summaryrefslogtreecommitdiff
path: root/lotuswordpro
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-12-10 12:00:52 +0000
committerAndras Timar <andras.timar@collabora.com>2015-12-21 13:16:01 +0100
commitdca028011e4bc4759e96c6771498a65a1122944f (patch)
tree5b24b2c5eab721edd749c7df1294373ccb1f65b2 /lotuswordpro
parenta793c1673a41b47fdad6817258bd2e39eebe6a0c (diff)
lwp cycle 1 fixes
guard against missing Foundry (cherry picked from commit 92c15e8b299504ef76847cceb5911ef6c7ff26f1) guard against missing grandfather layout (cherry picked from commit f9164c1785432996092d376fb3983e1a3f78dad7) guard against corrupt LwpTocSuperLayout (cherry picked from commit e0dca588239c0902ea90fcdc2b6d0ee2b1525ec2) don't trust that this is what its supposed to be (cherry picked from commit f792baefbfb645eafd5e6b7073bfe6e389d666dc) guard against missing HeadHolder (cherry picked from commit ca868de5e41b45a077949e40ef80f063c362892b) avoid divide by zero (cherry picked from commit 92b936e3ef947cc096b1445455332625900c3024) guard against missing Foundry (cherry picked from commit ed09d4f55d752dbc7d815fdc90e6cbe2656690b7) check is within legal bounds (cherry picked from commit 8410527550ef6db8348e8590eb0c52bccbe40310) don't trust that this is what its supposed to be (cherry picked from commit 9ad6f07e0b5494e55d70642120f173961845ce30) check dynamic casts (cherry picked from commit 54e95789adf05c6852db18b80a549b789a40d6d3) guard against missing Foundry (cherry picked from commit 6093ba6065ea339c5c6de162294eabf0eebe3c80) guard against missing range (cherry picked from commit 1aff042d88b2d6d3c3b7ed9db4b36bed640a0f06) there can be 0 columns (cherry picked from commit 6857a386a4cfe4ddb42515cb00df5bd6648d0964) need dynamic casts here, etc. (cherry picked from commit 46fe3bddebf30775ae19eaa0fefe1d8e2f78eced) add a reference to ensure pPara exists until end of scope (cherry picked from commit 61f55b25c62eaa2714ad8b991edcf54be5e41e0c) this needs to be a dynamic cast (cherry picked from commit 67296edb5c8c7cbb185fe2d31c46eadc5dd927b8) detect infinite recurse in object creation (cherry picked from commit 48c3eb3c91fd98c313bcec18f24cc949d6e788b3) check for null content (cherry picked from commit 4a573e67c67ddf15403a79e7ec8d984d189dc83a) check for null Modifiers (cherry picked from commit 6834384e80cf5cd374cdec471ce385ba2ca94580) guard against broken formula and bad lengths (cherry picked from commit 1e0b9881b4dc7d002d5da767f1476fb1c2147fc7) guard against empty Story (cherry picked from commit ef68438d384ed6dd919fa0f1a3830d2171f8e002) need a dynamic cast here 53rd and final distinct crash fix of this sequence (cherry picked from commit 3735b05668ffcaa37fcecf2907478616db52f2b4) coverity#1341875 Division or modulo by float zero (cherry picked from commit 18952ac1de81b522f5fef36ff922c4a0dc29499d) guard against missing m_pXFContainer (cherry picked from commit 13eaf4dad1324b4f2d909424b2bf06f75102f01f) guard against missing table (cherry picked from commit 0034019480167d50df33865389a6d21e8d5b9cec) guard against empty XFDrawObjects (cherry picked from commit e9801b286b7af0a6043a3a70090a49c5959abe16) this cast needs to be dynamic (cherry picked from commit 8d57f2fb953f031c48892366ce52f6d4fcb9c025) this cast needs to be dynamic (cherry picked from commit 25632b8ffe53dd18faaab2f5c019f7a401ebf579) check all obj().get() casts with dynamic_cast (cherry picked from commit 411dc2058d222a5c2f9b8b159b9384086c9219a5) guard against missing Container Layout (cherry picked from commit dd43c614980ed330936df1abcc484452e1c71a09) guard against null pContent (cherry picked from commit c910e229aa19edd0502aa05dffedc91dd727da6f) guard against infinite recursion (cherry picked from commit 5df326438fd3a5613a52b4de1935426911ff1301) cppcheck: fix memleak in lotuswordpro (cherry picked from commit 6e1efd486dfd5a4bcff1405158c9e40e0c2b6524) infinite recurse protection (cherry picked from commit fb8cba16caa87bf21fdd2747b22d90d913557dac) need more dynamic casts here (cherry picked from commit 5d8449cd14aa3d08929bb25626ab54aa7515f47d) recursion protection (cherry picked from commit 4e6df6de1a95b6b4194cf930cabaae7fde3b6960) protect against missing Foundry (cherry picked from commit ddc7d96a399822c2f29dcaca8222dfb96c383576) guard against missing header rows (cherry picked from commit 2487ba80581d8b0f50be40a26255789e1a050e95) deploy references to keep layout alive long enough (cherry picked from commit 1deae8a2d92747ad69b024513ddae93cc8927d29) use more references to fix life cycles (cherry picked from commit 62a6cadbab6c7bdfbd605c1c75c250904ed10442) use more references to fix life cycles (cherry picked from commit a1426bc54b11eb48fdefaf7e8dfd7996e5c7e4d5) deploy references to keep layout alive long enough (cherry picked from commit fdf122378d5dfa7160fa29eace026424b125e3e4) use more references to fix life cycles (cherry picked from commit 0876868a14c7d139ed2a79ece989c84239a2c853) protect both EnumNamedProperty branches the same way (cherry picked from commit a065eda2383e8d2d8de3cf0a280f6699c05da425) guard against no container layout (cherry picked from commit c6a2df4061de028eb9d7fb752051ecb9f1621fef) guard against invalid Layout Scale (cherry picked from commit c66ed9591217a612c7adc22757ea2b760a716ee3) use more references to fix life cycles (cherry picked from commit a258c3a6503b4fd76ad2b0f705fdd7f472f58c4b) use more references to fix life cycles (cherry picked from commit a23f7b3c14ad0e88264aca197a979aefcc9c0670) use more references to fix life cycles (cherry picked from commit 64cfe976c36cb930e0a96557ba7d9eb99442fc59) hold WaterMarkLayout by reference (cherry picked from commit 80509545cc43893776dd24f441e9b95567ce06db) most casts and checks (cherry picked from commit 01f920f2cece7a05ea075130c19229029efe7c0f) font might be null (cherry picked from commit 00bccc565d1bcd4bd620bb9b33b9f1d07fb5f13e) more use of references to avoid crashing (cherry picked from commit 69d166a0277d21d63b97ffc965d82bb301d55502) more lifecycle protection (cherry picked from commit 012bdecfcd7094403516c98bd5231fe1ef6f7e9d) guard against infinite recursion (cherry picked from commit 76220aafe0bffe20f10b07c725cd096adb56b108) need more References for life cycle fixes here 32nd and final distinct crash fix of this sequence (cherry picked from commit 9550737e5db7415a679aec8a64d6f724962b8750) Change-Id: Id6961e7c35df56ca37d5cb57c2d3d1e03e31dd6d 1282b2c3c920ef89460aa57026d89c8928155116 18648e74d16b932cfa6fbd2057d1e9987c498fd4 f0450bdab2c315a94a75060e1fadf2f8513f9dae c12ee6f4366285fc05fd59b94ec371d8ca013a4a 7d6502c752a7b9f39f94d5cddd5f44240e0b6d04 d15a2692f8aa572c0b5db87f04761ca3eac0249e e3f9e52575436b9505a412b20c7e1b24fa61f6cb 8ae6252039729a1cba8c2fe34f72222c94e3e449 cc3eee0776fb385a5c750293811dec796458a26b 7e76589689d2c9e79a8823d594e8f3ca030e26cf cdb0694b9c1771a475368aeeb4cb11f4ba8b84f3 e367e88df7165d728015a1b3987b220a23203765 578343719d2d7feff51775ff1b073b6584e76f82 0067ead587c25296ab195b80f461fb0766b1899a d606e58292a25309adb67cf05cc9b9a237e83f81 e56eb27bb1827860b2600a5586e866e39cd31518 824c29b39fe1e9e631a21f09611758bea03b0ca9 842122f7e2cba48d4798905f41f63b3e06775d00 ab13d67fdc218c84400a4d84e177e5096bb68379 de44aed9a3189b0fd21a8adc039eb61bd3d3dc14 d170132c2082fd4905192adc840125088ef5da27 3a07361bb66a62533475618c9b50f184d791a799 5c0800c353b46ea1fe359a893bdd8215f70cd809 00bde6564be6fb7c7f6d2ccb1faa7dd94e414635 9deb28a3a5420a43f8604a56145c8274bb4cc8d9 af8e7a46be9c92a7cd11136cb903cc4b9ffe54f5 6d02cc8dc894ef7e2903874b0ab973f7f1b3225d 763aa5874d0c1f977decff88414eea6247f96405 d9525918eab822b39576a1efce7dc3a3bd93e78d a4f2dff9c3cb81bb5056f005b23420cab1ca49e5 7c55986fba87dea0c519f60240605db03262dfe9 15b8aa6b95264d56018fbd5c22bcb0d04e43cf91 7139e67e7b5bcd7e1867dff1cfbd53fa0f5748b7 df84ababeeb109a411c03a18d3a9aa6e136c7ef4 66fda143ba1f0fa6f2638a8bd4936c75a6c40980 e5c0317f842258fe42f894dbace0ea0e328f288a aa28ef00572eb9c4ba3a6d8ae0c668b7b0132f56 670f00b0beb77e5014c3dd4a4798e69ece882b87 b70b5ebc498e6517ef40d0515e69e2e77288c1b5 0c903533542608c1d7a3c97e2be7f2b7624b265b cac22d3c179eca42e01a724f7592ee4b34dd45e3 54931f0dccabb2d9a58cc92ef5ebf3469f93f03c 93669a6460806c1d4c35669a639667b0c6f3f4ab f615c68bfaf145d81dab96b05e7b903c1a6b03cf 84541445e44f14244030b9970e0a48e72edacea7 50fd30114b45d1225adb7bfd5d77cb89a229aac8 83928638a390f434c431487b1cb13633f24de9ec b14639d532da5bffdfe7e0a7bb362b20a7f25dfb 7dc7739ee7b958319ddd4e0cf262254728ef0569 8be1b8298f096791628d1f51d36ceeabdc804f9a d0d9bb1d1abe6f6c9440bf979407d13db49696c4 03748695efbe17d59aba09f88d5c6fcd174113c9 158632de6898685e34d362cc274e959bb5c2e2d7 1b566c835b6cdc733d0aa4393d3b3ce2ff7b764f b9f41091737e66995f332c06083d51408eb1497b clear objects from duplicate ids early Change-Id: I0caab9e329a465e10bf3ed321c55c287371bd437 (cherry picked from commit 480fb6ca369f5a347489414e9d314c802b1ee7aa) Reviewed-on: https://gerrit.libreoffice.org/20698 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com> (cherry picked from commit d1d9e61de393aaa8e08edf8f96f134ba1eea9578)
Diffstat (limited to 'lotuswordpro')
-rw-r--r--lotuswordpro/source/filter/lwpcelllayout.cxx25
-rw-r--r--lotuswordpro/source/filter/lwpcontent.cxx20
-rw-r--r--lotuswordpro/source/filter/lwpcontent.hxx2
-rw-r--r--lotuswordpro/source/filter/lwpdivinfo.cxx4
-rw-r--r--lotuswordpro/source/filter/lwpdoc.cxx72
-rw-r--r--lotuswordpro/source/filter/lwpdoc.hxx23
-rw-r--r--lotuswordpro/source/filter/lwpfnlayout.cxx12
-rw-r--r--lotuswordpro/source/filter/lwpfootnote.cxx6
-rw-r--r--lotuswordpro/source/filter/lwpfoundry.cxx42
-rw-r--r--lotuswordpro/source/filter/lwpframelayout.cxx104
-rw-r--r--lotuswordpro/source/filter/lwpfrib.cxx2
-rw-r--r--lotuswordpro/source/filter/lwpfribbreaks.cxx9
-rw-r--r--lotuswordpro/source/filter/lwpfribframe.cxx6
-rw-r--r--lotuswordpro/source/filter/lwpfribsection.cxx43
-rw-r--r--lotuswordpro/source/filter/lwpfribtable.cxx12
-rw-r--r--lotuswordpro/source/filter/lwpgrfobj.cxx6
-rw-r--r--lotuswordpro/source/filter/lwplayout.cxx413
-rw-r--r--lotuswordpro/source/filter/lwplayout.hxx51
-rw-r--r--lotuswordpro/source/filter/lwpnotes.cxx6
-rw-r--r--lotuswordpro/source/filter/lwpobjfactory.cxx14
-rw-r--r--lotuswordpro/source/filter/lwpobjfactory.hxx3
-rw-r--r--lotuswordpro/source/filter/lwpoleobject.cxx6
-rw-r--r--lotuswordpro/source/filter/lwppagelayout.cxx32
-rw-r--r--lotuswordpro/source/filter/lwppara.cxx24
-rw-r--r--lotuswordpro/source/filter/lwppara1.cxx8
-rw-r--r--lotuswordpro/source/filter/lwpparaproperty.cxx4
-rw-r--r--lotuswordpro/source/filter/lwpparastyle.cxx3
-rw-r--r--lotuswordpro/source/filter/lwpproplist.cxx11
-rw-r--r--lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx16
-rw-r--r--lotuswordpro/source/filter/lwpstory.cxx152
-rw-r--r--lotuswordpro/source/filter/lwpstory.hxx2
-rw-r--r--lotuswordpro/source/filter/lwptable.hxx5
-rw-r--r--lotuswordpro/source/filter/lwptablelayout.cxx113
-rw-r--r--lotuswordpro/source/filter/lwptblcell.cxx2
-rw-r--r--lotuswordpro/source/filter/lwptblcell.hxx2
-rw-r--r--lotuswordpro/source/filter/lwptblformula.cxx19
-rw-r--r--lotuswordpro/source/filter/lwptoc.cxx23
-rw-r--r--lotuswordpro/source/filter/tocread.cxx2
-rw-r--r--lotuswordpro/source/filter/xfilter/xfcell.cxx4
-rw-r--r--lotuswordpro/source/filter/xfilter/xftable.cxx12
-rw-r--r--lotuswordpro/source/filter/xfilter/xftable.hxx2
41 files changed, 754 insertions, 563 deletions
diff --git a/lotuswordpro/source/filter/lwpcelllayout.cxx b/lotuswordpro/source/filter/lwpcelllayout.cxx
index 13d7307cf8f1..404c4e7d312f 100644
--- a/lotuswordpro/source/filter/lwpcelllayout.cxx
+++ b/lotuswordpro/source/filter/lwpcelllayout.cxx
@@ -328,7 +328,7 @@ XFCell* LwpCellLayout::ConvertCell(LwpObjectID aTableID, sal_uInt16 nRow, sal_uI
// we should judt its style by current position
if (pTable->GetDefaultCellStyle() == GetObjectID())
{
- aStyleName = GetCellStyleName(nRow, nCol, pTable->GetTableLayout());
+ aStyleName = GetCellStyleName(nRow, nCol, pTable->GetTableLayout().get());
}
// content of cell
@@ -423,10 +423,7 @@ LwpObjectID * LwpCellLayout::GetPreviousCellStory()
LwpCellBorderType LwpCellLayout::GetCellBorderType(sal_uInt16 nRow, sal_uInt16 nCol, LwpTableLayout * pTableLayout)
{
if (!pTableLayout)
- {
- assert(false);
return enumWholeBorder;
- }
// get left cell and judge if neighbour border is different
XFBorders * pBorders = GetXFBorders();
@@ -572,8 +569,8 @@ void LwpCellLayout::RegisterDefaultCell()
*/
void LwpCellLayout::RegisterStyle()
{
- LwpVirtualLayout * pParent = dynamic_cast<LwpVirtualLayout *>(GetParent().obj().get());
- if (!pParent || pParent->GetLayoutType() != LWP_ROW_LAYOUT)
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout *>(GetParent().obj().get()));
+ if (!xParent.is() || xParent->GetLayoutType() != LWP_ROW_LAYOUT)
{
// default cell layout, we must register 4 styles for it
RegisterDefaultCell();
@@ -650,7 +647,7 @@ void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID)
{
bool bProtected = false;
// judge current cell
- if (IsProtected())
+ if (GetIsProtected())
{
bProtected = true;
}
@@ -658,7 +655,7 @@ void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID)
{
// judge base on
LwpCellLayout * pBase = dynamic_cast<LwpCellLayout *>(GetBasedOnStyle().get());
- if (pBase && pBase->IsProtected())
+ if (pBase && pBase->GetIsProtected())
{
bProtected = true;
}
@@ -666,9 +663,9 @@ void LwpCellLayout::ApplyProtect(XFCell * pCell, LwpObjectID aTableID)
{
// judge whole table
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())
+ rtl::Reference<LwpTableLayout> xTableLayout(pTable ? pTable->GetTableLayout() : nullptr);
+ LwpSuperTableLayout * pSuper = xTableLayout.is() ? xTableLayout->GetSuperTableLayout() : nullptr;
+ if (pSuper && pSuper->GetIsProtected())
{
bProtected = true;
}
@@ -764,7 +761,11 @@ LwpCellBorderType LwpConnectedCellLayout::GetCellBorderType(sal_uInt16 nRow, sal
}
}
- if ( (nRow + nRowSpan) == pTableLayout->GetTable()->GetRow() )
+ LwpTable* pTable = pTableLayout->GetTable();
+ if (!pTable)
+ throw std::runtime_error("missing table");
+
+ if ( (nRow + nRowSpan) == pTable->GetRow())
{
bNoBottomBorder = false;
}
diff --git a/lotuswordpro/source/filter/lwpcontent.cxx b/lotuswordpro/source/filter/lwpcontent.cxx
index 77ae0d3ad9cb..17be69bfca4c 100644
--- a/lotuswordpro/source/filter/lwpcontent.cxx
+++ b/lotuswordpro/source/filter/lwpcontent.cxx
@@ -125,17 +125,20 @@ void LwpContent::Read()
pStrm->SkipExtra();
}
-LwpVirtualLayout* LwpContent::GetLayout(LwpVirtualLayout* pStartLayout)
+rtl::Reference<LwpVirtualLayout> LwpContent::GetLayout(LwpVirtualLayout* pStartLayout)
{
return m_LayoutsWithMe.GetLayout(pStartLayout);
}
bool LwpContent::HasNonEmbeddedLayouts()
{
- LwpVirtualLayout* pLayout = NULL;
- while( (pLayout = GetLayout(pLayout)) )
+ rtl::Reference<LwpVirtualLayout> xLayout;
+ while (true)
{
- if(!pLayout->NoContentReference())
+ xLayout = GetLayout(xLayout.get());
+ if (!xLayout.is())
+ break;
+ if (!xLayout->NoContentReference())
return true;
}
return false;
@@ -143,10 +146,13 @@ bool LwpContent::HasNonEmbeddedLayouts()
bool LwpContent::IsStyleContent()
{
- LwpVirtualLayout* pLayout = NULL;
- while( (pLayout = GetLayout(pLayout)) )
+ rtl::Reference<LwpVirtualLayout> xLayout;
+ while (true)
{
- if(pLayout->IsStyleLayout())
+ xLayout = GetLayout(xLayout.get());
+ if (!xLayout.is())
+ break;
+ if (xLayout->IsStyleLayout())
return true;
}
return false;
diff --git a/lotuswordpro/source/filter/lwpcontent.hxx b/lotuswordpro/source/filter/lwpcontent.hxx
index cd85bd5b1893..b0900c2377b4 100644
--- a/lotuswordpro/source/filter/lwpcontent.hxx
+++ b/lotuswordpro/source/filter/lwpcontent.hxx
@@ -110,7 +110,7 @@ protected:
void Read() SAL_OVERRIDE;
public:
inline LwpAssociatedLayouts& GetLayoutsWithMe();
- LwpVirtualLayout* GetLayout(LwpVirtualLayout* pStartLayout);
+ rtl::Reference<LwpVirtualLayout> GetLayout(LwpVirtualLayout* pStartLayout);
inline bool IsActive();
virtual bool IsTable();
inline OUString GetClassName();
diff --git a/lotuswordpro/source/filter/lwpdivinfo.cxx b/lotuswordpro/source/filter/lwpdivinfo.cxx
index 2e975875a8ff..11d4f0e559d4 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().get());
+ LwpDLVListHeadTailHolder* pHeadTail = dynamic_cast<LwpDLVListHeadTailHolder*>(pDiv->GetPageHintsID().obj().get());
if(pHeadTail)
{
- LwpPageHint* pPageHint =static_cast<LwpPageHint*>(pHeadTail->GetTail().obj().get());
+ LwpPageHint* pPageHint = dynamic_cast<LwpPageHint*>(pHeadTail->GetTail().obj().get());
if(pPageHint && !pPageHint->GetPageLayoutID().IsNull())
{
return pPageHint->GetPageNumber();
diff --git a/lotuswordpro/source/filter/lwpdoc.cxx b/lotuswordpro/source/filter/lwpdoc.cxx
index a0dc5303d035..29a359b2249e 100644
--- a/lotuswordpro/source/filter/lwpdoc.cxx
+++ b/lotuswordpro/source/filter/lwpdoc.cxx
@@ -70,7 +70,8 @@
LwpDocument::LwpDocument(LwpObjectHeader& objHdr, LwpSvStream* pStrm)
: LwpDLNFPVList(objHdr, pStrm)
- , m_pOwnedFoundry(NULL)
+ , m_pOwnedFoundry(nullptr)
+ , m_bGettingFirstDivisionWithContentsThatIsNotOLE(false)
, m_nFlags(0)
, m_nPersistentFlags(0)
, m_pLnOpts(NULL)
@@ -233,7 +234,9 @@ void LwpDocument::RegisterStyle()
void LwpDocument::RegisterTextStyles()
{
//Register all text styles: para styles, character styles
- LwpDLVListHeadHolder* pParaStyleHolder = dynamic_cast<LwpDLVListHeadHolder*>(m_pFoundry->GetTextStyleHead().obj().get());
+ LwpDLVListHeadHolder* pParaStyleHolder = m_pFoundry
+ ? dynamic_cast<LwpDLVListHeadHolder*>(m_pFoundry->GetTextStyleHead().obj().get())
+ : nullptr;
if(pParaStyleHolder)
{
LwpTextStyle* pParaStyle = dynamic_cast<LwpTextStyle*> (pParaStyleHolder->GetHeadID().obj().get());
@@ -252,12 +255,15 @@ void LwpDocument::RegisterTextStyles()
*/
void LwpDocument::RegisterLayoutStyles()
{
- //Register all layout styles, before register all styles in para
- m_pFoundry->RegisterAllLayouts();
+ if (m_pFoundry)
+ {
+ //Register all layout styles, before register all styles in para
+ m_pFoundry->RegisterAllLayouts();
+ }
//set initial pagelayout in story for parsing pagelayout
LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*> (m_DivInfo.obj( VO_DIVISIONINFO).get());
- if(pDivInfo)
+ if (pDivInfo)
{
LwpPageLayout* pPageLayout = dynamic_cast<LwpPageLayout*>(pDivInfo->GetInitialLayoutID().obj(VO_PAGELAYOUT).get());
if(pPageLayout)
@@ -279,16 +285,18 @@ void LwpDocument::RegisterLayoutStyles()
void LwpDocument::RegisterStylesInPara()
{
//Register all automatic styles in para
- LwpHeadContent* pContent = dynamic_cast<LwpHeadContent*> (m_pFoundry->GetContentManager().GetContentList().obj().get());
- if(pContent)
+ rtl::Reference<LwpHeadContent> xContent(m_pFoundry
+ ? dynamic_cast<LwpHeadContent*> (m_pFoundry->GetContentManager().GetContentList().obj().get())
+ : nullptr);
+ if (xContent.is())
{
- LwpStory* pStory = dynamic_cast<LwpStory*>(pContent->GetChildHead().obj(VO_STORY).get());
- while(pStory)
+ rtl::Reference<LwpStory> xStory(dynamic_cast<LwpStory*>(xContent->GetChildHead().obj(VO_STORY).get()));
+ while (xStory.is())
{
//Register the child para
- pStory->SetFoundry(m_pFoundry);
- pStory->RegisterStyle();
- pStory = dynamic_cast<LwpStory*>(pStory->GetNext().obj(VO_STORY).get());
+ xStory->SetFoundry(m_pFoundry);
+ xStory->DoRegisterStyle();
+ xStory.set(dynamic_cast<LwpStory*>(xStory->GetNext().obj(VO_STORY).get()));
}
}
}
@@ -297,19 +305,20 @@ void LwpDocument::RegisterStylesInPara()
*/
void LwpDocument::RegisterBulletStyles()
{
+ if (!m_pFoundry)
+ return;
//Register bullet styles
LwpDLVListHeadHolder* mBulletHead = dynamic_cast<LwpDLVListHeadHolder*>
(m_pFoundry->GetBulletManagerID().obj(VO_HEADHOLDER).get());
- if( mBulletHead )
+ if (!mBulletHead)
+ return;
+ LwpSilverBullet* pBullet = dynamic_cast<LwpSilverBullet*>
+ (mBulletHead->GetHeadID().obj().get());
+ while(pBullet)
{
- LwpSilverBullet* pBullet = dynamic_cast<LwpSilverBullet*>
- (mBulletHead->GetHeadID().obj().get());
- while(pBullet)
- {
- pBullet->SetFoundry(m_pFoundry);
- pBullet->RegisterStyle();
- pBullet = dynamic_cast<LwpSilverBullet*> (pBullet->GetNext().obj().get());
- }
+ pBullet->SetFoundry(m_pFoundry);
+ pBullet->RegisterStyle();
+ pBullet = dynamic_cast<LwpSilverBullet*> (pBullet->GetNext().obj().get());
}
}
/**
@@ -317,13 +326,14 @@ void LwpDocument::RegisterBulletStyles()
*/
void LwpDocument::RegisterGraphicsStyles()
{
+ if (!m_pFoundry)
+ return;
//Register all graphics styles, the first object should register the next;
rtl::Reference<LwpObject> pGraphic = m_pFoundry->GetGraphicListHead().obj(VO_GRAPHIC);
- if(pGraphic.is())
- {
- pGraphic->SetFoundry(m_pFoundry);
- pGraphic->DoRegisterStyle();
- }
+ if (!pGraphic.is())
+ return;
+ pGraphic->SetFoundry(m_pFoundry);
+ pGraphic->DoRegisterStyle();
}
/**
* @descr Register line number styles
@@ -610,7 +620,7 @@ LwpDocument* LwpDocument::GetPreviousDivision()
/**
* @descr Get first division with contents that is not ole, copy from lwp-source code
*/
- LwpDocument* LwpDocument::GetFirstDivisionWithContentsThatIsNotOLE()
+ LwpDocument* LwpDocument::ImplGetFirstDivisionWithContentsThatIsNotOLE()
{
LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*>(GetDivInfoID().obj().get());
if(pDivInfo && pDivInfo->HasContents()
@@ -619,7 +629,7 @@ LwpDocument* LwpDocument::GetPreviousDivision()
LwpDocument* pDivision = GetFirstDivision();
- while (pDivision && pDivision != this)
+ while (pDivision)
{
LwpDocument* pContentDivision = pDivision->GetFirstDivisionWithContentsThatIsNotOLE();
if(pContentDivision)
@@ -637,7 +647,7 @@ LwpDocument* LwpDocument::GetPreviousDivision()
LwpDocument *pLastDoc = pRoot ? pRoot->GetLastDivisionWithContents() : nullptr;
while (pLastDoc)
{
- if(pLastDoc->GetEnSuperTableLayout())
+ if (pLastDoc->GetEnSuperTableLayout().is())
return pLastDoc;
pLastDoc = pLastDoc->GetPreviousDivisionWithContents();
}
@@ -647,14 +657,14 @@ LwpDocument* LwpDocument::GetPreviousDivision()
/**
* @descr Get endnote supertable layout, every division has only one endnote supertable layout.
*/
- LwpVirtualLayout* LwpDocument::GetEnSuperTableLayout()
+rtl::Reference<LwpVirtualLayout> LwpDocument::GetEnSuperTableLayout()
{
LwpHeadLayout* pHeadLayout = dynamic_cast<LwpHeadLayout*>(GetFoundry()->GetLayout().obj().get());
if(pHeadLayout)
{
return pHeadLayout->FindEnSuperTableLayout();
}
- return NULL;
+ return rtl::Reference<LwpVirtualLayout>();
}
/**
diff --git a/lotuswordpro/source/filter/lwpdoc.hxx b/lotuswordpro/source/filter/lwpdoc.hxx
index 31b9338dbfc9..91ac419cfa43 100644
--- a/lotuswordpro/source/filter/lwpdoc.hxx
+++ b/lotuswordpro/source/filter/lwpdoc.hxx
@@ -89,6 +89,7 @@ public:
private:
LwpFoundry* m_pOwnedFoundry;
+ bool m_bGettingFirstDivisionWithContentsThatIsNotOLE;
//Data members in file format
LwpObjectID m_DocSockID;
@@ -137,8 +138,7 @@ public:
void RegisterStyle() SAL_OVERRIDE;
inline bool IsChildDoc();
- inline bool HonorProtection();
- inline LwpObjectID& GetContentList();
+ inline bool GetHonorProtection();
inline LwpObjectID& GetDocData();
inline LwpObjectID& GetSocket();
@@ -160,12 +160,20 @@ public:
LwpDocument* GetLastDivisionWithContents();
LwpDocument* GetLastInGroupWithContents();
LwpDocument* GetRootDocument();
- LwpDocument* GetFirstDivisionWithContentsThatIsNotOLE();
+ LwpDocument* GetFirstDivisionWithContentsThatIsNotOLE()
+ {
+ if (m_bGettingFirstDivisionWithContentsThatIsNotOLE)
+ throw std::runtime_error("recursion in page divisions");
+ m_bGettingFirstDivisionWithContentsThatIsNotOLE = true;
+ LwpDocument* pRet = ImplGetFirstDivisionWithContentsThatIsNotOLE();
+ m_bGettingFirstDivisionWithContentsThatIsNotOLE = false;
+ return pRet;
+ }
LwpDocument* GetLastDivisionThatHasEndnote();
LwpDocument* GetLastDivision();
LwpDocument* GetFirstDivision();
- LwpVirtualLayout* GetEnSuperTableLayout();
+ rtl::Reference<LwpVirtualLayout> GetEnSuperTableLayout();
bool GetNumberOfPages(LwpDocument* pEndDivision, sal_uInt16& nCount);
sal_uInt16 GetNumberOfPagesBefore();
@@ -173,6 +181,7 @@ public:
private:
void MaxNumberOfPages(sal_uInt16& nNumPages);
+ LwpDocument* ImplGetFirstDivisionWithContentsThatIsNotOLE();
void XFConvertFrameInPage(XFContentContainer* pCont);
static void ChangeStyleName();
bool IsSkippedDivision();
@@ -182,14 +191,10 @@ inline bool LwpDocument::IsChildDoc()
{
return (m_nPersistentFlags & DOC_CHILDDOC) != 0;
}
-inline bool LwpDocument::HonorProtection()
+inline bool LwpDocument::GetHonorProtection()
{
return (m_nPersistentFlags & DOC_PROTECTED) != 0;
}
-inline LwpObjectID& LwpDocument::GetContentList()
-{
- return m_pFoundry->GetContentManager().GetContentList();
-}
inline LwpObjectID& LwpDocument::GetSocket()
{
return m_DocSockID;
diff --git a/lotuswordpro/source/filter/lwpfnlayout.cxx b/lotuswordpro/source/filter/lwpfnlayout.cxx
index e02c59736c3d..d50cc0ec7f93 100644
--- a/lotuswordpro/source/filter/lwpfnlayout.cxx
+++ b/lotuswordpro/source/filter/lwpfnlayout.cxx
@@ -119,14 +119,14 @@ void LwpFnRowLayout::RegisterStyle()
{
// register cells' style
LwpObjectID& rCellID = GetChildHead();
- LwpCellLayout * pCellLayout = static_cast<LwpCellLayout *>(rCellID.obj().get());
+ LwpCellLayout * pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get());
while(pCellLayout)
{
pCellLayout->SetFoundry(m_pFoundry);
pCellLayout->RegisterStyle();
rCellID = pCellLayout->GetNext();
- pCellLayout = static_cast<LwpCellLayout *>(rCellID.obj().get());
+ pCellLayout = dynamic_cast<LwpCellLayout *>(rCellID.obj().get());
}
}
@@ -199,14 +199,14 @@ void LwpEndnoteLayout::RegisterStyle()
{
// register style of rows
LwpObjectID& rRowID = GetChildHead();
- LwpRowLayout * pRowLayout = static_cast<LwpRowLayout *>(rRowID.obj().get());
+ LwpRowLayout * pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get());
while (pRowLayout)
{
pRowLayout->SetFoundry(m_pFoundry);
pRowLayout->RegisterStyle();
rRowID = pRowLayout->GetNext();
- pRowLayout = static_cast<LwpRowLayout *>(rRowID.obj().get());
+ pRowLayout = dynamic_cast<LwpRowLayout *>(rRowID.obj().get());
}
}
@@ -262,7 +262,7 @@ void LwpEnSuperTableLayout::XFConvert(XFContentContainer * /*pCont*/)
while(!rID.IsNull())
{
- LwpVirtualLayout * pLayout = static_cast<LwpVirtualLayout *>(rID.obj().get());
+ LwpVirtualLayout * pLayout = dynamic_cast<LwpVirtualLayout*>(rID.obj().get());
if(!pLayout)
{
break;
@@ -318,7 +318,7 @@ LwpVirtualLayout* LwpFnSuperTableLayout::GetMainTableLayout()
while(!rID.IsNull())
{
- LwpVirtualLayout * pLayout = static_cast<LwpVirtualLayout *>(rID.obj().get());
+ LwpVirtualLayout * pLayout = dynamic_cast<LwpVirtualLayout *>(rID.obj().get());
if(!pLayout)
{
break;
diff --git a/lotuswordpro/source/filter/lwpfootnote.cxx b/lotuswordpro/source/filter/lwpfootnote.cxx
index 86c69ffd69af..0964edae2154 100644
--- a/lotuswordpro/source/filter/lwpfootnote.cxx
+++ b/lotuswordpro/source/filter/lwpfootnote.cxx
@@ -206,7 +206,7 @@ LwpCellLayout* LwpFootnote::GetCellLayout()
LwpEnSuperTableLayout* pEnSuperLayout = FindFootnoteTableLayout();
if(pEnSuperLayout)
{
- LwpTableLayout* pTableLayout = static_cast<LwpTableLayout*>(pEnSuperLayout->GetMainTableLayout());
+ LwpTableLayout* pTableLayout = dynamic_cast<LwpTableLayout*>(pEnSuperLayout->GetMainTableLayout());
if(pTableLayout)
{
LwpRowLayout* pRowLayout = pTableLayout->GetRowLayout(m_nRow);
@@ -372,7 +372,7 @@ LwpEnSuperTableLayout* LwpFootnote::FindFootnoteTableLayout()
while ((pContent = pFoundry->EnumContents(pContent)) != NULL)
if (pContent->IsTable() && (strClassName.equals(pContent->GetClassName())) &&
- pContent->IsActive() && pContent->GetLayout(NULL))
+ pContent->IsActive() && pContent->GetLayout(nullptr).is())
{
// Found it!
return static_cast<LwpEnSuperTableLayout *>(
@@ -390,7 +390,7 @@ LwpContent* LwpFootnote::FindFootnoteContent()
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))
+ if (pContent && pContent->GetLayout(nullptr).is())
return pContent;
LwpCellLayout* pCellLayout = GetCellLayout();
diff --git a/lotuswordpro/source/filter/lwpfoundry.cxx b/lotuswordpro/source/filter/lwpfoundry.cxx
index 3e2609fd0daa..1d44e180cb05 100644
--- a/lotuswordpro/source/filter/lwpfoundry.cxx
+++ b/lotuswordpro/source/filter/lwpfoundry.cxx
@@ -233,18 +233,21 @@ void LwpFoundry::RegisterAllLayouts()
LwpBookMark* LwpFoundry::GetBookMark(LwpObjectID objMarker)
{
- LwpDLVListHeadHolder* pHeadHolder= static_cast
+ LwpDLVListHeadHolder* pHeadHolder= dynamic_cast
<LwpDLVListHeadHolder*>(m_BookMarkHead.obj().get());
+
+ if (!pHeadHolder)
+ return nullptr;
+
LwpObjectID& rObjID = pHeadHolder->GetHeadID();
- LwpBookMark* pBookMark;
- pBookMark = static_cast<LwpBookMark*>(rObjID.obj().get());
+ LwpBookMark* pBookMark = dynamic_cast<LwpBookMark*>(rObjID.obj().get());
while (pBookMark)
{
if (pBookMark->IsRightMarker(objMarker))
return pBookMark;
rObjID = pBookMark->GetNext();
- pBookMark = static_cast<LwpBookMark*>(rObjID.obj().get());
+ pBookMark = dynamic_cast<LwpBookMark*>(rObjID.obj().get());
}
return NULL;
}
@@ -273,7 +276,7 @@ LwpSection* LwpFoundry::EnumSections(LwpSection * pSection)
*/
LwpObjectID * LwpFoundry::GetDefaultTextStyle()
{
- LwpVersionedPointer * pPointer = static_cast<LwpVersionedPointer *>(m_DefaultTextStyle.obj().get());
+ LwpVersionedPointer * pPointer = dynamic_cast<LwpVersionedPointer *>(m_DefaultTextStyle.obj().get());
if (!pPointer)
return NULL;
@@ -287,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().get());
+ LwpDLVListHeadHolder* pParaStyleHolder = dynamic_cast<LwpDLVListHeadHolder*>(GetTextStyleHead().obj().get());
if(pParaStyleHolder)
{
- LwpTextStyle* pParaStyle = static_cast<LwpTextStyle*> (pParaStyleHolder->GetHeadID().obj().get());
+ LwpTextStyle* pParaStyle = dynamic_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().get());
+ pParaStyle = dynamic_cast<LwpTextStyle*>(pParaStyle->GetNext().obj().get());
}
}
@@ -405,8 +408,8 @@ LwpContent* LwpContentManager::EnumContents(LwpContent* pContent)
{
if(pContent)
return pContent->GetNextEnumerated();
- LwpVersionedPointer* pPointer = static_cast<LwpVersionedPointer*>(m_EnumHead.obj().get());
- return pPointer ? static_cast<LwpContent*>(pPointer->GetPointer().obj().get()) : NULL;
+ LwpVersionedPointer* pPointer = dynamic_cast<LwpVersionedPointer*>(m_EnumHead.obj().get());
+ return pPointer ? dynamic_cast<LwpContent*>(pPointer->GetPointer().obj().get()) : nullptr;
}
void LwpPieceManager::Read(LwpObjectStream *pStrm)
@@ -457,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().get());
+ return dynamic_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().get());
+ pList = dynamic_cast<LwpListList*>(pLast->GetListList().obj().get());
pList= GetNextActiveListList(pList);
}
else
@@ -475,7 +478,7 @@ LwpOrderedObject* LwpOrderedObjectManager::Enumerate(LwpOrderedObject * pLast)
if(pList)
{
- return static_cast<LwpOrderedObject*>(pList->GetHead().obj().get());
+ return dynamic_cast<LwpOrderedObject*>(pList->GetHead().obj().get());
}
return NULL;
@@ -489,23 +492,22 @@ LwpListList* LwpOrderedObjectManager::GetNextActiveListList(LwpListList * pLast)
{
LwpListList* pList = NULL;
if(pLast)
- pList = static_cast<LwpListList*>(pLast->GetNext().obj().get());
+ pList = dynamic_cast<LwpListList*>(pLast->GetNext().obj().get());
else
{
- LwpDLVListHeadHolder* pHeadHolder= static_cast<LwpDLVListHeadHolder*>(m_Head.obj().get());
+ LwpDLVListHeadHolder* pHeadHolder= dynamic_cast<LwpDLVListHeadHolder*>(m_Head.obj().get());
if(pHeadHolder)
{
- pList = static_cast<LwpListList*>(pHeadHolder->GetHeadID().obj().get());
+ pList = dynamic_cast<LwpListList*>(pHeadHolder->GetHeadID().obj().get());
}
}
while(pList)
{
- LwpContent* pContent = static_cast<LwpContent*>(pList->GetObject().obj().get());
- if(pContent && pContent->HasNonEmbeddedLayouts() &&
- !pContent->IsStyleContent())
+ LwpContent* pContent = dynamic_cast<LwpContent*>(pList->GetObject().obj().get());
+ if (pContent && pContent->HasNonEmbeddedLayouts() && !pContent->IsStyleContent())
return pList;
- pList = static_cast<LwpListList*>(pList->GetNext().obj().get());
+ pList = dynamic_cast<LwpListList*>(pList->GetNext().obj().get());
}
return NULL;
}
diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx
index feff262b133d..19944f74f76c 100644
--- a/lotuswordpro/source/filter/lwpframelayout.cxx
+++ b/lotuswordpro/source/filter/lwpframelayout.cxx
@@ -190,35 +190,35 @@ void LwpFrame::RegisterStyle(XFFrameStyle* pFrameStyle)
void LwpFrame::XFConvert(XFContentContainer* pCont)
{
// parse the frame which anchor to page
- LwpVirtualLayout* pParent = m_pLayout->GetParentLayout();
- if (!pParent)
+ rtl::Reference<LwpVirtualLayout> xParent = m_pLayout->GetParentLayout();
+ if (!xParent.is())
throw std::runtime_error("missing Parent Layout");
- if(pParent->IsPage()&& pParent->GetParentLayout()->IsPage())
+ if (xParent->IsPage() && xParent->GetParentLayout().is() && xParent->GetParentLayout()->IsPage())
{
//for mirror page, problems exist if the parent layout is header or footer layout,
- pParent = pParent->GetParentLayout();
+ xParent = xParent->GetParentLayout();
}
- if(m_pLayout->IsAnchorPage()&& pParent->IsPage())
+ if(m_pLayout->IsAnchorPage()&& xParent->IsPage())
{
//get parent layout
if(m_pLayout->IsUseOnPage())
{
- sal_Int32 nPageNo = pParent->GetPageNumber(m_pLayout->GetUsePage());
+ sal_Int32 nPageNo = xParent->GetPageNumber(m_pLayout->GetUsePage());
if(nPageNo>0)
m_pLayout->XFConvertFrame(pCont, nPageNo);
}
else if(m_pLayout->IsUseOnAllPages())
{
- sal_Int32 nFirst = pParent->GetPageNumber(FIRST_LAYOUTPAGENO);
- sal_Int32 nLast = pParent->GetPageNumber(LAST_LAYOUTPAGENO);
+ sal_Int32 nFirst = xParent->GetPageNumber(FIRST_LAYOUTPAGENO);
+ sal_Int32 nLast = xParent->GetPageNumber(LAST_LAYOUTPAGENO);
if(nLast > 0)
m_pLayout->XFConvertFrame(pCont, nFirst, nLast, true);
}
else if(m_pLayout->IsUseOnAllOddPages()||m_pLayout->IsUseOnAllEvenPages())
{
- sal_Int32 nFirst = pParent->GetPageNumber(FIRST_LAYOUTPAGENO);
- sal_Int32 nLast = pParent->GetPageNumber(LAST_LAYOUTPAGENO);
+ sal_Int32 nFirst = xParent->GetPageNumber(FIRST_LAYOUTPAGENO);
+ sal_Int32 nLast = xParent->GetPageNumber(LAST_LAYOUTPAGENO);
if(nLast > 0)
{
sal_uInt16 first = static_cast<sal_uInt16>(nFirst);
@@ -257,7 +257,8 @@ void LwpFrame::ApplyWrapType(XFFrameStyle *pFrameStyle)
//between the frame object and page margins
eWrap = enumXFWrapBest;
- LwpMiddleLayout* pParent = static_cast<LwpMiddleLayout*>(m_pLayout->GetContainerLayout());
+ rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+ LwpMiddleLayout* pParent = dynamic_cast<LwpMiddleLayout*>(xContainer.get());
if(pParent)
{
if(IsLeftWider())
@@ -275,7 +276,7 @@ void LwpFrame::ApplyWrapType(XFFrameStyle *pFrameStyle)
case LwpPlacableLayout::LAY_NO_WRAP_AROUND:
{
eWrap = enumXFWrapRunThrough;
- if(!m_pLayout->GetBackColor() && !m_pLayout->GetWaterMarkLayout())
+ if(!m_pLayout->GetBackColor() && !m_pLayout->GetWaterMarkLayout().is())
{
//pFrameStyle->SetBackGround(sal_True);
XFColor aXFColor(0xffffff); //white color
@@ -400,7 +401,7 @@ void LwpFrame::ApplyBackColor(XFFrameStyle* pFrameStyle)
*/
void LwpFrame::ApplyProtect(XFFrameStyle* pFrameStyle)
{
- if(m_pLayout->IsProtected())
+ if(m_pLayout->GetIsProtected())
{
pFrameStyle->SetProtect(true,true,true);
}
@@ -437,8 +438,8 @@ void LwpFrame::ApplyPosType(XFFrameStyle* pFrameStyle)
//set vertical position
if(m_pLayout->IsAnchorPage())//in page
{
- LwpVirtualLayout* pContainer = m_pLayout->GetContainerLayout();
- if(pContainer && (pContainer->IsHeader() || pContainer->IsFooter()))
+ rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+ if (xContainer.is() && (xContainer->IsHeader() || xContainer->IsFooter()))
{
//Only anchor to para, the frame can display in header and footer of each page
eYPos = enumXFFrameYPosFromTop; //from top
@@ -470,15 +471,15 @@ void LwpFrame::ApplyPosType(XFFrameStyle* pFrameStyle)
eYPos = enumXFFrameYPosBelow; //below
eYRel = enumXFFrameYRelChar; //from char
//set vertical position
- LwpVirtualLayout* pContainer = m_pLayout->GetContainerLayout();
- if(pContainer && pContainer->IsPage())//in page
+ rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+ if (xContainer.is() && xContainer->IsPage())//in page
{
//eYPos = enumXFFrameYPosFromTop;
//eYRel = enumXFFrameYRelPage;
eYPos = enumXFFrameYPosBelow;
eYRel = enumXFFrameYRelChar;
}
- else if(pContainer && pContainer->IsFrame()) //in frame
+ else if (xContainer.is() && xContainer->IsFrame()) //in frame
{
eYPos = enumXFFrameYPosFromTop;
eYRel = enumXFFrameYRelPage;
@@ -539,12 +540,13 @@ void LwpFrame::ApplyWatermark(XFFrameStyle *pFrameStyle)
{
pFrameStyle->SetBackImage(pBGImage);
//set watermark transparent
- LwpMiddleLayout* pLay = static_cast<LwpMiddleLayout*>(m_pLayout->GetWaterMarkLayout());
- LwpBackgroundStuff* pBackgroundStuff = pLay->GetBackgroundStuff();
- if(pBackgroundStuff && !pBackgroundStuff->IsTransparent())
- {
- pFrameStyle->SetTransparency(100);
- }
+ rtl::Reference<LwpVirtualLayout> xWaterMarkLayout(m_pLayout->GetWaterMarkLayout());
+ LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xWaterMarkLayout.get());
+ LwpBackgroundStuff* pBackgroundStuff = pLay ? pLay->GetBackgroundStuff() : nullptr;
+ if(pBackgroundStuff && !pBackgroundStuff->IsTransparent())
+ {
+ pFrameStyle->SetTransparency(100);
+ }
}
}
@@ -617,11 +619,11 @@ void LwpFrame::ParseAnchorType(XFFrame *pXFFrame)
//anchor to page, frame and cell
if(m_pLayout->IsAnchorPage())//in page
{
- LwpVirtualLayout* pContainer = m_pLayout->GetContainerLayout();
- if(pContainer && (pContainer->IsHeader() || pContainer->IsFooter()))
+ rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+ if (xContainer.is() && (xContainer->IsHeader() || xContainer->IsFooter()))
{
eAnchor = enumXFAnchorPara;
- fYOffset -= pContainer->GetMarginsValue(MARGIN_TOP);
+ fYOffset -= xContainer->GetMarginsValue(MARGIN_TOP);
}
else
eAnchor = enumXFAnchorPage;
@@ -634,8 +636,9 @@ void LwpFrame::ParseAnchorType(XFFrame *pXFFrame)
{
//eAnchor = enumXFAnchorChar;
eAnchor = enumXFAnchorPara;
- LwpMiddleLayout* pContainer = static_cast<LwpMiddleLayout*>(m_pLayout->GetContainerLayout());
- if(pContainer)
+ rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+ LwpMiddleLayout* pContainer = dynamic_cast<LwpMiddleLayout*>(xContainer.get());
+ if (pContainer)
{
fYOffset -= pContainer->GetMarginsValue(MARGIN_TOP);
}
@@ -645,26 +648,26 @@ void LwpFrame::ParseAnchorType(XFFrame *pXFFrame)
case LwpLayoutRelativityGuts::LAY_PARA_RELATIVE: //same page as text
{
eAnchor = enumXFAnchorChar;
- LwpVirtualLayout* pContainer = m_pLayout->GetContainerLayout();
- if(pContainer && pContainer->IsPage())//in page
+ rtl::Reference<LwpVirtualLayout> xContainer(m_pLayout->GetContainerLayout());
+ if (xContainer.is() && xContainer->IsPage())//in page
{
//eAnchor = enumXFAnchorPage;
eAnchor = enumXFAnchorChar;// to character
}
- else if(pContainer && pContainer->IsFrame()) //in frame
+ else if (xContainer.is() && xContainer->IsFrame()) //in frame
{
eAnchor = enumXFAnchorFrame;
}
- else if(pContainer && pContainer->IsCell()) //in cell
+ else if (xContainer.is() && xContainer->IsCell()) //in cell
{
//eAnchor = enumXFAnchorChar;
eAnchor = enumXFAnchorPara;
- fYOffset -= pContainer->GetMarginsValue(MARGIN_TOP);
+ fYOffset -= xContainer->GetMarginsValue(MARGIN_TOP);
}
- else if(pContainer && (pContainer->IsHeader() || pContainer->IsFooter()))//in header or footer
+ else if (xContainer.is() && (xContainer->IsHeader() || xContainer->IsFooter()))//in header or footer
{
eAnchor = enumXFAnchorPara;
- fYOffset -= pContainer->GetMarginsValue(MARGIN_TOP);
+ fYOffset -= xContainer->GetMarginsValue(MARGIN_TOP);
}
break;
}
@@ -692,7 +695,6 @@ void LwpFrame::ParseAnchorType(XFFrame *pXFFrame)
//because of the different feature between Word Pro and SODC, I simulate the vertical base offset
//between anchor and frame origin using the font height.
- //LwpPara* pPara = static_cast<LwpPara*>(m_pLayout->GetPosition()->obj());
rtl::Reference<XFFont> pFont = m_pLayout->GetFont();
if(pFont.is())
{
@@ -717,9 +719,9 @@ void LwpFrame::ParseAnchorType(XFFrame *pXFFrame)
*/
bool LwpFrame::IsLeftWider()
{
- //LwpMiddleLayout* pParent = static_cast<LwpMiddleLayout*>(m_pLayout->GetContainerLayout());
- LwpVirtualLayout* pParent = static_cast<LwpVirtualLayout*>(m_pLayout->GetContainerLayout());
- if(pParent)
+ rtl::Reference<LwpVirtualLayout> xLayout(m_pLayout->GetContainerLayout());
+ LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*>(xLayout.get());
+ if (pParent)
{
LwpPoint aPoint = m_pLayout->GetOrigin();
double fXOffset = LwpTools::ConvertFromUnitsToMetric(aPoint.GetX());
@@ -917,10 +919,13 @@ bool LwpFrameLayout::IsForWaterMark()
{
if(m_nBuoyancy >=LAY_BUOYLAYER)
{
- if(!m_Content.IsNull() && (m_Content.obj()->GetTag()==VO_GRAPHIC) )
- {
+ if (m_Content.IsNull())
+ return false;
+ rtl::Reference<LwpObject> content = m_Content.obj();
+ if (!content.is())
+ return false;
+ if (content->GetTag() == VO_GRAPHIC)
return true;
- }
}
return false;
}
@@ -947,8 +952,9 @@ double LwpFrameLayout::GetWidth()
double LwpFrameLayout::GetMaxWidth()
{
double fActualWidth = 0;
- LwpMiddleLayout* pParent = static_cast<LwpMiddleLayout*>(GetContainerLayout());
- if(pParent)
+ rtl::Reference<LwpVirtualLayout> xLayout(GetContainerLayout());
+ LwpMiddleLayout* pParent = dynamic_cast<LwpMiddleLayout*>(xLayout.get());
+ if (pParent)
{
LwpPoint aPoint = GetOrigin();
double fXOffset = LwpTools::ConvertFromUnitsToMetric(aPoint.GetX());
@@ -1098,11 +1104,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().get());
+ LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get());
while(pLayout)
{
pLayout->XFConvert(pXFFrame);
- pLayout = static_cast<LwpVirtualLayout*>(pLayout->GetNext().obj().get());
+ pLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext().obj().get());
}
pCont ->Add(pXFFrame);
@@ -1181,12 +1187,12 @@ void LwpDropcapLayout::RegisterStyle(LwpFoundry* pFoundry)
{
pStory->SetDropcapFlag(true);
pStory->SetFoundry(pFoundry);
- LwpPara* pPara = static_cast<LwpPara*>(pStory->GetFirstPara().obj().get());
+ LwpPara* pPara = dynamic_cast<LwpPara*>(pStory->GetFirstPara().obj().get());
while(pPara)
{
pPara->SetFoundry(pFoundry);
pPara->RegisterStyle();
- pPara = static_cast<LwpPara*>(pPara->GetNext().obj().get());
+ pPara = dynamic_cast<LwpPara*>(pPara->GetNext().obj().get());
}
}
}
diff --git a/lotuswordpro/source/filter/lwpfrib.cxx b/lotuswordpro/source/filter/lwpfrib.cxx
index d88ec390a26b..e1a9b8cc659e 100644
--- a/lotuswordpro/source/filter/lwpfrib.cxx
+++ b/lotuswordpro/source/filter/lwpfrib.cxx
@@ -261,7 +261,7 @@ void LwpFrib::RegisterStyle(LwpFoundry* pFoundry)
{
pStyle = new XFTextStyle();
*pStyle = *pNamedStyle;
- LwpCharacterStyle* pCharStyle = static_cast<LwpCharacterStyle*>(m_pModifiers->CharStyleID.obj().get());
+ LwpCharacterStyle* pCharStyle = dynamic_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 eaaf91953e09..c6ebad163a68 100644
--- a/lotuswordpro/source/filter/lwpfribbreaks.cxx
+++ b/lotuswordpro/source/filter/lwpfribbreaks.cxx
@@ -80,12 +80,9 @@ void LwpFribColumnBreak::RegisterBreakStyle(LwpPara * pPara)
*pOverStyle = *pBaseStyle;
pOverStyle->SetStyleName("");
- //Old code
- //if (static_cast<LwpStory*>(pPara->GetStoryID()->obj())
- // ->GetCurrentLayout()->GetNumCols() == 1)
//New code
- LwpStory* pStory = static_cast<LwpStory*>(pPara->GetStoryID().obj().get());
- LwpPageLayout* pCurLayout = pStory ? pStory->GetCurrentLayout() : NULL;
+ LwpStory* pStory = dynamic_cast<LwpStory*>(pPara->GetStoryID().obj().get());
+ LwpPageLayout* pCurLayout = pStory ? pStory->GetCurrentLayout() : nullptr;
if( pCurLayout && (pCurLayout->GetNumCols() == 1) )
{
@@ -129,7 +126,7 @@ void LwpFribPageBreak::RegisterBreakStyle(LwpPara* pPara)
XFParaStyle* pBaseStyle = pPara->GetXFParaStyle();
if (pBaseStyle == NULL) return;
- LwpPageLayout* pLayout = static_cast<LwpPageLayout*>(m_Layout.obj().get());
+ LwpPageLayout* pLayout = dynamic_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 9f0161e83d72..6b1d5f87948b 100644
--- a/lotuswordpro/source/filter/lwpfribframe.cxx
+++ b/lotuswordpro/source/filter/lwpfribframe.cxx
@@ -156,13 +156,13 @@ void LwpFribFrame::XFConvert(XFContentContainer* pCont)
sal_uInt8 nType = pLayout->GetRelativeType();
if( LwpLayoutRelativityGuts::LAY_PARA_RELATIVE == nType)
{
- LwpVirtualLayout* pContainerLayout = pLayout->GetContainerLayout();
- if(pContainerLayout && pContainerLayout->IsFrame())
+ rtl::Reference<LwpVirtualLayout> xContainerLayout(pLayout->GetContainerLayout());
+ if (xContainerLayout.is() && xContainerLayout->IsFrame())
{
//same page as text and in frame
pXFContentContainer = m_pPara->GetXFContainer();
}
- else if(pContainerLayout && pContainerLayout->IsCell())
+ else if (xContainerLayout.is() && xContainerLayout->IsCell())
{
//same page as text and in cell, get the first xfpara
rtl::Reference<XFContent> first(
diff --git a/lotuswordpro/source/filter/lwpfribsection.cxx b/lotuswordpro/source/filter/lwpfribsection.cxx
index e24faf854c91..e14993c8ebdd 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().get());
+ return dynamic_cast<LwpSection*>(m_Section.obj().get());
}
/**
@@ -126,11 +126,12 @@ void LwpFribSection::RegisterSectionStyle()
void LwpFribSection::SetSectionName()
{
LwpSection* pSection = GetSection();
- if(pSection)
- {
- LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
- pStory->SetSectionName(pSection->GetSectionName());
- }
+ if (!pSection)
+ return;
+ LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+ if (!pStory)
+ return;
+ pStory->SetSectionName(pSection->GetSectionName());
}
/**
@@ -164,7 +165,7 @@ void LwpFribSection::ParseSection()
m_pMasterPage->ParseSection(this);
}
}
- else if (LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID().obj().get()))
+ else if (LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get()))
{
rtl::Reference<LwpObject> xObj(m_Section.obj());
if (xObj.is() && xObj->GetTag() == VO_INDEXSECTION)
@@ -172,16 +173,6 @@ void LwpFribSection::ParseSection()
//create a new section and add it to container
XFIndex* pIndex = new XFIndex;
pIndex->SetIndexType(enumXFIndexAlphabetical);
- /*
- sal_Bool bRunin = sal_False;
- sal_Bool bSeparator = sal_False;
- LwpIndexSection* pIndexSection = static_cast<LwpIndexSection*>(m_Section.obj());
- if (pIndexSection->IsFormatRunin())
- bRunin = sal_True;
- if (pIndexSection->IsFormatSeparator())
- bSeparator = sal_True;
- pIndex->SetDefaultAlphaIndex("",bRunin,bSeparator);
- */
SetDefaultAlphaIndex(pIndex);
pStory->AddXFContent( pIndex );
@@ -200,7 +191,7 @@ void LwpFribSection::SetDefaultAlphaIndex(XFIndex * pXFIndex)
LwpFoundry* pFoundry = m_pPara->GetFoundry();
OUString styleName = pFoundry->FindActuralStyleName("Separator");
- LwpIndexSection* pIndexSection = static_cast<LwpIndexSection*>(m_Section.obj().get());
+ LwpIndexSection* pIndexSection = dynamic_cast<LwpIndexSection*>(m_Section.obj().get());
XFIndexTemplate * pTemplateSep = new XFIndexTemplate();
if (pIndexSection->IsFormatSeparator())
{
@@ -259,7 +250,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().get());
+ LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
pStory->SetCurrentLayout(m_pLayout);
RegisterFillerPageStyle();
return false;
@@ -290,7 +281,7 @@ bool LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
case LwpLayout::StartOnOddPage: //fall through
case LwpLayout::StartOnEvenPage:
{
- LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+ LwpStory* pStory = dynamic_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 +296,7 @@ bool LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
}
//register tab style;
- LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+ LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
pStory->SetTabLayout(m_pLayout);
m_pPara->RegisterTabStyle(pOverStyle);
@@ -316,7 +307,7 @@ bool LwpMasterPage::RegisterMasterPage(LwpFrib* pFrib)
{
XFSectionStyle* pSectStyle= new XFSectionStyle();
//set margin
- pStory = static_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+ pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
if(pStory)
{
LwpPageLayout* pCurrentLayout = pStory->GetCurrentLayout();
@@ -348,7 +339,7 @@ bool LwpMasterPage::IsNeedSection()
{
bool bNewSection = false;
//get story
- LwpStory* pStory = static_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
+ LwpStory* pStory = dynamic_cast<LwpStory*>(m_pPara->GetStoryID().obj().get());
//if pagelayout is modified, register the pagelayout
if(pStory->IsPMModified())
{
@@ -396,8 +387,8 @@ void LwpMasterPage::ParseSection(LwpFrib* pFrib)
XFContentContainer* pContent = CreateXFSection();
if(pContent)
{
- LwpStory* pStory = static_cast<LwpStory*> ( m_pPara->GetStoryID().obj().get() );
- //delete the additional blank para, 06/28/2005
+ LwpStory* pStory = dynamic_cast<LwpStory*> ( m_pPara->GetStoryID().obj().get() );
+ //delete the additional blank para
XFParagraph* pCurrPara = rFribPtr.GetXFPara();
if(!pCurrPara->HasContents())
{
@@ -412,7 +403,7 @@ void LwpMasterPage::ParseSection(LwpFrib* pFrib)
}
else
{
- LwpStory* pStory = static_cast<LwpStory*> ( m_pPara->GetStoryID().obj().get() );
+ LwpStory* pStory = dynamic_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 86c70ea62537..606659243f26 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().get());
+ return dynamic_cast<LwpSuperTableLayout*>(m_objTable.obj().get());
}
void LwpFribTable::RegisterNewStyle()
@@ -103,11 +103,11 @@ void LwpFribTable::XFConvert(XFContentContainer* pCont)
if (!pSuper)
return;
sal_uInt8 nType = pSuper->GetRelativeType();
- LwpVirtualLayout* pContainer = pSuper->GetContainerLayout();
- if (!pContainer)
+ rtl::Reference<LwpVirtualLayout> xContainer(pSuper->GetContainerLayout());
+ if (!xContainer.is())
return;
if ( LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE == nType
- && !pContainer->IsCell())
+ && !xContainer->IsCell())
{
pXFContentContainer = m_pPara->GetXFContainer();
//delete the additional blank para, 06/28/2005
@@ -124,11 +124,11 @@ void LwpFribTable::XFConvert(XFContentContainer* pCont)
else if( LwpLayoutRelativityGuts::LAY_PARA_RELATIVE == nType)
{
//same page as text and in frame
- if(pContainer->IsFrame())
+ if (xContainer->IsFrame())
{
pXFContentContainer = m_pPara->GetXFContainer();
}
- else if(pContainer->IsCell())
+ else if (xContainer->IsCell())
{
//same page as text and in cell, get the first xfpara
rtl::Reference<XFContent> first(
diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx
index 6192263b8075..29888eb4c1b3 100644
--- a/lotuswordpro/source/filter/lwpgrfobj.cxx
+++ b/lotuswordpro/source/filter/lwpgrfobj.cxx
@@ -203,7 +203,7 @@ void LwpGraphicObject::XFConvert (XFContentContainer* pCont)
pCont->Add(iter->get());
}
}
- else if (this->IsGrafFormatValid())
+ else if (this->IsGrafFormatValid() && !m_vXFDrawObjects.empty())
{
XFImage* pImage = static_cast<XFImage*>(m_vXFDrawObjects.front().get());
@@ -277,8 +277,8 @@ void LwpGraphicObject::RegisterStyle()
if (m_sServerContextFormat[1]=='l'&&m_sServerContextFormat[2]=='c'&&m_sServerContextFormat[3]=='h')
{
- LwpVirtualLayout* pMyLayout = GetLayout(NULL);
- if (pMyLayout && pMyLayout->IsFrame())
+ rtl::Reference<LwpVirtualLayout> xMyLayout(GetLayout(nullptr));
+ if (xMyLayout.is() && xMyLayout->IsFrame())
{
XFFrameStyle* pXFFrameStyle = new XFFrameStyle();
pXFFrameStyle->SetXPosType(enumXFFrameXPosFromLeft, enumXFFrameXRelFrame);
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index 871e886c717d..b2022c1e48a2 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -78,6 +78,9 @@
LwpVirtualLayout::LwpVirtualLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
: LwpDLNFPVList(objHdr, pStrm)
+ , m_bGettingHonorProtection(false)
+ , m_bGettingHasProtection(false)
+ , m_bGettingIsProtected(false)
, m_nAttributes(0)
, m_nAttributes2(0)
, m_nAttributes3(0)
@@ -143,21 +146,17 @@ bool LwpVirtualLayout::HonorProtection()
if(!(m_nAttributes2 & STYLE2_HONORPROTECTION))
return false;
- LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
- if(pParent && !pParent->IsHeader())
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+ if (xParent.is() && !xParent->IsHeader())
{
- return pParent->HonorProtection();
+ return xParent->GetHonorProtection();
}
if(m_pFoundry)//is null now
{
LwpDocument* pDoc = m_pFoundry->GetDocument();
- /*if(pDoc)
- {
- return pDoc->HonorProtection();
- }*/
if(pDoc && pDoc->GetRootDocument())
- return pDoc->GetRootDocument()->HonorProtection();
+ return pDoc->GetRootDocument()->GetHonorProtection();
}
return true;
@@ -171,10 +170,10 @@ bool LwpVirtualLayout::IsProtected()
{
bool bProtected = (m_nAttributes & STYLE_PROTECTED)!=0;
- LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
- if(pParent && !pParent->IsHeader())
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+ if (xParent.is() && !xParent->IsHeader())
{
- if(pParent->HonorProtection()&&(pParent->HasProtection()||bProtected))
+ if (xParent->GetHonorProtection() && (xParent->GetHasProtection()||bProtected))
{
return true;
}
@@ -184,7 +183,7 @@ bool LwpVirtualLayout::IsProtected()
LwpDocument* pDoc = m_pFoundry->GetDocument();
if(pDoc)
{
- if (pDoc->HonorProtection() && bProtected)
+ if (pDoc->GetHonorProtection() && bProtected)
{
return true;
}
@@ -203,10 +202,10 @@ bool LwpVirtualLayout::HasProtection()
if(m_nAttributes & STYLE_PROTECTED)
return true;
- LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
- if(pParent && !pParent->IsHeader())
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+ if (xParent.is() && !xParent->IsHeader())
{
- return pParent->HasProtection();
+ return xParent->GetHasProtection();
}
return false;
@@ -234,9 +233,9 @@ LwpUseWhen* LwpVirtualLayout::GetUseWhen()
if(GetLayoutType()!=LWP_PAGE_LAYOUT)
{
//get parent
- LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
- if(pParent && !pParent->IsHeader()&& (pParent->GetLayoutType()!=LWP_PAGE_LAYOUT))
- return pParent->GetUseWhen();
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+ if (xParent.is() && !xParent->IsHeader() && (xParent->GetLayoutType() != LWP_PAGE_LAYOUT))
+ return xParent->GetUseWhen();
}
@@ -344,9 +343,9 @@ bool LwpVirtualLayout::IsMinimumHeight()
* @descr: Get parent layout
*
*/
-LwpVirtualLayout* LwpVirtualLayout::GetParentLayout()
+rtl::Reference<LwpVirtualLayout> LwpVirtualLayout::GetParentLayout()
{
- return dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
+ return rtl::Reference<LwpVirtualLayout>(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
}
/**
@@ -356,12 +355,12 @@ LwpVirtualLayout* LwpVirtualLayout::GetParentLayout()
void LwpVirtualLayout::RegisterChildStyle()
{
//Register all children styles
- LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get());
- while(pLayout)
+ rtl::Reference<LwpVirtualLayout> xLayout(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
+ while (xLayout.is())
{
- pLayout->SetFoundry(m_pFoundry);
- pLayout->RegisterStyle();
- pLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext().obj().get());
+ xLayout->SetFoundry(m_pFoundry);
+ xLayout->RegisterStyle();
+ xLayout.set(dynamic_cast<LwpVirtualLayout*>(xLayout->GetNext().obj().get()));
}
}
@@ -375,9 +374,9 @@ bool LwpVirtualLayout::IsStyleLayout()
if (m_nAttributes3 & STYLE3_STYLELAYOUT)
return true;
- LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get());
- if (pParent)
- return pParent->IsStyleLayout();
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+ if (xParent.is())
+ return xParent->IsStyleLayout();
return false;
}
@@ -445,42 +444,40 @@ void LwpAssociatedLayouts::Read(LwpObjectStream* pStrm)
* @descr: Looking for the layout which follows the pStartLayout
* @param: pStartLayout - the layout which is used for looking for its following layout
*/
-LwpVirtualLayout* LwpAssociatedLayouts::GetLayout(LwpVirtualLayout *pStartLayout)
+rtl::Reference<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().get());
+ return rtl::Reference<LwpVirtualLayout>(dynamic_cast<LwpVirtualLayout*>(m_OnlyLayout.obj().get()));
- LwpObjectHolder* pObjHolder = dynamic_cast<LwpObjectHolder*>(m_Layouts.GetHead().obj().get());
- if(pObjHolder)
+ rtl::Reference<LwpObjectHolder> xObjHolder(dynamic_cast<LwpObjectHolder*>(m_Layouts.GetHead().obj().get()));
+ if (xObjHolder.is())
{
- LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(pObjHolder->GetObject().obj().get());
- if(!pStartLayout )
- return pLayout;
+ rtl::Reference<LwpVirtualLayout> xLayout(dynamic_cast<LwpVirtualLayout*>(xObjHolder->GetObject().obj().get()));
+ if (!pStartLayout)
+ return xLayout;
- while(pObjHolder && pStartLayout != pLayout)
+ while (xObjHolder.is() && pStartLayout != xLayout.get())
{
- pObjHolder = dynamic_cast<LwpObjectHolder*>(pObjHolder->GetNext().obj().get());
- if(pObjHolder)
+ xObjHolder.set(dynamic_cast<LwpObjectHolder*>(xObjHolder->GetNext().obj().get()));
+ if (xObjHolder.is())
{
- pLayout = dynamic_cast<LwpVirtualLayout*>(pObjHolder->GetObject().obj().get());
+ xLayout.set(dynamic_cast<LwpVirtualLayout*>(xObjHolder->GetObject().obj().get()));
}
}
- if(pObjHolder)
+ if (xObjHolder.is())
{
- pObjHolder = dynamic_cast<LwpObjectHolder*>(pObjHolder->GetNext().obj().get());
- if(pObjHolder)
+ xObjHolder.set(dynamic_cast<LwpObjectHolder*>(xObjHolder->GetNext().obj().get()));
+ if (xObjHolder.is())
{
- pLayout = dynamic_cast<LwpVirtualLayout*>(pObjHolder->GetObject().obj().get());
- return pLayout;
+ xLayout.set(dynamic_cast<LwpVirtualLayout*>(xObjHolder->GetObject().obj().get()));
+ return xLayout;
}
}
-
- //return pLayout;
}
- return NULL;
+ return rtl::Reference<LwpVirtualLayout>();
}
LwpHeadLayout::LwpHeadLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
@@ -499,27 +496,27 @@ void LwpHeadLayout::Read()
void LwpHeadLayout::RegisterStyle()
{
//Register all children styles
- LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get());
- while(pLayout)
+ rtl::Reference<LwpVirtualLayout> xLayout(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
+ while (xLayout.is())
{
- pLayout->SetFoundry(m_pFoundry);
+ xLayout->SetFoundry(m_pFoundry);
//if the layout is relative to para, the layout will be registered in para
- if(!pLayout->IsRelativeAnchored())
+ if (!xLayout->IsRelativeAnchored())
{
- if (pLayout == this)
+ if (xLayout.get() == this)
{
OSL_FAIL("Layout points to itself");
break;
}
- pLayout->DoRegisterStyle();
+ xLayout->DoRegisterStyle();
}
- LwpVirtualLayout *pNext = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext().obj().get());
- if (pNext == pLayout)
+ rtl::Reference<LwpVirtualLayout> xNext(dynamic_cast<LwpVirtualLayout*>(xLayout->GetNext().obj().get()));
+ if (xNext.get() == xLayout.get())
{
OSL_FAIL("Layout points to itself");
break;
}
- pLayout = pNext;
+ xLayout = xNext;
}
}
@@ -527,18 +524,18 @@ void LwpHeadLayout::RegisterStyle()
* @descr find endnote supertable layout from the child layout list. Suppose that there is only one endnote supertablelayout in one division
* @return pointer to endnote supertable layout
*/
-LwpVirtualLayout* LwpHeadLayout::FindEnSuperTableLayout()
+rtl::Reference<LwpVirtualLayout> LwpHeadLayout::FindEnSuperTableLayout()
{
- LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get());
- while(pLayout)
+ rtl::Reference<LwpVirtualLayout> xLayout(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
+ while (xLayout.get())
{
- if(pLayout->GetLayoutType() == LWP_ENDNOTE_SUPERTABLE_LAYOUT)
+ if (xLayout->GetLayoutType() == LWP_ENDNOTE_SUPERTABLE_LAYOUT)
{
- return pLayout;
+ return xLayout;
}
- pLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetNext().obj().get());
+ xLayout.set(dynamic_cast<LwpVirtualLayout*>(xLayout->GetNext().obj().get()));
}
- return NULL;
+ return rtl::Reference<LwpVirtualLayout>();
}
LwpLayoutStyle::LwpLayoutStyle()
@@ -671,9 +668,13 @@ LwpLayoutGeometry* LwpMiddleLayout::GetGeometry()
{
return ( dynamic_cast<LwpLayoutGeometry*> (m_LayGeometry.obj().get()) );
}
- else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(GetBasedOnStyle().get()))
+ else
{
- return pLay->GetGeometry();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ return pLay->GetGeometry();
+ }
}
return NULL;
}
@@ -718,12 +719,12 @@ bool LwpMiddleLayout::MarginsSameAsParent()
{
return LwpVirtualLayout::MarginsSameAsParent();
}
- if (LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*> (GetBasedOnStyle().get()))
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*>(xBase.get()))
{
pLay->MarginsSameAsParent();
}
return LwpVirtualLayout::MarginsSameAsParent();
-
}
/**
@@ -737,10 +738,10 @@ double LwpMiddleLayout::GetMarginsValue(const sal_uInt8 &nWhichSide)
{
if ( MarginsSameAsParent() )
{
- LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
- if(pParent && !pParent->IsHeader())
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+ if (xParent.is() && !xParent->IsHeader())
{
- fValue = pParent->GetMarginsValue(nWhichSide);
+ fValue = xParent->GetMarginsValue(nWhichSide);
return fValue;
}
}
@@ -755,8 +756,9 @@ double LwpMiddleLayout::GetMarginsValue(const sal_uInt8 &nWhichSide)
return fValue;
}
}
- LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*>(GetBasedOnStyle().get());
- if(pStyle)
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*>(xBase.get());
+ if (pStyle)
{
fValue = pStyle->GetMarginsValue(nWhichSide);
return fValue;
@@ -802,9 +804,13 @@ LwpBorderStuff* LwpMiddleLayout::GetBorderStuff()
LwpLayoutBorder* pLayoutBorder = dynamic_cast<LwpLayoutBorder*>(m_LayBorderStuff.obj().get());
return pLayoutBorder ? &pLayoutBorder->GetBorderStuff() : NULL;
}
- else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(GetBasedOnStyle().get()))
+ else
{
- return pLay->GetBorderStuff();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ return pLay->GetBorderStuff();
+ }
}
return NULL;
}
@@ -822,9 +828,13 @@ LwpBackgroundStuff* LwpMiddleLayout::GetBackgroundStuff()
LwpLayoutBackground* pLayoutBackground = dynamic_cast<LwpLayoutBackground*>(m_LayBackgroundStuff.obj().get());
return pLayoutBackground ? &pLayoutBackground->GetBackgoudStuff() : NULL;
}
- else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(GetBasedOnStyle().get()))
+ else
{
- return pLay->GetBackgroundStuff();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ return pLay->GetBackgroundStuff();
+ }
}
return NULL;
}
@@ -931,9 +941,13 @@ LwpTabOverride* LwpMiddleLayout::GetTabOverride()
}
return NULL;
}
- else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> ( GetBasedOnStyle().get() ))
+ else
{
- return pLay->GetTabOverride();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ return pLay->GetTabOverride();
+ }
}
return NULL;
}
@@ -946,68 +960,70 @@ LwpTabOverride* LwpMiddleLayout::GetTabOverride()
*/
sal_uInt16 LwpMiddleLayout::GetScaleMode()
{
- if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is())
+ if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is() && GetLayoutScale())
return GetLayoutScale()->GetScaleMode();
rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
if (xBase.is())
- return dynamic_cast<LwpMiddleLayout*>(xBase.get())->GetScaleMode();
+ return dynamic_cast<LwpMiddleLayout&>(*xBase.get()).GetScaleMode();
else
return (LwpLayoutScale::FIT_IN_FRAME | LwpLayoutScale::MAINTAIN_ASPECT_RATIO);
}
sal_uInt16 LwpMiddleLayout::GetScaleTile()
{
- if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is())
+ if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is() && GetLayoutScale())
return (GetLayoutScale()->GetPlacement() & LwpLayoutScale::TILED)
? 1 : 0;
rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
if (xBase.is())
- return dynamic_cast<LwpMiddleLayout*>(xBase.get())->GetScaleTile();
+ return dynamic_cast<LwpMiddleLayout&>(*xBase.get()).GetScaleTile();
else
return 0;
}
sal_uInt16 LwpMiddleLayout::GetScaleCenter()
{
- if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is())
+ if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is() && GetLayoutScale())
+ {
return (GetLayoutScale()->GetPlacement() & LwpLayoutScale::CENTERED)
? 1 : 0;
+ }
rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
if (xBase.is())
- return dynamic_cast<LwpMiddleLayout*>(xBase.get())->GetScaleCenter();
+ return dynamic_cast<LwpMiddleLayout&>(*xBase.get()).GetScaleCenter();
else
return 0;
}
sal_uInt32 LwpMiddleLayout::GetScalePercentage()
{
- if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is())
+ if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is() && GetLayoutScale())
return GetLayoutScale()->GetScalePercentage()/10;//m_nScalePercentage 1000 = 100%
rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
if (xBase.is())
- return dynamic_cast<LwpMiddleLayout*>(xBase.get())->GetScalePercentage();
+ return dynamic_cast<LwpMiddleLayout&>(*xBase.get()).GetScalePercentage();
else
return 100;
}
double LwpMiddleLayout::GetScaleWidth()
{
- if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is())
+ if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is() && GetLayoutScale())
return LwpTools::ConvertFromUnits(GetLayoutScale()->GetScaleWidth());
rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
if (xBase.is())
- return dynamic_cast<LwpMiddleLayout*>(xBase.get())->GetScaleWidth();
+ return dynamic_cast<LwpMiddleLayout&>(*xBase.get()).GetScaleWidth();
else
return 0;
}
double LwpMiddleLayout::GetScaleHeight()
{
- if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is())
+ if ((m_nOverrideFlag & OVER_SCALING) && m_LayScale.obj().is() && GetLayoutScale())
return LwpTools::ConvertFromUnits(GetLayoutScale()->GetScaleHeight());
rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
if (xBase.is())
- return dynamic_cast<LwpMiddleLayout*>(xBase.get())->GetScaleHeight();
+ return dynamic_cast<LwpMiddleLayout&>(*xBase.get()).GetScaleHeight();
else
return 0;
}
@@ -1175,9 +1191,13 @@ bool LwpMiddleLayout::IsAutoGrow()
((LAY_AUTOGROW << SHIFT_UP) | (LAY_AUTOGROW << SHIFT_DOWN) |
(LAY_AUTOGROW << SHIFT_RIGHT) | (LAY_AUTOGROW << SHIFT_LEFT))) != 0;
}
- else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(GetBasedOnStyle().get()))
+ else
{
- return pLay->IsAutoGrow();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ return pLay->IsAutoGrow();
+ }
}
return LwpVirtualLayout::IsAutoGrow();
}
@@ -1192,9 +1212,13 @@ bool LwpMiddleLayout::IsAutoGrowDown()
{
return (m_nDirection & (LAY_AUTOGROW << SHIFT_DOWN)) != 0;
}
- else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(GetBasedOnStyle().get()))
+ else
{
- return pLay->IsAutoGrowDown();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ return pLay->IsAutoGrowDown();
+ }
}
return LwpVirtualLayout::IsAutoGrowDown();
}
@@ -1209,9 +1233,13 @@ bool LwpMiddleLayout::IsAutoGrowUp()
{
return (m_nDirection & (LAY_AUTOGROW << SHIFT_UP)) != 0;
}
- else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(GetBasedOnStyle().get()))
+ else
{
- return pLay->IsAutoGrowUp();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ return pLay->IsAutoGrowUp();
+ }
}
return LwpVirtualLayout::IsAutoGrowUp();
}
@@ -1226,9 +1254,13 @@ bool LwpMiddleLayout::IsAutoGrowLeft()
{
return (m_nDirection & (LAY_AUTOGROW << SHIFT_LEFT)) != 0;
}
- else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(GetBasedOnStyle().get()))
+ else
{
- return pLay->IsAutoGrowLeft();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ return pLay->IsAutoGrowLeft();
+ }
}
return LwpVirtualLayout::IsAutoGrowLeft();
}
@@ -1243,9 +1275,13 @@ bool LwpMiddleLayout::IsAutoGrowRight()
{
return (m_nDirection & (LAY_AUTOGROW << SHIFT_RIGHT)) != 0;
}
- else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> (GetBasedOnStyle().get()))
+ else
{
- return pLay->IsAutoGrowRight();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ return pLay->IsAutoGrowRight();
+ }
}
return LwpVirtualLayout::IsAutoGrowRight();
}
@@ -1263,9 +1299,13 @@ sal_uInt8 LwpMiddleLayout::GetContentOrientation()
if (pLayGeometry)
return pLayGeometry->GetContentOrientation();
}
- else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(GetBasedOnStyle().get()))
+ else
{
- return pLay->GetContentOrientation();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ return pLay->GetContentOrientation();
+ }
}
return LwpVirtualLayout::GetContentOrientation();
}
@@ -1281,24 +1321,28 @@ bool LwpMiddleLayout::HonorProtection()
if(!(m_nAttributes2 & STYLE2_HONORPROTECTION))
return false;
- LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
- if(pParent && !pParent->IsHeader())
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+ if (xParent.is() && !xParent->IsHeader())
{
- return pParent->HonorProtection();
+ return xParent->GetHonorProtection();
}
if(m_pFoundry)//is null now
{
LwpDocument* pDoc = m_pFoundry->GetDocument();
- if(pDoc)
+ if (pDoc)
{
- return pDoc->HonorProtection();
+ return pDoc->GetHonorProtection();
}
}
}
- else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> (GetBasedOnStyle().get()))
+ else
{
- return pLay->HonorProtection();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ return pLay->GetHonorProtection();
+ }
}
return LwpVirtualLayout::HonorProtection();
@@ -1315,21 +1359,25 @@ bool LwpMiddleLayout::IsProtected()
{
bProtected = (m_nAttributes & STYLE_PROTECTED)!=0;
}
- else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> (GetBasedOnStyle().get()))
+ else
{
- bProtected = pLay->IsProtected();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ bProtected = pLay->GetIsProtected();
+ }
+ else
+ bProtected = LwpVirtualLayout::IsProtected();
}
- else
- bProtected = LwpVirtualLayout::IsProtected();
- LwpVirtualLayout* pParent = dynamic_cast<LwpVirtualLayout*> (GetParent().obj().get());
- if(pParent && !pParent->IsHeader())
+ rtl::Reference<LwpVirtualLayout> xParent(dynamic_cast<LwpVirtualLayout*>(GetParent().obj().get()));
+ if (xParent.is() && !xParent->IsHeader())
{
/* If a parent's protected then none of its children can be accessed. */
- if(pParent->IsProtected())
+ if (xParent->GetIsProtected())
return true;
- if(pParent->HonorProtection())
+ if (xParent->GetHonorProtection())
return bProtected;
/* If our parent isn't honoring protection then we aren't protected. */
@@ -1341,7 +1389,7 @@ bool LwpMiddleLayout::IsProtected()
LwpDocument* pDoc = m_pFoundry->GetDocument();
if(pDoc)
{
- if (pDoc->HonorProtection())
+ if (pDoc->GetHonorProtection())
return bProtected;
/* If the document isn't honoring protection then we aren't protected.*/
@@ -1356,18 +1404,18 @@ bool LwpMiddleLayout::IsProtected()
* @descr: Get watermark layout
*
*/
-LwpVirtualLayout* LwpMiddleLayout::GetWaterMarkLayout()
+rtl::Reference<LwpVirtualLayout> LwpMiddleLayout::GetWaterMarkLayout()
{
- LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get());
- while(pLay)
+ rtl::Reference<LwpVirtualLayout> xLay(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
+ while (xLay.is())
{
- if( pLay->IsForWaterMark())
+ if (xLay->IsForWaterMark())
{
- return pLay;
+ return xLay;
}
- pLay = dynamic_cast<LwpVirtualLayout*> (pLay->GetNext().obj().get());
+ xLay.set(dynamic_cast<LwpVirtualLayout*>(xLay->GetNext().obj().get()));
}
- return NULL;
+ return rtl::Reference<LwpVirtualLayout>();
}
/**
@@ -1376,7 +1424,8 @@ LwpVirtualLayout* LwpMiddleLayout::GetWaterMarkLayout()
*/
XFBGImage* LwpMiddleLayout::GetXFBGImage()
{
- LwpMiddleLayout* pLay = static_cast<LwpMiddleLayout*>(GetWaterMarkLayout());
+ rtl::Reference<LwpVirtualLayout> xWaterMarkLayout(GetWaterMarkLayout());
+ LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xWaterMarkLayout.get());
if(pLay)
{
//test BGImage
@@ -1440,9 +1489,13 @@ bool LwpMiddleLayout::GetUsePrinterSettings()
{
return (m_nAttributes3 & STYLE3_USEPRINTERSETTINGS) != 0;
}
- else if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*> (GetBasedOnStyle().get()))
+ else
{
- return pLay->GetUsePrinterSettings();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpMiddleLayout* pLay = dynamic_cast<LwpMiddleLayout*>(xBase.get()))
+ {
+ return pLay->GetUsePrinterSettings();
+ }
}
return false;
}
@@ -1519,7 +1572,8 @@ sal_uInt16 LwpLayout::GetNumCols()
}
}
- LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*> (GetBasedOnStyle().get());
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*>(xBase.get());
if (pStyle)
{
return pStyle->GetNumCols();
@@ -1544,7 +1598,8 @@ double LwpLayout::GetColWidth(sal_uInt16 nIndex)
}
}
- LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*>(GetBasedOnStyle().get());
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*>(xBase.get());
if (pStyle)
{
return pStyle->GetColWidth(nIndex);
@@ -1569,7 +1624,8 @@ double LwpLayout::GetColGap(sal_uInt16 nIndex)
}
}
- LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*>(GetBasedOnStyle().get());
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ LwpVirtualLayout* pStyle = dynamic_cast<LwpVirtualLayout*>(xBase.get());
if (pStyle)
{
return pStyle->GetColGap(nIndex);
@@ -1714,9 +1770,13 @@ sal_uInt16 LwpLayout::GetUsePage()
else
return 0;
}
- else if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(GetBasedOnStyle().get()))
+ else
{
- return pLay->GetUsePage();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(xBase.get()))
+ {
+ return pLay->GetUsePage();
+ }
}
return 0;
}
@@ -1731,9 +1791,13 @@ LwpUseWhen* LwpLayout::VirtualGetUseWhen()
{
return m_pUseWhen;
}
- else if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(GetBasedOnStyle().get()))
+ else
{
- return pLay->VirtualGetUseWhen();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(xBase.get()))
+ {
+ return pLay->VirtualGetUseWhen();
+ }
}
return LwpVirtualLayout::VirtualGetUseWhen();
}
@@ -1752,9 +1816,13 @@ bool LwpLayout::IsUseOnAllPages()
else
return false;
}
- else if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(GetBasedOnStyle().get()))
+ else
{
- return pLay->IsUseOnAllPages();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(xBase.get()))
+ {
+ return pLay->IsUseOnAllPages();
+ }
}
return LwpVirtualLayout::IsUseOnAllPages();
}
@@ -1773,9 +1841,13 @@ bool LwpLayout::IsUseOnAllEvenPages()
else
return false;
}
- else if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(GetBasedOnStyle().get()))
+ else
{
- return pLay->IsUseOnAllEvenPages();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(xBase.get()))
+ {
+ return pLay->IsUseOnAllEvenPages();
+ }
}
return LwpVirtualLayout::IsUseOnAllEvenPages();
}
@@ -1794,9 +1866,13 @@ bool LwpLayout::IsUseOnAllOddPages()
else
return false;
}
- else if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(GetBasedOnStyle().get()))
+ else
{
- return pLay->IsUseOnAllOddPages();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(xBase.get()))
+ {
+ return pLay->IsUseOnAllOddPages();
+ }
}
return LwpVirtualLayout::IsUseOnAllOddPages();
}
@@ -1815,9 +1891,13 @@ bool LwpLayout::IsUseOnPage()
else
return false;
}
- else if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(GetBasedOnStyle().get()))
+ else
{
- return pLay->IsUseOnPage();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(xBase.get()))
+ {
+ return pLay->IsUseOnPage();
+ }
}
return LwpVirtualLayout::IsUseOnPage();
}
@@ -1835,9 +1915,13 @@ LwpShadow* LwpLayout::GetShadow()
LwpLayoutShadow* pLayoutShadow = dynamic_cast<LwpLayoutShadow*>(m_LayShadow.obj().get());
return pLayoutShadow ? &pLayoutShadow->GetShadow() : NULL;
}
- else if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(GetBasedOnStyle().get()))
+ else
{
- return pLay->GetShadow();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpLayout* pLay = dynamic_cast<LwpLayout*>(xBase.get()))
+ {
+ return pLay->GetShadow();
+ }
}
return NULL;
}
@@ -1900,7 +1984,7 @@ XFShadow* LwpLayout::GetXFShadow()
* @descr get the layout that containers the current frame layout
*
*/
-LwpVirtualLayout* LwpLayout::GetContainerLayout()
+rtl::Reference<LwpVirtualLayout> LwpLayout::GetContainerLayout()
{
if(IsRelativeAnchored())
{
@@ -1981,9 +2065,13 @@ sal_uInt8 LwpPlacableLayout::GetWrapType()
{
return m_nWrapType;
}
- else if (LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*>(GetBasedOnStyle().get()))
+ else
{
- return pLay->GetWrapType();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*>(xBase.get()))
+ {
+ return pLay->GetWrapType();
+ }
}
return LAY_WRAP_AROUND;
}
@@ -2002,9 +2090,13 @@ LwpLayoutRelativity* LwpPlacableLayout::GetRelativityPiece()
return dynamic_cast<LwpLayoutRelativity*>(m_LayRelativity.obj().get());
}
}
- else if (LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*>(GetBasedOnStyle().get()))
+ else
{
- return pLay->GetRelativityPiece();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*>(xBase.get()))
+ {
+ return pLay->GetRelativityPiece();
+ }
}
return NULL;
}
@@ -2043,9 +2135,13 @@ sal_Int32 LwpPlacableLayout::GetBaseLineOffset()
{
return m_nBaseLineOffset;
}
- else if (LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*>(GetBasedOnStyle().get()))
+ else
{
- return pLay->GetBaseLineOffset();
+ rtl::Reference<LwpObject> xBase(GetBasedOnStyle());
+ if (LwpPlacableLayout* pLay = dynamic_cast<LwpPlacableLayout*>(xBase.get()))
+ {
+ return pLay->GetBaseLineOffset();
+ }
}
return 0;
@@ -2059,9 +2155,8 @@ bool LwpPlacableLayout::IsAnchorPage()
if(IsRelativeAnchored())
return false;
- LwpVirtualLayout* pLayout = GetParentLayout();
- if(pLayout && (pLayout->IsPage() || pLayout->IsHeader() || pLayout->IsFooter()))
- //if(pLayout && pLayout->IsPage())
+ rtl::Reference<LwpVirtualLayout> xLayout = GetParentLayout();
+ if (xLayout.is() && (xLayout->IsPage() || xLayout->IsHeader() || xLayout->IsFooter()))
{
return true;
}
@@ -2076,8 +2171,8 @@ bool LwpPlacableLayout::IsAnchorFrame()
if(IsRelativeAnchored())
return false;
- LwpVirtualLayout* pLayout = GetParentLayout();
- if(pLayout && (pLayout->IsFrame()||pLayout->IsGroupHead()))
+ rtl::Reference<LwpVirtualLayout> xLayout = GetParentLayout();
+ if (xLayout.is() && (xLayout->IsFrame() || xLayout->IsGroupHead()))
{
return true;
}
@@ -2092,8 +2187,8 @@ bool LwpPlacableLayout::IsAnchorCell()
if(IsRelativeAnchored())
return false;
- LwpVirtualLayout* pLayout = GetParentLayout();
- if(pLayout && pLayout->IsCell())
+ rtl::Reference<LwpVirtualLayout> xLayout = GetParentLayout();
+ if (xLayout.is() && xLayout->IsCell())
{
return true;
}
diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx
index 5e9b42ef1ca9..a7bcf1eb4932 100644
--- a/lotuswordpro/source/filter/lwplayout.hxx
+++ b/lotuswordpro/source/filter/lwplayout.hxx
@@ -115,9 +115,33 @@ public:
bool IsAutoGrowWidth();
bool IsInlineToMargin();
virtual sal_uInt8 GetContentOrientation(){ return TEXT_ORIENT_LRTB;}
- virtual bool HonorProtection();
- virtual bool IsProtected();
- bool HasProtection();
+ bool GetHonorProtection()
+ {
+ if (m_bGettingHonorProtection)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingHonorProtection = true;
+ bool bRet = HonorProtection();
+ m_bGettingHonorProtection = false;
+ return bRet;
+ }
+ bool GetIsProtected()
+ {
+ if (m_bGettingIsProtected)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingIsProtected = true;
+ bool bRet = IsProtected();
+ m_bGettingIsProtected = false;
+ return bRet;
+ }
+ bool GetHasProtection()
+ {
+ if (m_bGettingHasProtection)
+ throw std::runtime_error("recursion in layout");
+ m_bGettingHasProtection = true;
+ bool bRet = HasProtection();
+ m_bGettingHasProtection = false;
+ return bRet;
+ }
OUString GetStyleName(){ return m_StyleName;}
bool IsComplex();
virtual bool IsAnchorPage(){ return false;}
@@ -141,9 +165,9 @@ public:
virtual sal_Int32 GetPageNumber(sal_uInt16 /*nLayoutNumber*/ = 0){ return -1;}
bool IsMinimumHeight();
virtual bool IsForWaterMark(){ return false;}
- virtual LwpPara* GetLastParaOfPreviousStory() { return NULL; }
- LwpVirtualLayout* GetParentLayout();
- virtual LwpVirtualLayout* GetContainerLayout(){ return NULL;}
+ virtual LwpPara* GetLastParaOfPreviousStory() { return nullptr; }
+ rtl::Reference<LwpVirtualLayout> GetParentLayout();
+ virtual rtl::Reference<LwpVirtualLayout> GetContainerLayout() { return rtl::Reference<LwpVirtualLayout>(); }
void RegisterChildStyle();
bool NoContentReference();
bool IsStyleLayout();
@@ -167,7 +191,13 @@ public:
//End by
protected:
void Read() SAL_OVERRIDE;
+ bool HasProtection();
+ virtual bool HonorProtection();
+ virtual bool IsProtected();
protected:
+ bool m_bGettingHonorProtection;
+ bool m_bGettingHasProtection;
+ bool m_bGettingIsProtected;
sal_uInt32 m_nAttributes;
sal_uInt32 m_nAttributes2;
sal_uInt32 m_nAttributes3;
@@ -229,8 +259,7 @@ public:
public:
void Read(LwpObjectStream* pStrm);
LwpObjectID& GetOnlyLayout() { return m_OnlyLayout;}
- LwpDLVListHeadTail& GetLayouts() { return m_Layouts;}
- LwpVirtualLayout* GetLayout(LwpVirtualLayout* pStartLayout);
+ rtl::Reference<LwpVirtualLayout> GetLayout(LwpVirtualLayout* pStartLayout);
protected:
LwpObjectID m_OnlyLayout; //LwpVirtualLayout
LwpDLVListHeadTail m_Layouts;
@@ -242,7 +271,7 @@ public:
LwpHeadLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm);
virtual ~LwpHeadLayout(){}
void RegisterStyle() SAL_OVERRIDE;
- LwpVirtualLayout* FindEnSuperTableLayout();
+ rtl::Reference<LwpVirtualLayout> FindEnSuperTableLayout();
protected:
void Read() SAL_OVERRIDE;
virtual LWP_LAYOUT_TYPE GetLayoutType () SAL_OVERRIDE { return LWP_HEAD_LAYOUT;}
@@ -298,7 +327,7 @@ public:
virtual sal_uInt8 GetContentOrientation() SAL_OVERRIDE;
virtual bool HonorProtection() SAL_OVERRIDE;
virtual bool IsProtected() SAL_OVERRIDE;
- LwpVirtualLayout* GetWaterMarkLayout();
+ rtl::Reference<LwpVirtualLayout> GetWaterMarkLayout();
XFBGImage* GetXFBGImage();
bool GetUsePrinterSettings();
@@ -395,7 +424,7 @@ public:
virtual bool IsUseOnAllOddPages() SAL_OVERRIDE;
virtual bool IsUseOnPage() SAL_OVERRIDE;
LwpObjectID& GetPosition(){ return m_Positon;}
- virtual LwpVirtualLayout* GetContainerLayout() SAL_OVERRIDE;
+ virtual rtl::Reference<LwpVirtualLayout> GetContainerLayout() SAL_OVERRIDE;
};
class LwpPlacableLayout : public LwpLayout
diff --git a/lotuswordpro/source/filter/lwpnotes.cxx b/lotuswordpro/source/filter/lwpnotes.cxx
index dd08b1762cdc..bd16ae9708d1 100644
--- a/lotuswordpro/source/filter/lwpnotes.cxx
+++ b/lotuswordpro/source/filter/lwpnotes.cxx
@@ -101,7 +101,7 @@ void LwpFribNote::RegisterNewStyle()
*/
void LwpFribNote::XFConvert(XFContentContainer* pCont)
{
- LwpNoteLayout* pLayout =static_cast<LwpNoteLayout*>(m_Layout.obj().get());
+ LwpNoteLayout* pLayout = dynamic_cast<LwpNoteLayout*>(m_Layout.obj().get());
if(pLayout)
{
XFAnnotation* pXFNote = new XFAnnotation;
@@ -217,10 +217,10 @@ OUString LwpNoteLayout::GetAuthor()
LwpNoteHeaderLayout* pTextLayout = static_cast<LwpNoteHeaderLayout*>(FindChildByType(LWP_NOTEHEADER_LAYOUT));
if(pTextLayout)
{
- LwpStory* pStory = static_cast<LwpStory*>(pTextLayout->GetContent().obj().get());
+ LwpStory* pStory = dynamic_cast<LwpStory*>(pTextLayout->GetContent().obj().get());
if(pStory)
{
- LwpPara* pFirst = static_cast<LwpPara*>(pStory->GetFirstPara().obj().get());
+ LwpPara* pFirst = dynamic_cast<LwpPara*>(pStory->GetFirstPara().obj().get());
if(pFirst)
return pFirst->GetContentText(true);
}
diff --git a/lotuswordpro/source/filter/lwpobjfactory.cxx b/lotuswordpro/source/filter/lwpobjfactory.cxx
index f73f8003f7d1..5938635e2eb6 100644
--- a/lotuswordpro/source/filter/lwpobjfactory.cxx
+++ b/lotuswordpro/source/filter/lwpobjfactory.cxx
@@ -670,10 +670,15 @@ rtl::Reference<LwpObject> LwpObjectFactory::CreateObject(sal_uInt32 type, LwpObj
break;
}
}
- if(newObj.is())
+ if (newObj.is())
{
newObj->QuickRead();
- m_IdToObjList.insert(LwpIdToObjMap::value_type(objHdr.GetID(), newObj));
+ auto result = m_IdToObjList.insert(LwpIdToObjMap::value_type(objHdr.GetID(), newObj));
+ if (!result.second)
+ {
+ SAL_WARN("lwp", "clearing duplicate object");
+ newObj.clear();
+ }
}
return newObj;
@@ -706,7 +711,12 @@ rtl::Reference<LwpObject> LwpObjectFactory::QueryObject(const LwpObjectID &objID
return NULL;
}
+ if (std::find(m_aObjsIDInCreation.begin(), m_aObjsIDInCreation.end(), objID) != m_aObjsIDInCreation.end())
+ throw std::runtime_error("recursion in object creation");
+
+ m_aObjsIDInCreation.push_back(objID);
obj = CreateObject(objHdr.GetTag(), objHdr);
+ m_aObjsIDInCreation.pop_back();
}
return obj;
}
diff --git a/lotuswordpro/source/filter/lwpobjfactory.hxx b/lotuswordpro/source/filter/lwpobjfactory.hxx
index 4feab65239a3..733fbb4bf0aa 100644
--- a/lotuswordpro/source/filter/lwpobjfactory.hxx
+++ b/lotuswordpro/source/filter/lwpobjfactory.hxx
@@ -76,6 +76,7 @@
#include "lwpidxmgr.hxx"
#include <unordered_map>
+#include <vector>
/**
* @brief object factory used for lwp object creation and maintenance
@@ -90,9 +91,9 @@ public:
//For object Factory and object manager
private:
-// static LwpObjectFactory *m_pMgr;
sal_uInt32 m_nNumObjs;
LwpSvStream* m_pSvStream;
+ std::vector<LwpObjectID> m_aObjsIDInCreation;
struct hashFunc
{
size_t operator()( const LwpObjectID& rName ) const
diff --git a/lotuswordpro/source/filter/lwpoleobject.cxx b/lotuswordpro/source/filter/lwpoleobject.cxx
index 4afb0309d6da..ce23af8fc5e1 100644
--- a/lotuswordpro/source/filter/lwpoleobject.cxx
+++ b/lotuswordpro/source/filter/lwpoleobject.cxx
@@ -116,10 +116,10 @@ void LwpGraphicOleObject::GetGrafScaledSize(double & fWidth, double & fHeight)
double fSclGrafWidth = fWidth;//LwpTools::ConvertFromUnitsToMetric(pMyScale->GetScaleWidth());
double fSclGrafHeight = fHeight;//LwpTools::ConvertFromUnitsToMetric(pMyScale->GetScaleHeight());
- LwpVirtualLayout* pLayout = GetLayout(NULL);
- if (pLayout && pLayout->IsFrame())
+ rtl::Reference<LwpVirtualLayout> xLayout(GetLayout(nullptr));
+ if (xLayout.is() && xLayout->IsFrame())
{
- LwpFrameLayout* pMyFrameLayout = static_cast<LwpFrameLayout*>(pLayout);
+ LwpFrameLayout* pMyFrameLayout = static_cast<LwpFrameLayout*>(xLayout.get());
LwpLayoutScale* pMyScale = pMyFrameLayout->GetLayoutScale();
LwpLayoutGeometry* pFrameGeo = pMyFrameLayout->GetGeometry();
diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx
index 0f788992b303..776b5740577b 100644
--- a/lotuswordpro/source/filter/lwppagelayout.cxx
+++ b/lotuswordpro/source/filter/lwppagelayout.cxx
@@ -506,24 +506,24 @@ void LwpPageLayout::ResetXFColumns()
LwpHeaderLayout* LwpPageLayout::GetHeaderLayout()
{
- LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get());
- while(pLay)
+ rtl::Reference<LwpVirtualLayout> xLay(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
+ while (xLay.is())
{
- if( pLay->GetLayoutType() == LWP_HEADER_LAYOUT )
- return ( static_cast<LwpHeaderLayout*> (pLay) );
- pLay = dynamic_cast<LwpVirtualLayout*> (pLay->GetNext().obj().get());
+ if (xLay->GetLayoutType() == LWP_HEADER_LAYOUT)
+ return dynamic_cast<LwpHeaderLayout*>(xLay.get());
+ xLay.set(dynamic_cast<LwpVirtualLayout*>(xLay->GetNext().obj().get()));
}
return NULL;
}
LwpFooterLayout* LwpPageLayout::GetFooterLayout()
{
- LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get());
- while(pLay)
+ rtl::Reference<LwpVirtualLayout> xLay(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
+ while (xLay.is())
{
- if( pLay->GetLayoutType() == LWP_FOOTER_LAYOUT )
- return ( static_cast<LwpFooterLayout*> (pLay) );
- pLay = dynamic_cast<LwpVirtualLayout*> (pLay->GetNext().obj().get());
+ if (xLay->GetLayoutType() == LWP_FOOTER_LAYOUT)
+ return dynamic_cast<LwpFooterLayout*>(xLay.get());
+ xLay.set(dynamic_cast<LwpVirtualLayout*>(xLay->GetNext().obj().get()));
}
return NULL;
}
@@ -536,19 +536,19 @@ LwpPageLayout* LwpPageLayout::GetOddChildLayout()
{
if(IsComplex())
{
- LwpVirtualLayout* pLay = dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get());
- while(pLay)
+ rtl::Reference<LwpVirtualLayout> xLay(dynamic_cast<LwpVirtualLayout*>(GetChildHead().obj().get()));
+ while (xLay.is())
{
- if( pLay->GetLayoutType() == LWP_PAGE_LAYOUT )
+ if (xLay->GetLayoutType() == LWP_PAGE_LAYOUT)
{
- LwpPageLayout* pPageLayout = static_cast<LwpPageLayout*> (pLay);
+ LwpPageLayout* pPageLayout = static_cast<LwpPageLayout*>(xLay.get());
LwpUseWhen* pUseWhen = pPageLayout->GetUseWhen();
if(pUseWhen && pUseWhen->IsUseOnAllOddPages())
{
return pPageLayout;
}
}
- pLay = dynamic_cast<LwpVirtualLayout*> (pLay->GetNext().obj().get());
+ xLay.set(dynamic_cast<LwpVirtualLayout*>(xLay->GetNext().obj().get()));
}
}
return NULL;
@@ -579,6 +579,8 @@ sal_Int32 LwpPageLayout::GetPageNumber(sal_uInt16 nLayoutNumber)
{
sal_Int16 nPageNumber = -1;
LwpFoundry* pFoundry = this->GetFoundry();
+ if (!pFoundry)
+ return nPageNumber;
LwpDocument* pDoc = pFoundry->GetDocument();
LwpDLVListHeadTailHolder* pHeadTail = dynamic_cast<LwpDLVListHeadTailHolder*>(pDoc->GetPageHintsID().obj().get());
if(!pHeadTail) return nPageNumber;
diff --git a/lotuswordpro/source/filter/lwppara.cxx b/lotuswordpro/source/filter/lwppara.cxx
index 7ed4d1ae4e38..ea746ddb4efb 100644
--- a/lotuswordpro/source/filter/lwppara.cxx
+++ b/lotuswordpro/source/filter/lwppara.cxx
@@ -277,6 +277,7 @@ void LwpPara::XFConvert(XFContentContainer* pCont)
//Create an XFPara for this VO_PARA
XFParagraph *pPara = new XFParagraph;
+ rtl::Reference<XFContentContainer> xHolder(pPara);
pPara->SetStyleName(m_StyleName);
if(!m_SectionStyleName.isEmpty())
@@ -288,7 +289,7 @@ void LwpPara::XFConvert(XFContentContainer* pCont)
m_pXFContainer = pSection;
}
- if (m_bHasBullet && m_pSilverBullet)
+ if (m_bHasBullet && m_pSilverBullet)
{
XFContentContainer* pListItem = AddBulletList(m_pXFContainer);
if (pListItem)
@@ -296,7 +297,7 @@ void LwpPara::XFConvert(XFContentContainer* pCont)
pListItem->Add(pPara);
}
}
- else
+ else if (m_pXFContainer)
{
LwpBulletStyleMgr* pBulletStyleMgr = this->GetBulletStyleMgr();
if (pBulletStyleMgr)
@@ -353,13 +354,14 @@ void LwpPara::RegisterStyle()
//2 reg para style
if (!m_pFoundry)
return;
- XFParaStyle* pBaseStyle = static_cast<XFParaStyle*>(m_pFoundry->GetStyleManager()->GetStyle(m_ParaStyle));
- if (pBaseStyle == NULL) return;
+ XFParaStyle* pBaseStyle = dynamic_cast<XFParaStyle*>(m_pFoundry->GetStyleManager()->GetStyle(m_ParaStyle));
+ if (pBaseStyle == nullptr) return;
m_StyleName = pBaseStyle->GetStyleName();//such intf to be added
m_ParentStyleName = m_StyleName;
XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
- if (GetParaStyle()->GetIndent())
+ LwpParaStyle* pParaStyle = GetParaStyle();
+ if (pParaStyle && pParaStyle->GetIndent())
{
std::unique_ptr<LwpIndentOverride> pIndentOverride(GetParaStyle()->GetIndent()->clone());
delete m_pIndentOverride;
@@ -699,7 +701,7 @@ void LwpPara::RegisterStyle()
if (!pPrePara)
{
LwpStory* pStory = pPara->GetStory();
- pPrePara = pStory->GetLastParaOfPreviousStory();
+ pPrePara = pStory ? pStory->GetLastParaOfPreviousStory() : nullptr;
if (!pPrePara)
{
@@ -767,13 +769,13 @@ void LwpPara::RegisterStyle()
//register tab style
if(m_Fribs.HasFrib(FRIB_TAG_TAB))
{
- XFParaStyle* pParaStyle = new XFParaStyle;
- *pParaStyle = *GetXFParaStyle();
+ XFParaStyle* pNewParaStyle = new XFParaStyle;
+ *pNewParaStyle = *GetXFParaStyle();
//pOverStyle->SetStyleName("");
- this->RegisterTabStyle(pParaStyle);
+ this->RegisterTabStyle(pNewParaStyle);
if (!m_ParentStyleName.isEmpty())
- pParaStyle->SetParentStyleName(m_ParentStyleName);
- m_StyleName = pXFStyleManager->AddStyle(pParaStyle).m_pStyle->GetStyleName();
+ pNewParaStyle->SetParentStyleName(m_ParentStyleName);
+ m_StyleName = pXFStyleManager->AddStyle(pNewParaStyle).m_pStyle->GetStyleName();
}
//register master page;
diff --git a/lotuswordpro/source/filter/lwppara1.cxx b/lotuswordpro/source/filter/lwppara1.cxx
index c9ad2d86378c..a7b9e77234f9 100644
--- a/lotuswordpro/source/filter/lwppara1.cxx
+++ b/lotuswordpro/source/filter/lwppara1.cxx
@@ -224,7 +224,7 @@ void LwpPara::GetParaNumber(sal_uInt16 nPosition, ParaNumbering* pParaNumbering)
if (pPreFrib)
{
if ((pPreFrib->GetType() == FRIB_TAG_TEXT) &&
- (pPreFrib->GetModifiers()->aTxtAttrOverride.GetHideLevels() == nHideLevels))
+ (pPreFrib->GetModifiers() && pPreFrib->GetModifiers()->aTxtAttrOverride.GetHideLevels() == nHideLevels))
{
pParaNumbering->pPrefix = static_cast<LwpFribText*>(pPreFrib);
}
@@ -628,8 +628,10 @@ bool LwpPara::ComparePagePosition(LwpVirtualLayout * pPreLayout, LwpVirtualLayou
bool LwpPara::IsInCell()
{
LwpStory *pStory = GetStory();
- LwpVirtualLayout* pLayout = pStory ? pStory->GetLayout(NULL) : NULL;
- if(pLayout && pLayout->IsCell())
+ if (!pStory)
+ return false;
+ rtl::Reference<LwpVirtualLayout> xLayout(pStory->GetLayout(nullptr));
+ if (xLayout.is() && xLayout->IsCell())
return true;
return false;
}
diff --git a/lotuswordpro/source/filter/lwpparaproperty.cxx b/lotuswordpro/source/filter/lwpparaproperty.cxx
index 3dc427f01940..f4e79f845870 100644
--- a/lotuswordpro/source/filter/lwpparaproperty.cxx
+++ b/lotuswordpro/source/filter/lwpparaproperty.cxx
@@ -146,8 +146,8 @@ LwpParaAlignProperty::LwpParaAlignProperty(LwpObjectStream* pFile)
LwpObjectID align;
align.ReadIndexed(pFile);
- LwpAlignmentPiece *pAlignmentPiece = dynamic_cast<LwpAlignmentPiece*>(align.obj(VO_ALIGNMENTPIECE).get());
- m_pAlignment = pAlignmentPiece ? dynamic_cast<LwpAlignmentOverride*>(pAlignmentPiece->GetOverride()) : NULL;
+ rtl::Reference<LwpAlignmentPiece> xAlignmentPiece(dynamic_cast<LwpAlignmentPiece*>(align.obj(VO_ALIGNMENTPIECE).get()));
+ m_pAlignment = xAlignmentPiece.is() ? dynamic_cast<LwpAlignmentOverride*>(xAlignmentPiece->GetOverride()) : nullptr;
}
diff --git a/lotuswordpro/source/filter/lwpparastyle.cxx b/lotuswordpro/source/filter/lwpparastyle.cxx
index 6d6d6372ce94..6822fd9b7cb3 100644
--- a/lotuswordpro/source/filter/lwpparastyle.cxx
+++ b/lotuswordpro/source/filter/lwpparastyle.cxx
@@ -679,6 +679,9 @@ void LwpParaStyle::ApplyTab(XFParaStyle *pParaStyle, LwpTabOverride *pTabOverRid
void LwpParaStyle::RegisterStyle()
{
+ if (!m_pFoundry)
+ throw std::runtime_error("missing Foundry");
+
XFParaStyle* pStyle = new XFParaStyle();
//Set name
diff --git a/lotuswordpro/source/filter/lwpproplist.cxx b/lotuswordpro/source/filter/lwpproplist.cxx
index f79022f4898e..07920fbe3b8f 100644
--- a/lotuswordpro/source/filter/lwpproplist.cxx
+++ b/lotuswordpro/source/filter/lwpproplist.cxx
@@ -71,7 +71,7 @@ LwpPropListElement::LwpPropListElement(LwpObjectHeader &objHdr, LwpSvStream *pSt
LwpPropListElement* LwpPropListElement::GetNext()
{
- return static_cast<LwpPropListElement*>(LwpDLVList::GetNext().obj().get());
+ return dynamic_cast<LwpPropListElement*>(LwpDLVList::GetNext().obj().get());
}
void LwpPropListElement::Read()
@@ -117,7 +117,7 @@ void LwpPropList::Read(LwpObjectStream* pObjStrm)
LwpPropListElement* LwpPropList::GetFirst()
{
- return static_cast<LwpPropListElement*>(LwpDLVListHead::GetFirst().obj().get());
+ return dynamic_cast<LwpPropListElement*>(LwpDLVListHead::GetFirst().obj().get());
}
OUString LwpPropList::EnumNamedProperty(OUString& name,OUString& value)
@@ -131,11 +131,10 @@ OUString LwpPropList::EnumNamedProperty(OUString& name,OUString& value)
value = pElement->GetValue().str();
name = pElement->GetName().str();
pElement = pElement->GetNext();
- return pElement->GetName().str();
+ if(pElement)
+ return pElement->GetName().str();
}
- else
- return OUString("");
-
+ return OUString("");
}
else
{
diff --git a/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx b/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx
index 872d0117cdad..1a9c3ad1e876 100644
--- a/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx
+++ b/lotuswordpro/source/filter/lwpsdwgrouploaderv0102.cxx
@@ -131,11 +131,11 @@ void LwpSdwGroupLoaderV0102::BeginDrawObjects(std::vector< rtl::Reference<XFFram
m_pStream->SeekRel(2);
//for calculating transformation params.
- LwpFrameLayout* pMyFrameLayout = static_cast<LwpFrameLayout*>(m_pGraphicObj->GetLayout(NULL));
- if (pMyFrameLayout)
+ rtl::Reference<LwpFrameLayout> xMyFrameLayout(dynamic_cast<LwpFrameLayout*>(m_pGraphicObj->GetLayout(nullptr).get()));
+ if (xMyFrameLayout.is())
{
- LwpLayoutScale* pMyScale = pMyFrameLayout->GetLayoutScale();
- LwpLayoutGeometry* pFrameGeo = pMyFrameLayout->GetGeometry();
+ LwpLayoutScale* pMyScale = xMyFrameLayout->GetLayoutScale();
+ LwpLayoutGeometry* pFrameGeo = xMyFrameLayout->GetGeometry();
if (pMyScale && pFrameGeo)
{
// original drawing size
@@ -145,10 +145,8 @@ void LwpSdwGroupLoaderV0102::BeginDrawObjects(std::vector< rtl::Reference<XFFram
double fGrafOrgHeight = (double)nHeight/TWIPS_PER_CM;
// get margin values
- double fLeftMargin = pMyFrameLayout->GetMarginsValue(MARGIN_LEFT);
-// double fRightMargin = pMyFrameLayout->GetMarginsValue(MARGIN_RIGHT);
- double fTopMargin = pMyFrameLayout->GetMarginsValue(MARGIN_TOP);
-// double fBottomMargin = pMyFrameLayout->GetMarginsValue(MARGIN_BOTTOM);
+ double fLeftMargin = xMyFrameLayout->GetMarginsValue(MARGIN_LEFT);
+ double fTopMargin = xMyFrameLayout->GetMarginsValue(MARGIN_TOP);
// frame size
double fFrameWidth = LwpTools::ConvertFromUnitsToMetric(pFrameGeo->GetWidth());
@@ -199,7 +197,7 @@ void LwpSdwGroupLoaderV0102::BeginDrawObjects(std::vector< rtl::Reference<XFFram
}
// placement: centered
- if (pMyFrameLayout->GetScaleCenter())
+ if (xMyFrameLayout->GetScaleCenter())
{
Rectangle aBoundRect(static_cast<long>(left*m_aTransformData.fScaleX + fLeftMargin),
static_cast<long>(top * m_aTransformData.fScaleY + fTopMargin),
diff --git a/lotuswordpro/source/filter/lwpstory.cxx b/lotuswordpro/source/filter/lwpstory.cxx
index 9b59b26d5904..64c255559d50 100644
--- a/lotuswordpro/source/filter/lwpstory.cxx
+++ b/lotuswordpro/source/filter/lwpstory.cxx
@@ -105,15 +105,15 @@ void LwpStory::XFConvert(XFContentContainer* pCont)
XFConvertFrameInFrame(pCont);
//process para list
XFContentContainer* pParaCont = pCont;
- LwpPara* pPara = dynamic_cast<LwpPara*> ( GetFirstPara().obj().get() );
- while(pPara)
+ rtl::Reference<LwpPara> xPara(dynamic_cast<LwpPara*>(GetFirstPara().obj().get()));
+ while (xPara.is())
{
- pPara->SetFoundry(m_pFoundry);
- pPara->XFConvert(pParaCont);
+ xPara->SetFoundry(m_pFoundry);
+ xPara->XFConvert(pParaCont);
//Get the xfcontainer for the next para
- pParaCont = pPara->GetXFContainer();
- pPara = dynamic_cast<LwpPara*> ( pPara->GetNext().obj().get() );
+ pParaCont = xPara->GetXFContainer();
+ xPara.set(dynamic_cast<LwpPara*>(xPara->GetNext().obj().get()));
}
//process frame which anchor is to cell after converter all the para
@@ -121,26 +121,26 @@ void LwpStory::XFConvert(XFContentContainer* pCont)
XFConvertFrameInHeaderFooter(pCont);
//Release Lwp Objects
- LwpPara* pCur = dynamic_cast<LwpPara*> (GetFirstPara().obj().get());
- LwpPara* pNext;
- while(pCur)
+ rtl::Reference<LwpPara> xCur(dynamic_cast<LwpPara*>(GetFirstPara().obj().get()));
+ rtl::Reference<LwpPara> xNext;
+ while (xCur.is())
{
- pNext = dynamic_cast<LwpPara*> ( pCur->GetNext().obj().get() );
+ xNext.set(dynamic_cast<LwpPara*>(xCur->GetNext().obj().get()));
LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
LwpObjectFactory* pObjMgr = pGlobal->GetLwpObjFactory();
- pObjMgr->ReleaseObject(pCur->GetObjectID());
- pCur = pNext;
+ pObjMgr->ReleaseObject(xCur->GetObjectID());
+ xCur = xNext;
}
}
void LwpStory::RegisterStyle()
{
- LwpPara* pPara = dynamic_cast<LwpPara*>( GetFirstPara().obj().get() );
- while(pPara)
+ rtl::Reference<LwpPara> xPara(dynamic_cast<LwpPara*>(GetFirstPara().obj().get()));
+ while (xPara.is())
{
- pPara->SetFoundry(m_pFoundry);
- pPara->RegisterStyle();
- pPara = dynamic_cast<LwpPara*>(pPara->GetNext().obj().get());
+ xPara->SetFoundry(m_pFoundry);
+ xPara->DoRegisterStyle();
+ xPara.set(dynamic_cast<LwpPara*>(xPara->GetNext().obj().get()));
}
}
@@ -150,24 +150,7 @@ void LwpStory::Parse(IXFStream* pOutputStream)
XFConvert(m_pXFContainer);
m_pXFContainer->ToXml(pOutputStream);
delete m_pXFContainer;
- m_pXFContainer = NULL;
-
- //It seems that, currently, we do not need to process the child story
- /*LwpObject* pChildStory = GetFirstStory()->obj();
- if(pChildStory)
- {
- pChildStory->SetFoundry(m_pFoundry);
- pChildStory->Parse(pOutputStream);
- }*/
-
- //Don't process the next story
-/* LwpObject* pNextStory = GetNextStory()->obj();
- if(pNextStory)
- {
- pNextStory->SetFoundry(m_pFoundry);
- pNextStory->Parse(pOutputStream);
- }*/
-
+ m_pXFContainer = nullptr;
}
#include "lwppagelayout.hxx"
@@ -229,20 +212,23 @@ void LwpStory::SortPageLayout()
{
//Get all the pagelayout and store in list
std::vector<LwpPageLayout*> aLayoutList;
- LwpVirtualLayout* pLayout = GetLayout(NULL);
- while(pLayout)
+ rtl::Reference<LwpVirtualLayout> xLayout(GetLayout(nullptr));
+ while (xLayout.get())
{
- if(pLayout->IsPage())
+ LwpPageLayout *pLayout = xLayout->IsPage()
+ ? dynamic_cast<LwpPageLayout*>(xLayout.get())
+ : nullptr;
+ if (pLayout)
{
- LwpLayout::UseWhenType eSectionType = static_cast<LwpPageLayout*>(pLayout)->GetUseWhenType();
- //for mirror page, the child is pagelayout
- LwpVirtualLayout* pParent = pLayout->GetParentLayout();
- if(eSectionType != LwpLayout::StartWithinColume && pParent && !pParent->IsPage())
+ LwpLayout::UseWhenType eSectionType = pLayout->GetUseWhenType();
+ //for mirror page, the child is pagelayout
+ rtl::Reference<LwpVirtualLayout> xParent = xLayout->GetParentLayout();
+ if(eSectionType != LwpLayout::StartWithinColume && xParent.is() && !xParent->IsPage())
{
- aLayoutList.push_back(static_cast<LwpPageLayout*>(pLayout));
+ aLayoutList.push_back(pLayout);
}
}
- pLayout = GetLayout(pLayout);
+ xLayout = GetLayout(xLayout.get());
}
// sort the pagelayout according to their position
std::vector<LwpPageLayout*>::iterator aIt;
@@ -335,26 +321,24 @@ bool LwpStory::IsNeedSection()
**************************************************************************/
void LwpStory::XFConvertFrameInCell(XFContentContainer* pCont)
{
- LwpVirtualLayout* pLayout = GetLayout(NULL);
- while(pLayout)
+ rtl::Reference<LwpVirtualLayout> xLayout(GetLayout(nullptr));
+ while (xLayout.is())
{
- LwpVirtualLayout* pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetChildHead().obj().get());
- while(pFrameLayout)
+ rtl::Reference<LwpVirtualLayout> xFrameLayout(dynamic_cast<LwpVirtualLayout*>(xLayout->GetChildHead().obj().get()));
+ while (xFrameLayout.is())
{
-
- //if(pFrameLayout->IsAnchorCell())
- if(pFrameLayout->IsAnchorCell() && pFrameLayout->HasContent())
+ if (xFrameLayout->IsAnchorCell() && xFrameLayout->HasContent())
{
//get the first xfpara
rtl::Reference<XFContent> first(
pCont->FindFirstContent(enumXFContentPara));
XFContentContainer* pXFFirtPara = static_cast<XFContentContainer*>(first.get());
if(pXFFirtPara)
- pFrameLayout->XFConvert(pXFFirtPara);
+ xFrameLayout->XFConvert(pXFFirtPara);
}
- pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pFrameLayout->GetNext().obj().get());
+ xFrameLayout.set(dynamic_cast<LwpVirtualLayout*>(xFrameLayout->GetNext().obj().get()));
}
- pLayout = GetLayout(pLayout);
+ xLayout = GetLayout(xLayout.get());
}
}
@@ -366,22 +350,22 @@ void LwpStory::XFConvertFrameInCell(XFContentContainer* pCont)
**************************************************************************/
void LwpStory::XFConvertFrameInPage(XFContentContainer* pCont)
{
- LwpVirtualLayout* pLayout = GetLayout(NULL);
- while(pLayout)
+ rtl::Reference<LwpVirtualLayout> xLayout(GetLayout(nullptr));
+ while (xLayout.is())
{
- LwpVirtualLayout* pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetChildHead().obj().get());
- while(pFrameLayout)
+ rtl::Reference<LwpVirtualLayout> xFrameLayout(dynamic_cast<LwpVirtualLayout*>(xLayout->GetChildHead().obj().get()));
+ while (xFrameLayout.is())
{
- if((pFrameLayout->IsAnchorPage()
- &&(pFrameLayout->IsFrame()
- ||pFrameLayout->IsSuperTable()
- ||pFrameLayout->IsGroupHead())))
+ if((xFrameLayout->IsAnchorPage()
+ &&(xFrameLayout->IsFrame()
+ || xFrameLayout->IsSuperTable()
+ || xFrameLayout->IsGroupHead())))
{
- pFrameLayout->XFConvert(pCont);
+ xFrameLayout->XFConvert(pCont);
}
- pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pFrameLayout->GetNext().obj().get());
+ xFrameLayout.set(dynamic_cast<LwpVirtualLayout*>(xFrameLayout->GetNext().obj().get()));
}
- pLayout = GetLayout(pLayout);
+ xLayout = GetLayout(xLayout.get());
}
}
/**************************************************************************
@@ -392,19 +376,19 @@ void LwpStory::XFConvertFrameInPage(XFContentContainer* pCont)
**************************************************************************/
void LwpStory::XFConvertFrameInFrame(XFContentContainer* pCont)
{
- LwpVirtualLayout* pLayout = GetLayout(NULL);
- while(pLayout)
+ rtl::Reference<LwpVirtualLayout> xLayout(GetLayout(nullptr));
+ while (xLayout.get())
{
- LwpVirtualLayout* pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetChildHead().obj().get());
- while(pFrameLayout)
+ rtl::Reference<LwpVirtualLayout> xFrameLayout(dynamic_cast<LwpVirtualLayout*>(xLayout->GetChildHead().obj().get()));
+ while (xFrameLayout.is())
{
- if(pFrameLayout->IsAnchorFrame())
+ if (xFrameLayout->IsAnchorFrame())
{
- pFrameLayout->XFConvert(pCont);
+ xFrameLayout->XFConvert(pCont);
}
- pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pFrameLayout->GetNext().obj().get());
+ xFrameLayout.set(dynamic_cast<LwpVirtualLayout*>(xFrameLayout->GetNext().obj().get()));
}
- pLayout = GetLayout(pLayout);
+ xLayout = GetLayout(xLayout.get());
}
}
/**************************************************************************
@@ -415,24 +399,24 @@ void LwpStory::XFConvertFrameInFrame(XFContentContainer* pCont)
**************************************************************************/
void LwpStory::XFConvertFrameInHeaderFooter(XFContentContainer* pCont)
{
- LwpVirtualLayout* pLayout = GetLayout(NULL);
- while(pLayout)
+ rtl::Reference<LwpVirtualLayout> xLayout(GetLayout(nullptr));
+ while (xLayout.is())
{
- LwpVirtualLayout* pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pLayout->GetChildHead().obj().get());
- while(pFrameLayout)
+ rtl::Reference<LwpVirtualLayout> xFrameLayout(dynamic_cast<LwpVirtualLayout*>(xLayout->GetChildHead().obj().get()));
+ while (xFrameLayout.is())
{
- if(pFrameLayout->IsAnchorPage() && (pLayout->IsHeader() || pLayout->IsFooter()))
+ if (xFrameLayout->IsAnchorPage() && (xLayout->IsHeader() || xLayout->IsFooter()))
{
//The frame must be included by <text:p>
rtl::Reference<XFContent> first(
pCont->FindFirstContent(enumXFContentPara));
XFContentContainer* pXFFirtPara = static_cast<XFContentContainer*>(first.get());
if(pXFFirtPara)
- pFrameLayout->XFConvert(pXFFirtPara);
+ xFrameLayout->XFConvert(pXFFirtPara);
}
- pFrameLayout = dynamic_cast<LwpVirtualLayout*>(pFrameLayout->GetNext().obj().get());
+ xFrameLayout.set(dynamic_cast<LwpVirtualLayout*>(xFrameLayout->GetNext().obj().get()));
}
- pLayout = GetLayout(pLayout);
+ xLayout = GetLayout(xLayout.get());
}
}
@@ -452,10 +436,10 @@ XFContentContainer* LwpStory::GetXFContent()
LwpPara* LwpStory::GetLastParaOfPreviousStory()
{
- LwpVirtualLayout* pVLayout = this->GetLayout(NULL);
- if (pVLayout)
+ rtl::Reference<LwpVirtualLayout> xVLayout(this->GetLayout(nullptr));
+ if (xVLayout.is())
{
- return pVLayout->GetLastParaOfPreviousStory();
+ return xVLayout->GetLastParaOfPreviousStory();
}
return NULL;
diff --git a/lotuswordpro/source/filter/lwpstory.hxx b/lotuswordpro/source/filter/lwpstory.hxx
index a546b9d88ca8..c4d42de860b1 100644
--- a/lotuswordpro/source/filter/lwpstory.hxx
+++ b/lotuswordpro/source/filter/lwpstory.hxx
@@ -155,7 +155,7 @@ LwpMiddleLayout* LwpStory::GetTabLayout()
{
if(m_pTabLayout)
return m_pTabLayout;
- return static_cast<LwpMiddleLayout*>(GetLayout(NULL));
+ return dynamic_cast<LwpMiddleLayout*>(GetLayout(nullptr).get());
}
void LwpStory::SetPMModified(bool bPMModified)
{
diff --git a/lotuswordpro/source/filter/lwptable.hxx b/lotuswordpro/source/filter/lwptable.hxx
index 6c4f1cbc973a..475d9a8924b2 100644
--- a/lotuswordpro/source/filter/lwptable.hxx
+++ b/lotuswordpro/source/filter/lwptable.hxx
@@ -124,7 +124,10 @@ public:
LwpObjectID& GetDefaultCellStyle() {return m_DefaultCellStyle;}
sal_uInt16 GetRow() {return m_nRow;}
sal_uInt16 GetColumn() {return m_nColumn;}
- LwpTableLayout * GetTableLayout(){return static_cast<LwpTableLayout *>(GetLayout(NULL));}
+ rtl::Reference<LwpTableLayout> GetTableLayout()
+ {
+ return rtl::Reference<LwpTableLayout>(dynamic_cast<LwpTableLayout*>(GetLayout(nullptr).get()));
+ }
bool IsNumberDown();
virtual bool IsTable() SAL_OVERRIDE { return true;}
LwpSuperTableLayout* GetSuperTableLayout();
diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx
index ecf37c44a5c1..6f1b73cf493d 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -355,7 +355,7 @@ void LwpSuperTableLayout::ApplyAlignment(XFTableStyle * pTableStyle)
void LwpSuperTableLayout::XFConvert(XFContentContainer* pCont)
{
if ( LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE == GetRelativeType()
- && !GetContainerLayout()->IsCell())
+ && (!GetContainerLayout().is() || !GetContainerLayout()->IsCell()) )
{
LwpTableLayout * pTableLayout = GetTableLayout();
if (pTableLayout)
@@ -451,6 +451,7 @@ LwpCellLayout * LwpTableLayout::GetCellByRowCol(sal_uInt16 nRow, sal_uInt16 nCol
return m_WordProCellsMap[static_cast<size_t>(nRow)*m_nCols + nCol];
}
+
/**
* @short traverse all table cells
* @param
@@ -581,10 +582,16 @@ void LwpTableLayout::RegisterColumns()
LwpColumnLayout * pColumnLayout = dynamic_cast<LwpColumnLayout *>(rColumnID.obj().get());
while (pColumnLayout)
{
- m_pColumns[pColumnLayout->GetColumnID()] = pColumnLayout;
+ auto nColId = pColumnLayout->GetColumnID();
+ if (nColId >= nCols)
+ {
+ delete [] pWidthCalculated;
+ throw std::range_error("corrupt LwpTableLayout");
+ }
+ m_pColumns[nColId] = pColumnLayout;
if (!pColumnLayout->IsJustifiable())
{
- pWidthCalculated[pColumnLayout->GetColumnID()] = sal_True;
+ pWidthCalculated[nColId] = sal_True;
dTableWidth -= pColumnLayout->GetWidth();
nJustifiableColumn --;
}
@@ -594,7 +601,7 @@ void LwpTableLayout::RegisterColumns()
}
// if all columns are not justifiable, the rightmost column will be changed to justifiable
- if(nJustifiableColumn == 0)
+ if (nJustifiableColumn == 0 && nCols != 0)
{
nJustifiableColumn ++;
if (m_pColumns[nCols - 1])
@@ -611,7 +618,7 @@ void LwpTableLayout::RegisterColumns()
}
// justifiable columns will share the remain width averagely
- dDefaultColumn = dTableWidth/nJustifiableColumn;
+ dDefaultColumn = nJustifiableColumn ? dTableWidth/nJustifiableColumn : 0;
// register default column style
XFColStyle *pColStyle = new XFColStyle();
@@ -687,11 +694,8 @@ void LwpTableLayout::RegisterStyle()
{
// get super table layout
LwpSuperTableLayout * pSuper = GetSuperTableLayout();
- if(!pSuper)
- {
- assert(false);
+ if (!pSuper)
return;
- }
// get table
LwpTable * pTable = GetTable();
@@ -719,7 +723,7 @@ void LwpTableLayout::RegisterStyle()
// If the table is not "with paragraph above" placement, create an frame style
// by supertable layout
if ( LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE == nType
- && (!pSuper->GetContainerLayout() || !pSuper->GetContainerLayout()->IsCell()) )
+ && (!pSuper->GetContainerLayout().is() || !pSuper->GetContainerLayout()->IsCell()) )
{
//with para above
// pSuper->ApplyBackColor(pTableStyle);
@@ -1107,9 +1111,9 @@ void LwpTableLayout::PutCellVals(LwpFoundry* pFoundry, LwpObjectID aTableID)
try{
- LwpDLVListHeadHolder* pHolder = static_cast<LwpDLVListHeadHolder*>(pFoundry->GetNumberManager().GetTableRangeID().obj().get());
+ LwpDLVListHeadHolder* pHolder = dynamic_cast<LwpDLVListHeadHolder*>(pFoundry->GetNumberManager().GetTableRangeID().obj().get());
- LwpTableRange* pTableRange = static_cast<LwpTableRange*>(pHolder->GetHeadID().obj().get());
+ LwpTableRange* pTableRange = pHolder ? dynamic_cast<LwpTableRange*>(pHolder->GetHeadID().obj().get()) : nullptr;
//Look up the table
while (NULL!=pTableRange)
@@ -1122,44 +1126,50 @@ void LwpTableLayout::PutCellVals(LwpFoundry* pFoundry, LwpObjectID aTableID)
pTableRange = pTableRange->GetNext();
}
- if (pTableRange)
- {
- LwpCellRange* pRange = static_cast<LwpCellRange*>(pTableRange->GetCellRangeID().obj().get());
- LwpFolder* pFolder = static_cast<LwpFolder*>(pRange->GetFolderID().obj().get());
- LwpObjectID aRowListID = pFolder->GetChildHeadID();
- LwpRowList* pRowList = static_cast<LwpRowList*>(aRowListID.obj().get());
+ if (!pTableRange)
+ return;
+
+ LwpCellRange* pRange = dynamic_cast<LwpCellRange*>(pTableRange->GetCellRangeID().obj().get());
+ if (!pRange)
+ return;
+
+ LwpFolder* pFolder = dynamic_cast<LwpFolder*>(pRange->GetFolderID().obj().get());
+ if (!pFolder)
+ return;
- //loop the rowlist
- while( NULL!=pRowList)
+ LwpObjectID aRowListID = pFolder->GetChildHeadID();
+ LwpRowList* pRowList = dynamic_cast<LwpRowList*>(aRowListID.obj().get());
+
+ //loop the rowlist
+ while( nullptr!=pRowList)
+ {
+ sal_uInt16 nRowID = pRowList->GetRowID();
{
- sal_uInt16 nRowID = pRowList->GetRowID();
+ LwpCellList* pCellList = dynamic_cast<LwpCellList*>(pRowList->GetChildHeadID().obj().get());
+ //loop the cellList
+ while( nullptr!=pCellList)
{
- LwpCellList* pCellList = static_cast<LwpCellList*>(pRowList->GetChildHeadID().obj().get());
- //loop the celllist
- while( NULL!=pCellList)
- {
- {//put cell
- sal_uInt16 nColID = pCellList->GetColumnID();
-
- XFCell* pCell = GetCellsMap(nRowID,static_cast<sal_uInt8>(nColID));
- if (pCell)
- {
- pCellList->Convert(pCell, this);
-
- //process paragraph
- PostProcessParagraph(pCell, nRowID, nColID);
- }
- else
- {
- //Hidden cell would not be in cellsmap
- assert(false);
- }
+ {//put cell
+ sal_uInt16 nColID = pCellList->GetColumnID();
+
+ XFCell* pCell = GetCellsMap(nRowID,static_cast<sal_uInt8>(nColID));
+ if (pCell)
+ {
+ pCellList->Convert(pCell, this);
+
+ //process paragraph
+ PostProcessParagraph(pCell, nRowID, nColID);
+ }
+ else
+ {
+ //Hidden cell would not be in cellsmap
+ assert(false);
}
- pCellList = static_cast<LwpCellList*>(pCellList->GetNextID().obj().get());
}
+ pCellList = dynamic_cast<LwpCellList*>(pCellList->GetNextID().obj().get());
}
- pRowList = static_cast<LwpRowList*>(pRowList->GetNextID().obj().get());
}
+ pRowList = dynamic_cast<LwpRowList*>(pRowList->GetNextID().obj().get());
}
}catch (...) {
@@ -1215,14 +1225,17 @@ void LwpTableLayout::PostProcessParagraph(XFCell *pCell, sal_uInt16 nRowID, sal_
if (bColorMod)
{
- rtl::Reference<XFFont> pFont = pOverStyle->GetFont();
- XFColor aColor = pFont->GetColor();
- if ( aColor == aNullColor )
+ rtl::Reference<XFFont> xFont = pOverStyle->GetFont();
+ if (xFont.is())
{
- rtl::Reference<XFFont> pNewFont = new XFFont;
- aColor = pNumStyle->GetColor();
- pNewFont->SetColor(aColor);
- pOverStyle->SetFont(pNewFont);
+ XFColor aColor = xFont->GetColor();
+ if ( aColor == aNullColor )
+ {
+ rtl::Reference<XFFont> pNewFont = new XFFont;
+ aColor = pNumStyle->GetColor();
+ pNewFont->SetColor(aColor);
+ pOverStyle->SetFont(pNewFont);
+ }
}
}
diff --git a/lotuswordpro/source/filter/lwptblcell.cxx b/lotuswordpro/source/filter/lwptblcell.cxx
index cf0cddc8bafd..e5db4894a97d 100644
--- a/lotuswordpro/source/filter/lwptblcell.cxx
+++ b/lotuswordpro/source/filter/lwptblcell.cxx
@@ -107,7 +107,7 @@ void LwpCellList::Parse(IXFStream* /*pOutputStream*/)
void LwpCellList::Convert(XFCell * pCell, LwpTableLayout* /*pCellsMap*/)
{
LwpObjectID aValueID = GetValueID();
- LwpNumericValue* pValue = static_cast<LwpNumericValue*>(aValueID.obj().get());
+ LwpNumericValue* pValue = dynamic_cast<LwpNumericValue*>(aValueID.obj().get());
if (pValue)
{
pCell->SetValue( pValue->GetValue() );
diff --git a/lotuswordpro/source/filter/lwptblcell.hxx b/lotuswordpro/source/filter/lwptblcell.hxx
index 2a2273cb153d..6437c0e3a3db 100644
--- a/lotuswordpro/source/filter/lwptblcell.hxx
+++ b/lotuswordpro/source/filter/lwptblcell.hxx
@@ -152,7 +152,7 @@ public:
void Parse(IXFStream* pOutputStream) SAL_OVERRIDE;
LwpObjectID GetCellRangeID(){return cpCellRange;}
LwpObjectID GetTableID(){ return cqTable;}
- LwpTableRange* GetNext() { return static_cast<LwpTableRange*>(LwpDLVList::GetNext().obj().get());}
+ LwpTableRange* GetNext() { return dynamic_cast<LwpTableRange*>(LwpDLVList::GetNext().obj().get());}
protected:
LwpObjectID cqTable;
LwpObjectID cpCellRange;
diff --git a/lotuswordpro/source/filter/lwptblformula.cxx b/lotuswordpro/source/filter/lwptblformula.cxx
index eda2b45fa55e..7f8ea4a13e68 100644
--- a/lotuswordpro/source/filter/lwptblformula.cxx
+++ b/lotuswordpro/source/filter/lwptblformula.cxx
@@ -201,8 +201,13 @@ bool LwpFormulaInfo::ReadExpression()
// Len = m_pObjStrm->QuickReaduInt16();
m_pObjStrm->SeekRel(2);
- while ((TokenType = m_pObjStrm->QuickReaduInt16()) != TK_END)
+ bool bError = false;
+ while ((TokenType = m_pObjStrm->QuickReaduInt16(&bError)) != TK_END)
{
+
+ if (bError)
+ throw std::runtime_error("error reading expression");
+
// Get the disk length of this token
DiskLength = m_pObjStrm->QuickReaduInt16();
@@ -252,19 +257,29 @@ bool LwpFormulaInfo::ReadExpression()
case TK_NOT:
m_pObjStrm->SeekRel(DiskLength); // extensible for future
+ if (m_aStack.size() >= 2)
{//binary operator
LwpFormulaOp* pOp = new LwpFormulaOp(TokenType);
pOp->AddArg(m_aStack.back()); m_aStack.pop_back();
pOp->AddArg(m_aStack.back()); m_aStack.pop_back();
m_aStack.push_back(pOp);
}
+ else
+ {
+ readSucceeded = false;
+ }
break;
case TK_UNARY_MINUS:
+ if (!m_aStack.empty())
{
LwpFormulaUnaryOp* pOp = new LwpFormulaUnaryOp(TokenType);
pOp->AddArg(m_aStack.back()); m_aStack.pop_back();
m_aStack.push_back(pOp);
}
+ else
+ {
+ readSucceeded = false;
+ }
break;
default:
// We don't know what to do with this token, so eat it.
@@ -367,7 +382,7 @@ void LwpFormulaInfo::Read()
{
LwpCellList::Read();
{
- LwpRowList* pRowList = static_cast<LwpRowList*>(cParent.obj().get());
+ LwpRowList* pRowList = dynamic_cast<LwpRowList*>(cParent.obj().get());
if (pRowList)
{
m_nFormulaRow = pRowList->GetRowID();
diff --git a/lotuswordpro/source/filter/lwptoc.cxx b/lotuswordpro/source/filter/lwptoc.cxx
index dfb41788306f..ce2c239fd39f 100644
--- a/lotuswordpro/source/filter/lwptoc.cxx
+++ b/lotuswordpro/source/filter/lwptoc.cxx
@@ -106,17 +106,22 @@ void LwpTocSuperLayout::Read()
m_SearchItems.Read(m_pObjStrm);
- sal_uInt16 i;
sal_uInt16 count = m_pObjStrm->QuickReaduInt16();
- for (i = 0; (i < MAX_LEVELS) && (count > 0); i++, count--)
+ if (count > MAX_LEVELS)
+ throw std::range_error("corrupt LwpTocSuperLayout");
+ for (sal_uInt16 i = 0; i < count; ++i)
m_DestName[i].Read(m_pObjStrm);
count = m_pObjStrm->QuickReaduInt16();
- for (i = 0; (i < MAX_LEVELS) && (count > 0); i++, count--)
+ if (count > MAX_LEVELS)
+ throw std::range_error("corrupt LwpTocSuperLayout");
+ for (sal_uInt16 i = 0; i < count; ++i)
m_DestPGName[i].Read(m_pObjStrm);
count = m_pObjStrm->QuickReaduInt16();
- for (i = 0; i < count; i++)
+ if (count > MAX_LEVELS)
+ throw std::range_error("corrupt LwpTocSuperLayout");
+ for (sal_uInt16 i = 0; i < count; ++i)
m_nFlags[i] = m_pObjStrm->QuickReaduInt32();
m_pObjStrm->SkipExtra();
@@ -130,8 +135,8 @@ void LwpTocSuperLayout::RegisterStyle()
LwpSuperTableLayout::RegisterStyle();
// Get font info of default text style and set into tab style
- const LwpObjectID *pDefaultTextStyle = m_pFoundry->GetDefaultTextStyle();
- XFParaStyle* pBaseStyle = pDefaultTextStyle ? static_cast<XFParaStyle*>(m_pFoundry->GetStyleManager()->GetStyle(*pDefaultTextStyle)) : nullptr;
+ const LwpObjectID *pDefaultTextStyle = m_pFoundry ? m_pFoundry->GetDefaultTextStyle() : nullptr;
+ XFParaStyle* pBaseStyle = pDefaultTextStyle ? dynamic_cast<XFParaStyle*>(m_pFoundry->GetStyleManager()->GetStyle(*pDefaultTextStyle)) : nullptr;
XFTextStyle*pTextStyle = new XFTextStyle;
if (pBaseStyle)
pTextStyle->SetFont(pBaseStyle->GetFont()); // who delete this font?????
@@ -243,8 +248,12 @@ void LwpTocSuperLayout::XFConvert(XFContentContainer* pCont)
// add TOC content
LwpSuperTableLayout::XFConvert(pToc);
+ rtl::Reference<LwpVirtualLayout> xContainer(GetContainerLayout());
+ if (!xContainer.is())
+ return;
+
// if current TOC is located in a cell, we must add a frame between upper level container and TOC
- if ( !GetContainerLayout()->IsCell() )
+ if (!xContainer->IsCell())
{
pCont->Add(pToc);
}
diff --git a/lotuswordpro/source/filter/tocread.cxx b/lotuswordpro/source/filter/tocread.cxx
index 135281abcde7..42f444588fe9 100644
--- a/lotuswordpro/source/filter/tocread.cxx
+++ b/lotuswordpro/source/filter/tocread.cxx
@@ -118,6 +118,8 @@ CBenTOCReader::ReadLabel(unsigned long * pTOCOffset, unsigned long * pTOCSize)
assert(Flags == 0x0101 || Flags == 0x0);
cBlockSize = UtGetIntelWord(pCurrLabel) * 1024; pCurrLabel += 2;
+ if (cBlockSize == 0)
+ return BenErr_NotBentoContainer;
// Check major version
if (UtGetIntelWord(pCurrLabel) != BEN_CURR_MAJOR_VERSION)
diff --git a/lotuswordpro/source/filter/xfilter/xfcell.cxx b/lotuswordpro/source/filter/xfilter/xfcell.cxx
index ac79dda1e331..3fa0236bacc6 100644
--- a/lotuswordpro/source/filter/xfilter/xfcell.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfcell.cxx
@@ -91,6 +91,10 @@ void XFCell::Add(XFContent *pContent)
assert(false);
return;
}
+ if (!pContent)
+ {
+ throw std::runtime_error("no content");
+ }
if( pContent->GetContentType() == enumXFContentTable )
{
XFTable *pTable = static_cast<XFTable*>(pContent);
diff --git a/lotuswordpro/source/filter/xfilter/xftable.cxx b/lotuswordpro/source/filter/xfilter/xftable.cxx
index f9576f032593..652e9e7e0bb3 100644
--- a/lotuswordpro/source/filter/xfilter/xftable.cxx
+++ b/lotuswordpro/source/filter/xfilter/xftable.cxx
@@ -104,11 +104,13 @@ void XFTable::AddRow(XFRow *pRow)
m_aRows[row] = pRow;
}
-void XFTable::AddHeaderRow(XFRow *pRow)
+void XFTable::AddHeaderRow(XFRow *pRow)
{
- if( !pRow )
+ if( !pRow)
return;
- m_aHeaderRows.Add(pRow);
+ if (!m_aHeaderRows.is())
+ return;
+ m_aHeaderRows->Add(pRow);
}
OUString XFTable::GetTableName()
@@ -207,10 +209,10 @@ void XFTable::ToXml(IXFStream *pStrm)
}
}
- if( m_aHeaderRows.GetCount()>0 )
+ if (m_aHeaderRows.is() && m_aHeaderRows->GetCount()>0)
{
pStrm->StartElement( "table:table-header-rows" );
- m_aHeaderRows.ToXml(pStrm);
+ m_aHeaderRows->ToXml(pStrm);
pStrm->EndElement( "table:table-header-rows" );
}
//output rows:
diff --git a/lotuswordpro/source/filter/xfilter/xftable.hxx b/lotuswordpro/source/filter/xfilter/xftable.hxx
index 9dffb6f533e5..96cd9fac5f09 100644
--- a/lotuswordpro/source/filter/xfilter/xftable.hxx
+++ b/lotuswordpro/source/filter/xfilter/xftable.hxx
@@ -117,7 +117,7 @@ private:
OUString m_strName;
bool m_bSubTable;
XFCell *m_pOwnerCell;
- XFContentContainer m_aHeaderRows;
+ rtl::Reference<XFContentContainer> m_aHeaderRows;
std::map<sal_uInt16, XFRow*> m_aRows;
std::map<sal_Int32,OUString> m_aColumns;
OUString m_strDefCellStyle;