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 .
20 #ifndef INCLUDED_SD_SOURCE_FILTER_EPPT_TEXT_HXX
21 #define INCLUDED_SD_SOURCE_FILTER_EPPT_TEXT_HXX
23 #include "epptbase.hxx"
25 #include <com/sun/star/awt/FontDescriptor.hpp>
26 #include <com/sun/star/lang/Locale.hpp>
27 #include <editeng/svxenum.hxx>
31 namespace com
{ namespace sun
{ namespace star
{
32 namespace awt
{ struct FontDescriptor
; }
33 namespace beans
{ class XPropertyState
; }
34 namespace text
{ class XTextRange
; class XTextContent
; class XSimpleText
; }
35 namespace style
{ struct TabStop
; }
40 bool bExtendedParameters
;
41 sal_uInt32 nParaFlags
;
42 sal_Int16 nBulletFlags
;
45 OUString sGraphicUrl
; // String to a graphic
47 SvxNumType nNumberingType
;
48 sal_uInt32 nHorzAdjust
;
49 sal_uInt32 nBulletColor
;
51 sal_Int16 nStartWith
; // start of numbering
53 sal_Int16 nBulletRealSize
; // scale in percent
54 sal_Int16 nDepth
; // actual depth
55 sal_Unicode cBulletId
; // if Numbering Type == CharSpecial
56 css::awt::FontDescriptor aFontDesc
;
58 bool bExtendedBulletsUsed
;
60 sal_uInt32 nMappedNumType
;
61 bool bNumberingIsNumber
;
64 : bExtendedParameters(false)
67 , nNumberingType(SVX_NUM_NUMBER_NONE
)
76 , bExtendedBulletsUsed(false)
79 , bNumberingIsNumber(true)
84 class PropStateValue
: public PropValue
89 , ePropState(css::beans::PropertyState_AMBIGUOUS_VALUE
)
93 css::beans::PropertyState ePropState
;
94 css::uno::Reference
< css::beans::XPropertyState
> mXPropState
;
96 bool ImplGetPropertyValue( const OUString
& rString
, bool bGetPropertyState
);
101 sal_uInt32 nFieldType
;
102 sal_uInt32 nFieldStartPos
;
103 sal_uInt32 nFieldEndPos
;
104 OUString aRepresentation
;
107 FieldEntry( sal_uInt32 nType
, sal_uInt32 nStart
, sal_uInt32 nEnd
)
110 nFieldStartPos
= nStart
;
115 class PortionObj final
: public PropStateValue
118 friend class ParagraphObj
;
121 void ImplConstruct( const PortionObj
& rPortionObj
);
122 static sal_uInt32
ImplGetTextField( css::uno::Reference
< css::text::XTextRange
> & rXTextRangeRef
,
123 const css::uno::Reference
< css::beans::XPropertySet
> & rXPropSetRef
, OUString
& rURL
);
124 sal_uInt32
ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition
);
125 void ImplGetPortionValues( FontCollection
& rFontCollection
, bool bGetPropStateValue
);
129 css::beans::PropertyState meCharColor
;
130 css::beans::PropertyState meCharHeight
;
131 css::beans::PropertyState meFontName
;
132 css::beans::PropertyState meAsianOrComplexFont
;
133 css::beans::PropertyState meCharEscapement
;
134 css::lang::Locale meCharLocale
;
135 sal_uInt16 mnCharAttrHard
;
137 sal_uInt32 mnCharColor
;
138 sal_uInt16 mnCharAttr
;
139 sal_uInt16 mnCharHeight
;
141 sal_uInt16 mnAsianOrComplexFont
;
142 sal_Int16 mnCharEscapement
;
144 sal_uInt32 mnTextSize
;
147 std::unique_ptr
<sal_uInt16
[]> mpText
;
148 std::unique_ptr
<FieldEntry
> mpFieldEntry
;
150 PortionObj( css::uno::Reference
< css::text::XTextRange
> & rXTextRangeRef
,
151 bool bLast
, FontCollection
& rFontCollection
);
152 PortionObj( const css::uno::Reference
< css::beans::XPropertySet
> & rXPropSetRef
,
153 FontCollection
& rFontCollection
);
154 PortionObj( const PortionObj
& rPortionObj
);
157 void Write( SvStream
* pStrm
, bool bLast
);
158 sal_uInt32
Count() const { return mnTextSize
; };
160 PortionObj
& operator=( const PortionObj
& rPortionObj
);
165 bool bFirstParagraph
: 1;
166 bool bLastParagraph
: 1;
168 ParaFlags() { bFirstParagraph
= true; bLastParagraph
= false; };
171 class ParagraphObj
: public PropStateValue
, public SOParagraph
173 friend class TextObj
;
174 friend struct PPTExParaSheet
;
176 std::vector
<std::unique_ptr
<PortionObj
> > mvPortions
;
180 void ImplConstruct( const ParagraphObj
& rParagraphObj
);
182 sal_uInt32
ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition
);
183 void ImplGetParagraphValues( PPTExBulletProvider
* pBuProv
, bool bGetPropStateValue
);
184 void ImplGetNumberingLevel( PPTExBulletProvider
* pBuProv
, sal_Int16 nDepth
, bool bIsBullet
, bool bGetPropStateValue
);
188 css::uno::Sequence
< css::style::TabStop
> maTabStop
;
190 sal_uInt32 mnTextSize
;
193 bool mbFirstParagraph
;
194 bool mbLastParagraph
;
196 css::beans::PropertyState meBullet
;
197 css::beans::PropertyState meTextAdjust
;
198 css::beans::PropertyState meLineSpacing
;
199 css::beans::PropertyState meLineSpacingTop
;
200 css::beans::PropertyState meLineSpacingBottom
;
201 css::beans::PropertyState meForbiddenRules
;
202 css::beans::PropertyState meParagraphPunctation
;
203 css::beans::PropertyState meBiDi
;
205 sal_uInt16 mnTextAdjust
;
206 sal_Int16 mnLineSpacing
;
207 bool mbFixedLineSpacing
;
208 sal_Int16 mnLineSpacingTop
;
209 sal_Int16 mnLineSpacingBottom
;
210 bool mbForbiddenRules
;
211 bool mbParagraphPunctation
;
214 ParagraphObj( css::uno::Reference
< css::text::XTextContent
> const & rXTextContentRef
,
215 ParaFlags
, FontCollection
& rFontCollection
,
216 PPTExBulletProvider
& rBuProv
);
217 ParagraphObj( const ParagraphObj
& rParargraphObj
) = delete;
218 ParagraphObj( const css::uno::Reference
< css::beans::XPropertySet
> & rXPropSetRef
,
219 PPTExBulletProvider
* pBuProv
);
221 bool empty() const { return mvPortions
.empty(); }
223 const PortionObj
& front() const { return *mvPortions
.front().get(); }
225 std::vector
<std::unique_ptr
<PortionObj
> >::const_iterator
begin() const { return mvPortions
.begin(); }
226 std::vector
<std::unique_ptr
<PortionObj
> >::const_iterator
end() const { return mvPortions
.end(); }
228 void CalculateGraphicBulletSize( sal_uInt16 nFontHeight
);
231 void Write( SvStream
* pStrm
);
232 sal_uInt32
CharacterCount() const { return mnTextSize
; };
234 ParagraphObj
& operator=( const ParagraphObj
& rParagraphObj
);
241 std::shared_ptr
<ImplTextObj
> mpImplTextObj
;
242 void ImplCalculateTextPositions();
245 TextObj( css::uno::Reference
< css::text::XSimpleText
> const &
246 rXText
, int nInstance
, FontCollection
& rFontCollection
, PPTExBulletProvider
& rBuProv
);
248 ParagraphObj
* GetParagraph(int idx
);
249 sal_uInt32
ParagraphCount() const;
250 sal_uInt32
Count() const;
251 int GetInstance() const;
252 bool HasExtendedBullets();
257 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */