xref: /aoo42x/main/sw/source/ui/inc/colmgr.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 _COLMGR_HXX
28 #define _COLMGR_HXX
29 
30 #include "swdllapi.h"
31 #include <fmtclds.hxx>
32 
33 SW_DLLPUBLIC void FitToActualSize(SwFmtCol& rCol, sal_uInt16 nWidth);
34 
35 class SW_DLLPUBLIC SwColMgr
36 {
37 public:
38 		// lActWidth wird aus den Edits des Seitendialogs
39 		// direkt uebergeben
40 	SwColMgr(const SfxItemSet &rSet, sal_uInt16 nActWidth = USHRT_MAX);
41 	~SwColMgr();
42 
43 
44 	inline sal_uInt16 		GetCount() const;
45 	void 				SetCount(sal_uInt16 nCount, sal_uInt16 nGutterWidth);
46 	sal_uInt16 				GetGutterWidth(sal_uInt16 nPos = USHRT_MAX) const;
47 	void 				SetGutterWidth(sal_uInt16 nWidth, sal_uInt16 nPos = USHRT_MAX);
48 
49 	sal_uInt16 				GetColWidth(sal_uInt16 nIdx) const;
50 	void 				SetColWidth(sal_uInt16 nIdx, sal_uInt16 nWidth);
51 
52 	inline sal_Bool 		IsAutoWidth() const;
53 	void 				SetAutoWidth(sal_Bool bOn = sal_True, sal_uInt16 lGutterWidth = 0);
54 
55 	inline sal_Bool			HasLine() const;
56 	inline void 		SetNoLine();
57 
58 	inline void 		SetLineWidthAndColor(sal_uLong nWidth, const Color& rCol);
59 	inline sal_uLong		GetLineWidth() const;
60 	inline const Color& GetLineColor() const;
61 
62 	inline SwColLineAdj GetAdjust() const;
63 	inline void 		SetAdjust(SwColLineAdj);
64 
65 	short 				GetLineHeightPercent() const;
66 	void 				SetLineHeightPercent(short nPercent);
67 
68 	inline void			NoCols();
69 	void 				Update();
70 
71 	const SwFmtCol& 	GetColumns() const { return aFmtCol; }
72 
73 	void				SetActualWidth(sal_uInt16 nW);
74 	sal_uInt16				GetActualSize() const { return nWidth; }
75 
76 
77 private:
78 
79 	SwFmtCol 			aFmtCol;
80 	sal_uInt16 				nWidth;
81 };
82 
83 // INLINE METHODE --------------------------------------------------------
84 
85 inline 	sal_uInt16 SwColMgr::GetCount() const
86 {
87 	return aFmtCol.GetNumCols();
88 }
89 inline void         SwColMgr::SetLineWidthAndColor(sal_uLong nLWidth, const Color& rCol)
90 {
91     aFmtCol.SetLineWidth(nLWidth);
92 	aFmtCol.SetLineColor(rCol);
93 }
94 inline sal_uLong		SwColMgr::GetLineWidth() const
95 {
96 	return aFmtCol.GetLineWidth();
97 }
98 inline const Color& SwColMgr::GetLineColor() const
99 {
100 	return aFmtCol.GetLineColor();
101 }
102 inline	SwColLineAdj SwColMgr::GetAdjust() const
103 {
104 	return aFmtCol.GetLineAdj();
105 }
106 inline	void SwColMgr::SetAdjust(SwColLineAdj eAdj)
107 {
108 	aFmtCol.SetLineAdj(eAdj);
109 }
110 inline sal_Bool SwColMgr::IsAutoWidth() const
111 {
112 	return aFmtCol.IsOrtho();
113 }
114 inline void SwColMgr::SetAutoWidth(sal_Bool bOn, sal_uInt16 nGutterWidth)
115 {
116 	aFmtCol.SetOrtho(bOn, nGutterWidth, nWidth);
117 }
118 inline void	SwColMgr::NoCols()
119 {
120 	aFmtCol.GetColumns().DeleteAndDestroy(0, aFmtCol.GetColumns().Count());
121 }
122 inline sal_Bool SwColMgr::HasLine() const
123 {
124 	return GetAdjust() != COLADJ_NONE;
125 }
126 inline void SwColMgr::SetNoLine()
127 {
128 	SetAdjust(COLADJ_NONE);
129 }
130 
131 #endif
132