[Libreoffice-commits] core.git: sc/inc sc/source

Stephan Bergmann sbergman at redhat.com
Thu Dec 8 11:19:59 UTC 2016


 sc/inc/textuno.hxx              |    5 ++---
 sc/source/ui/unoobj/textuno.cxx |   24 ++++++------------------
 2 files changed, 8 insertions(+), 21 deletions(-)

New commits:
commit 01b21b027114baebac99da23f95463373a6addf2
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Dec 8 12:18:32 2016 +0100

    Replace manual acquire/release calls with rtl::Reference
    
    ...which also removes the need for a user-declared ScHeaderFooterTextCursor copy
    ctor
    
    Change-Id: Ida4ad4b3aef0865b40535f1fbf220ce5c44f2d47

diff --git a/sc/inc/textuno.hxx b/sc/inc/textuno.hxx
index eafda68..12c7136 100644
--- a/sc/inc/textuno.hxx
+++ b/sc/inc/textuno.hxx
@@ -263,11 +263,10 @@ public:
 class ScHeaderFooterTextCursor : public SvxUnoTextCursor
 {
 private:
-    ScHeaderFooterTextObj&  rTextObj;
+    rtl::Reference<ScHeaderFooterTextObj> rTextObj;
 
 public:
-                            ScHeaderFooterTextCursor(const ScHeaderFooterTextCursor& rOther);
-                            ScHeaderFooterTextCursor(ScHeaderFooterTextObj& rText);
+                            ScHeaderFooterTextCursor(rtl::Reference<ScHeaderFooterTextObj> const & rText);
         virtual                                 ~ScHeaderFooterTextCursor() throw() override;
 
                             // SvxUnoTextCursor methods reimplemented here:
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index 9487ae7..68d9bcc 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -299,7 +299,7 @@ uno::Reference<text::XTextCursor> SAL_CALL ScHeaderFooterTextObj::createTextCurs
                                                     throw(uno::RuntimeException, std::exception)
 {
     SolarMutexGuard aGuard;
-    return new ScHeaderFooterTextCursor( *this );
+    return new ScHeaderFooterTextCursor( this );
 }
 
 uno::Reference<text::XTextCursor> SAL_CALL ScHeaderFooterTextObj::createTextCursorByRange(
@@ -669,31 +669,19 @@ ScCellTextCursor* ScCellTextCursor::getImplementation(const uno::Reference<uno::
     return pRet;
 }
 
-ScHeaderFooterTextCursor::ScHeaderFooterTextCursor(const ScHeaderFooterTextCursor& rOther) :
-    SvxUnoTextCursor( rOther ),
-    rTextObj( rOther.rTextObj )
-{
-    rTextObj.acquire();
-}
-
-ScHeaderFooterTextCursor::ScHeaderFooterTextCursor(ScHeaderFooterTextObj& rText) :
-    SvxUnoTextCursor( rText.GetUnoText() ),
+ScHeaderFooterTextCursor::ScHeaderFooterTextCursor(rtl::Reference<ScHeaderFooterTextObj> const & rText) :
+    SvxUnoTextCursor( rText->GetUnoText() ),
     rTextObj( rText )
-{
-    rTextObj.acquire();
-}
+{}
 
-ScHeaderFooterTextCursor::~ScHeaderFooterTextCursor() throw()
-{
-    rTextObj.release();
-}
+ScHeaderFooterTextCursor::~ScHeaderFooterTextCursor() throw() = default;
 
 // SvxUnoTextCursor methods reimplemented here to return the right objects:
 
 uno::Reference<text::XText> SAL_CALL ScHeaderFooterTextCursor::getText() throw(uno::RuntimeException, std::exception)
 {
     SolarMutexGuard aGuard;
-    return &rTextObj;
+    return rTextObj.get();
 }
 
 uno::Reference<text::XTextRange> SAL_CALL ScHeaderFooterTextCursor::getStart() throw(uno::RuntimeException, std::exception)


More information about the Libreoffice-commits mailing list