diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-04-24 17:28:27 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-04-26 09:58:02 -0400 |
commit | 6705f284f41ed7ca2d10d9f6d2ab67005ec045d4 (patch) | |
tree | b00c5977bff795e7f847db8cb9186c6562ea15fd /sc | |
parent | 58cb46341c8037c0fc2adeac69f72f09d0ffa952 (diff) |
Now I can store a reference in the edit source.
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/editsrc.hxx | 5 | ||||
-rw-r--r-- | sc/source/ui/unoobj/editsrc.cxx | 18 | ||||
-rw-r--r-- | sc/source/ui/unoobj/fielduno.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/unoobj/textuno.cxx | 6 |
4 files changed, 13 insertions, 20 deletions
diff --git a/sc/inc/editsrc.hxx b/sc/inc/editsrc.hxx index 1628d1039b81..64c5871b32fb 100644 --- a/sc/inc/editsrc.hxx +++ b/sc/inc/editsrc.hxx @@ -51,15 +51,14 @@ class SdrObject; class ScHeaderFooterEditSource : public SvxEditSource { private: - ScHeaderFooterTextData* mpTextData; + ScHeaderFooterTextData& mrTextData; public: - ScHeaderFooterEditSource(ScHeaderFooterTextData* pData); + ScHeaderFooterEditSource(ScHeaderFooterTextData& rData); virtual ~ScHeaderFooterEditSource(); // GetEditEngine is needed because the forwarder doesn't have field functions ScEditEngineDefaulter* GetEditEngine(); - void SetTextData(ScHeaderFooterTextData* pData); virtual SvxEditSource* Clone() const; virtual SvxTextForwarder* GetTextForwarder(); diff --git a/sc/source/ui/unoobj/editsrc.cxx b/sc/source/ui/unoobj/editsrc.cxx index fb4782dabdad..45e0feb42582 100644 --- a/sc/source/ui/unoobj/editsrc.cxx +++ b/sc/source/ui/unoobj/editsrc.cxx @@ -50,35 +50,29 @@ #include "postit.hxx" #include "AccessibleText.hxx" -ScHeaderFooterEditSource::ScHeaderFooterEditSource(ScHeaderFooterTextData* pData) : - mpTextData(pData) {} +ScHeaderFooterEditSource::ScHeaderFooterEditSource(ScHeaderFooterTextData& rData) : + mrTextData(rData) {} ScHeaderFooterEditSource::~ScHeaderFooterEditSource() {} ScEditEngineDefaulter* ScHeaderFooterEditSource::GetEditEngine() { - return mpTextData ? mpTextData->GetEditEngine() : NULL; -} - -void ScHeaderFooterEditSource::SetTextData(ScHeaderFooterTextData* pData) -{ - mpTextData = pData; + return mrTextData.GetEditEngine(); } SvxEditSource* ScHeaderFooterEditSource::Clone() const { - return new ScHeaderFooterEditSource(mpTextData); + return new ScHeaderFooterEditSource(mrTextData); } SvxTextForwarder* ScHeaderFooterEditSource::GetTextForwarder() { - return mpTextData ? mpTextData->GetTextForwarder() : NULL; + return mrTextData.GetTextForwarder(); } void ScHeaderFooterEditSource::UpdateData() { - if (mpTextData) - mpTextData->UpdateData(); + mrTextData.UpdateData(); } //------------------------------------------------------------------------ diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index bc95fa0963a2..c5a8c56826ce 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -853,7 +853,7 @@ ScHeaderFieldsObj::ScHeaderFieldsObj(ScHeaderFooterTextData& rData) : nType(SC_SERVICE_INVALID), mpRefreshListeners( NULL ) { - pEditSource = new ScHeaderFooterEditSource(&rData); + pEditSource = new ScHeaderFooterEditSource(rData); } ScHeaderFieldsObj::~ScHeaderFieldsObj() @@ -927,7 +927,7 @@ ScHeaderFieldObj* ScHeaderFieldsObj::GetObjectByIndex_Impl(sal_Int32 Index) cons uno::Reference<text::XTextRange> xTemp(xText, uno::UNO_QUERY); xTextRange = xTemp; - return new ScHeaderFieldObj(xTextRange, new ScHeaderFooterEditSource(&mrData), nFieldType, aSelection); + return new ScHeaderFieldObj(xTextRange, new ScHeaderFooterEditSource(mrData), nFieldType, aSelection); } return NULL; } diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx index 868e7be4c706..eacdf6effbeb 100644 --- a/sc/source/ui/unoobj/textuno.cxx +++ b/sc/source/ui/unoobj/textuno.cxx @@ -297,8 +297,8 @@ void ScHeaderFooterTextObj::CreateUnoText_Impl() if ( !pUnoText ) { // can't be aggregated because getString/setString is handled here - ScHeaderFooterEditSource aEditSource(&aTextData); - pUnoText = new SvxUnoText( &aEditSource, lcl_GetHdFtPropertySet(), uno::Reference<text::XText>() ); + pUnoText = new SvxUnoText( + new ScHeaderFooterEditSource(aTextData), lcl_GetHdFtPropertySet(), uno::Reference<text::XText>()); pUnoText->acquire(); } } @@ -478,7 +478,7 @@ void SAL_CALL ScHeaderFooterTextObj::insertTextContent( break; } - pHeaderField->InitDoc(xTextRange, new ScHeaderFooterEditSource(&aTextData), aSelection); + pHeaderField->InitDoc(xTextRange, new ScHeaderFooterEditSource(aTextData), aSelection); // for bAbsorb=FALSE, the new selection must be behind the inserted content // (the xml filter relies on this) |