merge the formfield patch from ooo-build
[ooovba.git] / lotuswordpro / source / filter / lwpbreaksoverride.cxx
blobe368cc00f3d899082707bc5817390c9aad7cd8c6
1 /*************************************************************************
3 * The Contents of this file are made available subject to the terms of
4 * either of the following licenses
6 * - GNU Lesser General Public License Version 2.1
7 * - Sun Industry Standards Source License Version 1.1
9 * Sun Microsystems Inc., October, 2000
11 * GNU Lesser General Public License Version 2.1
12 * =============================================
13 * Copyright 2000 by Sun Microsystems, Inc.
14 * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License version 2.1, as published by the Free Software Foundation.
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 * MA 02111-1307 USA
31 * Sun Industry Standards Source License Version 1.1
32 * =================================================
33 * The contents of this file are subject to the Sun Industry Standards
34 * Source License Version 1.1 (the "License"); You may not use this file
35 * except in compliance with the License. You may obtain a copy of the
36 * License at http://www.openoffice.org/license.html.
38 * Software provided under this License is provided on an "AS IS" basis,
39 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
40 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
41 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
42 * See the License for the specific provisions governing your rights and
43 * obligations concerning the Software.
45 * The Initial Developer of the Original Code is: IBM Corporation
47 * Copyright: 2008 by IBM Corporation
49 * All Rights Reserved.
51 * Contributor(s): _______________________________________
54 ************************************************************************/
55 /*************************************************************************
56 * @file
57 * Breaks override of Wordpro.
58 ************************************************************************/
59 /*************************************************************************
60 * Change History
61 * 2005-01-12 Create and implement.
62 ************************************************************************/
63 #include "lwpbreaksoverride.hxx"
64 #include "lwpobjstrm.hxx"
65 #include "lwpatomholder.hxx"
68 LwpBreaksOverride::LwpBreaksOverride()
70 m_pNextStyle = new LwpAtomHolder();
73 LwpBreaksOverride::~LwpBreaksOverride()
75 if( m_pNextStyle )
76 delete m_pNextStyle;
79 void LwpBreaksOverride::Read(LwpObjectStream *pStrm)
81 if (pStrm->QuickReadBool())
83 ReadCommon(pStrm);
85 m_pNextStyle->Read(pStrm);
88 pStrm->SkipExtra();
91 //add by , 01/28/2005
92 void LwpBreaksOverride::Override(LwpBreaksOverride* pOther)
94 if (m_nApply & BO_PAGEBEFORE)
96 if (IsPageBreakBeforeOverridden())
98 pOther->OverridePageBreakBefore(IsPageBreakBefore());
100 else
102 pOther->RevertPageBreakBefore();
105 if (m_nApply & BO_PAGEAFTER)
107 if (IsPageBreakAfterOverridden())
109 pOther->OverridePageBreakAfter(IsPageBreakAfter());
111 else
113 pOther->RevertPageBreakAfter();
116 if (m_nApply & BO_KEEPTOGETHER)
118 if (IsPageBreakWithinOverridden())
120 pOther->OverridePageBreakWithin(IsPageBreakWithin());
122 else
124 pOther->RevertPageBreakWithin();
127 if (m_nApply & BO_COLBEFORE)
129 if (IsColumnBreakBeforeOverridden())
131 pOther->OverrideColumnBreakBefore(IsColumnBreakBefore());
133 else
135 pOther->RevertColumnBreakBefore();
138 if (m_nApply & BO_COLAFTER)
140 if (IsColumnBreakAfterOverridden())
142 pOther->OverrideColumnBreakAfter(IsColumnBreakAfter());
144 else
146 pOther->RevertColumnBreakAfter();
149 if (m_nApply & BO_KEEPPREV)
151 if (IsKeepWithPreviousOverridden())
153 pOther->OverrideKeepWithPrevious(IsKeepWithPrevious());
155 else
157 pOther->RevertKeepWithPrevious();
160 if (m_nApply & BO_KEEPNEXT)
162 if (IsKeepWithNextOverridden())
164 pOther->OverrideKeepWithNext(IsKeepWithNext());
166 else
168 pOther->RevertKeepWithNext();
171 if (m_nApply & BO_USENEXTSTYLE)
173 if (IsUseNextStyleOverridden())
175 pOther->OverrideUseNextStyle(IsUseNextStyle());
177 else
179 pOther->RevertUseNextStyle();
184 void LwpBreaksOverride::operator=(const LwpOverride& rOther)
186 LwpOverride::operator=(rOther);
188 // copy m_pNextStyle...
191 void LwpBreaksOverride::OverridePageBreakBefore(sal_Bool bVal)
193 if(bVal)
195 LwpOverride::Override(BO_PAGEBEFORE, STATE_ON);
197 else
199 LwpOverride::Override(BO_PAGEBEFORE, STATE_OFF);
202 void LwpBreaksOverride::OverridePageBreakAfter(sal_Bool bVal)
204 if(bVal)
206 LwpOverride::Override(BO_PAGEAFTER, STATE_ON);
208 else
210 LwpOverride::Override(BO_PAGEAFTER, STATE_OFF);
213 void LwpBreaksOverride::OverridePageBreakWithin(sal_Bool bVal)
215 // Note the flipped logic
216 if(!bVal)
218 LwpOverride::Override(BO_KEEPTOGETHER, STATE_ON);
220 else
222 LwpOverride::Override(BO_KEEPTOGETHER, STATE_OFF);
225 void LwpBreaksOverride::OverrideColumnBreakBefore(sal_Bool bVal)
227 if(bVal)
229 LwpOverride::Override(BO_COLBEFORE, STATE_ON);
231 else
233 LwpOverride::Override(BO_COLBEFORE, STATE_OFF);
236 void LwpBreaksOverride::OverrideColumnBreakAfter(sal_Bool bVal)
238 if(bVal)
240 LwpOverride::Override(BO_COLAFTER, STATE_ON);
242 else
244 LwpOverride::Override(BO_COLAFTER, STATE_OFF);
247 void LwpBreaksOverride::OverrideKeepWithNext(sal_Bool bVal)
249 if(bVal)
251 LwpOverride::Override(BO_KEEPNEXT, STATE_ON);
253 else
255 LwpOverride::Override(BO_KEEPNEXT, STATE_OFF);
258 void LwpBreaksOverride::OverrideKeepWithPrevious(sal_Bool bVal)
260 if(bVal)
262 LwpOverride::Override(BO_KEEPPREV, STATE_ON);
264 else
266 LwpOverride::Override(BO_KEEPPREV, STATE_OFF);
269 void LwpBreaksOverride::OverrideUseNextStyle(sal_Bool bVal)
271 if(bVal)
273 LwpOverride::Override(BO_USENEXTSTYLE, STATE_ON);
275 else
277 LwpOverride::Override(BO_USENEXTSTYLE, STATE_OFF);
280 //end add