[Libreoffice-commits] .: Branch 'libreoffice-3-6' - 6 commits - officecfg/registry sc/AllLangResTarget_sc.mk sc/inc sc/Library_scui.mk sc/sdi sc/source sc/uiconfig

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Tue Jul 3 18:40:04 PDT 2012


 officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu |    5 
 sc/AllLangResTarget_sc.mk                                         |    1 
 sc/Library_scui.mk                                                |    2 
 sc/inc/conditio.hxx                                               |    2 
 sc/inc/globstr.hrc                                                |   14 
 sc/inc/sc.hrc                                                     |    3 
 sc/inc/scabstdlg.hxx                                              |   10 
 sc/sdi/cellsh.sdi                                                 |    1 
 sc/sdi/scalc.sdi                                                  |   25 +
 sc/source/core/data/documen7.cxx                                  |    4 
 sc/source/ui/attrdlg/scdlgfact.cxx                                |   25 +
 sc/source/ui/attrdlg/scdlgfact.hxx                                |   11 
 sc/source/ui/condformat/condformatdlg.cxx                         |   82 +--
 sc/source/ui/condformat/condformathelper.cxx                      |  121 +++++
 sc/source/ui/condformat/condformatmgr.cxx                         |  227 ++++++++++
 sc/source/ui/inc/condformatdlg.hrc                                |    1 
 sc/source/ui/inc/condformatdlg.hxx                                |   13 
 sc/source/ui/inc/condformathelper.hxx                             |   30 +
 sc/source/ui/inc/condformatmgr.hrc                                |   18 
 sc/source/ui/inc/condformatmgr.hxx                                |  110 ++++
 sc/source/ui/src/condformatdlg.src                                |   77 +--
 sc/source/ui/src/condformatmgr.src                                |   66 ++
 sc/source/ui/src/globstr.src                                      |   32 +
 sc/source/ui/view/cellsh1.cxx                                     |   29 +
 sc/uiconfig/scalc/menubar/menubar.xml                             |   10 
 25 files changed, 796 insertions(+), 123 deletions(-)

New commits:
commit e93b5fff2775cd1d8793eb14e7ffcf059ebc2752
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Jul 4 02:16:17 2012 +0200

    impreove the cond format dialog a little bit
    
    Change-Id: I4c7fdb15440ef0fca5b262a37549e96c85d8ab1f

diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index d20d320..79a111d 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -320,7 +320,7 @@ void ScCondFrmtEntry::Init()
     Point aPointCol = maLbColMiddle.GetPosPixel();
     Point aPointEdDataBar = maEdDataBarMin.GetPosPixel();
     Point aPointLbDataBar = maLbDataBarMaxType.GetPosPixel();
-    const long nMovePos = 150;
+    const long nMovePos = 250;
     aPointLb.X() += nMovePos;
     aPointEd.X() += nMovePos;
     aPointCol.X() += nMovePos;
@@ -453,6 +453,7 @@ void ScCondFrmtEntry::SetCondType()
     HideColorScaleElements();
     HideDataBarElements();
     SwitchToType(CONDITION);
+    ConditionTypeSelectHdl(NULL);
 }
 
 void ScCondFrmtEntry::HideColorScaleElements()
@@ -565,7 +566,11 @@ void ScCondFrmtEntry::SetFormulaType()
     maEdVal2.Hide();
     maLbCondType.Hide();
     maLbStyle.Show();
+    maFtCondition.Show();
     maWdPreview.Show();
+    maFtStyle.Show();
+    Size aSize(440, 30);
+    maEdVal1.SetSizePixel(aSize);
 }
 
 void ScCondFrmtEntry::Select()
@@ -895,7 +900,7 @@ IMPL_LINK_NOARG( ScCondFrmtEntry, ConditionTypeSelectHdl )
     else
     {
         maEdVal2.Hide();
-        Size aSize(193, 30);
+        Size aSize(440, 30);
         maEdVal1.SetSizePixel(aSize);
     }
     return 0;
diff --git a/sc/source/ui/src/condformatdlg.src b/sc/source/ui/src/condformatdlg.src
index 68fd52a..ebf84f3 100644
--- a/sc/source/ui/src/condformatdlg.src
+++ b/sc/source/ui/src/condformatdlg.src
@@ -134,13 +134,13 @@ Control RID_COND_ENTRY
     Edit ED_VAL1
     {
         Pos = MAP_APPFONT( 125, 15 );
-        Size = MAP_APPFONT( 170, 12 );
+        Size = MAP_APPFONT( 160, 12 );
         Border = TRUE;
     };
     Edit ED_VAL2
     {
-        Pos = MAP_APPFONT( 215, 15 );
-        Size = MAP_APPFONT( 80, 12 );
+        Pos = MAP_APPFONT( 210, 15 );
+        Size = MAP_APPFONT( 75, 12 );
         Border = TRUE;
     };
     ListBox LB_STYLE
@@ -156,7 +156,7 @@ Control RID_COND_ENTRY
     };
     ListBox LB_COLOR_FORMAT
     {
-        Pos = MAP_APPFONT( 50, 15 );
+        Pos = MAP_APPFONT( 70, 15 );
         Size = MAP_APPFONT( 60, 60);
         Border = TRUE;
         DropDown = TRUE;
@@ -170,7 +170,7 @@ Control RID_COND_ENTRY
     ListBox LB_TYPE_COL_SCALE
     {
         Pos = MAP_APPFONT( 5, 32 );
-        Size = MAP_APPFONT( 50, 60 );
+        Size = MAP_APPFONT( 60, 60 );
         Border = TRUE;
         DropDown = TRUE;
         StringList [ en-US ] =
@@ -186,7 +186,7 @@ Control RID_COND_ENTRY
     Edit ED_COL_SCALE
     {
         Pos = MAP_APPFONT( 5, 48 );
-        Size = MAP_APPFONT( 50, 12 );
+        Size = MAP_APPFONT( 60, 12 );
         Border = TRUE;
     };
     Window WD_PREVIEW
commit a666d4236cf799777a6af37c218fb6adc285b7a5
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Jul 3 02:52:55 2012 +0200

    check for invalid tab number, fdo#51667
    
    Change-Id: I9aebfafb68850130088658535f289f66d49f1741

diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index adf2863..1566f4a 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -212,7 +212,7 @@ void ScDocument::StartListeningCell( const ScAddress& rAddress,
 {
     OSL_ENSURE(pListener, "StartListeningCell: pListener Null");
     SCTAB nTab = rAddress.Tab();
-    if (nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
+    if (VALIDTAB(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
         maTabs[nTab]->StartListening( rAddress, pListener );
 }
 
@@ -221,7 +221,7 @@ void ScDocument::EndListeningCell( const ScAddress& rAddress,
 {
     OSL_ENSURE(pListener, "EndListeningCell: pListener Null");
     SCTAB nTab = rAddress.Tab();
-    if (nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
+    if (VALIDTAB(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
         maTabs[nTab]->EndListening( rAddress, pListener );
 }
 
commit fde053ef9a190d86cf77c6fc6106a5787e7c066f
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Jul 3 01:15:41 2012 +0200

    make the cond format dialog a bit mroe beautiful
    
    Change-Id: Id4eb94b1d262828f4e0cdd060f7eb87d146a4e86

diff --git a/sc/source/ui/src/condformatdlg.src b/sc/source/ui/src/condformatdlg.src
index e2b529c..68fd52a 100644
--- a/sc/source/ui/src/condformatdlg.src
+++ b/sc/source/ui/src/condformatdlg.src
@@ -32,40 +32,40 @@ ModalDialog RID_SCDLG_CONDFORMAT
 {
     OutputSize = TRUE;
     Hide = TRUE;
-    Size = MAP_APPFONT ( 200, 200 );
+    Size = MAP_APPFONT ( 300, 300 );
     Text [ en-US ] = "Conditional Formatting for";
     Moveable = TRUE;
     Closeable = TRUE;
     OkButton BTN_OK
     {
-        Pos = MAP_APPFONT ( 160, 180 );
-        Size = MAP_APPFONT ( 30, 14 );
+        Pos = MAP_APPFONT ( 190, 280 );
+        Size = MAP_APPFONT ( 50, 14 );
         TabStop = TRUE;
     };
     CancelButton BTN_CANCEL
     {
-        Pos = MAP_APPFONT ( 120, 180 );
-        Size = MAP_APPFONT ( 30, 14 );
+        Pos = MAP_APPFONT ( 245, 280 );
+        Size = MAP_APPFONT ( 50, 14 );
         TabStop = TRUE;
     };
     PushButton BTN_ADD
     {
-        Pos = MAP_APPFONT( 5, 155 );
-        Size = MAP_APPFONT( 40, 14 );
+        Pos = MAP_APPFONT( 5, 255 );
+        Size = MAP_APPFONT( 50, 14 );
         Text [ en-US ] = "Add";
         TabStop = TRUE;
     };
     PushButton BTN_REMOVE
     {
-        Pos = MAP_APPFONT( 50, 155 );
-        Size = MAP_APPFONT( 40, 14 );
+        Pos = MAP_APPFONT( 60, 255 );
+        Size = MAP_APPFONT( 50, 14 );
         Text [ en-US ] = "Remove";
         TabStop = TRUE;
     };
     Control CTRL_LIST
     {
         Pos = MAP_APPFONT( 5, 20 );
-        Size = MAP_APPFONT( 190, 120 );
+        Size = MAP_APPFONT( 290, 220 );
         Border = TRUE;
     };
 };
@@ -73,13 +73,13 @@ ModalDialog RID_SCDLG_CONDFORMAT
 Control RID_COND_ENTRY
 {
     Pos = MAP_APPFONT( 0, 0 );
-    Size = MAP_APPFONT( 190, 40 );
+    Size = MAP_APPFONT( 290, 40 );
     Border = TRUE;
 
     FixedText FT_COND_NR
     {
         Pos = MAP_APPFONT( 2, 2 );
-        Size = MAP_APPFONT( 30, 10 );
+        Size = MAP_APPFONT( 50, 10 );
     };
     String STR_CONDITION
     {
@@ -88,14 +88,14 @@ Control RID_COND_ENTRY
 
     FixedText FT_CONDITION
     {
-        Pos = MAP_APPFONT( 40, 2 );
-        Size = MAP_APPFONT( 90, 10 );
+        Pos = MAP_APPFONT( 60, 2 );
+        Size = MAP_APPFONT( 120, 10 );
     };
 
     ListBox LB_TYPE
     {
         Pos = MAP_APPFONT( 5, 15 );
-        Size = MAP_APPFONT( 40, 40 );
+        Size = MAP_APPFONT( 60, 40 );
         Border = TRUE;
         DropDown = TRUE;
         StringList [ en-US ] =
@@ -107,8 +107,8 @@ Control RID_COND_ENTRY
     };
     ListBox LB_CELLIS_TYPE
     {
-        Pos = MAP_APPFONT( 50, 15 );
-        Size = MAP_APPFONT( 30, 40 );
+        Pos = MAP_APPFONT( 70, 15 );
+        Size = MAP_APPFONT( 50, 40 );
         Border = TRUE;
         DropDown = TRUE;
         StringList [ en-US ] =
@@ -133,20 +133,20 @@ Control RID_COND_ENTRY
     };
     Edit ED_VAL1
     {
-        Pos = MAP_APPFONT( 90, 15 );
-        Size = MAP_APPFONT( 70, 12 );
+        Pos = MAP_APPFONT( 125, 15 );
+        Size = MAP_APPFONT( 170, 12 );
         Border = TRUE;
     };
     Edit ED_VAL2
     {
-        Pos = MAP_APPFONT( 130, 15 );
-        Size = MAP_APPFONT( 30, 12 );
+        Pos = MAP_APPFONT( 215, 15 );
+        Size = MAP_APPFONT( 80, 12 );
         Border = TRUE;
     };
     ListBox LB_STYLE
     {
         Pos = MAP_APPFONT( 50, 32 );
-        Size = MAP_APPFONT( 30, 40 );
+        Size = MAP_APPFONT( 50, 80 );
         Border = TRUE;
         DropDown = TRUE;
         StringList [ en-US ] =
@@ -157,7 +157,7 @@ Control RID_COND_ENTRY
     ListBox LB_COLOR_FORMAT
     {
         Pos = MAP_APPFONT( 50, 15 );
-        Size = MAP_APPFONT( 60, 40);
+        Size = MAP_APPFONT( 60, 60);
         Border = TRUE;
         DropDown = TRUE;
         StringList [ en-US ] =
@@ -167,24 +167,10 @@ Control RID_COND_ENTRY
             "Data Bar";
         };
     };
-    ListBox LB_COL_SCALE2
-    {
-        Pos = MAP_APPFONT( 120, 15 );
-        Size = MAP_APPFONT( 60, 40 );
-        Border = TRUE;
-        DropDown = TRUE;
-    };
-    ListBox LB_COL_SCALE3
-    {
-        Pos = MAP_APPFONT( 120, 15 );
-        Size = MAP_APPFONT( 60, 40 );
-        Border = TRUE;
-        DropDown = TRUE;
-    };
     ListBox LB_TYPE_COL_SCALE
     {
         Pos = MAP_APPFONT( 5, 32 );
-        Size = MAP_APPFONT( 40, 40 );
+        Size = MAP_APPFONT( 50, 60 );
         Border = TRUE;
         DropDown = TRUE;
         StringList [ en-US ] =
@@ -200,20 +186,20 @@ Control RID_COND_ENTRY
     Edit ED_COL_SCALE
     {
         Pos = MAP_APPFONT( 5, 48 );
-        Size = MAP_APPFONT( 40, 12 );
+        Size = MAP_APPFONT( 50, 12 );
         Border = TRUE;
     };
     Window WD_PREVIEW
     {
-        Pos = MAP_APPFONT( 90, 32 );
-        Size = MAP_APPFONT( 40, 14 );
+        Pos = MAP_APPFONT( 150, 32 );
+        Size = MAP_APPFONT( 60, 14 );
         Text [ en-US ] = "Example";
         Border = TRUE;
     };
     ListBox LB_COL
     {
         Pos = MAP_APPFONT( 5, 62 );
-        Size = MAP_APPFONT( 40, 40 );
+        Size = MAP_APPFONT( 60, 40 );
         Border = TRUE;
         DropDown = TRUE;
         DDExtraWidth = TRUE;
commit 77c9613a227ce61adde63c6d1657c59bc1b4f3bb
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Jul 2 18:48:30 2012 +0200

    correct enumerate the condition entries in the dialog
    
    Change-Id: I43c83674464f7c41505735b2ec4208f21567ed4c

diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index cea4244..d20d320 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -143,7 +143,9 @@ ScCondFrmtEntry::ScCondFrmtEntry(Window* pParent, ScDocument* pDoc):
     maEdDataBarMin( this, ScResId( ED_COL_SCALE ) ),
     maEdDataBarMax( this, ScResId( ED_COL_SCALE ) ),
     maBtOptions( this, ScResId( BTN_OPTIONS ) ),
-    mpDoc(pDoc)
+    mpDoc(pDoc),
+    mnIndex(0),
+    maStrCondition(ScResId( STR_CONDITION ).toString())
 {
     SetControlBackground(GetSettings().GetStyleSettings().GetDialogColor());
     FreeResource();
@@ -422,6 +424,14 @@ void ScCondFrmtEntry::SwitchToType( ScCondFormatEntryType eType )
     }
 }
 
+void ScCondFrmtEntry::SetIndex(sal_Int32 nIndex)
+{
+    mnIndex = nIndex;
+    rtl::OUStringBuffer aBuffer(maStrCondition);
+    aBuffer.append(rtl::OUString::valueOf(nIndex));
+    maFtCondNr.SetText(aBuffer.makeStringAndClear());
+}
+
 void ScCondFrmtEntry::HideCondElements()
 {
     maEdVal1.Hide();
@@ -951,9 +961,12 @@ ScConditionalFormat* ScCondFormatList::GetConditionalFormat() const
 void ScCondFormatList::RecalcAll()
 {
     sal_Int32 nTotalHeight = 0;
+    sal_Int32 nIndex = 1;
     for(EntryContainer::iterator itr = maEntries.begin(); itr != maEntries.end(); ++itr)
     {
         nTotalHeight += itr->GetSizePixel().Height();
+        itr->SetIndex( nIndex );
+        ++nIndex;
     }
 
     Size aCtrlSize = GetOutputSize();
diff --git a/sc/source/ui/condformat/condformathelper.cxx b/sc/source/ui/condformat/condformathelper.cxx
index 341f390..dda40a8 100644
--- a/sc/source/ui/condformat/condformathelper.cxx
+++ b/sc/source/ui/condformat/condformathelper.cxx
@@ -9,6 +9,7 @@
 
 #include <rtl/ustrbuf.hxx>
 #include "condformathelper.hxx"
+#include "globstr.hrc"
 
 namespace {
 
@@ -48,13 +49,13 @@ rtl::OUString getExpression(sal_Int32 nIndex)
         case 5:
             return rtl::OUString("!=");
         case 6:
-            return ScGlobaLL:GetRscString(STR_COND_BETWEEN);
+            return ScGlobal::GetRscString(STR_COND_BETWEEN);
         case 7:
-            return ScGlobaLL:GetRscString(STR_COND_NOTBETWEEN);
+            return ScGlobal::GetRscString(STR_COND_NOTBETWEEN);
         case 8:
-            return ScGlobaLL:GetRscString(STR_COND_DUPLICATE);
+            return ScGlobal::GetRscString(STR_COND_DUPLICATE);
         case 9:
-            return ScGlobaLL:GetRscString(STR_COND_UNIQUE);
+            return ScGlobal::GetRscString(STR_COND_UNIQUE);
     }
     return rtl::OUString();
 }
diff --git a/sc/source/ui/inc/condformatdlg.hrc b/sc/source/ui/inc/condformatdlg.hrc
index 045b215..d92e7a7 100644
--- a/sc/source/ui/inc/condformatdlg.hrc
+++ b/sc/source/ui/inc/condformatdlg.hrc
@@ -53,5 +53,6 @@
 #define WD_PREVIEW 26
 #define LB_COL 27
 #define BTN_OPTIONS 30
+#define STR_CONDITION 31
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/condformatdlg.hxx b/sc/source/ui/inc/condformatdlg.hxx
index fba8295..35e24da 100644
--- a/sc/source/ui/inc/condformatdlg.hxx
+++ b/sc/source/ui/inc/condformatdlg.hxx
@@ -115,6 +115,8 @@ private:
 
     ScDocument* mpDoc;
     ScAddress maPos;
+    sal_Int32 mnIndex;
+    rtl::OUString maStrCondition;
 
     DECL_LINK( TypeListHdl, void*);
     DECL_LINK( ColFormatTypeHdl, void*);
@@ -134,6 +136,7 @@ public:
     void Deselect();
 
     bool IsSelected() const;
+    void SetIndex(sal_Int32 nIndex);
 
     ScFormatEntry* GetEntry() const;
 };
diff --git a/sc/source/ui/src/condformatdlg.src b/sc/source/ui/src/condformatdlg.src
index 26b8d13..e2b529c 100644
--- a/sc/source/ui/src/condformatdlg.src
+++ b/sc/source/ui/src/condformatdlg.src
@@ -80,7 +80,10 @@ Control RID_COND_ENTRY
     {
         Pos = MAP_APPFONT( 2, 2 );
         Size = MAP_APPFONT( 30, 10 );
-        Text [ en-US ] = "Condition";
+    };
+    String STR_CONDITION
+    {
+        Text [ en-US ] = "Condition ";
     };
 
     FixedText FT_CONDITION
diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src
index 5eec907..9938cd6 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -1865,7 +1865,7 @@ Resource RID_GLOBSTR
     };
     String STR_COND_CONDITION
     {
-        Text [ en-US ] = "Condition";
+        Text [ en-US ] = "Cell value is";
     };
     String STR_COND_COLORSCALE
     {
commit 1643cb725cbd9ab0c5d238b0d762f470980ad658
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Jul 2 17:28:44 2012 +0200

    localize all parts of the new cond format dialogs
    
    Change-Id: Ia582433bd126b9e60b7aecdc19bce57b2a6e85a6

diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index d8781a1..1bb71a4 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -602,7 +602,16 @@
 #define STR_PIVOT_GROUP             467
 #define STR_HEADER_COND             468
 
-#define STR_COUNT                   469
+#define STR_COND_CONDITION          469
+#define STR_COND_COLORSCALE         470
+#define STR_COND_DATABAR            471
+#define STR_COND_FORMULA            472
+#define STR_COND_BETWEEN            473
+#define STR_COND_NOTBETWEEN         474
+#define STR_COND_UNIQUE             475
+#define STR_COND_DUPLICATE          476
+
+#define STR_COUNT                   477
 
 
 #endif
diff --git a/sc/source/ui/condformat/condformathelper.cxx b/sc/source/ui/condformat/condformathelper.cxx
index 0ef03e8..341f390 100644
--- a/sc/source/ui/condformat/condformathelper.cxx
+++ b/sc/source/ui/condformat/condformathelper.cxx
@@ -17,13 +17,13 @@ rtl::OUString getTextForType(ScCondFormatEntryType eType)
     switch(eType)
     {
         case CONDITION:
-            return rtl::OUString("Cell value");
+            return ScGlobal::GetRscString(STR_COND_CONDITION);
         case COLORSCALE:
-            return rtl::OUString("Color scale");
+            return ScGlobal::GetRscString(STR_COND_COLORSCALE);
         case DATABAR:
-            return rtl::OUString("Data Bar");
+            return ScGlobal::GetRscString(STR_COND_DATABAR);
         case FORMULA:
-            return rtl::OUString("Formula is");
+            return ScGlobal::GetRscString(STR_COND_FORMULA);
         default:
             break;
     }
@@ -48,13 +48,13 @@ rtl::OUString getExpression(sal_Int32 nIndex)
         case 5:
             return rtl::OUString("!=");
         case 6:
-            return rtl::OUString("between");
+            return ScGlobaLL:GetRscString(STR_COND_BETWEEN);
         case 7:
-            return rtl::OUString("not between");
+            return ScGlobaLL:GetRscString(STR_COND_NOTBETWEEN);
         case 8:
-            return rtl::OUString("duplicate");
+            return ScGlobaLL:GetRscString(STR_COND_DUPLICATE);
         case 9:
-            return rtl::OUString("unique");
+            return ScGlobaLL:GetRscString(STR_COND_UNIQUE);
     }
     return rtl::OUString();
 }
diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx
index c8f3ad6..aee8b6f 100644
--- a/sc/source/ui/condformat/condformatmgr.cxx
+++ b/sc/source/ui/condformat/condformatmgr.cxx
@@ -62,7 +62,8 @@ ScCondFormatManagerWindow::ScCondFormatManagerWindow(Window* pParent, ScDocument
     SetPosSizePixel( Point( 0, aHeadSize.Height() ), Size( aBoxSize.Width(), aBoxSize.Height() - aHeadSize.Height() ) );
     SetTabs( &nTabs[0], MAP_PIXEL );
 
-    //maHeaderBar.SetEndDragHdl( LINK( this, ScRangeManagerTable, HeaderEndDragHdl ) );
+    maHeaderBar.SetEndDragHdl( LINK(this, ScCondFormatManagerWindow, HeaderEndDragHdl ) );
+    HeaderEndDragHdl(NULL);
 
     Init();
     Show();
@@ -122,6 +123,25 @@ void ScCondFormatManagerWindow::Update()
     Init();
 }
 
+IMPL_LINK_NOARG(ScCondFormatManagerWindow, HeaderEndDragHdl)
+{
+    long aTableSize = maHeaderBar.GetSizePixel().Width();
+    long aItemRangeSize = maHeaderBar.GetItemSize(ITEMID_RANGE);
+
+    //calculate column size based on user input and minimum size
+    long aItemCondSize = aTableSize - aItemRangeSize;
+
+    Size aSz;
+    aSz.Width() = aItemRangeSize;
+    SetTab( ITEMID_RANGE, PixelToLogic( aSz, MapMode(MAP_APPFONT) ).Width(), MAP_APPFONT );
+    maHeaderBar.SetItemSize(ITEMID_RANGE, aItemRangeSize);
+    aSz.Width() += aItemCondSize;
+    SetTab( ITEMID_CONDITION, PixelToLogic( aSz, MapMode(MAP_APPFONT) ).Width(), MAP_APPFONT );
+    maHeaderBar.SetItemSize(ITEMID_CONDITION, aItemCondSize);
+
+    return 0;
+}
+
 ScCondFormatManagerCtrl::ScCondFormatManagerCtrl(Window* pParent, ScDocument* pDoc, ScConditionalFormatList* pFormatList, const ScAddress& rPos):
     Control(pParent, ScResId(CTRL_TABLE)),
     maWdManager(this, pDoc, pFormatList, rPos)
@@ -199,6 +219,7 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnHdl)
         mpFormatList->InsertNew(pNewFormat);
         maCtrlManager.Update();
     }
+    delete pDlg;
 
     return 0;
 }
diff --git a/sc/source/ui/inc/condformatmgr.hxx b/sc/source/ui/inc/condformatmgr.hxx
index bf7cfb3..39bfe3b 100644
--- a/sc/source/ui/inc/condformatmgr.hxx
+++ b/sc/source/ui/inc/condformatmgr.hxx
@@ -54,6 +54,8 @@ private:
     const ScAddress& mrPos;
     std::map<SvLBoxEntry*, sal_Int32> maMapLBoxEntryToCondIndex;
 
+    DECL_LINK( HeaderEndDragHdl, void* );
+
 public:
     ScCondFormatManagerWindow( Window* pParent, ScDocument* pDoc, ScConditionalFormatList* pFormatList, const ScAddress& rPos );
 
diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src
index 4b2a4ec..5eec907 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -1861,7 +1861,35 @@ Resource RID_GLOBSTR
     };
     String STR_HEADER_COND
     {
-        Text [ en_US ] = "First Condition";
+        Text [ en-US ] = "First Condition";
+    };
+    String STR_COND_CONDITION
+    {
+        Text [ en-US ] = "Condition";
+    };
+    String STR_COND_COLORSCALE
+    {
+        Text [ en-US ] = "ColorScale";
+    };
+    String STR_COND_DATABAR
+    {
+        Text [ en-US ] = "DataBar";
+    };
+    String STR_COND_BETWEEN
+    {
+        Text [ en-US ] = "between";
+    };
+    String STR_COND_NOTBETWEEN
+    {
+        Text [ en-US ] = "not between";
+    };
+    String STR_COND_UNIQUE
+    {
+        Text [ en-US ] = "unique";
+    };
+    String STR_COND_DUPLICATE
+    {
+        Text [ en-US ] = "duplicate";
     };
 };
 
commit acbf943bc65b155bc0c77d5bf2ef8cffb5aa9150
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Jul 2 11:30:28 2012 +0200

    add the cond format manager
    
    Change-Id: I2c21b048c24333e4d04434ff92b9d9da2efe9558

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index 5bf1ec3..be05859 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -449,6 +449,11 @@
                     <value xml:lang="en-US">Conditional Formatting...</value>
                 </prop>
             </node>
+            <node oor:name=".uno:ConditionalFormatManagerDialog" oor:op="replace">
+                <prop oor:name="Label" oor:type="xs:string">
+                    <value xml:lang="en-US">Manage...</value>
+                </prop>
+            </node>
             <node oor:name=".uno:Deselect" oor:op="replace">
                 <prop oor:name="Label" oor:type="xs:string">
                     <value xml:lang="en-US">Undo Selection</value>
diff --git a/sc/AllLangResTarget_sc.mk b/sc/AllLangResTarget_sc.mk
index 1c0eb4d..2d3c64c 100644
--- a/sc/AllLangResTarget_sc.mk
+++ b/sc/AllLangResTarget_sc.mk
@@ -81,6 +81,7 @@ $(eval $(call gb_SrsTarget_add_files,sc/res,\
     sc/source/ui/src/filter.src \
     sc/source/ui/src/colorformat.src \
     sc/source/ui/src/condformatdlg.src \
+    sc/source/ui/src/condformatmgr.src \
     sc/source/ui/cctrl/checklistmenu.src \
     sc/source/ui/navipi/navipi.src \
     sc/source/ui/docshell/tpstat.src \
diff --git a/sc/Library_scui.mk b/sc/Library_scui.mk
index 0cb2780..e13cda0 100644
--- a/sc/Library_scui.mk
+++ b/sc/Library_scui.mk
@@ -65,6 +65,8 @@ $(eval $(call gb_Library_add_exception_objects,scui,\
     sc/source/ui/cctrl/editfield \
     sc/source/ui/condformat/colorformat \
     sc/source/ui/condformat/condformatdlg \
+    sc/source/ui/condformat/condformathelper \
+    sc/source/ui/condformat/condformatmgr \
     sc/source/ui/dbgui/dapidata \
     sc/source/ui/dbgui/dapitype \
     sc/source/ui/dbgui/dpgroupdlg \
diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx
index 2938ca7..eaeccf5 100644
--- a/sc/inc/conditio.hxx
+++ b/sc/inc/conditio.hxx
@@ -314,7 +314,7 @@ public:
 //  List of areas and formats:
 //
 
-class ScConditionalFormatList
+class SC_DLLPUBLIC ScConditionalFormatList
 {
 private:
     boost::ptr_set<ScConditionalFormat> maConditionalFormats;
diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc
index b02d250..d8781a1 100644
--- a/sc/inc/globstr.hrc
+++ b/sc/inc/globstr.hrc
@@ -600,8 +600,9 @@
 #define STR_UNSAVED_EXT_REF         465
 #define STR_CLOSE_WITH_UNSAVED_REFS 466
 #define STR_PIVOT_GROUP             467
+#define STR_HEADER_COND             468
 
-#define STR_COUNT                   468
+#define STR_COUNT                   469
 
 
 #endif
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index e2949d4..05a5be6 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -288,6 +288,7 @@
 #define SID_OPENDLG_CONDFRMT        (SC_MESSAGE_START + 59)
 #define SID_OPENDLG_OPTSOLVER       (SC_MESSAGE_START + 60)
 #define SID_VALIDITY_REFERENCE      (SC_MESSAGE_START + 61)
+#define SID_OPENDLG_CONDFRMT_MANAGER (SC_MESSAGE_START + 62)
 #define SC_HINT_NAVIGATOR_UPDATEALL  (SC_MESSAGE_START + 65)
 
 // functions
@@ -1235,6 +1236,8 @@
 #define RID_SCPAGE_SORTKEY_FIELDS       (SC_DIALOGS_START + 158)
 #define RID_SCDLG_SORTKEY               (SC_DIALOGS_START + 159)
 
+#define RID_SCDLG_COND_FORMAT_MANAGER   (SC_DIALOGS_START + 158)
+
 #define SC_DIALOGS_END                  (SC_DIALOGS_START + 160)
 
 #ifndef STD_MASKCOLOR
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 921773a..d5efc4e 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -58,6 +58,7 @@ struct ScDPFuncData;
 struct ScDPNumGroupInfo;
 class ScTabViewShell;
 class ScConditionalFormat;
+class ScConditionalFormatList;
 
 namespace com { namespace sun { namespace star { namespace sheet {
     struct DataPilotFieldReference;
@@ -92,6 +93,12 @@ public:
     virtual ScConditionalFormat* GetConditionalFormat() = 0;
 };
 
+class AbstractScCondFormatManagerDlg : public VclAbstractDialog
+{
+public:
+    virtual ScConditionalFormatList* GetConditionalFormatList() = 0;
+};
+
 class AbstractScDataBarSettingsDlg : public VclAbstractDialog
 {
 };
@@ -362,6 +369,9 @@ public:
     virtual AbstractScCondFormatDlg* CreateScCondFormatDlg (Window* pParent, ScDocument* pDoc, const ScConditionalFormat* pFormat,
                                                                 const ScRangeList& rList, const ScAddress& rPos, int nId ) = 0; //add for ScCondFormatDlg
 
+    virtual AbstractScCondFormatManagerDlg* CreateScCondFormatMgrDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList,
+                                                                const ScRangeList& rList, const ScAddress& rPos, int nId ) = 0;
+
     virtual AbstractScDataBarSettingsDlg* CreateScDataBarSetttingsDlg (Window* pParent, ScDocument* pDoc, int nId ) = 0; //add for ScDataBarSettingsDlg
 
     virtual AbstractScDataPilotDatabaseDlg * CreateScDataPilotDatabaseDlg (Window* pParent ,int nId ) = 0; //add for ScDataPilotDatabaseDlg
diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi
index 99f3541..f20b07c 100644
--- a/sc/sdi/cellsh.sdi
+++ b/sc/sdi/cellsh.sdi
@@ -188,6 +188,7 @@ interface CellSelection
     SID_CANCEL      [ ExecMethod = Execute; ]
     SID_TOGGLE_REL  [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
     SID_OPENDLG_CONDFRMT    [ ExecMethod = ExecuteEdit; ]
+    SID_OPENDLG_CONDFRMT_MANAGER    [ ExecMethod = ExecuteEdit; ]
     SID_COLORSCALE          [ ExecMethod = ExecuteEdit; ]
     SID_DATABAR             [ ExecMethod = ExecuteEdit; ]
     FID_NOTE_VISIBLE        [ ExecMethod = ExecuteEdit; StateMethod = GetState; ]
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 36f355f..050c645 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -1094,6 +1094,31 @@ SfxVoidItem ConditionalFormatDialog SID_OPENDLG_CONDFRMT
 ]
 
 //--------------------------------------------------------------------------
+SfxVoidItem ConditionalFormatManagerDialog SID_OPENDLG_CONDFRMT_MANAGER
+()
+[
+    /* flags: */
+    AutoUpdate = FALSE,
+    Cachable = Cachable,
+    FastCall = FALSE,
+    HasCoreId = FALSE,
+    HasDialog = TRUE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+    Synchron;
+
+    /* config: */
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    StatusBarConfig = FALSE,
+    ToolBoxConfig = TRUE,
+    GroupId = GID_FORMAT;
+]
+
+//--------------------------------------------------------------------------
 SfxVoidItem ColorScaleDialog SID_COLORSCALE
 ()
 [
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 01c3b08..4dd5292 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -81,6 +81,7 @@
 #include "tpdefaults.hxx"
 #include "colorformat.hxx"
 #include "condformatdlg.hxx"
+#include "condformatmgr.hxx"
 
 // ause
 #include "editutil.hxx"
@@ -90,6 +91,7 @@ IMPL_ABSTDLG_BASE(AbstractScImportAsciiDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScAutoFormatDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScColRowLabelDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScCondFormatDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractScCondFormatManagerDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScDataBarSettingsDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScDataPilotDatabaseDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScDataPilotSourceTypeDlg_Impl);
@@ -460,7 +462,10 @@ ScConditionalFormat* AbstractScCondFormatDlg_Impl::GetConditionalFormat()
     return pDlg->GetConditionalFormat();
 }
 
-
+ScConditionalFormatList* AbstractScCondFormatManagerDlg_Impl::GetConditionalFormatList()
+{
+    return pDlg->GetConditionalFormatList();
+}
 
 
 long AbstractScMetricInputDlg_Impl::GetInputValue( FieldUnit eUnit ) const
@@ -794,6 +799,24 @@ AbstractScCondFormatDlg* ScAbstractDialogFactory_Impl::CreateScCondFormatDlg(Win
     return NULL;
 }
 
+AbstractScCondFormatManagerDlg* ScAbstractDialogFactory_Impl::CreateScCondFormatMgrDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList,
+                                                                const ScRangeList& rList, const ScAddress& rPos, int nId )
+{
+    ScCondFormatManagerDlg* pDlg = NULL;
+    switch( nId )
+    {
+        case RID_SCDLG_COND_FORMAT_MANAGER:
+            pDlg = new ScCondFormatManagerDlg( pParent, pDoc, pFormatList, rList, rPos );
+            break;
+        default:
+            break;
+    }
+    if(pDlg)
+        return new AbstractScCondFormatManagerDlg_Impl( pDlg );
+
+    return NULL;
+}
+
 AbstractScDataBarSettingsDlg* ScAbstractDialogFactory_Impl::CreateScDataBarSetttingsDlg(Window* pParent, ScDocument* pDoc, int nId)
 {
     ScDataBarSettingsDlg* pDlg = NULL;
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 5fb36e1..a56272e 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -68,6 +68,7 @@ class ScSortWarningDlg;
 class ScTextImportOptionsDlg;
 class ScDataBarSettingsDlg;
 class ScCondFormatDlg;
+class ScCondFormatManagerDlg;
 
 #define DECL_ABSTDLG_BASE(Class,DialogClass)        \
     DialogClass*        pDlg;                       \
@@ -146,6 +147,13 @@ class AbstractScCondFormatDlg_Impl : public AbstractScCondFormatDlg
     virtual ScConditionalFormat* GetConditionalFormat();
 };
 
+class AbstractScCondFormatManagerDlg_Impl : public AbstractScCondFormatManagerDlg
+{
+    DECL_ABSTDLG_BASE(AbstractScCondFormatManagerDlg_Impl, ScCondFormatManagerDlg)
+
+    virtual ScConditionalFormatList* GetConditionalFormatList();
+};
+
 class AbstractScDataBarSettingsDlg_Impl : public AbstractScDataBarSettingsDlg
 {
     DECL_ABSTDLG_BASE(AbstractScDataBarSettingsDlg_Impl, ScDataBarSettingsDlg)
@@ -432,6 +440,9 @@ public:
     virtual AbstractScCondFormatDlg* CreateScCondFormatDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormat* pFormat,
                                                                 const ScRangeList& rRange, const ScAddress& rPos, int nId ); //add for ScDataBarSettingsDlg
 
+    virtual AbstractScCondFormatManagerDlg* CreateScCondFormatMgrDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList,
+                                                                const ScRangeList& rList, const ScAddress& rPos, int nId );
+
     virtual AbstractScDataBarSettingsDlg* CreateScDataBarSetttingsDlg (Window* pParent, ScDocument* pDoc, int nId ); //add for ScDataBarSettingsDlg
 
     virtual AbstractScDataPilotDatabaseDlg * CreateScDataPilotDatabaseDlg (Window* pParent ,int nId ); //add for ScDataPilotDatabaseDlg
diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index 8c2aa1d..cea4244 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -387,57 +387,6 @@ void ScCondFrmtEntry::Init()
     mpDataBarData->maPositiveColor = COL_LIGHTBLUE;
 }
 
-namespace {
-
-rtl::OUString getTextForType(ScCondFormatEntryType eType)
-{
-    switch(eType)
-    {
-        case CONDITION:
-            return rtl::OUString("Cell value");
-        case COLORSCALE:
-            return rtl::OUString("Color scale");
-        case DATABAR:
-            return rtl::OUString("Data Bar");
-        case FORMULA:
-            return rtl::OUString("Formula is");
-        default:
-            break;
-    }
-
-    return rtl::OUString("");
-}
-
-rtl::OUString getExpression(sal_Int32 nIndex)
-{
-    switch(nIndex)
-    {
-        case 0:
-            return rtl::OUString("=");
-        case 1:
-            return rtl::OUString("<");
-        case 2:
-            return rtl::OUString(">");
-        case 3:
-            return rtl::OUString("<=");
-        case 4:
-            return rtl::OUString(">=");
-        case 5:
-            return rtl::OUString("!=");
-        case 6:
-            return rtl::OUString("between");
-        case 7:
-            return rtl::OUString("not between");
-        case 8:
-            return rtl::OUString("duplicate");
-        case 9:
-            return rtl::OUString("unique");
-    }
-    return rtl::OUString();
-}
-
-}
-
 long ScCondFrmtEntry::Notify( NotifyEvent& rNEvt )
 {
     if( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN )
@@ -454,11 +403,8 @@ void ScCondFrmtEntry::SwitchToType( ScCondFormatEntryType eType )
         case COLLAPSED:
             {
                 maLbType.Hide();
-                rtl::OUStringBuffer maCondText(getTextForType(meType));
-                maCondText.append(rtl::OUString(" "));
-                if(meType == CONDITION)
-                    maCondText.append(getExpression(maLbCondType.GetSelectEntryPos()));
-                maFtCondition.SetText(maCondText.makeStringAndClear());
+                rtl::OUString maCondText = ScCondFormatHelper::GetExpression(meType, maLbCondType.GetSelectEntryPos());
+                maFtCondition.SetText(maCondText);
                 maFtCondition.Show();
                 maLbType.Hide();
                 HideCondElements();
diff --git a/sc/source/ui/condformat/condformathelper.cxx b/sc/source/ui/condformat/condformathelper.cxx
new file mode 100644
index 0000000..0ef03e8
--- /dev/null
+++ b/sc/source/ui/condformat/condformathelper.cxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <rtl/ustrbuf.hxx>
+#include "condformathelper.hxx"
+
+namespace {
+
+rtl::OUString getTextForType(ScCondFormatEntryType eType)
+{
+    switch(eType)
+    {
+        case CONDITION:
+            return rtl::OUString("Cell value");
+        case COLORSCALE:
+            return rtl::OUString("Color scale");
+        case DATABAR:
+            return rtl::OUString("Data Bar");
+        case FORMULA:
+            return rtl::OUString("Formula is");
+        default:
+            break;
+    }
+
+    return rtl::OUString("");
+}
+
+rtl::OUString getExpression(sal_Int32 nIndex)
+{
+    switch(nIndex)
+    {
+        case 0:
+            return rtl::OUString("=");
+        case 1:
+            return rtl::OUString("<");
+        case 2:
+            return rtl::OUString(">");
+        case 3:
+            return rtl::OUString("<=");
+        case 4:
+            return rtl::OUString(">=");
+        case 5:
+            return rtl::OUString("!=");
+        case 6:
+            return rtl::OUString("between");
+        case 7:
+            return rtl::OUString("not between");
+        case 8:
+            return rtl::OUString("duplicate");
+        case 9:
+            return rtl::OUString("unique");
+    }
+    return rtl::OUString();
+}
+
+}
+
+rtl::OUString ScCondFormatHelper::GetExpression(const ScConditionalFormat& rFormat, const ScAddress& rPos)
+{
+    rtl::OUStringBuffer aBuffer;
+    if(!rFormat.IsEmpty())
+    {
+        switch(rFormat.GetEntry(0)->GetType())
+        {
+            case condformat::CONDITION:
+                {
+                    const ScConditionEntry* pEntry = static_cast<const ScConditionEntry*>(rFormat.GetEntry(0));
+                    ScConditionMode eMode = pEntry->GetOperation();
+                    if(eMode == SC_COND_DIRECT)
+                    {
+                        aBuffer.append(getTextForType(FORMULA));
+                    }
+                    else
+                    {
+                        aBuffer.append(getTextForType(CONDITION));
+                        aBuffer.append(rtl::OUString(" "));
+                        aBuffer.append(getExpression(static_cast<sal_Int32>(eMode)));
+                        aBuffer.append(rtl::OUString(" "));
+                        if(eMode == SC_COND_BETWEEN || eMode == SC_COND_NOTBETWEEN)
+                        {
+                            aBuffer.append(pEntry->GetExpression(rPos, 0));
+                            aBuffer.append(rtl::OUString(" and "));
+                            aBuffer.append(pEntry->GetExpression(rPos, 1));
+                        }
+                        else
+                        {
+                            aBuffer.append(pEntry->GetExpression(rPos, 0));
+                        }
+                    }
+                }
+
+                break;
+            case condformat::DATABAR:
+                aBuffer.append(getTextForType(DATABAR));
+                break;
+            case condformat::COLORSCALE:
+                aBuffer.append(getTextForType(COLORSCALE));
+                break;
+        }
+    }
+    return aBuffer.makeStringAndClear();
+}
+
+rtl::OUString ScCondFormatHelper::GetExpression( ScCondFormatEntryType eType, sal_Int32 nIndex )
+{
+    rtl::OUStringBuffer aBuffer(getTextForType(eType));
+    aBuffer.append(rtl::OUString(" "));
+    if(eType == CONDITION)
+        aBuffer.append(getExpression(nIndex));
+
+    return aBuffer.makeStringAndClear();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx
new file mode 100644
index 0000000..c8f3ad6
--- /dev/null
+++ b/sc/source/ui/condformat/condformatmgr.cxx
@@ -0,0 +1,206 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Markus Mohrhard <markus.mohrhard at googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "condformatmgr.hxx"
+#include "condformatmgr.hrc"
+#include "scresid.hxx"
+#include "globstr.hrc"
+#include "condformatdlg.hxx"
+#include "vcl/msgbox.hxx"
+
+#define ITEMID_RANGE 1
+#define ITEMID_CONDITION 2
+
+
+ScCondFormatManagerWindow::ScCondFormatManagerWindow(Window* pParent, ScDocument* pDoc, ScConditionalFormatList* pFormatList, const ScAddress& rPos):
+    SvTabListBox(pParent, WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP),
+    maHeaderBar( pParent, WB_BUTTONSTYLE | WB_BOTTOMBORDER ),
+    mpDoc(pDoc),
+    mpFormatList(pFormatList),
+    mrPos(rPos)
+{
+    Size aBoxSize( pParent->GetOutputSizePixel() );
+
+    maHeaderBar.SetPosSizePixel( Point(0, 0), Size( aBoxSize.Width(), 16 ) );
+
+    String aConditionStr(ScGlobal::GetRscString(STR_HEADER_COND));
+    String aRangeStr(ScGlobal::GetRscString(STR_HEADER_RANGE));
+
+    long nTabSize = aBoxSize.Width()/2;
+    maHeaderBar.InsertItem( ITEMID_RANGE, aRangeStr, nTabSize, HIB_LEFT| HIB_VCENTER );
+    maHeaderBar.InsertItem( ITEMID_CONDITION, aConditionStr, nTabSize, HIB_LEFT| HIB_VCENTER );
+
+    static long nTabs[] = {2, 0, nTabSize };
+    Size aHeadSize( maHeaderBar.GetSizePixel() );
+
+    //pParent->SetFocusControl( this );
+    SetPosSizePixel( Point( 0, aHeadSize.Height() ), Size( aBoxSize.Width(), aBoxSize.Height() - aHeadSize.Height() ) );
+    SetTabs( &nTabs[0], MAP_PIXEL );
+
+    //maHeaderBar.SetEndDragHdl( LINK( this, ScRangeManagerTable, HeaderEndDragHdl ) );
+
+    Init();
+    Show();
+    maHeaderBar.Show();
+    SetSelectionMode(MULTIPLE_SELECTION);
+}
+
+String ScCondFormatManagerWindow::createEntryString(const ScConditionalFormat& rFormat)
+{
+    ScRangeList aRange = rFormat.GetRange();
+    String aStr;
+    aRange.Format(aStr, SCA_VALID, mpDoc, mpDoc->GetAddressConvention());
+    aStr += '\t';
+    aStr += ScCondFormatHelper::GetExpression(rFormat, mrPos);
+    return aStr;
+}
+
+void ScCondFormatManagerWindow::Init()
+{
+    SetUpdateMode(false);
+
+    for(ScConditionalFormatList::iterator itr = mpFormatList->begin(); itr != mpFormatList->end(); ++itr)
+    {
+        SvLBoxEntry* pEntry = InsertEntryToColumn( createEntryString(*itr), LIST_APPEND, 0xffff );
+        maMapLBoxEntryToCondIndex.insert(std::pair<SvLBoxEntry*,sal_Int32>(pEntry,itr->GetKey()));
+    }
+    SetUpdateMode(true);
+}
+
+void ScCondFormatManagerWindow::DeleteSelection()
+{
+    if(GetSelectionCount())
+    {
+        for(SvLBoxEntry* pEntry = FirstSelected(); pEntry != NULL; pEntry = NextSelected(pEntry))
+        {
+            sal_Int32 nIndex = maMapLBoxEntryToCondIndex.find(pEntry)->second;
+            mpFormatList->erase(nIndex);
+        }
+        RemoveSelection();
+    }
+}
+
+ScConditionalFormat* ScCondFormatManagerWindow::GetSelection()
+{
+    SvLBoxEntry* pEntry = FirstSelected();
+    if(!pEntry)
+        return NULL;
+
+    sal_Int32 nIndex = maMapLBoxEntryToCondIndex.find(pEntry)->second;
+    return mpFormatList->GetFormat(nIndex);
+}
+
+void ScCondFormatManagerWindow::Update()
+{
+    Clear();
+    maMapLBoxEntryToCondIndex.clear();
+    Init();
+}
+
+ScCondFormatManagerCtrl::ScCondFormatManagerCtrl(Window* pParent, ScDocument* pDoc, ScConditionalFormatList* pFormatList, const ScAddress& rPos):
+    Control(pParent, ScResId(CTRL_TABLE)),
+    maWdManager(this, pDoc, pFormatList, rPos)
+{
+}
+
+ScConditionalFormat* ScCondFormatManagerCtrl::GetSelection()
+{
+    return maWdManager.GetSelection();
+}
+
+void ScCondFormatManagerCtrl::DeleteSelection()
+{
+    maWdManager.DeleteSelection();
+}
+
+void ScCondFormatManagerCtrl::Update()
+{
+    maWdManager.Update();
+}
+
+ScCondFormatManagerDlg::ScCondFormatManagerDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList, const ScRangeList& rList, const ScAddress& rPos):
+    ModalDialog(pParent, ScResId(RID_SCDLG_COND_FORMAT_MANAGER)),
+    maBtnAdd(this, ScResId(BTN_ADD)),
+    maBtnRemove(this, ScResId(BTN_REMOVE)),
+    maBtnEdit(this, ScResId(BTN_EDIT)),
+    maBtnOk(this, ScResId(BTN_OK)),
+    maBtnCancel(this, ScResId(BTN_CANCEL)),
+    maFlLine(this, ScResId(FL_LINE)),
+    mpFormatList( pFormatList ? new ScConditionalFormatList(*pFormatList) : NULL),
+    maCtrlManager(this, pDoc, mpFormatList, rPos),
+    mpDoc(pDoc),
+    mrRangeList(rList),
+    maPos(rPos)
+{
+    FreeResource();
+
+    maBtnRemove.SetClickHdl(LINK(this, ScCondFormatManagerDlg, RemoveBtnHdl));
+    maBtnEdit.SetClickHdl(LINK(this, ScCondFormatManagerDlg, EditBtnHdl));
+    maBtnAdd.Hide();
+}
+
+ScCondFormatManagerDlg::~ScCondFormatManagerDlg()
+{
+    delete mpFormatList;
+}
+
+ScConditionalFormatList* ScCondFormatManagerDlg::GetConditionalFormatList()
+{
+    ScConditionalFormatList* pList = mpFormatList;
+    mpFormatList = NULL;
+    return pList;
+}
+
+IMPL_LINK_NOARG(ScCondFormatManagerDlg, RemoveBtnHdl)
+{
+    maCtrlManager.DeleteSelection();
+    return 0;
+}
+
+IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnHdl)
+{
+    ScConditionalFormat* pFormat = maCtrlManager.GetSelection();
+
+    if(!pFormat)
+        return 0;
+
+    ScCondFormatDlg* pDlg = new ScCondFormatDlg(this, mpDoc, pFormat, pFormat->GetRange(), maPos);
+    if(pDlg->Execute() == RET_OK)
+    {
+        sal_Int32 nKey = pFormat->GetKey();
+        mpFormatList->erase(nKey);
+        ScConditionalFormat* pNewFormat = pDlg->GetConditionalFormat();
+        pNewFormat->SetKey(nKey);
+        mpFormatList->InsertNew(pNewFormat);
+        maCtrlManager.Update();
+    }
+
+    return 0;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/condformatdlg.hxx b/sc/source/ui/inc/condformatdlg.hxx
index 2794cfd..fba8295 100644
--- a/sc/source/ui/inc/condformatdlg.hxx
+++ b/sc/source/ui/inc/condformatdlg.hxx
@@ -36,6 +36,7 @@
 #include <svtools/ctrlbox.hxx>
 
 #include "rangelst.hxx"
+#include "condformathelper.hxx"
 
 #include <boost/ptr_container/ptr_vector.hpp>
 #include <boost/scoped_ptr.hpp>
@@ -46,15 +47,6 @@ class ScFormatEntry;
 class ScConditionalFormat;
 struct ScDataBarFormatData;
 
-enum ScCondFormatEntryType
-{
-    CONDITION,
-    COLORSCALE,
-    DATABAR,
-    FORMULA,
-    COLLAPSED
-};
-
 class ScCondFrmtEntry : public Control
 {
 private:
diff --git a/sc/source/ui/inc/condformathelper.hxx b/sc/source/ui/inc/condformathelper.hxx
new file mode 100644
index 0000000..99f5b59
--- /dev/null
+++ b/sc/source/ui/inc/condformathelper.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <rtl/ustring.hxx>
+#include "conditio.hxx"
+
+enum ScCondFormatEntryType
+{
+    CONDITION,
+    COLORSCALE,
+    DATABAR,
+    FORMULA,
+    COLLAPSED
+};
+
+class ScCondFormatHelper
+{
+public:
+    static rtl::OUString GetExpression(const ScConditionalFormat& rFormat, const ScAddress& rPos);
+
+    static rtl::OUString GetExpression( ScCondFormatEntryType eType, sal_Int32 nIndex );
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/condformatmgr.hrc b/sc/source/ui/inc/condformatmgr.hrc
new file mode 100644
index 0000000..7fb10c7
--- /dev/null
+++ b/sc/source/ui/inc/condformatmgr.hrc
@@ -0,0 +1,18 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#define BTN_OK 1
+#define BTN_CANCEL 2
+#define BTN_ADD 3
+#define BTN_REMOVE 4
+#define BTN_EDIT 5
+#define FL_LINE 6
+#define CTRL_TABLE 8
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/condformatmgr.hxx b/sc/source/ui/inc/condformatmgr.hxx
new file mode 100644
index 0000000..bf7cfb3
--- /dev/null
+++ b/sc/source/ui/inc/condformatmgr.hxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Markus Mohrhard <markus.mohrhard at googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "sc.hrc"
+
+#include <vcl/dialog.hxx>
+#include <svtools/svtabbx.hxx>
+#include <vcl/button.hxx>
+#include <vcl/fixed.hxx>
+#include <svtools/headbar.hxx>
+
+#include "conditio.hxx"
+#include "rangelst.hxx"
+#include "document.hxx"
+
+#include <map>
+
+class ScDocument;
+
+class ScCondFormatManagerWindow : public SvTabListBox
+{
+private:
+    void Init();
+    String createEntryString(const ScConditionalFormat& rFormat);
+
+    HeaderBar maHeaderBar;
+    ScDocument* mpDoc;
+    ScConditionalFormatList* mpFormatList;
+    const ScAddress& mrPos;
+    std::map<SvLBoxEntry*, sal_Int32> maMapLBoxEntryToCondIndex;
+
+public:
+    ScCondFormatManagerWindow( Window* pParent, ScDocument* pDoc, ScConditionalFormatList* pFormatList, const ScAddress& rPos );
+
+    void DeleteSelection();
+    ScConditionalFormat* GetSelection();
+    void Update();
+};
+
+class ScCondFormatManagerCtrl : Control
+{
+public:
+    ScCondFormatManagerCtrl(Window* pParent, ScDocument* pDoc, ScConditionalFormatList* pFormatList, const ScAddress& rPos);
+
+    ScConditionalFormat* GetSelection();
+    void DeleteSelection();
+    void Update();
+
+private:
+    ScCondFormatManagerWindow maWdManager;
+};
+
+class ScCondFormatManagerDlg : public ModalDialog
+{
+public:
+    ScCondFormatManagerDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList, const ScRangeList& rList, const ScAddress& rPos);
+    ~ScCondFormatManagerDlg();
+
+    ScConditionalFormatList* GetConditionalFormatList();
+
+private:
+    PushButton maBtnAdd;
+    PushButton maBtnRemove;
+    PushButton maBtnEdit;
+
+    OKButton maBtnOk;
+    CancelButton maBtnCancel;
+
+    FixedLine maFlLine;
+
+    ScConditionalFormatList* mpFormatList;
+
+    ScCondFormatManagerCtrl maCtrlManager;
+
+    ScDocument* mpDoc;
+    const ScRangeList& mrRangeList;
+    ScAddress maPos;
+
+    DECL_LINK(RemoveBtnHdl, void*);
+    DECL_LINK(EditBtnHdl, void*);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/src/condformatmgr.src b/sc/source/ui/src/condformatmgr.src
new file mode 100644
index 0000000..9009d21
--- /dev/null
+++ b/sc/source/ui/src/condformatmgr.src
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "sc.hrc"
+#include "condformatmgr.hrc"
+
+ModalDialog RID_SCDLG_COND_FORMAT_MANAGER
+{
+    OutputSize = TRUE;
+    Hide = TRUE;
+    Size = MAP_APPFONT ( 300, 275 );
+    Text [ en-US ] = "Manage Conditional Formatting";
+    Moveable = TRUE;
+    Closeable = TRUE;
+    OkButton BTN_OK
+    {
+        Pos = MAP_APPFONT ( 190, 255 );
+        Size = MAP_APPFONT ( 50, 14 );
+        TabStop = TRUE;
+    };
+    CancelButton BTN_CANCEL
+    {
+        Pos = MAP_APPFONT ( 245, 255 );
+        Size = MAP_APPFONT ( 50, 14 );
+        TabStop = TRUE;
+    };
+    PushButton BTN_ADD
+    {
+        Pos = MAP_APPFONT( 5, 230 );
+        Size = MAP_APPFONT( 40, 14 );
+        Text [ en-US ] = "Add";
+        TabStop = TRUE;
+    };
+    PushButton BTN_REMOVE
+    {
+        Pos = MAP_APPFONT( 95, 230 );
+        Size = MAP_APPFONT( 40, 14 );
+        Text [ en-US ] = "Remove";
+        TabStop = TRUE;
+    };
+    Control CTRL_TABLE
+    {
+        Pos = MAP_APPFONT( 5, 5 );
+        Size = MAP_APPFONT( 290, 220 );
+        Border = TRUE;
+    };
+    PushButton BTN_EDIT
+    {
+        Pos = MAP_APPFONT( 50, 230 );
+        Size = MAP_APPFONT( 40, 14 );
+        Text [ en-US ] = "Edit...";
+    };
+    FixedLine FL_LINE
+    {
+        Pos = MAP_APPFONT( 0, 250 );
+        Size = MAP_APPFONT( 300, 2 );
+    };
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src
index dcc4adb..4b2a4ec 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -1859,5 +1859,9 @@ Resource RID_GLOBSTR
     {
         Text [ en-US ] = "This Document is referenced by another document and not yet saved. Closing it without saving will result in data loss.";
     };
+    String STR_HEADER_COND
+    {
+        Text [ en_US ] = "First Condition";
+    };
 };
 
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 0d20878..14ed86b 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2077,7 +2077,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                 {
                     pDlg = pFact->CreateScCondFormatDlg( pTabViewShell->GetDialogParent(), pDoc, NULL, aRangeList, aPos, RID_SCDLG_CONDFORMAT );
                 }
-                OSL_ENSURE(pDlg, "Dialog create fail!");
+
                 if(pDlg->Execute() == RET_OK)
                 {
                     ScConditionalFormat* pFormat = pDlg->GetConditionalFormat();
@@ -2090,6 +2090,33 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
             }
             break;
 
+        case SID_OPENDLG_CONDFRMT_MANAGER:
+            {
+                ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
+                OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
+
+                ScRangeList aRangeList;
+                ScViewData* pData = GetViewData();
+                pData->GetMarkData().FillRangeListWithMarks(&aRangeList, false);
+                ScDocument* pDoc = pData->GetDocument();
+
+                ScAddress aPos(pData->GetCurX(), pData->GetCurY(), pData->GetTabNo());
+                if(aRangeList.empty())
+                {
+                    ScRange* pRange = new ScRange(aPos);
+                    aRangeList.push_back(pRange);
+                }
+
+                ScConditionalFormatList* pList = pDoc->GetCondFormList( aPos.Tab() );
+                AbstractScCondFormatManagerDlg* pDlg = pFact->CreateScCondFormatMgrDlg( pTabViewShell->GetDialogParent(), pDoc, pList, aRangeList, aPos, RID_SCDLG_COND_FORMAT_MANAGER);
+                if(pDlg->Execute() == RET_OK)
+                {
+                    pDoc->SetCondFormList(pDlg->GetConditionalFormatList(), aPos.Tab());
+                }
+                delete pDlg;
+            }
+            break;
+
         case SID_COLORSCALE:
             {
                 ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
diff --git a/sc/uiconfig/scalc/menubar/menubar.xml b/sc/uiconfig/scalc/menubar/menubar.xml
index af9f701..ab14b65 100644
--- a/sc/uiconfig/scalc/menubar/menubar.xml
+++ b/sc/uiconfig/scalc/menubar/menubar.xml
@@ -260,10 +260,12 @@
             <menu:menuitem menu:id=".uno:DesignerDialog"/>
             <menu:menuitem menu:id=".uno:AutoFormat"/>
             <menu:menu menu:id=".uno:ConditionalFormatMenu">
-	          <menu:menupopup>
-	            <menu:menuitem menu:id=".uno:ConditionalFormatDialog"/>
-	          </menu:menupopup>
-	        </menu:menu>
+              <menu:menupopup>
+                <menu:menuitem menu:id=".uno:ConditionalFormatDialog"/>
+                <menu:menuseparator/>
+                <menu:menuitem menu:id=".uno:ConditionalFormatManagerDialog"/>
+              </menu:menupopup>
+            </menu:menu>
             <menu:menuseparator/>
             <menu:menu menu:id=".uno:AnchorMenu">
                 <menu:menupopup>


More information about the Libreoffice-commits mailing list