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 <vcl/textdata.hxx>
25 #include <svl/hint.hxx>
26 #include <tools/gen.hxx>
27 #include <editeng/editengdllapi.h>
32 /** Extends TextHint by two additional parameters which are necessary
33 for the SfxHintId::EditSourceParasMoved hint. TextHint's value in this
34 case denotes the destination position, the two parameters the
35 start and the end of the moved paragraph range.
37 class SAL_DLLPUBLIC_RTTI SvxEditSourceHint
: public TextHint
44 SvxEditSourceHint( SfxHintId nId
);
45 SvxEditSourceHint( SfxHintId nId
, sal_Int32 nValue
, sal_Int32 nStart
, sal_Int32 nEnd
);
47 using TextHint::GetValue
;
48 sal_Int32
GetStartValue() const { return mnStart
;}
49 sal_Int32
GetEndValue() const { return mnEnd
;}
51 class SvxEditSourceHintEndPara final
: public SvxEditSourceHint
54 SvxEditSourceHintEndPara() : SvxEditSourceHint(SfxHintId::EditSourceSelectionChanged
) {}
56 /** Helper class for common functionality in edit sources
58 class EDITENG_DLLPUBLIC SvxEditSourceHelper
62 /** Translates EditEngine notifications into broadcastable hints
65 Notification object sent by the EditEngine.
67 @return the translated hint
69 static ::std::unique_ptr
<SfxHint
> EENotification2Hint( EENotify
const * aNotify
);
71 /** Calculate attribute run for EditEngines
73 Please note that the range returned is half-open: [nStartIndex,nEndIndex)
76 Herein, the start index of the range of similar attributes is returned
79 Herein, the end index (exclusive) of the range of similar attributes is returned
82 The EditEngine to query for attributes
85 The paragraph the following index value is to be interpreted in
88 The character index from which the range of similar attributed characters is requested
90 static void GetAttributeRun( sal_Int32
& nStartIndex
, sal_Int32
& nEndIndex
, const EditEngine
& rEE
, sal_Int32 nPara
, sal_Int32 nIndex
, bool bInCell
= false);
92 /** Convert point from edit engine to user coordinate space
94 As the edit engine internally keeps vertical text unrotated,
95 all internal edit engine methods return their stuff unrotated,
96 too. This method rotates and shifts given point appropriately,
97 if vertical writing is on.
103 Paper size of the edit engine
106 Whether output text is vertical or not
108 @return the possibly transformed point
110 static Point
EEToUserSpace( const Point
& rPoint
, const Size
& rEESize
, bool bIsVertical
);
112 /** Convert point from user to edit engine coordinate space
114 As the edit engine internally keeps vertical text unrotated,
115 all internal edit engine methods return their stuff unrotated,
116 too. This method rotates and shifts given point appropriately,
117 if vertical writing is on.
123 Paper size of the edit engine
126 Whether output text is vertical or not
128 @return the possibly transformed point
130 static Point
UserSpaceToEE( const Point
& rPoint
, const Size
& rEESize
, bool bIsVertical
);
132 /** Convert rect from edit engine to user coordinate space
134 As the edit engine internally keeps vertical text unrotated,
135 all internal edit engine methods return their stuff unrotated,
136 too. This method rotates and shifts given rect appropriately,
137 if vertical writing is on.
140 Rectangle to transform
143 Paper size of the edit engine
146 Whether output text is vertical or not
148 @return the possibly transformed rect
150 static tools::Rectangle
EEToUserSpace( const tools::Rectangle
& rRect
, const Size
& rEESize
, bool bIsVertical
);
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */