Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * The Contents of this file are made available subject to the terms of
5 : : * either of the following licenses
6 : : *
7 : : * - GNU Lesser General Public License Version 2.1
8 : : * - Sun Industry Standards Source License Version 1.1
9 : : *
10 : : * Sun Microsystems Inc., October, 2000
11 : : *
12 : : * GNU Lesser General Public License Version 2.1
13 : : * =============================================
14 : : * Copyright 2000 by Sun Microsystems, Inc.
15 : : * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 : : *
17 : : * This library is free software; you can redistribute it and/or
18 : : * modify it under the terms of the GNU Lesser General Public
19 : : * License version 2.1, as published by the Free Software Foundation.
20 : : *
21 : : * This library is distributed in the hope that it will be useful,
22 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 : : * Lesser General Public License for more details.
25 : : *
26 : : * You should have received a copy of the GNU Lesser General Public
27 : : * License along with this library; if not, write to the Free Software
28 : : * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 : : * MA 02111-1307 USA
30 : : *
31 : : *
32 : : * Sun Industry Standards Source License Version 1.1
33 : : * =================================================
34 : : * The contents of this file are subject to the Sun Industry Standards
35 : : * Source License Version 1.1 (the "License"); You may not use this file
36 : : * except in compliance with the License. You may obtain a copy of the
37 : : * License at http://www.openoffice.org/license.html.
38 : : *
39 : : * Software provided under this License is provided on an "AS IS" basis,
40 : : * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
41 : : * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
42 : : * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
43 : : * See the License for the specific provisions governing your rights and
44 : : * obligations concerning the Software.
45 : : *
46 : : * The Initial Developer of the Original Code is: IBM Corporation
47 : : *
48 : : * Copyright: 2008 by IBM Corporation
49 : : *
50 : : * All Rights Reserved.
51 : : *
52 : : * Contributor(s): _______________________________________
53 : : *
54 : : *
55 : : ************************************************************************/
56 : : /*************************************************************************
57 : : * @file
58 : : * Border override of Wordpro.
59 : : ************************************************************************/
60 : : #ifndef _LWPPARABORDEROVERRIDE_HXX
61 : : #define _LWPPARABORDEROVERRIDE_HXX
62 : :
63 : : #include "lwpoverride.hxx"
64 : :
65 : : class LwpBorderStuff;
66 : : class LwpShadow;
67 : : class LwpMargins;
68 : :
69 : : class LwpParaBorderOverride : public LwpOverride
70 : : {
71 : : public:
72 : : LwpParaBorderOverride();
73 : : virtual ~LwpParaBorderOverride();
74 : :
75 : : virtual LwpParaBorderOverride* clone() const;
76 : :
77 : : enum BorderWidthType
78 : : {
79 : : PB_NONE = 0, /* No border */
80 : : PB_TEXTWIDTH = 1, /* Border is width of text */
81 : : PB_MARGINWIDTH = 2, /* Border extends to margins */
82 : : PB_CUSTOMWIDTH = 3 /* Border width is specified explicitly */
83 : : };
84 : : public:
85 : : virtual void Read(LwpObjectStream *pStrm);
86 : :
87 : 18 : LwpShadow* GetShadow(){ return m_pShadow; }
88 : 18 : LwpBorderStuff* GetBorderStuff(){ return m_pBorderStuff; }
89 : 6 : LwpMargins* GetMargins() { return m_pMargins; };
90 : :
91 : : void Override(LwpParaBorderOverride* pOther);
92 : :
93 : : inline sal_Bool IsBorderStuffOverridden();
94 : : inline sal_Bool IsBetweenStuffOverridden();
95 : : inline sal_Bool IsShadowOverridden();
96 : : inline sal_Bool IsMarginsOverridden();
97 : : inline sal_Bool IsAboveTypeOverridden();
98 : : inline sal_Bool IsBelowTypeOverridden();
99 : : inline sal_Bool IsRightTypeOverridden();
100 : : inline sal_Bool IsBetweenTypeOverridden();
101 : : inline sal_Bool IsAboveWidthOverridden();
102 : : inline sal_Bool IsBelowWidthOverridden();
103 : : inline sal_Bool IsBetweenWidthOverridden();
104 : : inline sal_Bool IsRightWidthOverridden();
105 : : inline sal_Bool IsBetweenMarginOverridden();
106 : :
107 : : void OverrideBorderStuff(LwpBorderStuff* pBorderStuff);
108 : : void OverrideBetweenStuff(LwpBorderStuff* pBorderStuff);
109 : : void OverrideShadow(LwpShadow* pShadow);
110 : : void OverrideMargins(LwpMargins* pMargins);
111 : : void OverrideAboveType(BorderWidthType eNewType);
112 : : void OverrideBelowType(BorderWidthType eNewType);
113 : : void OverrideRightType(BorderWidthType eNewType);
114 : : void OverrideBetweenType(BorderWidthType eNewType);
115 : : void OverrideAboveWidth(sal_uInt32 nNewWidth);
116 : : void OverrideBelowWidth(sal_uInt32 nNewWidth);
117 : : void OverrideBetweenWidth(sal_uInt32 nNewWidth);
118 : : void OverrideRightWidth(sal_uInt32 nNewWidth);
119 : : void OverrideBetweenMargin(sal_uInt32 nNewMargin);
120 : :
121 : : inline void RevertBorderStuff();
122 : : inline void RevertBetweenStuff();
123 : : inline void RevertShadow();
124 : : inline void RevertMargins();
125 : : inline void RevertAboveType();
126 : : inline void RevertBelowType();
127 : : inline void RevertRightType();
128 : : inline void RevertBetweenType();
129 : : inline void RevertAboveWidth();
130 : : inline void RevertBelowWidth();
131 : : inline void RevertBetweenWidth();
132 : : inline void RevertRightWidth();
133 : : inline void RevertBetweenMargin();
134 : :
135 : : //end add
136 : : friend class LwpParaBorderPiece;
137 : :
138 : : protected:
139 : : LwpParaBorderOverride(LwpParaBorderOverride const& rOther);
140 : :
141 : : private:
142 : : LwpParaBorderOverride& operator=(LwpParaBorderOverride const& rOther); // not implemented
143 : :
144 : : protected:
145 : : enum
146 : : {
147 : : PBO_STUFF = 0x0001,
148 : : PBO_SHADOW = 0x0002,
149 : : PBO_MARGINS = 0x0004,
150 : : PBO_ABOVETYPE = 0x0008,
151 : : PBO_BELOWTYPE = 0x0010,
152 : : PBO_RIGHTTYPE = 0x0020,
153 : : PBO_ABOVE = 0x0040,
154 : : PBO_BELOW = 0x0080,
155 : : PBO_BETWEENSTUFF = 0x0100,
156 : : PBO_BETWEENTYPE = 0x0200,
157 : : PBO_BETWEEN = 0x0400,
158 : : PBO_BETWEENMARGIN = 0x0800,
159 : : PBO_RIGHT = 0x1000
160 : : };
161 : :
162 : : private:
163 : : LwpBorderStuff *m_pBorderStuff;
164 : : LwpBorderStuff *m_pBetweenStuff;
165 : : LwpShadow *m_pShadow;
166 : : LwpMargins *m_pMargins;
167 : :
168 : : BorderWidthType m_eAboveType;
169 : : BorderWidthType m_eBelowType;
170 : : BorderWidthType m_eRightType;
171 : : BorderWidthType m_eBetweenType;
172 : :
173 : : sal_uInt32 m_nAboveWidth;
174 : : sal_uInt32 m_nBelowWidth;
175 : : sal_uInt32 m_nBetweenWidth;
176 : : sal_uInt32 m_nRightWidth;
177 : :
178 : : sal_uInt32 m_nBetweenMargin;
179 : : };
180 : :
181 : 6 : inline sal_Bool LwpParaBorderOverride::IsBorderStuffOverridden()
182 : : {
183 : 6 : return (sal_Bool)((m_nOverride & PBO_STUFF) != 0);
184 : : }
185 : 6 : inline sal_Bool LwpParaBorderOverride::IsBetweenStuffOverridden()
186 : : {
187 : 6 : return (sal_Bool)((m_nOverride & PBO_BETWEENSTUFF) != 0);
188 : : }
189 : 3 : inline sal_Bool LwpParaBorderOverride::IsShadowOverridden()
190 : : {
191 : 3 : return (sal_Bool)((m_nOverride & PBO_SHADOW) != 0);
192 : : }
193 : 6 : inline sal_Bool LwpParaBorderOverride::IsMarginsOverridden()
194 : : {
195 : 6 : return (sal_Bool)((m_nOverride & PBO_MARGINS) != 0);
196 : : }
197 : 6 : inline sal_Bool LwpParaBorderOverride::IsAboveTypeOverridden()
198 : : {
199 : 6 : return (sal_Bool)((m_nOverride & PBO_ABOVETYPE) != 0);
200 : : }
201 : 6 : inline sal_Bool LwpParaBorderOverride::IsBelowTypeOverridden()
202 : : {
203 : 6 : return (sal_Bool)((m_nOverride & PBO_BELOWTYPE) != 0);
204 : : }
205 : 6 : inline sal_Bool LwpParaBorderOverride::IsRightTypeOverridden()
206 : : {
207 : 6 : return (sal_Bool)((m_nOverride & PBO_RIGHTTYPE) != 0);
208 : : }
209 : 6 : inline sal_Bool LwpParaBorderOverride::IsBetweenTypeOverridden()
210 : : {
211 : 6 : return (sal_Bool)((m_nOverride & PBO_BETWEENTYPE) != 0);
212 : : }
213 : 0 : inline sal_Bool LwpParaBorderOverride::IsAboveWidthOverridden()
214 : : {
215 : 0 : return (sal_Bool)((m_nOverride & PBO_ABOVE) != 0);
216 : : }
217 : 0 : inline sal_Bool LwpParaBorderOverride::IsBelowWidthOverridden()
218 : : {
219 : 0 : return (sal_Bool)((m_nOverride & PBO_BELOW) != 0);
220 : : }
221 : 6 : inline sal_Bool LwpParaBorderOverride::IsBetweenWidthOverridden()
222 : : {
223 : 6 : return (sal_Bool)((m_nOverride & PBO_BETWEEN) != 0);
224 : : }
225 : 0 : inline sal_Bool LwpParaBorderOverride::IsRightWidthOverridden()
226 : : {
227 : 0 : return (sal_Bool)((m_nOverride & PBO_RIGHT) != 0);
228 : : }
229 : 6 : inline sal_Bool LwpParaBorderOverride::IsBetweenMarginOverridden()
230 : : {
231 : 6 : return (sal_Bool)((m_nOverride & PBO_BETWEENMARGIN) != 0);
232 : : }
233 : :
234 : 0 : inline void LwpParaBorderOverride::RevertBorderStuff()
235 : : {
236 : 0 : LwpOverride::Override(PBO_STUFF, STATE_STYLE);
237 : 0 : }
238 : 0 : inline void LwpParaBorderOverride::RevertBetweenStuff()
239 : : {
240 : 0 : LwpOverride::Override(PBO_BETWEENSTUFF, STATE_STYLE);
241 : 0 : }
242 : 0 : inline void LwpParaBorderOverride::RevertShadow()
243 : : {
244 : 0 : LwpOverride::Override(PBO_SHADOW, STATE_STYLE);
245 : 0 : }
246 : 0 : inline void LwpParaBorderOverride::RevertMargins()
247 : : {
248 : 0 : LwpOverride::Override(PBO_MARGINS, STATE_STYLE);
249 : 0 : }
250 : 0 : inline void LwpParaBorderOverride::RevertAboveType()
251 : : {
252 : 0 : LwpOverride::Override(PBO_ABOVETYPE, STATE_STYLE);
253 : 0 : }
254 : 0 : inline void LwpParaBorderOverride::RevertBelowType()
255 : : {
256 : 0 : LwpOverride::Override(PBO_BELOWTYPE, STATE_STYLE);
257 : 0 : }
258 : 0 : inline void LwpParaBorderOverride::RevertRightType()
259 : : {
260 : 0 : LwpOverride::Override(PBO_RIGHTTYPE, STATE_STYLE);
261 : 0 : }
262 : 0 : inline void LwpParaBorderOverride::RevertBetweenType()
263 : : {
264 : 0 : LwpOverride::Override(PBO_BETWEENTYPE, STATE_STYLE);
265 : 0 : }
266 : 0 : inline void LwpParaBorderOverride::RevertAboveWidth()
267 : : {
268 : 0 : LwpOverride::Override(PBO_ABOVE, STATE_STYLE);
269 : 0 : }
270 : 0 : inline void LwpParaBorderOverride::RevertBelowWidth()
271 : : {
272 : 0 : LwpOverride::Override(PBO_BELOW, STATE_STYLE);
273 : 0 : }
274 : 0 : inline void LwpParaBorderOverride::RevertBetweenWidth()
275 : : {
276 : 0 : LwpOverride::Override(PBO_BETWEEN, STATE_STYLE);
277 : 0 : }
278 : 0 : inline void LwpParaBorderOverride::RevertRightWidth()
279 : : {
280 : 0 : LwpOverride::Override(PBO_RIGHT, STATE_STYLE);
281 : 0 : }
282 : 0 : inline void LwpParaBorderOverride::RevertBetweenMargin()
283 : : {
284 : 0 : LwpOverride::Override(PBO_BETWEENMARGIN, STATE_STYLE);
285 : 0 : }
286 : :
287 : : #endif
288 : :
289 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|