Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _TABCOL_HXX
29 : : #define _TABCOL_HXX
30 : :
31 : : #include <tools/solar.h>
32 : :
33 : : #include <vector>
34 : : #include "swdllapi.h"
35 : :
36 : : struct SwTabColsEntry
37 : : {
38 : : long nPos;
39 : : long nMin;
40 : : long nMax;
41 : : sal_Bool bHidden; // For each entry a flag, hidden or not.
42 : : // If the flag bHidden is sal_True column separator
43 : : // is not in current line. It must maintained
44 : : // but it may not be displayed.
45 : : };
46 : :
47 : : typedef std::vector< SwTabColsEntry > SwTabColsEntries;
48 : :
49 : 193 : class SW_DLLPUBLIC SwTabCols
50 : : {
51 : : long nLeftMin, // Leftmost border (reference point) for
52 : : // document coordinates.
53 : : // All other values are relative to this point!
54 : : nLeft, // Left border of table.
55 : : nRight, // Right border of table.
56 : : nRightMax; // Maximum right border of table.
57 : :
58 : : bool bLastRowAllowedToChange; // If the last row of the table frame
59 : : // is split across pages, it may not
60 : : // change its size.
61 : :
62 : : SwTabColsEntries aData;
63 : :
64 : : //For the CopyCTor.
65 : 140 : const SwTabColsEntries& GetData() const { return aData; }
66 : :
67 : : public:
68 : : SwTabCols( sal_uInt16 nSize = 0 );
69 : : SwTabCols( const SwTabCols& );
70 : : SwTabCols &operator=( const SwTabCols& );
71 : : sal_Bool operator==( const SwTabCols& rCmp ) const;
72 : 3077 : long& operator[]( sal_uInt16 nPos ) { return aData[nPos].nPos; }
73 : 714 : long operator[]( sal_uInt16 nPos ) const { return aData[nPos].nPos; }
74 : 6459 : sal_uInt16 Count() const { return sal::static_int_cast< sal_uInt16 >(aData.size()); }
75 : :
76 : 391 : sal_Bool IsHidden( sal_uInt16 nPos ) const { return aData[nPos].bHidden; }
77 : 0 : void SetHidden( sal_uInt16 nPos, sal_Bool bValue ) { aData[nPos].bHidden = bValue; }
78 : :
79 : : void Insert( long nValue, sal_Bool bValue, sal_uInt16 nPos );
80 : : void Insert( long nValue, long nMin, long nMax, sal_Bool bValue, sal_uInt16 nPos );
81 : : void Remove( sal_uInt16 nPos, sal_uInt16 nAnz = 1 );
82 : :
83 : : const SwTabColsEntry& GetEntry( sal_uInt16 nPos ) const { return aData[nPos]; }
84 : 559 : SwTabColsEntry& GetEntry( sal_uInt16 nPos ) { return aData[nPos]; }
85 : :
86 : 184 : long GetLeftMin() const { return nLeftMin; }
87 : 4696 : long GetLeft() const { return nLeft; }
88 : 1720 : long GetRight() const { return nRight; }
89 : 151 : long GetRightMax()const { return nRightMax;}
90 : :
91 : 95 : void SetLeftMin ( long nNew ) { nLeftMin = nNew; }
92 : 95 : void SetLeft ( long nNew ) { nLeft = nNew; }
93 : 95 : void SetRight ( long nNew ) { nRight = nNew; }
94 : 95 : void SetRightMax( long nNew ) { nRightMax = nNew;}
95 : :
96 : 145 : bool IsLastRowAllowedToChange() const { return bLastRowAllowedToChange; }
97 : 2 : void SetLastRowAllowedToChange( bool bNew ) { bLastRowAllowedToChange = bNew; }
98 : : };
99 : :
100 : : #endif //_TABCOL_HXX
101 : :
102 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|