diff options
author | Michael Meeks <michael.meeks@suse.com> | 2012-09-28 13:40:47 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-10-04 16:58:36 +0100 |
commit | cf83153902ec9cd7d15782cbdbf01df9f449fdbc (patch) | |
tree | 5dbb106ed772406786100b43ebe5da5b536151c2 /sc | |
parent | 743e9b1b63574fa79aff934369454868895d510c (diff) |
fdo#54940 - make editing relative refs more intuitive to me
Change-Id: Id3aa76010d92e71c5dc417fdafba90c3ea8401c8
Signed-off-by: Kohei Yoshida <kohei.yoshida@gmail.com>
Diffstat (limited to 'sc')
-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 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 2 |
4 files changed, 20 insertions, 3 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 8214c507e958..19321b5ef4a3 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -1135,6 +1135,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 aee8b6f26dd4..03fbeb3a4aa5 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(); diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 14ed86bb29a7..c53294563ba4 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -2075,7 +2075,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } else { - pDlg = pFact->CreateScCondFormatDlg( pTabViewShell->GetDialogParent(), pDoc, NULL, aRangeList, aPos, RID_SCDLG_CONDFORMAT ); + pDlg = pFact->CreateScCondFormatDlg( pTabViewShell->GetDialogParent(), pDoc, NULL, aRangeList, aRangeList.GetTopLeftCorner(), RID_SCDLG_CONDFORMAT ); } if(pDlg->Execute() == RET_OK) |