sc/inc/fielduno.hxx | 7 +++++-- sc/source/ui/unoobj/cellsuno.cxx | 5 ++++- sc/source/ui/unoobj/fielduno.cxx | 10 +++++----- 3 files changed, 14 insertions(+), 8 deletions(-)
New commits: commit 502e11b22eef0b2cfc544790e9430406dda8321e Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Thu Apr 26 15:32:52 2012 -0400 Pass ScCellObj instance to ScCellFieldsObj instead of creating a new one. diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx index 7c237b2..4f3d29b 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 a916c6d..9f874e3 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 fcc5f3b..2753fa6 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; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits