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 _COLMGR_HXX
29 : : #define _COLMGR_HXX
30 : :
31 : : #include "swdllapi.h"
32 : : #include <fmtclds.hxx>
33 : :
34 : : SW_DLLPUBLIC void FitToActualSize(SwFmtCol& rCol, sal_uInt16 nWidth);
35 : :
36 : : class SW_DLLPUBLIC SwColMgr
37 : : {
38 : : public:
39 : : // lActWidth is passed directly from the page dialogs edits
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 : : void SetLineWidthAndColor(::editeng::SvxBorderStyle eStyle, sal_uLong nWidth, const Color& rCol);
59 : : inline ::editeng::SvxBorderStyle GetLineStyle() const;
60 : : inline sal_uLong GetLineWidth() const;
61 : : inline const Color& GetLineColor() const;
62 : :
63 : : inline SwColLineAdj GetAdjust() const;
64 : : inline void SetAdjust(SwColLineAdj);
65 : :
66 : : short GetLineHeightPercent() const;
67 : : void SetLineHeightPercent(short nPercent);
68 : :
69 : : inline void NoCols();
70 : : void Update();
71 : :
72 : 0 : const SwFmtCol& GetColumns() const { return aFmtCol; }
73 : :
74 : : void SetActualWidth(sal_uInt16 nW);
75 : 0 : sal_uInt16 GetActualSize() const { return nWidth; }
76 : :
77 : :
78 : : private:
79 : :
80 : : SwFmtCol aFmtCol;
81 : : sal_uInt16 nWidth;
82 : : };
83 : :
84 : : // INLINE METHOD --------------------------------------------------------
85 : 0 : inline sal_uInt16 SwColMgr::GetCount() const
86 : : {
87 : 0 : return aFmtCol.GetNumCols();
88 : : }
89 : :
90 : 0 : inline ::editeng::SvxBorderStyle SwColMgr::GetLineStyle() const
91 : : {
92 : 0 : return aFmtCol.GetLineStyle();
93 : : }
94 : 0 : inline sal_uLong SwColMgr::GetLineWidth() const
95 : : {
96 : 0 : return aFmtCol.GetLineWidth();
97 : : }
98 : :
99 : 0 : inline const Color& SwColMgr::GetLineColor() const
100 : : {
101 : 0 : return aFmtCol.GetLineColor();
102 : : }
103 : :
104 : 0 : inline SwColLineAdj SwColMgr::GetAdjust() const
105 : : {
106 : 0 : return aFmtCol.GetLineAdj();
107 : : }
108 : :
109 : 0 : inline void SwColMgr::SetAdjust(SwColLineAdj eAdj)
110 : : {
111 : 0 : aFmtCol.SetLineAdj(eAdj);
112 : 0 : }
113 : 0 : inline sal_Bool SwColMgr::IsAutoWidth() const
114 : : {
115 : 0 : return aFmtCol.IsOrtho();
116 : : }
117 : 0 : inline void SwColMgr::SetAutoWidth(sal_Bool bOn, sal_uInt16 nGutterWidth)
118 : : {
119 : 0 : aFmtCol.SetOrtho(bOn, nGutterWidth, nWidth);
120 : 0 : }
121 : :
122 : 0 : inline void SwColMgr::NoCols()
123 : : {
124 : 0 : aFmtCol.GetColumns().clear();
125 : 0 : }
126 : 0 : inline sal_Bool SwColMgr::HasLine() const
127 : : {
128 : 0 : return GetAdjust() != COLADJ_NONE;
129 : : }
130 : :
131 : 0 : inline void SwColMgr::SetNoLine()
132 : : {
133 : 0 : SetAdjust(COLADJ_NONE);
134 : 0 : }
135 : :
136 : : #endif
137 : :
138 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|