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