[Libreoffice-commits] .: 5 commits - sc/inc sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Sep 28 09:13:05 PDT 2012


 sc/inc/rangelst.hxx                       |    1 
 sc/source/core/tool/rangelst.cxx          |   15 +++++++++++
 sc/source/ui/condformat/condformatdlg.cxx |   39 +++++++++++++-----------------
 sc/source/ui/condformat/condformatmgr.cxx |    6 +++-
 sc/source/ui/inc/condformatmgr.hxx        |    1 
 sc/source/ui/view/cellsh1.cxx             |    4 +--
 6 files changed, 41 insertions(+), 25 deletions(-)

New commits:
commit 9edb6ba992ad2ef092996903d775df5313613bee
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Sep 28 18:09:43 2012 +0200

    add the remaining parts to previous commit
    
    Change-Id: Ia0b9ed9eed30991f38234bf56c49b26392491f30

diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index a1cdc8c..e9211c1 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2061,11 +2061,11 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                 const ScConditionalFormat* pCondFormat = pDoc->GetCondFormat(aPos.Col(), aPos.Row(), aPos.Tab());
                 if(pCondFormat)
                 {
-                    pDlg = pFact->CreateScCondFormatDlg( pTabViewShell->GetDialogParent(), pDoc, pCondFormat, pCondFormat->GetRange(), aPos, RID_SCDLG_CONDFORMAT );
+                    pDlg = pFact->CreateScCondFormatDlg( pTabViewShell->GetDialogParent(), pDoc, pCondFormat, pCondFormat->GetRange(), pCondFormat->GetRange().GetTopLeftCorner(), RID_SCDLG_CONDFORMAT );
                 }
                 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)
commit 985e7e4f5017b67f2734b8885d81e32e2011e470
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Fri Sep 28 13:40:47 2012 +0100

    fdo#54940 - make editing relative refs more intuitive to me
    
    Change-Id: Ib7681de7b1aad9b6dda183e3c4fa1b1010270d3f

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 c9c4c3e..b7347f6 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 b40a523..62b1fdc 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();
commit 5f32a4a2a18b1726c8bb7a5ce694648b0d8aba31
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Fri Sep 28 13:38:52 2012 +0100

    double-click on a conditional format inspects / edits it.
    
    Change-Id: Icdfeae938627b63decd26571e86bc1e80e07f6c6

diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx
index ebaad9b..b40a523 100644
--- a/sc/source/ui/condformat/condformatmgr.cxx
+++ b/sc/source/ui/condformat/condformatmgr.cxx
@@ -180,6 +180,7 @@ ScCondFormatManagerDlg::ScCondFormatManagerDlg(Window* pParent, ScDocument* pDoc
 
     maBtnRemove.SetClickHdl(LINK(this, ScCondFormatManagerDlg, RemoveBtnHdl));
     maBtnEdit.SetClickHdl(LINK(this, ScCondFormatManagerDlg, EditBtnHdl));
+    maCtrlManager.GetListControl().SetDoubleClickHdl(LINK(this, ScCondFormatManagerDlg, EditBtnHdl));
     maBtnAdd.Hide();
 }
 
diff --git a/sc/source/ui/inc/condformatmgr.hxx b/sc/source/ui/inc/condformatmgr.hxx
index 2f75dde..3735e63 100644
--- a/sc/source/ui/inc/condformatmgr.hxx
+++ b/sc/source/ui/inc/condformatmgr.hxx
@@ -71,6 +71,7 @@ public:
     ScConditionalFormat* GetSelection();
     void DeleteSelection();
     void Update();
+    ScCondFormatManagerWindow &GetListControl() { return maWdManager; }
 
 private:
     ScCondFormatManagerWindow maWdManager;
commit 6b612128794b7dba984c45e8aa7673b5261eb5dd
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Fri Sep 28 12:43:47 2012 +0100

    auto-expand the first conditional format in the list.
    
    Change-Id: I65280d39b560b4b7eed3e21a6e6c7b02c124f10a

diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index ef69309..51fc485 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -1005,6 +1005,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();
commit bee798cf4a91030184e01073c9aaaa5a66174600
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Fri Sep 28 11:50:31 2012 +0100

    improve conditional formatting height calculations.
    
    Change-Id: If5080892b820d268ffef22111d0caee217586b56

diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index 3be5bc2..ef69309 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -511,30 +511,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);
     }
 }


More information about the Libreoffice-commits mailing list