[Libreoffice-commits] core.git: lotuswordpro/source
Caolán McNamara
caolanm at redhat.com
Sun Dec 13 09:00:12 PST 2015
lotuswordpro/source/filter/lwpframelayout.cxx | 15 ++++++++-------
lotuswordpro/source/filter/lwplayout.cxx | 17 +++++++++--------
lotuswordpro/source/filter/lwplayout.hxx | 2 +-
3 files changed, 18 insertions(+), 16 deletions(-)
New commits:
commit 80509545cc43893776dd24f441e9b95567ce06db
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Dec 13 16:59:16 2015 +0000
hold WaterMarkLayout by reference
Change-Id: I7dc7739ee7b958319ddd4e0cf262254728ef0569
diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx
index b31791a..7312e81 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 b8dd7fa..7eeeb51 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 9221029..5d115a6 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();
More information about the Libreoffice-commits
mailing list