make ValueTransfer easier to understand
[LibreOffice.git] / include / svx / rulritem.hxx
blob9d24ecd6088d1799747e94a0d855ba8d51bded5d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SVX_RULRITEM_HXX
20 #define INCLUDED_SVX_RULRITEM_HXX
22 #include <tools/gen.hxx>
23 #include <svl/poolitem.hxx>
24 #include <svx/svxdllapi.h>
25 #include <vector>
27 class SVX_DLLPUBLIC SvxLongLRSpaceItem final : public SfxPoolItem
29 tools::Long mlLeft; // nLeft or the negative first-line indentation
30 tools::Long mlRight; // the unproblematic right edge
32 virtual bool operator==( const SfxPoolItem& ) const override;
33 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
34 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
36 virtual bool GetPresentation( SfxItemPresentation ePres,
37 MapUnit eCoreMetric,
38 MapUnit ePresMetric,
39 OUString &rText, const IntlWrapper& ) const override;
41 virtual SvxLongLRSpaceItem* Clone( SfxItemPool *pPool = nullptr ) const override;
43 const SvxLongLRSpaceItem& operator=(const SvxLongLRSpaceItem &) = delete;
45 public:
46 static SfxPoolItem* CreateDefault();
47 SvxLongLRSpaceItem(tools::Long lLeft, tools::Long lRight, sal_uInt16 nId);
48 SvxLongLRSpaceItem();
49 SvxLongLRSpaceItem(SvxLongLRSpaceItem const &) = default;
51 tools::Long GetLeft() const { return mlLeft;}
52 tools::Long GetRight() const { return mlRight;}
53 void SetLeft(tools::Long lArgLeft);
54 void SetRight(tools::Long lArgRight);
57 class SVX_DLLPUBLIC SvxLongULSpaceItem final : public SfxPoolItem
59 tools::Long mlLeft; // nLeft or the negative first-line indentation
60 tools::Long mlRight; // the unproblematic right edge
62 virtual bool operator==( const SfxPoolItem& ) const override;
63 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
64 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
66 virtual bool GetPresentation( SfxItemPresentation ePres,
67 MapUnit eCoreMetric,
68 MapUnit ePresMetric,
69 OUString &rText, const IntlWrapper& ) const override;
71 virtual SvxLongULSpaceItem* Clone( SfxItemPool *pPool = nullptr ) const override;
73 const SvxLongULSpaceItem& operator=(const SvxLongULSpaceItem &) = delete;
75 public:
76 static SfxPoolItem* CreateDefault();
77 SvxLongULSpaceItem(tools::Long lUpper, tools::Long lLower, sal_uInt16 nId);
78 SvxLongULSpaceItem();
79 SvxLongULSpaceItem(SvxLongULSpaceItem const &) = default;
81 tools::Long GetUpper() const { return mlLeft;}
82 tools::Long GetLower() const { return mlRight;}
83 void SetUpper(tools::Long lArgLeft);
84 void SetLower(tools::Long lArgRight);
87 class SVX_DLLPUBLIC SvxPagePosSizeItem final : public SfxPoolItem
89 Point aPos;
90 tools::Long lWidth;
91 tools::Long lHeight;
93 virtual bool operator==( const SfxPoolItem& ) const override;
94 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
95 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
97 virtual bool GetPresentation( SfxItemPresentation ePres,
98 MapUnit eCoreMetric,
99 MapUnit ePresMetric,
100 OUString &rText, const IntlWrapper& ) const override;
102 virtual SvxPagePosSizeItem* Clone( SfxItemPool *pPool = nullptr ) const override;
104 private:
105 const SvxPagePosSizeItem& operator=(const SvxPagePosSizeItem &) = delete;
106 public:
107 static SfxPoolItem* CreateDefault();
108 SvxPagePosSizeItem(const Point &rPos, tools::Long lWidth, tools::Long lHeight);
109 SvxPagePosSizeItem();
110 SvxPagePosSizeItem(SvxPagePosSizeItem const &) = default;
112 const Point &GetPos() const { return aPos; }
113 tools::Long GetWidth() const { return lWidth; }
114 tools::Long GetHeight() const { return lHeight; }
117 struct SVX_DLLPUBLIC SvxColumnDescription
119 tools::Long nStart; /* Start of the column */
120 tools::Long nEnd; /* End of the column */
121 bool bVisible; /* Visibility */
123 tools::Long nEndMin; //min. possible position of end
124 tools::Long nEndMax; //max. possible position of end
126 SvxColumnDescription(tools::Long start, tools::Long end, bool bVis);
128 SvxColumnDescription(tools::Long start, tools::Long end,
129 tools::Long endMin, tools::Long endMax, bool bVis);
131 bool operator==(const SvxColumnDescription &rCmp) const;
132 bool operator!=(const SvxColumnDescription &rCmp) const;
133 tools::Long GetWidth() const;
136 template<typename charT, typename traits>
137 inline std::basic_ostream<charT, traits> & operator <<(
138 std::basic_ostream<charT, traits> & stream, SvxColumnDescription const& dsc)
140 return stream << "{ nStart " << dsc.nStart << " nEnd " << dsc.nEnd
141 << " bVisible " << dsc.bVisible << " nEndMin " << dsc.nEndMin
142 << " nEndMax " << dsc.nEndMax << " }";
146 class SVX_DLLPUBLIC SvxColumnItem final : public SfxPoolItem
148 std::vector<SvxColumnDescription> aColumns; // Column array
150 tools::Long nLeft; // Left edge for the table
151 tools::Long nRight; // Right edge for the table; for columns always
152 // equal to the surrounding frame
153 sal_uInt16 nActColumn; // the current column
154 bool bTable; // table?
155 bool bOrtho; // evenly spread columns
157 virtual bool operator==( const SfxPoolItem& ) const override;
159 virtual bool GetPresentation( SfxItemPresentation ePres,
160 MapUnit eCoreMetric,
161 MapUnit ePresMetric,
162 OUString &rText,
163 const IntlWrapper& ) const override;
165 virtual SvxColumnItem* Clone( SfxItemPool *pPool = nullptr ) const override;
166 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
167 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
169 public:
170 static SfxPoolItem* CreateDefault();
171 // right edge of the surrounding frame
172 // nLeft, nRight each the distance to the surrounding frame
173 SvxColumnItem(sal_uInt16 nAct = 0);
174 SvxColumnItem(sal_uInt16 nActCol, sal_uInt16 nLeft, sal_uInt16 nRight); // Table with borders
176 SvxColumnDescription& operator[](sal_uInt16 index);
177 const SvxColumnDescription& operator[](sal_uInt16 index) const;
178 SvxColumnDescription& At(sal_uInt16 index);
179 SvxColumnDescription& GetActiveColumnDescription();
181 sal_uInt16 Count() const;
182 void Append(const SvxColumnDescription& rDesc);
183 void SetLeft(tools::Long aLeft);
184 void SetRight(tools::Long aRight);
185 sal_uInt16 GetActColumn() const { return nActColumn;}
186 bool IsFirstAct() const;
187 bool IsLastAct() const;
188 tools::Long GetLeft() const { return nLeft;}
189 tools::Long GetRight() const { return nRight;}
190 bool IsTable() const { return bTable;}
191 bool CalcOrtho() const;
192 void SetOrtho(bool bVal);
193 bool IsConsistent() const;
196 class SVX_DLLPUBLIC SvxObjectItem final : public SfxPoolItem
198 tools::Long nStartX; /* Start in x direction */
199 tools::Long nEndX; /* End in x direction */
200 tools::Long nStartY; /* Start in y direction */
201 tools::Long nEndY; /* End in y direction */
202 bool bLimits; /* boundary limit control by the application */
204 virtual bool operator==( const SfxPoolItem& ) const override;
206 virtual bool GetPresentation( SfxItemPresentation ePres,
207 MapUnit eCoreMetric,
208 MapUnit ePresMetric,
209 OUString &rText, const IntlWrapper& ) const override;
211 virtual SvxObjectItem* Clone( SfxItemPool *pPool = nullptr ) const override;
212 virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
213 virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
215 const SvxObjectItem &operator=(const SvxObjectItem &) = delete;
217 public:
218 static SfxPoolItem* CreateDefault();
219 SvxObjectItem(tools::Long nStartX, tools::Long nEndX,
220 tools::Long nStartY, tools::Long nEndY);
221 SvxObjectItem(SvxObjectItem const &) = default;
223 tools::Long GetStartX() const { return nStartX;}
224 tools::Long GetEndX() const { return nEndX;}
225 tools::Long GetStartY() const { return nStartY;}
226 tools::Long GetEndY() const { return nEndY;}
228 void SetStartX(tools::Long lValue);
229 void SetEndX(tools::Long lValue);
230 void SetStartY(tools::Long lValue);
231 void SetEndY(tools::Long lValue);
234 #endif
236 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */