xref: /aoo41x/main/svx/inc/svx/rulritem.hxx (revision 3334a7e6)
1*3334a7e6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*3334a7e6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*3334a7e6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*3334a7e6SAndrew Rist  * distributed with this work for additional information
6*3334a7e6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*3334a7e6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*3334a7e6SAndrew Rist  * "License"); you may not use this file except in compliance
9*3334a7e6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*3334a7e6SAndrew Rist  *
11*3334a7e6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*3334a7e6SAndrew Rist  *
13*3334a7e6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*3334a7e6SAndrew Rist  * software distributed under the License is distributed on an
15*3334a7e6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*3334a7e6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*3334a7e6SAndrew Rist  * specific language governing permissions and limitations
18*3334a7e6SAndrew Rist  * under the License.
19*3334a7e6SAndrew Rist  *
20*3334a7e6SAndrew Rist  *************************************************************/
21*3334a7e6SAndrew Rist 
22*3334a7e6SAndrew Rist 
23cdf0e10cSrcweir #ifndef _SVX_RULRITEM_HXX
24cdf0e10cSrcweir #define _SVX_RULRITEM_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir // include ---------------------------------------------------------------
27cdf0e10cSrcweir 
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <tools/gen.hxx>
30cdf0e10cSrcweir #include <svl/poolitem.hxx>
31cdf0e10cSrcweir #include "svx/svxdllapi.h"
32cdf0e10cSrcweir 
33cdf0e10cSrcweir // class SvxLongLRSpaceItem ----------------------------------------------
34cdf0e10cSrcweir 
35cdf0e10cSrcweir class SVX_DLLPUBLIC SvxLongLRSpaceItem : public SfxPoolItem
36cdf0e10cSrcweir {
37cdf0e10cSrcweir 	long	lLeft;         // nLeft oder der neg. Erstzeileneinzug
38cdf0e10cSrcweir 	long	lRight;        // der unproblematische rechte Rand
39cdf0e10cSrcweir 
40cdf0e10cSrcweir   protected:
41cdf0e10cSrcweir 
42cdf0e10cSrcweir 	virtual int 			 operator==( const SfxPoolItem& ) const;
43cdf0e10cSrcweir 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
44cdf0e10cSrcweir 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
45cdf0e10cSrcweir 
46cdf0e10cSrcweir 	virtual String			 GetValueText() const;
47cdf0e10cSrcweir 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
48cdf0e10cSrcweir 									SfxMapUnit eCoreMetric,
49cdf0e10cSrcweir 									SfxMapUnit ePresMetric,
50cdf0e10cSrcweir                                     String &rText, const IntlWrapper * = 0 ) const;
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 	virtual SfxPoolItem*	 Clone( SfxItemPool *pPool = 0 ) const;
53cdf0e10cSrcweir 
54cdf0e10cSrcweir private:
55cdf0e10cSrcweir 	SVX_DLLPRIVATE const SvxLongLRSpaceItem& operator=(const SvxLongLRSpaceItem &); // n.i.
56cdf0e10cSrcweir 
57cdf0e10cSrcweir public:
58cdf0e10cSrcweir 	TYPEINFO();
59cdf0e10cSrcweir 	SvxLongLRSpaceItem(long lLeft, long lRight, sal_uInt16 nId);
60cdf0e10cSrcweir 	SvxLongLRSpaceItem(const SvxLongLRSpaceItem &);
61cdf0e10cSrcweir     SvxLongLRSpaceItem();
62cdf0e10cSrcweir 
GetLeft() const63cdf0e10cSrcweir 	long    GetLeft() const { return lLeft; }
GetRight() const64cdf0e10cSrcweir 	long    GetRight() const { return lRight; }
SetLeft(long lArgLeft)65cdf0e10cSrcweir 	void    SetLeft(long lArgLeft) {lLeft=lArgLeft;}
SetRight(long lArgRight)66cdf0e10cSrcweir 	void    SetRight(long lArgRight) {lRight=lArgRight;}
67cdf0e10cSrcweir };
68cdf0e10cSrcweir 
69cdf0e10cSrcweir // class SvxLongULSpaceItem ----------------------------------------------
70cdf0e10cSrcweir 
71cdf0e10cSrcweir class SVX_DLLPUBLIC SvxLongULSpaceItem : public SfxPoolItem
72cdf0e10cSrcweir {
73cdf0e10cSrcweir 	long	lLeft;         // nLeft oder der neg. Erstzeileneinzug
74cdf0e10cSrcweir 	long	lRight;        // der unproblematische rechte Rand
75cdf0e10cSrcweir 
76cdf0e10cSrcweir   protected:
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 	virtual int 			 operator==( const SfxPoolItem& ) const;
79cdf0e10cSrcweir 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
80cdf0e10cSrcweir 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 	virtual String			 GetValueText() const;
83cdf0e10cSrcweir 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
84cdf0e10cSrcweir 									SfxMapUnit eCoreMetric,
85cdf0e10cSrcweir 									SfxMapUnit ePresMetric,
86cdf0e10cSrcweir                                     String &rText, const IntlWrapper * = 0 ) const;
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 	virtual SfxPoolItem*	 Clone( SfxItemPool *pPool = 0 ) const;
89cdf0e10cSrcweir 
90cdf0e10cSrcweir private:
91cdf0e10cSrcweir 	SVX_DLLPRIVATE const SvxLongULSpaceItem& operator=(const SvxLongULSpaceItem &); // n.i.
92cdf0e10cSrcweir 
93cdf0e10cSrcweir public:
94cdf0e10cSrcweir 	TYPEINFO();
95cdf0e10cSrcweir 	SvxLongULSpaceItem(long lUpper, long lLower, sal_uInt16 nId);
96cdf0e10cSrcweir 	SvxLongULSpaceItem(const SvxLongULSpaceItem &);
97cdf0e10cSrcweir     SvxLongULSpaceItem();
98cdf0e10cSrcweir 
GetUpper() const99cdf0e10cSrcweir 	long    GetUpper() const { return lLeft; }
GetLower() const100cdf0e10cSrcweir 	long    GetLower() const { return lRight; }
SetUpper(long lArgLeft)101cdf0e10cSrcweir 	void    SetUpper(long lArgLeft) {lLeft=lArgLeft;}
SetLower(long lArgRight)102cdf0e10cSrcweir 	void    SetLower(long lArgRight) {lRight=lArgRight;}
103cdf0e10cSrcweir };
104cdf0e10cSrcweir 
105cdf0e10cSrcweir // class SvxPagePosSizeItem ----------------------------------------------
106cdf0e10cSrcweir 
107cdf0e10cSrcweir class SVX_DLLPUBLIC SvxPagePosSizeItem : public SfxPoolItem
108cdf0e10cSrcweir {
109cdf0e10cSrcweir 	Point aPos;
110cdf0e10cSrcweir 	long lWidth;
111cdf0e10cSrcweir 	long lHeight;
112cdf0e10cSrcweir protected:
113cdf0e10cSrcweir 	virtual int 			 operator==( const SfxPoolItem& ) const;
114cdf0e10cSrcweir 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
115cdf0e10cSrcweir 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	virtual String			 GetValueText() const;
118cdf0e10cSrcweir 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
119cdf0e10cSrcweir 									SfxMapUnit eCoreMetric,
120cdf0e10cSrcweir 									SfxMapUnit ePresMetric,
121cdf0e10cSrcweir                                     String &rText, const IntlWrapper * = 0 ) const;
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 	virtual SfxPoolItem*	 Clone( SfxItemPool *pPool = 0 ) const;
124cdf0e10cSrcweir 
125cdf0e10cSrcweir private:
126cdf0e10cSrcweir 	SVX_DLLPRIVATE const SvxPagePosSizeItem& operator=(const SvxPagePosSizeItem &); // n.i.
127cdf0e10cSrcweir public:
128cdf0e10cSrcweir 	TYPEINFO();
129cdf0e10cSrcweir 	SvxPagePosSizeItem(const Point &rPos, long lWidth, long lHeight);
130cdf0e10cSrcweir 	SvxPagePosSizeItem(const SvxPagePosSizeItem &);
131cdf0e10cSrcweir     SvxPagePosSizeItem();
132cdf0e10cSrcweir 
GetPos() const133cdf0e10cSrcweir 	const Point &GetPos() const { return aPos; }
GetWidth() const134cdf0e10cSrcweir 	long    GetWidth() const { return lWidth; }
GetHeight() const135cdf0e10cSrcweir 	long    GetHeight() const { return lHeight; }
136cdf0e10cSrcweir };
137cdf0e10cSrcweir 
138cdf0e10cSrcweir // struct SvxColumnDescription -------------------------------------------
139cdf0e10cSrcweir 
140cdf0e10cSrcweir struct SvxColumnDescription
141cdf0e10cSrcweir {
142cdf0e10cSrcweir     long nStart;                    /* Spaltenbeginn */
143cdf0e10cSrcweir     long nEnd;                      /* Spaltenende */
144cdf0e10cSrcweir 	sal_Bool   bVisible;				   /* Sichtbarkeit */
145cdf0e10cSrcweir 
146cdf0e10cSrcweir     long nEndMin;         //min. possible position of end
147cdf0e10cSrcweir     long nEndMax;         //max. possible position of end
148cdf0e10cSrcweir 
SvxColumnDescriptionSvxColumnDescription149cdf0e10cSrcweir 	SvxColumnDescription():
150cdf0e10cSrcweir         nStart(0), nEnd(0), bVisible(sal_True), nEndMin(0), nEndMax(0) {}
151cdf0e10cSrcweir 
SvxColumnDescriptionSvxColumnDescription152cdf0e10cSrcweir 	SvxColumnDescription(const SvxColumnDescription &rCopy) :
153cdf0e10cSrcweir         nStart(rCopy.nStart), nEnd(rCopy.nEnd),
154cdf0e10cSrcweir         bVisible(rCopy.bVisible),
155cdf0e10cSrcweir         nEndMin(rCopy.nEndMin), nEndMax(rCopy.nEndMax)
156cdf0e10cSrcweir          {}
157cdf0e10cSrcweir 
SvxColumnDescriptionSvxColumnDescription158cdf0e10cSrcweir     SvxColumnDescription(long start, long end, sal_Bool bVis = sal_True):
159cdf0e10cSrcweir         nStart(start), nEnd(end),
160cdf0e10cSrcweir         bVisible(bVis),
161cdf0e10cSrcweir         nEndMin(0), nEndMax(0) {}
162cdf0e10cSrcweir 
SvxColumnDescriptionSvxColumnDescription163cdf0e10cSrcweir     SvxColumnDescription(long start, long end,
164cdf0e10cSrcweir                         long endMin, long endMax, sal_Bool bVis = sal_True):
165cdf0e10cSrcweir         nStart(start), nEnd(end),
166cdf0e10cSrcweir         bVisible(bVis),
167cdf0e10cSrcweir         nEndMin(endMin), nEndMax(endMax)
168cdf0e10cSrcweir          {}
169cdf0e10cSrcweir 
operator ==SvxColumnDescription170cdf0e10cSrcweir     int operator==(const SvxColumnDescription &rCmp) const {
171cdf0e10cSrcweir 		return nStart == rCmp.nStart &&
172cdf0e10cSrcweir             bVisible == rCmp.bVisible &&
173cdf0e10cSrcweir             nEnd == rCmp.nEnd &&
174cdf0e10cSrcweir             nEndMin == rCmp.nEndMin &&
175cdf0e10cSrcweir                 nEndMax == rCmp.nEndMax;
176cdf0e10cSrcweir     }
operator !=SvxColumnDescription177cdf0e10cSrcweir 	int operator!=(const SvxColumnDescription &rCmp) const {
178cdf0e10cSrcweir 		return !operator==(rCmp);
179cdf0e10cSrcweir 	}
GetWidthSvxColumnDescription180cdf0e10cSrcweir     long GetWidth() const { return nEnd - nStart; }
181cdf0e10cSrcweir };
182cdf0e10cSrcweir 
183cdf0e10cSrcweir // class SvxColumnItem ---------------------------------------------------
184cdf0e10cSrcweir 
185cdf0e10cSrcweir typedef SvPtrarr SvxColumns;
186cdf0e10cSrcweir 
187cdf0e10cSrcweir class SVX_DLLPUBLIC SvxColumnItem : public SfxPoolItem
188cdf0e10cSrcweir {
189cdf0e10cSrcweir 	SvxColumns aColumns;// Spaltenarray
190cdf0e10cSrcweir 	long	nLeft,		// Linker Rand bei Tabelle
191cdf0e10cSrcweir 		   nRight;		// Rechter Rand bei Tabelle; bei Spalten immer gleich
192cdf0e10cSrcweir 						// zum umgebenden Rahmen
193cdf0e10cSrcweir 	sal_uInt16 nActColumn;	// die aktuelle Spalte
194cdf0e10cSrcweir 	sal_Bool    bTable;		// Tabelle?
195cdf0e10cSrcweir 	sal_Bool	bOrtho;     // Gleichverteilte Spalten
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 	void DeleteAndDestroyColumns();
198cdf0e10cSrcweir 
199cdf0e10cSrcweir protected:
200cdf0e10cSrcweir 	virtual int 			 operator==( const SfxPoolItem& ) const;
201cdf0e10cSrcweir 
202cdf0e10cSrcweir 	virtual String			 GetValueText() const;
203cdf0e10cSrcweir 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
204cdf0e10cSrcweir 									SfxMapUnit eCoreMetric,
205cdf0e10cSrcweir 									SfxMapUnit ePresMetric,
206cdf0e10cSrcweir                                     String &rText, const IntlWrapper * = 0 ) const;
207cdf0e10cSrcweir 
208cdf0e10cSrcweir 	virtual SfxPoolItem*	 Clone( SfxItemPool *pPool = 0 ) const;
209cdf0e10cSrcweir 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
210cdf0e10cSrcweir 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
211cdf0e10cSrcweir public:
212cdf0e10cSrcweir 	TYPEINFO();
213cdf0e10cSrcweir 	// rechter Rand des umgebenden Rahmens
214cdf0e10cSrcweir 	// nLeft, nRight jeweils der Abstand zum umgebenden Rahmen
215cdf0e10cSrcweir 	SvxColumnItem(sal_uInt16 nAct = 0); // Spalten
216cdf0e10cSrcweir 	SvxColumnItem(sal_uInt16 nActCol,
217cdf0e10cSrcweir 				  sal_uInt16 nLeft, sal_uInt16 nRight = 0);	// Tabelle mit Raendern
218cdf0e10cSrcweir 	SvxColumnItem(const	SvxColumnItem &);
219cdf0e10cSrcweir 	~SvxColumnItem();
220cdf0e10cSrcweir 
221cdf0e10cSrcweir 	const SvxColumnItem &operator=(const SvxColumnItem &);
222cdf0e10cSrcweir 
Count() const223cdf0e10cSrcweir 	sal_uInt16 Count() const { return aColumns.Count(); }
operator [](sal_uInt16 i)224cdf0e10cSrcweir 	SvxColumnDescription &operator[](sal_uInt16 i)
225cdf0e10cSrcweir 		{ return *(SvxColumnDescription*)aColumns[i]; }
operator [](sal_uInt16 i) const226cdf0e10cSrcweir 	const SvxColumnDescription &operator[](sal_uInt16 i) const
227cdf0e10cSrcweir 		{ return *(SvxColumnDescription*)aColumns[i]; }
Insert(const SvxColumnDescription & rDesc,sal_uInt16 nPos)228cdf0e10cSrcweir 	void Insert(const SvxColumnDescription &rDesc, sal_uInt16 nPos) {
229cdf0e10cSrcweir 		SvxColumnDescription* pDesc = new SvxColumnDescription(rDesc);
230cdf0e10cSrcweir 		aColumns.Insert(pDesc, nPos);
231cdf0e10cSrcweir 	}
Append(const SvxColumnDescription & rDesc)232cdf0e10cSrcweir 	void   Append(const SvxColumnDescription &rDesc) { Insert(rDesc, Count()); }
SetLeft(long left)233cdf0e10cSrcweir 	void   SetLeft(long left) { nLeft = left; }
SetRight(long right)234cdf0e10cSrcweir 	void   SetRight(long right) { nRight = right; }
SetActColumn(sal_uInt16 nCol)235cdf0e10cSrcweir 	void   SetActColumn(sal_uInt16 nCol) { nActColumn = nCol; }
236cdf0e10cSrcweir 
GetActColumn() const237cdf0e10cSrcweir 	sal_uInt16 GetActColumn() const { return nActColumn; }
IsFirstAct() const238cdf0e10cSrcweir 	sal_Bool   IsFirstAct() const { return nActColumn == 0; }
IsLastAct() const239cdf0e10cSrcweir 	sal_Bool   IsLastAct() const { return nActColumn == Count()-1; }
GetLeft()240cdf0e10cSrcweir 	long GetLeft() { return nLeft; }
GetRight()241cdf0e10cSrcweir 	long GetRight() { return nRight; }
242cdf0e10cSrcweir 
IsTable() const243cdf0e10cSrcweir 	sal_Bool   IsTable() const { return bTable; }
244cdf0e10cSrcweir 
245cdf0e10cSrcweir 	sal_Bool   CalcOrtho() const;
SetOrtho(sal_Bool bVal)246cdf0e10cSrcweir 	void   SetOrtho(sal_Bool bVal) { bOrtho = bVal; }
IsOrtho() const247cdf0e10cSrcweir 	sal_Bool   IsOrtho () const { return sal_False ; }
248cdf0e10cSrcweir 
IsConsistent() const249cdf0e10cSrcweir 	sal_Bool IsConsistent() const  { return nActColumn < aColumns.Count(); }
250cdf0e10cSrcweir 	long   GetVisibleRight() const;// rechter sichtbare Rand der aktuellen Spalte
251cdf0e10cSrcweir };
252cdf0e10cSrcweir 
253cdf0e10cSrcweir // class SvxObjectItem ---------------------------------------------------
254cdf0e10cSrcweir 
255cdf0e10cSrcweir class SVX_DLLPUBLIC SvxObjectItem : public SfxPoolItem
256cdf0e10cSrcweir {
257cdf0e10cSrcweir private:
258cdf0e10cSrcweir 	long   nStartX;					   /* Beginn in X-Richtung */
259cdf0e10cSrcweir 	long   nEndX;					   /* Ende in X-Richtung */
260cdf0e10cSrcweir 	long   nStartY;                    /* Beginn in Y-Richtung */
261cdf0e10cSrcweir 	long   nEndY;                      /* Ende in Y-Richtung */
262cdf0e10cSrcweir 	sal_Bool   bLimits;					   /* Grenzwertkontrolle durch die Applikation */
263cdf0e10cSrcweir protected:
264cdf0e10cSrcweir 	virtual int 			 operator==( const SfxPoolItem& ) const;
265cdf0e10cSrcweir 
266cdf0e10cSrcweir 	virtual String			 GetValueText() const;
267cdf0e10cSrcweir 	virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
268cdf0e10cSrcweir 									SfxMapUnit eCoreMetric,
269cdf0e10cSrcweir 									SfxMapUnit ePresMetric,
270cdf0e10cSrcweir                                     String &rText, const IntlWrapper * = 0 ) const;
271cdf0e10cSrcweir 
272cdf0e10cSrcweir 	virtual SfxPoolItem*	 Clone( SfxItemPool *pPool = 0 ) const;
273cdf0e10cSrcweir 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
274cdf0e10cSrcweir 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
275cdf0e10cSrcweir private:
276cdf0e10cSrcweir 	SVX_DLLPRIVATE const SvxObjectItem &operator=(const SvxObjectItem &); // n.i.
277cdf0e10cSrcweir public:
278cdf0e10cSrcweir 	TYPEINFO();
279cdf0e10cSrcweir 	SvxObjectItem(long nStartX, long nEndX,
280cdf0e10cSrcweir 				  long nStartY, long nEndY,
281cdf0e10cSrcweir 				  sal_Bool bLimits = sal_False);
282cdf0e10cSrcweir 	SvxObjectItem(const SvxObjectItem &);
283cdf0e10cSrcweir 
HasLimits() const284cdf0e10cSrcweir 	sal_Bool   HasLimits() const { return bLimits; }
285cdf0e10cSrcweir 
GetStartX() const286cdf0e10cSrcweir 	long   GetStartX() const { return nStartX; }
GetEndX() const287cdf0e10cSrcweir 	long   GetEndX() const { return nEndX; }
GetStartY() const288cdf0e10cSrcweir 	long   GetStartY() const { return nStartY; }
GetEndY() const289cdf0e10cSrcweir 	long   GetEndY() const { return nEndY; }
290cdf0e10cSrcweir 
SetStartX(long l)291cdf0e10cSrcweir 	void   SetStartX(long l) { nStartX = l; }
SetEndX(long l)292cdf0e10cSrcweir 	void   SetEndX(long l) { nEndX = l; }
SetStartY(long l)293cdf0e10cSrcweir 	void   SetStartY(long l) { nStartY = l; }
SetEndY(long l)294cdf0e10cSrcweir 	void   SetEndY(long l) { nEndY = l; }
295cdf0e10cSrcweir };
296cdf0e10cSrcweir 
297cdf0e10cSrcweir 
298cdf0e10cSrcweir #endif
299cdf0e10cSrcweir 
300