[Libreoffice-commits] .: 4 commits - sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Dec 3 09:55:24 PST 2012


 sc/source/ui/condformat/condformatdlg.cxx |   30 -------------------------
 sc/source/ui/condformat/condformatmgr.cxx |   35 +++++++++++++++++++-----------
 sc/source/ui/inc/condformatdlg.hxx        |    6 -----
 sc/source/ui/view/cellsh1.cxx             |   20 ++++++++++++-----
 4 files changed, 39 insertions(+), 52 deletions(-)

New commits:
commit 0ec762f00cf5dfbbbd73b55059ac832cc251c73b
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Dec 3 18:48:44 2012 +0100

    make the Add and the Edit button work again
    
    Change-Id: I956ff1fce8f897553c8a16d45e0bfdd529b9fd66

diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx
index b8fb972..295a83e 100644
--- a/sc/source/ui/condformat/condformatmgr.cxx
+++ b/sc/source/ui/condformat/condformatmgr.cxx
@@ -183,9 +183,6 @@ ScCondFormatManagerDlg::ScCondFormatManagerDlg(Window* pParent, ScDocument* pDoc
     maBtnEdit.SetClickHdl(LINK(this, ScCondFormatManagerDlg, EditBtnHdl));
     maBtnAdd.SetClickHdl(LINK(this, ScCondFormatManagerDlg, AddBtnHdl));
     maCtrlManager.GetListControl().SetDoubleClickHdl(LINK(this, ScCondFormatManagerDlg, EditBtnHdl));
-
-    maBtnAdd.Disable();
-    maBtnEdit.Disable();
 }
 
 ScCondFormatManagerDlg::~ScCondFormatManagerDlg()
@@ -224,21 +221,29 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnHdl)
     if(!pFormat)
         return 0;
 
-    boost::scoped_ptr<ScCondFormatDlg> pDlg;//(new ScCondFormatDlg(this, mpDoc, pFormat, pFormat->GetRange(),
-                                              //  pFormat->GetRange().GetTopLeftCorner(), condformat::dialog::NONE));
-    /*
+    sal_uInt16 nId = 1;
+    ScModule* pScMod = SC_MOD();
+    pScMod->SetRefDialog( nId, true );
+    boost::scoped_ptr<ScCondFormatDlg> pDlg(new ScCondFormatDlg(this, mpDoc, pFormat, pFormat->GetRange(),
+                                               pFormat->GetRange().GetTopLeftCorner(), condformat::dialog::NONE));
+    Disable();
     if(pDlg->Execute() == RET_OK)
     {
         sal_Int32 nKey = pFormat->GetKey();
         mpFormatList->erase(nKey);
         ScConditionalFormat* pNewFormat = pDlg->GetConditionalFormat();
-        pNewFormat->SetKey(nKey);
-        mpFormatList->InsertNew(pNewFormat);
+        if(pNewFormat)
+        {
+            pNewFormat->SetKey(nKey);
+            mpFormatList->InsertNew(pNewFormat);
+        }
+
         maCtrlManager.Update();
+        mbModified = true;
     }
-    */
+    Enable();
 
-    mbModified = true;
+    pScMod->SetRefDialog( nId, false );
 
     return 0;
 }
@@ -262,8 +267,12 @@ sal_uInt32 FindKey(ScConditionalFormatList* pFormatList)
 
 IMPL_LINK_NOARG(ScCondFormatManagerDlg, AddBtnHdl)
 {
-    boost::scoped_ptr<ScCondFormatDlg> pDlg;//(new ScCondFormatDlg(this, mpDoc, NULL, ScRangeList(),
-                                              //  maPos, condformat::dialog::CONDITION));
+    sal_uInt16 nId = 1;
+    ScModule* pScMod = SC_MOD();
+    pScMod->SetRefDialog( nId, true );
+    boost::scoped_ptr<ScCondFormatDlg> pDlg(new ScCondFormatDlg(this, mpDoc, NULL, ScRangeList(),
+                                               maPos, condformat::dialog::CONDITION));
+    Disable();
     if(pDlg->Execute() == RET_OK)
     {
         ScConditionalFormat* pNewFormat = pDlg->GetConditionalFormat();
@@ -276,6 +285,8 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, AddBtnHdl)
 
         mbModified = true;
     }
+    Enable();
+    pScMod->SetRefDialog( nId, false );
 
     return 0;
 }
diff --git a/sc/source/ui/inc/condformatdlg.hxx b/sc/source/ui/inc/condformatdlg.hxx
index ce270e1..588d04d 100644
--- a/sc/source/ui/inc/condformatdlg.hxx
+++ b/sc/source/ui/inc/condformatdlg.hxx
@@ -125,7 +125,7 @@ protected:
 
 
 public:
-    ScCondFormatDlg(Window* pWindow, ScDocument* pDoc, const ScConditionalFormat* pFormat,
+    SC_DLLPUBLIC ScCondFormatDlg(Window* pWindow, ScDocument* pDoc, const ScConditionalFormat* pFormat,
             const ScRangeList& rRange, const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType);
     virtual ~ScCondFormatDlg();
 
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index d7fa1ac..d7816ea 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -1771,7 +1771,6 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
         case SID_OPENDLG_DATABAR:
             {
                 sal_uInt16 nId = 1;
-
                 pScMod->SetRefDialog( nId, true );
 
                 ScRangeList aRangeList;
commit 302bdaf2f4e3dac8c719ab0f51624209fb81ac28
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Dec 3 17:22:36 2012 +0100

    use the new possibility as modal dialog
    
    Change-Id: I407740279d8b0e48b7b934655deb590b3abf5aa9

diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx
index 78214aa..15ffd57 100644
--- a/sc/source/ui/condformat/condformatdlg.cxx
+++ b/sc/source/ui/condformat/condformatdlg.cxx
@@ -381,8 +381,6 @@ ScCondFormatDlg::ScCondFormatDlg(Window* pParent, ScDocument* pDoc, const ScCond
     maBtnAdd.SetClickHdl( LINK( &maCondFormList, ScCondFormatList, AddBtnHdl ) );
     maBtnRemove.SetClickHdl( LINK( &maCondFormList, ScCondFormatList, RemoveBtnHdl ) );
     maEdRange.SetModifyHdl( LINK( this, ScCondFormatDlg, EdRangeModifyHdl ) );
-    maBtnOk.SetClickHdl( LINK( this, ScCondFormatDlg, OkBtnHdl ) );
-    maBtnCancel.SetClickHdl( LINK( this, ScCondFormatDlg, CancelBtnHdl ) );
     maEdRange.SetGetFocusHdl( LINK( this, ScCondFormatDlg, RangeGetFocusHdl ) );
     maEdRange.SetLoseFocusHdl( LINK( this, ScCondFormatDlg, RangeLoseFocusHdl ) );
     FreeResource();
@@ -484,34 +482,6 @@ IMPL_LINK( ScCondFormatDlg, EdRangeModifyHdl, Edit*, pEdit )
     return 0;
 }
 
-sal_Bool ScCondFormatDlg::Close()
-{
-    sal_uInt16 nId = 1;
-    EndDialog();
-    return DoClose(nId);
-}
-
-IMPL_LINK_NOARG( ScCondFormatDlg, OkBtnHdl )
-{
-    ScConditionalFormat* pFormat = GetConditionalFormat();
-    SfxObjectShell* pObjectShell = mpDoc->GetDocumentShell();
-    sal_Int32 nKey = 0;
-    if(mpFormat)
-        nKey = mpFormat->GetKey();
-
-    static_cast<ScDocShell*>(pObjectShell)->GetDocFunc().ReplaceConditionalFormat(nKey, pFormat, maPos.Tab(), pFormat->GetRange());
-
-    Close();
-    return 0;
-}
-
-IMPL_LINK_NOARG( ScCondFormatDlg, CancelBtnHdl )
-{
-    Close();
-
-    return 0;
-}
-
 IMPL_LINK( ScCondFormatDlg, RangeGetFocusHdl, formula::RefEdit*, pEdit )
 {
     mpLastEdit = pEdit;
diff --git a/sc/source/ui/inc/condformatdlg.hxx b/sc/source/ui/inc/condformatdlg.hxx
index f5c3e25..ce270e1 100644
--- a/sc/source/ui/inc/condformatdlg.hxx
+++ b/sc/source/ui/inc/condformatdlg.hxx
@@ -119,10 +119,6 @@ private:
     condformat::dialog::ScCondFormatDialogType meType;
 
     DECL_LINK( EdRangeModifyHdl, Edit* );
-    DECL_LINK( OkBtnHdl, void* );
-    DECL_LINK( CancelBtnHdl, void* );
-
-    virtual sal_Bool Close();
 protected:
 
     virtual void RefInputDone( sal_Bool bForced = false );
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index ccbf388..d7fa1ac 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -1792,13 +1792,17 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                     aRangeList.push_back(pRange);
                 }
 
+                sal_Int32 nKey = 0;
                 const ScConditionalFormat* pCondFormat = pDoc->GetCondFormat(aPos.Col(), aPos.Row(), aPos.Tab());
-                ScCondFormatDlg* pCondFormatDlg = NULL;
+                boost::scoped_ptr<ScCondFormatDlg> pCondFormatDlg;
                 if(pCondFormat)
                 {
                     const ScRangeList& rCondFormatRange = pCondFormat->GetRange();
                     if(rCondFormatRange == aRangeList)
-                        pCondFormatDlg = new ScCondFormatDlg( pTabViewShell->GetDialogParent(), pDoc, pCondFormat, rCondFormatRange, aPos, condformat::dialog::NONE );
+                    {
+                        nKey = pCondFormat->GetKey();
+                        pCondFormatDlg.reset( new ScCondFormatDlg( pTabViewShell->GetDialogParent(), pDoc, pCondFormat, rCondFormatRange, aPos, condformat::dialog::NONE ) );
+                    }
                 }
 
                 if(!pCondFormatDlg)
@@ -1818,9 +1822,13 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                         default:
                             break;
                     }
-                    pCondFormatDlg = new ScCondFormatDlg( pTabViewShell->GetDialogParent(), pDoc, NULL, aRangeList, aRangeList.GetTopLeftCorner(), eType );
+                    pCondFormatDlg.reset( new ScCondFormatDlg( pTabViewShell->GetDialogParent(), pDoc, NULL, aRangeList, aRangeList.GetTopLeftCorner(), eType ) );
+                }
+                if( pCondFormatDlg->Execute() == RET_OK )
+                {
+                    ScConditionalFormat* pFormat = pCondFormatDlg->GetConditionalFormat();
+                    pData->GetDocShell()->GetDocFunc().ReplaceConditionalFormat(nKey, pFormat, aPos.Tab(), pFormat->GetRange());
                 }
-                pCondFormatDlg->Execute();
 
                 pScMod->SetRefDialog( nId, false );
 
commit df46e7452db180f2db2f786951ec1b0816454558
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Dec 3 17:21:22 2012 +0100

    forgot to remove the ref mode after closing the dialog
    
    Change-Id: I3c0079fbbd5f763497549c5cf9dcd36c6b20ac77

diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index d8c03fd..ccbf388 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -1822,6 +1822,9 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                 }
                 pCondFormatDlg->Execute();
 
+                pScMod->SetRefDialog( nId, false );
+
+
             }
             break;
 
commit be80b108daa0aa1db78b70c9c477d652b11d14a0
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Dec 3 16:36:47 2012 +0100

    should call Execute in the right place
    
    Change-Id: I4a4b6047aed045349b24a3af70b739df7f93dc60

diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index e8122b3..d8c03fd 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -1819,8 +1819,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                             break;
                     }
                     pCondFormatDlg = new ScCondFormatDlg( pTabViewShell->GetDialogParent(), pDoc, NULL, aRangeList, aRangeList.GetTopLeftCorner(), eType );
-                    pCondFormatDlg->Execute();
                 }
+                pCondFormatDlg->Execute();
 
             }
             break;


More information about the Libreoffice-commits mailing list