summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-12-08 12:18:32 +0100
committerStephan Bergmann <sbergman@redhat.com>2016-12-08 12:18:32 +0100
commit01b21b027114baebac99da23f95463373a6addf2 (patch)
tree2e162ae2e2e6a5b0a5f7e4a65b528e283167e041 /sc
parent65cc20c6911bdbe0995691d6c3d0f5c772155d13 (diff)
Replace manual acquire/release calls with rtl::Reference
...which also removes the need for a user-declared ScHeaderFooterTextCursor copy ctor Change-Id: Ida4ad4b3aef0865b40535f1fbf220ce5c44f2d47
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/textuno.hxx5
-rw-r--r--sc/source/ui/unoobj/textuno.cxx24
2 files changed, 8 insertions, 21 deletions
diff --git a/sc/inc/textuno.hxx b/sc/inc/textuno.hxx
index eafda68ba6be..12c7136fce8b 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 9487ae7e2b9f..68d9bccf6741 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)