diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-12-13 16:59:16 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-12-13 16:59:16 +0000 |
commit | 80509545cc43893776dd24f441e9b95567ce06db (patch) | |
tree | 49a42342eb29861b741190651ede43b3cf671223 /lotuswordpro | |
parent | 64cfe976c36cb930e0a96557ba7d9eb99442fc59 (diff) |
hold WaterMarkLayout by reference
Change-Id: I7dc7739ee7b958319ddd4e0cf262254728ef0569
Diffstat (limited to 'lotuswordpro')
-rw-r--r-- | lotuswordpro/source/filter/lwpframelayout.cxx | 15 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwplayout.cxx | 17 | ||||
-rw-r--r-- | lotuswordpro/source/filter/lwplayout.hxx | 2 |
3 files changed, 18 insertions, 16 deletions
diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx index b31791aca1aa..7312e81da5eb 100644 --- a/lotuswordpro/source/filter/lwpframelayout.cxx +++ b/lotuswordpro/source/filter/lwpframelayout.cxx @@ -272,7 +272,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 @@ -534,12 +534,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); + } } } diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx index b8dd7fae8874..7eeeb51d9dc6 100644 --- a/lotuswordpro/source/filter/lwplayout.cxx +++ b/lotuswordpro/source/filter/lwplayout.cxx @@ -1357,18 +1357,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 nullptr; + return rtl::Reference<LwpVirtualLayout>(); } /** @@ -1377,7 +1377,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 diff --git a/lotuswordpro/source/filter/lwplayout.hxx b/lotuswordpro/source/filter/lwplayout.hxx index 92210294ca9f..5d115a67d4b6 100644 --- a/lotuswordpro/source/filter/lwplayout.hxx +++ b/lotuswordpro/source/filter/lwplayout.hxx @@ -322,7 +322,7 @@ public: virtual sal_uInt8 GetContentOrientation() override; virtual bool HonorProtection() override; virtual bool IsProtected() override; - LwpVirtualLayout* GetWaterMarkLayout(); + rtl::Reference<LwpVirtualLayout> GetWaterMarkLayout(); XFBGImage* GetXFBGImage(); bool GetUsePrinterSettings(); |