diff options
-rw-r--r-- | sc/inc/rangelst.hxx | 1 | ||||
-rw-r--r-- | sc/source/core/tool/rangelst.cxx | 15 | ||||
-rw-r--r-- | sc/source/ui/condformat/condformatmgr.cxx | 5 |
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(); |