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 OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIES_HXX
21 : #define OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIES_HXX
22 :
23 : #include <com/sun/star/beans/XPropertySet.hpp>
24 : #include "oox/drawingml/fillpropertiesgroupcontext.hxx"
25 : #include "oox/drawingml/textcharacterproperties.hxx"
26 : #include <com/sun/star/style/NumberingType.hpp>
27 : #include "oox/drawingml/textfont.hxx"
28 : #include "textspacing.hxx"
29 : #include <boost/optional.hpp>
30 :
31 : namespace com { namespace sun { namespace star {
32 : namespace graphic { class XGraphic; }
33 : } } }
34 :
35 : namespace oox { namespace drawingml {
36 :
37 : class TextParagraphProperties;
38 :
39 : typedef boost::shared_ptr< TextParagraphProperties > TextParagraphPropertiesPtr;
40 :
41 7323 : class BulletList
42 : {
43 : public:
44 : BulletList( );
45 : bool is() const;
46 : void apply( const BulletList& );
47 : void pushToPropMap( const ::oox::core::XmlFilterBase* pFilterBase, PropertyMap& xPropMap ) const;
48 : void setBulletChar( const ::rtl::OUString & sChar );
49 0 : void setStartAt( sal_Int32 nStartAt ){ mnStartAt <<= static_cast< sal_Int16 >( nStartAt ); }
50 : void setType( sal_Int32 nType );
51 : void setNone( );
52 : void setSuffixParenBoth();
53 : void setSuffixParenRight();
54 : void setSuffixPeriod();
55 : void setSuffixNone();
56 : void setSuffixMinusRight();
57 : void setBulletSize(sal_Int16 nSize);
58 : void setFontSize(sal_Int16 nSize);
59 191 : void setStyleName( const rtl::OUString& rStyleName ) { maStyleName <<= rStyleName; }
60 : void setGraphic( ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rXGraphic );
61 :
62 : ::oox::drawingml::ColorPtr maBulletColorPtr;
63 : ::com::sun::star::uno::Any mbBulletColorFollowText;
64 : ::com::sun::star::uno::Any mbBulletFontFollowText;
65 : ::oox::drawingml::TextFont maBulletFont;
66 : ::com::sun::star::uno::Any msBulletChar;
67 : ::com::sun::star::uno::Any mnStartAt;
68 : ::com::sun::star::uno::Any mnNumberingType;
69 : ::com::sun::star::uno::Any msNumberingPrefix;
70 : ::com::sun::star::uno::Any msNumberingSuffix;
71 : ::com::sun::star::uno::Any mnSize;
72 : ::com::sun::star::uno::Any mnFontSize;
73 : ::com::sun::star::uno::Any maStyleName;
74 : ::com::sun::star::uno::Any maGraphic;
75 : boost::optional< float > maFollowFontSize;
76 : };
77 :
78 0 : class TextParagraphProperties
79 : {
80 : public:
81 :
82 : TextParagraphProperties();
83 : ~TextParagraphProperties();
84 :
85 191 : void setLevel( sal_Int16 nLevel ) { mnLevel = nLevel; }
86 268 : sal_Int16 getLevel( ) const { return mnLevel; }
87 446 : PropertyMap& getTextParagraphPropertyMap() { return maTextParagraphPropertyMap; }
88 227 : BulletList& getBulletList() { return maBulletList; }
89 308 : TextCharacterProperties& getTextCharacterProperties() { return maTextCharacterProperties; }
90 41 : const TextCharacterProperties& getTextCharacterProperties() const { return maTextCharacterProperties; }
91 :
92 191 : TextSpacing& getParaTopMargin() { return maParaTopMargin; }
93 227 : TextSpacing& getParaBottomMargin() { return maParaBottomMargin; }
94 96 : boost::optional< sal_Int32 >& getParaLeftMargin(){ return moParaLeftMargin; }
95 39 : boost::optional< sal_Int32 >& getFirstLineIndentation(){ return moFirstLineIndentation; }
96 :
97 : void apply( const TextParagraphProperties& rSourceProps );
98 : void pushToPropSet( const ::oox::core::XmlFilterBase* pFilterBase,
99 : const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet,
100 : PropertyMap& rioBulletList, const BulletList* pMasterBuList, sal_Bool bApplyBulletList, float fFontSize, bool bPushDefaultValues = false ) const;
101 : void pushToPropSet( const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet) const;
102 :
103 : /** Returns the largest character size of this paragraph. If possible the
104 : masterstyle should have been applied before, otherwise the character
105 : size can be zero and the default value is returned. */
106 : float getCharHeightPoints( float fDefault ) const;
107 :
108 : #ifdef DBG_UTIL
109 : void dump() const;
110 : #endif
111 :
112 : protected:
113 :
114 : TextCharacterProperties maTextCharacterProperties;
115 : PropertyMap maTextParagraphPropertyMap;
116 : BulletList maBulletList;
117 : TextSpacing maParaTopMargin;
118 : TextSpacing maParaBottomMargin;
119 : boost::optional< sal_Int32 > moParaLeftMargin;
120 : boost::optional< sal_Int32 > moFirstLineIndentation;
121 : sal_Int16 mnLevel;
122 : };
123 :
124 : } }
125 :
126 : #endif // OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIES_HXX
127 :
128 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|