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,
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 /*************************************************************************
57 * Breaks override of Wordpro.
58 ************************************************************************/
59 /*************************************************************************
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()
79 void LwpBreaksOverride::Read(LwpObjectStream
*pStrm
)
81 if (pStrm
->QuickReadBool())
85 m_pNextStyle
->Read(pStrm
);
92 void LwpBreaksOverride::Override(LwpBreaksOverride
* pOther
)
94 if (m_nApply
& BO_PAGEBEFORE
)
96 if (IsPageBreakBeforeOverridden())
98 pOther
->OverridePageBreakBefore(IsPageBreakBefore());
102 pOther
->RevertPageBreakBefore();
105 if (m_nApply
& BO_PAGEAFTER
)
107 if (IsPageBreakAfterOverridden())
109 pOther
->OverridePageBreakAfter(IsPageBreakAfter());
113 pOther
->RevertPageBreakAfter();
116 if (m_nApply
& BO_KEEPTOGETHER
)
118 if (IsPageBreakWithinOverridden())
120 pOther
->OverridePageBreakWithin(IsPageBreakWithin());
124 pOther
->RevertPageBreakWithin();
127 if (m_nApply
& BO_COLBEFORE
)
129 if (IsColumnBreakBeforeOverridden())
131 pOther
->OverrideColumnBreakBefore(IsColumnBreakBefore());
135 pOther
->RevertColumnBreakBefore();
138 if (m_nApply
& BO_COLAFTER
)
140 if (IsColumnBreakAfterOverridden())
142 pOther
->OverrideColumnBreakAfter(IsColumnBreakAfter());
146 pOther
->RevertColumnBreakAfter();
149 if (m_nApply
& BO_KEEPPREV
)
151 if (IsKeepWithPreviousOverridden())
153 pOther
->OverrideKeepWithPrevious(IsKeepWithPrevious());
157 pOther
->RevertKeepWithPrevious();
160 if (m_nApply
& BO_KEEPNEXT
)
162 if (IsKeepWithNextOverridden())
164 pOther
->OverrideKeepWithNext(IsKeepWithNext());
168 pOther
->RevertKeepWithNext();
171 if (m_nApply
& BO_USENEXTSTYLE
)
173 if (IsUseNextStyleOverridden())
175 pOther
->OverrideUseNextStyle(IsUseNextStyle());
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
)
195 LwpOverride::Override(BO_PAGEBEFORE
, STATE_ON
);
199 LwpOverride::Override(BO_PAGEBEFORE
, STATE_OFF
);
202 void LwpBreaksOverride::OverridePageBreakAfter(sal_Bool bVal
)
206 LwpOverride::Override(BO_PAGEAFTER
, STATE_ON
);
210 LwpOverride::Override(BO_PAGEAFTER
, STATE_OFF
);
213 void LwpBreaksOverride::OverridePageBreakWithin(sal_Bool bVal
)
215 // Note the flipped logic
218 LwpOverride::Override(BO_KEEPTOGETHER
, STATE_ON
);
222 LwpOverride::Override(BO_KEEPTOGETHER
, STATE_OFF
);
225 void LwpBreaksOverride::OverrideColumnBreakBefore(sal_Bool bVal
)
229 LwpOverride::Override(BO_COLBEFORE
, STATE_ON
);
233 LwpOverride::Override(BO_COLBEFORE
, STATE_OFF
);
236 void LwpBreaksOverride::OverrideColumnBreakAfter(sal_Bool bVal
)
240 LwpOverride::Override(BO_COLAFTER
, STATE_ON
);
244 LwpOverride::Override(BO_COLAFTER
, STATE_OFF
);
247 void LwpBreaksOverride::OverrideKeepWithNext(sal_Bool bVal
)
251 LwpOverride::Override(BO_KEEPNEXT
, STATE_ON
);
255 LwpOverride::Override(BO_KEEPNEXT
, STATE_OFF
);
258 void LwpBreaksOverride::OverrideKeepWithPrevious(sal_Bool bVal
)
262 LwpOverride::Override(BO_KEEPPREV
, STATE_ON
);
266 LwpOverride::Override(BO_KEEPPREV
, STATE_OFF
);
269 void LwpBreaksOverride::OverrideUseNextStyle(sal_Bool bVal
)
273 LwpOverride::Override(BO_USENEXTSTYLE
, STATE_ON
);
277 LwpOverride::Override(BO_USENEXTSTYLE
, STATE_OFF
);