Kaydet (Commit) 01b21b02 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Replace manual acquire/release calls with rtl::Reference

...which also removes the need for a user-declared ScHeaderFooterTextCursor copy
ctor

Change-Id: Ida4ad4b3aef0865b40535f1fbf220ce5c44f2d47
üst 65cc20c6
...@@ -263,11 +263,10 @@ public: ...@@ -263,11 +263,10 @@ public:
class ScHeaderFooterTextCursor : public SvxUnoTextCursor class ScHeaderFooterTextCursor : public SvxUnoTextCursor
{ {
private: private:
ScHeaderFooterTextObj& rTextObj; rtl::Reference<ScHeaderFooterTextObj> rTextObj;
public: public:
ScHeaderFooterTextCursor(const ScHeaderFooterTextCursor& rOther); ScHeaderFooterTextCursor(rtl::Reference<ScHeaderFooterTextObj> const & rText);
ScHeaderFooterTextCursor(ScHeaderFooterTextObj& rText);
virtual ~ScHeaderFooterTextCursor() throw() override; virtual ~ScHeaderFooterTextCursor() throw() override;
// SvxUnoTextCursor methods reimplemented here: // SvxUnoTextCursor methods reimplemented here:
......
...@@ -299,7 +299,7 @@ uno::Reference<text::XTextCursor> SAL_CALL ScHeaderFooterTextObj::createTextCurs ...@@ -299,7 +299,7 @@ uno::Reference<text::XTextCursor> SAL_CALL ScHeaderFooterTextObj::createTextCurs
throw(uno::RuntimeException, std::exception) throw(uno::RuntimeException, std::exception)
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
return new ScHeaderFooterTextCursor( *this ); return new ScHeaderFooterTextCursor( this );
} }
uno::Reference<text::XTextCursor> SAL_CALL ScHeaderFooterTextObj::createTextCursorByRange( uno::Reference<text::XTextCursor> SAL_CALL ScHeaderFooterTextObj::createTextCursorByRange(
...@@ -669,31 +669,19 @@ ScCellTextCursor* ScCellTextCursor::getImplementation(const uno::Reference<uno:: ...@@ -669,31 +669,19 @@ ScCellTextCursor* ScCellTextCursor::getImplementation(const uno::Reference<uno::
return pRet; return pRet;
} }
ScHeaderFooterTextCursor::ScHeaderFooterTextCursor(const ScHeaderFooterTextCursor& rOther) : ScHeaderFooterTextCursor::ScHeaderFooterTextCursor(rtl::Reference<ScHeaderFooterTextObj> const & rText) :
SvxUnoTextCursor( rOther ), SvxUnoTextCursor( rText->GetUnoText() ),
rTextObj( rOther.rTextObj )
{
rTextObj.acquire();
}
ScHeaderFooterTextCursor::ScHeaderFooterTextCursor(ScHeaderFooterTextObj& rText) :
SvxUnoTextCursor( rText.GetUnoText() ),
rTextObj( rText ) rTextObj( rText )
{ {}
rTextObj.acquire();
}
ScHeaderFooterTextCursor::~ScHeaderFooterTextCursor() throw() ScHeaderFooterTextCursor::~ScHeaderFooterTextCursor() throw() = default;
{
rTextObj.release();
}
// SvxUnoTextCursor methods reimplemented here to return the right objects: // SvxUnoTextCursor methods reimplemented here to return the right objects:
uno::Reference<text::XText> SAL_CALL ScHeaderFooterTextCursor::getText() throw(uno::RuntimeException, std::exception) uno::Reference<text::XText> SAL_CALL ScHeaderFooterTextCursor::getText() throw(uno::RuntimeException, std::exception)
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
return &rTextObj; return rTextObj.get();
} }
uno::Reference<text::XTextRange> SAL_CALL ScHeaderFooterTextCursor::getStart() throw(uno::RuntimeException, std::exception) uno::Reference<text::XTextRange> SAL_CALL ScHeaderFooterTextCursor::getStart() throw(uno::RuntimeException, std::exception)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment