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 :
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 0 : struct SOParagraph
41 : {
42 : sal_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 : sal_Bool bExtendedBulletsUsed;
61 : sal_uInt16 nBulletId;
62 : sal_uInt32 nMappedNumType;
63 : sal_Bool bNumberingIsNumber;
64 :
65 0 : 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 0 : , bNumberingIsNumber(true)
82 : {
83 0 : }
84 : };
85 :
86 0 : class PropStateValue : public PropValue
87 : {
88 : public:
89 0 : PropStateValue()
90 : : PropValue()
91 0 : , ePropState(css::beans::PropertyState_AMBIGUOUS_VALUE)
92 : {
93 0 : }
94 : protected:
95 : css::beans::PropertyState ePropState;
96 : css::uno::Reference < css::beans::XPropertyState > mXPropState;
97 :
98 : sal_Bool ImplGetPropertyValue( const OUString& rString, sal_Bool bGetPropertyState = sal_True );
99 : };
100 :
101 0 : struct FieldEntry
102 : {
103 : sal_uInt32 nFieldType;
104 : sal_uInt32 nFieldStartPos;
105 : sal_uInt32 nFieldEndPos;
106 : OUString aRepresentation;
107 : OUString aFieldUrl;
108 :
109 0 : FieldEntry( sal_uInt32 nType, sal_uInt32 nStart, sal_uInt32 nEnd )
110 0 : {
111 0 : nFieldType = nType;
112 0 : nFieldStartPos = nStart;
113 0 : nFieldEndPos = nEnd;
114 0 : }
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 : 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, sal_Bool bGetPropStateValue = sal_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 : sal_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 : sal_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, sal_Bool bLast );
162 0 : sal_uInt32 Count() const { return mnTextSize; };
163 :
164 : PortionObj& operator=( const PortionObj& rPortionObj );
165 : };
166 :
167 : struct ParaFlags
168 : {
169 : sal_Bool bFirstParagraph : 1;
170 : sal_Bool bLastParagraph : 1;
171 :
172 0 : ParaFlags() { bFirstParagraph = sal_True; bLastParagraph = sal_False; };
173 : };
174 :
175 : class ParagraphObj : public std::vector<PortionObj*>, public PropStateValue, public SOParagraph
176 : {
177 : friend class TextObj;
178 : friend struct PPTExParaSheet;
179 :
180 : MapMode maMapModeSrc;
181 : MapMode maMapModeDest;
182 :
183 : protected :
184 :
185 : void ImplConstruct( const ParagraphObj& rParagraphObj );
186 : void ImplClear();
187 : sal_uInt32 ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition );
188 : void ImplGetParagraphValues( PPTExBulletProvider& rBuProv, sal_Bool bGetPropStateValue = sal_False );
189 : void ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int16 nDepth, sal_Bool bIsBullet, sal_Bool bGetPropStateValue = sal_False );
190 :
191 : public :
192 :
193 : ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > maTabStop;
194 :
195 : sal_uInt32 mnTextSize;
196 :
197 : sal_Bool mbIsBullet;
198 : sal_Bool mbFirstParagraph;
199 : sal_Bool mbLastParagraph;
200 :
201 : ::com::sun::star::beans::PropertyState meBullet;
202 : ::com::sun::star::beans::PropertyState meTextAdjust;
203 : ::com::sun::star::beans::PropertyState meLineSpacing;
204 : ::com::sun::star::beans::PropertyState meLineSpacingTop;
205 : ::com::sun::star::beans::PropertyState meLineSpacingBottom;
206 : ::com::sun::star::beans::PropertyState meForbiddenRules;
207 : ::com::sun::star::beans::PropertyState meParagraphPunctation;
208 : ::com::sun::star::beans::PropertyState meBiDi;
209 :
210 : sal_uInt16 mnTextAdjust;
211 : sal_Int16 mnLineSpacing;
212 : sal_Bool mbFixedLineSpacing;
213 : sal_Int16 mnLineSpacingTop;
214 : sal_Int16 mnLineSpacingBottom;
215 : sal_Bool mbForbiddenRules;
216 : sal_Bool mbParagraphPunctation;
217 : sal_uInt16 mnBiDi;
218 :
219 : ParagraphObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > & rXTextContentRef,
220 : ParaFlags, FontCollection& rFontCollection,
221 : PPTExBulletProvider& rBuProv );
222 : ParagraphObj( const ParagraphObj& rParargraphObj );
223 : ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef,
224 : PPTExBulletProvider& rBuProv );
225 :
226 : void CalculateGraphicBulletSize( sal_uInt16 nFontHeight );
227 : ~ParagraphObj();
228 :
229 : void Write( SvStream* pStrm );
230 0 : sal_uInt32 CharacterCount() const { return mnTextSize; };
231 :
232 : ParagraphObj& operator=( const ParagraphObj& rParagraphObj );
233 : };
234 :
235 : struct ImplTextObj;
236 :
237 0 : class TextObj
238 : {
239 : boost::shared_ptr<ImplTextObj> mpImplTextObj;
240 : void ImplCalculateTextPositions();
241 :
242 : public :
243 : TextObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > &
244 : rXText, int nInstance, FontCollection& rFontCollection, PPTExBulletProvider& rBuProv );
245 :
246 : ParagraphObj* GetParagraph(int idx);
247 : sal_uInt32 ParagraphCount() const;
248 : sal_uInt32 Count() const;
249 : int GetInstance() const;
250 : sal_Bool HasExtendedBullets();
251 : void WriteTextSpecInfo( SvStream* pStrm );
252 : };
253 :
254 : #endif
255 :
256 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|