summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-04-24 22:57:58 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-04-26 09:58:02 -0400
commitf43d0e0a124172cfa9a2bed89ed999626ba91e61 (patch)
treeaec00f9365145ecb78e5908a54db14c5e1c18c17 /sc
parent6705f284f41ed7ca2d10d9f6d2ab67005ec045d4 (diff)
Likewise, pass edit source instance to ScEditFieldObj.
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/fielduno.hxx8
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx3
-rw-r--r--sc/source/ui/unoobj/fielduno.cxx47
-rw-r--r--sc/source/ui/unoobj/servuno.cxx2
4 files changed, 11 insertions, 49 deletions
diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx
index e8f37da27ce2..d87f11f2e9c4 100644
--- a/sc/inc/fielduno.hxx
+++ b/sc/inc/fielduno.hxx
@@ -466,7 +466,6 @@ class ScEditFieldObj : public cppu::WeakImplHelper4<
com::sun::star::lang::XServiceInfo>,
public ScMutexHelper,
public ::cppu::OComponentHelper,
- public SfxListener,
private boost::noncopyable
{
public:
@@ -475,7 +474,6 @@ public:
private:
const SfxItemPropertySet* pPropSet;
ScDocShell* pDocShell;
- ScAddress aCellPos;
SvxEditSource* pEditSource;
ESelection aSelection;
@@ -494,17 +492,15 @@ public:
ScEditFieldObj(
const com::sun::star::uno::Reference<com::sun::star::text::XTextRange>& rContent,
- FieldType eType, ScDocShell* pDocSh, const ScAddress& rPos, const ESelection& rSel);
+ SvxEditSource* pEditSrc, FieldType eType, const ESelection& rSel);
virtual ~ScEditFieldObj();
- virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
-
void DeleteField();
bool IsInserted() const;
SvxFieldItem CreateFieldItem();
void InitDoc(
const com::sun::star::uno::Reference<com::sun::star::text::XTextRange>& rContent,
- FieldType eType, ScDocShell* pDocSh, const ScAddress& rPos, const ESelection& rSel);
+ SvxEditSource* pEditSrc, FieldType eType, const ESelection& rSel);
// XTextField
virtual ::rtl::OUString SAL_CALL getPresentation( sal_Bool bShowCommand )
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index f466a9a3628c..38726788ba80 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -6449,7 +6449,8 @@ void SAL_CALL ScCellObj::insertTextContent( const uno::Reference<text::XTextRang
aSelection.nEndPara = aSelection.nStartPara;
aSelection.nEndPos = aSelection.nStartPos + 1;
uno::Reference<text::XTextRange> xParent(this);
- pCellField->InitDoc(xParent, ScEditFieldObj::URL, pDocSh, aCellPos, aSelection);
+ pCellField->InitDoc(
+ xParent, new ScCellEditSource(pDocSh, aCellPos), ScEditFieldObj::URL, aSelection);
// for bAbsorb=FALSE, the new selection must be behind the inserted content
// (the xml filter relies on this)
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index c5a8c56826ce..d88770dd7971 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -301,7 +301,7 @@ uno::Reference<text::XTextField> ScCellFieldsObj::GetObjectByIndex_Impl(sal_Int3
ESelection aSelection( nPar, nPos, nPar, nPos+1 ); // Feld ist 1 Zeichen
uno::Reference<text::XTextRange> xContent(new ScCellObj(pDocShell, aCellPos));
uno::Reference<text::XTextField> xRet(
- new ScEditFieldObj(xContent, ScEditFieldObj::URL, pDocShell, aCellPos, aSelection));
+ new ScEditFieldObj(xContent, new ScCellEditSource(pDocShell, aCellPos), ScEditFieldObj::URL, aSelection));
return xRet;
}
return uno::Reference<text::XTextField>();
@@ -1484,71 +1484,36 @@ SvxFieldData* ScEditFieldObj::getData()
ScEditFieldObj::ScEditFieldObj(
const uno::Reference<text::XTextRange>& rContent,
- FieldType eType, ScDocShell* pDocSh, const ScAddress& rPos, const ESelection& rSel) :
+ SvxEditSource* pEditSrc, FieldType eType, const ESelection& rSel) :
OComponentHelper(getMutex()),
pPropSet(lcl_GetURLPropertySet()),
- pDocShell(pDocSh),
- aCellPos(rPos),
+ pEditSource(pEditSrc),
aSelection(rSel),
meType(eType), mpData(NULL), mpContent(rContent)
{
// pDocShell ist Null, wenn per ServiceProvider erzeugt
-
- if (pDocShell)
- {
- pDocShell->GetDocument()->AddUnoObject(*this);
- pEditSource = new ScCellEditSource( pDocShell, aCellPos );
- }
- else
- pEditSource = NULL;
}
void ScEditFieldObj::InitDoc(
const uno::Reference<text::XTextRange>& rContent,
- FieldType eType, ScDocShell* pDocSh, const ScAddress& rPos, const ESelection& rSel)
+ SvxEditSource* pEditSrc, FieldType eType, const ESelection& rSel)
{
- if ( pDocSh && !pEditSource )
+ if (!pEditSource)
{
mpContent = rContent;
meType = eType;
mpData.reset();
- aCellPos = rPos;
aSelection = rSel;
- pDocShell = pDocSh;
-
- pDocShell->GetDocument()->AddUnoObject(*this);
- pEditSource = new ScCellEditSource( pDocShell, aCellPos );
+ pEditSource = pEditSrc;
}
}
ScEditFieldObj::~ScEditFieldObj()
{
- if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
-
delete pEditSource;
}
-void ScEditFieldObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
-{
- //! Updates fuer aSelection (muessen erst noch erzeugt werden) !!!!!!
-
- if ( rHint.ISA( ScUpdateRefHint ) )
- {
- //! Ref-Update
- }
- else if ( rHint.ISA( SfxSimpleHint ) &&
- ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
- {
- pDocShell = NULL; // ungueltig geworden
- }
-
- // EditSource hat sich selber als Listener angemeldet
-}
-
-// per getImplementation gerufen:
-
SvxFieldItem ScEditFieldObj::CreateFieldItem()
{
OSL_ENSURE( !pEditSource, "CreateFieldItem mit eingefuegtem Feld" );
diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx
index 816be4140cf4..d7c2d9ba09c1 100644
--- a/sc/source/ui/unoobj/servuno.cxx
+++ b/sc/source/ui/unoobj/servuno.cxx
@@ -432,7 +432,7 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance(
{
uno::Reference<text::XTextRange> xNullContent;
xRet.set(static_cast<text::XTextField*>(
- new ScEditFieldObj(xNullContent, ScEditFieldObj::URL, NULL, ScAddress(), ESelection())));
+ new ScEditFieldObj(xNullContent, NULL, ScEditFieldObj::URL, ESelection())));
}
break;
case SC_SERVICE_PAGEFIELD: