summaryrefslogtreecommitdiff
path: root/lotuswordpro/source/filter
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2010-12-24 10:03:59 +0100
committerDavid Tardon <dtardon@redhat.com>2010-12-24 14:17:54 +0100
commiteb13a88164d7ca860af6dc48c9646232d7f908f1 (patch)
tree2bf63ae3fcde6e3e750acf4ec59778e90b268cfe /lotuswordpro/source/filter
parentf2689d614c44b99882c5d3fcc49b16d07956efe8 (diff)
replace virtual operator= by cloning
Diffstat (limited to 'lotuswordpro/source/filter')
-rw-r--r--lotuswordpro/source/filter/lwpbackgroundoverride.cxx39
-rw-r--r--lotuswordpro/source/filter/lwpbackgroundoverride.hxx7
-rw-r--r--lotuswordpro/source/filter/lwpbreaksoverride.cxx23
-rw-r--r--lotuswordpro/source/filter/lwpbreaksoverride.hxx10
-rw-r--r--lotuswordpro/source/filter/lwpbulletstylemgr.cxx8
-rw-r--r--lotuswordpro/source/filter/lwpbulletstylemgr.hxx11
-rw-r--r--lotuswordpro/source/filter/lwpcharborderoverride.cxx20
-rw-r--r--lotuswordpro/source/filter/lwpcharborderoverride.hxx8
-rw-r--r--lotuswordpro/source/filter/lwpnumberingoverride.cxx23
-rw-r--r--lotuswordpro/source/filter/lwpnumberingoverride.hxx10
-rw-r--r--lotuswordpro/source/filter/lwpoverride.cxx168
-rw-r--r--lotuswordpro/source/filter/lwpoverride.hxx94
-rw-r--r--lotuswordpro/source/filter/lwppara.cxx32
-rw-r--r--lotuswordpro/source/filter/lwppara.hxx6
-rw-r--r--lotuswordpro/source/filter/lwppara1.cxx89
-rw-r--r--lotuswordpro/source/filter/lwpparaborderoverride.cxx70
-rw-r--r--lotuswordpro/source/filter/lwpparaborderoverride.hxx12
-rw-r--r--lotuswordpro/source/filter/lwpparastyle.cxx21
-rw-r--r--lotuswordpro/source/filter/lwptaboverride.cxx42
-rw-r--r--lotuswordpro/source/filter/lwptaboverride.hxx9
-rw-r--r--lotuswordpro/source/filter/makefile.mk2
21 files changed, 527 insertions, 177 deletions
diff --git a/lotuswordpro/source/filter/lwpbackgroundoverride.cxx b/lotuswordpro/source/filter/lwpbackgroundoverride.cxx
new file mode 100644
index 000000000000..43397b73e531
--- /dev/null
+++ b/lotuswordpro/source/filter/lwpbackgroundoverride.cxx
@@ -0,0 +1,39 @@
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public 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.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ * Red Hat, Inc.
+ * Portions created by the Initial Developer are Copyright (C) 2010 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): David Tardon <dtardon@redhat.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "lwpbackgroundoverride.hxx"
+
+LwpBackgroundOverride::LwpBackgroundOverride(LwpBackgroundOverride const &rOther)
+ : LwpOverride(rOther)
+ , m_aStuff(rOther.m_aStuff)
+{
+}
+
+LwpBackgroundOverride* LwpBackgroundOverride::clone() const
+{
+ return new LwpBackgroundOverride(*this);
+}
diff --git a/lotuswordpro/source/filter/lwpbackgroundoverride.hxx b/lotuswordpro/source/filter/lwpbackgroundoverride.hxx
index ce991d816493..109101b6390d 100644
--- a/lotuswordpro/source/filter/lwpbackgroundoverride.hxx
+++ b/lotuswordpro/source/filter/lwpbackgroundoverride.hxx
@@ -68,6 +68,7 @@ public:
LwpBackgroundOverride(){}
virtual ~LwpBackgroundOverride(){}
+ virtual LwpBackgroundOverride* clone() const;
public:
virtual void Read(LwpObjectStream *pStrm)
@@ -85,6 +86,12 @@ public:
LwpColor GetBackColor(){ return m_aStuff.m_aFillColor; }
LwpBackgroundStuff* GetBGStuff() { return &m_aStuff; }
+protected:
+ LwpBackgroundOverride(LwpBackgroundOverride const& rOther);
+
+private:
+ LwpBackgroundOverride& operator=(LwpBackgroundOverride const& rOther); // not implemented
+
private:
LwpBackgroundStuff m_aStuff;
};
diff --git a/lotuswordpro/source/filter/lwpbreaksoverride.cxx b/lotuswordpro/source/filter/lwpbreaksoverride.cxx
index 6d108f25bb41..38111c229bb9 100644
--- a/lotuswordpro/source/filter/lwpbreaksoverride.cxx
+++ b/lotuswordpro/source/filter/lwpbreaksoverride.cxx
@@ -61,6 +61,9 @@
* Change History
* 2005-01-12 Create and implement.
************************************************************************/
+
+#include <memory>
+
#include "lwpbreaksoverride.hxx"
#include "lwpobjstrm.hxx"
#include "lwpatomholder.hxx"
@@ -71,12 +74,25 @@ LwpBreaksOverride::LwpBreaksOverride()
m_pNextStyle = new LwpAtomHolder();
}
+LwpBreaksOverride::LwpBreaksOverride(LwpBreaksOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_pNextStyle(0)
+{
+ std::auto_ptr<LwpAtomHolder> pNextStyle(new LwpAtomHolder(*rOther.m_pNextStyle));
+ m_pNextStyle = pNextStyle.release();
+}
+
LwpBreaksOverride::~LwpBreaksOverride()
{
if( m_pNextStyle )
delete m_pNextStyle;
}
+LwpBreaksOverride* LwpBreaksOverride::clone() const
+{
+ return new LwpBreaksOverride(*this);
+}
+
void LwpBreaksOverride::Read(LwpObjectStream *pStrm)
{
if (pStrm->QuickReadBool())
@@ -182,13 +198,6 @@ void LwpBreaksOverride::Override(LwpBreaksOverride* pOther)
}
}
-void LwpBreaksOverride::operator=(const LwpOverride& rOther)
-{
- LwpOverride::operator=(rOther);
-
- // copy m_pNextStyle...
-}
-
void LwpBreaksOverride::OverridePageBreakBefore(sal_Bool bVal)
{
if(bVal)
diff --git a/lotuswordpro/source/filter/lwpbreaksoverride.hxx b/lotuswordpro/source/filter/lwpbreaksoverride.hxx
index 72fbfd468a5d..adde24d9be0a 100644
--- a/lotuswordpro/source/filter/lwpbreaksoverride.hxx
+++ b/lotuswordpro/source/filter/lwpbreaksoverride.hxx
@@ -75,6 +75,8 @@ public:
LwpBreaksOverride();
virtual ~LwpBreaksOverride();
+ virtual LwpBreaksOverride* clone() const;
+
enum
{
BO_PAGEBEFORE = 0x01, // page break before this style
@@ -93,8 +95,6 @@ public:
//add by , 01/28/2005
void Override(LwpBreaksOverride* pOther);
- void operator=(const LwpOverride& rOther);
-
inline sal_Bool IsPageBreakBefore();
inline sal_Bool IsPageBreakAfter();
inline sal_Bool IsPageBreakWithin();
@@ -136,6 +136,12 @@ public:
inline LwpAtomHolder* GetNextStyle();
//end add
+protected:
+ LwpBreaksOverride(LwpBreaksOverride const& rOther);
+
+private:
+ LwpBreaksOverride& operator=(const LwpBreaksOverride& rOther); // not implemented
+
private:
LwpAtomHolder *m_pNextStyle;
};
diff --git a/lotuswordpro/source/filter/lwpbulletstylemgr.cxx b/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
index d0f5293d93a0..1209a2afe9b3 100644
--- a/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
+++ b/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
@@ -130,14 +130,14 @@ rtl::OUString LwpBulletStyleMgr::RegisterBulletStyle(LwpPara* pPara, LwpBulletOv
}
LwpObjectID aBulletID = pBullOver->GetSilverBullet();
- LwpBulletOverride aBulletOver = *pBullOver;
+ boost::shared_ptr<LwpBulletOverride> pBulletOver(pBullOver->clone());
sal_uInt16 nNameIndex = 0;
std::vector <OverridePair>::iterator iter;
for(iter = m_vIDsPairList.begin(); iter != m_vIDsPairList.end(); iter++)
{
- if (iter->first.GetSilverBullet() == aBulletID && iter->second == aIndentID
- && iter->first.IsRightAligned() == pBullOver->IsRightAligned())
+ if (iter->first->GetSilverBullet() == aBulletID && iter->second == aIndentID
+ && iter->first->IsRightAligned() == pBullOver->IsRightAligned())
{
return m_vStyleNameList[nNameIndex];
}
@@ -147,7 +147,7 @@ rtl::OUString LwpBulletStyleMgr::RegisterBulletStyle(LwpPara* pPara, LwpBulletOv
}
}
- m_vIDsPairList.push_back(std::make_pair(aBulletOver, aIndentID));
+ m_vIDsPairList.push_back(std::make_pair(pBulletOver, aIndentID));
rtl::OUString aStyleName;
LwpFribPtr* pBulletParaFribs = pBulletPara->GetFribs();
diff --git a/lotuswordpro/source/filter/lwpbulletstylemgr.hxx b/lotuswordpro/source/filter/lwpbulletstylemgr.hxx
index 0da3b010cd61..b9268724d7f9 100644
--- a/lotuswordpro/source/filter/lwpbulletstylemgr.hxx
+++ b/lotuswordpro/source/filter/lwpbulletstylemgr.hxx
@@ -64,6 +64,9 @@
#ifndef _LWPBULLETSTYLEMGR_HXX
#define _LWPBULLETSTYLEMGR_HXX
+#include <boost/scoped_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+
#include "lwpheader.hxx"
#include "lwpfoundry.hxx"
#include "lwpobjid.hxx"
@@ -112,7 +115,7 @@ private:
private:
// std::vector <XFListStyle*> m_aBulletStyleList;
- typedef std::pair<LwpBulletOverride, LwpObjectID> OverridePair;
+ typedef std::pair<boost::shared_ptr<LwpBulletOverride>, LwpObjectID> OverridePair;
std::vector <rtl::OUString> m_vStyleNameList;
std::vector <OverridePair> m_vIDsPairList;
rtl::OUString m_aCurrentStyleName;
@@ -124,7 +127,7 @@ private:
sal_Bool m_bContinue;
sal_Bool m_bIsBulletSkipped;
LwpObjectID m_aCurrentNumberingID;
- LwpNumberingOverride m_aCurrentNumOverride;
+ boost::scoped_ptr<LwpNumberingOverride> m_pCurrentNumOverride;
sal_uInt16 m_nCurrentPos;
};
@@ -159,11 +162,11 @@ inline sal_uInt16 LwpBulletStyleMgr::GetCurrentPos() const
inline void LwpBulletStyleMgr::SetCurrentNumOver(const LwpNumberingOverride& rOther)
{
- m_aCurrentNumOverride = rOther;
+ m_pCurrentNumOverride.reset(rOther.clone());
}
inline LwpNumberingOverride* LwpBulletStyleMgr::GetCurrentNumOver()
{
- return &m_aCurrentNumOverride;
+ return m_pCurrentNumOverride.get();
}
#endif
diff --git a/lotuswordpro/source/filter/lwpcharborderoverride.cxx b/lotuswordpro/source/filter/lwpcharborderoverride.cxx
index 1f8c98b159bc..927d1dd78b03 100644
--- a/lotuswordpro/source/filter/lwpcharborderoverride.cxx
+++ b/lotuswordpro/source/filter/lwpcharborderoverride.cxx
@@ -62,6 +62,8 @@
Jan 2005 Created
************************************************************************/
+#include <memory>
+
#include "lwpcharborderoverride.hxx"
#include "lwpborderstuff.hxx"
#include "lwpmargins.hxx"
@@ -71,6 +73,19 @@ m_pBorderStuff(new LwpBorderStuff), m_pMargins(new LwpMargins)
{
}
+LwpCharacterBorderOverride::LwpCharacterBorderOverride(LwpCharacterBorderOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_pBorderStuff(0)
+ , m_pMargins(0)
+ , m_nAboveWidth(rOther.m_nAboveWidth)
+ , m_nBelowWidth(rOther.m_nBelowWidth)
+{
+ std::auto_ptr<LwpBorderStuff> pBorderStuff(new LwpBorderStuff(*rOther.m_pBorderStuff));
+ std::auto_ptr<LwpMargins> pMargins(new LwpMargins(*rOther.m_pMargins));
+ m_pBorderStuff = pBorderStuff.release();
+ m_pMargins = pMargins.release();
+}
+
LwpCharacterBorderOverride::~LwpCharacterBorderOverride()
{
if (m_pBorderStuff)
@@ -83,6 +98,11 @@ LwpCharacterBorderOverride::~LwpCharacterBorderOverride()
}
}
+LwpCharacterBorderOverride* LwpCharacterBorderOverride::clone() const
+{
+ return new LwpCharacterBorderOverride(*this);
+}
+
void LwpCharacterBorderOverride::Read(LwpObjectStream* pStrm)
{
if (pStrm->QuickReadBool())
diff --git a/lotuswordpro/source/filter/lwpcharborderoverride.hxx b/lotuswordpro/source/filter/lwpcharborderoverride.hxx
index 080134379a63..7908620ff9bd 100644
--- a/lotuswordpro/source/filter/lwpcharborderoverride.hxx
+++ b/lotuswordpro/source/filter/lwpcharborderoverride.hxx
@@ -76,6 +76,8 @@ public:
virtual ~LwpCharacterBorderOverride();
+ virtual LwpCharacterBorderOverride* clone() const;
+
void Read(LwpObjectStream* pStrm);
void Override(LwpCharacterBorderOverride* pOther);
@@ -100,6 +102,12 @@ public:
inline void RevertAboveWidth();
inline void RevertBelowWidth();
+protected:
+ LwpCharacterBorderOverride(LwpCharacterBorderOverride const& rOther);
+
+private:
+ LwpCharacterBorderOverride& operator=(LwpCharacterBorderOverride const& rOther); // not implemented
+
private:
LwpBorderStuff* m_pBorderStuff;
LwpMargins* m_pMargins;
diff --git a/lotuswordpro/source/filter/lwpnumberingoverride.cxx b/lotuswordpro/source/filter/lwpnumberingoverride.cxx
index 497cbac2a01d..db33130070f9 100644
--- a/lotuswordpro/source/filter/lwpnumberingoverride.cxx
+++ b/lotuswordpro/source/filter/lwpnumberingoverride.cxx
@@ -71,6 +71,18 @@ LwpNumberingOverride::LwpNumberingOverride()
m_nPosition = 0;
}
+LwpNumberingOverride::LwpNumberingOverride(LwpNumberingOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_nLevel(rOther.m_nLevel)
+ , m_nPosition(rOther.m_nPosition)
+{
+}
+
+LwpNumberingOverride* LwpNumberingOverride::clone() const
+{
+ return new LwpNumberingOverride(*this);
+}
+
void LwpNumberingOverride::Read(LwpObjectStream *pStrm)
{
if (pStrm->QuickReadBool())
@@ -135,17 +147,6 @@ void LwpNumberingOverride::Override(LwpNumberingOverride* pOther)
}
}
-void LwpNumberingOverride::operator=(const LwpOverride& rOther)
-{
- LwpOverride::operator=(rOther);
-
- const LwpNumberingOverride* pOther =
- static_cast<LwpNumberingOverride*>((LwpOverride*)&rOther);
-
- m_nLevel = pOther->m_nLevel;
- m_nPosition = pOther->m_nPosition;
-}
-
void LwpNumberingOverride::OverrideLevel(sal_uInt16 nNewLv)
{
m_nLevel = nNewLv;
diff --git a/lotuswordpro/source/filter/lwpnumberingoverride.hxx b/lotuswordpro/source/filter/lwpnumberingoverride.hxx
index 4fce3e54152f..010c3d3ec374 100644
--- a/lotuswordpro/source/filter/lwpnumberingoverride.hxx
+++ b/lotuswordpro/source/filter/lwpnumberingoverride.hxx
@@ -74,6 +74,8 @@ public:
LwpNumberingOverride();
virtual ~LwpNumberingOverride(){}
+ virtual LwpNumberingOverride* clone() const;
+
enum
{
NO_LEVEL = 0x0001,
@@ -86,7 +88,6 @@ public:
//add by , 02/03/2005
void Override(LwpNumberingOverride* pOther);
- void operator=(const LwpOverride& rOther);
inline sal_uInt16 GetLevel() const;
inline sal_uInt16 GetPosition() const;
@@ -108,6 +109,13 @@ public:
inline void RevertHeading();
inline void RevertSmartLevel();
//end add
+
+protected:
+ LwpNumberingOverride(LwpNumberingOverride const& rOther);
+
+private:
+ LwpNumberingOverride& operator=(LwpNumberingOverride const& rOther); // not implemented
+
private:
sal_uInt16 m_nLevel;
sal_uInt16 m_nPosition;
diff --git a/lotuswordpro/source/filter/lwpoverride.cxx b/lotuswordpro/source/filter/lwpoverride.cxx
index b2baedfa3bc9..42e0b5d5599e 100644
--- a/lotuswordpro/source/filter/lwpoverride.cxx
+++ b/lotuswordpro/source/filter/lwpoverride.cxx
@@ -62,6 +62,8 @@
Jan 2005 Created
************************************************************************/
+#include <memory>
+
#include "lwpoverride.hxx"
#include "lwpfilehdr.hxx"
#include "lwpatomholder.hxx"
@@ -70,6 +72,13 @@
#include "lwpbackgroundstuff.hxx"
/*class LwpOverride*/
+LwpOverride::LwpOverride(LwpOverride const& rOther)
+ : m_nValues(rOther.m_nValues)
+ , m_nOverride(rOther.m_nOverride)
+ , m_nApply(rOther.m_nApply)
+{
+}
+
void LwpOverride::ReadCommon(LwpObjectStream* pStrm)
{
pStrm->QuickRead(&m_nValues, 2);
@@ -85,13 +94,6 @@ void LwpOverride::Clear()
m_nApply = 0;
}
-void LwpOverride::operator=(const LwpOverride& rOther)
-{
- m_nValues = rOther.m_nValues;
- m_nOverride = rOther.m_nOverride;
- m_nApply = rOther.m_nApply;
-}
-
void LwpOverride::Override(sal_uInt16 nBits, STATE eState)
{
if (eState == STATE_STYLE)
@@ -115,6 +117,17 @@ void LwpOverride::Override(sal_uInt16 nBits, STATE eState)
}
/*class LwpTextLanguageOverride*/
+LwpTextLanguageOverride::LwpTextLanguageOverride(LwpTextLanguageOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_nLanguage(rOther.m_nLanguage)
+{
+}
+
+LwpTextLanguageOverride* LwpTextLanguageOverride::clone() const
+{
+ return new LwpTextLanguageOverride(*this);
+}
+
void LwpTextLanguageOverride::Read(LwpObjectStream* pStrm)
{
if (pStrm->QuickReadBool())
@@ -128,6 +141,18 @@ void LwpTextLanguageOverride::Read(LwpObjectStream* pStrm)
}
/*class LwpTextAttributeOverride*/
+LwpTextAttributeOverride::LwpTextAttributeOverride(LwpTextAttributeOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_nHideLevels(rOther.m_nHideLevels)
+ , m_nBaseLineOffset(rOther.m_nBaseLineOffset)
+{
+}
+
+LwpTextAttributeOverride* LwpTextAttributeOverride::clone() const
+{
+ return new LwpTextAttributeOverride(*this);
+}
+
void LwpTextAttributeOverride::Read(LwpObjectStream* pStrm)
{
if (pStrm->QuickReadBool())
@@ -150,6 +175,17 @@ sal_Bool LwpTextAttributeOverride::IsHighLight()
}
/*class LwpKinsokuOptsOverride*/
+LwpKinsokuOptsOverride::LwpKinsokuOptsOverride(LwpKinsokuOptsOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_nLevels(rOther.m_nLevels)
+{
+}
+
+LwpKinsokuOptsOverride* LwpKinsokuOptsOverride::clone() const
+{
+ return new LwpKinsokuOptsOverride(*this);
+}
+
void LwpKinsokuOptsOverride::Read(LwpObjectStream* pStrm)
{
if (pStrm->QuickReadBool())
@@ -162,6 +198,18 @@ void LwpKinsokuOptsOverride::Read(LwpObjectStream* pStrm)
}
/*class LwpBulletOverride*/
+LwpBulletOverride::LwpBulletOverride(LwpBulletOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_SilverBullet(rOther.m_SilverBullet)
+ , m_bIsNull(rOther.m_bIsNull)
+{
+}
+
+LwpBulletOverride* LwpBulletOverride::clone() const
+{
+ return new LwpBulletOverride(*this);
+}
+
void LwpBulletOverride::Read(LwpObjectStream * pStrm)
{
if (pStrm->QuickReadBool())
@@ -199,15 +247,6 @@ void LwpBulletOverride::OverrideRightAligned(sal_Bool bOver)
}
}
-void LwpBulletOverride::operator=(const LwpOverride& rOther)
-{
- LwpOverride::operator=(rOther);
- const LwpBulletOverride* pBullet = static_cast<LwpBulletOverride*>((LwpOverride*)&rOther);
-
- m_SilverBullet = pBullet->m_SilverBullet;
-
-}
-
void LwpBulletOverride::OverrideSilverBullet(LwpObjectID aID)
{
if (!aID.IsNull())
@@ -259,6 +298,19 @@ void LwpBulletOverride::Override(LwpBulletOverride* pOther)
}
/*class LwpAlignmentOverride*/
+LwpAlignmentOverride::LwpAlignmentOverride(LwpAlignmentOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_nAlignType(rOther.m_nAlignType)
+ , m_nPosition(rOther.m_nPosition)
+ , m_nAlignChar(rOther.m_nAlignChar)
+{
+}
+
+LwpAlignmentOverride* LwpAlignmentOverride::clone() const
+{
+ return new LwpAlignmentOverride(*this);
+}
+
void LwpAlignmentOverride::Read(LwpObjectStream * pStrm)
{
if (pStrm->QuickReadBool())
@@ -273,6 +325,19 @@ void LwpAlignmentOverride::Read(LwpObjectStream * pStrm)
}
/*class LwpSpacingCommonOverride*/
+LwpSpacingCommonOverride::LwpSpacingCommonOverride(LwpSpacingCommonOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_nSpacingType(rOther.m_nSpacingType)
+ , m_nAmount(rOther.m_nAmount)
+ , m_nMultiple(rOther.m_nMultiple)
+{
+}
+
+LwpSpacingCommonOverride* LwpSpacingCommonOverride::clone() const
+{
+ return new LwpSpacingCommonOverride(*this);
+}
+
void LwpSpacingCommonOverride::Read(LwpObjectStream* pStrm)
{
if (pStrm->QuickReadBool())
@@ -295,16 +360,6 @@ m_pParaSpacingBelow(new LwpSpacingCommonOverride)
{
}
-LwpSpacingOverride& LwpSpacingOverride::operator=(LwpSpacingOverride& other)
-{
- LwpOverride::operator=(other);
- *m_pSpacing = *other.m_pSpacing;
- *m_pAboveLineSpacing = *other.m_pAboveLineSpacing;
- *m_pParaSpacingAbove = *other.m_pParaSpacingAbove;
- *m_pParaSpacingAbove = *other.m_pParaSpacingAbove;
- return *this;
-}
-
LwpSpacingOverride::~LwpSpacingOverride()
{
if (m_pSpacing)
@@ -325,6 +380,28 @@ LwpSpacingOverride::~LwpSpacingOverride()
}
}
+LwpSpacingOverride::LwpSpacingOverride(LwpSpacingOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_pSpacing(0)
+ , m_pAboveLineSpacing(0)
+ , m_pParaSpacingAbove(0)
+ , m_pParaSpacingBelow(0)
+{
+ std::auto_ptr<LwpSpacingCommonOverride> pSpacing(rOther.m_pSpacing->clone());
+ std::auto_ptr<LwpSpacingCommonOverride> pAboveLineSpacing(rOther.m_pAboveLineSpacing->clone());
+ std::auto_ptr<LwpSpacingCommonOverride> pParaSpacingAbove(rOther.m_pParaSpacingAbove->clone());
+ std::auto_ptr<LwpSpacingCommonOverride> pParaSpacingBelow(rOther.m_pParaSpacingBelow->clone());
+ m_pSpacing = pSpacing.release();
+ m_pAboveLineSpacing = pAboveLineSpacing.release();
+ m_pParaSpacingAbove = pParaSpacingAbove.release();
+ m_pParaSpacingBelow = pParaSpacingBelow.release();
+}
+
+LwpSpacingOverride* LwpSpacingOverride::clone() const
+{
+ return new LwpSpacingOverride(*this);
+}
+
void LwpSpacingOverride::Read(LwpObjectStream* pStrm)
{
if (pStrm->QuickReadBool())
@@ -343,6 +420,20 @@ void LwpSpacingOverride::Read(LwpObjectStream* pStrm)
}
/*class LwpIndentOverride*/
+LwpIndentOverride::LwpIndentOverride(LwpIndentOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_nAll(rOther.m_nAll)
+ , m_nFirst(rOther.m_nFirst)
+ , m_nRest(rOther.m_nRest)
+ , m_nRight(rOther.m_nRight)
+{
+}
+
+LwpIndentOverride* LwpIndentOverride::clone() const
+{
+ return new LwpIndentOverride(*this);
+}
+
void LwpIndentOverride::Read(LwpObjectStream* pStrm)
{
if (pStrm->QuickReadBool())
@@ -373,6 +464,21 @@ LwpAmikakeOverride::~LwpAmikakeOverride()
}
}
+LwpAmikakeOverride::LwpAmikakeOverride(LwpAmikakeOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_pBackgroundStuff(0)
+ , m_nType(rOther.m_nType)
+{
+ std::auto_ptr<LwpBackgroundStuff> pBackgroundStuff(
+ new LwpBackgroundStuff(*rOther.m_pBackgroundStuff));
+ m_pBackgroundStuff = pBackgroundStuff.release();
+}
+
+LwpAmikakeOverride* LwpAmikakeOverride::clone() const
+{
+ return new LwpAmikakeOverride(*this);
+}
+
void LwpAmikakeOverride::Read(LwpObjectStream* pStrm)
{
if (pStrm->QuickReadBool())
@@ -419,16 +525,6 @@ void LwpAlignmentOverride::OverrideAlignment(AlignType val)//add by 1-24
m_nOverride |= AO_TYPE;
}
-LwpIndentOverride& LwpIndentOverride::operator=(LwpIndentOverride& other)
-{
- LwpOverride::operator=(other);
- m_nAll = other.m_nAll;
- m_nFirst = other.m_nFirst;
- m_nRest = other.m_nRest;
- m_nRight = other.m_nRight;
- return *this;
-}
-
void LwpIndentOverride::Override(LwpIndentOverride* other)
{
if(m_nOverride & IO_ALL)
diff --git a/lotuswordpro/source/filter/lwpoverride.hxx b/lotuswordpro/source/filter/lwpoverride.hxx
index ea61007c8132..e5c88168e85f 100644
--- a/lotuswordpro/source/filter/lwpoverride.hxx
+++ b/lotuswordpro/source/filter/lwpoverride.hxx
@@ -84,9 +84,9 @@ public:
virtual ~LwpOverride(){}
- virtual void Read(LwpObjectStream* pStrm) = 0;
+ virtual LwpOverride* clone() const = 0;
- virtual void operator=(const LwpOverride& rOther);
+ virtual void Read(LwpObjectStream* pStrm) = 0;
void ReadCommon(LwpObjectStream* pStrm);
@@ -95,6 +95,12 @@ public:
void Override(sal_uInt16 nBits, STATE eState);
protected:
+ LwpOverride(LwpOverride const& rOther);
+
+private:
+ LwpOverride& operator=(LwpOverride const& rOther); // not implemented
+
+protected:
sal_uInt16 m_nValues;
sal_uInt16 m_nOverride;
sal_uInt16 m_nApply;
@@ -106,8 +112,16 @@ class LwpTextLanguageOverride : public LwpOverride
public:
LwpTextLanguageOverride() : m_nLanguage(0) {}
+ virtual LwpTextLanguageOverride* clone() const;
+
void Read(LwpObjectStream* pStrm);
+protected:
+ LwpTextLanguageOverride(LwpTextLanguageOverride const& rOther);
+
+private:
+ LwpTextLanguageOverride& operator=(LwpTextLanguageOverride const& rOther); // not implemented
+
private:
sal_uInt16 m_nLanguage;
};
@@ -118,12 +132,20 @@ class LwpTextAttributeOverride : public LwpOverride
public:
LwpTextAttributeOverride() : m_nHideLevels(0), m_nBaseLineOffset(0) {}
+ virtual LwpTextAttributeOverride* clone() const;
+
void Read(LwpObjectStream* pStrm);
inline sal_uInt16 GetHideLevels() const;
sal_Bool IsHighLight();
+protected:
+ LwpTextAttributeOverride(LwpTextAttributeOverride const& rOther);
+
+private:
+ LwpTextAttributeOverride& operator=(LwpTextAttributeOverride const& rOther); // not implemented
+
private:
enum{
TAO_HIGHLIGHT = 0x08,
@@ -142,8 +164,16 @@ class LwpKinsokuOptsOverride : public LwpOverride
public:
LwpKinsokuOptsOverride() : m_nLevels(0) {}
+ virtual LwpKinsokuOptsOverride* clone() const;
+
void Read(LwpObjectStream* pStrm);
+protected:
+ LwpKinsokuOptsOverride(LwpKinsokuOptsOverride const& rOther);
+
+private:
+ LwpKinsokuOptsOverride& operator=(LwpKinsokuOptsOverride const& rOther); // not implemented
+
private:
sal_uInt16 m_nLevels;
};
@@ -154,12 +184,12 @@ class LwpBulletOverride : public LwpOverride
public:
LwpBulletOverride() {m_bIsNull = sal_True;}
+ virtual LwpBulletOverride* clone() const;
+
void Read(LwpObjectStream* pStrm);
inline LwpObjectID GetSilverBullet() const;
- void operator=(const LwpOverride& rOther);
-
void Override(LwpBulletOverride* pOther);
inline sal_Bool IsSilverBulletOverridden();
@@ -179,6 +209,13 @@ public:
inline void RevertRightAligned();
sal_Bool IsInValid(){return m_bIsNull;}
+
+protected:
+ LwpBulletOverride(LwpBulletOverride const& rOther);
+
+private:
+ LwpBulletOverride& operator=(LwpBulletOverride const& rOther); // not implemented
+
private:
enum
{
@@ -192,6 +229,7 @@ private:
LwpObjectID m_SilverBullet;
sal_Bool m_bIsNull;
};
+
inline LwpObjectID LwpBulletOverride::GetSilverBullet() const
{
return m_SilverBullet;
@@ -248,6 +286,8 @@ class LwpAlignmentOverride : public LwpOverride
public:
LwpAlignmentOverride() : m_nAlignType(ALIGN_LEFT), m_nPosition(0), m_nAlignChar(0){}
+ virtual LwpAlignmentOverride* clone() const;
+
void Read(LwpObjectStream* pStrm);
enum AlignType
@@ -265,6 +305,13 @@ public:
AlignType GetAlignType(){ return m_nAlignType; }
void Override(LwpAlignmentOverride* other);//add by 1-24
void OverrideAlignment(AlignType val);//add by 1-24
+
+protected:
+ LwpAlignmentOverride(LwpAlignmentOverride const& rOther);
+
+private:
+ LwpAlignmentOverride& operator=(LwpAlignmentOverride const& rOther); // not implemented
+
private:
enum
{
@@ -284,6 +331,8 @@ class LwpSpacingCommonOverride : public LwpOverride
public:
LwpSpacingCommonOverride() : m_nSpacingType(SPACING_NONE), m_nAmount(0), m_nMultiple(65536){}
+ virtual LwpSpacingCommonOverride* clone() const;
+
void Read(LwpObjectStream* pStrm);
enum SpacingType
@@ -304,6 +353,12 @@ public:
void OverrideMultiple(sal_Int32 val);
protected:
+ LwpSpacingCommonOverride(LwpSpacingCommonOverride const& rOther);
+
+private:
+ LwpSpacingCommonOverride& operator=(LwpSpacingCommonOverride const& rOther); // not implemented
+
+protected:
enum
{
SPO_TYPE = 0x01,
@@ -313,7 +368,6 @@ protected:
SpacingType m_nSpacingType;//sal_uInt16
sal_Int32 m_nAmount;
sal_Int32 m_nMultiple;
-
};
/////////////////////////////////////////////////////////////////
@@ -321,9 +375,10 @@ class LwpSpacingOverride : public LwpOverride
{
public:
LwpSpacingOverride();
- LwpSpacingOverride& operator=(LwpSpacingOverride& other);
virtual ~LwpSpacingOverride();
+ virtual LwpSpacingOverride* clone() const;
+
void Read(LwpObjectStream* pStrm);
void Override(LwpSpacingOverride* other);
@@ -332,6 +387,13 @@ public:
LwpSpacingCommonOverride* GetAboveLineSpacing(){return m_pAboveLineSpacing;}
LwpSpacingCommonOverride* GetAboveSpacing(){return m_pParaSpacingAbove;}
LwpSpacingCommonOverride* GetBelowSpacing(){return m_pParaSpacingBelow;}
+
+protected:
+ LwpSpacingOverride(LwpSpacingOverride const& rOther);
+
+private:
+ LwpSpacingOverride& operator=(LwpSpacingOverride const& rOther); // not implemented
+
private:
LwpSpacingCommonOverride* m_pSpacing;
LwpSpacingCommonOverride* m_pAboveLineSpacing;
@@ -344,7 +406,9 @@ class LwpIndentOverride : public LwpOverride
{
public:
LwpIndentOverride() : m_nAll(0), m_nFirst(0), m_nRest(0), m_nRight(0) {}
- LwpIndentOverride& operator=(LwpIndentOverride& other);
+
+ virtual LwpIndentOverride* clone() const;
+
void Read(LwpObjectStream* pStrm);
enum
@@ -373,6 +437,13 @@ public:
void SetMFirst(sal_Int32 val){m_nFirst=val;}
void SetMRest(sal_Int32 val){m_nRest=val;}
void SetMRight(sal_Int32 val){m_nRight=val;}
+
+protected:
+ LwpIndentOverride(LwpIndentOverride const& rOther);
+
+private:
+ LwpIndentOverride& operator=(LwpIndentOverride const& rOther); // not implemented
+
private:
enum
{
@@ -400,6 +471,7 @@ private:
sal_Int32 m_nRest;
sal_Int32 m_nRight;
};
+
inline double LwpIndentOverride::GetFirst() const
{
return LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(m_nFirst-m_nRest));
@@ -422,6 +494,8 @@ public:
virtual ~LwpAmikakeOverride();
+ virtual LwpAmikakeOverride* clone() const;
+
void Read(LwpObjectStream* pStrm);
enum
{
@@ -430,6 +504,12 @@ public:
AMIKAKE_CHARACTER = 2
};
+protected:
+ LwpAmikakeOverride(LwpAmikakeOverride const& rOther);
+
+private:
+ LwpAmikakeOverride& operator=(LwpAmikakeOverride const& rOther); // not implemented
+
private:
LwpBackgroundStuff* m_pBackgroundStuff;
sal_uInt16 m_nType;
diff --git a/lotuswordpro/source/filter/lwppara.cxx b/lotuswordpro/source/filter/lwppara.cxx
index 0439c91e31c4..f65b71fbe6f6 100644
--- a/lotuswordpro/source/filter/lwppara.cxx
+++ b/lotuswordpro/source/filter/lwppara.cxx
@@ -369,11 +369,10 @@ void LwpPara::RegisterStyle()
if (GetParaStyle()->GetIndent())
{
- m_pIndentOverride = new LwpIndentOverride;
- *m_pIndentOverride = *(GetParaStyle()->GetIndent()); //add by 2-6,for indent hierachy
+ std::auto_ptr<LwpIndentOverride> pIndentOverride(GetParaStyle()->GetIndent()->clone());
+ delete m_pIndentOverride;
+ m_pIndentOverride = pIndentOverride.release();
}
-// else
-// m_pIndentOverride = NULL;
XFParaStyle* pOverStyle = NULL;
sal_Bool noSpacing = sal_True;
@@ -395,13 +394,15 @@ void LwpPara::RegisterStyle()
{
case PP_LOCAL_ALIGN:
{
- LwpAlignmentOverride aAlign;
if (!pParaStyle->GetAlignment())
OverrideAlignment(NULL,static_cast<LwpParaAlignProperty*>(pProps)->GetAlignment(),pOverStyle);
else
{
- aAlign = *(pParaStyle->GetAlignment());
- OverrideAlignment(&aAlign,static_cast<LwpParaAlignProperty*>(pProps)->GetAlignment(),pOverStyle);
+ boost::scoped_ptr<LwpAlignmentOverride> const pAlign(
+ pParaStyle->GetAlignment()->clone());
+ OverrideAlignment(pAlign.get(),
+ static_cast<LwpParaAlignProperty*>(pProps)->GetAlignment(),
+ pOverStyle);
}
}
break;
@@ -419,14 +420,16 @@ void LwpPara::RegisterStyle()
break;
case PP_LOCAL_SPACING:
{
- LwpSpacingOverride aSpacing;
noSpacing = sal_False;
if (!pParaStyle->GetSpacing())
OverrideSpacing(NULL,static_cast<LwpParaSpacingProperty*>(pProps)->GetSpacing(),pOverStyle);
else
{
- aSpacing = *(pParaStyle->GetSpacing());
- OverrideSpacing(&aSpacing,static_cast<LwpParaSpacingProperty*>(pProps)->GetSpacing(),pOverStyle);
+ boost::scoped_ptr<LwpSpacingOverride> const
+ pSpacing(pParaStyle->GetSpacing()->clone());
+ OverrideSpacing(pSpacing.get(),
+ static_cast<LwpParaSpacingProperty*>(pProps)->GetSpacing(),
+ pOverStyle);
}
}
break;
@@ -737,13 +740,13 @@ void LwpPara::RegisterStyle()
LwpStory* pMyStory = this->GetStory();
if (pMyStory)
{
- if (pMyStory->IsBullStyleUsedBefore(m_aBulletStyleName, m_aParaNumbering.GetPosition()))
+ if (pMyStory->IsBullStyleUsedBefore(m_aBulletStyleName, m_pParaNumbering->GetPosition()))
{
//m_bBullContinue = sal_True;
}
else
{
- pMyStory->AddBullStyleName2List(m_aBulletStyleName, m_aParaNumbering.GetPosition());
+ pMyStory->AddBullStyleName2List(m_aBulletStyleName, m_pParaNumbering->GetPosition());
}
}
@@ -965,8 +968,7 @@ XFContentContainer* LwpPara::AddBulletList(XFContentContainer* pCont)
}
if (m_pSilverBullet->HasName())
{
-// nLevel = m_pParaNumbering->GetPosition();
- nLevel = m_aParaNumbering.GetPosition();
+ nLevel = m_pParaNumbering->GetPosition();
m_nLevel = nLevel;//add by ,for get para level
// m_aBulletStyleName = m_pSilverBullet->GetBulletStyleName();
}
@@ -977,7 +979,7 @@ XFContentContainer* LwpPara::AddBulletList(XFContentContainer* pCont)
LwpNumberingOverride* LwpPara::GetParaNumbering()
{
- return &m_aParaNumbering;
+ return m_pParaNumbering.get();
}
void LwpForked3NotifyList::Read(LwpObjectStream* pObjStrm)
diff --git a/lotuswordpro/source/filter/lwppara.hxx b/lotuswordpro/source/filter/lwppara.hxx
index bd46a8857ded..fcda32e62b4b 100644
--- a/lotuswordpro/source/filter/lwppara.hxx
+++ b/lotuswordpro/source/filter/lwppara.hxx
@@ -65,6 +65,9 @@
#ifndef _LWPPARAGRAPH_HXX_
#define _LWPPARAGRAPH_HXX_
+
+#include <boost/scoped_ptr.hpp>
+
#include "lwpfribheader.hxx"
#include "lwpobj.hxx"
#include "lwpobjstrm.hxx"
@@ -243,8 +246,7 @@ protected:
LwpObjectID m_aSilverBulletID;
LwpSilverBullet* m_pSilverBullet;
LwpBulletOverride* m_pBullOver;
-// LwpNumberingOverride* m_pParaNumbering;
- LwpNumberingOverride m_aParaNumbering;
+ boost::scoped_ptr<LwpNumberingOverride> m_pParaNumbering;
rtl::OUString m_aBulletStyleName;
sal_Bool m_bBullContinue;
//end add
diff --git a/lotuswordpro/source/filter/lwppara1.cxx b/lotuswordpro/source/filter/lwppara1.cxx
index 6cf899e74082..5be69ec7e0a5 100644
--- a/lotuswordpro/source/filter/lwppara1.cxx
+++ b/lotuswordpro/source/filter/lwppara1.cxx
@@ -62,6 +62,10 @@
Jan 2005 Created
************************************************************************/
+#include <memory>
+
+#include <boost/cast.hpp>
+
#include "lwppara.hxx"
#include "lwpglobalmgr.hxx"
#include "lwpfilehdr.hxx"
@@ -100,6 +104,14 @@
#include "lwpdropcapmgr.hxx"
#include "lwptable.hxx"
#include "lwpcelllayout.hxx"
+
+// for the check in boost::polymorphic_downcast
+#if OSL_DEBUG_LEVEL > 0 && !defined(NDEBUG)
+# define NDEBUG 1
+#endif
+
+using boost::polymorphic_downcast;
+
/**
* @short get text of paragraph
*/
@@ -340,22 +352,22 @@ void LwpPara::OverrideParaBorder(LwpParaProperty* pProps, XFParaStyle* pOverStyl
}
LwpOverride* pBorder = pParaStyle->GetParaBorder();
- LwpParaBorderOverride aFinalBorder;
- if (pBorder)
- {
- aFinalBorder = *pBorder;
- }
+ std::auto_ptr<LwpParaBorderOverride> pFinalBorder(
+ pBorder
+ ? polymorphic_downcast<LwpParaBorderOverride*>(pBorder->clone())
+ : new LwpParaBorderOverride)
+ ;
// get local border
pBorder = static_cast<LwpParaBorderProperty*>(pProps)->GetLocalParaBorder();
if (pBorder)
{
- LwpParaBorderOverride aLocalBorder;
- aLocalBorder = *pBorder;
- aLocalBorder.Override(&aFinalBorder);
+ boost::scoped_ptr<LwpParaBorderOverride> pLocalBorder(
+ polymorphic_downcast<LwpParaBorderOverride*>(pBorder->clone()));
+ pLocalBorder->Override(pFinalBorder.get());
}
- pParaStyle->ApplyParaBorder(pOverStyle, &aFinalBorder);
+ pParaStyle->ApplyParaBorder(pOverStyle, pFinalBorder.release());
}
/**
* @short: Override parabreaks style.
@@ -372,23 +384,24 @@ void LwpPara::OverrideParaBreaks(LwpParaProperty* pProps, XFParaStyle* pOverStyl
}
LwpOverride* pBreaks = pParaStyle->GetBreaks();
- LwpBreaksOverride* pFinalBreaks = new LwpBreaksOverride();
- if (pBreaks)
- {
- *pFinalBreaks = *pBreaks;
- }
+ std::auto_ptr<LwpBreaksOverride> pFinalBreaks(
+ pBreaks
+ ? polymorphic_downcast<LwpBreaksOverride*>(pBreaks->clone())
+ : new LwpBreaksOverride)
+ ;
// get local breaks
pBreaks = static_cast<LwpParaBreaksProperty*>(pProps)->GetLocalParaBreaks();
if (pBreaks)
{
- LwpBreaksOverride aLocalBreaks;
- aLocalBreaks = *pBreaks;
- aLocalBreaks.Override(pFinalBreaks);
+ boost::scoped_ptr<LwpBreaksOverride> const pLocalBreaks(
+ polymorphic_downcast<LwpBreaksOverride*>(pBreaks->clone()));
+ pLocalBreaks->Override(pFinalBreaks.get());
}
// save the breaks
- m_pBreaks = pFinalBreaks;
+ delete m_pBreaks;
+ m_pBreaks = pFinalBreaks.release();
//add by 1/31
XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
@@ -458,18 +471,18 @@ void LwpPara::OverrideParaBullet(LwpParaProperty* pProps)
m_bHasBullet = sal_True;
LwpOverride* pBullet= pParaStyle->GetBulletOverride();
- LwpBulletOverride aFinalBullet;
- if (pBullet)
- {
- aFinalBullet = *pBullet;
- }
-
- LwpBulletOverride aLocalBullet;
- aLocalBullet = *pLocalBullet;
- aLocalBullet.Override(&aFinalBullet);
-
- *m_pBullOver = aFinalBullet;
- aSilverBulletID = aFinalBullet.GetSilverBullet();
+ std::auto_ptr<LwpBulletOverride> pFinalBullet(
+ pBullet
+ ? polymorphic_downcast<LwpBulletOverride*>(pBullet->clone())
+ : new LwpBulletOverride)
+ ;
+
+ boost::scoped_ptr<LwpBulletOverride> const pLocalBullet2(pLocalBullet->clone());
+ pLocalBullet2->Override(pFinalBullet.get());
+
+ aSilverBulletID = pFinalBullet->GetSilverBullet();
+ delete m_pBullOver;
+ m_pBullOver = pFinalBullet.release();
if (!aSilverBulletID.IsNull())
{
m_pSilverBullet = static_cast<LwpSilverBullet*>(aSilverBulletID.obj(VO_SILVERBULLET));
@@ -494,8 +507,9 @@ void LwpPara::OverrideParaBullet(LwpParaProperty* pProps)
m_pSilverBullet->SetFoundry(m_pFoundry);
}
- m_pBullOver = new LwpBulletOverride();
- *m_pBullOver = *pBullOver;
+ std::auto_ptr<LwpBulletOverride> pBulletOverride(pBullOver->clone());
+ delete m_pBullOver;
+ m_pBullOver = pBulletOverride.release();
}
}
}
@@ -513,31 +527,30 @@ void LwpPara::OverrideParaNumbering(LwpParaProperty* pProps)
}
LwpNumberingOverride* pParaNumbering = pParaStyle->GetNumberingOverride();
- LwpNumberingOverride aOver;
+ std::auto_ptr<LwpNumberingOverride> pOver(new LwpNumberingOverride);
//Override with the local numbering, if any
if (pProps)
{
LwpNumberingOverride* pPropNumbering = static_cast<LwpParaNumberingProperty*>(pProps)->GetLocalNumbering();
if (pPropNumbering)
{
- aOver = *pPropNumbering;
+ pOver.reset(pPropNumbering->clone());
}
}
else
{
if (pParaNumbering)
{
- aOver = *pParaNumbering;
+ pOver.reset(pParaNumbering->clone());
}
}
if (m_nFlags & VALID_LEVEL)
{
- aOver.OverrideLevel(m_nLevel);
+ pOver->OverrideLevel(m_nLevel);
}
- m_aParaNumbering = aOver;
-
+ m_pParaNumbering.reset(pOver.release());
}
/**************************************************************************
diff --git a/lotuswordpro/source/filter/lwpparaborderoverride.cxx b/lotuswordpro/source/filter/lwpparaborderoverride.cxx
index df2f396712c5..51b831f6fe37 100644
--- a/lotuswordpro/source/filter/lwpparaborderoverride.cxx
+++ b/lotuswordpro/source/filter/lwpparaborderoverride.cxx
@@ -61,6 +61,9 @@
* Change History
* 2005-01-11 create and implement.
************************************************************************/
+
+#include <memory>
+
#include "lwpparaborderoverride.hxx"
#include "lwpborderstuff.hxx"
#include "lwpshadow.hxx"
@@ -86,6 +89,32 @@ LwpParaBorderOverride::LwpParaBorderOverride()
m_nBetweenMargin = 0;
}
+LwpParaBorderOverride::LwpParaBorderOverride(LwpParaBorderOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_pBorderStuff(0)
+ , m_pBetweenStuff(0)
+ , m_pShadow(0)
+ , m_pMargins(0)
+ , m_eAboveType(rOther.m_eAboveType)
+ , m_eBelowType(rOther.m_eBelowType)
+ , m_eRightType(rOther.m_eRightType)
+ , m_eBetweenType(rOther.m_eBetweenType)
+ , m_nAboveWidth(rOther.m_nAboveWidth)
+ , m_nBelowWidth(rOther.m_nBelowWidth)
+ , m_nBetweenWidth(rOther.m_nBetweenWidth)
+ , m_nRightWidth(rOther.m_nRightWidth)
+ , m_nBetweenMargin(rOther.m_nBetweenMargin)
+{
+ std::auto_ptr<LwpBorderStuff> pBorderStuff(new LwpBorderStuff(*rOther.m_pBorderStuff));
+ std::auto_ptr<LwpBorderStuff> pBetweenStuff(new LwpBorderStuff(*rOther.m_pBetweenStuff));
+ std::auto_ptr<LwpShadow> pShadow(new LwpShadow(*rOther.m_pShadow));
+ std::auto_ptr<LwpMargins> pMargins(new LwpMargins(*rOther.m_pMargins));
+ m_pBorderStuff = pBorderStuff.release();
+ m_pBetweenStuff = pBetweenStuff.release();
+ m_pShadow = pShadow.release();
+ m_pMargins = pMargins.release();
+}
+
LwpParaBorderOverride::~LwpParaBorderOverride()
{
if( m_pBorderStuff )
@@ -98,6 +127,11 @@ LwpParaBorderOverride::~LwpParaBorderOverride()
delete m_pMargins;
}
+LwpParaBorderOverride* LwpParaBorderOverride::clone() const
+{
+ return new LwpParaBorderOverride(*this);
+}
+
void LwpParaBorderOverride::Read(LwpObjectStream *pStrm)
{
if (pStrm->QuickReadBool())
@@ -131,42 +165,6 @@ void LwpParaBorderOverride::Read(LwpObjectStream *pStrm)
pStrm->SkipExtra();
}
-// 01/26/2005
-void LwpParaBorderOverride::operator=(const LwpOverride& rOther)
-{
- LwpOverride::operator=(rOther);
- const LwpParaBorderOverride* pParaBorder = static_cast<LwpParaBorderOverride*>((LwpOverride*)&rOther);
-
- if (pParaBorder->m_pBorderStuff)
- {
- *m_pBorderStuff = *(pParaBorder->m_pBorderStuff);
- }
- if (pParaBorder->m_pBetweenStuff)
- {
- *m_pBetweenStuff = *(pParaBorder->m_pBetweenStuff);
- }
- if (pParaBorder->m_pShadow)
- {
- *m_pShadow = *(pParaBorder->m_pShadow);
- }
- if (pParaBorder->m_pMargins)
- {
- *m_pMargins = *(pParaBorder->m_pMargins);
- }
-
- m_eAboveType = pParaBorder->m_eAboveType;
- m_eBelowType = pParaBorder->m_eBelowType;
- m_eRightType = pParaBorder->m_eRightType;
- m_eBetweenType = pParaBorder->m_eBelowType;
-
- m_nAboveWidth = pParaBorder->m_nAboveWidth;
- m_nBelowWidth = pParaBorder->m_nBelowWidth;
- m_nBetweenWidth = pParaBorder->m_nBetweenWidth;
- m_nRightWidth = pParaBorder->m_nRightWidth;
-
- m_nBetweenMargin = pParaBorder->m_nBetweenMargin;
-}
-
void LwpParaBorderOverride::Override(LwpParaBorderOverride* pOther)
{
if (m_nApply & PBO_STUFF)
diff --git a/lotuswordpro/source/filter/lwpparaborderoverride.hxx b/lotuswordpro/source/filter/lwpparaborderoverride.hxx
index f4b1a5423e74..dc32a5232f2d 100644
--- a/lotuswordpro/source/filter/lwpparaborderoverride.hxx
+++ b/lotuswordpro/source/filter/lwpparaborderoverride.hxx
@@ -76,6 +76,8 @@ public:
LwpParaBorderOverride();
virtual ~LwpParaBorderOverride();
+ virtual LwpParaBorderOverride* clone() const;
+
enum BorderWidthType
{
PB_NONE = 0, /* No border */
@@ -90,9 +92,6 @@ public:
LwpBorderStuff* GetBorderStuff(){ return m_pBorderStuff; }
LwpMargins* GetMargins() { return m_pMargins; };
- //add by , 01/25/2005
- virtual void operator=(const LwpOverride& rOther);
-
void Override(LwpParaBorderOverride* pOther);
inline sal_Bool IsBorderStuffOverridden();
@@ -139,6 +138,13 @@ public:
//end add
friend class LwpParaBorderPiece;
+
+protected:
+ LwpParaBorderOverride(LwpParaBorderOverride const& rOther);
+
+private:
+ LwpParaBorderOverride& operator=(LwpParaBorderOverride const& rOther); // not implemented
+
protected:
enum
{
diff --git a/lotuswordpro/source/filter/lwpparastyle.cxx b/lotuswordpro/source/filter/lwpparastyle.cxx
index 2dbb6248f899..89df3b19440b 100644
--- a/lotuswordpro/source/filter/lwpparastyle.cxx
+++ b/lotuswordpro/source/filter/lwpparastyle.cxx
@@ -62,6 +62,7 @@
Jan 2005 Created
************************************************************************/
+#include <boost/scoped_ptr.hpp>
#include "lwpparastyle.hxx"
#include "lwpfilehdr.hxx"
@@ -178,12 +179,10 @@ void LwpParaStyle::Apply(XFParaStyle *pParaStyle)
{
if (!m_pBulletOverride->IsInValid())//Add by ,for remove bullet indent in named bullet style
{
- LwpIndentOverride* pNewIndent = new LwpIndentOverride;
- *pNewIndent = *pIndent;
+ boost::scoped_ptr<LwpIndentOverride> pNewIndent(pIndent->clone());
pNewIndent->SetMFirst(0);
pNewIndent->SetMRest(0);
- ApplyIndent(NULL,pParaStyle,pNewIndent);
- delete pNewIndent;
+ ApplyIndent(NULL, pParaStyle, pNewIndent.get());
}
else
ApplyIndent(NULL,pParaStyle,pIndent);
@@ -444,13 +443,13 @@ void LwpParaStyle::ApplyIndent(LwpPara* pPara, XFParaStyle* pParaStyle, LwpInden
else
pParentPara = NULL;
- LwpIndentOverride* pTotalIndent = new LwpIndentOverride;
+ std::auto_ptr<LwpIndentOverride> pTotalIndent(new LwpIndentOverride);
if (pIndent->IsUseRelative() && pParentPara)
{
LwpIndentOverride* pParentIndent = pParentPara->GetIndent();
if (!pParentIndent)
return;
- *pTotalIndent = *pIndent;
+ pTotalIndent.reset(pIndent->clone());
//add by ,for bullet only
if (pPara)
@@ -461,7 +460,7 @@ void LwpParaStyle::ApplyIndent(LwpPara* pPara, XFParaStyle* pParaStyle, LwpInden
pTotalIndent->SetMRight(pParentIndent->GetMRight()+ pTotalIndent->GetMRight());
pParaStyle->SetMargins(LwpTools::ConvertToMetric(LwpTools::ConvertFromUnits(
pTotalIndent->GetMAll())), pTotalIndent->GetRight());
- pPara->SetIndent(pTotalIndent);
+ pPara->SetIndent(pTotalIndent.release());
return;
}
}
@@ -479,12 +478,12 @@ void LwpParaStyle::ApplyIndent(LwpPara* pPara, XFParaStyle* pParaStyle, LwpInden
pParaStyle->SetIndent(pTotalIndent->GetFirst());
pParaStyle->SetMargins(pTotalIndent->GetLeft(), pTotalIndent->GetRight());
- pPara->SetIndent(pTotalIndent);
+ pPara->SetIndent(pTotalIndent.release());
}
else
{
- *pTotalIndent = *pIndent;
+ pTotalIndent.reset(pIndent->clone());
//add by
if (pPara)
{
@@ -493,7 +492,7 @@ void LwpParaStyle::ApplyIndent(LwpPara* pPara, XFParaStyle* pParaStyle, LwpInden
// pParaStyle->SetIndent(LwpTools::ConvertFromUnits(pIndent->GetMAll()));
pParaStyle->SetMargins(LwpTools::ConvertToMetric(
LwpTools::ConvertFromUnits(pIndent->GetMAll())), pIndent->GetRight());
- pPara->SetIndent(pTotalIndent);
+ pPara->SetIndent(pTotalIndent.release());
return;
}
}
@@ -503,7 +502,7 @@ void LwpParaStyle::ApplyIndent(LwpPara* pPara, XFParaStyle* pParaStyle, LwpInden
pParaStyle->SetMargins(pIndent->GetLeft(), pIndent->GetRight());
if (pPara)
{
- pPara->SetIndent(pTotalIndent);
+ pPara->SetIndent(pTotalIndent.release());
}
}
}
diff --git a/lotuswordpro/source/filter/lwptaboverride.cxx b/lotuswordpro/source/filter/lwptaboverride.cxx
new file mode 100644
index 000000000000..de863e7e6fdc
--- /dev/null
+++ b/lotuswordpro/source/filter/lwptaboverride.cxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public 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.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ * Red Hat, Inc.
+ * Portions created by the Initial Developer are Copyright (C) 2010 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s): David Tardon <dtardon@redhat.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "lwptaboverride.hxx"
+
+LwpTabOverride::LwpTabOverride(LwpTabOverride const& rOther)
+ : LwpOverride(rOther)
+ , m_aTabRackID(rOther.m_aTabRackID)
+{
+}
+
+LwpTabOverride* LwpTabOverride::clone() const
+{
+ return new LwpTabOverride(*this);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwptaboverride.hxx b/lotuswordpro/source/filter/lwptaboverride.hxx
index 49b4f700a985..dabdf5452cbf 100644
--- a/lotuswordpro/source/filter/lwptaboverride.hxx
+++ b/lotuswordpro/source/filter/lwptaboverride.hxx
@@ -79,6 +79,8 @@ public:
{
}
+ virtual LwpTabOverride* clone() const;
+
virtual void Read(LwpObjectStream *pStrm)
{
if (pStrm->QuickReadBool())
@@ -94,6 +96,13 @@ public:
inline sal_Bool IsTabRackOverridden();
inline void Override(LwpTabOverride* pOther);
inline void OverrideTabRack(LwpObjectID* pTabRackID);
+
+protected:
+ LwpTabOverride(LwpTabOverride const& rOther);
+
+private:
+ LwpTabOverride& operator=(LwpTabOverride const& rOther); // not implemented
+
private:
LwpObjectID m_aTabRackID;
enum
diff --git a/lotuswordpro/source/filter/makefile.mk b/lotuswordpro/source/filter/makefile.mk
index 4271a33a3df0..2a93958c69d1 100644
--- a/lotuswordpro/source/filter/makefile.mk
+++ b/lotuswordpro/source/filter/makefile.mk
@@ -20,6 +20,7 @@ SLOFILES= \
$(SLO)$/utlist.obj \
$(SLO)$/lwp9reader.obj \
$(SLO)$/lwpatomholder.obj \
+ $(SLO)$/lwpbackgroundoverride.obj\
$(SLO)$/lwpbasetype.obj \
$(SLO)$/lwpcolor.obj \
$(SLO)$/lwpcontent.obj \
@@ -64,6 +65,7 @@ SLOFILES= \
$(SLO)$/lwpcharborderoverride.obj \
$(SLO)$/lwpbreaksoverride.obj \
$(SLO)$/lwpbackgroundstuff.obj \
+ $(SLO)$/lwptaboverride.obj \
$(SLO)$/lwptabrack.obj \
$(SLO)$/lwpcharacterstyle.obj \
$(SLO)$/lwpoverride.obj \