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 
26 class SvStream;
27 class SvxFontItem;
28 class SvxFontHeightItem;
29 class SvxWeightItem;
30 class SvxPostureItem;
31 class SvxUnderlineItem;
32 class SvxOverlineItem;
33 class SvxCrossedOutItem;
34 class SvxContourItem;
35 class SvxShadowedItem;
36 class SvxColorItem;
37 class SvxBoxItem;
38 class SvxLineItem;
39 class SvxBrushItem;
40 class SvxAdjustItem;
41 class SvxHorJustifyItem;
42 class SvxVerJustifyItem;
43 class SfxBoolItem;
44 class SvxMarginItem;
45 class SfxInt32Item;
46 class SvxRotateModeItem;
47 
50 
52 {
53 public:
54  // BlockA
55  sal_uInt16 nFontVersion;
56  sal_uInt16 nFontHeightVersion;
57  sal_uInt16 nWeightVersion;
58  sal_uInt16 nPostureVersion;
59  sal_uInt16 nUnderlineVersion;
60  sal_uInt16 nOverlineVersion;
61  sal_uInt16 nCrossedOutVersion;
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
71  sal_uInt16 nHorJustifyVersion;
72  sal_uInt16 nVerJustifyVersion;
73  sal_uInt16 nOrientationVersion;
74  sal_uInt16 nMarginVersion;
75  sal_uInt16 nBoolVersion;
76  sal_uInt16 nInt32Version;
77  sal_uInt16 nRotateModeVersion;
78  sal_uInt16 nNumFormatVersion;
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 {
93 protected:
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 
140  AutoFormatBase();
141  AutoFormatBase( const AutoFormatBase& rNew );
142  ~AutoFormatBase();
143 
145  bool operator==(const AutoFormatBase& rRight) const;
146 
147 public:
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< SvxBrushItem > m_aBackground
std::unique_ptr< SfxBoolItem > m_aStacked
const SvxRotateModeItem & GetRotateMode() const
std::unique_ptr< SvxPostureItem > m_aCTLPosture
const SfxBoolItem & GetLinebreak() const
std::unique_ptr< SvxFontHeightItem > m_aHeight
std::unique_ptr< SfxInt32Item > m_aRotateAngle
std::unique_ptr< SvxFontItem > m_aFont
std::unique_ptr< SvxContourItem > m_aContour
const SvxFontHeightItem & GetCTLHeight() const
const SvxShadowedItem & GetShadowed() const
const SvxAdjustItem & GetAdjust() const
const SvxWeightItem & GetCTLWeight() const
const SvxFontItem & GetCTLFont() const
std::unique_ptr< SvxFontHeightItem > m_aCJKHeight
const SvxBrushItem & GetBackground() const
sal_uInt16 nVerJustifyVersion
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28
const SvxPostureItem & GetCTLPosture() const
const SfxBoolItem & GetStacked() const
const SvxWeightItem & GetCJKWeight() const
sal_uInt16 nHorJustifyVersion
std::unique_ptr< SvxUnderlineItem > m_aUnderline
std::unique_ptr< SvxShadowedItem > m_aShadowed
const SvxFontItem & GetFont() const
std::unique_ptr< SvxOverlineItem > m_aOverline
sal_uInt16 nOrientationVersion
std::unique_ptr< SvxPostureItem > m_aCJKPosture
std::unique_ptr< SvxCrossedOutItem > m_aCrossedOut
std::unique_ptr< SvxHorJustifyItem > m_aHorJustify
std::unique_ptr< SvxMarginItem > m_aMargin
const SvxUnderlineItem & GetUnderline() const
sal_uInt16 nNumFormatVersion
const SvxWeightItem & GetWeight() const
std::unique_ptr< SfxBoolItem > m_aLinebreak
const SvxContourItem & GetContour() const
sal_uInt16 nRotateModeVersion
const SvxFontHeightItem & GetCJKHeight() const
std::unique_ptr< SvxLineItem > m_aTLBR
std::unique_ptr< SvxBoxItem > m_aBox
std::unique_ptr< SvxVerJustifyItem > m_aVerJustify
std::unique_ptr< SvxWeightItem > m_aCTLWeight
std::unique_ptr< SvxAdjustItem > m_aAdjust
std::unique_ptr< SvxFontItem > m_aCTLFont
const SvxPostureItem & GetCJKPosture() const
std::unique_ptr< SvxPostureItem > m_aPosture
const SvxVerJustifyItem & GetVerJustify() const
const SvxHorJustifyItem & GetHorJustify() const
sal_uInt16 nCrossedOutVersion
const SvxCrossedOutItem & GetCrossedOut() const
Struct with version numbers of the Items.
const SvxLineItem & GetBLTR() const
const SvxOverlineItem & GetOverline() const
const SvxLineItem & GetTLBR() const
std::unique_ptr< SvxRotateModeItem > m_aRotateMode
std::unique_ptr< SvxLineItem > m_aBLTR
std::unique_ptr< SvxFontItem > m_aCJKFont
const SvxFontItem & GetCJKFont() const
std::unique_ptr< SvxColorItem > m_aColor
sal_uInt16 nFontHeightVersion
std::unique_ptr< SvxWeightItem > m_aCJKWeight
std::unique_ptr< SvxWeightItem > m_aWeight
const SvxMarginItem & GetMargin() const
const SvxPostureItem & GetPosture() const
const SvxColorItem & GetColor() const
std::unique_ptr< SvxFontHeightItem > m_aCTLHeight
bool operator==(const ScCsvLayoutData &rData1, const ScCsvLayoutData &rData2)
const SvxBoxItem & GetBox() const
const SvxFontHeightItem & GetHeight() const
sal_uInt16 nUnderlineVersion
const SfxInt32Item & GetRotateAngle() const