Hi guys,
These three together (worked on by Markus & myself) improve some of the
ergonomics around the conditional formatting dialog, and fix a minor
sizing issue.
I'd love to get them into -3-6 - review/sign-off appreciated; the
slightly larger fix is a squash of three from master.
Thanks,
Michael.
--
michael.me...@suse.com <><, Pseudo Engineer, itinerant idiot
>From ab905f6398df6655645eb43aab49fa3519ad4dd9 Mon Sep 17 00:00:00 2001
From: Michael Meeks
Date: Fri, 28 Sep 2012 11:50:31 +0100
Subject: [PATCH 1/3] improve conditional formatting height calculations.
Change-Id: If5080892b820d268ffef22111d0caee217586b56
---
sc/source/ui/condformat/condformatdlg.cxx | 37 +
1 file changed, 16 insertions(+), 21 deletions(-)
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index 5c6d0f2..9fe983f 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -494,30 +494,25 @@ void ScCondFrmtEntry::HideColorScaleElements()
void ScCondFrmtEntry::SetHeight()
{
-if(mbActive)
+long nPad = LogicToPixel(Size(42,2), MapMode(MAP_APPFONT)).getHeight();
+
+// Calculate maximum height we need from visible widgets
+sal_uInt16 nChildren = GetChildCount();
+
+long nMaxHeight = 0;
+for(sal_uInt16 i = 0; i < nChildren; i++)
{
-Size aSize = GetSizePixel();
-switch (meType)
-{
-case CONDITION:
-case FORMULA:
-aSize.Height() = 120;
-break;
-case COLORSCALE:
-aSize.Height() = 200;
-break;
-case DATABAR:
-aSize.Height() = 200;
-break;
-default:
-break;
-}
-SetSizePixel(aSize);
+Window *pChild = GetChild(i);
+if(!pChild || !pChild->IsVisible())
+continue;
+Point aPos = pChild->GetPosPixel();
+Size aSize = pChild->GetSizePixel();
+nMaxHeight = std::max(aPos.Y() + aSize.Height(), nMaxHeight);
}
-else
+Size aSize = GetSizePixel();
+if(nMaxHeight > 0)
{
-Size aSize = GetSizePixel();
-aSize.Height() = 40;
+aSize.Height() = nMaxHeight + nPad;
SetSizePixel(aSize);
}
}
--
1.7.10.4
>From e493b5f51347c9104c3c3d7ed238ba7919669dbb Mon Sep 17 00:00:00 2001
From: Michael Meeks
Date: Fri, 28 Sep 2012 12:43:47 +0100
Subject: [PATCH 2/3] auto-expand the first conditional format in the list.
Change-Id: I65280d39b560b4b7eed3e21a6e6c7b02c124f10a
---
sc/source/ui/condformat/condformatdlg.cxx |2 ++
1 file changed, 2 insertions(+)
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index 9fe983f..6b877de 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -979,6 +979,8 @@ ScCondFormatList::ScCondFormatList(Window* pParent, const ResId& rResId, ScDocum
{
maEntries.push_back(new ScCondFrmtEntry( this, mpDoc, pFormat->GetEntry(nIndex), maPos ));
}
+if (nCount > 0)
+maEntries.begin()->Select();
}
RecalcAll();
--
1.7.10.4
>From 88b1cb2b5379ffdc3f7ee9d623520d42b3d1f292 Mon Sep 17 00:00:00 2001
From: Michael Meeks
Date: Fri, 28 Sep 2012 13:40:47 +0100
Subject: [PATCH 3/3] fdo#54940 - make editing relative refs more intuitive to
me
---
sc/inc/rangelst.hxx |1 +
sc/source/core/tool/rangelst.cxx | 15 +++
sc/source/ui/condformat/condformatmgr.cxx |5 +++--
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 74bb7be..8bf3bed 100644
--- a/sc/inc/rangelst.hxx
+++ b/sc/inc/rangelst.hxx
@@ -81,6 +81,7 @@ public:
boolIntersects( const ScRange& ) const;
boolIn( const ScRange& ) const;
size_t GetCellCount() const;
+ScAddress GetTopLeftCorner() const;
ScRange*Remove(size_t nPos);
voidRemoveAll();
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index 8214c50..19321b5 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/c