xref: /aoo41x/main/sw/source/ui/inc/colmgr.hxx (revision 1d2dbeb0)
1*1d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1d2dbeb0SAndrew Rist  * distributed with this work for additional information
6*1d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
9*1d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*1d2dbeb0SAndrew Rist  *
11*1d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*1d2dbeb0SAndrew Rist  *
13*1d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
15*1d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
18*1d2dbeb0SAndrew Rist  * under the License.
19*1d2dbeb0SAndrew Rist  *
20*1d2dbeb0SAndrew Rist  *************************************************************/
21*1d2dbeb0SAndrew Rist 
22*1d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef _COLMGR_HXX
24cdf0e10cSrcweir #define _COLMGR_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "swdllapi.h"
27cdf0e10cSrcweir #include <fmtclds.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir SW_DLLPUBLIC void FitToActualSize(SwFmtCol& rCol, sal_uInt16 nWidth);
30cdf0e10cSrcweir 
31cdf0e10cSrcweir class SW_DLLPUBLIC SwColMgr
32cdf0e10cSrcweir {
33cdf0e10cSrcweir public:
34cdf0e10cSrcweir 		// lActWidth wird aus den Edits des Seitendialogs
35cdf0e10cSrcweir 		// direkt uebergeben
36cdf0e10cSrcweir 	SwColMgr(const SfxItemSet &rSet, sal_uInt16 nActWidth = USHRT_MAX);
37cdf0e10cSrcweir 	~SwColMgr();
38cdf0e10cSrcweir 
39cdf0e10cSrcweir 
40cdf0e10cSrcweir 	inline sal_uInt16 		GetCount() const;
41cdf0e10cSrcweir 	void 				SetCount(sal_uInt16 nCount, sal_uInt16 nGutterWidth);
42cdf0e10cSrcweir 	sal_uInt16 				GetGutterWidth(sal_uInt16 nPos = USHRT_MAX) const;
43cdf0e10cSrcweir 	void 				SetGutterWidth(sal_uInt16 nWidth, sal_uInt16 nPos = USHRT_MAX);
44cdf0e10cSrcweir 
45cdf0e10cSrcweir 	sal_uInt16 				GetColWidth(sal_uInt16 nIdx) const;
46cdf0e10cSrcweir 	void 				SetColWidth(sal_uInt16 nIdx, sal_uInt16 nWidth);
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 	inline sal_Bool 		IsAutoWidth() const;
49cdf0e10cSrcweir 	void 				SetAutoWidth(sal_Bool bOn = sal_True, sal_uInt16 lGutterWidth = 0);
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 	inline sal_Bool			HasLine() const;
52cdf0e10cSrcweir 	inline void 		SetNoLine();
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 	inline void 		SetLineWidthAndColor(sal_uLong nWidth, const Color& rCol);
55cdf0e10cSrcweir 	inline sal_uLong		GetLineWidth() const;
56cdf0e10cSrcweir 	inline const Color& GetLineColor() const;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 	inline SwColLineAdj GetAdjust() const;
59cdf0e10cSrcweir 	inline void 		SetAdjust(SwColLineAdj);
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 	short 				GetLineHeightPercent() const;
62cdf0e10cSrcweir 	void 				SetLineHeightPercent(short nPercent);
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 	inline void			NoCols();
65cdf0e10cSrcweir 	void 				Update();
66cdf0e10cSrcweir 
GetColumns() const67cdf0e10cSrcweir 	const SwFmtCol& 	GetColumns() const { return aFmtCol; }
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 	void				SetActualWidth(sal_uInt16 nW);
GetActualSize() const70cdf0e10cSrcweir 	sal_uInt16				GetActualSize() const { return nWidth; }
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 
73cdf0e10cSrcweir private:
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 	SwFmtCol 			aFmtCol;
76cdf0e10cSrcweir 	sal_uInt16 				nWidth;
77cdf0e10cSrcweir };
78cdf0e10cSrcweir 
79cdf0e10cSrcweir // INLINE METHODE --------------------------------------------------------
80cdf0e10cSrcweir 
GetCount() const81cdf0e10cSrcweir inline 	sal_uInt16 SwColMgr::GetCount() const
82cdf0e10cSrcweir {
83cdf0e10cSrcweir 	return aFmtCol.GetNumCols();
84cdf0e10cSrcweir }
SetLineWidthAndColor(sal_uLong nLWidth,const Color & rCol)85cdf0e10cSrcweir inline void         SwColMgr::SetLineWidthAndColor(sal_uLong nLWidth, const Color& rCol)
86cdf0e10cSrcweir {
87cdf0e10cSrcweir     aFmtCol.SetLineWidth(nLWidth);
88cdf0e10cSrcweir 	aFmtCol.SetLineColor(rCol);
89cdf0e10cSrcweir }
GetLineWidth() const90cdf0e10cSrcweir inline sal_uLong		SwColMgr::GetLineWidth() const
91cdf0e10cSrcweir {
92cdf0e10cSrcweir 	return aFmtCol.GetLineWidth();
93cdf0e10cSrcweir }
GetLineColor() const94cdf0e10cSrcweir inline const Color& SwColMgr::GetLineColor() const
95cdf0e10cSrcweir {
96cdf0e10cSrcweir 	return aFmtCol.GetLineColor();
97cdf0e10cSrcweir }
GetAdjust() const98cdf0e10cSrcweir inline	SwColLineAdj SwColMgr::GetAdjust() const
99cdf0e10cSrcweir {
100cdf0e10cSrcweir 	return aFmtCol.GetLineAdj();
101cdf0e10cSrcweir }
SetAdjust(SwColLineAdj eAdj)102cdf0e10cSrcweir inline	void SwColMgr::SetAdjust(SwColLineAdj eAdj)
103cdf0e10cSrcweir {
104cdf0e10cSrcweir 	aFmtCol.SetLineAdj(eAdj);
105cdf0e10cSrcweir }
IsAutoWidth() const106cdf0e10cSrcweir inline sal_Bool SwColMgr::IsAutoWidth() const
107cdf0e10cSrcweir {
108cdf0e10cSrcweir 	return aFmtCol.IsOrtho();
109cdf0e10cSrcweir }
SetAutoWidth(sal_Bool bOn,sal_uInt16 nGutterWidth)110cdf0e10cSrcweir inline void SwColMgr::SetAutoWidth(sal_Bool bOn, sal_uInt16 nGutterWidth)
111cdf0e10cSrcweir {
112cdf0e10cSrcweir 	aFmtCol.SetOrtho(bOn, nGutterWidth, nWidth);
113cdf0e10cSrcweir }
NoCols()114cdf0e10cSrcweir inline void	SwColMgr::NoCols()
115cdf0e10cSrcweir {
116cdf0e10cSrcweir 	aFmtCol.GetColumns().DeleteAndDestroy(0, aFmtCol.GetColumns().Count());
117cdf0e10cSrcweir }
HasLine() const118cdf0e10cSrcweir inline sal_Bool SwColMgr::HasLine() const
119cdf0e10cSrcweir {
120cdf0e10cSrcweir 	return GetAdjust() != COLADJ_NONE;
121cdf0e10cSrcweir }
SetNoLine()122cdf0e10cSrcweir inline void SwColMgr::SetNoLine()
123cdf0e10cSrcweir {
124cdf0e10cSrcweir 	SetAdjust(COLADJ_NONE);
125cdf0e10cSrcweir }
126cdf0e10cSrcweir 
127cdf0e10cSrcweir #endif
128