summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2012-09-28 13:40:47 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-09-28 18:12:21 +0200
commit985e7e4f5017b67f2734b8885d81e32e2011e470 (patch)
treefe2bd9340d92de7026cc6786ece4c7c2b396a62f /sc
parent5f32a4a2a18b1726c8bb7a5ce694648b0d8aba31 (diff)
fdo#54940 - make editing relative refs more intuitive to me
Change-Id: Ib7681de7b1aad9b6dda183e3c4fa1b1010270d3f
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/rangelst.hxx1
-rw-r--r--sc/source/core/tool/rangelst.cxx15
-rw-r--r--sc/source/ui/condformat/condformatmgr.cxx5
3 files changed, 19 insertions, 2 deletions
diff --git a/sc/inc/rangelst.hxx b/sc/inc/rangelst.hxx
index 74bb7be1d99a..8bf3bed47266 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 c9c4c3e19097..b7347f62dcbd 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 b40a52319053..62b1fdc40be4 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();