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 #ifndef _SVX_ALGITEM_HXX 24 #define _SVX_ALGITEM_HXX 25 26 // include --------------------------------------------------------------- 27 28 #include <svx/svxids.hrc> 29 #include <svl/poolitem.hxx> 30 #include <svl/eitem.hxx> 31 #include <editeng/svxenum.hxx> 32 #include "svx/svxdllapi.h" 33 34 class SvStream; 35 36 //------------------------------------------------------------------------ 37 38 39 40 class SVX_DLLPUBLIC SvxHorJustifyItem: public SfxEnumItem 41 { 42 public: 43 TYPEINFO(); 44 45 SvxHorJustifyItem( const sal_uInt16 nId ); 46 47 SvxHorJustifyItem( 48 const SvxCellHorJustify eJustify /*= SVX_HOR_JUSTIFY_STANDARD*/, 49 const sal_uInt16 nId ); 50 51 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, 52 SfxMapUnit eCoreMetric, 53 SfxMapUnit ePresMetric, 54 String &rText, const IntlWrapper * = 0 ) const; 55 56 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; 57 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); 58 59 virtual sal_uInt16 GetValueCount() const; 60 virtual String GetValueText( sal_uInt16 nVal ) const; 61 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 62 virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const; 63 operator =(const SvxHorJustifyItem & rHorJustify)64 inline SvxHorJustifyItem& operator=(const SvxHorJustifyItem& rHorJustify) 65 { 66 SetValue( rHorJustify.GetValue() ); 67 return *this; 68 } 69 }; 70 71 72 //------------------------------------------------------------------------ 73 74 75 class SVX_DLLPUBLIC SvxVerJustifyItem: public SfxEnumItem 76 { 77 public: 78 TYPEINFO(); 79 80 SvxVerJustifyItem( const sal_uInt16 nId ); 81 82 SvxVerJustifyItem( 83 const SvxCellVerJustify eJustify /*= SVX_VER_JUSTIFY_STANDARD*/, 84 const sal_uInt16 nId ); 85 86 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, 87 SfxMapUnit eCoreMetric, 88 SfxMapUnit ePresMetric, 89 String &rText, const IntlWrapper * = 0 ) const; 90 91 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; 92 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); 93 94 virtual sal_uInt16 GetValueCount() const; 95 virtual String GetValueText( sal_uInt16 nVal ) const; 96 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 97 virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const; 98 operator =(const SvxVerJustifyItem & rVerJustify)99 inline SvxVerJustifyItem& operator=(const SvxVerJustifyItem& rVerJustify) 100 { 101 SetValue( rVerJustify.GetValue() ); 102 return *this; 103 } 104 }; 105 106 107 //------------------------------------------------------------------------ 108 109 class SVX_DLLPUBLIC SvxOrientationItem: public SfxEnumItem 110 { 111 public: 112 TYPEINFO(); 113 114 SvxOrientationItem( 115 const SvxCellOrientation eOrientation /*= SVX_ORIENTATION_STANDARD*/, 116 const sal_uInt16 nId ); 117 118 SvxOrientationItem( 119 sal_Int32 nRotation, sal_Bool bStacked, 120 const sal_uInt16 nId ); 121 122 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, 123 SfxMapUnit eCoreMetric, 124 SfxMapUnit ePresMetric, 125 String &rText, const IntlWrapper * = 0 ) const; 126 127 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; 128 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); 129 130 virtual sal_uInt16 GetValueCount() const; 131 virtual String GetValueText( sal_uInt16 nVal ) const; 132 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 133 virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const; 134 operator =(const SvxOrientationItem & rOrientation)135 inline SvxOrientationItem& operator=(const SvxOrientationItem& rOrientation) 136 { 137 SetValue( rOrientation.GetValue() ); 138 return *this; 139 } 140 141 /** Returns sal_True, if the item represents STACKED state. */ 142 sal_Bool IsStacked() const; 143 /** Returns the rotation this item represents (returns nStdAngle for STANDARD and STACKED state). */ 144 sal_Int32 GetRotation( sal_Int32 nStdAngle = 0 ) const; 145 /** Fills this item according to passed item values. */ 146 void SetFromRotation( sal_Int32 nRotation, sal_Bool bStacked ); 147 }; 148 149 //------------------------------------------------------------------------ 150 151 class SVX_DLLPUBLIC SvxMarginItem: public SfxPoolItem 152 { 153 sal_Int16 nLeftMargin; 154 sal_Int16 nTopMargin; 155 sal_Int16 nRightMargin; 156 sal_Int16 nBottomMargin; 157 public: 158 TYPEINFO(); 159 SvxMarginItem( const sal_uInt16 nId ); 160 SvxMarginItem( sal_Int16 nLeft, sal_Int16 nTop /*= 0*/, 161 sal_Int16 nRight /*= 0*/, sal_Int16 nBottom /*= 0*/, 162 const sal_uInt16 nId ); 163 SvxMarginItem( const SvxMarginItem& ); 164 165 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, 166 SfxMapUnit eCoreMetric, 167 SfxMapUnit ePresMetric, 168 String &rText, const IntlWrapper * = 0 ) const; 169 170 virtual int operator==( const SfxPoolItem& ) const; 171 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 172 virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const; 173 virtual SvStream& Store( SvStream&, sal_uInt16 nItemVersion ) const; 174 175 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; 176 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); 177 GetLeftMargin() const178 sal_Int16 GetLeftMargin() const {return nLeftMargin; } 179 sal_Bool SetLeftMargin(sal_Int16 nLeft); GetTopMargin() const180 sal_Int16 GetTopMargin() const {return nTopMargin; } 181 sal_Bool SetTopMargin(sal_Int16 nTop); GetRightMargin() const182 sal_Int16 GetRightMargin() const {return nRightMargin; } 183 sal_Bool SetRightMargin(sal_Int16 nRight); GetBottomMargin() const184 sal_Int16 GetBottomMargin() const {return nBottomMargin; } 185 sal_Bool SetBottomMargin(sal_Int16 nBottom); 186 operator =(const SvxMarginItem & rMargin)187 inline SvxMarginItem& operator=(const SvxMarginItem& rMargin) 188 { 189 nLeftMargin = rMargin.nLeftMargin; 190 nTopMargin = rMargin.nTopMargin; 191 nRightMargin = rMargin.nRightMargin; 192 nBottomMargin = rMargin.nBottomMargin; 193 return *this; 194 } 195 }; 196 197 #endif 198 199