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 ); 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); 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 89 void setLevel( sal_Int16 nLevel ) { mnLevel = nLevel; } 90 sal_Int16 getLevel( ) const { return mnLevel; } 91 PropertyMap& getTextParagraphPropertyMap() { return maTextParagraphPropertyMap; } 92 BulletList& getBulletList() { return maBulletList; } 93 TextCharacterProperties& getTextCharacterProperties() { return maTextCharacterProperties; } 94 const TextCharacterProperties& getTextCharacterProperties() const { return maTextCharacterProperties; } 95 96 TextSpacing& getParaTopMargin() { return maParaTopMargin; } 97 TextSpacing& getParaBottomMargin() { return maParaBottomMargin; } 98 boost::optional< sal_Int32 >& getParaLeftMargin(){ return moParaLeftMargin; } 99 boost::optional< sal_Int32 >& getFirstLineIndentation(){ return moFirstLineIndentation; } 100 101 void apply( const TextParagraphProperties& rSourceProps ); 102 void pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBase, 103 const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet, 104 PropertyMap& rioBulletList, const BulletList* pMasterBuList, sal_Bool bApplyBulletList, float fFontSize ) 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 protected: 112 113 TextCharacterProperties maTextCharacterProperties; 114 PropertyMap maTextParagraphPropertyMap; 115 BulletList maBulletList; 116 TextSpacing maParaTopMargin; 117 TextSpacing maParaBottomMargin; 118 boost::optional< sal_Int32 > moParaLeftMargin; 119 boost::optional< sal_Int32 > moFirstLineIndentation; 120 sal_Int16 mnLevel; 121 }; 122 123 } } 124 125 #endif // OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIES_HXX 126