LibreOffice Module sw (master)  1
colmgr.hxx
Go to the documentation of this file.
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 #include <climits>
26 
27 SW_DLLPUBLIC void FitToActualSize(SwFormatCol& rCol, sal_uInt16 nWidth);
28 
30 {
31 public:
32  // lActWidth is passed directly from the page dialogs edits
33  SwColMgr(const SfxItemSet &rSet);
34  ~SwColMgr();
35 
36  inline sal_uInt16 GetCount() const;
37  void SetCount(sal_uInt16 nCount, sal_uInt16 nGutterWidth);
38  sal_uInt16 GetGutterWidth(sal_uInt16 nPos = USHRT_MAX) const;
39  void SetGutterWidth(sal_uInt16 nWidth, sal_uInt16 nPos = USHRT_MAX);
40 
41  sal_uInt16 GetColWidth(sal_uInt16 nIdx) const;
42  void SetColWidth(sal_uInt16 nIdx, sal_uInt16 nWidth);
43 
44  inline bool IsAutoWidth() const;
45  void SetAutoWidth(bool bOn, sal_uInt16 lGutterWidth = 0);
46 
47  inline bool HasLine() const;
48  inline void SetNoLine();
49 
50  void SetLineWidthAndColor(SvxBorderLineStyle eStyle, sal_uLong nWidth, const Color& rCol);
51  inline SvxBorderLineStyle GetLineStyle() const;
52  inline sal_uLong GetLineWidth() const;
53  inline const Color& GetLineColor() const;
54 
55  inline SwColLineAdj GetAdjust() const;
56  inline void SetAdjust(SwColLineAdj);
57 
58  short GetLineHeightPercent() const;
59  void SetLineHeightPercent(short nPercent);
60 
61  inline void NoCols();
62 
63  const SwFormatCol& GetColumns() const { return aFormatCol; }
64 
65  void SetActualWidth(sal_uInt16 nW);
66  sal_uInt16 GetActualSize() const { return nWidth; }
67 
68 private:
70  sal_uInt16 nWidth;
71 };
72 
73 inline sal_uInt16 SwColMgr::GetCount() const
74 {
75  return aFormatCol.GetNumCols();
76 }
77 
79 {
80  return aFormatCol.GetLineStyle();
81 }
83 {
84  return aFormatCol.GetLineWidth();
85 }
86 
87 inline const Color& SwColMgr::GetLineColor() const
88 {
89  return aFormatCol.GetLineColor();
90 }
91 
93 {
94  return aFormatCol.GetLineAdj();
95 }
96 
98 {
99  aFormatCol.SetLineAdj(eAdj);
100 }
101 inline bool SwColMgr::IsAutoWidth() const
102 {
103  return aFormatCol.IsOrtho();
104 }
105 inline void SwColMgr::SetAutoWidth(bool bOn, sal_uInt16 nGutterWidth)
106 {
107  aFormatCol.SetOrtho(bOn, nGutterWidth, nWidth);
108 }
109 
110 inline void SwColMgr::NoCols()
111 {
112  aFormatCol.GetColumns().clear();
113 }
114 inline bool SwColMgr::HasLine() const
115 {
116  return GetAdjust() != COLADJ_NONE;
117 }
118 
119 inline void SwColMgr::SetNoLine()
120 {
122 }
123 
124 #endif
125 
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const Color & GetLineColor() const
Definition: colmgr.hxx:87
bool IsOrtho() const
Definition: fmtclds.hxx:121
sal_uIntPtr sal_uLong
sal_uLong GetLineWidth() const
Definition: colmgr.hxx:82
const Color & GetLineColor() const
Definition: fmtclds.hxx:118
SvxBorderLineStyle GetLineStyle() const
Definition: fmtclds.hxx:116
void SetOrtho(bool bNew, sal_uInt16 nGutterWidth, sal_uInt16 nAct)
This too re-arranges columns automatically if flag is set.
Definition: atrfrm.cxx:962
void SetLineAdj(SwColLineAdj eNew)
Definition: fmtclds.hxx:133
SvxBorderLineStyle
bool IsAutoWidth() const
Definition: colmgr.hxx:101
sal_uInt16 nWidth
Definition: colmgr.hxx:70
bool HasLine() const
Definition: colmgr.hxx:114
sal_uInt16 GetActualSize() const
Definition: colmgr.hxx:66
const SwFormatCol & GetColumns() const
Definition: colmgr.hxx:63
void SetNoLine()
Definition: colmgr.hxx:119
SW_DLLPUBLIC void FitToActualSize(SwFormatCol &rCol, sal_uInt16 nWidth)
Definition: colmgr.cxx:35
const SwColumns & GetColumns() const
Definition: fmtclds.hxx:112
SvxBorderLineStyle GetLineStyle() const
Definition: colmgr.hxx:78
void SetAutoWidth(bool bOn, sal_uInt16 lGutterWidth=0)
Definition: colmgr.hxx:105
SwFormatCol aFormatCol
Definition: colmgr.hxx:69
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
SwColLineAdj GetAdjust() const
Definition: colmgr.hxx:92
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:261
sal_uLong GetLineWidth() const
Definition: fmtclds.hxx:117
void SetAdjust(SwColLineAdj)
Definition: colmgr.hxx:97
void NoCols()
Definition: colmgr.hxx:110
sal_uInt16 GetNumCols() const
Definition: fmtclds.hxx:114
SwColLineAdj
Definition: fmtclds.hxx:59
sal_uInt16 GetCount() const
Definition: colmgr.hxx:73
sal_Int32 nPos
SwColLineAdj GetLineAdj() const
Definition: fmtclds.hxx:120