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 INCLUDED_EDITENG_UNOEDHLP_HXX
21 #define INCLUDED_EDITENG_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
48 SvxEditSourceHint( sal_uLong nId
);
49 SvxEditSourceHint( sal_uLong nId
, sal_uLong nValue
, sal_Int32 nStart
=0, sal_Int32 nEnd
=0 );
51 sal_uLong
GetValue() const;
52 sal_Int32
GetStartValue() const { return mnStart
;}
53 sal_Int32
GetEndValue() const { return mnEnd
;}
55 class SvxEditSourceHintEndPara
:public SvxEditSourceHint
58 SvxEditSourceHintEndPara( sal_uInt32 nId
)
59 :SvxEditSourceHint(nId
) {}
60 SvxEditSourceHintEndPara( sal_uInt32 nId
, sal_uInt32 nValue
, sal_uInt32 nStart
=0, sal_uInt32 nEnd
=0 )
61 :SvxEditSourceHint(nId
,nValue
,nStart
){ (void)nEnd
; }
63 /** Helper class for common functionality in edit sources
65 class EDITENG_DLLPUBLIC SvxEditSourceHelper
69 /** Translates EditEngine notifications into broadcastable hints
72 Notification object send by the EditEngine.
74 @return the translated hint
76 static ::std::unique_ptr
<SfxHint
> EENotification2Hint( EENotify
* aNotify
);
78 /** Calculate attribute run for EditEngines
80 Please note that the range returned is half-open: [nStartIndex,nEndIndex)
83 Herein, the start index of the range of similar attributes is returned
86 Herein, the end index (exclusive) of the range of similar attributes is returned
89 The EditEngine to query for attributes
92 The paragraph the following index value is to be interpreted in
95 The character index from which the range of similar attributed characters is requested
97 @return true, if the range has been successfully determined
99 static bool GetAttributeRun( sal_Int32
& nStartIndex
, sal_Int32
& nEndIndex
, const EditEngine
& rEE
, sal_Int32 nPara
, sal_Int32 nIndex
, bool bInCell
= false);
101 /** Convert point from edit engine to user coordinate space
103 As the edit engine internally keeps vertical text unrotated,
104 all internal edit engine methods return their stuff unrotated,
105 too. This method rotates and shifts given point appropriately,
106 if vertical writing is on.
112 Paper size of the edit engine
115 Whether output text is vertical or not
117 @return the possibly transformed point
119 static Point
EEToUserSpace( const Point
& rPoint
, const Size
& rEESize
, bool bIsVertical
);
121 /** Convert point from user to edit engine coordinate space
123 As the edit engine internally keeps vertical text unrotated,
124 all internal edit engine methods return their stuff unrotated,
125 too. This method rotates and shifts given point appropriately,
126 if vertical writing is on.
132 Paper size of the edit engine
135 Whether output text is vertical or not
137 @return the possibly transformed point
139 static Point
UserSpaceToEE( const Point
& rPoint
, const Size
& rEESize
, bool bIsVertical
);
141 /** Convert rect from edit engine to user coordinate space
143 As the edit engine internally keeps vertical text unrotated,
144 all internal edit engine methods return their stuff unrotated,
145 too. This method rotates and shifts given rect appropriately,
146 if vertical writing is on.
149 Rectangle to transform
152 Paper size of the edit engine
155 Whether output text is vertical or not
157 @return the possibly transformed rect
159 static Rectangle
EEToUserSpace( const Rectangle
& rRect
, const Size
& rEESize
, bool bIsVertical
);
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */