Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_SD_SOURCE_FILTER_EPPT_TEXT_HXX
21 : #define INCLUDED_SD_SOURCE_FILTER_EPPT_TEXT_HXX
22 :
23 : #include "epptbase.hxx"
24 : #include "epptdef.hxx"
25 :
26 : #include <rtl/textenc.h>
27 : #include <com/sun/star/awt/FontDescriptor.hpp>
28 : #include <com/sun/star/lang/Locale.hpp>
29 : #include <editeng/svxenum.hxx>
30 : #include <boost/ptr_container/ptr_vector.hpp>
31 : #include <boost/shared_ptr.hpp>
32 :
33 : namespace com { namespace sun { namespace star {
34 : namespace awt { struct FontDescriptor; }
35 : namespace beans { class XPropertyState; }
36 : namespace text { class XTextRange; class XTextContent; class XSimpleText; }
37 : namespace style { struct TabStop; }
38 : }}}
39 :
40 778 : struct SOParagraph
41 : {
42 : bool bExtendedParameters;
43 : sal_uInt32 nParaFlags;
44 : sal_Int16 nBulletFlags;
45 : OUString sPrefix;
46 : OUString sSuffix;
47 : OUString sGraphicUrl; // String to a graphic
48 : Size aBuGraSize;
49 : sal_uInt32 nNumberingType; // this is actually a SvxEnum
50 : sal_uInt32 nHorzAdjust;
51 : sal_uInt32 nBulletColor;
52 : sal_Int32 nBulletOfs;
53 : sal_Int16 nStartWith; // start of numbering
54 : sal_Int16 nTextOfs;
55 : sal_Int16 nBulletRealSize; // scale in percent
56 : sal_Int16 nDepth; // actual depth
57 : sal_Unicode cBulletId; // if Numbering Type == CharSpecial
58 : ::com::sun::star::awt::FontDescriptor aFontDesc;
59 :
60 : bool bExtendedBulletsUsed;
61 : sal_uInt16 nBulletId;
62 : sal_uInt32 nMappedNumType;
63 : bool bNumberingIsNumber;
64 :
65 778 : SOParagraph()
66 : : bExtendedParameters(false)
67 : , nParaFlags(0)
68 : , nBulletFlags(0)
69 : , nNumberingType(SVX_NUM_NUMBER_NONE)
70 : , nHorzAdjust(0)
71 : , nBulletColor(0)
72 : , nBulletOfs(0)
73 : , nStartWith(0)
74 : , nTextOfs(0)
75 : , nBulletRealSize(0)
76 : , nDepth(0)
77 : , cBulletId(0)
78 : , bExtendedBulletsUsed(false)
79 : , nBulletId(0xffff)
80 : , nMappedNumType(0)
81 778 : , bNumberingIsNumber(true)
82 : {
83 778 : }
84 : };
85 :
86 1556 : class PropStateValue : public PropValue
87 : {
88 : public:
89 1556 : PropStateValue()
90 : : PropValue()
91 1556 : , ePropState(css::beans::PropertyState_AMBIGUOUS_VALUE)
92 : {
93 1556 : }
94 : protected:
95 : css::beans::PropertyState ePropState;
96 : css::uno::Reference < css::beans::XPropertyState > mXPropState;
97 :
98 : bool ImplGetPropertyValue( const OUString& rString, bool bGetPropertyState = true );
99 : };
100 :
101 21 : struct FieldEntry
102 : {
103 : sal_uInt32 nFieldType;
104 : sal_uInt32 nFieldStartPos;
105 : sal_uInt32 nFieldEndPos;
106 : OUString aRepresentation;
107 : OUString aFieldUrl;
108 :
109 21 : FieldEntry( sal_uInt32 nType, sal_uInt32 nStart, sal_uInt32 nEnd )
110 21 : {
111 21 : nFieldType = nType;
112 21 : nFieldStartPos = nStart;
113 21 : nFieldEndPos = nEnd;
114 21 : }
115 : };
116 :
117 : class PortionObj : public PropStateValue
118 : {
119 :
120 : friend class ParagraphObj;
121 :
122 : protected :
123 :
124 : void ImplClear();
125 : void ImplConstruct( const PortionObj& rPortionObj );
126 : static sal_uInt32 ImplGetTextField( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & rXTextRangeRef,
127 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef, OUString& rURL );
128 : sal_uInt32 ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition );
129 : void ImplGetPortionValues( FontCollection& rFontCollection, bool bGetPropStateValue = false );
130 :
131 : public :
132 :
133 : ::com::sun::star::beans::PropertyState meCharColor;
134 : ::com::sun::star::beans::PropertyState meCharHeight;
135 : ::com::sun::star::beans::PropertyState meFontName;
136 : ::com::sun::star::beans::PropertyState meAsianOrComplexFont;
137 : ::com::sun::star::beans::PropertyState meCharEscapement;
138 : ::com::sun::star::lang::Locale meCharLocale;
139 : sal_uInt16 mnCharAttrHard;
140 :
141 : sal_uInt32 mnCharColor;
142 : sal_uInt16 mnCharAttr;
143 : sal_uInt16 mnCharHeight;
144 : sal_uInt16 mnFont;
145 : sal_uInt16 mnAsianOrComplexFont;
146 : sal_Int16 mnCharEscapement;
147 :
148 : sal_uInt32 mnTextSize;
149 : bool mbLastPortion;
150 :
151 : sal_uInt16* mpText;
152 : FieldEntry* mpFieldEntry;
153 :
154 : PortionObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & rXTextRangeRef,
155 : bool bLast, FontCollection& rFontCollection );
156 : PortionObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef,
157 : FontCollection& rFontCollection );
158 : PortionObj( const PortionObj& rPortionObj );
159 : ~PortionObj();
160 :
161 : void Write( SvStream* pStrm, bool bLast );
162 74 : sal_uInt32 Count() const { return mnTextSize; };
163 :
164 : PortionObj& operator=( const PortionObj& rPortionObj );
165 : };
166 :
167 : struct ParaFlags
168 : {
169 : bool bFirstParagraph : 1;
170 : bool bLastParagraph : 1;
171 :
172 35 : ParaFlags() { bFirstParagraph = true; bLastParagraph = false; };
173 : };
174 :
175 : class ParagraphObj : public PropStateValue, public SOParagraph
176 : {
177 : friend class TextObj;
178 : friend struct PPTExParaSheet;
179 :
180 : boost::ptr_vector<PortionObj> mvPortions;
181 : MapMode maMapModeSrc;
182 : MapMode maMapModeDest;
183 :
184 : protected :
185 :
186 : void ImplConstruct( const ParagraphObj& rParagraphObj );
187 : void ImplClear();
188 : sal_uInt32 ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition );
189 : void ImplGetParagraphValues( PPTExBulletProvider* pBuProv, bool bGetPropStateValue = false );
190 : void ImplGetNumberingLevel( PPTExBulletProvider* pBuProv, sal_Int16 nDepth, bool bIsBullet, bool bGetPropStateValue = false );
191 :
192 : public :
193 :
194 : ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > maTabStop;
195 :
196 : sal_uInt32 mnTextSize;
197 :
198 : bool mbIsBullet;
199 : bool mbFirstParagraph;
200 : bool mbLastParagraph;
201 :
202 : ::com::sun::star::beans::PropertyState meBullet;
203 : ::com::sun::star::beans::PropertyState meTextAdjust;
204 : ::com::sun::star::beans::PropertyState meLineSpacing;
205 : ::com::sun::star::beans::PropertyState meLineSpacingTop;
206 : ::com::sun::star::beans::PropertyState meLineSpacingBottom;
207 : ::com::sun::star::beans::PropertyState meForbiddenRules;
208 : ::com::sun::star::beans::PropertyState meParagraphPunctation;
209 : ::com::sun::star::beans::PropertyState meBiDi;
210 :
211 : sal_uInt16 mnTextAdjust;
212 : sal_Int16 mnLineSpacing;
213 : bool mbFixedLineSpacing;
214 : sal_Int16 mnLineSpacingTop;
215 : sal_Int16 mnLineSpacingBottom;
216 : bool mbForbiddenRules;
217 : bool mbParagraphPunctation;
218 : sal_uInt16 mnBiDi;
219 :
220 : ParagraphObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > & rXTextContentRef,
221 : ParaFlags, FontCollection& rFontCollection,
222 : PPTExBulletProvider& rBuProv );
223 : ParagraphObj( const ParagraphObj& rParargraphObj );
224 : ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef,
225 : PPTExBulletProvider* pBuProv );
226 :
227 35 : bool empty() const { return mvPortions.empty(); }
228 :
229 56 : const PortionObj& front() const { return mvPortions.front(); }
230 :
231 63 : boost::ptr_vector<PortionObj>::const_iterator begin() const { return mvPortions.begin(); }
232 105 : boost::ptr_vector<PortionObj>::const_iterator end() const { return mvPortions.end(); }
233 :
234 : void CalculateGraphicBulletSize( sal_uInt16 nFontHeight );
235 : ~ParagraphObj();
236 :
237 : void Write( SvStream* pStrm );
238 42 : sal_uInt32 CharacterCount() const { return mnTextSize; };
239 :
240 : ParagraphObj& operator=( const ParagraphObj& rParagraphObj );
241 : };
242 :
243 : struct ImplTextObj;
244 :
245 35 : class TextObj
246 : {
247 : boost::shared_ptr<ImplTextObj> mpImplTextObj;
248 : void ImplCalculateTextPositions();
249 :
250 : public :
251 : TextObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > &
252 : rXText, int nInstance, FontCollection& rFontCollection, PPTExBulletProvider& rBuProv );
253 :
254 : ParagraphObj* GetParagraph(int idx);
255 : sal_uInt32 ParagraphCount() const;
256 : sal_uInt32 Count() const;
257 : int GetInstance() const;
258 : bool HasExtendedBullets();
259 : void WriteTextSpecInfo( SvStream* pStrm );
260 : };
261 :
262 : #endif
263 :
264 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|