diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-04-26 15:32:52 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-04-26 15:32:52 -0400 |
commit | 502e11b22eef0b2cfc544790e9430406dda8321e (patch) | |
tree | d8457874b0eb76b0878d21b0b12eeeff2c6b6999 /sc | |
parent | Ditto. Use rtl::Reference. (diff) | |
download | core-502e11b22eef0b2cfc544790e9430406dda8321e.tar.gz core-502e11b22eef0b2cfc544790e9430406dda8321e.zip |
Pass ScCellObj instance to ScCellFieldsObj instead of creating a new one.
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/fielduno.hxx | 7 | ||||
-rw-r--r-- | sc/source/ui/unoobj/cellsuno.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/unoobj/fielduno.cxx | 10 |
3 files changed, 14 insertions, 8 deletions
diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx index 7c237b2d106e..4f3d29b718d9 100644 --- a/sc/inc/fielduno.hxx +++ b/sc/inc/fielduno.hxx @@ -69,6 +69,7 @@ class ScCellFieldsObj : public cppu::WeakImplHelper5< public SfxListener { private: + com::sun::star::uno::Reference<com::sun::star::text::XTextRange> mxContent; ScDocShell* pDocShell; ScAddress aCellPos; ScEditSource* mpEditSource; @@ -82,8 +83,10 @@ private: GetObjectByIndex_Impl(sal_Int32 Index) const; public: - ScCellFieldsObj(ScDocShell* pDocSh, const ScAddress& rPos); - virtual ~ScCellFieldsObj(); + ScCellFieldsObj( + const com::sun::star::uno::Reference<com::sun::star::text::XTextRange>& xContent, + ScDocShell* pDocSh, const ScAddress& rPos); + virtual ~ScCellFieldsObj(); virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index a916c6d48979..9f874e3fa5c5 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -6704,7 +6704,10 @@ uno::Reference<container::XEnumerationAccess> SAL_CALL ScCellObj::getTextFields( SolarMutexGuard aGuard; ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) - return new ScCellFieldsObj( pDocSh, aCellPos ); + { + uno::Reference<text::XTextRange> xContent(this); + return new ScCellFieldsObj(xContent, pDocSh, aCellPos); + } return NULL; } diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index fcc5f3b13f13..2753fa66a4ef 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -295,7 +295,10 @@ SvxFieldData* ScUnoEditEngine::FindByPos(sal_uInt16 nPar, xub_StrLen nPos, TypeI //------------------------------------------------------------------------ -ScCellFieldsObj::ScCellFieldsObj(ScDocShell* pDocSh, const ScAddress& rPos) : +ScCellFieldsObj::ScCellFieldsObj( + const uno::Reference<text::XTextRange>& xContent, + ScDocShell* pDocSh, const ScAddress& rPos) : + mxContent(xContent), pDocShell( pDocSh ), aCellPos( rPos ), mpRefreshListeners( NULL ) @@ -353,16 +356,13 @@ uno::Reference<text::XTextField> ScCellFieldsObj::GetObjectByIndex_Impl(sal_Int3 if (!pData) return uno::Reference<text::XTextField>(); - // Get the parent text range instance. - uno::Reference<text::XTextRange> xContent(new ScCellObj(pDocShell, aCellPos)); - sal_uInt16 nPar = aTempEngine.GetFieldPar(); xub_StrLen nPos = aTempEngine.GetFieldPos(); ESelection aSelection( nPar, nPos, nPar, nPos+1 ); // Feld ist 1 Zeichen ScEditFieldObj::FieldType eType = getFieldType(pData->GetClassId()); uno::Reference<text::XTextField> xRet( - new ScEditFieldObj(xContent, new ScCellEditSource(pDocShell, aCellPos), eType, aSelection)); + new ScEditFieldObj(mxContent, new ScCellEditSource(pDocShell, aCellPos), eType, aSelection)); return xRet; } |