1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _SVX_RULRITEM_HXX 28 #define _SVX_RULRITEM_HXX 29 30 // include --------------------------------------------------------------- 31 32 33 #include <tools/gen.hxx> 34 #include <svl/poolitem.hxx> 35 #include "svx/svxdllapi.h" 36 37 // class SvxLongLRSpaceItem ---------------------------------------------- 38 39 class SVX_DLLPUBLIC SvxLongLRSpaceItem : public SfxPoolItem 40 { 41 long lLeft; // nLeft oder der neg. Erstzeileneinzug 42 long lRight; // der unproblematische rechte Rand 43 44 protected: 45 46 virtual int operator==( const SfxPoolItem& ) const; 47 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; 48 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); 49 50 virtual String GetValueText() const; 51 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, 52 SfxMapUnit eCoreMetric, 53 SfxMapUnit ePresMetric, 54 String &rText, const IntlWrapper * = 0 ) const; 55 56 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 57 58 private: 59 SVX_DLLPRIVATE const SvxLongLRSpaceItem& operator=(const SvxLongLRSpaceItem &); // n.i. 60 61 public: 62 TYPEINFO(); 63 SvxLongLRSpaceItem(long lLeft, long lRight, sal_uInt16 nId); 64 SvxLongLRSpaceItem(const SvxLongLRSpaceItem &); 65 SvxLongLRSpaceItem(); 66 67 long GetLeft() const { return lLeft; } 68 long GetRight() const { return lRight; } 69 void SetLeft(long lArgLeft) {lLeft=lArgLeft;} 70 void SetRight(long lArgRight) {lRight=lArgRight;} 71 }; 72 73 // class SvxLongULSpaceItem ---------------------------------------------- 74 75 class SVX_DLLPUBLIC SvxLongULSpaceItem : public SfxPoolItem 76 { 77 long lLeft; // nLeft oder der neg. Erstzeileneinzug 78 long lRight; // der unproblematische rechte Rand 79 80 protected: 81 82 virtual int operator==( const SfxPoolItem& ) const; 83 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; 84 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); 85 86 virtual String GetValueText() const; 87 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, 88 SfxMapUnit eCoreMetric, 89 SfxMapUnit ePresMetric, 90 String &rText, const IntlWrapper * = 0 ) const; 91 92 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 93 94 private: 95 SVX_DLLPRIVATE const SvxLongULSpaceItem& operator=(const SvxLongULSpaceItem &); // n.i. 96 97 public: 98 TYPEINFO(); 99 SvxLongULSpaceItem(long lUpper, long lLower, sal_uInt16 nId); 100 SvxLongULSpaceItem(const SvxLongULSpaceItem &); 101 SvxLongULSpaceItem(); 102 103 long GetUpper() const { return lLeft; } 104 long GetLower() const { return lRight; } 105 void SetUpper(long lArgLeft) {lLeft=lArgLeft;} 106 void SetLower(long lArgRight) {lRight=lArgRight;} 107 }; 108 109 // class SvxPagePosSizeItem ---------------------------------------------- 110 111 class SVX_DLLPUBLIC SvxPagePosSizeItem : public SfxPoolItem 112 { 113 Point aPos; 114 long lWidth; 115 long lHeight; 116 protected: 117 virtual int operator==( const SfxPoolItem& ) const; 118 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; 119 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); 120 121 virtual String GetValueText() const; 122 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, 123 SfxMapUnit eCoreMetric, 124 SfxMapUnit ePresMetric, 125 String &rText, const IntlWrapper * = 0 ) const; 126 127 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 128 129 private: 130 SVX_DLLPRIVATE const SvxPagePosSizeItem& operator=(const SvxPagePosSizeItem &); // n.i. 131 public: 132 TYPEINFO(); 133 SvxPagePosSizeItem(const Point &rPos, long lWidth, long lHeight); 134 SvxPagePosSizeItem(const SvxPagePosSizeItem &); 135 SvxPagePosSizeItem(); 136 137 const Point &GetPos() const { return aPos; } 138 long GetWidth() const { return lWidth; } 139 long GetHeight() const { return lHeight; } 140 }; 141 142 // struct SvxColumnDescription ------------------------------------------- 143 144 struct SvxColumnDescription 145 { 146 long nStart; /* Spaltenbeginn */ 147 long nEnd; /* Spaltenende */ 148 sal_Bool bVisible; /* Sichtbarkeit */ 149 150 long nEndMin; //min. possible position of end 151 long nEndMax; //max. possible position of end 152 153 SvxColumnDescription(): 154 nStart(0), nEnd(0), bVisible(sal_True), nEndMin(0), nEndMax(0) {} 155 156 SvxColumnDescription(const SvxColumnDescription &rCopy) : 157 nStart(rCopy.nStart), nEnd(rCopy.nEnd), 158 bVisible(rCopy.bVisible), 159 nEndMin(rCopy.nEndMin), nEndMax(rCopy.nEndMax) 160 {} 161 162 SvxColumnDescription(long start, long end, sal_Bool bVis = sal_True): 163 nStart(start), nEnd(end), 164 bVisible(bVis), 165 nEndMin(0), nEndMax(0) {} 166 167 SvxColumnDescription(long start, long end, 168 long endMin, long endMax, sal_Bool bVis = sal_True): 169 nStart(start), nEnd(end), 170 bVisible(bVis), 171 nEndMin(endMin), nEndMax(endMax) 172 {} 173 174 int operator==(const SvxColumnDescription &rCmp) const { 175 return nStart == rCmp.nStart && 176 bVisible == rCmp.bVisible && 177 nEnd == rCmp.nEnd && 178 nEndMin == rCmp.nEndMin && 179 nEndMax == rCmp.nEndMax; 180 } 181 int operator!=(const SvxColumnDescription &rCmp) const { 182 return !operator==(rCmp); 183 } 184 long GetWidth() const { return nEnd - nStart; } 185 }; 186 187 // class SvxColumnItem --------------------------------------------------- 188 189 typedef SvPtrarr SvxColumns; 190 191 class SVX_DLLPUBLIC SvxColumnItem : public SfxPoolItem 192 { 193 SvxColumns aColumns;// Spaltenarray 194 long nLeft, // Linker Rand bei Tabelle 195 nRight; // Rechter Rand bei Tabelle; bei Spalten immer gleich 196 // zum umgebenden Rahmen 197 sal_uInt16 nActColumn; // die aktuelle Spalte 198 sal_Bool bTable; // Tabelle? 199 sal_Bool bOrtho; // Gleichverteilte Spalten 200 201 void DeleteAndDestroyColumns(); 202 203 protected: 204 virtual int operator==( const SfxPoolItem& ) const; 205 206 virtual String GetValueText() const; 207 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, 208 SfxMapUnit eCoreMetric, 209 SfxMapUnit ePresMetric, 210 String &rText, const IntlWrapper * = 0 ) const; 211 212 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 213 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; 214 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); 215 public: 216 TYPEINFO(); 217 // rechter Rand des umgebenden Rahmens 218 // nLeft, nRight jeweils der Abstand zum umgebenden Rahmen 219 SvxColumnItem(sal_uInt16 nAct = 0); // Spalten 220 SvxColumnItem(sal_uInt16 nActCol, 221 sal_uInt16 nLeft, sal_uInt16 nRight = 0); // Tabelle mit Raendern 222 SvxColumnItem(const SvxColumnItem &); 223 ~SvxColumnItem(); 224 225 const SvxColumnItem &operator=(const SvxColumnItem &); 226 227 sal_uInt16 Count() const { return aColumns.Count(); } 228 SvxColumnDescription &operator[](sal_uInt16 i) 229 { return *(SvxColumnDescription*)aColumns[i]; } 230 const SvxColumnDescription &operator[](sal_uInt16 i) const 231 { return *(SvxColumnDescription*)aColumns[i]; } 232 void Insert(const SvxColumnDescription &rDesc, sal_uInt16 nPos) { 233 SvxColumnDescription* pDesc = new SvxColumnDescription(rDesc); 234 aColumns.Insert(pDesc, nPos); 235 } 236 void Append(const SvxColumnDescription &rDesc) { Insert(rDesc, Count()); } 237 void SetLeft(long left) { nLeft = left; } 238 void SetRight(long right) { nRight = right; } 239 void SetActColumn(sal_uInt16 nCol) { nActColumn = nCol; } 240 241 sal_uInt16 GetActColumn() const { return nActColumn; } 242 sal_Bool IsFirstAct() const { return nActColumn == 0; } 243 sal_Bool IsLastAct() const { return nActColumn == Count()-1; } 244 long GetLeft() { return nLeft; } 245 long GetRight() { return nRight; } 246 247 sal_Bool IsTable() const { return bTable; } 248 249 sal_Bool CalcOrtho() const; 250 void SetOrtho(sal_Bool bVal) { bOrtho = bVal; } 251 sal_Bool IsOrtho () const { return sal_False ; } 252 253 sal_Bool IsConsistent() const { return nActColumn < aColumns.Count(); } 254 long GetVisibleRight() const;// rechter sichtbare Rand der aktuellen Spalte 255 }; 256 257 // class SvxObjectItem --------------------------------------------------- 258 259 class SVX_DLLPUBLIC SvxObjectItem : public SfxPoolItem 260 { 261 private: 262 long nStartX; /* Beginn in X-Richtung */ 263 long nEndX; /* Ende in X-Richtung */ 264 long nStartY; /* Beginn in Y-Richtung */ 265 long nEndY; /* Ende in Y-Richtung */ 266 sal_Bool bLimits; /* Grenzwertkontrolle durch die Applikation */ 267 protected: 268 virtual int operator==( const SfxPoolItem& ) const; 269 270 virtual String GetValueText() const; 271 virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, 272 SfxMapUnit eCoreMetric, 273 SfxMapUnit ePresMetric, 274 String &rText, const IntlWrapper * = 0 ) const; 275 276 virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; 277 virtual sal_Bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; 278 virtual sal_Bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); 279 private: 280 SVX_DLLPRIVATE const SvxObjectItem &operator=(const SvxObjectItem &); // n.i. 281 public: 282 TYPEINFO(); 283 SvxObjectItem(long nStartX, long nEndX, 284 long nStartY, long nEndY, 285 sal_Bool bLimits = sal_False); 286 SvxObjectItem(const SvxObjectItem &); 287 288 sal_Bool HasLimits() const { return bLimits; } 289 290 long GetStartX() const { return nStartX; } 291 long GetEndX() const { return nEndX; } 292 long GetStartY() const { return nStartY; } 293 long GetEndY() const { return nEndY; } 294 295 void SetStartX(long l) { nStartX = l; } 296 void SetEndX(long l) { nEndX = l; } 297 void SetStartY(long l) { nStartY = l; } 298 void SetEndY(long l) { nEndY = l; } 299 }; 300 301 302 #endif 303 304