nss: upgrade to release 3.73
[LibreOffice.git] / include / editeng / unoedhlp.hxx
blob24a9105453dab6c060776d9e391494fc30c85269
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_EDITENG_UNOEDHLP_HXX
21 #define INCLUDED_EDITENG_UNOEDHLP_HXX
23 #include <memory>
24 #include <tools/solar.h>
25 #include <vcl/textdata.hxx>
26 #include <svl/hint.hxx>
27 #include <tools/gen.hxx>
28 #include <editeng/editengdllapi.h>
30 struct EENotify;
31 class EditEngine;
33 /** Extends TextHint by two additional parameters which are necessary
34 for the SfxHintId::EditSourceParasMoved hint. TextHint's value in this
35 case denotes the destination position, the two parameters the
36 start and the end of the moved paragraph range.
38 class SAL_DLLPUBLIC_RTTI SvxEditSourceHint : public TextHint
40 private:
41 sal_Int32 mnStart;
42 sal_Int32 mnEnd;
44 public:
45 SvxEditSourceHint( SfxHintId nId );
46 SvxEditSourceHint( SfxHintId nId, sal_uLong nValue, sal_Int32 nStart, sal_Int32 nEnd );
48 using TextHint::GetValue;
49 sal_Int32 GetStartValue() const { return mnStart;}
50 sal_Int32 GetEndValue() const { return mnEnd;}
52 class SvxEditSourceHintEndPara final : public SvxEditSourceHint
54 public:
55 SvxEditSourceHintEndPara() : SvxEditSourceHint(SfxHintId::EditSourceSelectionChanged) {}
57 /** Helper class for common functionality in edit sources
59 class EDITENG_DLLPUBLIC SvxEditSourceHelper
61 public:
63 /** Translates EditEngine notifications into broadcastable hints
65 @param aNotify
66 Notification object sent by the EditEngine.
68 @return the translated hint
70 static ::std::unique_ptr<SfxHint> EENotification2Hint( EENotify const * aNotify );
72 /** Calculate attribute run for EditEngines
74 Please note that the range returned is half-open: [nStartIndex,nEndIndex)
76 @param nStartIndex
77 Herein, the start index of the range of similar attributes is returned
79 @param nEndIndex
80 Herein, the end index (exclusive) of the range of similar attributes is returned
82 @param rEE
83 The EditEngine to query for attributes
85 @param nPara
86 The paragraph the following index value is to be interpreted in
88 @param nIndex
89 The character index from which the range of similar attributed characters is requested
91 static void GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, const EditEngine& rEE, sal_Int32 nPara, sal_Int32 nIndex, bool bInCell = false);
93 /** Convert point from edit engine to user coordinate space
95 As the edit engine internally keeps vertical text unrotated,
96 all internal edit engine methods return their stuff unrotated,
97 too. This method rotates and shifts given point appropriately,
98 if vertical writing is on.
100 @param rPoint
101 Point to transform
103 @param rEESize
104 Paper size of the edit engine
106 @param bIsVertical
107 Whether output text is vertical or not
109 @return the possibly transformed point
111 static Point EEToUserSpace( const Point& rPoint, const Size& rEESize, bool bIsVertical );
113 /** Convert point from user to edit engine coordinate space
115 As the edit engine internally keeps vertical text unrotated,
116 all internal edit engine methods return their stuff unrotated,
117 too. This method rotates and shifts given point appropriately,
118 if vertical writing is on.
120 @param rPoint
121 Point to transform
123 @param rEESize
124 Paper size of the edit engine
126 @param bIsVertical
127 Whether output text is vertical or not
129 @return the possibly transformed point
131 static Point UserSpaceToEE( const Point& rPoint, const Size& rEESize, bool bIsVertical );
133 /** Convert rect from edit engine to user coordinate space
135 As the edit engine internally keeps vertical text unrotated,
136 all internal edit engine methods return their stuff unrotated,
137 too. This method rotates and shifts given rect appropriately,
138 if vertical writing is on.
140 @param rRect
141 Rectangle to transform
143 @param rEESize
144 Paper size of the edit engine
146 @param bIsVertical
147 Whether output text is vertical or not
149 @return the possibly transformed rect
151 static tools::Rectangle EEToUserSpace( const tools::Rectangle& rRect, const Size& rEESize, bool bIsVertical );
155 #endif
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */