diff options
author | Fong Lin <pflin@novell.com> | 2010-10-08 17:04:46 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@novell.com> | 2010-10-08 17:04:46 +0100 |
commit | cc316b39d9110c536e1758a4f814738ca209bb02 (patch) | |
tree | 0ff290d366ff8fea16ebc7e7781cc14b563f9b37 /lotuswordpro/source/filter/lwpbreaksoverride.cxx | |
parent | 949fa63a66adc1ba54a0c353afd66bb863024d27 (diff) |
Port of Lotus Word Pro filter, by Fong Lin and Noel Power
Diffstat (limited to 'lotuswordpro/source/filter/lwpbreaksoverride.cxx')
-rw-r--r-- | lotuswordpro/source/filter/lwpbreaksoverride.cxx | 280 |
1 files changed, 280 insertions, 0 deletions
diff --git a/lotuswordpro/source/filter/lwpbreaksoverride.cxx b/lotuswordpro/source/filter/lwpbreaksoverride.cxx new file mode 100644 index 000000000000..c614d1a5b2fe --- /dev/null +++ b/lotuswordpro/source/filter/lwpbreaksoverride.cxx @@ -0,0 +1,280 @@ +/************************************************************************* + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: IBM Corporation + * + * Copyright: 2008 by IBM Corporation + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +/************************************************************************* +* @file +* Breaks override of Wordpro. +************************************************************************/ +/************************************************************************* +* Change History +* 2005-01-12 Create and implement. +************************************************************************/ +#include "lwpbreaksoverride.hxx" +#include "lwpobjstrm.hxx" +#include "lwpatomholder.hxx" + + +LwpBreaksOverride::LwpBreaksOverride() +{ + m_pNextStyle = new LwpAtomHolder(); +} + +LwpBreaksOverride::~LwpBreaksOverride() +{ + if( m_pNextStyle ) + delete m_pNextStyle; +} + +void LwpBreaksOverride::Read(LwpObjectStream *pStrm) +{ + if (pStrm->QuickReadBool()) + { + ReadCommon(pStrm); + + m_pNextStyle->Read(pStrm); + } + + pStrm->SkipExtra(); +} + +//add by , 01/28/2005 +void LwpBreaksOverride::Override(LwpBreaksOverride* pOther) +{ + if (m_nApply & BO_PAGEBEFORE) + { + if (IsPageBreakBeforeOverridden()) + { + pOther->OverridePageBreakBefore(IsPageBreakBefore()); + } + else + { + pOther->RevertPageBreakBefore(); + } + } + if (m_nApply & BO_PAGEAFTER) + { + if (IsPageBreakAfterOverridden()) + { + pOther->OverridePageBreakAfter(IsPageBreakAfter()); + } + else + { + pOther->RevertPageBreakAfter(); + } + } + if (m_nApply & BO_KEEPTOGETHER) + { + if (IsPageBreakWithinOverridden()) + { + pOther->OverridePageBreakWithin(IsPageBreakWithin()); + } + else + { + pOther->RevertPageBreakWithin(); + } + } + if (m_nApply & BO_COLBEFORE) + { + if (IsColumnBreakBeforeOverridden()) + { + pOther->OverrideColumnBreakBefore(IsColumnBreakBefore()); + } + else + { + pOther->RevertColumnBreakBefore(); + } + } + if (m_nApply & BO_COLAFTER) + { + if (IsColumnBreakAfterOverridden()) + { + pOther->OverrideColumnBreakAfter(IsColumnBreakAfter()); + } + else + { + pOther->RevertColumnBreakAfter(); + } + } + if (m_nApply & BO_KEEPPREV) + { + if (IsKeepWithPreviousOverridden()) + { + pOther->OverrideKeepWithPrevious(IsKeepWithPrevious()); + } + else + { + pOther->RevertKeepWithPrevious(); + } + } + if (m_nApply & BO_KEEPNEXT) + { + if (IsKeepWithNextOverridden()) + { + pOther->OverrideKeepWithNext(IsKeepWithNext()); + } + else + { + pOther->RevertKeepWithNext(); + } + } + if (m_nApply & BO_USENEXTSTYLE) + { + if (IsUseNextStyleOverridden()) + { + pOther->OverrideUseNextStyle(IsUseNextStyle()); + } + else + { + pOther->RevertUseNextStyle(); + } + } +} + +void LwpBreaksOverride::operator=(const LwpOverride& rOther) +{ + LwpOverride::operator=(rOther); + + // copy m_pNextStyle... +} + +void LwpBreaksOverride::OverridePageBreakBefore(sal_Bool bVal) +{ + if(bVal) + { + LwpOverride::Override(BO_PAGEBEFORE, STATE_ON); + } + else + { + LwpOverride::Override(BO_PAGEBEFORE, STATE_OFF); + } +} +void LwpBreaksOverride::OverridePageBreakAfter(sal_Bool bVal) +{ + if(bVal) + { + LwpOverride::Override(BO_PAGEAFTER, STATE_ON); + } + else + { + LwpOverride::Override(BO_PAGEAFTER, STATE_OFF); + } +} +void LwpBreaksOverride::OverridePageBreakWithin(sal_Bool bVal) +{ + // Note the flipped logic + if(!bVal) + { + LwpOverride::Override(BO_KEEPTOGETHER, STATE_ON); + } + else + { + LwpOverride::Override(BO_KEEPTOGETHER, STATE_OFF); + } +} +void LwpBreaksOverride::OverrideColumnBreakBefore(sal_Bool bVal) +{ + if(bVal) + { + LwpOverride::Override(BO_COLBEFORE, STATE_ON); + } + else + { + LwpOverride::Override(BO_COLBEFORE, STATE_OFF); + } +} +void LwpBreaksOverride::OverrideColumnBreakAfter(sal_Bool bVal) +{ + if(bVal) + { + LwpOverride::Override(BO_COLAFTER, STATE_ON); + } + else + { + LwpOverride::Override(BO_COLAFTER, STATE_OFF); + } +} +void LwpBreaksOverride::OverrideKeepWithNext(sal_Bool bVal) +{ + if(bVal) + { + LwpOverride::Override(BO_KEEPNEXT, STATE_ON); + } + else + { + LwpOverride::Override(BO_KEEPNEXT, STATE_OFF); + } +} +void LwpBreaksOverride::OverrideKeepWithPrevious(sal_Bool bVal) +{ + if(bVal) + { + LwpOverride::Override(BO_KEEPPREV, STATE_ON); + } + else + { + LwpOverride::Override(BO_KEEPPREV, STATE_OFF); + } +} +void LwpBreaksOverride::OverrideUseNextStyle(sal_Bool bVal) +{ + if(bVal) + { + LwpOverride::Override(BO_USENEXTSTYLE, STATE_ON); + } + else + { + LwpOverride::Override(BO_USENEXTSTYLE, STATE_OFF); + } +} +//end add |