LibreOffice Module svx (master) 1
autoformathelper.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
20#ifndef INCLUDED_SVX_AUTOFORMATHELPER_HXX
21#define INCLUDED_SVX_AUTOFORMATHELPER_HXX
22
23#include <svx/svxdllapi.h>
24#include <memory>
25
26class SvStream;
27class SvxFontItem;
29class SvxWeightItem;
30class SvxPostureItem;
32class SvxOverlineItem;
34class SvxContourItem;
35class SvxShadowedItem;
36class SvxColorItem;
37class SvxBoxItem;
38class SvxLineItem;
39class SvxBrushItem;
40class SvxAdjustItem;
43class SfxBoolItem;
44class SvxMarginItem;
45class SfxInt32Item;
47
50
52{
53public:
54 // BlockA
55 sal_uInt16 nFontVersion;
57 sal_uInt16 nWeightVersion;
58 sal_uInt16 nPostureVersion;
60 sal_uInt16 nOverlineVersion;
62 sal_uInt16 nContourVersion;
63 sal_uInt16 nShadowedVersion;
64 sal_uInt16 nColorVersion;
65 sal_uInt16 nBoxVersion;
66 sal_uInt16 nLineVersion;
67 sal_uInt16 nBrushVersion;
68 sal_uInt16 nAdjustVersion;
69
70 // BlockB
74 sal_uInt16 nMarginVersion;
75 sal_uInt16 nBoolVersion;
76 sal_uInt16 nInt32Version;
79
81
82 void LoadBlockA( SvStream& rStream, sal_uInt16 nVer );
83 void LoadBlockB( SvStream& rStream, sal_uInt16 nVer );
84
85 static void WriteBlockA(SvStream& rStream, sal_uInt16 fileVersion);
86 static void WriteBlockB(SvStream& rStream, sal_uInt16 fileVersion);
87};
88
90
92{
93protected:
94 // common attributes of Calc and Writer
95 // --- from 641 on: CJK and CTL font settings
96 std::unique_ptr<SvxFontItem> m_aFont;
97 std::unique_ptr<SvxFontHeightItem> m_aHeight;
98 std::unique_ptr<SvxWeightItem> m_aWeight;
99 std::unique_ptr<SvxPostureItem> m_aPosture;
100
101 std::unique_ptr<SvxFontItem> m_aCJKFont;
102 std::unique_ptr<SvxFontHeightItem> m_aCJKHeight;
103 std::unique_ptr<SvxWeightItem> m_aCJKWeight;
104 std::unique_ptr<SvxPostureItem> m_aCJKPosture;
105
106 std::unique_ptr<SvxFontItem> m_aCTLFont;
107 std::unique_ptr<SvxFontHeightItem> m_aCTLHeight;
108 std::unique_ptr<SvxWeightItem> m_aCTLWeight;
109 std::unique_ptr<SvxPostureItem> m_aCTLPosture;
110
111 std::unique_ptr<SvxUnderlineItem> m_aUnderline;
112 std::unique_ptr<SvxOverlineItem> m_aOverline;
113 std::unique_ptr<SvxCrossedOutItem> m_aCrossedOut;
114 std::unique_ptr<SvxContourItem> m_aContour;
115 std::unique_ptr<SvxShadowedItem> m_aShadowed;
116 std::unique_ptr<SvxColorItem> m_aColor;
117 std::unique_ptr<SvxBoxItem> m_aBox;
118 std::unique_ptr<SvxLineItem> m_aTLBR;
119 std::unique_ptr<SvxLineItem> m_aBLTR;
120 std::unique_ptr<SvxBrushItem> m_aBackground;
121
122 // Writer specific
123 std::unique_ptr<SvxAdjustItem> m_aAdjust;
124
125 // Calc specific
126 std::unique_ptr<SvxHorJustifyItem> m_aHorJustify;
127 std::unique_ptr<SvxVerJustifyItem> m_aVerJustify;
128 std::unique_ptr<SfxBoolItem> m_aStacked;
129 std::unique_ptr<SvxMarginItem> m_aMargin;
130 std::unique_ptr<SfxBoolItem> m_aLinebreak;
131
132 // from SO5, 504k on, rotated text
133 std::unique_ptr<SfxInt32Item> m_aRotateAngle;
134 std::unique_ptr<SvxRotateModeItem> m_aRotateMode;
135
136 // assignment-op is protected due to this being a tooling
137 // class, so callers need to be aware of what they do
138 AutoFormatBase& operator=(const AutoFormatBase&);
139
141 AutoFormatBase( const AutoFormatBase& rNew );
143
145 bool operator==(const AutoFormatBase& rRight) const;
146
147public:
148 // The get-methods.
149 const SvxFontItem &GetFont() const { return *m_aFont; }
150 const SvxFontHeightItem &GetHeight() const { return *m_aHeight; }
151 const SvxWeightItem &GetWeight() const { return *m_aWeight; }
152 const SvxPostureItem &GetPosture() const { return *m_aPosture; }
153 const SvxFontItem &GetCJKFont() const { return *m_aCJKFont; }
154 const SvxFontHeightItem &GetCJKHeight() const { return *m_aCJKHeight; }
155 const SvxWeightItem &GetCJKWeight() const { return *m_aCJKWeight; }
156 const SvxPostureItem &GetCJKPosture() const { return *m_aCJKPosture; }
157 const SvxFontItem &GetCTLFont() const { return *m_aCTLFont; }
158 const SvxFontHeightItem &GetCTLHeight() const { return *m_aCTLHeight; }
159 const SvxWeightItem &GetCTLWeight() const { return *m_aCTLWeight; }
160 const SvxPostureItem &GetCTLPosture() const { return *m_aCTLPosture; }
161 const SvxUnderlineItem &GetUnderline() const { return *m_aUnderline; }
162 const SvxOverlineItem &GetOverline() const { return *m_aOverline; }
163 const SvxCrossedOutItem &GetCrossedOut() const { return *m_aCrossedOut; }
164 const SvxContourItem &GetContour() const { return *m_aContour; }
165 const SvxShadowedItem &GetShadowed() const { return *m_aShadowed; }
166 const SvxColorItem &GetColor() const { return *m_aColor; }
167 const SvxBoxItem &GetBox() const { return *m_aBox; }
168 const SvxLineItem& GetTLBR() const { return *m_aTLBR; }
169 const SvxLineItem& GetBLTR() const { return *m_aBLTR; }
170 const SvxBrushItem &GetBackground() const { return *m_aBackground; }
171 const SvxAdjustItem &GetAdjust() const { return *m_aAdjust; }
172 const SvxHorJustifyItem& GetHorJustify() const { return *m_aHorJustify; }
173 const SvxVerJustifyItem& GetVerJustify() const { return *m_aVerJustify; }
174 const SfxBoolItem& GetStacked() const { return *m_aStacked; }
175 const SvxMarginItem& GetMargin() const { return *m_aMargin; }
176 const SfxBoolItem& GetLinebreak() const { return *m_aLinebreak; }
177 const SfxInt32Item& GetRotateAngle() const { return *m_aRotateAngle; }
178 const SvxRotateModeItem& GetRotateMode() const { return *m_aRotateMode; }
179
180 // The set-methods.
181 void SetFont( const SvxFontItem& rNew );
182 void SetHeight( const SvxFontHeightItem& rNew );
183 void SetWeight( const SvxWeightItem& rNew );
184 void SetPosture( const SvxPostureItem& rNew );
185 void SetCJKFont( const SvxFontItem& rNew );
186 void SetCJKHeight( const SvxFontHeightItem& rNew );
187 void SetCJKWeight( const SvxWeightItem& rNew );
188 void SetCJKPosture( const SvxPostureItem& rNew );
189 void SetCTLFont( const SvxFontItem& rNew );
190 void SetCTLHeight( const SvxFontHeightItem& rNew );
191 void SetCTLWeight( const SvxWeightItem& rNew );
192 void SetCTLPosture( const SvxPostureItem& rNew );
193 void SetUnderline( const SvxUnderlineItem& rNew );
194 void SetOverline( const SvxOverlineItem& rNew );
195 void SetCrossedOut( const SvxCrossedOutItem& rNew );
196 void SetContour( const SvxContourItem& rNew );
197 void SetShadowed( const SvxShadowedItem& rNew );
198 void SetColor( const SvxColorItem& rNew );
199 void SetBox( const SvxBoxItem& rNew );
200 void SetTLBR( const SvxLineItem& rNew );
201 void SetBLTR( const SvxLineItem& rNew );
202 void SetBackground( const SvxBrushItem& rNew );
203 void SetAdjust( const SvxAdjustItem& rNew );
204 void SetHorJustify( const SvxHorJustifyItem& rNew );
205 void SetVerJustify( const SvxVerJustifyItem& rNew );
206 void SetStacked( const SfxBoolItem& rNew );
207 void SetMargin( const SvxMarginItem& rNew );
208 void SetLinebreak( const SfxBoolItem& rNew );
209 void SetRotateAngle( const SfxInt32Item& rNew );
210 void SetRotateMode( const SvxRotateModeItem& rNew );
211
212 bool LoadBlockA( SvStream& rStream, const AutoFormatVersions& rVersions, sal_uInt16 nVer );
213 bool LoadBlockB( SvStream& rStream, const AutoFormatVersions& rVersions, sal_uInt16 nVer );
214
215 bool SaveBlockA( SvStream& rStream, sal_uInt16 fileVersion ) const;
216 bool SaveBlockB( SvStream& rStream, sal_uInt16 fileVersion ) const;
217};
218
219#endif // INCLUDED_SVX_AUTOFORMATHELPER_HXX
220
222/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< SvxFontHeightItem > m_aCJKHeight
std::unique_ptr< SvxAdjustItem > m_aAdjust
const SfxBoolItem & GetStacked() const
const SvxContourItem & GetContour() const
std::unique_ptr< SvxShadowedItem > m_aShadowed
std::unique_ptr< SvxLineItem > m_aBLTR
const SvxColorItem & GetColor() const
std::unique_ptr< SvxCrossedOutItem > m_aCrossedOut
std::unique_ptr< SfxBoolItem > m_aLinebreak
const SvxWeightItem & GetWeight() const
std::unique_ptr< SvxPostureItem > m_aCTLPosture
const SfxBoolItem & GetLinebreak() const
std::unique_ptr< SvxWeightItem > m_aWeight
const SvxBoxItem & GetBox() const
std::unique_ptr< SvxPostureItem > m_aCJKPosture
std::unique_ptr< SvxFontHeightItem > m_aHeight
std::unique_ptr< SvxBrushItem > m_aBackground
const SvxFontHeightItem & GetCJKHeight() const
const SvxWeightItem & GetCTLWeight() const
std::unique_ptr< SfxBoolItem > m_aStacked
const SvxFontItem & GetCTLFont() const
std::unique_ptr< SvxVerJustifyItem > m_aVerJustify
const SvxLineItem & GetTLBR() const
std::unique_ptr< SvxOverlineItem > m_aOverline
const SvxPostureItem & GetPosture() const
std::unique_ptr< SfxInt32Item > m_aRotateAngle
const SvxFontItem & GetFont() const
const SvxWeightItem & GetCJKWeight() const
const SvxRotateModeItem & GetRotateMode() const
std::unique_ptr< SvxFontItem > m_aCJKFont
const SvxPostureItem & GetCJKPosture() const
const SvxOverlineItem & GetOverline() const
const SvxFontItem & GetCJKFont() const
const SvxAdjustItem & GetAdjust() const
const SvxLineItem & GetBLTR() const
std::unique_ptr< SvxMarginItem > m_aMargin
std::unique_ptr< SvxColorItem > m_aColor
std::unique_ptr< SvxFontHeightItem > m_aCTLHeight
const SvxShadowedItem & GetShadowed() const
std::unique_ptr< SvxBoxItem > m_aBox
std::unique_ptr< SvxFontItem > m_aCTLFont
const SvxFontHeightItem & GetCTLHeight() const
const SvxBrushItem & GetBackground() const
std::unique_ptr< SvxWeightItem > m_aCTLWeight
bool operator==(const AutoFormatBase &rRight) const
Comparing based of boxes backgrounds.
const SvxFontHeightItem & GetHeight() const
const SvxHorJustifyItem & GetHorJustify() const
const SvxVerJustifyItem & GetVerJustify() const
std::unique_ptr< SvxFontItem > m_aFont
std::unique_ptr< SvxContourItem > m_aContour
std::unique_ptr< SvxPostureItem > m_aPosture
const SfxInt32Item & GetRotateAngle() const
const SvxPostureItem & GetCTLPosture() const
std::unique_ptr< SvxWeightItem > m_aCJKWeight
const SvxCrossedOutItem & GetCrossedOut() const
std::unique_ptr< SvxRotateModeItem > m_aRotateMode
std::unique_ptr< SvxUnderlineItem > m_aUnderline
std::unique_ptr< SvxLineItem > m_aTLBR
const SvxMarginItem & GetMargin() const
const SvxUnderlineItem & GetUnderline() const
std::unique_ptr< SvxHorJustifyItem > m_aHorJustify
Color m_aColor
Font m_aFont
Struct with version numbers of the Items.
sal_uInt16 nRotateModeVersion
sal_uInt16 nUnderlineVersion
sal_uInt16 nFontHeightVersion
sal_uInt16 nHorJustifyVersion
sal_uInt16 nOrientationVersion
sal_uInt16 nCrossedOutVersion
sal_uInt16 nVerJustifyVersion
sal_uInt16 nNumFormatVersion
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28
static bool SetFont(const SfxItemSet &rSet, sal_uInt16 nSlot, SvxFont &rFont)
Definition: tbcontrl.cxx:1302