summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-10-12 21:47:20 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-11-28 13:28:25 -0500
commitcc635c24f3f5ab761cd640bacc5ae12adc4d0846 (patch)
treeff070ea1bc15ff74c43254b2031c0c6aafe9d8d2 /sc
parent6f2013f164c2550073346bf175c1173c1032b598 (diff)
Keep track of linked cell positions.
Change-Id: I33e39e53b618270561ba7bfc236e8d8558bccffa
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/orcusxml.hxx2
-rw-r--r--sc/source/core/tool/orcusxml.cxx2
-rw-r--r--sc/source/ui/xmlsource/xmlsourcedlg.cxx22
3 files changed, 24 insertions, 2 deletions
diff --git a/sc/inc/orcusxml.hxx b/sc/inc/orcusxml.hxx
index d615ab6bfcd2..4fa223e5b596 100644
--- a/sc/inc/orcusxml.hxx
+++ b/sc/inc/orcusxml.hxx
@@ -11,6 +11,7 @@
#define __SC_ORCUSXML_HXX__
#include "scdllapi.h"
+#include "address.hxx"
#include "vcl/image.hxx"
#include <boost/ptr_container/ptr_vector.hpp>
@@ -28,6 +29,7 @@ struct ScOrcusXMLTreeParam
struct EntryData
{
EntryType meType;
+ ScAddress maLinkedPos; /// linked cell position (invalid if unlinked)
SC_DLLPUBLIC EntryData(EntryType eType);
};
diff --git a/sc/source/core/tool/orcusxml.cxx b/sc/source/core/tool/orcusxml.cxx
index 4e9ef805ddc5..c5e0ac124b10 100644
--- a/sc/source/core/tool/orcusxml.cxx
+++ b/sc/source/core/tool/orcusxml.cxx
@@ -12,7 +12,7 @@
#include "svtools/treelistbox.hxx"
ScOrcusXMLTreeParam::EntryData::EntryData(EntryType eType) :
- meType(eType) {}
+ meType(eType), maLinkedPos(ScAddress::INITIALIZE_INVALID) {}
ScOrcusXMLTreeParam::EntryData* ScOrcusXMLTreeParam::getUserData(SvLBoxEntry& rEntry)
{
diff --git a/sc/source/ui/xmlsource/xmlsourcedlg.cxx b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
index c4fb78178968..561f98d8f410 100644
--- a/sc/source/ui/xmlsource/xmlsourcedlg.cxx
+++ b/sc/source/ui/xmlsource/xmlsourcedlg.cxx
@@ -88,6 +88,17 @@ void ScXMLSourceDlg::SetReference(const ScRange& rRange, ScDocument* pDoc)
OUString aStr;
rRange.aStart.Format(aStr, SCA_ABS_3D, pDoc, pDoc->GetAddressConvention());
mpActiveEdit->SetRefString(aStr);
+
+ // Set this address to currently selected tree item.
+ SvLBoxEntry* pEntry = maLbTree.GetCurEntry();
+ if (!pEntry)
+ return;
+
+ ScOrcusXMLTreeParam::EntryData* pUserData = ScOrcusXMLTreeParam::getUserData(*pEntry);
+ if (!pUserData)
+ return;
+
+ pUserData->maLinkedPos = rRange.aStart;
}
void ScXMLSourceDlg::Deactivate()
@@ -188,10 +199,19 @@ void ScXMLSourceDlg::TreeItemSelected()
return;
ScOrcusXMLTreeParam::EntryData* pUserData = ScOrcusXMLTreeParam::getUserData(*pEntry);
-
if (!pUserData)
return;
+ const ScAddress& rPos = pUserData->maLinkedPos;
+ if (rPos.IsValid())
+ {
+ OUString aStr;
+ rPos.Format(aStr, SCA_ABS_3D, mpDoc, mpDoc->GetAddressConvention());
+ maRefEdit.SetRefString(aStr);
+ }
+ else
+ maRefEdit.SetRefString(OUString());
+
switch (pUserData->meType)
{
case ScOrcusXMLTreeParam::Attribute: