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