1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 _SVX_UNOEDHLP_HXX
21 #define _SVX_UNOEDHLP_HXX
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"
33 #define EDITSOURCE_HINT_PARASMOVED 20
34 #define EDITSOURCE_HINT_SELECTIONCHANGED 21
36 /** Extends TextHint by two additional parameters which are necessary
37 for the EDITSOURCE_HINT_PARASMOVED hint. TextHint's value in this
38 case denotes the destination position, the two parameters the
39 start and the end of the moved paragraph range.
41 class EDITENG_DLLPUBLIC SvxEditSourceHint
: public TextHint
49 SvxEditSourceHint( sal_uLong nId
);
50 SvxEditSourceHint( sal_uLong nId
, sal_uLong nValue
, sal_Int32 nStart
=0, sal_Int32 nEnd
=0 );
52 sal_uLong
GetValue() const;
53 sal_Int32
GetStartValue() const;
54 sal_Int32
GetEndValue() const;
57 /** Helper class for common functionality in edit sources
59 class EDITENG_DLLPUBLIC SvxEditSourceHelper
63 /** Translates EditEngine notifications into broadcastable hints
66 Notification object send by the EditEngine.
68 @return the translated hint
70 SAL_WNODEPRECATED_DECLARATIONS_PUSH
71 static ::std::auto_ptr
<SfxHint
> EENotification2Hint( EENotify
* aNotify
);
72 SAL_WNODEPRECATED_DECLARATIONS_POP
74 /** Calculate attribute run for EditEngines
76 Please note that the range returned is half-open: [nStartIndex,nEndIndex)
79 Herein, the start index of the range of similar attributes is returned
82 Herein, the end index (exclusive) of the range of similar attributes is returned
85 The EditEngine to query for attributes
88 The paragraph the following index value is to be interpreted in
91 The character index from which the range of similar attributed characters is requested
93 @return sal_True, if the range has been successfully determined
95 static sal_Bool
GetAttributeRun( sal_uInt16
& nStartIndex
, sal_uInt16
& nEndIndex
, const EditEngine
& rEE
, sal_Int32 nPara
, sal_uInt16 nIndex
);
97 /** Convert point from edit engine to user coordinate space
99 As the edit engine internally keeps vertical text unrotated,
100 all internal edit engine methods return their stuff unrotated,
101 too. This method rotates and shifts given point appropriately,
102 if vertical writing is on.
108 Paper size of the edit engine
111 Whether output text is vertical or not
113 @return the possibly transformed point
115 static Point
EEToUserSpace( const Point
& rPoint
, const Size
& rEESize
, bool bIsVertical
);
117 /** Convert point from user to edit engine coordinate space
119 As the edit engine internally keeps vertical text unrotated,
120 all internal edit engine methods return their stuff unrotated,
121 too. This method rotates and shifts given point appropriately,
122 if vertical writing is on.
128 Paper size of the edit engine
131 Whether output text is vertical or not
133 @return the possibly transformed point
135 static Point
UserSpaceToEE( const Point
& rPoint
, const Size
& rEESize
, bool bIsVertical
);
137 /** Convert rect from edit engine to user coordinate space
139 As the edit engine internally keeps vertical text unrotated,
140 all internal edit engine methods return their stuff unrotated,
141 too. This method rotates and shifts given rect appropriately,
142 if vertical writing is on.
145 Rectangle to transform
148 Paper size of the edit engine
151 Whether output text is vertical or not
153 @return the possibly transformed rect
155 static Rectangle
EEToUserSpace( const Rectangle
& rRect
, const Size
& rEESize
, bool bIsVertical
);
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */