Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SVX_UNOEDHLP_HXX
30 : : #define _SVX_UNOEDHLP_HXX
31 : :
32 : : #include <memory>
33 : : #include <tools/solar.h>
34 : : #include <vcl/textdata.hxx>
35 : : #include <svl/hint.hxx>
36 : : #include <tools/gen.hxx>
37 : : #include "editeng/editengdllapi.h"
38 : :
39 : : struct EENotify;
40 : : class EditEngine;
41 : :
42 : : #define EDITSOURCE_HINT_PARASMOVED 20
43 : : #define EDITSOURCE_HINT_SELECTIONCHANGED 21
44 : :
45 : : /** Extends TextHint by two additional parameters which are necessary
46 : : for the EDITSOURCE_HINT_PARASMOVED hint. TextHint's value in this
47 : : case denotes the destination position, the two parameters the
48 : : start and the end of the moved paragraph range.
49 : : */
50 [ # # ]: 0 : class EDITENG_DLLPUBLIC SvxEditSourceHint : public TextHint
51 : : {
52 : : private:
53 : : sal_uLong mnStart;
54 : : sal_uLong mnEnd;
55 : :
56 : : public:
57 : : TYPEINFO();
58 : : SvxEditSourceHint( sal_uLong nId );
59 : : SvxEditSourceHint( sal_uLong nId, sal_uLong nValue, sal_uLong nStart=0, sal_uLong nEnd=0 );
60 : :
61 : : sal_uLong GetValue() const;
62 : : sal_uLong GetStartValue() const;
63 : : sal_uLong GetEndValue() const;
64 : : };
65 : :
66 : : /** Helper class for common functionality in edit sources
67 : : */
68 : : class EDITENG_DLLPUBLIC SvxEditSourceHelper
69 : : {
70 : : public:
71 : :
72 : : /** Translates EditEngine notifications into broadcastable hints
73 : :
74 : : @param aNotify
75 : : Notification object send by the EditEngine.
76 : :
77 : : @return the translated hint
78 : : */
79 : : SAL_WNODEPRECATED_DECLARATIONS_PUSH
80 : : static ::std::auto_ptr<SfxHint> EENotification2Hint( EENotify* aNotify );
81 : : SAL_WNODEPRECATED_DECLARATIONS_POP
82 : :
83 : : /** Calculate attribute run for EditEngines
84 : :
85 : : Please note that the range returned is half-open: [nStartIndex,nEndIndex)
86 : :
87 : : @param nStartIndex
88 : : Herein, the start index of the range of similar attributes is returned
89 : :
90 : : @param nEndIndex
91 : : Herein, the end index (exclusive) of the range of similar attributes is returned
92 : :
93 : : @param rEE
94 : : The EditEngine to query for attributes
95 : :
96 : : @param nPara
97 : : The paragraph the following index value is to be interpreted in
98 : :
99 : : @param nIndex
100 : : The character index from which the range of similar attributed characters is requested
101 : :
102 : : @return sal_True, if the range has been successfully determined
103 : : */
104 : : static sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, const EditEngine& rEE, sal_uInt16 nPara, sal_uInt16 nIndex );
105 : :
106 : : /** Convert point from edit engine to user coordinate space
107 : :
108 : : As the edit engine internally keeps vertical text unrotated,
109 : : all internal edit engine methods return their stuff unrotated,
110 : : too. This method rotates and shifts given point appropriately,
111 : : if vertical writing is on.
112 : :
113 : : @param rPoint
114 : : Point to transform
115 : :
116 : : @param rEESize
117 : : Paper size of the edit engine
118 : :
119 : : @param bIsVertical
120 : : Whether output text is vertical or not
121 : :
122 : : @return the possibly transformed point
123 : : */
124 : : static Point EEToUserSpace( const Point& rPoint, const Size& rEESize, bool bIsVertical );
125 : :
126 : : /** Convert point from user to edit engine coordinate space
127 : :
128 : : As the edit engine internally keeps vertical text unrotated,
129 : : all internal edit engine methods return their stuff unrotated,
130 : : too. This method rotates and shifts given point appropriately,
131 : : if vertical writing is on.
132 : :
133 : : @param rPoint
134 : : Point to transform
135 : :
136 : : @param rEESize
137 : : Paper size of the edit engine
138 : :
139 : : @param bIsVertical
140 : : Whether output text is vertical or not
141 : :
142 : : @return the possibly transformed point
143 : : */
144 : : static Point UserSpaceToEE( const Point& rPoint, const Size& rEESize, bool bIsVertical );
145 : :
146 : : /** Convert rect from edit engine to user coordinate space
147 : :
148 : : As the edit engine internally keeps vertical text unrotated,
149 : : all internal edit engine methods return their stuff unrotated,
150 : : too. This method rotates and shifts given rect appropriately,
151 : : if vertical writing is on.
152 : :
153 : : @param rRect
154 : : Rectangle to transform
155 : :
156 : : @param rEESize
157 : : Paper size of the edit engine
158 : :
159 : : @param bIsVertical
160 : : Whether output text is vertical or not
161 : :
162 : : @return the possibly transformed rect
163 : : */
164 : : static Rectangle EEToUserSpace( const Rectangle& rRect, const Size& rEESize, bool bIsVertical );
165 : :
166 : : };
167 : :
168 : : #endif
169 : :
170 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|