Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


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.meeks@suse.com  <><, Pseudo Engineer, itinerant idiot
From ab905f6398df6655645eb43aab49fa3519ad4dd9 Mon Sep 17 00:00:00 2001
From: Michael Meeks <michael.meeks@suse.com>
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 <michael.meeks@suse.com>
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 <michael.meeks@suse.com>
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:
     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 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/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx
index aee8b6f..03fbeb3 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 14ed86b..c532945 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)
-- 
1.7.10.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.