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 EPPT_TEXT_HXX
21 : #define 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 :
30 : namespace com { namespace sun { namespace 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; }
35 : }}}
36 :
37 0 : struct SOParagraph
38 : {
39 : sal_Bool bExtendedParameters;
40 : sal_uInt32 nParaFlags;
41 : sal_Int16 nBulletFlags;
42 : String sPrefix;
43 : String sSuffix;
44 : String sGraphicUrl; // String auf eine Graphic
45 : Size aBuGraSize;
46 : sal_uInt32 nNumberingType; // in wirlichkeit ist dies ein SvxEnum
47 : sal_uInt32 nHorzAdjust;
48 : sal_uInt32 nBulletColor;
49 : sal_Int32 nBulletOfs;
50 : sal_Int16 nStartWith; // Start der nummerierung
51 : sal_Int16 nTextOfs;
52 : sal_Int16 nBulletRealSize; // GroessenVerhaeltnis in Proz
53 : sal_Int16 nDepth; // aktuelle tiefe
54 : sal_Unicode cBulletId; // wenn Numbering Type == CharSpecial
55 : ::com::sun::star::awt::FontDescriptor aFontDesc;
56 :
57 : sal_Bool bExtendedBulletsUsed;
58 : sal_uInt16 nBulletId;
59 : sal_uInt32 nMappedNumType;
60 : sal_Bool bNumberingIsNumber;
61 :
62 0 : SOParagraph()
63 0 : {
64 0 : nDepth = 0;
65 0 : bExtendedParameters = sal_False;
66 0 : nParaFlags = 0;
67 0 : nBulletFlags = 0;
68 0 : nBulletOfs = 0;
69 0 : nTextOfs = 0;
70 0 : bExtendedBulletsUsed = sal_False;
71 0 : nBulletId = 0xffff;
72 0 : bNumberingIsNumber = sal_True;
73 0 : };
74 : };
75 :
76 0 : class PropStateValue : public PropValue
77 : {
78 : protected :
79 :
80 : ::com::sun::star::beans::PropertyState ePropState;
81 : ::com::sun::star::uno::Reference
82 : < ::com::sun::star::beans::XPropertyState > mXPropState;
83 :
84 : sal_Bool ImplGetPropertyValue( const String& rString, sal_Bool bGetPropertyState = sal_True );
85 :
86 : };
87 :
88 0 : struct FieldEntry
89 : {
90 : sal_uInt32 nFieldType;
91 : sal_uInt32 nFieldStartPos;
92 : sal_uInt32 nFieldEndPos;
93 : String aRepresentation;
94 : String aFieldUrl;
95 :
96 0 : FieldEntry( sal_uInt32 nType, sal_uInt32 nStart, sal_uInt32 nEnd )
97 0 : {
98 0 : nFieldType = nType;
99 0 : nFieldStartPos = nStart;
100 0 : nFieldEndPos = nEnd;
101 0 : }
102 : };
103 :
104 : class PortionObj : public PropStateValue
105 : {
106 :
107 : friend class ParagraphObj;
108 :
109 : protected :
110 :
111 : void ImplClear();
112 : void ImplConstruct( const PortionObj& rPortionObj );
113 : sal_uInt32 ImplGetTextField( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & rXTextRangeRef,
114 : const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef, String& rURL );
115 : sal_uInt32 ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition );
116 : void ImplGetPortionValues( FontCollection& rFontCollection, sal_Bool bGetPropStateValue = sal_False );
117 :
118 : public :
119 :
120 : ::com::sun::star::beans::PropertyState meCharColor;
121 : ::com::sun::star::beans::PropertyState meCharHeight;
122 : ::com::sun::star::beans::PropertyState meFontName;
123 : ::com::sun::star::beans::PropertyState meAsianOrComplexFont;
124 : ::com::sun::star::beans::PropertyState meCharEscapement;
125 : ::com::sun::star::lang::Locale meCharLocale;
126 : sal_uInt16 mnCharAttrHard;
127 :
128 : sal_uInt32 mnCharColor;
129 : sal_uInt16 mnCharAttr;
130 : sal_uInt16 mnCharHeight;
131 : sal_uInt16 mnFont;
132 : sal_uInt16 mnAsianOrComplexFont;
133 : sal_Int16 mnCharEscapement;
134 :
135 : sal_uInt32 mnTextSize;
136 : sal_Bool mbLastPortion;
137 :
138 : sal_uInt16* mpText;
139 : FieldEntry* mpFieldEntry;
140 :
141 : PortionObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & rXTextRangeRef,
142 : sal_Bool bLast, FontCollection& rFontCollection );
143 : PortionObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef,
144 : FontCollection& rFontCollection );
145 : PortionObj( const PortionObj& rPortionObj );
146 : ~PortionObj();
147 :
148 : void Write( SvStream* pStrm, sal_Bool bLast );
149 0 : sal_uInt32 Count() const { return mnTextSize; };
150 :
151 : PortionObj& operator=( const PortionObj& rPortionObj );
152 : };
153 :
154 : struct ParaFlags
155 : {
156 : sal_Bool bFirstParagraph : 1;
157 : sal_Bool bLastParagraph : 1;
158 :
159 0 : ParaFlags() { bFirstParagraph = sal_True; bLastParagraph = sal_False; };
160 : };
161 :
162 : class ParagraphObj : public std::vector<PortionObj*>, public PropStateValue, public SOParagraph
163 : {
164 : friend class TextObj;
165 : friend struct PPTExParaSheet;
166 :
167 : MapMode maMapModeSrc;
168 : MapMode maMapModeDest;
169 :
170 : protected :
171 :
172 : void ImplConstruct( const ParagraphObj& rParagraphObj );
173 : void ImplClear();
174 : sal_uInt32 ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition );
175 : void ImplGetParagraphValues( PPTExBulletProvider& rBuProv, sal_Bool bGetPropStateValue = sal_False );
176 : void ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int16 nDepth, sal_Bool bIsBullet, sal_Bool bGetPropStateValue = sal_False );
177 :
178 : public :
179 :
180 : ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > maTabStop;
181 :
182 : sal_uInt32 mnTextSize;
183 :
184 : sal_Bool mbIsBullet;
185 : sal_Bool mbFirstParagraph;
186 : sal_Bool mbLastParagraph;
187 :
188 : ::com::sun::star::beans::PropertyState meBullet;
189 : ::com::sun::star::beans::PropertyState meTextAdjust;
190 : ::com::sun::star::beans::PropertyState meLineSpacing;
191 : ::com::sun::star::beans::PropertyState meLineSpacingTop;
192 : ::com::sun::star::beans::PropertyState meLineSpacingBottom;
193 : ::com::sun::star::beans::PropertyState meForbiddenRules;
194 : ::com::sun::star::beans::PropertyState meParagraphPunctation;
195 : ::com::sun::star::beans::PropertyState meBiDi;
196 :
197 : sal_uInt16 mnTextAdjust;
198 : sal_Int16 mnLineSpacing;
199 : sal_Bool mbFixedLineSpacing;
200 : sal_Int16 mnLineSpacingTop;
201 : sal_Int16 mnLineSpacingBottom;
202 : sal_Bool mbForbiddenRules;
203 : sal_Bool mbParagraphPunctation;
204 : sal_uInt16 mnBiDi;
205 :
206 : ParagraphObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > & rXTextContentRef,
207 : ParaFlags, FontCollection& rFontCollection,
208 : PPTExBulletProvider& rBuProv );
209 : ParagraphObj( const ParagraphObj& rParargraphObj );
210 : ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef,
211 : PPTExBulletProvider& rBuProv );
212 :
213 : void CalculateGraphicBulletSize( sal_uInt16 nFontHeight );
214 : ~ParagraphObj();
215 :
216 : void Write( SvStream* pStrm );
217 0 : sal_uInt32 CharacterCount() const { return mnTextSize; };
218 :
219 : ParagraphObj& operator=( const ParagraphObj& rParagraphObj );
220 : };
221 :
222 : struct ImplTextObj
223 : {
224 : sal_uInt32 mnRefCount;
225 : sal_uInt32 mnTextSize;
226 : int mnInstance;
227 : std::vector<ParagraphObj*> maList;
228 : sal_Bool mbHasExtendedBullets;
229 : sal_Bool mbFixedCellHeightUsed;
230 :
231 : ImplTextObj( int nInstance );
232 : ~ImplTextObj();
233 : };
234 :
235 : class TextObj
236 : {
237 : ImplTextObj* mpImplTextObj;
238 : void ImplCalculateTextPositions();
239 :
240 : public :
241 : TextObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > &
242 : rXText, int nInstance, FontCollection& rFontCollection, PPTExBulletProvider& rBuProv );
243 : TextObj( const TextObj& rTextObj );
244 : ~TextObj();
245 :
246 0 : ParagraphObj* GetParagraph(int idx) { return mpImplTextObj->maList[idx]; };
247 0 : sal_uInt32 ParagraphCount() const { return mpImplTextObj->maList.size(); };
248 0 : sal_uInt32 Count() const { return mpImplTextObj->mnTextSize; };
249 0 : int GetInstance() const { return mpImplTextObj->mnInstance; };
250 0 : sal_Bool HasExtendedBullets(){ return mpImplTextObj->mbHasExtendedBullets; };
251 : void WriteTextSpecInfo( SvStream* pStrm );
252 :
253 : TextObj& operator=( TextObj& rTextObj );
254 : };
255 :
256 : #endif
257 :
258 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|