Kaydet (Commit) 502e11b2 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Pass ScCellObj instance to ScCellFieldsObj instead of creating a new one.

üst 109e2a78
......@@ -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 );
......
......@@ -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;
}
......
......@@ -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;
}
......
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