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