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 .
22 #include "epptbase.hxx"
24 #include <com/sun/star/awt/FontDescriptor.hpp>
25 #include <com/sun/star/lang/Locale.hpp>
26 #include <editeng/svxenum.hxx>
30 namespace com::sun::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
; }
39 bool bExtendedParameters
;
40 sal_uInt32 nParaFlags
;
41 sal_Int16 nBulletFlags
;
44 OUString sGraphicUrl
; // String to a graphic
46 SvxNumType nNumberingType
;
47 sal_uInt32 nHorzAdjust
;
48 sal_uInt32 nBulletColor
;
50 sal_Int16 nStartWith
; // start of numbering
52 sal_Int16 nBulletRealSize
; // scale in percent
53 sal_Int16 nDepth
; // actual depth
54 sal_Unicode cBulletId
; // if Numbering Type == CharSpecial
55 css::awt::FontDescriptor aFontDesc
;
57 bool bExtendedBulletsUsed
;
59 sal_uInt32 nMappedNumType
;
60 bool bNumberingIsNumber
;
63 : bExtendedParameters(false)
66 , nNumberingType(SVX_NUM_NUMBER_NONE
)
75 , bExtendedBulletsUsed(false)
78 , bNumberingIsNumber(true)
83 class PropStateValue
: public PropValue
88 , ePropState(css::beans::PropertyState_AMBIGUOUS_VALUE
)
92 css::beans::PropertyState ePropState
;
93 css::uno::Reference
< css::beans::XPropertyState
> mXPropState
;
95 bool ImplGetPropertyValue( const OUString
& rString
, bool bGetPropertyState
);
100 sal_uInt32 nFieldType
;
101 sal_uInt32 nFieldStartPos
;
102 sal_uInt32 nFieldEndPos
;
103 OUString aRepresentation
;
106 FieldEntry( sal_uInt32 nType
, sal_uInt32 nStart
, sal_uInt32 nEnd
)
108 nFieldStartPos(nStart
),
114 class PortionObj final
: public PropStateValue
117 friend class ParagraphObj
;
120 void ImplConstruct( const PortionObj
& rPortionObj
);
121 static sal_uInt32
ImplGetTextField( css::uno::Reference
< css::text::XTextRange
> & rXTextRangeRef
,
122 const css::uno::Reference
< css::beans::XPropertySet
> & rXPropSetRef
, OUString
& rURL
);
123 sal_uInt32
ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition
);
124 void ImplGetPortionValues( FontCollection
& rFontCollection
, bool bGetPropStateValue
);
128 css::beans::PropertyState meCharColor
;
129 css::beans::PropertyState meCharHeight
;
130 css::beans::PropertyState meFontName
;
131 css::beans::PropertyState meAsianOrComplexFont
;
132 css::beans::PropertyState meCharEscapement
;
133 css::lang::Locale meCharLocale
;
134 sal_uInt16 mnCharAttrHard
;
136 sal_uInt32 mnCharColor
;
137 sal_uInt16 mnCharAttr
;
138 sal_uInt16 mnCharHeight
;
140 sal_uInt16 mnAsianOrComplexFont
;
141 sal_Int16 mnCharEscapement
;
143 sal_uInt32 mnTextSize
;
146 std::unique_ptr
<sal_uInt16
[]> mpText
;
147 std::unique_ptr
<FieldEntry
> mpFieldEntry
;
149 PortionObj( css::uno::Reference
< css::text::XTextRange
> & rXTextRangeRef
,
150 bool bLast
, FontCollection
& rFontCollection
);
151 PortionObj( const css::uno::Reference
< css::beans::XPropertySet
> & rXPropSetRef
,
152 FontCollection
& rFontCollection
);
153 PortionObj( const PortionObj
& rPortionObj
);
156 void Write( SvStream
* pStrm
, bool bLast
);
157 sal_uInt32
Count() const { return mnTextSize
; };
159 PortionObj
& operator=( const PortionObj
& rPortionObj
);
164 bool bFirstParagraph
: 1;
165 bool bLastParagraph
: 1;
167 ParaFlags() { bFirstParagraph
= true; bLastParagraph
= false; };
170 class ParagraphObj
: public PropStateValue
, public SOParagraph
172 friend class TextObj
;
173 friend struct PPTExParaSheet
;
175 std::vector
<std::unique_ptr
<PortionObj
> > mvPortions
;
179 void ImplConstruct( const ParagraphObj
& rParagraphObj
);
181 sal_uInt32
ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition
);
182 void ImplGetParagraphValues( PPTExBulletProvider
* pBuProv
, bool bGetPropStateValue
);
183 void ImplGetNumberingLevel( PPTExBulletProvider
* pBuProv
, sal_Int16 nDepth
, bool bIsBullet
, bool bGetPropStateValue
);
187 css::uno::Sequence
< css::style::TabStop
> maTabStop
;
189 sal_uInt32 mnTextSize
;
192 bool mbFirstParagraph
;
193 bool mbLastParagraph
;
195 css::beans::PropertyState meBullet
;
196 css::beans::PropertyState meTextAdjust
;
197 css::beans::PropertyState meLineSpacing
;
198 css::beans::PropertyState meLineSpacingTop
;
199 css::beans::PropertyState meLineSpacingBottom
;
200 css::beans::PropertyState meForbiddenRules
;
201 css::beans::PropertyState meParagraphPunctation
;
202 css::beans::PropertyState meBiDi
;
204 sal_uInt16 mnTextAdjust
;
205 sal_Int16 mnLineSpacing
;
206 bool mbFixedLineSpacing
;
207 sal_Int16 mnLineSpacingTop
;
208 sal_Int16 mnLineSpacingBottom
;
209 bool mbForbiddenRules
;
210 bool mbParagraphPunctation
;
213 ParagraphObj( css::uno::Reference
< css::text::XTextContent
> const & rXTextContentRef
,
214 ParaFlags
, FontCollection
& rFontCollection
,
215 PPTExBulletProvider
& rBuProv
);
216 ParagraphObj( const ParagraphObj
& rParargraphObj
) = delete;
217 ParagraphObj( const css::uno::Reference
< css::beans::XPropertySet
> & rXPropSetRef
,
218 PPTExBulletProvider
* pBuProv
);
220 bool empty() const { return mvPortions
.empty(); }
222 const PortionObj
& front() const { return *mvPortions
.front(); }
224 std::vector
<std::unique_ptr
<PortionObj
> >::const_iterator
begin() const { return mvPortions
.begin(); }
225 std::vector
<std::unique_ptr
<PortionObj
> >::const_iterator
end() const { return mvPortions
.end(); }
227 void CalculateGraphicBulletSize( sal_uInt16 nFontHeight
);
230 void Write( SvStream
* pStrm
);
231 sal_uInt32
CharacterCount() const { return mnTextSize
; };
233 ParagraphObj
& operator=( const ParagraphObj
& rParagraphObj
);
240 std::shared_ptr
<ImplTextObj
> mpImplTextObj
;
241 void ImplCalculateTextPositions();
244 TextObj( css::uno::Reference
< css::text::XSimpleText
> const &
245 rXText
, int nInstance
, FontCollection
& rFontCollection
, PPTExBulletProvider
& rBuProv
);
247 ParagraphObj
* GetParagraph(int idx
);
248 sal_uInt32
ParagraphCount() const;
249 sal_uInt32
Count() const;
250 int GetInstance() const;
251 bool HasExtendedBullets() const;
254 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */