1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
20 #ifndef INCLUDED_SVX_AUTOFORMATHELPER_HXX
21 #define INCLUDED_SVX_AUTOFORMATHELPER_HXX
23 #include <svx/svxdllapi.h>
28 class SvxFontHeightItem
;
31 class SvxUnderlineItem
;
32 class SvxOverlineItem
;
33 class SvxCrossedOutItem
;
35 class SvxShadowedItem
;
41 class SvxHorJustifyItem
;
42 class SvxVerJustifyItem
;
46 class SvxRotateModeItem
;
48 //////////////////////////////////////////////////////////////////////////////
49 /// Struct with version numbers of the Items
51 struct SVX_DLLPUBLIC AutoFormatVersions
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
;
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
;
82 void LoadBlockA( SvStream
& rStream
, sal_uInt16 nVer
);
83 void LoadBlockB( SvStream
& rStream
, sal_uInt16 nVer
);
85 static void WriteBlockA(SvStream
& rStream
, sal_uInt16 fileVersion
);
86 static void WriteBlockB(SvStream
& rStream
, sal_uInt16 fileVersion
);
89 //////////////////////////////////////////////////////////////////////////////
91 class SVX_DLLPUBLIC AutoFormatBase
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
;
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
;
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
;
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
;
123 std::unique_ptr
<SvxAdjustItem
> m_aAdjust
;
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
;
132 // from SO5, 504k on, rotated text
133 std::unique_ptr
<SfxInt32Item
> m_aRotateAngle
;
134 std::unique_ptr
<SvxRotateModeItem
> m_aRotateMode
;
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
&);
141 AutoFormatBase( const AutoFormatBase
& rNew
);
144 /// Comparing based of boxes backgrounds.
145 bool operator==(const AutoFormatBase
& rRight
);
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
; }
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
);
212 bool LoadBlockA( SvStream
& rStream
, const AutoFormatVersions
& rVersions
, sal_uInt16 nVer
);
213 bool LoadBlockB( SvStream
& rStream
, const AutoFormatVersions
& rVersions
, sal_uInt16 nVer
);
215 bool SaveBlockA( SvStream
& rStream
, sal_uInt16 fileVersion
) const;
216 bool SaveBlockB( SvStream
& rStream
, sal_uInt16 fileVersion
) const;
219 #endif // INCLUDED_SVX_AUTOFORMATHELPER_HXX
221 //////////////////////////////////////////////////////////////////////////////
222 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */