[Libreoffice-commits] core.git: 2 commits - lotuswordpro/source

Stephan Bergmann sbergman at redhat.com
Fri Jun 6 07:50:14 PDT 2014


 lotuswordpro/source/filter/lwp9reader.cxx      |    4 
 lotuswordpro/source/filter/lwpcelllayout.cxx   |   34 ++--
 lotuswordpro/source/filter/lwpcontent.hxx      |    2 
 lotuswordpro/source/filter/lwpdivinfo.cxx      |    4 
 lotuswordpro/source/filter/lwpdivinfo.hxx      |    5 
 lotuswordpro/source/filter/lwpdivopts.hxx      |    3 
 lotuswordpro/source/filter/lwpdlvlist.hxx      |    6 
 lotuswordpro/source/filter/lwpdoc.cxx          |  114 +++++++--------
 lotuswordpro/source/filter/lwpdocdata.hxx      |    3 
 lotuswordpro/source/filter/lwpfnlayout.cxx     |   16 +-
 lotuswordpro/source/filter/lwpfootnote.cxx     |    8 -
 lotuswordpro/source/filter/lwpfootnote.hxx     |    3 
 lotuswordpro/source/filter/lwpfoundry.cxx      |   44 ++---
 lotuswordpro/source/filter/lwpframelayout.cxx  |   38 ++---
 lotuswordpro/source/filter/lwpfrib.cxx         |    2 
 lotuswordpro/source/filter/lwpfribbreaks.cxx   |    4 
 lotuswordpro/source/filter/lwpfribframe.cxx    |   20 +-
 lotuswordpro/source/filter/lwpfribframe.hxx    |    2 
 lotuswordpro/source/filter/lwpfribmark.cxx     |    8 -
 lotuswordpro/source/filter/lwpfribptr.cxx      |   16 +-
 lotuswordpro/source/filter/lwpfribsection.cxx  |   22 +-
 lotuswordpro/source/filter/lwpfribtable.cxx    |    2 
 lotuswordpro/source/filter/lwpgrfobj.cxx       |    2 
 lotuswordpro/source/filter/lwpholder.hxx       |   12 +
 lotuswordpro/source/filter/lwplayout.cxx       |  186 ++++++++++++-------------
 lotuswordpro/source/filter/lwplayout.hxx       |    2 
 lotuswordpro/source/filter/lwplaypiece.hxx     |   33 ++--
 lotuswordpro/source/filter/lwpmarker.cxx       |    4 
 lotuswordpro/source/filter/lwpnotes.cxx        |   18 +-
 lotuswordpro/source/filter/lwpnumericfmt.hxx   |    4 
 lotuswordpro/source/filter/lwpobj.hxx          |    8 -
 lotuswordpro/source/filter/lwpobjfactory.cxx   |   24 ---
 lotuswordpro/source/filter/lwpobjfactory.hxx   |   12 +
 lotuswordpro/source/filter/lwpobjid.cxx        |    8 -
 lotuswordpro/source/filter/lwpobjid.hxx        |    6 
 lotuswordpro/source/filter/lwppagehint.hxx     |    2 
 lotuswordpro/source/filter/lwppagelayout.cxx   |   44 ++---
 lotuswordpro/source/filter/lwppara.cxx         |   10 -
 lotuswordpro/source/filter/lwppara.hxx         |    9 -
 lotuswordpro/source/filter/lwppara1.cxx        |   12 -
 lotuswordpro/source/filter/lwpparaproperty.cxx |   20 +-
 lotuswordpro/source/filter/lwpparaproperty.hxx |    2 
 lotuswordpro/source/filter/lwpparastyle.cxx    |   32 ++--
 lotuswordpro/source/filter/lwppiece.hxx        |   42 ++++-
 lotuswordpro/source/filter/lwpproplist.cxx     |    4 
 lotuswordpro/source/filter/lwpproplist.hxx     |    3 
 lotuswordpro/source/filter/lwprowlayout.cxx    |   16 +-
 lotuswordpro/source/filter/lwprowlayout.hxx    |    2 
 lotuswordpro/source/filter/lwpsection.hxx      |    2 
 lotuswordpro/source/filter/lwpsilverbullet.cxx |    8 -
 lotuswordpro/source/filter/lwpstory.cxx        |   40 ++---
 lotuswordpro/source/filter/lwptable.cxx        |    4 
 lotuswordpro/source/filter/lwptablelayout.cxx  |   52 +++---
 lotuswordpro/source/filter/lwptabrack.cxx      |    2 
 lotuswordpro/source/filter/lwptabrack.hxx      |    3 
 lotuswordpro/source/filter/lwptblcell.cxx      |    2 
 lotuswordpro/source/filter/lwptblcell.hxx      |   23 ++-
 lotuswordpro/source/filter/lwptblformula.cxx   |    2 
 lotuswordpro/source/filter/lwptblformula.hxx   |    3 
 lotuswordpro/source/filter/lwptoc.cxx          |    8 -
 lotuswordpro/source/filter/lwptoc.hxx          |    3 
 lotuswordpro/source/filter/lwpverdocument.hxx  |    3 
 lotuswordpro/source/filter/lwpvpointer.cxx     |    4 
 lotuswordpro/source/filter/lwpvpointer.hxx     |    3 
 lotuswordpro/source/filter/ut.hxx              |    8 -
 65 files changed, 558 insertions(+), 489 deletions(-)

New commits:
commit 37183595bb3b4d58682f90fd9f6713bedcb852a2
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Jun 6 16:49:17 2014 +0200

    Fix memory leaks, by refcounting LwpObject
    
    Change-Id: I1539597cd5bcabcbf0295d1acc320c503ad53604

diff --git a/lotuswordpro/source/filter/lwp9reader.cxx b/lotuswordpro/source/filter/lwp9reader.cxx
index a4ec3e5..fe77bd2 100644
--- a/lotuswordpro/source/filter/lwp9reader.cxx
+++ b/lotuswordpro/source/filter/lwp9reader.cxx
@@ -180,13 +180,13 @@ void Lwp9Reader::ParseDocument()
     WriteDocHeader();
 
     //Get root document
-    LwpDocument* doc = dynamic_cast<LwpDocument*> ( m_LwpFileHdr.GetDocID()->obj() );
+    LwpDocument* doc = dynamic_cast<LwpDocument*> ( m_LwpFileHdr.GetDocID()->obj().get() );
 
     if (!doc)
         return;
 
     //Parse Doc Data
-    LwpDocData *pDocData = dynamic_cast<LwpDocData*>((doc->GetDocData())->obj());
+    LwpDocData *pDocData = dynamic_cast<LwpDocData*>((doc->GetDocData())->obj().get());
     if (pDocData!=NULL)
         pDocData->Parse(m_pStream);
 
diff --git a/lotuswordpro/source/filter/lwpcelllayout.cxx b/lotuswordpro/source/filter/lwpcelllayout.cxx
index 59d3a08..85df93e 100644
--- a/lotuswordpro/source/filter/lwpcelllayout.cxx
+++ b/lotuswordpro/source/filter/lwpcelllayout.cxx
@@ -91,7 +91,7 @@ LwpCellLayout::~LwpCellLayout()
  */
 LwpTableLayout * LwpCellLayout::GetTableLayout()
 {
-    LwpRowLayout * pRow = dynamic_cast<LwpRowLayout *>(GetParent()->obj());
+    LwpRowLayout * pRow = dynamic_cast<LwpRowLayout *>(GetParent()->obj().get());
     if(!pRow)
     {
         return NULL;
@@ -265,14 +265,14 @@ void LwpCellLayout::ApplyBackColor(XFCellStyle *pCellStyle)
  */
 void LwpCellLayout::ApplyFmtStyle(XFCellStyle *pCellStyle)
 {
-    LwpLayoutNumerics* pLayoutNumerics = dynamic_cast<LwpLayoutNumerics*>(cLayNumerics.obj());
+    LwpLayoutNumerics* pLayoutNumerics = dynamic_cast<LwpLayoutNumerics*>(cLayNumerics.obj().get());
     if (!pLayoutNumerics)
     {
         // if current layout doesn't have format, go to based on layout
-        LwpCellLayout* pCellLayout = dynamic_cast<LwpCellLayout*>(m_BasedOnStyle.obj());
+        LwpCellLayout* pCellLayout = dynamic_cast<LwpCellLayout*>(m_BasedOnStyle.obj().get());
         if (pCellLayout)
         {
-            pLayoutNumerics = dynamic_cast<LwpLayoutNumerics*>(pCellLayout->GetNumericsObject()->obj());
+            pLayoutNumerics = dynamic_cast<LwpLayoutNumerics*>(pCellLayout->GetNumericsObject()->obj().get());
         }
     }
 
@@ -314,7 +314,7 @@ XFCell* LwpCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uI
 {
     // if cell layout is aTableID's default cell layout
     // it can't have any content, bypass these code
-    LwpTable * pTable = dynamic_cast<LwpTable *>(aTableID.obj());
+    LwpTable * pTable = dynamic_cast<LwpTable *>(aTableID.obj().get());
     if (!pTable)
     {
         assert(false);
@@ -331,7 +331,7 @@ XFCell* LwpCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uI
     }
 
     // content of cell
-    LwpStory* pStory = dynamic_cast<LwpStory*>(m_Content.obj());
+    LwpStory* pStory = dynamic_cast<LwpStory*>(m_Content.obj().get());
     if (pStory)
     {
         pStory->XFConvert(pXFCell);
@@ -347,8 +347,8 @@ LwpPara* LwpCellLayout::GetLastParaOfPreviousStory()
     LwpObjectID* pPreStoryID = this->GetPreviousCellStory();
     if (pPreStoryID && !(pPreStoryID->IsNull()))
     {
-        LwpStory* pPreStory = dynamic_cast<LwpStory*>(pPreStoryID->obj(VO_STORY));
-        return dynamic_cast<LwpPara*>(pPreStory->GetLastPara()->obj(VO_PARA));
+        LwpStory* pPreStory = dynamic_cast<LwpStory*>(pPreStoryID->obj(VO_STORY).get());
+        return dynamic_cast<LwpPara*>(pPreStory->GetLastPara()->obj(VO_PARA).get());
     }
     else
     {
@@ -571,7 +571,7 @@ void LwpCellLayout::RegisterDefaultCell()
  */
 void LwpCellLayout::RegisterStyle()
 {
-    LwpVirtualLayout * pParent = dynamic_cast<LwpVirtualLayout *>(GetParent()->obj());
+    LwpVirtualLayout * pParent = dynamic_cast<LwpVirtualLayout *>(GetParent()->obj().get());
     if (!pParent || pParent->GetLayoutType() != LWP_ROW_LAYOUT)
     {
         // default cell layout, we must register 4 styles for it
@@ -595,8 +595,8 @@ void LwpCellLayout::RegisterStyle()
     m_StyleName = pXFStyleManager->AddStyle(pCellStyle)->GetStyleName();
 
     // content object register styles
-    LwpObject * pObj = m_Content.obj();
-    if (pObj)
+    rtl::Reference<LwpObject> pObj = m_Content.obj();
+    if (pObj.is())
     {
         pObj->SetFoundry(m_pFoundry);
         pObj->RegisterStyle();
@@ -657,7 +657,7 @@ void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID)
     else
     {
         // judge base on
-        LwpCellLayout * pBase = dynamic_cast<LwpCellLayout *>(m_BasedOnStyle.obj());
+        LwpCellLayout * pBase = dynamic_cast<LwpCellLayout *>(m_BasedOnStyle.obj().get());
         if (pBase && pBase->IsProtected())
         {
             bProtected = true;
@@ -665,7 +665,7 @@ void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID)
         else
         {
             // judge whole table
-            LwpTable * pTable = dynamic_cast<LwpTable *>(aTableID.obj());
+            LwpTable * pTable = dynamic_cast<LwpTable *>(aTableID.obj().get());
             LwpTableLayout * pTableLayout = pTable ? static_cast<LwpTableLayout *>(pTable->GetTableLayout()) : NULL;
             LwpSuperTableLayout * pSuper = pTableLayout ? pTableLayout->GetSuperTableLayout() : NULL;
             if (pSuper && pSuper->IsProtected())
@@ -877,19 +877,19 @@ void LwpHiddenCellLayout::Read()
 
 XFCell* LwpHiddenCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uInt16 nCol)
 {
-    if (!cconnectedlayout.obj())
+    if (!cconnectedlayout.obj().is())
         return NULL;
-    LwpConnectedCellLayout* pConnCell = dynamic_cast<LwpConnectedCellLayout* >(cconnectedlayout.obj());
+    LwpConnectedCellLayout* pConnCell = dynamic_cast<LwpConnectedCellLayout* >(cconnectedlayout.obj().get());
 
     if (!pConnCell || nRow < (pConnCell->GetNumrows()+pConnCell->GetRowID()))
         return NULL;
     // if the hidden cell should be displayed for limit of SODC
     // use the default cell layout
     XFCell* pXFCell = NULL;
-    LwpTable *pTable = dynamic_cast<LwpTable *>(aTableID.obj());
+    LwpTable *pTable = dynamic_cast<LwpTable *>(aTableID.obj().get());
     if (pTable)
     {
-        LwpCellLayout *pDefault = dynamic_cast<LwpCellLayout *>(pTable->GetDefaultCellStyle()->obj());
+        LwpCellLayout *pDefault = dynamic_cast<LwpCellLayout *>(pTable->GetDefaultCellStyle()->obj().get());
         if (pDefault)
         {
             pXFCell = pDefault->ConvertCell(aTableID, nRow, nCol);
diff --git a/lotuswordpro/source/filter/lwpcontent.hxx b/lotuswordpro/source/filter/lwpcontent.hxx
index fae9fcc..70a03da 100644
--- a/lotuswordpro/source/filter/lwpcontent.hxx
+++ b/lotuswordpro/source/filter/lwpcontent.hxx
@@ -141,7 +141,7 @@ inline OUString LwpContent::GetClassName()
 
 inline LwpContent* LwpContent::GetNextEnumerated()
 {
-    return dynamic_cast<LwpContent*>(m_NextEnumerated.obj());
+    return dynamic_cast<LwpContent*>(m_NextEnumerated.obj().get());
 }
 /**
  * @brief
diff --git a/lotuswordpro/source/filter/lwpdivinfo.cxx b/lotuswordpro/source/filter/lwpdivinfo.cxx
index 564309e..5a93497 100644
--- a/lotuswordpro/source/filter/lwpdivinfo.cxx
+++ b/lotuswordpro/source/filter/lwpdivinfo.cxx
@@ -166,10 +166,10 @@ sal_uInt16 LwpDivInfo::GetMaxNumberOfPages()
     LwpDocument* pDiv = GetDivision();
     if(!pDiv)
         return 0;
-    LwpDLVListHeadTailHolder* pHeadTail = static_cast<LwpDLVListHeadTailHolder*>(pDiv->GetPageHintsID()->obj());
+    LwpDLVListHeadTailHolder* pHeadTail = static_cast<LwpDLVListHeadTailHolder*>(pDiv->GetPageHintsID()->obj().get());
     if(pHeadTail)
     {
-        LwpPageHint* pPageHint =static_cast<LwpPageHint*>(pHeadTail->GetTail()->obj());
+        LwpPageHint* pPageHint =static_cast<LwpPageHint*>(pHeadTail->GetTail()->obj().get());
         if(pPageHint && !pPageHint->GetPageLayoutID()->IsNull())
         {
             return pPageHint->GetPageNumber();
diff --git a/lotuswordpro/source/filter/lwpdivinfo.hxx b/lotuswordpro/source/filter/lwpdivinfo.hxx
index a2a094f..b191f15 100644
--- a/lotuswordpro/source/filter/lwpdivinfo.hxx
+++ b/lotuswordpro/source/filter/lwpdivinfo.hxx
@@ -78,7 +78,6 @@ class LwpDivInfo : public LwpObject
 {
 public:
     LwpDivInfo(LwpObjectHeader& objHdr, LwpSvStream* pStrm);
-    virtual ~LwpDivInfo();
     LwpObjectID* GetInitialLayoutID(){ return &m_InitialLayoutID;}
     LwpObjectID* GetFillerPageTextID(){ return &m_FillerPageTextID;}
     // add by  ,03/14/2004
@@ -97,6 +96,8 @@ public:
 protected:
     void Read() SAL_OVERRIDE;
 private:
+    virtual ~LwpDivInfo();
+
     LwpObjectID m_ParentID;
     LwpAtomHolder m_Name;
     LwpObjectID m_LayoutID;
@@ -161,7 +162,7 @@ inline bool LwpDivInfo::IsGotoable()
 
 inline LwpDocument* LwpDivInfo::GetDivision()
 {
-    return dynamic_cast<LwpDocument*>(m_ParentID.obj());
+    return dynamic_cast<LwpDocument*>(m_ParentID.obj().get());
 }
 #endif
 
diff --git a/lotuswordpro/source/filter/lwpdivopts.hxx b/lotuswordpro/source/filter/lwpdivopts.hxx
index 8d0d645..1445aa5 100644
--- a/lotuswordpro/source/filter/lwpdivopts.hxx
+++ b/lotuswordpro/source/filter/lwpdivopts.hxx
@@ -108,10 +108,11 @@ class LwpDivisionOptions : public LwpObject
 {
 public:
     LwpDivisionOptions(LwpObjectHeader& objHdr, LwpSvStream* pStrm);
-    virtual ~LwpDivisionOptions();
 protected:
     void Read() SAL_OVERRIDE;
 private:
+    virtual ~LwpDivisionOptions();
+
     LwpHyphenOptions m_HyphOpts;
     sal_uInt16 m_nOptionFlag;
     LwpTextLanguage m_Lang;
diff --git a/lotuswordpro/source/filter/lwpdlvlist.hxx b/lotuswordpro/source/filter/lwpdlvlist.hxx
index dea314e..6c90a82 100644
--- a/lotuswordpro/source/filter/lwpdlvlist.hxx
+++ b/lotuswordpro/source/filter/lwpdlvlist.hxx
@@ -74,8 +74,9 @@ class LwpDLVList : public LwpObject
 {
 public:
     LwpDLVList(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
-    virtual ~LwpDLVList(){}
 protected:
+    virtual ~LwpDLVList(){}
+
     LwpObjectID m_ListPrevious;
     LwpObjectID m_ListNext;
 protected:
@@ -99,8 +100,9 @@ class LwpDLNFVList : public LwpDLVList
 {
 public:
     LwpDLNFVList(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
-    virtual ~LwpDLNFVList(){}
 protected:
+    virtual ~LwpDLNFVList(){}
+
     LwpObjectID m_ChildHead;
     LwpObjectID m_ChildTail;
     LwpObjectID m_Parent;
diff --git a/lotuswordpro/source/filter/lwpdoc.cxx b/lotuswordpro/source/filter/lwpdoc.cxx
index 3296725..7b42168 100644
--- a/lotuswordpro/source/filter/lwpdoc.cxx
+++ b/lotuswordpro/source/filter/lwpdoc.cxx
@@ -163,8 +163,8 @@ void LwpDocument::Parse(IXFStream* pOutputStream)
         ParseDocContent(pOutputStream);
     }
 
-    LwpObject* pDocSock = GetSocket()->obj( VO_DOCSOCK );
-    if(pDocSock!=NULL)
+    rtl::Reference<LwpObject> pDocSock = GetSocket()->obj( VO_DOCSOCK );
+    if(pDocSock.is())
     {
         pDocSock->Parse(pOutputStream);
     }
@@ -174,7 +174,7 @@ bool LwpDocument::IsSkippedDivision()
 {
     OUString sDivName;
     bool ret = false;
-    LwpDivInfo* pDiv = dynamic_cast<LwpDivInfo*>(GetDivInfoID()->obj(VO_DIVISIONINFO));
+    LwpDivInfo* pDiv = dynamic_cast<LwpDivInfo*>(GetDivInfoID()->obj(VO_DIVISIONINFO).get());
     if (pDiv == NULL)
         return true;
     sDivName = pDiv->GetDivName();
@@ -186,10 +186,10 @@ bool LwpDocument::IsSkippedDivision()
         || (strClassName == STR_DivisionGroupEndnote)
         || (strClassName == STR_DocumentEndnote))
     {
-        LwpPageLayout* pPageLayout = dynamic_cast<LwpPageLayout*>(pDiv->GetInitialLayoutID()->obj(VO_PAGELAYOUT));
+        LwpPageLayout* pPageLayout = dynamic_cast<LwpPageLayout*>(pDiv->GetInitialLayoutID()->obj(VO_PAGELAYOUT).get());
         if(pPageLayout)
         {
-            LwpStory* pStory = dynamic_cast<LwpStory*>(pPageLayout->GetContent()->obj(VO_STORY));
+            LwpStory* pStory = dynamic_cast<LwpStory*>(pPageLayout->GetContent()->obj(VO_STORY).get());
             if(pStory)
             {
                 //This judgement maybe have problem. If there is only one para in the story,
@@ -221,8 +221,8 @@ void LwpDocument::RegisterStyle()
     RegisterFootnoteStyles();
 
     //Register styles in other document connected with this document: next doc, children doc
-    LwpObject* pDocSock = GetSocket()->obj();
-    if(pDocSock!=NULL)
+    rtl::Reference<LwpObject> pDocSock = GetSocket()->obj();
+    if(pDocSock.is())
     {
         pDocSock->RegisterStyle();
     }
@@ -233,15 +233,15 @@ void LwpDocument::RegisterStyle()
 void LwpDocument::RegisterTextStyles()
 {
     //Register all text styles: para styles, character styles
-    LwpDLVListHeadHolder* pParaStyleHolder = dynamic_cast<LwpDLVListHeadHolder*>(m_pFoundry->GetTextStyleHead()->obj());
+    LwpDLVListHeadHolder* pParaStyleHolder = dynamic_cast<LwpDLVListHeadHolder*>(m_pFoundry->GetTextStyleHead()->obj().get());
     if(pParaStyleHolder)
     {
-        LwpTextStyle* pParaStyle = dynamic_cast<LwpTextStyle*> (pParaStyleHolder->GetHeadID()->obj());
+        LwpTextStyle* pParaStyle = dynamic_cast<LwpTextStyle*> (pParaStyleHolder->GetHeadID()->obj().get());
         while(pParaStyle)
         {
             pParaStyle->SetFoundry(m_pFoundry);
             pParaStyle->RegisterStyle();
-            pParaStyle = dynamic_cast<LwpParaStyle*>(pParaStyle->GetNext()->obj());
+            pParaStyle = dynamic_cast<LwpParaStyle*>(pParaStyle->GetNext()->obj().get());
         }
     }
     ChangeStyleName();//add by ,for click here block,05/5/26
@@ -256,15 +256,15 @@ void LwpDocument::RegisterLayoutStyles()
     m_pFoundry->RegisterAllLayouts();
 
     //set initial pagelayout in story for parsing pagelayout
-    LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*> (m_DivInfo.obj( VO_DIVISIONINFO));
+    LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*> (m_DivInfo.obj( VO_DIVISIONINFO).get());
     LwpPageLayout* pPageLayout = NULL;
     if(pDivInfo)
     {
-        pPageLayout = dynamic_cast<LwpPageLayout*>(pDivInfo->GetInitialLayoutID()->obj(VO_PAGELAYOUT));
+        pPageLayout = dynamic_cast<LwpPageLayout*>(pDivInfo->GetInitialLayoutID()->obj(VO_PAGELAYOUT).get());
         if(pPageLayout)
         {
             //In Ole division, the content of pagelayout is VO_OLEOBJECT
-            LwpStory* pStory = dynamic_cast<LwpStory*>(pPageLayout->GetContent()->obj(VO_STORY));
+            LwpStory* pStory = dynamic_cast<LwpStory*>(pPageLayout->GetContent()->obj(VO_STORY).get());
             if(pStory)
             {
                 //add all the pagelayout in order into the pagelayout list;
@@ -280,16 +280,16 @@ void LwpDocument::RegisterLayoutStyles()
 void LwpDocument::RegisterStylesInPara()
 {
     //Register all automatic styles in para
-    LwpHeadContent* pContent = dynamic_cast<LwpHeadContent*> (m_pFoundry->GetContentManager()->GetContentList()->obj());
+    LwpHeadContent* pContent = dynamic_cast<LwpHeadContent*> (m_pFoundry->GetContentManager()->GetContentList()->obj().get());
     if(pContent)
     {
-        LwpStory* pStory = dynamic_cast<LwpStory*>(pContent->GetChildHead()->obj(VO_STORY));
+        LwpStory* pStory = dynamic_cast<LwpStory*>(pContent->GetChildHead()->obj(VO_STORY).get());
         while(pStory)
         {
             //Register the child para
             pStory->SetFoundry(m_pFoundry);
             pStory->RegisterStyle();
-            pStory = dynamic_cast<LwpStory*>(pStory->GetNext()->obj(VO_STORY));
+            pStory = dynamic_cast<LwpStory*>(pStory->GetNext()->obj(VO_STORY).get());
         }
     }
 }
@@ -300,16 +300,16 @@ void LwpDocument::RegisterBulletStyles()
 {
     //Register bullet styles
     LwpDLVListHeadHolder* mBulletHead = dynamic_cast<LwpDLVListHeadHolder*>
-                (m_pFoundry->GetBulletManagerID()->obj(VO_HEADHOLDER));
+        (m_pFoundry->GetBulletManagerID()->obj(VO_HEADHOLDER).get());
     if( mBulletHead )
     {
         LwpSilverBullet* pBullet = dynamic_cast<LwpSilverBullet*>
-                            (mBulletHead->GetHeadID()->obj());
+                            (mBulletHead->GetHeadID()->obj().get());
         while(pBullet)
         {
             pBullet->SetFoundry(m_pFoundry);
             pBullet->RegisterStyle();
-            pBullet = dynamic_cast<LwpSilverBullet*> (pBullet->GetNext()->obj());
+            pBullet = dynamic_cast<LwpSilverBullet*> (pBullet->GetNext()->obj().get());
         }
     }
 }
@@ -319,8 +319,8 @@ void LwpDocument::RegisterBulletStyles()
 void LwpDocument::RegisterGraphicsStyles()
 {
     //Register all graphics styles, the first object should register the next;
-    LwpObject* pGraphic = m_pFoundry->GetGraphicListHead()->obj(VO_GRAPHIC);
-    if(pGraphic)
+    rtl::Reference<LwpObject> pGraphic = m_pFoundry->GetGraphicListHead()->obj(VO_GRAPHIC);
+    if(pGraphic.is())
     {
         pGraphic->SetFoundry(m_pFoundry);
         pGraphic->RegisterStyle();
@@ -344,7 +344,7 @@ void LwpDocument::RegisterFootnoteStyles()
     //Register footnote and endnote configuration for the entire document
     if(!m_FootnoteOpts.IsNull())
     {
-        LwpFootnoteOptions* pFootnoteOpts = dynamic_cast<LwpFootnoteOptions*>(m_FootnoteOpts.obj());
+        LwpFootnoteOptions* pFootnoteOpts = dynamic_cast<LwpFootnoteOptions*>(m_FootnoteOpts.obj().get());
         if (pFootnoteOpts)
         {
             pFootnoteOpts->SetMasterPage("Endnote");
@@ -356,13 +356,13 @@ void LwpDocument::RegisterFootnoteStyles()
     LwpDocument* pEndnoteDiv = GetLastDivisionThatHasEndnote();
     if(this == pEndnoteDiv)
     {
-        LwpDLVListHeadTailHolder* pHeadTail = dynamic_cast<LwpDLVListHeadTailHolder*>(GetPageHintsID()->obj());
+        LwpDLVListHeadTailHolder* pHeadTail = dynamic_cast<LwpDLVListHeadTailHolder*>(GetPageHintsID()->obj().get());
         if(pHeadTail)
         {
-            LwpPageHint* pPageHint = dynamic_cast<LwpPageHint*>(pHeadTail->GetTail()->obj());
+            LwpPageHint* pPageHint = dynamic_cast<LwpPageHint*>(pHeadTail->GetTail()->obj().get());
             if(pPageHint && !pPageHint->GetPageLayoutID()->IsNull())
             {
-                LwpPageLayout* pPageLayout = dynamic_cast<LwpPageLayout*>(pPageHint->GetPageLayoutID()->obj());
+                LwpPageLayout* pPageLayout = dynamic_cast<LwpPageLayout*>(pPageHint->GetPageLayoutID()->obj().get());
                 if(pPageLayout)
                 {
                     pPageLayout->SetFoundry(GetFoundry());
@@ -386,7 +386,7 @@ void LwpDocument::RegisterDefaultParaStyles()
         LwpDocument* pFirstDoc = GetFirstDivisionWithContentsThatIsNotOLE();
         if(pFirstDoc)
         {
-            LwpVerDocument* pVerDoc = dynamic_cast<LwpVerDocument*>(pFirstDoc->GetVerDoc()->obj());
+            LwpVerDocument* pVerDoc = dynamic_cast<LwpVerDocument*>(pFirstDoc->GetVerDoc()->obj().get());
             if(pVerDoc)
             {
                 pVerDoc->RegisterStyle();
@@ -403,11 +403,11 @@ void LwpDocument::RegisterDefaultParaStyles()
 void LwpDocument::ParseDocContent(IXFStream* pOutputStream)
 {
     //Parse content in PageLayout
-    LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*> (m_DivInfo.obj());
+    LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*> (m_DivInfo.obj().get());
     if(pDivInfo==NULL) return;
 
-    LwpObject* pLayoutObj = pDivInfo->GetInitialLayoutID()->obj();
-    if(pLayoutObj==NULL)
+    rtl::Reference<LwpObject> pLayoutObj = pDivInfo->GetInitialLayoutID()->obj();
+    if(!pLayoutObj.is())
     {
         //master document not supported now.
         return;
@@ -434,7 +434,7 @@ LwpObjectID* LwpDocument::GetValidFootnoteOpts()
  */
 sal_uInt16 LwpDocument::GetEndnoteType()
 {
-    LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(GetDivInfoID()->obj());
+    LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(GetDivInfoID()->obj().get());
     if (!pDivInfo)
         return FN_DONTCARE;
     OUString strClassName = pDivInfo->GetClassName();
@@ -451,10 +451,10 @@ sal_uInt16 LwpDocument::GetEndnoteType()
  */
 LwpDocument* LwpDocument::GetPreviousDivision()
 {
-    LwpDocSock* pDocSock = dynamic_cast<LwpDocSock*>(GetSocket()->obj());
+    LwpDocSock* pDocSock = dynamic_cast<LwpDocSock*>(GetSocket()->obj().get());
     if(pDocSock)
     {
-        return dynamic_cast<LwpDocument*>(pDocSock->GetPrevious()->obj());
+        return dynamic_cast<LwpDocument*>(pDocSock->GetPrevious()->obj().get());
     }
     return NULL;
 }
@@ -463,10 +463,10 @@ LwpDocument* LwpDocument::GetPreviousDivision()
  */
  LwpDocument* LwpDocument::GetNextDivision()
 {
-    LwpDocSock* pDocSock = dynamic_cast<LwpDocSock*>(GetSocket()->obj());
+    LwpDocSock* pDocSock = dynamic_cast<LwpDocSock*>(GetSocket()->obj().get());
     if(pDocSock)
     {
-        return dynamic_cast<LwpDocument*>(pDocSock->GetNext()->obj());
+        return dynamic_cast<LwpDocument*>(pDocSock->GetNext()->obj().get());
     }
     return NULL;
 }
@@ -475,10 +475,10 @@ LwpDocument* LwpDocument::GetPreviousDivision()
  */
  LwpDocument* LwpDocument::GetParentDivision()
 {
-    LwpDocSock* pDocSock = dynamic_cast<LwpDocSock*>(GetSocket()->obj());
+    LwpDocSock* pDocSock = dynamic_cast<LwpDocSock*>(GetSocket()->obj().get());
     if(pDocSock)
     {
-        return dynamic_cast<LwpDocument*>(pDocSock->GetParent()->obj());
+        return dynamic_cast<LwpDocument*>(pDocSock->GetParent()->obj().get());
     }
     return NULL;
 }
@@ -491,7 +491,7 @@ LwpDocument* LwpDocument::GetPreviousDivision()
 
     for (pPrev = GetPreviousDivision(); pPrev; pPrev = pPrev->GetPreviousDivision())
     {
-        LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(pPrev->GetDivInfoID()->obj());
+        LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(pPrev->GetDivInfoID()->obj().get());
         if(pDivInfo && pDivInfo->HasContents())
             return pPrev;
     }
@@ -506,7 +506,7 @@ LwpDocument* LwpDocument::GetPreviousDivision()
 
     for (pNext = GetNextDivision(); pNext; pNext = pNext->GetNextDivision())
     {
-        LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(pNext->GetDivInfoID()->obj());
+        LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(pNext->GetDivInfoID()->obj().get());
         if(pDivInfo && pDivInfo->HasContents())
             return pNext;
     }
@@ -533,7 +533,7 @@ LwpDocument* LwpDocument::GetPreviousDivision()
  */
  LwpDocument* LwpDocument::GetLastDivisionWithContents()
 {
-    LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(GetDivInfoID()->obj());
+    LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(GetDivInfoID()->obj().get());
     if(pDivInfo && pDivInfo->HasContents())
     {
         return this;
@@ -564,7 +564,7 @@ LwpDocument* LwpDocument::GetPreviousDivision()
 
     while (pNext)
     {
-        LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(pNext->GetDivInfoID()->obj());
+        LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(pNext->GetDivInfoID()->obj().get());
         if (pDivInfo && pDivInfo->HasContents())
             pLast = pNext;
         pNext = pNext->GetNextInGroup();
@@ -578,9 +578,9 @@ LwpDocument* LwpDocument::GetPreviousDivision()
  */
  LwpDocument* LwpDocument::GetLastDivision()
 {
-    LwpDocSock* pDocSock = dynamic_cast<LwpDocSock*>(GetSocket()->obj());
+    LwpDocSock* pDocSock = dynamic_cast<LwpDocSock*>(GetSocket()->obj().get());
     if(pDocSock)
-        return dynamic_cast<LwpDocument*>(pDocSock->GetChildTail()->obj());
+        return dynamic_cast<LwpDocument*>(pDocSock->GetChildTail()->obj().get());
     return NULL;
 }
 
@@ -589,9 +589,9 @@ LwpDocument* LwpDocument::GetPreviousDivision()
  */
  LwpDocument* LwpDocument::GetFirstDivision()
 {
-    LwpDocSock* pDocSock = dynamic_cast<LwpDocSock*>(GetSocket()->obj());
+    LwpDocSock* pDocSock = dynamic_cast<LwpDocSock*>(GetSocket()->obj().get());
     if(pDocSock)
-        return dynamic_cast<LwpDocument*>(pDocSock->GetChildHead()->obj());
+        return dynamic_cast<LwpDocument*>(pDocSock->GetChildHead()->obj().get());
     return NULL;
 }
 
@@ -614,7 +614,7 @@ LwpDocument* LwpDocument::GetPreviousDivision()
  */
  LwpDocument* LwpDocument::GetFirstDivisionWithContentsThatIsNotOLE()
 {
-    LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(GetDivInfoID()->obj());
+    LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(GetDivInfoID()->obj().get());
     if(pDivInfo && pDivInfo->HasContents()
         && !pDivInfo->IsOleDivision())
         return this;
@@ -653,7 +653,7 @@ LwpDocument* LwpDocument::GetPreviousDivision()
  */
  LwpVirtualLayout* LwpDocument::GetEnSuperTableLayout()
 {
-    LwpHeadLayout* pHeadLayout = dynamic_cast<LwpHeadLayout*>(GetFoundry()->GetLayout()->obj());
+    LwpHeadLayout* pHeadLayout = dynamic_cast<LwpHeadLayout*>(GetFoundry()->GetLayout()->obj().get());
     if(pHeadLayout)
     {
         return pHeadLayout->FindEnSuperTableLayout();
@@ -669,7 +669,7 @@ bool LwpDocument::GetNumberOfPages(LwpDocument* pEndDivision, sal_uInt16& nCount
     if(this == pEndDivision)
         return true;
 
-    LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(m_DivInfo.obj());
+    LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(m_DivInfo.obj().get());
     if(pDivInfo)
     {
         pDivInfo->GetNumberOfPages(nCount);
@@ -704,7 +704,7 @@ sal_uInt16 LwpDocument::GetNumberOfPagesBefore()
 {
     LwpDocument* pDivision = GetFirstDivision();
 
-    LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(m_DivInfo.obj());
+    LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(m_DivInfo.obj().get());
     if(pDivInfo)
         nNumPages += pDivInfo->GetMaxNumberOfPages();
     while(pDivision)
@@ -737,13 +737,13 @@ void LwpDocument::XFConvertFrameInPage(XFContentContainer * pCont)
 {
     LwpDocument* pDivision = GetFirstDivision();
 
-    LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*> (GetDivInfoID()->obj());
+    LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*> (GetDivInfoID()->obj().get());
     if(pDivInfo)
     {
-        LwpPageLayout*  pPageLayout = dynamic_cast<LwpPageLayout*>(pDivInfo->GetInitialLayoutID()->obj());
+        LwpPageLayout*  pPageLayout = dynamic_cast<LwpPageLayout*>(pDivInfo->GetInitialLayoutID()->obj().get());
         if(pPageLayout)
         {
-            LwpStory* pStory = dynamic_cast<LwpStory*>(pPageLayout->GetContent()->obj());
+            LwpStory* pStory = dynamic_cast<LwpStory*>(pPageLayout->GetContent()->obj().get());
             if(pStory)
                 pStory->XFConvertFrameInPage(pCont);
         }
@@ -784,12 +784,12 @@ void LwpDocSock::Read()
  */
 void LwpDocSock::RegisterStyle()
 {
-    LwpObject* pDoc = GetNext()->obj();
-    if(pDoc)
+    rtl::Reference<LwpObject> pDoc = GetNext()->obj();
+    if(pDoc.is())
         pDoc->RegisterStyle();
 
     pDoc = GetChildHead()->obj();
-    if(pDoc)
+    if(pDoc.is())
         pDoc->RegisterStyle();
 }
  /**
@@ -797,12 +797,12 @@ void LwpDocSock::RegisterStyle()
  */
 void LwpDocSock::Parse(IXFStream* pOutputStream)
 {
-    LwpObject* pDoc = GetChildHead()->obj();
-    if(pDoc)
+    rtl::Reference<LwpObject> pDoc = GetChildHead()->obj();
+    if(pDoc.is())
         pDoc->Parse(pOutputStream);
 
     pDoc = GetNext()->obj();
-    if(pDoc)
+    if(pDoc.is())
         pDoc->Parse(pOutputStream);
 }
 
diff --git a/lotuswordpro/source/filter/lwpdocdata.hxx b/lotuswordpro/source/filter/lwpdocdata.hxx
index adf3a31..48414b3 100644
--- a/lotuswordpro/source/filter/lwpdocdata.hxx
+++ b/lotuswordpro/source/filter/lwpdocdata.hxx
@@ -164,8 +164,9 @@ class LwpDocData : public LwpObject
 {
 public:
     LwpDocData(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
-    virtual ~LwpDocData();
 private:
+    virtual ~LwpDocData();
+
     LwpDocOptions m_DocOptions;
     LwpDocInfo m_DocInfo;
     LwpDocControl m_DocControl;
diff --git a/lotuswordpro/source/filter/lwpfnlayout.cxx b/lotuswordpro/source/filter/lwpfnlayout.cxx
index 0b10dc4..595f43a 100644
--- a/lotuswordpro/source/filter/lwpfnlayout.cxx
+++ b/lotuswordpro/source/filter/lwpfnlayout.cxx
@@ -119,14 +119,14 @@ void LwpFnRowLayout::RegisterStyle()
 {
     // register cells' style
     LwpObjectID *pCellID= GetChildHead();
-    LwpCellLayout * pCellLayout = static_cast<LwpCellLayout *>(pCellID->obj());
+    LwpCellLayout * pCellLayout = static_cast<LwpCellLayout *>(pCellID->obj().get());
 
     while(pCellLayout)
     {
         pCellLayout->SetFoundry(m_pFoundry);
         pCellLayout->RegisterStyle();
         pCellID = pCellLayout->GetNext();
-        pCellLayout = static_cast<LwpCellLayout *>(pCellID->obj());
+        pCellLayout = static_cast<LwpCellLayout *>(pCellID->obj().get());
     }
 }
 
@@ -160,8 +160,8 @@ void LwpFnCellLayout::Read()
 void LwpFnCellLayout::RegisterStyle()
 {
     // content object register styles
-    LwpObject * pObj = m_Content.obj();
-    if (pObj)
+    rtl::Reference<LwpObject> pObj = m_Content.obj();
+    if (pObj.is())
     {
         pObj->SetFoundry(m_pFoundry);
         pObj->RegisterStyle();
@@ -199,14 +199,14 @@ void LwpEndnoteLayout::RegisterStyle()
 {
     // register style of rows
     LwpObjectID *pRowID = GetChildHead();
-    LwpRowLayout * pRowLayout = static_cast<LwpRowLayout *>(pRowID->obj());
+    LwpRowLayout * pRowLayout = static_cast<LwpRowLayout *>(pRowID->obj().get());
     while (pRowLayout)
     {
         pRowLayout->SetFoundry(m_pFoundry);
         pRowLayout->RegisterStyle();
 
         pRowID = pRowLayout->GetNext();
-        pRowLayout = static_cast<LwpRowLayout *>(pRowID->obj());
+        pRowLayout = static_cast<LwpRowLayout *>(pRowID->obj().get());
     }
 }
 
@@ -262,7 +262,7 @@ void LwpEnSuperTableLayout::XFConvert(XFContentContainer * /*pCont*/)
 
     while(pID && !pID->IsNull())
     {
-        LwpVirtualLayout * pLayout = static_cast<LwpVirtualLayout *>(pID->obj());
+        LwpVirtualLayout * pLayout = static_cast<LwpVirtualLayout *>(pID->obj().get());
         if(!pLayout)
         {
             break;
@@ -318,7 +318,7 @@ LwpVirtualLayout* LwpFnSuperTableLayout::GetMainTableLayout()
 
     while(pID && !pID->IsNull())
     {
-        LwpVirtualLayout * pLayout = static_cast<LwpVirtualLayout *>(pID->obj());
+        LwpVirtualLayout * pLayout = static_cast<LwpVirtualLayout *>(pID->obj().get());
         if(!pLayout)
         {
             break;
diff --git a/lotuswordpro/source/filter/lwpfootnote.cxx b/lotuswordpro/source/filter/lwpfootnote.cxx
index 91e18ae..1761b28 100644
--- a/lotuswordpro/source/filter/lwpfootnote.cxx
+++ b/lotuswordpro/source/filter/lwpfootnote.cxx
@@ -141,7 +141,7 @@ void LwpFribFootnote::XFConvert(XFContentContainer* pCont)
  */
 LwpFootnote* LwpFribFootnote::GetFootnote()
 {
-    return dynamic_cast<LwpFootnote*>(m_Footnote.obj());
+    return dynamic_cast<LwpFootnote*>(m_Footnote.obj().get());
 }
 
 LwpFootnote::LwpFootnote(LwpObjectHeader &objHdr, LwpSvStream *pStrm)
@@ -212,7 +212,7 @@ LwpCellLayout* LwpFootnote::GetCellLayout()
             LwpRowLayout* pRowLayout = pTableLayout->GetRowLayout(m_nRow);
             if(pRowLayout)
             {
-                return dynamic_cast<LwpCellLayout*>(pRowLayout->GetChildHead()->obj());
+                return dynamic_cast<LwpCellLayout*>(pRowLayout->GetChildHead()->obj().get());
             }
         }
     }
@@ -387,7 +387,7 @@ LwpEnSuperTableLayout* LwpFootnote::FindFootnoteTableLayout()
  */
 LwpContent* LwpFootnote::FindFootnoteContent()
 {
-    LwpContent* pContent = dynamic_cast<LwpContent*>(m_Content.obj());
+    LwpContent* pContent = dynamic_cast<LwpContent*>(m_Content.obj().get());
     //if the content has layout, the content has footnote contents;
     //or looking for the celllayout and return the footnote contents.
     if(pContent && pContent->GetLayout(NULL))
@@ -396,7 +396,7 @@ LwpContent* LwpFootnote::FindFootnoteContent()
     LwpCellLayout* pCellLayout = GetCellLayout();
     if(pCellLayout)
     {
-        pContent = dynamic_cast<LwpContent*>(pCellLayout->GetContent()->obj());
+        pContent = dynamic_cast<LwpContent*>(pCellLayout->GetContent()->obj().get());
     }
 
     return pContent;
diff --git a/lotuswordpro/source/filter/lwpfootnote.hxx b/lotuswordpro/source/filter/lwpfootnote.hxx
index 1d95043..1abb135 100644
--- a/lotuswordpro/source/filter/lwpfootnote.hxx
+++ b/lotuswordpro/source/filter/lwpfootnote.hxx
@@ -245,13 +245,14 @@ class LwpFootnoteOptions : public LwpObject
 {
 public:
     LwpFootnoteOptions(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
-    virtual ~LwpFootnoteOptions();
     void RegisterStyle() SAL_OVERRIDE;
 protected:
     void Read() SAL_OVERRIDE;
     void RegisterFootnoteStyle();
     void RegisterEndnoteStyle();
 private:
+    virtual ~LwpFootnoteOptions();
+
     sal_uInt16 m_nFlag;
     LwpFootnoteNumberOptions m_FootnoteNumbering;
     LwpFootnoteNumberOptions m_EndnoteDivisionNumbering;
diff --git a/lotuswordpro/source/filter/lwpfoundry.cxx b/lotuswordpro/source/filter/lwpfoundry.cxx
index 40dc99e..3fac6aa 100644
--- a/lotuswordpro/source/filter/lwpfoundry.cxx
+++ b/lotuswordpro/source/filter/lwpfoundry.cxx
@@ -195,8 +195,8 @@ void LwpFoundry::RegisterAllLayouts()
     m_bRegisteredAll = true;
 
     //Register CellStyle
-    LwpObject* pStyle = m_CellStyle.obj();
-    if( pStyle )
+    rtl::Reference<LwpObject> pStyle = m_CellStyle.obj();
+    if( pStyle.is() )
     {
         pStyle->SetFoundry(this);
         pStyle->RegisterStyle();
@@ -204,7 +204,7 @@ void LwpFoundry::RegisterAllLayouts()
 
     //register content page layout list: Layout
     pStyle = m_Layout.obj();
-    if( pStyle )
+    if( pStyle.is() )
     {
         pStyle->SetFoundry(this);
         pStyle->RegisterStyle();
@@ -212,7 +212,7 @@ void LwpFoundry::RegisterAllLayouts()
 
     //Register page style layout list: PageStyle, such as "Default Page"
     pStyle = m_PageStyle.obj();
-    if( pStyle )
+    if( pStyle.is() )
     {
         pStyle->SetFoundry(this);
         pStyle->RegisterStyle();
@@ -220,7 +220,7 @@ void LwpFoundry::RegisterAllLayouts()
 
     //Register FrameStyle
     pStyle = m_FrameStyle.obj();
-    if( pStyle )
+    if( pStyle.is() )
     {
         pStyle->SetFoundry(this);
         pStyle->RegisterStyle();
@@ -231,11 +231,11 @@ void LwpFoundry::RegisterAllLayouts()
 LwpBookMark* LwpFoundry::GetBookMark(LwpObjectID objMarker)
 {
     LwpDLVListHeadHolder* pHeadHolder= static_cast
-                    <LwpDLVListHeadHolder*>(m_BookMarkHead.obj());
+                    <LwpDLVListHeadHolder*>(m_BookMarkHead.obj().get());
     LwpObjectID* pObjID = pHeadHolder->GetHeadID();
     LwpBookMark* pBookMark;
     if (pObjID)
-        pBookMark = static_cast<LwpBookMark*>(pObjID->obj());
+        pBookMark = static_cast<LwpBookMark*>(pObjID->obj().get());
     else
         return NULL;
 
@@ -245,7 +245,7 @@ LwpBookMark* LwpFoundry::GetBookMark(LwpObjectID objMarker)
             return pBookMark;
         pObjID = pBookMark->GetNext();
         if (pObjID)
-            pBookMark = static_cast<LwpBookMark*>(pObjID->obj());
+            pBookMark = static_cast<LwpBookMark*>(pObjID->obj().get());
         else
             return NULL;
     }
@@ -276,7 +276,7 @@ LwpSection* LwpFoundry::EnumSections(LwpSection * pSection)
 */
 LwpObjectID * LwpFoundry::GetDefaultTextStyle()
 {
-    LwpVersionedPointer * pPointer = static_cast<LwpVersionedPointer *>(m_DefaultTextStyle.obj());
+    LwpVersionedPointer * pPointer = static_cast<LwpVersionedPointer *>(m_DefaultTextStyle.obj().get());
     if (!pPointer)
         return NULL;
 
@@ -290,16 +290,16 @@ LwpObjectID * LwpFoundry::GetDefaultTextStyle()
 LwpObjectID * LwpFoundry::FindParaStyleByName(const OUString& name)
 {
     //Register all text styles: para styles, character styles
-    LwpDLVListHeadHolder* pParaStyleHolder = static_cast<LwpDLVListHeadHolder*>(GetTextStyleHead()->obj());
+    LwpDLVListHeadHolder* pParaStyleHolder = static_cast<LwpDLVListHeadHolder*>(GetTextStyleHead()->obj().get());
     if(pParaStyleHolder)
     {
-        LwpTextStyle* pParaStyle = static_cast<LwpTextStyle*> (pParaStyleHolder->GetHeadID()->obj());
+        LwpTextStyle* pParaStyle = static_cast<LwpTextStyle*> (pParaStyleHolder->GetHeadID()->obj().get());
         while(pParaStyle)
         {
             OUString strName = pParaStyle->GetName()->str();
             if(strName == name)
                 return pParaStyle->GetObjectID();
-            pParaStyle = static_cast<LwpTextStyle*>(pParaStyle->GetNext()->obj());
+            pParaStyle = static_cast<LwpTextStyle*>(pParaStyle->GetNext()->obj().get());
         }
     }
 
@@ -408,8 +408,8 @@ LwpContent* LwpContentManager::EnumContents(LwpContent* pContent)
 {
     if(pContent)
         return pContent->GetNextEnumerated();
-    LwpVersionedPointer* pPointer = static_cast<LwpVersionedPointer*>(m_EnumHead.obj());
-    return pPointer ? static_cast<LwpContent*>(pPointer->GetPointer()->obj()) : NULL;
+    LwpVersionedPointer* pPointer = static_cast<LwpVersionedPointer*>(m_EnumHead.obj().get());
+    return pPointer ? static_cast<LwpContent*>(pPointer->GetPointer()->obj().get()) : NULL;
 }
 
 void LwpPieceManager::Read(LwpObjectStream *pStrm)
@@ -460,14 +460,14 @@ LwpOrderedObject* LwpOrderedObjectManager::Enumerate(LwpOrderedObject * pLast)
 {
     // If Last has a next, return it.
     if(pLast && !pLast->GetNext()->IsNull())
-        return static_cast<LwpOrderedObject*>(pLast->GetNext()->obj());
+        return static_cast<LwpOrderedObject*>(pLast->GetNext()->obj().get());
 
     LwpListList* pList = NULL;
     if(pLast)
     {
         // We're at the end of Last's list (not Liszt's list).
         // Start with the next active list
-        pList = static_cast<LwpListList*>(pLast->GetListList()->obj());
+        pList = static_cast<LwpListList*>(pLast->GetListList()->obj().get());
         pList= GetNextActiveListList(pList);
     }
     else
@@ -478,7 +478,7 @@ LwpOrderedObject* LwpOrderedObjectManager::Enumerate(LwpOrderedObject * pLast)
 
     if(pList)
     {
-        return static_cast<LwpOrderedObject*>(pList->GetHead()->obj());
+        return static_cast<LwpOrderedObject*>(pList->GetHead()->obj().get());
     }
 
     return NULL;
@@ -493,23 +493,23 @@ LwpListList* LwpOrderedObjectManager::GetNextActiveListList(LwpListList * pLast)
     LwpListList* pList = NULL;
     LwpContent* pContent = NULL;
     if(pLast)
-        pList = static_cast<LwpListList*>(pLast->GetNext()->obj());
+        pList = static_cast<LwpListList*>(pLast->GetNext()->obj().get());
     else
     {
-        LwpDLVListHeadHolder* pHeadHolder= static_cast<LwpDLVListHeadHolder*>(m_Head.obj());
+        LwpDLVListHeadHolder* pHeadHolder= static_cast<LwpDLVListHeadHolder*>(m_Head.obj().get());
         if(pHeadHolder)
         {
-            pList = static_cast<LwpListList*>(pHeadHolder->GetHeadID()->obj());
+            pList = static_cast<LwpListList*>(pHeadHolder->GetHeadID()->obj().get());
         }
     }
 
     while(pList)
     {
-        pContent = static_cast<LwpContent*>(pList->GetObject()->obj());
+        pContent = static_cast<LwpContent*>(pList->GetObject()->obj().get());
         if(pContent && pContent->HasNonEmbeddedLayouts() &&
             !pContent->IsStyleContent())
             return pList;
-        pList = static_cast<LwpListList*>(pList->GetNext()->obj());
+        pList = static_cast<LwpListList*>(pList->GetNext()->obj().get());
     }
     return NULL;
 }
diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx
index 948a35f..7109b9d 100644
--- a/lotuswordpro/source/filter/lwpframelayout.cxx
+++ b/lotuswordpro/source/filter/lwpframelayout.cxx
@@ -833,8 +833,8 @@ void LwpFrameLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart
         //if it is a link frame, parse contents only once
         if(!HasPreviousLinkLayout())
         {
-            LwpObject* content = m_Content.obj();
-            if (content)
+            rtl::Reference<LwpObject> content = m_Content.obj();
+            if (content.is())
             {
                 content->XFConvert(pXFFrame);
                 //set frame size according to ole size
@@ -863,8 +863,8 @@ void  LwpFrameLayout::RegisterStyle()
     m_pFrame->RegisterStyle(pFrameStyle);
 
     //register content style
-    LwpObject* content = m_Content.obj();
-    if (content)
+    rtl::Reference<LwpObject> content = m_Content.obj();
+    if (content.is())
     {
         content->SetFoundry(m_pFoundry);
         content->RegisterStyle();
@@ -884,7 +884,7 @@ OUString LwpFrameLayout::GetNextLinkName()
     LwpObjectID* pObjectID = m_Link.GetNextLayout();
     if(!pObjectID->IsNull())
     {
-        LwpLayout* pLayout = dynamic_cast<LwpLayout*>(pObjectID->obj());
+        LwpLayout* pLayout = dynamic_cast<LwpLayout*>(pObjectID->obj().get());
         if (pLayout)
         {
             LwpAtomHolder *pHolder = pLayout->GetName();
@@ -981,11 +981,11 @@ double LwpFrameLayout::GetMaxWidth()
  */
 void LwpFrameLayout::ApplyGraphicSize(XFFrame * pXFFrame)
 {
-    LwpObject* content = m_Content.obj();
-    if(content && (content->GetTag() == VO_GRAPHIC
+    rtl::Reference<LwpObject> content = m_Content.obj();
+    if(content.is() && (content->GetTag() == VO_GRAPHIC
                 || content->GetTag() == VO_OLEOBJECT ))
     {
-        LwpGraphicOleObject* pGraOle = static_cast<LwpGraphicOleObject*>(content);
+        LwpGraphicOleObject* pGraOle = static_cast<LwpGraphicOleObject*>(content.get());
         //Get frame geometry size
         double fWidth = 0;
         double fHeight = 0;
@@ -1097,11 +1097,11 @@ void LwpGroupLayout::XFConvertFrame(XFContentContainer* pCont, sal_Int32 nStart
         m_pFrame->Parse(pXFFrame, nStart);
 
         //add child frame into group
-        LwpVirtualLayout* pLayout = static_cast<LwpVirtualLayout*>(GetChildHead()->obj());
+        LwpVirtualLayout* pLayout = static_cast<LwpVirtualLayout*>(GetChildHead()->obj().get());
         while(pLayout)
         {
             pLayout->XFConvert(pXFFrame);
-            pLayout = static_cast<LwpVirtualLayout*>(pLayout->GetNext()->obj());
+            pLayout = static_cast<LwpVirtualLayout*>(pLayout->GetNext()->obj().get());
         }
 
         pCont ->Add(pXFFrame);
@@ -1147,11 +1147,11 @@ void LwpDropcapLayout::Read()
 
 void LwpDropcapLayout::Parse(IXFStream* pOutputStream)
 {
-    LwpStory* pStory = static_cast<LwpStory*>(m_Content.obj(VO_STORY));
+    LwpStory* pStory = static_cast<LwpStory*>(m_Content.obj(VO_STORY).get());
     if (!pStory)
         return;
-    LwpObject* pPara = pStory->GetFirstPara()->obj(VO_PARA);
-    if(pPara)
+    rtl::Reference<LwpObject> pPara = pStory->GetFirstPara()->obj(VO_PARA);
+    if(pPara.is())
     {
         pPara->SetFoundry(m_pFoundry);
         pPara->Parse(pOutputStream);
@@ -1160,7 +1160,7 @@ void LwpDropcapLayout::Parse(IXFStream* pOutputStream)
 
 void LwpDropcapLayout::XFConvert(XFContentContainer* pCont)
 {
-    LwpStory* pStory = static_cast<LwpStory*>(m_Content.obj(VO_STORY));
+    LwpStory* pStory = static_cast<LwpStory*>(m_Content.obj(VO_STORY).get());
     if (pStory)
     {
         pStory->SetFoundry(m_pFoundry);
@@ -1170,7 +1170,7 @@ void LwpDropcapLayout::XFConvert(XFContentContainer* pCont)
 
 LwpStory* LwpDropcapLayout::GetContentStory()
 {
-    return static_cast<LwpStory*>(m_Content.obj(VO_STORY));
+    return static_cast<LwpStory*>(m_Content.obj(VO_STORY).get());
 }
 
 void LwpDropcapLayout::RegisterStyle(LwpFoundry* pFoundry)
@@ -1180,12 +1180,12 @@ void LwpDropcapLayout::RegisterStyle(LwpFoundry* pFoundry)
     {
         pStory->SetDropcapFlag(true);
         pStory->SetFoundry(pFoundry);
-        LwpPara* pPara = static_cast<LwpPara*>(pStory->GetFirstPara()->obj());
+        LwpPara* pPara = static_cast<LwpPara*>(pStory->GetFirstPara()->obj().get());
         while(pPara)
         {
             pPara->SetFoundry(pFoundry);
             pPara->RegisterStyle();
-            pPara = static_cast<LwpPara*>(pPara->GetNext()->obj());
+            pPara = static_cast<LwpPara*>(pPara->GetNext()->obj().get());
         }
     }
 }
@@ -1222,12 +1222,12 @@ void LwpRubyLayout::Read()
 
 LwpRubyMarker* LwpRubyLayout::GetMarker()
 {
-    return static_cast<LwpRubyMarker*>(m_objRubyMarker.obj(VO_RUBYMARKER));
+    return static_cast<LwpRubyMarker*>(m_objRubyMarker.obj(VO_RUBYMARKER).get());
 }
 
 LwpStory* LwpRubyLayout::GetContentStory()
 {
-    return static_cast<LwpStory*>(m_Content.obj(VO_STORY));
+    return static_cast<LwpStory*>(m_Content.obj(VO_STORY).get());
 }
 
 void LwpRubyLayout::ConvertContentText()
diff --git a/lotuswordpro/source/filter/lwpfrib.cxx b/lotuswordpro/source/filter/lwpfrib.cxx
index 4543c96..163d80f 100644
--- a/lotuswordpro/source/filter/lwpfrib.cxx
+++ b/lotuswordpro/source/filter/lwpfrib.cxx
@@ -254,7 +254,7 @@ void LwpFrib::RegisterStyle(LwpFoundry* pFoundry)
         {
             pStyle = new XFTextStyle();
             *pStyle = *pNamedStyle;
-            LwpCharacterStyle* pCharStyle = static_cast<LwpCharacterStyle*>(m_pModifiers->CharStyleID.obj());
+            LwpCharacterStyle* pCharStyle = static_cast<LwpCharacterStyle*>(m_pModifiers->CharStyleID.obj().get());
 
             pStyle->SetStyleName("");
             pFont = pFoundry->GetFontManger()->CreateOverrideFont(pCharStyle->GetFinalFontID(),m_pModifiers->FontID);
diff --git a/lotuswordpro/source/filter/lwpfribbreaks.cxx b/lotuswordpro/source/filter/lwpfribbreaks.cxx
index 9890e1f..ce71c21 100644
--- a/lotuswordpro/source/filter/lwpfribbreaks.cxx
+++ b/lotuswordpro/source/filter/lwpfribbreaks.cxx
@@ -84,7 +84,7 @@ void LwpFribColumnBreak::RegisterBreakStyle(LwpPara * pPara)
     //if (static_cast<LwpStory*>(pPara->GetStoryID()->obj())
     //  ->GetCurrentLayout()->GetNumCols() == 1)
     //New code
-    LwpStory* pStory = static_cast<LwpStory*>(pPara->GetStoryID()->obj());
+    LwpStory* pStory = static_cast<LwpStory*>(pPara->GetStoryID()->obj().get());
     LwpPageLayout* pCurLayout = pStory ? pStory->GetCurrentLayout() : NULL;
     if( pCurLayout && (pCurLayout->GetNumCols() == 1) )
 
@@ -129,7 +129,7 @@ void LwpFribPageBreak::RegisterBreakStyle(LwpPara* pPara)
     XFParaStyle* pBaseStyle =  pPara->GetXFParaStyle();
     if (pBaseStyle == NULL) return;
 
-    LwpPageLayout* pLayout = static_cast<LwpPageLayout*>(m_Layout.obj());
+    LwpPageLayout* pLayout = static_cast<LwpPageLayout*>(m_Layout.obj().get());
     if(pLayout)
     {
         m_pMasterPage = new LwpMasterPage(pPara, pLayout);
diff --git a/lotuswordpro/source/filter/lwpfribframe.cxx b/lotuswordpro/source/filter/lwpfribframe.cxx
index 6e48950..5d5c20c 100644
--- a/lotuswordpro/source/filter/lwpfribframe.cxx
+++ b/lotuswordpro/source/filter/lwpfribframe.cxx
@@ -80,7 +80,7 @@ void LwpFribFrame::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
 *  @descr:  Get the layout object which the frib points to
 *
 */
-LwpObject* LwpFribFrame::GetLayout()
+rtl::Reference<LwpObject> LwpFribFrame::GetLayout()
 {
     return m_objLayout.obj();
 }
@@ -92,11 +92,11 @@ LwpObject* LwpFribFrame::GetLayout()
 */
 void LwpFribFrame::RegisterStyle(LwpFoundry* pFoundry)
 {
-    LwpObject *pObject = m_objLayout.obj();
+    rtl::Reference<LwpObject> pObject = m_objLayout.obj();
 
-    if (pObject && pObject->GetTag() == VO_DROPCAPLAYOUT)
+    if (pObject.is() && pObject->GetTag() == VO_DROPCAPLAYOUT)
     {
-        LwpDropcapLayout *pLayout = dynamic_cast<LwpDropcapLayout*>(pObject);
+        LwpDropcapLayout *pLayout = dynamic_cast<LwpDropcapLayout*>(pObject.get());
         if (!pLayout)
             return;
         pLayout->RegisterStyle(pFoundry);
@@ -104,7 +104,7 @@ void LwpFribFrame::RegisterStyle(LwpFoundry* pFoundry)
     else
     {
         //register frame style
-        LwpPlacableLayout* pLayout = dynamic_cast<LwpPlacableLayout*>(pObject);
+        LwpPlacableLayout* pLayout = dynamic_cast<LwpPlacableLayout*>(pObject.get());
         if (!pLayout)
             return;
         pLayout->SetFoundry(pFoundry);
@@ -132,12 +132,12 @@ void LwpFribFrame::RegisterStyle(LwpFoundry* pFoundry)
 }
 void LwpFribFrame::SetParaDropcap(LwpPara* pPara)
 {
-    LwpObject *pObject = m_objLayout.obj();
+    rtl::Reference<LwpObject> pObject = m_objLayout.obj();
 
-    if (pObject && pObject->GetTag() == VO_DROPCAPLAYOUT)
+    if (pObject.is() && pObject->GetTag() == VO_DROPCAPLAYOUT)
     {
         pPara->SetParaDropcap(true);
-        pPara->SetDropcapLayout(dynamic_cast<LwpDropcapLayout*>(pObject));
+        pPara->SetDropcapLayout(dynamic_cast<LwpDropcapLayout*>(pObject.get()));
     }
     else
         pPara->SetParaDropcap(false);
@@ -150,7 +150,7 @@ void LwpFribFrame::SetParaDropcap(LwpPara* pPara)
 void LwpFribFrame::XFConvert(XFContentContainer* pCont)
 {
     XFContentContainer* pXFContentContainer = pCont;
-    LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetLayout());
+    LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetLayout().get());
     if (!pLayout)
         return;
     sal_uInt8 nType = pLayout->GetRelativeType();
@@ -243,7 +243,7 @@ void LwpFribRubyFrame::XFConvert(XFContentContainer* /*pCont*/)
 
 LwpRubyLayout* LwpFribRubyFrame::GetLayout()
 {
-    return dynamic_cast<LwpRubyLayout*>(m_objLayout.obj());
+    return dynamic_cast<LwpRubyLayout*>(m_objLayout.obj().get());
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lotuswordpro/source/filter/lwpfribframe.hxx b/lotuswordpro/source/filter/lwpfribframe.hxx
index f377688..4afcc6d 100644
--- a/lotuswordpro/source/filter/lwpfribframe.hxx
+++ b/lotuswordpro/source/filter/lwpfribframe.hxx
@@ -74,7 +74,7 @@ public:
     LwpFribFrame( LwpPara* pPara) : LwpFrib(pPara){}
     virtual ~LwpFribFrame(){}
     void Read(LwpObjectStream* pObjStrm, sal_uInt16 len) SAL_OVERRIDE;
-    LwpObject* GetLayout();
+    rtl::Reference<LwpObject> GetLayout();
     void RegisterStyle(LwpFoundry* pFoundry) SAL_OVERRIDE;
     void SetParaDropcap(LwpPara* pPara);
     void XFConvert(XFContentContainer* pCont);
diff --git a/lotuswordpro/source/filter/lwpfribmark.cxx b/lotuswordpro/source/filter/lwpfribmark.cxx
index 05874bc..5f30615 100644
--- a/lotuswordpro/source/filter/lwpfribmark.cxx
+++ b/lotuswordpro/source/filter/lwpfribmark.cxx
@@ -94,7 +94,7 @@ void LwpFribCHBlock::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
 
 LwpCHBlkMarker* LwpFribCHBlock::GetMarker()
 {
-    return dynamic_cast<LwpCHBlkMarker*>(m_objMarker.obj());
+    return dynamic_cast<LwpCHBlkMarker*>(m_objMarker.obj().get());
 }
 
 void LwpFribCHBlock::XFConvert(XFContentContainer* pXFPara,LwpStory* pStory)
@@ -147,7 +147,7 @@ void  LwpFribBookMark::RegisterStyle(LwpFoundry* pFoundry)
         LwpObjectID* pID = pDoc->GetDivInfoID();
         if (!pID->IsNull())
         {
-            LwpDivInfo *pDivInvo = dynamic_cast<LwpDivInfo*>(pID->obj(VO_DIVISIONINFO));
+            LwpDivInfo *pDivInvo = dynamic_cast<LwpDivInfo*>(pID->obj(VO_DIVISIONINFO).get());
             if (pDivInvo)
                 sDivision = pDivInvo->GetDivName();
         }
@@ -237,7 +237,7 @@ void LwpFribField::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
 
 LwpFieldMark* LwpFribField::GetMarker()
 {
-    return dynamic_cast<LwpFieldMark*>(m_objMarker.obj());
+    return dynamic_cast<LwpFieldMark*>(m_objMarker.obj().get());
 }
 
 void LwpFribField::XFConvert(XFContentContainer* pXFPara)
@@ -1428,7 +1428,7 @@ LwpFribRubyMarker::LwpFribRubyMarker( LwpPara* pPara )
 
 LwpRubyMarker* LwpFribRubyMarker::GetMarker()
 {
-    return dynamic_cast<LwpRubyMarker*>(m_objMarker.obj(VO_RUBYMARKER));
+    return dynamic_cast<LwpRubyMarker*>(m_objMarker.obj(VO_RUBYMARKER).get());
 }
 
 void LwpFribRubyMarker::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
diff --git a/lotuswordpro/source/filter/lwpfribptr.cxx b/lotuswordpro/source/filter/lwpfribptr.cxx
index 7d6b000..a6a1669 100644
--- a/lotuswordpro/source/filter/lwpfribptr.cxx
+++ b/lotuswordpro/source/filter/lwpfribptr.cxx
@@ -222,7 +222,7 @@ void LwpFribPtr::XFConvert()
         case FRIB_TAG_PAGEBREAK:
         {
             LwpFribPageBreak* pPageBreak = static_cast<LwpFribPageBreak*>(pFrib);
-            LwpPageLayout* pLayout = dynamic_cast<LwpPageLayout*>(pPageBreak->GetLayout()->obj());
+            LwpPageLayout* pLayout = dynamic_cast<LwpPageLayout*>(pPageBreak->GetLayout()->obj().get());
             if(pLayout)
             {
                 pPageBreak->ParseLayout();
@@ -286,8 +286,8 @@ void LwpFribPtr::XFConvert()
         case FRIB_TAG_FRAME:
         {
             LwpFribFrame* frameFrib= static_cast<LwpFribFrame*>(pFrib);
-            LwpObject* pLayout = frameFrib->GetLayout();
-            if (pLayout && pLayout->GetTag() == VO_DROPCAPLAYOUT)
+            rtl::Reference<LwpObject> pLayout = frameFrib->GetLayout();
+            if (pLayout.is() && pLayout->GetTag() == VO_DROPCAPLAYOUT)
                 m_pPara->GetFoundry()->GetDropcapMgr()->SetXFPara(m_pXFPara);
             frameFrib->XFConvert(m_pXFPara);
         }
@@ -397,7 +397,7 @@ void LwpFribPtr::FindLayouts()
                             //StartWithinColume type not support now
                             break;
                         }
-                        LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID()->obj());
+                        LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID()->obj().get());
                         if (pStory)
                             pStory->AddPageLayout(pSection->GetPageLayout());
                     }
@@ -408,10 +408,10 @@ void LwpFribPtr::FindLayouts()
             case FRIB_TAG_PAGEBREAK:
             {
                 LwpFribPageBreak* pPageBreak = static_cast<LwpFribPageBreak*>(pFrib);
-                LwpPageLayout* pLayout = dynamic_cast<LwpPageLayout*>(pPageBreak->GetLayout()->obj());
+                LwpPageLayout* pLayout = dynamic_cast<LwpPageLayout*>(pPageBreak->GetLayout()->obj().get());
                 if(pLayout)
                 {
-                    LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID()->obj());
+                    LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID()->obj().get());
                     if (pStory)
                         pStory->AddPageLayout(pLayout);
                 }
@@ -607,7 +607,7 @@ void LwpFribPtr::ProcessDropcap(LwpStory* pStory,LwpFrib* pFrib,sal_uInt32 nLen)
             XFTextStyle* pFribStyle = pXFStyleManager->FindTextStyle(pFrib->GetStyleName());
             pFribStyle->GetFont()->SetFontSize(0);
 
-            LwpDropcapLayout* pObj = dynamic_cast<LwpDropcapLayout*>(pStory->GetLayoutsWithMe()->GetOnlyLayout()->obj());
+            LwpDropcapLayout* pObj = dynamic_cast<LwpDropcapLayout*>(pStory->GetLayoutsWithMe()->GetOnlyLayout()->obj().get());
             if (pObj)
                 pObj->SetChars(nLen);
         }
@@ -642,7 +642,7 @@ bool LwpFribPtr::ComparePagePosition(LwpVirtualLayout* pPreLayout, LwpVirtualLay
             case FRIB_TAG_PAGEBREAK:
             {
                 LwpFribPageBreak* pPageBreak = static_cast<LwpFribPageBreak*>(pFrib);
-                pLayout = dynamic_cast<LwpVirtualLayout*>(pPageBreak->GetLayout()->obj());
+                pLayout = dynamic_cast<LwpVirtualLayout*>(pPageBreak->GetLayout()->obj().get());
                 break;
             }
             default:
diff --git a/lotuswordpro/source/filter/lwpfribsection.cxx b/lotuswordpro/source/filter/lwpfribsection.cxx
index edd5940..1c9da63 100644
--- a/lotuswordpro/source/filter/lwpfribsection.cxx
+++ b/lotuswordpro/source/filter/lwpfribsection.cxx
@@ -102,7 +102,7 @@ void LwpFribSection::Read(LwpObjectStream *pObjStrm, sal_uInt16 /*len*/)
  */
 LwpSection* LwpFribSection::GetSection()
 {
-    return static_cast<LwpSection*>(m_Section.obj());
+    return static_cast<LwpSection*>(m_Section.obj().get());
 }
 
 /**
@@ -128,7 +128,7 @@ void LwpFribSection::SetSectionName()
     LwpSection* pSection = GetSection();
     if(pSection)
     {
-        LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID()->obj());
+        LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID()->obj().get());
         pStory->SetSectionName(pSection->GetSectionName());
     }
 }
@@ -166,7 +166,7 @@ void LwpFribSection::ParseSection()
     }
     else
     {
-        LwpStory* pStory = static_cast<LwpStory*> ( m_pPara->GetStoryID()->obj() );
+        LwpStory* pStory = static_cast<LwpStory*> ( m_pPara->GetStoryID()->obj().get() );
         if (m_Section.obj()->GetTag() == VO_INDEXSECTION)
         {
             //create a new section and add it to container
@@ -200,7 +200,7 @@ void LwpFribSection::SetDefaultAlphaIndex(XFIndex * pXFIndex)
     LwpFoundry* pFoundry = m_pPara->GetFoundry();
     OUString styleName = pFoundry->FindActuralStyleName("Separator");
 
-    LwpIndexSection* pIndexSection = static_cast<LwpIndexSection*>(m_Section.obj());
+    LwpIndexSection* pIndexSection = static_cast<LwpIndexSection*>(m_Section.obj().get());
     XFIndexTemplate * pTemplateSep = new XFIndexTemplate();
     if (pIndexSection->IsFormatSeparator())
     {
@@ -259,7 +259,7 @@ bool LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
     //if there is no other frib after current firb, register master page in starting para of next page
     if(IsNextPageType()&&(!pFrib->HasNextFrib()))
     {
-        LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID()->obj());
+        LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID()->obj().get());
         pStory->SetCurrentLayout(m_pLayout);
         RegisterFillerPageStyle();
         return false;
@@ -290,7 +290,7 @@ bool LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
         case LwpLayout::StartOnOddPage: //fall throught
         case LwpLayout::StartOnEvenPage:
         {
-            LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID()->obj());
+            LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID()->obj().get());
             pStory->SetCurrentLayout(m_pLayout);
             //get odd page layout when the current pagelayout is mirror
             m_pLayout = pStory->GetCurrentLayout();
@@ -305,7 +305,7 @@ bool LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
     }
 
     //register tab style;
-    LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID()->obj());
+    LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID()->obj().get());
     pStory->SetTabLayout(m_pLayout);
     m_pPara->RegisterTabStyle(pOverStyle);
 
@@ -316,7 +316,7 @@ bool LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
     {
         XFSectionStyle* pSectStyle= new XFSectionStyle();
         //set margin
-        pStory = static_cast<LwpStory*>(m_pPara->GetStoryID()->obj());
+        pStory = static_cast<LwpStory*>(m_pPara->GetStoryID()->obj().get());
         if(pStory)
         {
             LwpPageLayout* pCurrentLayout = pStory->GetCurrentLayout();
@@ -348,7 +348,7 @@ bool LwpMasterPage::IsNeedSection()
 {
     bool bNewSection = false;
     //get story
-    LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID()->obj());
+    LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID()->obj().get());
     //if pagelayout is modified, register the pagelayout
     if(pStory->IsPMModified())
     {
@@ -396,7 +396,7 @@ void LwpMasterPage::ParseSection(LwpFrib* pFrib)
     XFContentContainer* pContent = CreateXFSection();
     if(pContent)
     {
-        LwpStory* pStory = static_cast<LwpStory*> ( m_pPara->GetStoryID()->obj() );
+        LwpStory* pStory = static_cast<LwpStory*> ( m_pPara->GetStoryID()->obj().get() );
         //delete the additional blank para, 06/28/2005
         XFParagraph* pCurrPara = pFribPtr->GetXFPara();
         if(!pCurrPara->HasContents())
@@ -412,7 +412,7 @@ void LwpMasterPage::ParseSection(LwpFrib* pFrib)
     }
     else
     {
-        LwpStory* pStory = static_cast<LwpStory*> ( m_pPara->GetStoryID()->obj() );
+        LwpStory* pStory = static_cast<LwpStory*> ( m_pPara->GetStoryID()->obj().get() );
         pContent = pStory->GetXFContent();
     }
     if(pContent)
diff --git a/lotuswordpro/source/filter/lwpfribtable.cxx b/lotuswordpro/source/filter/lwpfribtable.cxx
index 86b81c3..21f7b81 100644
--- a/lotuswordpro/source/filter/lwpfribtable.cxx
+++ b/lotuswordpro/source/filter/lwpfribtable.cxx
@@ -73,7 +73,7 @@ void LwpFribTable::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
 
 LwpSuperTableLayout* LwpFribTable::GetSuperTable()
 {
-    return static_cast<LwpSuperTableLayout*>(m_objTable.obj());
+    return static_cast<LwpSuperTableLayout*>(m_objTable.obj().get());
 }
 
 void LwpFribTable::RegisterNewStyle()
diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx
index 353a20e..6e88462 100644
--- a/lotuswordpro/source/filter/lwpgrfobj.cxx
+++ b/lotuswordpro/source/filter/lwpgrfobj.cxx
@@ -459,7 +459,7 @@ void LwpGraphicObject::CreateGrafObject()
     // set scale and crop styles
     LwpAssociatedLayouts* pLayoutWithMe = GetLayoutsWithMe();
     LwpFrameLayout* pMyFrameLayout =
-        static_cast<LwpFrameLayout*>(pLayoutWithMe->GetOnlyLayout()->obj(VO_FRAMELAYOUT));
+        static_cast<LwpFrameLayout*>(pLayoutWithMe->GetOnlyLayout()->obj(VO_FRAMELAYOUT).get());
     if (pMyFrameLayout)
     {
         LwpLayoutScale* pMyScale = pMyFrameLayout->GetLayoutScale();
diff --git a/lotuswordpro/source/filter/lwpholder.hxx b/lotuswordpro/source/filter/lwpholder.hxx
index 8e0f94b..6f52ffc 100644
--- a/lotuswordpro/source/filter/lwpholder.hxx
+++ b/lotuswordpro/source/filter/lwpholder.hxx
@@ -75,10 +75,11 @@ class LwpDLVListHeadHolder : public LwpObject
 {
 public:
     LwpDLVListHeadHolder(LwpObjectHeader& objHdr, LwpSvStream* pStrm);
-    virtual ~LwpDLVListHeadHolder(){}
     void Read() SAL_OVERRIDE;
     LwpObjectID* GetHeadID() { return &m_DLVHead;}
 private:
+    virtual ~LwpDLVListHeadHolder(){}
+
     LwpObjectID m_DLVHead;
 };
 /**
@@ -89,12 +90,13 @@ class LwpDLVListHeadTailHolder : public LwpObject
 {
 public:
     LwpDLVListHeadTailHolder(LwpObjectHeader& objHdr, LwpSvStream* pStrm);
-    virtual ~LwpDLVListHeadTailHolder(){}
     void Read() SAL_OVERRIDE;
     LwpObjectID* GetHead(){ return m_HeadTail.GetHead();}
     LwpObjectID* GetTail(){ return m_HeadTail.GetTail();}
 protected:
     LwpDLVListHeadTail m_HeadTail;
+private:
+    virtual ~LwpDLVListHeadTailHolder(){}
 };
 /**
  * @brief   LwpObjectHolder, which is LwpDLVList, contains an id to an object
@@ -104,10 +106,11 @@ class LwpObjectHolder : public LwpDLVList
 {
 public:
     LwpObjectHolder(LwpObjectHeader& objHdr, LwpSvStream* pStrm);
-    virtual ~LwpObjectHolder(){}
     void Read() SAL_OVERRIDE;
     LwpObjectID* GetObject(){return &m_Object;}
 protected:
+    virtual ~LwpObjectHolder(){}
+
     LwpObjectID m_Object;
 };
 
@@ -119,12 +122,13 @@ class LwpListList : public LwpObjectHolder
 {
 public:
     LwpListList(LwpObjectHeader& objHdr, LwpSvStream* pStrm);
-    virtual ~LwpListList(){}
     void Read() SAL_OVERRIDE;
     LwpObjectID* GetHead(){ return m_HeadTail.GetHead();}
     LwpObjectID* GetTail(){ return m_HeadTail.GetTail();}
 protected:
     LwpDLVListHeadTail m_HeadTail;
+private:
+    virtual ~LwpListList(){}
 };
 
 #endif
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index 141cf1f..800b6a4 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -143,7 +143,7 @@ bool LwpVirtualLayout::HonorProtection()
     if(!(m_nAttributes2 & STYLE2_HONORPROTECTION))
         return false;
 
-    LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent()->obj());
+    LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent()->obj().get());
     if(pParent && !pParent->IsHeader())
     {
         return pParent->HonorProtection();
@@ -171,7 +171,7 @@ bool LwpVirtualLayout::IsProtected()
 {
     bool bProtected = (m_nAttributes & STYLE_PROTECTED)!=0;
 
-    LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent()->obj());
+    LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent()->obj().get());
     if(pParent && !pParent->IsHeader())
     {
         if(pParent->HonorProtection()&&(pParent->HasProtection()||bProtected))
@@ -203,7 +203,7 @@ bool LwpVirtualLayout::HasProtection()
     if(m_nAttributes & STYLE_PROTECTED)
         return true;
 
-    LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent()->obj());
+    LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent()->obj().get());
     if(pParent && !pParent->IsHeader())
     {
         return pParent->HasProtection();
@@ -234,7 +234,7 @@ LwpUseWhen* LwpVirtualLayout::GetUseWhen()
     if(GetLayoutType()!=LWP_PAGE_LAYOUT)
     {
         //get parent
-        LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent()->obj());
+        LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent()->obj().get());
         if(pParent && !pParent->IsHeader()&& (pParent->GetLayoutType()!=LWP_PAGE_LAYOUT))
             return pParent->GetUseWhen();
 
@@ -346,7 +346,7 @@ bool LwpVirtualLayout::IsMinimumHeight()
 */
 LwpVirtualLayout* LwpVirtualLayout::GetParentLayout()
 {
-    return dynamic_cast<LwpVirtualLayout*> (GetParent()->obj());
+    return dynamic_cast<LwpVirtualLayout*> (GetParent()->obj().get());
 }
 
 /**
@@ -356,12 +356,12 @@ LwpVirtualLayout* LwpVirtualLayout::GetParentLayout()
 void LwpVirtualLayout::RegisterChildStyle()
 {
     //Register all children styles
-    LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead()->obj());
+    LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead()->obj().get());
     while(pLayout)
     {
         pLayout->SetFoundry(m_pFoundry);
         pLayout->RegisterStyle();
-        pLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext()->obj());
+        pLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext()->obj().get());
     }
 }
 
@@ -375,7 +375,7 @@ bool LwpVirtualLayout::IsStyleLayout()
     if (m_nAttributes3 & STYLE3_STYLELAYOUT)
         return true;
 
-    LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*>(GetParent()->obj());
+    LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*>(GetParent()->obj().get());
     if (pParent)
         return pParent->IsStyleLayout();
     return false;
@@ -391,7 +391,7 @@ LwpVirtualLayout* LwpVirtualLayout::FindChildByType(LWP_LAYOUT_TYPE eType)
 
     while(pID && !pID->IsNull())
     {
-        LwpVirtualLayout * pLayout = dynamic_cast<LwpVirtualLayout *>(pID->obj());
+        LwpVirtualLayout * pLayout = dynamic_cast<LwpVirtualLayout *>(pID->obj().get());
         if(!pLayout)
         {
             break;
@@ -451,30 +451,30 @@ LwpVirtualLayout* LwpAssociatedLayouts::GetLayout(LwpVirtualLayout *pStartLayout
 
     if (!pStartLayout && !m_OnlyLayout.IsNull())
         /* Looking for the first layout and there's only one layout in  the list.*/
-        return dynamic_cast<LwpVirtualLayout*>(m_OnlyLayout.obj());
+        return dynamic_cast<LwpVirtualLayout*>(m_OnlyLayout.obj().get());
 
-    LwpObjectHolder* pObjHolder = dynamic_cast<LwpObjectHolder*>(m_Layouts.GetHead()->obj());
+    LwpObjectHolder* pObjHolder = dynamic_cast<LwpObjectHolder*>(m_Layouts.GetHead()->obj().get());
     if(pObjHolder)
     {
-        pLayout = dynamic_cast<LwpVirtualLayout*>(pObjHolder->GetObject()->obj());
+        pLayout = dynamic_cast<LwpVirtualLayout*>(pObjHolder->GetObject()->obj().get());
         if(!pStartLayout )
             return pLayout;
 
         while(pObjHolder && pStartLayout != pLayout)
         {
-            pObjHolder = dynamic_cast<LwpObjectHolder*>(pObjHolder->GetNext()->obj());
+            pObjHolder = dynamic_cast<LwpObjectHolder*>(pObjHolder->GetNext()->obj().get());
             if(pObjHolder)
             {
-                pLayout = dynamic_cast<LwpVirtualLayout*>(pObjHolder->GetObject()->obj());
+                pLayout = dynamic_cast<LwpVirtualLayout*>(pObjHolder->GetObject()->obj().get());
             }
         }
 
         if(pObjHolder)
         {
-            pObjHolder = dynamic_cast<LwpObjectHolder*>(pObjHolder->GetNext()->obj());
+            pObjHolder = dynamic_cast<LwpObjectHolder*>(pObjHolder->GetNext()->obj().get());
             if(pObjHolder)
             {
-                pLayout = dynamic_cast<LwpVirtualLayout*>(pObjHolder->GetObject()->obj());
+                pLayout = dynamic_cast<LwpVirtualLayout*>(pObjHolder->GetObject()->obj().get());
                 return pLayout;
             }
         }
@@ -501,7 +501,7 @@ void LwpHeadLayout::Read()
 void LwpHeadLayout::RegisterStyle()
 {
     //Register all children styles
-    LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead()->obj());
+    LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead()->obj().get());
     while(pLayout)
     {
         pLayout->SetFoundry(m_pFoundry);
@@ -515,7 +515,7 @@ void LwpHeadLayout::RegisterStyle()
             }
             pLayout->RegisterStyle();
         }
-        LwpVirtualLayout *pNext = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext()->obj());
+        LwpVirtualLayout *pNext = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext()->obj().get());
         if (pNext == pLayout)
         {
             OSL_FAIL("Layout points to itself");
@@ -531,14 +531,14 @@ void LwpHeadLayout::RegisterStyle()
  */
 LwpVirtualLayout* LwpHeadLayout::FindEnSuperTableLayout()
 {
-    LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead()->obj());
+    LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead()->obj().get());
     while(pLayout)
     {
         if(pLayout->GetLayoutType() == LWP_ENDNOTE_SUPERTABLE_LAYOUT)
         {
             return pLayout;
         }
-        pLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext()->obj());
+        pLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext()->obj().get());
     }
     return NULL;
 }
@@ -660,11 +660,11 @@ LwpLayoutGeometry* LwpMiddleLayout::GetGeometry()
 {
     if( !m_LayGeometry.IsNull() )
     {
-        return ( dynamic_cast<LwpLayoutGeometry*> (m_LayGeometry.obj()) );
+        return ( dynamic_cast<LwpLayoutGeometry*> (m_LayGeometry.obj().get()) );
     }
     else if( !m_BasedOnStyle.IsNull() )
     {
-        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() );
         return pLay ? pLay->GetGeometry() : NULL;
     }
     return NULL;
@@ -712,7 +712,7 @@ bool LwpMiddleLayout::MarginsSameAsParent()
     }
     if(!m_BasedOnStyle.IsNull())
     {
-        LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj());
+        LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj().get());
         if (pLay)
             pLay->MarginsSameAsParent();
     }
@@ -731,7 +731,7 @@ double LwpMiddleLayout::GetMarginsValue(const sal_uInt8 &nWhichSide)
     {
         if ( MarginsSameAsParent() )
         {
-            LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent()->obj());
+            LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent()->obj().get());
             if(pParent && !pParent->IsHeader())
             {
                 fValue = pParent->GetMarginsValue(nWhichSide);
@@ -742,14 +742,14 @@ double LwpMiddleLayout::GetMarginsValue(const sal_uInt8 &nWhichSide)
 
     if(m_nOverrideFlag & OVER_MARGINS)
     {
-        LwpLayoutMargins* pMar1 = dynamic_cast<LwpLayoutMargins*> (m_LayMargins.obj());
+        LwpLayoutMargins* pMar1 = dynamic_cast<LwpLayoutMargins*> (m_LayMargins.obj().get());
         if(pMar1)
         {
             fValue = pMar1->GetMargins()->GetMarginsValue(nWhichSide);
             return fValue;
         }
     }
-    LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj());
+    LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj().get());
     if(pStyle)
     {
         fValue = pStyle->GetMarginsValue(nWhichSide);
@@ -768,14 +768,14 @@ double LwpMiddleLayout::GetExtMarginsValue(const sal_uInt8 &nWhichSide)
     double fValue = 0;
     if(m_nOverrideFlag & OVER_MARGINS)
     {
-        LwpLayoutMargins* pMar1 = dynamic_cast<LwpLayoutMargins*> (m_LayMargins.obj());
+        LwpLayoutMargins* pMar1 = dynamic_cast<LwpLayoutMargins*> (m_LayMargins.obj().get());
         if(pMar1)
         {
             fValue = pMar1->GetExtMargins()->GetMarginsValue(nWhichSide);
             return fValue;
         }
     }
-    LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj());
+    LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj().get());
     if(pStyle)
     {
         fValue = pStyle->GetExtMarginsValue(nWhichSide);
@@ -793,12 +793,12 @@ LwpBorderStuff* LwpMiddleLayout::GetBorderStuff()
 {
     if(m_nOverrideFlag & OVER_BORDERS)
     {
-        LwpLayoutBorder* pLayoutBorder = dynamic_cast<LwpLayoutBorder*>(m_LayBorderStuff.obj());
+        LwpLayoutBorder* pLayoutBorder = dynamic_cast<LwpLayoutBorder*>(m_LayBorderStuff.obj().get());
         return pLayoutBorder ? pLayoutBorder->GetBorderStuff() : NULL;
     }
     else if( !m_BasedOnStyle.IsNull() )
     {
-        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() );
         return pLay ? pLay->GetBorderStuff() :  NULL;
     }
     return NULL;
@@ -814,12 +814,12 @@ LwpBackgroundStuff* LwpMiddleLayout::GetBackgroundStuff()
 {
     if(m_nOverrideFlag & OVER_BACKGROUND)
     {
-        LwpLayoutBackground* pLayoutBackground = dynamic_cast<LwpLayoutBackground*>(m_LayBackgroundStuff.obj());
+        LwpLayoutBackground* pLayoutBackground = dynamic_cast<LwpLayoutBackground*>(m_LayBackgroundStuff.obj().get());
         return pLayoutBackground ? pLayoutBackground->GetBackgoudStuff() : NULL;
     }
     else if( !m_BasedOnStyle.IsNull() )
     {
-        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() );
         return pLay ? pLay->GetBackgroundStuff() : NULL;
     }
     return NULL;
@@ -922,14 +922,14 @@ LwpTabOverride* LwpMiddleLayout::GetTabOverride()
     {
         if(!m_TabPiece.IsNull())
         {
-            LwpTabPiece *pPiece = dynamic_cast<LwpTabPiece*>(m_TabPiece.obj());
+            LwpTabPiece *pPiece = dynamic_cast<LwpTabPiece*>(m_TabPiece.obj().get());
             return (LwpTabOverride*)(pPiece ? pPiece->GetOverride() : NULL);
         }
         return NULL;
     }
     else if( !m_BasedOnStyle.IsNull() )
     {
-        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() );
         return pLay ? pLay->GetTabOverride() : NULL;
     }
     return NULL;
@@ -943,62 +943,62 @@ LwpTabOverride* LwpMiddleLayout::GetTabOverride()
 */
 sal_uInt16 LwpMiddleLayout::GetScaleMode(void)
 {
-    if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj())
+    if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is())
         return GetLayoutScale()->GetScaleMode();
-    else if (m_BasedOnStyle.obj())
-        return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj())->GetScaleMode();
+    else if (m_BasedOnStyle.obj().is())
+        return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj().get())->GetScaleMode();
     else
         return (LwpLayoutScale::FIT_IN_FRAME | LwpLayoutScale::MAINTAIN_ASPECT_RATIO);
 }
 
 sal_uInt16 LwpMiddleLayout::GetScaleTile(void)
 {
-    if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj())
+    if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is())
         return (GetLayoutScale()->GetPlacement() & LwpLayoutScale::TILED)
             ? 1 : 0;
-    else if (m_BasedOnStyle.obj())
-        return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj())->GetScaleTile();
+    else if (m_BasedOnStyle.obj().is())
+        return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj().get())->GetScaleTile();
     else
         return 0;
 }
 
 sal_uInt16 LwpMiddleLayout::GetScaleCenter(void)
 {
-    if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj())
+    if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is())
         return (GetLayoutScale()->GetPlacement() & LwpLayoutScale::CENTERED)
             ? 1 : 0;
-    else if (m_BasedOnStyle.obj())
-        return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj())->GetScaleCenter();
+    else if (m_BasedOnStyle.obj().is())
+        return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj().get())->GetScaleCenter();
     else
         return 0;
 }
 
 sal_uInt32 LwpMiddleLayout::GetScalePercentage(void)
 {
-    if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj())
+    if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is())
         return GetLayoutScale()->GetScalePercentage()/10;//m_nScalePercentage 1000 = 100%
-    else if (m_BasedOnStyle.obj())
-        return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj())->GetScalePercentage();
+    else if (m_BasedOnStyle.obj().is())
+        return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj().get())->GetScalePercentage();
     else
         return 100;
 }
 
 double LwpMiddleLayout::GetScaleWidth(void)
 {
-    if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj())
+    if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is())
         return LwpTools::ConvertFromUnits(GetLayoutScale()->GetScaleWidth());
-    else if (m_BasedOnStyle.obj())
-        return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj())->GetScaleWidth();
+    else if (m_BasedOnStyle.obj().is())
+        return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj().get())->GetScaleWidth();
     else
         return 0;
 }
 
 double LwpMiddleLayout::GetScaleHeight(void)
 {
-    if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj())
+    if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is())
         return LwpTools::ConvertFromUnits(GetLayoutScale()->GetScaleHeight());
-    else if (m_BasedOnStyle.obj())
-        return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj())->GetScaleHeight();
+    else if (m_BasedOnStyle.obj().is())
+        return dynamic_cast<LwpMiddleLayout*>(m_BasedOnStyle.obj().get())->GetScaleHeight();
     else
         return 0;
 }
@@ -1053,9 +1053,9 @@ bool LwpMiddleLayout::IsSizeRightToContainer(void)
                         << SHIFT_RIGHT))
         == ((LAY_USEDIRECTION | LAY_TOCONTAINER | LAY_AUTOSIZE) << SHIFT_RIGHT);
     }
-    else if (m_BasedOnStyle.obj())
+    else if (m_BasedOnStyle.obj().is())
     {
-        LwpMiddleLayout * pLayout = dynamic_cast<LwpMiddleLayout *>(m_BasedOnStyle.obj());
+        LwpMiddleLayout * pLayout = dynamic_cast<LwpMiddleLayout *>(m_BasedOnStyle.obj().get());
         return pLayout ? pLayout->IsSizeRightToContainer() : sal_False;
     }
     else
@@ -1072,9 +1072,9 @@ bool LwpMiddleLayout::IsSizeRightToContent(void)
                             << SHIFT_RIGHT))
                 == ((LAY_USEDIRECTION | LAY_AUTOSIZE) << SHIFT_RIGHT);
     }
-    else if (m_BasedOnStyle.obj())
+    else if (m_BasedOnStyle.obj().is())
     {
-        LwpMiddleLayout * pLayout = dynamic_cast<LwpMiddleLayout *>(m_BasedOnStyle.obj());
+        LwpMiddleLayout * pLayout = dynamic_cast<LwpMiddleLayout *>(m_BasedOnStyle.obj().get());
         return pLayout ? pLayout->IsSizeRightToContent() : sal_False;
     }
     else
@@ -1167,7 +1167,7 @@ bool LwpMiddleLayout::IsAutoGrow()
     }
     else if( !m_BasedOnStyle.IsNull() )
     {
-        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() );
         return pLay ? pLay->IsAutoGrow() : sal_False;
     }
     return LwpVirtualLayout::IsAutoGrow();
@@ -1185,7 +1185,7 @@ bool LwpMiddleLayout::IsAutoGrowDown()
     }
     else if( !m_BasedOnStyle.IsNull() )
     {
-        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() );
         return pLay ? pLay->IsAutoGrowDown() : sal_False;
     }
     return LwpVirtualLayout::IsAutoGrowDown();
@@ -1203,7 +1203,7 @@ bool LwpMiddleLayout::IsAutoGrowUp()
     }
     else if( !m_BasedOnStyle.IsNull() )
     {
-        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() );
         return pLay ? pLay->IsAutoGrowUp() : sal_False;
     }
     return LwpVirtualLayout::IsAutoGrowUp();
@@ -1221,7 +1221,7 @@ bool LwpMiddleLayout::IsAutoGrowLeft()
     }
     else if( !m_BasedOnStyle.IsNull() )
     {
-        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() );
         if (pLay)
             return pLay->IsAutoGrowLeft();
     }
@@ -1240,7 +1240,7 @@ bool LwpMiddleLayout::IsAutoGrowRight()
     }
     else if( !m_BasedOnStyle.IsNull() )
     {
-        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() );
         return pLay ? pLay->IsAutoGrowRight() : sal_False;
     }
     return LwpVirtualLayout::IsAutoGrowRight();
@@ -1255,13 +1255,13 @@ sal_uInt8 LwpMiddleLayout::GetContentOrientation()
     //content orientation in Graphic objects and OLE objects not supported now
     if((m_nOverrideFlag & OVER_ROTATION)&& !m_LayGeometry.IsNull())
     {
-        LwpLayoutGeometry* pLayGeometry = dynamic_cast<LwpLayoutGeometry*> (m_LayGeometry.obj());
+        LwpLayoutGeometry* pLayGeometry = dynamic_cast<LwpLayoutGeometry*> (m_LayGeometry.obj().get());
         if (pLayGeometry)
             return pLayGeometry->GetContentOrientation();
     }
     else if( !m_BasedOnStyle.IsNull() )
     {
-        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() );
         if (pLay)
             return pLay->GetContentOrientation();
     }
@@ -1279,7 +1279,7 @@ bool LwpMiddleLayout::HonorProtection()
         if(!(m_nAttributes2 & STYLE2_HONORPROTECTION))
             return false;
 
-        LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent()->obj());
+        LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent()->obj().get());
         if(pParent && !pParent->IsHeader())
         {
             return pParent->HonorProtection();
@@ -1296,7 +1296,7 @@ bool LwpMiddleLayout::HonorProtection()
     }
     else if( !m_BasedOnStyle.IsNull() )
     {
-        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() );
         if (pLay)
             return pLay->HonorProtection();
     }
@@ -1317,13 +1317,13 @@ bool LwpMiddleLayout::IsProtected()
     }
     else if( !m_BasedOnStyle.IsNull() )
     {
-        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() );
         bProtected = pLay ? pLay->IsProtected() : sal_False;
     }
     else
         bProtected = LwpVirtualLayout::IsProtected();
 
-    LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent()->obj());
+    LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent()->obj().get());
     if(pParent && !pParent->IsHeader())
     {
         /* If a parent's protected then none of its children can be accessed. */
@@ -1359,14 +1359,14 @@ bool LwpMiddleLayout::IsProtected()
 */
 LwpVirtualLayout* LwpMiddleLayout::GetWaterMarkLayout()
 {
-    LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*>(GetChildHead()->obj());
+    LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*>(GetChildHead()->obj().get());
     while(pLay)
     {
         if( pLay->IsForWaterMark())
         {
             return pLay;
         }
-        pLay = dynamic_cast<LwpVirtualLayout*> (pLay->GetNext()->obj());
+        pLay = dynamic_cast<LwpVirtualLayout*> (pLay->GetNext()->obj().get());
     }
     return NULL;
 }
@@ -1381,7 +1381,7 @@ XFBGImage* LwpMiddleLayout::GetXFBGImage()
     if(pLay)
     {
         //test BGImage
-        LwpGraphicObject* pGrfObj = dynamic_cast<LwpGraphicObject*>(pLay->GetContent()->obj());
+        LwpGraphicObject* pGrfObj = dynamic_cast<LwpGraphicObject*>(pLay->GetContent()->obj().get());
         if(pGrfObj)
         {
             XFBGImage* pXFBGImage = new XFBGImage();
@@ -1443,7 +1443,7 @@ bool LwpMiddleLayout::GetUsePrinterSettings()
     }
     else if( !m_BasedOnStyle.IsNull() )
     {
-        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj() );
+        LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( m_BasedOnStyle.obj().get() );
         return pLay ? pLay->GetUsePrinterSettings() : sal_False;
     }
     return false;
@@ -1452,8 +1452,8 @@ bool LwpMiddleLayout::GetUsePrinterSettings()
 //Check whether there are contents in the layout
 bool LwpMiddleLayout::HasContent()
 {
-    LwpObject* content = m_Content.obj();
-    if(content)
+    rtl::Reference<LwpObject> content = m_Content.obj();
+    if(content.is())
         return true;
     return false;
 }
@@ -1514,14 +1514,14 @@ sal_uInt16 LwpLayout::GetNumCols()
 {
     if(m_nOverrideFlag & OVER_COLUMNS)
     {
-        LwpLayoutColumns* pLayColumns = dynamic_cast<LwpLayoutColumns*>(m_LayColumns.obj());
+        LwpLayoutColumns* pLayColumns = dynamic_cast<LwpLayoutColumns*>(m_LayColumns.obj().get());
         if(pLayColumns)
         {
             return pLayColumns->GetNumCols();
         }
     }
 
-    LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj());
+    LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj().get());
     if(pStyle)
     {
         return pStyle->GetNumCols();
@@ -1539,14 +1539,14 @@ double LwpLayout::GetColWidth(sal_uInt16 nIndex)
 {
     if((m_nOverrideFlag & OVER_COLUMNS)||(m_nAttributes2 & STYLE2_LOCALCOLUMNINFO))
     {
-        LwpLayoutColumns* pLayColumns = dynamic_cast<LwpLayoutColumns*>(m_LayColumns.obj());
+        LwpLayoutColumns* pLayColumns = dynamic_cast<LwpLayoutColumns*>(m_LayColumns.obj().get());
         if(pLayColumns)
         {
             return pLayColumns->GetColWidth(nIndex);
         }
     }
 
-    LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj());
+    LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj().get());
     if(pStyle)
     {
         return pStyle->GetColWidth(nIndex);
@@ -1564,14 +1564,14 @@ double LwpLayout::GetColGap(sal_uInt16 nIndex)
 {
     if((m_nOverrideFlag & OVER_COLUMNS)||(m_nAttributes2 & STYLE2_LOCALCOLUMNINFO))
     {
-        LwpLayoutColumns* pLayColumns = dynamic_cast<LwpLayoutColumns*>(m_LayColumns.obj());
+        LwpLayoutColumns* pLayColumns = dynamic_cast<LwpLayoutColumns*>(m_LayColumns.obj().get());
         if(pLayColumns)
         {
             return pLayColumns->GetColGap(nIndex);
         }
     }
 
-    LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj());
+    LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*> (m_BasedOnStyle.obj().get());
     if(pStyle)
     {
         return pStyle->GetColGap(nIndex);
@@ -1640,7 +1640,7 @@ XFColumnSep* LwpLayout::GetColumnSep()
 {
 
     //Get LwpLayoutGutters
-    LwpLayoutGutters* pLayoutGutters = dynamic_cast<LwpLayoutGutters*>(m_LayGutterStuff.obj());
+    LwpLayoutGutters* pLayoutGutters = dynamic_cast<LwpLayoutGutters*>(m_LayGutterStuff.obj().get());
     if(!pLayoutGutters)
     {
         return NULL;
@@ -1723,7 +1723,7 @@ sal_uInt16 LwpLayout::GetUsePage()
     }
     else if( !m_BasedOnStyle.IsNull() )
     {
-        LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj() );
+        LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj().get() );
         return pLay ? pLay->GetUsePage() : 0;
     }
     return 0;
@@ -1741,7 +1741,7 @@ LwpUseWhen* LwpLayout::VirtualGetUseWhen()
     }
     else if( !m_BasedOnStyle.IsNull() )
     {
-        LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj() );
+        LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj().get() );
         return pLay ? pLay->VirtualGetUseWhen() : NULL;
     }
     return LwpVirtualLayout::VirtualGetUseWhen();
@@ -1763,7 +1763,7 @@ bool LwpLayout::IsUseOnAllPages()
     }
     else if( !m_BasedOnStyle.IsNull() )
     {
-        LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj() );
+        LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj().get() );
         if (pLay)
             return pLay->IsUseOnAllPages();
     }
@@ -1786,7 +1786,7 @@ bool LwpLayout::IsUseOnAllEvenPages()
     }
     else if( !m_BasedOnStyle.IsNull() )
     {
-        LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj() );
+        LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj().get() );
         if (pLay)
             return pLay->IsUseOnAllEvenPages();
     }
@@ -1809,7 +1809,7 @@ bool LwpLayout::IsUseOnAllOddPages()
     }
     else if( !m_BasedOnStyle.IsNull() )
     {
-        LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj() );
+        LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj().get() );
         if (pLay)
             return pLay->IsUseOnAllOddPages();
     }
@@ -1832,7 +1832,7 @@ bool LwpLayout::IsUseOnPage()
     }
     else if( !m_BasedOnStyle.IsNull() )
     {
-        LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj() );
+        LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj().get() );
         if (pLay)
             return pLay->IsUseOnPage();
     }
@@ -1849,12 +1849,12 @@ LwpShadow* LwpLayout::GetShadow()
 {
     if(m_nOverrideFlag & OVER_SHADOW)
     {
-        LwpLayoutShadow* pLayoutShadow = dynamic_cast<LwpLayoutShadow*>(m_LayShadow.obj());
+        LwpLayoutShadow* pLayoutShadow = dynamic_cast<LwpLayoutShadow*>(m_LayShadow.obj().get());
         return pLayoutShadow ? pLayoutShadow->GetShadow() : NULL;
     }
     else if( !m_BasedOnStyle.IsNull() )
     {
-        LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj() );
+        LwpLayout* pLay = dynamic_cast<LwpLayout*> ( m_BasedOnStyle.obj().get() );
         return pLay ? pLay->GetShadow() : NULL;
     }
     return NULL;
@@ -1923,7 +1923,7 @@ LwpVirtualLayout* LwpLayout::GetContainerLayout()
     if(IsRelativeAnchored())
     {
         //get position
-        LwpPara* pPara = dynamic_cast<LwpPara*>(GetPosition()->obj());
+        LwpPara* pPara = dynamic_cast<LwpPara*>(GetPosition()->obj().get());
         if(pPara)
         {
             LwpStory* pStory = pPara->GetStory();
@@ -2001,7 +2001,7 @@ sal_uInt8 LwpPlacableLayout::GetWrapType()
     }
     else if( !m_BasedOnStyle.IsNull() )
     {
-        LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*> ( m_BasedOnStyle.obj() );
+        LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*> ( m_BasedOnStyle.obj().get() );
         if (pLay)
             return pLay->GetWrapType();
     }
@@ -2019,12 +2019,12 @@ LwpLayoutRelativity* LwpPlacableLayout::GetRelativityPiece()
     {
         if(m_nOverrideFlag & OVER_PLACEMENT)
         {
-            return dynamic_cast<LwpLayoutRelativity*>(m_LayRelativity.obj());
+            return dynamic_cast<LwpLayoutRelativity*>(m_LayRelativity.obj().get());
         }
     }
     else if( !m_BasedOnStyle.IsNull() )
     {
-        LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*> ( m_BasedOnStyle.obj() );
+        LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*> ( m_BasedOnStyle.obj().get() );
         return pLay ? pLay->GetRelativityPiece() : NULL;
     }
     return NULL;
@@ -2066,7 +2066,7 @@ sal_Int32 LwpPlacableLayout::GetBaseLineOffset()
     }
     else if( !m_BasedOnStyle.IsNull() )
     {
-        LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*> ( m_BasedOnStyle.obj() );
+        LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*> ( m_BasedOnStyle.obj().get() );
         return pLay ? pLay->GetBaseLineOffset() : 0;
     }
     return 0;
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
index 073031c..525e9dd 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -301,7 +301,7 @@ public:
     XFBGImage* GetXFBGImage();
     virtual bool GetUsePrinterSettings();
 
-    LwpLayoutScale* GetLayoutScale(){return dynamic_cast<LwpLayoutScale*>(m_LayScale.obj());}
+    LwpLayoutScale* GetLayoutScale(){return dynamic_cast<LwpLayoutScale*>(m_LayScale.obj().get());}
         sal_uInt16 GetScaleMode(void);
     sal_uInt16 GetScaleTile(void);
     sal_uInt16 GetScaleCenter(void);
diff --git a/lotuswordpro/source/filter/lwplaypiece.hxx b/lotuswordpro/source/filter/lwplaypiece.hxx
index 8f53dd8..fbecee1 100644
--- a/lotuswordpro/source/filter/lwplaypiece.hxx
+++ b/lotuswordpro/source/filter/lwplaypiece.hxx
@@ -81,7 +81,6 @@ class LwpLayoutGeometry : public LwpVirtualPiece
 {
 public:
     LwpLayoutGeometry(LwpObjectHeader& objHdr, LwpSvStream* pStrm);
-    virtual ~LwpLayoutGeometry();
     virtual void Parse(IXFStream* pOutputStream) SAL_OVERRIDE;
     sal_Int32 GetWidth() { return m_nWidth; }
     sal_Int32 GetHeight() { return m_nHeight; }
@@ -98,6 +97,8 @@ protected:
     LwpPoint m_AbsoluteOrigin;
     LwpRotor m_ContainerRotor;
     sal_uInt8 m_ContentOrientation;
+private:
+    virtual ~LwpLayoutGeometry();
 };
 
 class LwpLayoutScale : public LwpVirtualPiece
@@ -108,7 +109,6 @@ public:
 
     enum    {CENTERED = 1, TILED = 2};
     LwpLayoutScale(LwpObjectHeader& objHdr, LwpSvStream* pStrm);
-    virtual ~LwpLayoutScale();
     virtual void Parse(IXFStream* pOutputStream) SAL_OVERRIDE;
     sal_uInt16 GetScaleMode(){return m_nScaleMode;}
     sal_uInt32 GetScalePercentage(){return m_nScalePercentage;}
@@ -132,6 +132,8 @@ protected:
     sal_uInt16 m_nContentRotation;
     LwpPoint m_Offset;
     sal_uInt16 m_nPlacement;
+private:
+    virtual ~LwpLayoutScale();
 };
 
 #include "lwpmargins.hxx"
@@ -140,7 +142,6 @@ class LwpLayoutMargins : public LwpVirtualPiece
 {
 public:
     LwpLayoutMargins(LwpObjectHeader& objHdr, LwpSvStream* pStrm);
-    virtual ~LwpLayoutMargins();
     virtual void Parse(IXFStream* pOutputStream) SAL_OVERRIDE;
     LwpMargins* GetMargins() { return &m_Margins; }
     LwpMargins* GetExtMargins(){ return &m_ExtMargins;}
@@ -150,6 +151,8 @@ protected:
     LwpMargins m_Margins;
     LwpMargins m_ExtMargins;
     LwpMargins m_ExtraMargins;
+private:
+    virtual ~LwpLayoutMargins();
 };
 
 #include "lwpborderstuff.hxx"
@@ -157,26 +160,28 @@ class LwpLayoutBorder : public LwpVirtualPiece
 {
 public:
     LwpLayoutBorder(LwpObjectHeader& objHdr, LwpSvStream* pStrm);
-    virtual ~LwpLayoutBorder();
     virtual void Parse(IXFStream* pOutputStream) SAL_OVERRIDE;
     LwpBorderStuff* GetBorderStuff(){ return &m_BorderStuff;}
 protected:
     virtual void Read() SAL_OVERRIDE;
 protected:
     LwpBorderStuff m_BorderStuff;
+private:
+    virtual ~LwpLayoutBorder();
 };
 
 class LwpLayoutBackground : public LwpVirtualPiece
 {
 public:
     LwpLayoutBackground(LwpObjectHeader& objHdr, LwpSvStream* pStrm);
-    virtual ~LwpLayoutBackground();
     virtual void Parse(IXFStream* pOutputStream) SAL_OVERRIDE;
     LwpBackgroundStuff* GetBackgoudStuff(){return &m_BackgroundStuff;}
 protected:
     virtual void Read() SAL_OVERRIDE;
 protected:
     LwpBackgroundStuff m_BackgroundStuff;
+private:
+    virtual ~LwpLayoutBackground();
 };
 
 class LwpExternalBorder
@@ -197,12 +202,13 @@ class LwpLayoutExternalBorder : public LwpVirtualPiece
 {
 public:
     LwpLayoutExternalBorder(LwpObjectHeader& objHdr, LwpSvStream* pStrm);
-    virtual ~LwpLayoutExternalBorder();
     virtual void Parse(IXFStream* pOutputStream) SAL_OVERRIDE;
 protected:
     virtual void Read() SAL_OVERRIDE;
 protected:
     LwpExternalBorder   m_ExtranalBorder;
+private:
+    virtual ~LwpLayoutExternalBorder();
 };
 
 class LwpColumnInfo
@@ -224,7 +230,6 @@ class LwpLayoutColumns : public LwpVirtualPiece
 {
 public:
     LwpLayoutColumns(LwpObjectHeader& objHdr, LwpSvStream* pStrm);
-    virtual ~LwpLayoutColumns();
     virtual void Parse(IXFStream* pOutputStream) SAL_OVERRIDE;
     inline sal_uInt16 GetNumCols(){return m_nNumCols;}
     double GetColWidth(sal_uInt16 nIndex);
@@ -234,19 +239,22 @@ protected:
 protected:
     sal_uInt16 m_nNumCols;
     LwpColumnInfo* m_pColumns;
+private:
+    virtual ~LwpLayoutColumns();
 };
 
 class LwpLayoutGutters : public LwpVirtualPiece
 {
 public:
     LwpLayoutGutters(LwpObjectHeader& objHdr, LwpSvStream* pStrm);
-    virtual ~LwpLayoutGutters();
     virtual void Parse(IXFStream* pOutputStream) SAL_OVERRIDE;
     inline virtual LwpBorderStuff* GetBorderStuff(){return &m_BorderBuffer;}
 protected:
     virtual void Read() SAL_OVERRIDE;
 protected:
     LwpBorderStuff m_BorderBuffer;
+private:
+    virtual ~LwpLayoutGutters();
 };
 
 class LwpJoinStuff
@@ -299,12 +307,13 @@ class LwpLayoutJoins : public LwpVirtualPiece
 {
 public:
     LwpLayoutJoins(LwpObjectHeader& objHdr, LwpSvStream* pStrm);
-    virtual ~LwpLayoutJoins();
     virtual void Parse(IXFStream* pOutputStream) SAL_OVERRIDE;
 protected:
     virtual void Read() SAL_OVERRIDE;
 protected:
     LwpJoinStuff m_JoinStuff;
+private:
+    virtual ~LwpLayoutJoins();
 };
 
 #include "lwpshadow.hxx"
@@ -313,13 +322,14 @@ class LwpLayoutShadow : public LwpVirtualPiece
 {
 public:
     LwpLayoutShadow(LwpObjectHeader& objHdr, LwpSvStream* pStrm);
-    virtual ~LwpLayoutShadow();
     virtual void Parse(IXFStream* pOutputStream) SAL_OVERRIDE;
     LwpShadow* GetShadow(){return &m_Shadow;}
 protected:
     virtual void Read() SAL_OVERRIDE;
 protected:
     LwpShadow m_Shadow;
+private:
+    virtual ~LwpLayoutShadow();
 };
 
 class LwpLayoutRelativityGuts
@@ -373,13 +383,14 @@ class LwpLayoutRelativity: public LwpVirtualPiece
 {
 public:
     LwpLayoutRelativity(LwpObjectHeader& objHdr, LwpSvStream* pStrm);
-    virtual ~LwpLayoutRelativity();
     virtual void Parse(IXFStream* pOutputStream) SAL_OVERRIDE;
     LwpLayoutRelativityGuts* GetRelGuts(){return &m_RelGuts;}
 protected:
     virtual void Read() SAL_OVERRIDE;
 protected:
     LwpLayoutRelativityGuts m_RelGuts;
+private:
+    virtual ~LwpLayoutRelativity();
 };
 
 #endif
diff --git a/lotuswordpro/source/filter/lwpmarker.cxx b/lotuswordpro/source/filter/lwpmarker.cxx
index af334fd..6ef0395 100644
--- a/lotuswordpro/source/filter/lwpmarker.cxx
+++ b/lotuswordpro/source/filter/lwpmarker.cxx
@@ -146,8 +146,8 @@ void LwpCHBlkMarker::Read()
 OUString LwpCHBlkMarker::GetPromptText()
 {
     LwpStory* pStory = NULL;
-    if (m_objPromptStory.obj())
-        pStory = dynamic_cast<LwpStory*>(m_objPromptStory.obj());
+    if (m_objPromptStory.obj().is())
+        pStory = dynamic_cast<LwpStory*>(m_objPromptStory.obj().get());
     if (pStory)
         return pStory->GetContentText();

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list