fdo#54940 - make editing relative refs more intuitive to me
Change-Id: Ib7681de7b1aad9b6dda183e3c4fa1b1010270d3f
diff --git a/sc/inc/rangelst.hxx b/sc/inc/rangelst.hxx
index 74bb7be..8bf3bed 100644
--- a/sc/inc/rangelst.hxx
+++ b/sc/inc/rangelst.hxx
@@ -81,6 +81,7 @@ public:
bool Intersects( const ScRange& ) const;
bool In( const ScRange& ) const;
size_t GetCellCount() const;
ScAddress GetTopLeftCorner() const;
ScRange* Remove(size_t nPos);
void RemoveAll();
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index c9c4c3e..b7347f6 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -1145,6 +1145,21 @@ void ScRangeList::push_back(ScRange* p)
maRanges.push_back(p);
}
ScAddress ScRangeList::GetTopLeftCorner() const
{
if(empty())
return ScAddress();
ScAddress aAddr = maRanges[0]->aStart;
for(size_t i = 1, n = size(); i < n; ++i)
{
if(maRanges[i]->aStart < aAddr)
aAddr = maRanges[i]->aStart;
}
return aAddr;
}
// === ScRangePairList ========================================================
ScRangePairList::~ScRangePairList()
diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx
index b40a523..62b1fdc 100644
--- a/sc/source/ui/condformat/condformatmgr.cxx
+++ b/sc/source/ui/condformat/condformatmgr.cxx
@@ -77,7 +77,7 @@ String ScCondFormatManagerWindow::createEntryString(const ScConditionalFormat& r
String aStr;
aRange.Format(aStr, SCA_VALID, mpDoc, mpDoc->GetAddressConvention());
aStr += '\t';
aStr += ScCondFormatHelper::GetExpression(rFormat, mrPos);
aStr += ScCondFormatHelper::GetExpression(rFormat, aRange.GetTopLeftCorner());
return aStr;
}
@@ -209,7 +209,8 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnHdl)
if(!pFormat)
return 0;
ScCondFormatDlg* pDlg = new ScCondFormatDlg(this, mpDoc, pFormat, pFormat->GetRange(), maPos);
ScCondFormatDlg* pDlg = new ScCondFormatDlg(this, mpDoc, pFormat, pFormat->GetRange(),
pFormat->GetRange().GetTopLeftCorner());
if(pDlg->Execute() == RET_OK)
{
sal_Int32 nKey = pFormat->GetKey();