Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_COLMGR_HXX
20 : #define INCLUDED_SW_SOURCE_UIBASE_INC_COLMGR_HXX
21 :
22 : #include "swdllapi.h"
23 : #include <fmtclds.hxx>
24 :
25 : SW_DLLPUBLIC void FitToActualSize(SwFormatCol& rCol, sal_uInt16 nWidth);
26 :
27 : class SW_DLLPUBLIC SwColMgr
28 : {
29 : public:
30 : // lActWidth is passed directly from the page dialogs edits
31 : SwColMgr(const SfxItemSet &rSet, sal_uInt16 nActWidth = USHRT_MAX);
32 : ~SwColMgr();
33 :
34 : inline sal_uInt16 GetCount() const;
35 : void SetCount(sal_uInt16 nCount, sal_uInt16 nGutterWidth);
36 : sal_uInt16 GetGutterWidth(sal_uInt16 nPos = USHRT_MAX) const;
37 : void SetGutterWidth(sal_uInt16 nWidth, sal_uInt16 nPos = USHRT_MAX);
38 :
39 : sal_uInt16 GetColWidth(sal_uInt16 nIdx) const;
40 : void SetColWidth(sal_uInt16 nIdx, sal_uInt16 nWidth);
41 :
42 : inline bool IsAutoWidth() const;
43 : void SetAutoWidth(bool bOn = true, sal_uInt16 lGutterWidth = 0);
44 :
45 : inline bool HasLine() const;
46 : inline void SetNoLine();
47 :
48 : void SetLineWidthAndColor(::editeng::SvxBorderStyle eStyle, sal_uLong nWidth, const Color& rCol);
49 : inline ::editeng::SvxBorderStyle GetLineStyle() const;
50 : inline sal_uLong GetLineWidth() const;
51 : inline const Color& GetLineColor() const;
52 :
53 : inline SwColLineAdj GetAdjust() const;
54 : inline void SetAdjust(SwColLineAdj);
55 :
56 : short GetLineHeightPercent() const;
57 : void SetLineHeightPercent(short nPercent);
58 :
59 : inline void NoCols();
60 : void Update();
61 :
62 0 : const SwFormatCol& GetColumns() const { return aFormatCol; }
63 :
64 : void SetActualWidth(sal_uInt16 nW);
65 0 : sal_uInt16 GetActualSize() const { return nWidth; }
66 :
67 : private:
68 :
69 : SwFormatCol aFormatCol;
70 : sal_uInt16 nWidth;
71 : };
72 :
73 0 : inline sal_uInt16 SwColMgr::GetCount() const
74 : {
75 0 : return aFormatCol.GetNumCols();
76 : }
77 :
78 0 : inline ::editeng::SvxBorderStyle SwColMgr::GetLineStyle() const
79 : {
80 0 : return aFormatCol.GetLineStyle();
81 : }
82 0 : inline sal_uLong SwColMgr::GetLineWidth() const
83 : {
84 0 : return aFormatCol.GetLineWidth();
85 : }
86 :
87 0 : inline const Color& SwColMgr::GetLineColor() const
88 : {
89 0 : return aFormatCol.GetLineColor();
90 : }
91 :
92 0 : inline SwColLineAdj SwColMgr::GetAdjust() const
93 : {
94 0 : return aFormatCol.GetLineAdj();
95 : }
96 :
97 0 : inline void SwColMgr::SetAdjust(SwColLineAdj eAdj)
98 : {
99 0 : aFormatCol.SetLineAdj(eAdj);
100 0 : }
101 0 : inline bool SwColMgr::IsAutoWidth() const
102 : {
103 0 : return aFormatCol.IsOrtho();
104 : }
105 0 : inline void SwColMgr::SetAutoWidth(bool bOn, sal_uInt16 nGutterWidth)
106 : {
107 0 : aFormatCol.SetOrtho(bOn, nGutterWidth, nWidth);
108 0 : }
109 :
110 0 : inline void SwColMgr::NoCols()
111 : {
112 0 : aFormatCol.GetColumns().clear();
113 0 : }
114 0 : inline bool SwColMgr::HasLine() const
115 : {
116 0 : return GetAdjust() != COLADJ_NONE;
117 : }
118 :
119 0 : inline void SwColMgr::SetNoLine()
120 : {
121 0 : SetAdjust(COLADJ_NONE);
122 0 : }
123 :
124 : #endif
125 :
126 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|