1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
23 #include "epptbase.hxx"
24 #include "epptdef.hxx"
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>
31 #include <boost/shared_ptr.hpp>
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
; }
42 sal_Bool bExtendedParameters
;
43 sal_uInt32 nParaFlags
;
44 sal_Int16 nBulletFlags
;
47 String sGraphicUrl
; // String to a graphic
49 sal_uInt32 nNumberingType
; // this is actually a SvxEnum
50 sal_uInt32 nHorzAdjust
;
51 sal_uInt32 nBulletColor
;
53 sal_Int16 nStartWith
; // start of numbering
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
;
60 sal_Bool bExtendedBulletsUsed
;
62 sal_uInt32 nMappedNumType
;
63 sal_Bool bNumberingIsNumber
;
66 : bExtendedParameters(false)
69 , nNumberingType(SVX_NUM_NUMBER_NONE
)
78 , bExtendedBulletsUsed(false)
81 , bNumberingIsNumber(true)
86 class PropStateValue
: public PropValue
90 ::com::sun::star::beans::PropertyState ePropState
;
91 ::com::sun::star::uno::Reference
92 < ::com::sun::star::beans::XPropertyState
> mXPropState
;
94 sal_Bool
ImplGetPropertyValue( const OUString
& rString
, sal_Bool bGetPropertyState
= sal_True
);
100 sal_uInt32 nFieldType
;
101 sal_uInt32 nFieldStartPos
;
102 sal_uInt32 nFieldEndPos
;
103 String aRepresentation
;
106 FieldEntry( sal_uInt32 nType
, sal_uInt32 nStart
, sal_uInt32 nEnd
)
109 nFieldStartPos
= nStart
;
114 class PortionObj
: public PropStateValue
117 friend class ParagraphObj
;
122 void ImplConstruct( const PortionObj
& rPortionObj
);
123 sal_uInt32
ImplGetTextField( ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextRange
> & rXTextRangeRef
,
124 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> & rXPropSetRef
, String
& rURL
);
125 sal_uInt32
ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition
);
126 void ImplGetPortionValues( FontCollection
& rFontCollection
, sal_Bool bGetPropStateValue
= sal_False
);
130 ::com::sun::star::beans::PropertyState meCharColor
;
131 ::com::sun::star::beans::PropertyState meCharHeight
;
132 ::com::sun::star::beans::PropertyState meFontName
;
133 ::com::sun::star::beans::PropertyState meAsianOrComplexFont
;
134 ::com::sun::star::beans::PropertyState meCharEscapement
;
135 ::com::sun::star::lang::Locale meCharLocale
;
136 sal_uInt16 mnCharAttrHard
;
138 sal_uInt32 mnCharColor
;
139 sal_uInt16 mnCharAttr
;
140 sal_uInt16 mnCharHeight
;
142 sal_uInt16 mnAsianOrComplexFont
;
143 sal_Int16 mnCharEscapement
;
145 sal_uInt32 mnTextSize
;
146 sal_Bool mbLastPortion
;
149 FieldEntry
* mpFieldEntry
;
151 PortionObj( ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextRange
> & rXTextRangeRef
,
152 sal_Bool bLast
, FontCollection
& rFontCollection
);
153 PortionObj( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> & rXPropSetRef
,
154 FontCollection
& rFontCollection
);
155 PortionObj( const PortionObj
& rPortionObj
);
158 void Write( SvStream
* pStrm
, sal_Bool bLast
);
159 sal_uInt32
Count() const { return mnTextSize
; };
161 PortionObj
& operator=( const PortionObj
& rPortionObj
);
166 sal_Bool bFirstParagraph
: 1;
167 sal_Bool bLastParagraph
: 1;
169 ParaFlags() { bFirstParagraph
= sal_True
; bLastParagraph
= sal_False
; };
172 class ParagraphObj
: public std::vector
<PortionObj
*>, public PropStateValue
, public SOParagraph
174 friend class TextObj
;
175 friend struct PPTExParaSheet
;
177 MapMode maMapModeSrc
;
178 MapMode maMapModeDest
;
182 void ImplConstruct( const ParagraphObj
& rParagraphObj
);
184 sal_uInt32
ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition
);
185 void ImplGetParagraphValues( PPTExBulletProvider
& rBuProv
, sal_Bool bGetPropStateValue
= sal_False
);
186 void ImplGetNumberingLevel( PPTExBulletProvider
& rBuProv
, sal_Int16 nDepth
, sal_Bool bIsBullet
, sal_Bool bGetPropStateValue
= sal_False
);
190 ::com::sun::star::uno::Sequence
< ::com::sun::star::style::TabStop
> maTabStop
;
192 sal_uInt32 mnTextSize
;
195 sal_Bool mbFirstParagraph
;
196 sal_Bool mbLastParagraph
;
198 ::com::sun::star::beans::PropertyState meBullet
;
199 ::com::sun::star::beans::PropertyState meTextAdjust
;
200 ::com::sun::star::beans::PropertyState meLineSpacing
;
201 ::com::sun::star::beans::PropertyState meLineSpacingTop
;
202 ::com::sun::star::beans::PropertyState meLineSpacingBottom
;
203 ::com::sun::star::beans::PropertyState meForbiddenRules
;
204 ::com::sun::star::beans::PropertyState meParagraphPunctation
;
205 ::com::sun::star::beans::PropertyState meBiDi
;
207 sal_uInt16 mnTextAdjust
;
208 sal_Int16 mnLineSpacing
;
209 sal_Bool mbFixedLineSpacing
;
210 sal_Int16 mnLineSpacingTop
;
211 sal_Int16 mnLineSpacingBottom
;
212 sal_Bool mbForbiddenRules
;
213 sal_Bool mbParagraphPunctation
;
216 ParagraphObj( ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextContent
> & rXTextContentRef
,
217 ParaFlags
, FontCollection
& rFontCollection
,
218 PPTExBulletProvider
& rBuProv
);
219 ParagraphObj( const ParagraphObj
& rParargraphObj
);
220 ParagraphObj( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> & rXPropSetRef
,
221 PPTExBulletProvider
& rBuProv
);
223 void CalculateGraphicBulletSize( sal_uInt16 nFontHeight
);
226 void Write( SvStream
* pStrm
);
227 sal_uInt32
CharacterCount() const { return mnTextSize
; };
229 ParagraphObj
& operator=( const ParagraphObj
& rParagraphObj
);
236 boost::shared_ptr
<ImplTextObj
> mpImplTextObj
;
237 void ImplCalculateTextPositions();
240 TextObj( ::com::sun::star::uno::Reference
< ::com::sun::star::text::XSimpleText
> &
241 rXText
, int nInstance
, FontCollection
& rFontCollection
, PPTExBulletProvider
& rBuProv
);
243 ParagraphObj
* GetParagraph(int idx
);
244 sal_uInt32
ParagraphCount() const;
245 sal_uInt32
Count() const;
246 int GetInstance() const;
247 sal_Bool
HasExtendedBullets();
248 void WriteTextSpecInfo( SvStream
* pStrm
);
253 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */