diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-25 10:16:58 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-25 10:34:20 +0200 |
commit | d49e497a6bd07e487149d65ab63138ce4aff73a4 (patch) | |
tree | 575920c4aefd77b71ff1235aafac36962fecfbff /sw | |
parent | ef2b4342e9f8a887bb840d8a6c875125139d433a (diff) |
use rtl::Reference in SwXTextDocument
instead of storing both a raw pointer and an uno::Reference
Change-Id: I94746e7fafcc7d2206ac0c1a6481e6006421529b
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/unotxdoc.hxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 17 |
2 files changed, 9 insertions, 12 deletions
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 36ef233e1301..e4aa520612c9 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -61,6 +61,7 @@ #include <com/sun/star/text/XFlatParagraphIteratorProvider.hpp> #include <com/sun/star/document/XDocumentLanguages.hpp> #include <com/sun/star/util/XCloneable.hpp> +#include <rtl/ref.hxx> #include <svl/itemprop.hxx> #include <svx/fmdmod.hxx> #include <editeng/UnoForbiddenCharsTable.hxx> @@ -174,8 +175,7 @@ private: //temporary frame to enable PDF export if no valid view is available SfxViewFrame* m_pHiddenViewFrame; - css::uno::Reference< css::uno::XInterface> xPropertyHelper; - SwXDocumentPropertyHelper* pPropertyHelper; + rtl::Reference<SwXDocumentPropertyHelper> mxPropertyHelper; SwPrintUIOptions * m_pPrintUIOptions; SwRenderData * m_pRenderData; diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 2c81a20ce62f..a1ca0a03b4c2 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -422,7 +422,6 @@ SwXTextDocument::SwXTextDocument(SwDocShell* pShell) mxLinkTargetSupplier(), mxXRedlines(), m_pHiddenViewFrame(nullptr), - pPropertyHelper(nullptr), m_pPrintUIOptions( nullptr ), m_pRenderData( nullptr ), // #i117783# @@ -452,12 +451,11 @@ SwXTextDocument::~SwXTextDocument() SwXDocumentPropertyHelper * SwXTextDocument::GetPropertyHelper () { - if(!xPropertyHelper.is()) + if(!mxPropertyHelper.is()) { - pPropertyHelper = new SwXDocumentPropertyHelper(*pDocShell->GetDoc()); - xPropertyHelper = static_cast<cppu::OWeakObject*>(pPropertyHelper); + mxPropertyHelper = new SwXDocumentPropertyHelper(*pDocShell->GetDoc()); } - return pPropertyHelper; + return mxPropertyHelper.get(); } void SwXTextDocument::GetNumberFormatter() @@ -1600,11 +1598,10 @@ void SwXTextDocument::InitNewDoc() static_cast<SwXRedlines*>(pMarks)->Invalidate(); mxXRedlines.clear(); } - if(xPropertyHelper.is()) + if(mxPropertyHelper.is()) { - pPropertyHelper->Invalidate(); - xPropertyHelper = nullptr; - pPropertyHelper = nullptr; + mxPropertyHelper->Invalidate(); + mxPropertyHelper.clear(); } } @@ -2064,7 +2061,7 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName) case WID_DOC_FORBIDDEN_CHARS: { GetPropertyHelper(); - Reference<XForbiddenCharacters> xRet(xPropertyHelper, UNO_QUERY); + Reference<XForbiddenCharacters> xRet(static_cast<cppu::OWeakObject*>(mxPropertyHelper.get()), UNO_QUERY); aAny <<= xRet; } break; |