fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / lotuswordpro / source / filter / lwpbreaksoverride.cxx
blob6556b68300ae77c8d10799fd11d6a7917163d82e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * The Contents of this file are made available subject to the terms of
5 * either of the following licenses
7 * - GNU Lesser General Public License Version 2.1
8 * - Sun Industry Standards Source License Version 1.1
10 * Sun Microsystems Inc., October, 2000
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
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.
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.
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
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.
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.
46 * The Initial Developer of the Original Code is: IBM Corporation
48 * Copyright: 2008 by IBM Corporation
50 * All Rights Reserved.
52 * Contributor(s): _______________________________________
55 ************************************************************************/
56 /*************************************************************************
57 * @file
58 * Breaks override of Wordpro.
59 ************************************************************************/
60 #include <memory>
62 #include "clone.hxx"
63 #include "lwpbreaksoverride.hxx"
64 #include "lwpobjstrm.hxx"
65 #include "lwpatomholder.hxx"
68 LwpBreaksOverride::LwpBreaksOverride()
70 m_pNextStyle = new LwpAtomHolder();
73 LwpBreaksOverride::LwpBreaksOverride(LwpBreaksOverride const& rOther)
74 : LwpOverride(rOther)
75 , m_pNextStyle(0)
77 std::auto_ptr<LwpAtomHolder> pNextStyle(::clone(rOther.m_pNextStyle));
78 m_pNextStyle = pNextStyle.release();
81 LwpBreaksOverride::~LwpBreaksOverride()
83 if( m_pNextStyle )
84 delete m_pNextStyle;
87 LwpBreaksOverride* LwpBreaksOverride::clone() const
89 return new LwpBreaksOverride(*this);
92 void LwpBreaksOverride::Read(LwpObjectStream *pStrm)
94 if (pStrm->QuickReadBool())
96 ReadCommon(pStrm);
98 m_pNextStyle->Read(pStrm);
101 pStrm->SkipExtra();
104 //add by , 01/28/2005
105 void LwpBreaksOverride::Override(LwpBreaksOverride* pOther)
107 if (m_nApply & BO_PAGEBEFORE)
109 if (IsPageBreakBeforeOverridden())
111 pOther->OverridePageBreakBefore(IsPageBreakBefore());
113 else
115 pOther->RevertPageBreakBefore();
118 if (m_nApply & BO_PAGEAFTER)
120 if (IsPageBreakAfterOverridden())
122 pOther->OverridePageBreakAfter(IsPageBreakAfter());
124 else
126 pOther->RevertPageBreakAfter();
129 if (m_nApply & BO_KEEPTOGETHER)
131 if (IsPageBreakWithinOverridden())
133 pOther->OverridePageBreakWithin(IsPageBreakWithin());
135 else
137 pOther->RevertPageBreakWithin();
140 if (m_nApply & BO_COLBEFORE)
142 if (IsColumnBreakBeforeOverridden())
144 pOther->OverrideColumnBreakBefore(IsColumnBreakBefore());
146 else
148 pOther->RevertColumnBreakBefore();
151 if (m_nApply & BO_COLAFTER)
153 if (IsColumnBreakAfterOverridden())
155 pOther->OverrideColumnBreakAfter(IsColumnBreakAfter());
157 else
159 pOther->RevertColumnBreakAfter();
162 if (m_nApply & BO_KEEPPREV)
164 if (IsKeepWithPreviousOverridden())
166 pOther->OverrideKeepWithPrevious(IsKeepWithPrevious());
168 else
170 pOther->RevertKeepWithPrevious();
173 if (m_nApply & BO_KEEPNEXT)
175 if (IsKeepWithNextOverridden())
177 pOther->OverrideKeepWithNext(IsKeepWithNext());
179 else
181 pOther->RevertKeepWithNext();
184 if (m_nApply & BO_USENEXTSTYLE)
186 if (IsUseNextStyleOverridden())
188 pOther->OverrideUseNextStyle(IsUseNextStyle());
190 else
192 pOther->RevertUseNextStyle();
197 void LwpBreaksOverride::OverridePageBreakBefore(sal_Bool bVal)
199 if(bVal)
201 LwpOverride::Override(BO_PAGEBEFORE, STATE_ON);
203 else
205 LwpOverride::Override(BO_PAGEBEFORE, STATE_OFF);
208 void LwpBreaksOverride::OverridePageBreakAfter(sal_Bool bVal)
210 if(bVal)
212 LwpOverride::Override(BO_PAGEAFTER, STATE_ON);
214 else
216 LwpOverride::Override(BO_PAGEAFTER, STATE_OFF);
219 void LwpBreaksOverride::OverridePageBreakWithin(sal_Bool bVal)
221 // Note the flipped logic
222 if(!bVal)
224 LwpOverride::Override(BO_KEEPTOGETHER, STATE_ON);
226 else
228 LwpOverride::Override(BO_KEEPTOGETHER, STATE_OFF);
231 void LwpBreaksOverride::OverrideColumnBreakBefore(sal_Bool bVal)
233 if(bVal)
235 LwpOverride::Override(BO_COLBEFORE, STATE_ON);
237 else
239 LwpOverride::Override(BO_COLBEFORE, STATE_OFF);
242 void LwpBreaksOverride::OverrideColumnBreakAfter(sal_Bool bVal)
244 if(bVal)
246 LwpOverride::Override(BO_COLAFTER, STATE_ON);
248 else
250 LwpOverride::Override(BO_COLAFTER, STATE_OFF);
253 void LwpBreaksOverride::OverrideKeepWithNext(sal_Bool bVal)
255 if(bVal)
257 LwpOverride::Override(BO_KEEPNEXT, STATE_ON);
259 else
261 LwpOverride::Override(BO_KEEPNEXT, STATE_OFF);
264 void LwpBreaksOverride::OverrideKeepWithPrevious(sal_Bool bVal)
266 if(bVal)
268 LwpOverride::Override(BO_KEEPPREV, STATE_ON);
270 else
272 LwpOverride::Override(BO_KEEPPREV, STATE_OFF);
275 void LwpBreaksOverride::OverrideUseNextStyle(sal_Bool bVal)
277 if(bVal)
279 LwpOverride::Override(BO_USENEXTSTYLE, STATE_ON);
281 else
283 LwpOverride::Override(BO_USENEXTSTYLE, STATE_OFF);
286 //end add
288 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */