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