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 INCLUDED_OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIES_HXX
21 : #define INCLUDED_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 <oox/drawingml/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 0 : 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 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 0 : void setStyleName( const 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 0 : void setLevel( sal_Int16 nLevel ) { mnLevel = nLevel; }
86 0 : sal_Int16 getLevel( ) const { return mnLevel; }
87 0 : PropertyMap& getTextParagraphPropertyMap() { return maTextParagraphPropertyMap; }
88 0 : BulletList& getBulletList() { return maBulletList; }
89 0 : TextCharacterProperties& getTextCharacterProperties() { return maTextCharacterProperties; }
90 0 : const TextCharacterProperties& getTextCharacterProperties() const { return maTextCharacterProperties; }
91 :
92 0 : TextSpacing& getParaTopMargin() { return maParaTopMargin; }
93 0 : TextSpacing& getParaBottomMargin() { return maParaBottomMargin; }
94 0 : boost::optional< sal_Int32 >& getParaLeftMargin(){ return moParaLeftMargin; }
95 0 : boost::optional< sal_Int32 >& getFirstLineIndentation(){ return moFirstLineIndentation; }
96 :
97 0 : boost::optional< sal_Int16 >& getParaAdjust() { return moParaAdjust; }
98 0 : void setParaAdjust( sal_Int16 nParaAdjust ) { moParaAdjust = nParaAdjust; }
99 :
100 : void apply( const TextParagraphProperties& rSourceProps );
101 : void pushToPropSet( const ::oox::core::XmlFilterBase* pFilterBase,
102 : const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet,
103 : PropertyMap& rioBulletList, const BulletList* pMasterBuList, bool bApplyBulletList, float fFontSize, bool bPushDefaultValues = false ) const;
104 : void pushToPropSet( const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet) const;
105 :
106 : /** Returns the largest character size of this paragraph. If possible the
107 : masterstyle should have been applied before, otherwise the character
108 : size can be zero and the default value is returned. */
109 : float getCharHeightPoints( float fDefault ) const;
110 :
111 : #ifdef DBG_UTIL
112 : void dump() const;
113 : #endif
114 :
115 : protected:
116 :
117 : TextCharacterProperties maTextCharacterProperties;
118 : PropertyMap maTextParagraphPropertyMap;
119 : BulletList maBulletList;
120 : TextSpacing maParaTopMargin;
121 : TextSpacing maParaBottomMargin;
122 : boost::optional< sal_Int32 > moParaLeftMargin;
123 : boost::optional< sal_Int32 > moFirstLineIndentation;
124 : boost::optional< sal_Int16 > moParaAdjust;
125 : sal_Int16 mnLevel;
126 : };
127 :
128 : } }
129 :
130 : #endif // INCLUDED_OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIES_HXX
131 :
132 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|