tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / include / editeng / unoedhlp.hxx
blob5b70de35ca55d941e8f0c96493aa93976c05ab0a
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 <vcl/textdata.hxx>
25 #include <svl/hint.hxx>
26 #include <tools/gen.hxx>
27 #include <editeng/editengdllapi.h>
29 struct EENotify;
30 class EditEngine;
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
39 private:
40 sal_Int32 mnStart;
41 sal_Int32 mnEnd;
43 public:
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
53 public:
54 SvxEditSourceHintEndPara() : SvxEditSourceHint(SfxHintId::EditSourceSelectionChanged) {}
56 /** Helper class for common functionality in edit sources
58 class EDITENG_DLLPUBLIC SvxEditSourceHelper
60 public:
62 /** Translates EditEngine notifications into broadcastable hints
64 @param aNotify
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)
75 @param nStartIndex
76 Herein, the start index of the range of similar attributes is returned
78 @param nEndIndex
79 Herein, the end index (exclusive) of the range of similar attributes is returned
81 @param rEE
82 The EditEngine to query for attributes
84 @param nPara
85 The paragraph the following index value is to be interpreted in
87 @param nIndex
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.
99 @param rPoint
100 Point to transform
102 @param rEESize
103 Paper size of the edit engine
105 @param bIsVertical
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.
119 @param rPoint
120 Point to transform
122 @param rEESize
123 Paper size of the edit engine
125 @param bIsVertical
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.
139 @param rRect
140 Rectangle to transform
142 @param rEESize
143 Paper size of the edit engine
145 @param bIsVertical
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 );
154 #endif
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */