bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / source / filter / eppt / text.hxx
blob7de5741c87eccb28deba5a73a0e64f8fe669bb99
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_SD_SOURCE_FILTER_EPPT_TEXT_HXX
21 #define INCLUDED_SD_SOURCE_FILTER_EPPT_TEXT_HXX
23 #include "epptbase.hxx"
25 #include <com/sun/star/awt/FontDescriptor.hpp>
26 #include <com/sun/star/lang/Locale.hpp>
27 #include <editeng/svxenum.hxx>
28 #include <vector>
29 #include <memory>
31 namespace com { namespace sun { namespace star {
32 namespace awt { struct FontDescriptor; }
33 namespace beans { class XPropertyState; }
34 namespace text { class XTextRange; class XTextContent; class XSimpleText; }
35 namespace style { struct TabStop; }
36 }}}
38 struct SOParagraph
40 bool bExtendedParameters;
41 sal_uInt32 nParaFlags;
42 sal_Int16 nBulletFlags;
43 OUString sPrefix;
44 OUString sSuffix;
45 OUString sGraphicUrl; // String to a graphic
46 Size aBuGraSize;
47 SvxNumType nNumberingType;
48 sal_uInt32 nHorzAdjust;
49 sal_uInt32 nBulletColor;
50 sal_Int32 nBulletOfs;
51 sal_Int16 nStartWith; // start of numbering
52 sal_Int16 nTextOfs;
53 sal_Int16 nBulletRealSize; // scale in percent
54 sal_Int16 nDepth; // actual depth
55 sal_Unicode cBulletId; // if Numbering Type == CharSpecial
56 css::awt::FontDescriptor aFontDesc;
58 bool bExtendedBulletsUsed;
59 sal_uInt16 nBulletId;
60 sal_uInt32 nMappedNumType;
61 bool bNumberingIsNumber;
63 SOParagraph()
64 : bExtendedParameters(false)
65 , nParaFlags(0)
66 , nBulletFlags(0)
67 , nNumberingType(SVX_NUM_NUMBER_NONE)
68 , nHorzAdjust(0)
69 , nBulletColor(0)
70 , nBulletOfs(0)
71 , nStartWith(0)
72 , nTextOfs(0)
73 , nBulletRealSize(0)
74 , nDepth(0)
75 , cBulletId(0)
76 , bExtendedBulletsUsed(false)
77 , nBulletId(0xffff)
78 , nMappedNumType(0)
79 , bNumberingIsNumber(true)
84 class PropStateValue : public PropValue
86 public:
87 PropStateValue()
88 : PropValue()
89 , ePropState(css::beans::PropertyState_AMBIGUOUS_VALUE)
92 protected:
93 css::beans::PropertyState ePropState;
94 css::uno::Reference < css::beans::XPropertyState > mXPropState;
96 bool ImplGetPropertyValue( const OUString& rString, bool bGetPropertyState );
99 struct FieldEntry
101 sal_uInt32 nFieldType;
102 sal_uInt32 nFieldStartPos;
103 sal_uInt32 nFieldEndPos;
104 OUString aRepresentation;
105 OUString aFieldUrl;
107 FieldEntry( sal_uInt32 nType, sal_uInt32 nStart, sal_uInt32 nEnd )
109 nFieldType = nType;
110 nFieldStartPos = nStart;
111 nFieldEndPos = nEnd;
115 class PortionObj final : public PropStateValue
118 friend class ParagraphObj;
120 void ImplClear();
121 void ImplConstruct( const PortionObj& rPortionObj );
122 static sal_uInt32 ImplGetTextField( css::uno::Reference< css::text::XTextRange > & rXTextRangeRef,
123 const css::uno::Reference< css::beans::XPropertySet > & rXPropSetRef, OUString& rURL );
124 sal_uInt32 ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition );
125 void ImplGetPortionValues( FontCollection& rFontCollection, bool bGetPropStateValue );
127 public:
129 css::beans::PropertyState meCharColor;
130 css::beans::PropertyState meCharHeight;
131 css::beans::PropertyState meFontName;
132 css::beans::PropertyState meAsianOrComplexFont;
133 css::beans::PropertyState meCharEscapement;
134 css::lang::Locale meCharLocale;
135 sal_uInt16 mnCharAttrHard;
137 sal_uInt32 mnCharColor;
138 sal_uInt16 mnCharAttr;
139 sal_uInt16 mnCharHeight;
140 sal_uInt16 mnFont;
141 sal_uInt16 mnAsianOrComplexFont;
142 sal_Int16 mnCharEscapement;
144 sal_uInt32 mnTextSize;
145 bool mbLastPortion;
147 std::unique_ptr<sal_uInt16[]> mpText;
148 std::unique_ptr<FieldEntry> mpFieldEntry;
150 PortionObj( css::uno::Reference< css::text::XTextRange > & rXTextRangeRef,
151 bool bLast, FontCollection& rFontCollection );
152 PortionObj( const css::uno::Reference< css::beans::XPropertySet > & rXPropSetRef,
153 FontCollection& rFontCollection );
154 PortionObj( const PortionObj& rPortionObj );
155 ~PortionObj();
157 void Write( SvStream* pStrm, bool bLast );
158 sal_uInt32 Count() const { return mnTextSize; };
160 PortionObj& operator=( const PortionObj& rPortionObj );
163 struct ParaFlags
165 bool bFirstParagraph : 1;
166 bool bLastParagraph : 1;
168 ParaFlags() { bFirstParagraph = true; bLastParagraph = false; };
171 class ParagraphObj : public PropStateValue, public SOParagraph
173 friend class TextObj;
174 friend struct PPTExParaSheet;
176 std::vector<std::unique_ptr<PortionObj> > mvPortions;
178 protected:
180 void ImplConstruct( const ParagraphObj& rParagraphObj );
181 void ImplClear();
182 sal_uInt32 ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition );
183 void ImplGetParagraphValues( PPTExBulletProvider* pBuProv, bool bGetPropStateValue );
184 void ImplGetNumberingLevel( PPTExBulletProvider* pBuProv, sal_Int16 nDepth, bool bIsBullet, bool bGetPropStateValue );
186 public:
188 css::uno::Sequence< css::style::TabStop > maTabStop;
190 sal_uInt32 mnTextSize;
192 bool mbIsBullet;
193 bool mbFirstParagraph;
194 bool mbLastParagraph;
196 css::beans::PropertyState meBullet;
197 css::beans::PropertyState meTextAdjust;
198 css::beans::PropertyState meLineSpacing;
199 css::beans::PropertyState meLineSpacingTop;
200 css::beans::PropertyState meLineSpacingBottom;
201 css::beans::PropertyState meForbiddenRules;
202 css::beans::PropertyState meParagraphPunctation;
203 css::beans::PropertyState meBiDi;
205 sal_uInt16 mnTextAdjust;
206 sal_Int16 mnLineSpacing;
207 bool mbFixedLineSpacing;
208 sal_Int16 mnLineSpacingTop;
209 sal_Int16 mnLineSpacingBottom;
210 bool mbForbiddenRules;
211 bool mbParagraphPunctation;
212 sal_uInt16 mnBiDi;
214 ParagraphObj( css::uno::Reference< css::text::XTextContent > const & rXTextContentRef,
215 ParaFlags, FontCollection& rFontCollection,
216 PPTExBulletProvider& rBuProv );
217 ParagraphObj( const ParagraphObj& rParargraphObj ) = delete;
218 ParagraphObj( const css::uno::Reference< css::beans::XPropertySet > & rXPropSetRef,
219 PPTExBulletProvider* pBuProv );
221 bool empty() const { return mvPortions.empty(); }
223 const PortionObj& front() const { return *mvPortions.front().get(); }
225 std::vector<std::unique_ptr<PortionObj> >::const_iterator begin() const { return mvPortions.begin(); }
226 std::vector<std::unique_ptr<PortionObj> >::const_iterator end() const { return mvPortions.end(); }
228 void CalculateGraphicBulletSize( sal_uInt16 nFontHeight );
229 ~ParagraphObj();
231 void Write( SvStream* pStrm );
232 sal_uInt32 CharacterCount() const { return mnTextSize; };
234 ParagraphObj& operator=( const ParagraphObj& rParagraphObj );
237 struct ImplTextObj;
239 class TextObj
241 std::shared_ptr<ImplTextObj> mpImplTextObj;
242 void ImplCalculateTextPositions();
244 public:
245 TextObj( css::uno::Reference< css::text::XSimpleText > const &
246 rXText, int nInstance, FontCollection& rFontCollection, PPTExBulletProvider& rBuProv );
248 ParagraphObj* GetParagraph(int idx);
249 sal_uInt32 ParagraphCount() const;
250 sal_uInt32 Count() const;
251 int GetInstance() const;
252 bool HasExtendedBullets();
255 #endif
257 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */