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

Keep track of linked cell positions.

Change-Id: I33e39e53b618270561ba7bfc236e8d8558bccffa
üst 6f2013f1
......@@ -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);
};
......
......@@ -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)
{
......
......@@ -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:
......
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