LibreOffice Module sw (master)  1
fmtclds.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_INC_FMTCLDS_HXX
20 #define INCLUDED_SW_INC_FMTCLDS_HXX
21 
22 #include <editeng/borderline.hxx>
23 #include <tools/color.hxx>
24 #include <tools/solar.h>
25 #include <svl/poolitem.hxx>
26 #include "swdllapi.h"
27 #include "hintids.hxx"
28 #include "format.hxx"
29 
30 #include <vector>
31 
33 class SwColumn
34 {
35  sal_uInt16 m_nWish;
38  sal_uInt16 m_nLeft;
39  sal_uInt16 m_nRight;
40 
41 public:
42  SwColumn();
43 
44  bool operator==( const SwColumn & ) const;
45 
46  void SetWishWidth( sal_uInt16 nNew ) { m_nWish = nNew; }
47  void SetLeft ( sal_uInt16 nNew ) { m_nLeft = nNew; }
48  void SetRight( sal_uInt16 nNew ) { m_nRight = nNew; }
49 
50  sal_uInt16 GetWishWidth() const { return m_nWish; }
51  sal_uInt16 GetLeft () const { return m_nLeft; }
52  sal_uInt16 GetRight() const { return m_nRight; }
53 
54  void dumpAsXml(xmlTextWriterPtr pWriter) const;
55 };
56 
57 typedef std::vector<SwColumn> SwColumns;
58 
60 {
65 };
66 
68 {
72 
73  sal_uInt16 m_nLineHeight;
77 
79  sal_uInt16 m_nWidth;
81 
82  bool m_bOrtho;
88  SAL_DLLPRIVATE void Calc( sal_uInt16 nGutterWidth, sal_uInt16 nAct );
89 
90 public:
91  SwFormatCol();
92  SwFormatCol( const SwFormatCol& );
93  virtual ~SwFormatCol() override;
94  //#i120133#
95  sal_Int16 GetAdjustValue() const { return m_aWidthAdjustValue; }
96  void SetAdjustValue( sal_Int16 n ) { m_aWidthAdjustValue = n; }
97 
99 
101  virtual bool operator==( const SfxPoolItem& ) const override;
102  virtual SfxPoolItem* Clone( SfxItemPool* pPool = nullptr ) const override;
103  virtual bool GetPresentation( SfxItemPresentation ePres,
104  MapUnit eCoreMetric,
105  MapUnit ePresMetric,
106  OUString &rText,
107  const IntlWrapper& rIntl ) const override;
108 
109  virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
110  virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
111 
112  const SwColumns &GetColumns() const { return m_aColumns; }
113  SwColumns &GetColumns() { return m_aColumns; }
114  sal_uInt16 GetNumCols() const { return m_aColumns.size(); }
115 
116  SvxBorderLineStyle GetLineStyle() const { return m_eLineStyle;}
117  sal_uLong GetLineWidth() const { return m_nLineWidth;}
118  const Color& GetLineColor() const { return m_aLineColor;}
119 
120  SwColLineAdj GetLineAdj() const { return m_eAdj; }
121  bool IsOrtho() const { return m_bOrtho; }
122  sal_uInt16 GetWishWidth() const { return m_nWidth; }
123  sal_uInt8 GetLineHeight()const { return m_nLineHeight; }
124 
127  sal_uInt16 GetGutterWidth( bool bMin = false ) const;
128 
129  void SetLineStyle(SvxBorderLineStyle eStyle) { m_eLineStyle = eStyle;}
130  void SetLineWidth(sal_uLong nLWidth) { m_nLineWidth = nLWidth;}
131  void SetLineColor(const Color& rCol ) { m_aLineColor = rCol;}
132  void SetLineHeight( sal_uInt8 nNew ) { m_nLineHeight = nNew; }
133  void SetLineAdj( SwColLineAdj eNew ){ m_eAdj = eNew; }
134  void SetWishWidth( sal_uInt16 nNew ) { m_nWidth = nNew; }
135 
138  void Init( sal_uInt16 nNumCols, sal_uInt16 nGutterWidth, sal_uInt16 nAct );
139 
144  void SetGutterWidth( sal_uInt16 nNew, sal_uInt16 nAct );
145 
148  void SetOrtho( bool bNew, sal_uInt16 nGutterWidth, sal_uInt16 nAct );
149 
151  void SetOrtho_( bool bNew ) { m_bOrtho = bNew; }
152 
156  sal_uInt16 CalcColWidth( sal_uInt16 nCol, sal_uInt16 nAct ) const;
157 
160  sal_uInt16 CalcPrtColWidth( sal_uInt16 nCol, sal_uInt16 nAct ) const;
161 
162  void dumpAsXml(xmlTextWriterPtr pWriter) const override;
163 };
164 
165 inline const SwFormatCol &SwAttrSet::GetCol(bool bInP) const
166  { return Get( RES_COL,bInP); }
167 
168 inline const SwFormatCol &SwFormat::GetCol(bool bInP) const
169  { return m_aSet.GetCol(bInP); }
170 
171 #endif
172 
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 m_nWish
Desired width, borders included.
Definition: fmtclds.hxx:35
void SetLineWidth(sal_uLong nLWidth)
Definition: fmtclds.hxx:130
void SetWishWidth(sal_uInt16 nNew)
Definition: fmtclds.hxx:134
#define RES_COL
Definition: hintids.hxx:214
const SwFormatCol & GetCol(bool=true) const
Definition: fmtclds.hxx:168
void SetLineHeight(sal_uInt8 nNew)
Definition: fmtclds.hxx:132
std::vector< SwColumn > SwColumns
Definition: fmtclds.hxx:57
void Init()
bool IsOrtho() const
Definition: fmtclds.hxx:121
bool m_bOrtho
Only if this flag is set, the setting of GutterWidth will be accompanied by a "visual rearrangement"...
Definition: fmtclds.hxx:82
virtual bool operator==(const SfxPoolItem &) const =0
void SetLeft(sal_uInt16 nNew)
Definition: fmtclds.hxx:47
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
void SetAdjustValue(sal_Int16 n)
Definition: fmtclds.hxx:96
sal_uIntPtr sal_uLong
sal_uInt16 m_nLeft
Left border.
Definition: fmtclds.hxx:38
void SetRight(sal_uInt16 nNew)
Definition: fmtclds.hxx:48
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: atrfrm.cxx:802
SfxPoolItem & operator=(const SfxPoolItem &)=delete
Color m_aLineColor
Color of the separator line.
Definition: fmtclds.hxx:71
const Color & GetLineColor() const
Definition: fmtclds.hxx:118
SwColLineAdj m_eAdj
Line will be adjusted top, centered or bottom.
Definition: fmtclds.hxx:76
SwAttrSet m_aSet
Definition: format.hxx:48
void SetLineColor(const Color &rCol)
Definition: fmtclds.hxx:131
SvxBorderLineStyle GetLineStyle() const
Definition: fmtclds.hxx:116
void SetLineAdj(SwColLineAdj eNew)
Definition: fmtclds.hxx:133
SvxBorderLineStyle
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId)
SwColumns m_aColumns
Information concerning the columns.
Definition: fmtclds.hxx:78
SwColumns & GetColumns()
Definition: fmtclds.hxx:113
void SetLineStyle(SvxBorderLineStyle eStyle)
Definition: fmtclds.hxx:129
struct _xmlTextWriter * xmlTextWriterPtr
SfxItemPresentation
const SwFormatCol & GetCol(bool=true) const
Definition: fmtclds.hxx:165
const SwColumns & GetColumns() const
Definition: fmtclds.hxx:112
sal_uInt8 GetLineHeight() const
Definition: fmtclds.hxx:123
sal_Int16 m_aWidthAdjustValue
Definition: fmtclds.hxx:80
sal_uInt16 m_nWidth
Total desired width of all columns.
Definition: fmtclds.hxx:79
sal_uInt16 m_nLineHeight
Percentile height of lines.
Definition: fmtclds.hxx:73
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
sal_Int16 GetAdjustValue() const
Definition: fmtclds.hxx:95
SwColumn()
Definition: atrfrm.cxx:788
sal_uInt16 GetWishWidth() const
Definition: fmtclds.hxx:122
sal_uInt16 GetWishWidth() const
Definition: fmtclds.hxx:50
void SetWishWidth(sal_uInt16 nNew)
Definition: fmtclds.hxx:46
sal_uLong m_nLineWidth
Width of the separator line.
Definition: fmtclds.hxx:70
virtual bool GetPresentation(SfxItemPresentation ePresentation, MapUnit eCoreMetric, MapUnit ePresentationMetric, OUString &rText, const IntlWrapper &rIntlWrapper) const
sal_uInt16 GetRight() const
Definition: fmtclds.hxx:52
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
unsigned char sal_uInt8
sal_uLong GetLineWidth() const
Definition: fmtclds.hxx:117
void SetOrtho_(bool bNew)
For the reader.
Definition: fmtclds.hxx:151
bool operator==(const SwColumn &) const
Definition: atrfrm.cxx:795
ColumnDescriptor.
Definition: fmtclds.hxx:33
sal_uInt16 GetLeft() const
Definition: fmtclds.hxx:51
sal_uInt16 GetNumCols() const
Definition: fmtclds.hxx:114
MapUnit
SvxBorderLineStyle m_eLineStyle
style of the separator line
Definition: fmtclds.hxx:69
SwColLineAdj
Definition: fmtclds.hxx:59
sal_uInt16 m_nRight
Right border.
Definition: fmtclds.hxx:39
SwColLineAdj GetLineAdj() const
Definition: fmtclds.hxx:120
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const