tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sd / source / filter / eppt / text.hxx
blobee2fc537cd354db5cc6080a65eab378f140c01e3
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 #pragma once
22 #include "epptbase.hxx"
24 #include <com/sun/star/awt/FontDescriptor.hpp>
25 #include <com/sun/star/lang/Locale.hpp>
26 #include <editeng/svxenum.hxx>
27 #include <vector>
28 #include <memory>
30 namespace com::sun::star {
31 namespace awt { struct FontDescriptor; }
32 namespace beans { class XPropertyState; }
33 namespace text { class XTextRange; class XTextContent; class XSimpleText; }
34 namespace style { struct TabStop; }
37 struct SOParagraph
39 bool bExtendedParameters;
40 sal_uInt32 nParaFlags;
41 sal_Int16 nBulletFlags;
42 OUString sPrefix;
43 OUString sSuffix;
44 OUString sGraphicUrl; // String to a graphic
45 Size aBuGraSize;
46 SvxNumType nNumberingType;
47 sal_uInt32 nHorzAdjust;
48 sal_uInt32 nBulletColor;
49 sal_Int32 nBulletOfs;
50 sal_Int16 nStartWith; // start of numbering
51 sal_Int16 nTextOfs;
52 sal_Int16 nBulletRealSize; // scale in percent
53 sal_Int16 nDepth; // actual depth
54 sal_Unicode cBulletId; // if Numbering Type == CharSpecial
55 css::awt::FontDescriptor aFontDesc;
57 bool bExtendedBulletsUsed;
58 sal_uInt16 nBulletId;
59 sal_uInt32 nMappedNumType;
60 bool bNumberingIsNumber;
62 SOParagraph()
63 : bExtendedParameters(false)
64 , nParaFlags(0)
65 , nBulletFlags(0)
66 , nNumberingType(SVX_NUM_NUMBER_NONE)
67 , nHorzAdjust(0)
68 , nBulletColor(0)
69 , nBulletOfs(0)
70 , nStartWith(0)
71 , nTextOfs(0)
72 , nBulletRealSize(0)
73 , nDepth(0)
74 , cBulletId(0)
75 , bExtendedBulletsUsed(false)
76 , nBulletId(0xffff)
77 , nMappedNumType(0)
78 , bNumberingIsNumber(true)
83 class PropStateValue : public PropValue
85 public:
86 PropStateValue()
87 : PropValue()
88 , ePropState(css::beans::PropertyState_AMBIGUOUS_VALUE)
91 protected:
92 css::beans::PropertyState ePropState;
93 css::uno::Reference < css::beans::XPropertyState > mXPropState;
95 bool ImplGetPropertyValue( const OUString& rString, bool bGetPropertyState );
98 struct FieldEntry
100 sal_uInt32 nFieldType;
101 sal_uInt32 nFieldStartPos;
102 sal_uInt32 nFieldEndPos;
103 OUString aRepresentation;
104 OUString aFieldUrl;
106 FieldEntry( sal_uInt32 nType, sal_uInt32 nStart, sal_uInt32 nEnd )
107 : nFieldType(nType),
108 nFieldStartPos(nStart),
109 nFieldEndPos(nEnd)
114 class PortionObj final : public PropStateValue
117 friend class ParagraphObj;
119 void ImplClear();
120 void ImplConstruct( const PortionObj& rPortionObj );
121 static sal_uInt32 ImplGetTextField( css::uno::Reference< css::text::XTextRange > & rXTextRangeRef,
122 const css::uno::Reference< css::beans::XPropertySet > & rXPropSetRef, OUString& rURL );
123 sal_uInt32 ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition );
124 void ImplGetPortionValues( FontCollection& rFontCollection, bool bGetPropStateValue );
126 public:
128 css::beans::PropertyState meCharColor;
129 css::beans::PropertyState meCharHeight;
130 css::beans::PropertyState meFontName;
131 css::beans::PropertyState meAsianOrComplexFont;
132 css::beans::PropertyState meCharEscapement;
133 css::lang::Locale meCharLocale;
134 sal_uInt16 mnCharAttrHard;
136 sal_uInt32 mnCharColor;
137 sal_uInt16 mnCharAttr;
138 sal_uInt16 mnCharHeight;
139 sal_uInt16 mnFont;
140 sal_uInt16 mnAsianOrComplexFont;
141 sal_Int16 mnCharEscapement;
143 sal_uInt32 mnTextSize;
144 bool mbLastPortion;
146 std::unique_ptr<sal_uInt16[]> mpText;
147 std::unique_ptr<FieldEntry> mpFieldEntry;
149 PortionObj( css::uno::Reference< css::text::XTextRange > & rXTextRangeRef,
150 bool bLast, FontCollection& rFontCollection );
151 PortionObj( const css::uno::Reference< css::beans::XPropertySet > & rXPropSetRef,
152 FontCollection& rFontCollection );
153 PortionObj( const PortionObj& rPortionObj );
154 ~PortionObj();
156 void Write( SvStream* pStrm, bool bLast );
157 sal_uInt32 Count() const { return mnTextSize; };
159 PortionObj& operator=( const PortionObj& rPortionObj );
162 struct ParaFlags
164 bool bFirstParagraph : 1;
165 bool bLastParagraph : 1;
167 ParaFlags() { bFirstParagraph = true; bLastParagraph = false; };
170 class ParagraphObj : public PropStateValue, public SOParagraph
172 friend class TextObj;
173 friend struct PPTExParaSheet;
175 std::vector<std::unique_ptr<PortionObj> > mvPortions;
177 protected:
179 void ImplConstruct( const ParagraphObj& rParagraphObj );
180 void ImplClear();
181 sal_uInt32 ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition );
182 void ImplGetParagraphValues( PPTExBulletProvider* pBuProv, bool bGetPropStateValue );
183 void ImplGetNumberingLevel( PPTExBulletProvider* pBuProv, sal_Int16 nDepth, bool bIsBullet, bool bGetPropStateValue );
185 public:
187 css::uno::Sequence< css::style::TabStop > maTabStop;
189 sal_uInt32 mnTextSize;
191 bool mbIsBullet;
192 bool mbFirstParagraph;
193 bool mbLastParagraph;
195 css::beans::PropertyState meBullet;
196 css::beans::PropertyState meTextAdjust;
197 css::beans::PropertyState meLineSpacing;
198 css::beans::PropertyState meLineSpacingTop;
199 css::beans::PropertyState meLineSpacingBottom;
200 css::beans::PropertyState meForbiddenRules;
201 css::beans::PropertyState meParagraphPunctation;
202 css::beans::PropertyState meBiDi;
204 sal_uInt16 mnTextAdjust;
205 sal_Int16 mnLineSpacing;
206 bool mbFixedLineSpacing;
207 sal_Int16 mnLineSpacingTop;
208 sal_Int16 mnLineSpacingBottom;
209 bool mbForbiddenRules;
210 bool mbParagraphPunctation;
211 sal_uInt16 mnBiDi;
213 ParagraphObj( css::uno::Reference< css::text::XTextContent > const & rXTextContentRef,
214 ParaFlags, FontCollection& rFontCollection,
215 PPTExBulletProvider& rBuProv );
216 ParagraphObj( const ParagraphObj& rParargraphObj ) = delete;
217 ParagraphObj( const css::uno::Reference< css::beans::XPropertySet > & rXPropSetRef,
218 PPTExBulletProvider* pBuProv );
220 bool empty() const { return mvPortions.empty(); }
222 const PortionObj& front() const { return *mvPortions.front(); }
224 std::vector<std::unique_ptr<PortionObj> >::const_iterator begin() const { return mvPortions.begin(); }
225 std::vector<std::unique_ptr<PortionObj> >::const_iterator end() const { return mvPortions.end(); }
227 void CalculateGraphicBulletSize( sal_uInt16 nFontHeight );
228 ~ParagraphObj();
230 void Write( SvStream* pStrm );
231 sal_uInt32 CharacterCount() const { return mnTextSize; };
233 ParagraphObj& operator=( const ParagraphObj& rParagraphObj );
236 struct ImplTextObj;
238 class TextObj
240 std::shared_ptr<ImplTextObj> mpImplTextObj;
241 void ImplCalculateTextPositions();
243 public:
244 TextObj( css::uno::Reference< css::text::XSimpleText > const &
245 rXText, int nInstance, FontCollection& rFontCollection, PPTExBulletProvider& rBuProv );
247 ParagraphObj* GetParagraph(int idx);
248 sal_uInt32 ParagraphCount() const;
249 sal_uInt32 Count() const;
250 int GetInstance() const;
251 bool HasExtendedBullets() const;
254 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */