1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIES_HXX 25 #define OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIES_HXX 26 27 #include <com/sun/star/beans/XPropertySet.hpp> 28 #include "oox/drawingml/fillpropertiesgroupcontext.hxx" 29 #include "oox/drawingml/textcharacterproperties.hxx" 30 #include <com/sun/star/style/NumberingType.hpp> 31 #include "oox/drawingml/textfont.hxx" 32 #include "textspacing.hxx" 33 #include <boost/optional.hpp> 34 35 namespace com { namespace sun { namespace star { 36 namespace graphic { class XGraphic; } 37 } } } 38 39 namespace oox { namespace drawingml { 40 41 class TextParagraphProperties; 42 43 typedef boost::shared_ptr< TextParagraphProperties > TextParagraphPropertiesPtr; 44 45 class BulletList 46 { 47 public: 48 BulletList( ); 49 bool is() const; 50 void apply( const BulletList& ); 51 void pushToPropMap( const ::oox::core::XmlFilterBase& rFilterBase, PropertyMap& rPropMap ) const; 52 void setBulletChar( const ::rtl::OUString & sChar ); setStartAt(sal_Int32 nStartAt)53 void setStartAt( sal_Int32 nStartAt ){ mnStartAt <<= static_cast< sal_Int16 >( nStartAt ); } 54 void setType( sal_Int32 nType ); 55 void setNone( ); 56 void setSuffixParenBoth(); 57 void setSuffixParenRight(); 58 void setSuffixPeriod(); 59 void setSuffixNone(); 60 void setSuffixMinusRight(); 61 void setBulletSize(sal_Int16 nSize); 62 void setFontSize(sal_Int16 nSize); setStyleName(const rtl::OUString & rStyleName)63 void setStyleName( const rtl::OUString& rStyleName ) { maStyleName <<= rStyleName; } 64 void setGraphic( ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rXGraphic ); 65 66 ::oox::drawingml::ColorPtr maBulletColorPtr; 67 ::com::sun::star::uno::Any mbBulletColorFollowText; 68 ::com::sun::star::uno::Any mbBulletFontFollowText; 69 ::oox::drawingml::TextFont maBulletFont; 70 ::com::sun::star::uno::Any msBulletChar; 71 ::com::sun::star::uno::Any mnStartAt; 72 ::com::sun::star::uno::Any mnNumberingType; 73 ::com::sun::star::uno::Any msNumberingPrefix; 74 ::com::sun::star::uno::Any msNumberingSuffix; 75 ::com::sun::star::uno::Any mnSize; 76 ::com::sun::star::uno::Any mnFontSize; 77 ::com::sun::star::uno::Any maStyleName; 78 ::com::sun::star::uno::Any maGraphic; 79 boost::optional< float > maFollowFontSize; 80 }; 81 82 class TextParagraphProperties 83 { 84 public: 85 86 TextParagraphProperties(); 87 ~TextParagraphProperties(); 88 setLevel(sal_Int16 nLevel)89 void setLevel( sal_Int16 nLevel ) { mnLevel = nLevel; } getLevel() const90 sal_Int16 getLevel( ) const { return mnLevel; } getTextParagraphPropertyMap()91 PropertyMap& getTextParagraphPropertyMap() { return maTextParagraphPropertyMap; } getBulletList()92 BulletList& getBulletList() { return maBulletList; } getBulletList() const93 const BulletList& getBulletList() const { return maBulletList; } getTextCharacterProperties()94 TextCharacterProperties& getTextCharacterProperties() { return maTextCharacterProperties; } getTextCharacterProperties() const95 const TextCharacterProperties& getTextCharacterProperties() const { return maTextCharacterProperties; } 96 getParaTopMargin()97 TextSpacing& getParaTopMargin() { return maParaTopMargin; } getParaBottomMargin()98 TextSpacing& getParaBottomMargin() { return maParaBottomMargin; } getParaLeftMargin()99 boost::optional< sal_Int32 >& getParaLeftMargin(){ return moParaLeftMargin; } getFirstLineIndentation()100 boost::optional< sal_Int32 >& getFirstLineIndentation(){ return moFirstLineIndentation; } 101 102 void apply( const TextParagraphProperties& rSourceProps ); 103 void pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBase, 104 const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet, 105 PropertyMap& rioBulletList, const BulletList* pMasterBuList, sal_Bool bApplyBulletList, float fFontSize ) const; 106 107 /** Returns the largest character size of this paragraph. If possible the 108 masterstyle should have been applied before, otherwise the character 109 size can be zero and the default value is returned. */ 110 float getCharHeightPoints( float fDefault ) const; 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