[Libreoffice-commits] core.git: 2 commits - sc/source

Markus Mohrhard markus.mohrhard at googlemail.com
Fri Jun 28 20:48:46 PDT 2013


 sc/source/ui/condformat/condformatdlgentry.cxx |   59 ++++++++++++++++++++++++-
 sc/source/ui/inc/condformatdlgentry.hxx        |   14 +++++
 2 files changed, 69 insertions(+), 4 deletions(-)

New commits:
commit def32c7e14ad9743e2b55804442be5d596f6c21c
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Jun 29 05:38:37 2013 +0200

    hide the style boxes to collapse the date entries fully
    
    Change-Id: I58f06a57a05ef007afc203c737acfe29df6ea6a3

diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx
index e0f78a5..2fb93e0 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -1258,6 +1258,7 @@ void ScDateFrmtEntry::SetActive()
     maLbDateEntry.Show();
     maFtStyle.Show();
     maWdPreview.Show();
+    maLbStyle.Show();
 
     Select();
 }
@@ -1267,6 +1268,7 @@ void ScDateFrmtEntry::SetInactive()
     maLbDateEntry.Hide();
     maFtStyle.Hide();
     maWdPreview.Hide();
+    maLbStyle.Hide();
 
     Deselect();
 }
commit aa028cab4a72660c773a9eac0cd8a19a0d655c01
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Jun 29 05:16:14 2013 +0200

    update all style lists when a new style is added
    
    Change-Id: Ib404958e2bc0e3bfe075d1c94f348e907ee004c8

diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx
index 46feaa8..e0f78a5 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -167,7 +167,8 @@ ScConditionFrmtEntry::ScConditionFrmtEntry( Window* pParent, ScDocument* pDoc, c
     maEdVal2( this, NULL, NULL, ScResId( ED_VAL2 ) ),
     maFtStyle( this, ScResId( FT_STYLE ) ),
     maLbStyle( this, ScResId( LB_STYLE ) ),
-    maWdPreview( this, ScResId( WD_PREVIEW ) )
+    maWdPreview( this, ScResId( WD_PREVIEW ) ),
+    mbIsInStyleCreate(false)
 {
 
     FreeResource();
@@ -175,6 +176,8 @@ ScConditionFrmtEntry::ScConditionFrmtEntry( Window* pParent, ScDocument* pDoc, c
 
     Init();
 
+    StartListening(*pDoc->GetStyleSheetPool(), true);
+
     if(pFormatEntry)
     {
         OUString aStyleName = pFormatEntry->GetStyle();
@@ -436,6 +439,35 @@ void ScConditionFrmtEntry::SetInactive()
 
 namespace {
 
+void UpdateStyleList(ListBox& rLbStyle, ScDocument* pDoc)
+{
+    OUString aSelectedStyle = rLbStyle.GetSelectEntry();
+    for(sal_Int32 i = rLbStyle.GetEntryCount(); i >= 1; --i)
+    {
+        rLbStyle.RemoveEntry(i);
+    }
+    FillStyleListBox(pDoc, rLbStyle);
+    rLbStyle.SelectEntry(aSelectedStyle);
+}
+
+}
+
+void ScConditionFrmtEntry::Notify(SfxBroadcaster&, const SfxHint& rHint)
+{
+    SfxStyleSheetHint* pHint = PTR_CAST(SfxStyleSheetHint, &rHint);
+    if(!pHint)
+        return;
+
+    sal_uInt16 nHint = pHint->GetHint();
+    if(nHint == SFX_STYLESHEET_MODIFIED)
+    {
+        if(!mbIsInStyleCreate)
+            UpdateStyleList(maLbStyle, mpDoc);
+    }
+}
+
+namespace {
+
 void StyleSelect( ListBox& rLbStyle, ScDocument* pDoc, SvxFontPrevWindow& rWdPreview )
 {
     if(rLbStyle.GetSelectEntryPos() == 0)
@@ -503,7 +535,9 @@ void StyleSelect( ListBox& rLbStyle, ScDocument* pDoc, SvxFontPrevWindow& rWdPre
 
 IMPL_LINK_NOARG(ScConditionFrmtEntry, StyleSelectHdl)
 {
+    mbIsInStyleCreate = true;
     StyleSelect( maLbStyle, mpDoc, maWdPreview );
+    mbIsInStyleCreate = false;
     return 0;
 }
 
@@ -1189,11 +1223,14 @@ ScDateFrmtEntry::ScDateFrmtEntry( Window* pParent, ScDocument* pDoc, const ScCon
     maLbDateEntry( this, ScResId( LB_DATE_TYPE ) ),
     maFtStyle( this, ScResId( FT_STYLE ) ),
     maLbStyle( this, ScResId( LB_STYLE ) ),
-    maWdPreview( this, ScResId( WD_PREVIEW ) )
+    maWdPreview( this, ScResId( WD_PREVIEW ) ),
+    mbIsInStyleCreate(false)
 {
     Init();
     FreeResource();
 
+    StartListening(*pDoc->GetStyleSheetPool(), sal_True);
+
     if(pFormat)
     {
         sal_Int32 nPos = static_cast<sal_Int32>(pFormat->GetDateType());
@@ -1234,6 +1271,20 @@ void ScDateFrmtEntry::SetInactive()
     Deselect();
 }
 
+void ScDateFrmtEntry::Notify( SfxBroadcaster&, const SfxHint& rHint )
+{
+    SfxStyleSheetHint* pHint = PTR_CAST(SfxStyleSheetHint, &rHint);
+    if(!pHint)
+        return;
+
+    sal_uInt16 nHint = pHint->GetHint();
+    if(nHint == SFX_STYLESHEET_MODIFIED)
+    {
+        if(!mbIsInStyleCreate)
+            UpdateStyleList(maLbStyle, mpDoc);
+    }
+}
+
 ScFormatEntry* ScDateFrmtEntry::GetEntry() const
 {
     ScCondDateFormatEntry* pNewEntry = new ScCondDateFormatEntry(mpDoc);
@@ -1250,7 +1301,9 @@ OUString ScDateFrmtEntry::GetExpressionString()
 
 IMPL_LINK_NOARG( ScDateFrmtEntry, StyleSelectHdl )
 {
+    mbIsInStyleCreate = true;
     StyleSelect( maLbStyle, mpDoc, maWdPreview );
+    mbIsInStyleCreate = false;
 
     return 0;
 }
diff --git a/sc/source/ui/inc/condformatdlgentry.hxx b/sc/source/ui/inc/condformatdlgentry.hxx
index 7727d28..77054ab 100644
--- a/sc/source/ui/inc/condformatdlgentry.hxx
+++ b/sc/source/ui/inc/condformatdlgentry.hxx
@@ -11,6 +11,8 @@
 #include "conditio.hxx"
 #include <formula/funcutl.hxx>
 
+#include <svl/lstner.hxx>
+
 class ScIconSetFrmtDataEntry;
 
 namespace condformat {
@@ -76,7 +78,7 @@ public:
     virtual condformat::entry::ScCondFrmtEntryType GetType() = 0;
 };
 
-class ScConditionFrmtEntry : public ScCondFrmtEntry
+class ScConditionFrmtEntry : public ScCondFrmtEntry, public SfxListener
 {
     //cond format ui elements
     ListBox maLbCondType;
@@ -85,6 +87,7 @@ class ScConditionFrmtEntry : public ScCondFrmtEntry
     FixedText maFtStyle;
     ListBox maLbStyle;
     SvxFontPrevWindow maWdPreview;
+    bool mbIsInStyleCreate;
 
     ScFormatEntry* createConditionEntry() const;
 
@@ -100,6 +103,9 @@ public:
     virtual void SetActive();
     virtual void SetInactive();
 
+    virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+    using ScCondFrmtEntry::Notify;
+
     virtual condformat::entry::ScCondFrmtEntryType GetType() { return condformat::entry::CONDITION; }
 };
 
@@ -219,7 +225,7 @@ public:
     virtual condformat::entry::ScCondFrmtEntryType GetType() { return condformat::entry::DATABAR; }
 };
 
-class ScDateFrmtEntry : public ScCondFrmtEntry
+class ScDateFrmtEntry : public ScCondFrmtEntry, public SfxListener
 {
 public:
     ScDateFrmtEntry( Window* pParent, ScDocument* pDoc, const ScCondDateFormatEntry* pFormat = NULL );
@@ -228,6 +234,8 @@ public:
     virtual void SetInactive();
     virtual condformat::entry::ScCondFrmtEntryType GetType() { return condformat::entry::DATE; }
 
+    virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+    using ScCondFrmtEntry::Notify;
 protected:
     virtual OUString GetExpressionString();
 
@@ -240,6 +248,8 @@ private:
     FixedText maFtStyle;
     ListBox maLbStyle;
     SvxFontPrevWindow maWdPreview;
+
+    bool mbIsInStyleCreate;
 };
 
 class ScIconSetFrmtEntry : public ScCondFrmtEntry


More information about the Libreoffice-commits mailing list