xref: /aoo42x/main/sw/inc/tabcol.hxx (revision cdf0e10c)
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 _TABCOL_HXX
28 #define _TABCOL_HXX
29 
30 #ifndef _SVSTDARR_HXX
31 #define _SVSTDARR_LONGS
32 #define _SVSTDARR_BOOLS
33 #include <svl/svstdarr.hxx>
34 #endif
35 
36 #ifndef INCLUDED_VECTOR
37 #include <vector>
38 #define INCLUDED_VECTOR
39 #endif
40 #include "swdllapi.h"
41 
42 struct SwTabColsEntry
43 {
44     long    nPos;
45     long    nMin;
46     long    nMax;
47     sal_Bool    bHidden;    //Fuer jeden Eintrag ein Flag, Hidden oder nicht.
48                         //Wenn das Flag Hidden sal_True ist liegt der Spalten-
49                         //trenner nicht in der aktuellen Zeile; er muss
50                         //mit gepflegt werden, darf aber nicht angezeigt
51                         //werden.
52 };
53 
54 typedef std::vector< SwTabColsEntry > SwTabColsEntries;
55 
56 class SW_DLLPUBLIC SwTabCols
57 {
58 	long nLeftMin,		//Linker aeusserer Rand (Bezugspunkt) in
59 						//Dokumentkordinaten.
60 						//Alle anderen Werte relativ zu diesem Punkt!
61 			nLeft,		//Linker Rand der Tabelle.
62 		   nRight,		//Rechter Rand der Tabelle.
63 		   nRightMax;	//Maximaler rechter Rand der Tabelle.
64 
65     bool bLastRowAllowedToChange;       // if the last row of the table frame
66                                         // is split across pages, it may not
67                                         // change its size
68 
69     SwTabColsEntries aData;
70 
71     //fuer den CopyCTor
72     const SwTabColsEntries& GetData() const { return aData; }
73 
74 public:
75 	SwTabCols( sal_uInt16 nSize = 0 );
76 	SwTabCols( const SwTabCols& );
77 	SwTabCols &operator=( const SwTabCols& );
78 	sal_Bool operator==( const SwTabCols& rCmp ) const;
79     long& operator[]( sal_uInt16 nPos ) { return aData[nPos].nPos; }
80     long operator[]( sal_uInt16 nPos ) const { return aData[nPos].nPos; }
81     sal_uInt16 Count() const { return sal::static_int_cast< sal_uInt16 >(aData.size()); }
82 
83     sal_Bool IsHidden( sal_uInt16 nPos ) const         { return aData[nPos].bHidden; }
84     void SetHidden( sal_uInt16 nPos, sal_Bool bValue ) { aData[nPos].bHidden = bValue; }
85 
86     void Insert( long nValue, sal_Bool bValue, sal_uInt16 nPos );
87     void Insert( long nValue, long nMin, long nMax, sal_Bool bValue, sal_uInt16 nPos );
88     void Remove( sal_uInt16 nPos, sal_uInt16 nAnz = 1 );
89 
90     const SwTabColsEntry& GetEntry( sal_uInt16 nPos ) const { return aData[nPos]; }
91           SwTabColsEntry& GetEntry( sal_uInt16 nPos )  { return aData[nPos]; }
92 
93 	long GetLeftMin() const { return nLeftMin; }
94 	long GetLeft()	const { return nLeft;	 }
95 	long GetRight()	const { return nRight;	 }
96 	long GetRightMax()const { return nRightMax;}
97 
98 	void SetLeftMin ( long nNew )	{ nLeftMin = nNew; }
99 	void SetLeft	( long nNew )	{ nLeft = nNew;	   }
100 	void SetRight	( long nNew )	{ nRight = nNew;   }
101 	void SetRightMax( long nNew )	{ nRightMax = nNew;}
102 
103     bool IsLastRowAllowedToChange() const { return bLastRowAllowedToChange; }
104     void SetLastRowAllowedToChange( bool bNew ) { bLastRowAllowedToChange = bNew; }
105 };
106 
107 #endif	//_TABCOL_HXX
108