[Libreoffice-commits] core.git: sc/inc sc/source sc/uiconfig sc/UIConfig_scalc.mk

Albert Thuswaldner albert.thuswaldner at gmail.com
Mon Apr 15 03:44:55 PDT 2013


 sc/UIConfig_scalc.mk                |    1 
 sc/inc/sc.hrc                       |    1 
 sc/inc/scabstdlg.hxx                |    8 +-
 sc/source/ui/attrdlg/scdlgfact.cxx  |   20 +----
 sc/source/ui/attrdlg/scdlgfact.hxx  |    9 ++
 sc/source/ui/dbgui/sortdlg.cxx      |   25 +++----
 sc/source/ui/inc/sortdlg.hrc        |    7 -
 sc/source/ui/inc/sortdlg.hxx        |    8 --
 sc/source/ui/src/sortdlg.src        |   48 -------------
 sc/source/ui/view/cellsh2.cxx       |    2 
 sc/uiconfig/scalc/ui/sortwarning.ui |  127 ++++++++++++++++++++++++++++++++++++
 11 files changed, 162 insertions(+), 94 deletions(-)

New commits:
commit db8b11b876ed26fb70cf90f86337395dd2e78f64
Author: Albert Thuswaldner <albert.thuswaldner at gmail.com>
Date:   Sun Apr 14 12:41:42 2013 +0200

    Calc: converted sort warning dialog to .ui
    
    Change-Id: I2bc44990efb62183507f46b22bfd8e09edf02eb6
    Reviewed-on: https://gerrit.libreoffice.org/3380
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index fe4e049..3d3c47f 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -75,6 +75,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
 	sc/uiconfig/scalc/ui/sortcriteriapage \
 	sc/uiconfig/scalc/ui/sortkey \
 	sc/uiconfig/scalc/ui/sortoptionspage \
+	sc/uiconfig/scalc/ui/sortwarning \
 	sc/uiconfig/scalc/ui/textimportoptions \
 	sc/uiconfig/scalc/ui/textimportcsv \
 ))
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index b0bfb20..7e88881 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -1080,7 +1080,6 @@
 
 #define RID_SCDLG_CONFLICTS             (SC_DIALOGS_START + 145)
 #define RID_SCDLG_SHAREDOCUMENT         (SC_DIALOGS_START + 146)
-#define RID_SCDLG_SORT_WARNING          (SC_DIALOGS_START + 147)
 #define RID_SCDLG_TABPROTECTION         (SC_DIALOGS_START + 148)
 #define RID_SCDLG_RETYPEPASS            (SC_DIALOGS_START + 150)
 #define RID_SCDLG_RETYPEPASS_INPUT      (SC_DIALOGS_START + 151)
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 4e9ffaa..2e80c1c 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -46,6 +46,7 @@ class SfxStyleSheetBase;
 class ScDPObject;
 struct ScPivotFuncData;
 struct ScDPNumGroupInfo;
+class ScSortWarningDlg;
 class ScTabViewShell;
 class ScConditionalFormat;
 class ScConditionalFormatList;
@@ -293,6 +294,10 @@ public:
     virtual sal_uInt16  GetSelectEntryPos(sal_uInt16 nPos) const = 0;
 };
 
+class AbstractScSortWarningDlg : public VclAbstractDialog  //add for ScSortWarningDlg
+{
+};
+
 class AbstractScStringInputDlg :  public VclAbstractDialog  //add for ScStringInputDlg
 {
 public:
@@ -345,7 +350,8 @@ public:
                                                     const String&   rStrLabel,
                                                     int nId,
                                                     sal_Bool                bColDefault = sal_True ) = 0;
-    virtual VclAbstractDialog * CreateScSortWarningDlg ( Window* pParent, const String& rExtendText, const String& rCurrentText, int nId ) = 0;  //add for ScSortWarningDlg
+
+    virtual AbstractScSortWarningDlg * CreateScSortWarningDlg(Window* pParent, const String& rExtendText, const String& rCurrentText ) = 0; //add for ScSortWarningDlg
 
     virtual AbstractScCondFormatManagerDlg* CreateScCondFormatMgrDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList,
                                                                 const ScAddress& rPos, int nId ) = 0;
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index acf411b..1283a3b 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -109,6 +109,7 @@ IMPL_ABSTDLG_BASE(AbstractScDPDateGroupDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScDPShowDetailDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScNewScenarioDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScShowTabDlg_Impl);
+IMPL_ABSTDLG_BASE(AbstractScSortWarningDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScStringInputDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScTabBgColorDlg_Impl);
 IMPL_ABSTDLG_BASE(AbstractScImportOptionsDlg_Impl);
@@ -729,23 +730,10 @@ VclAbstractDialog *  ScAbstractDialogFactory_Impl::CreateScColOrRowDlg(Window*
     return 0;
 }
 
-
-
-VclAbstractDialog * ScAbstractDialogFactory_Impl::CreateScSortWarningDlg( Window* pParent, const String& rExtendText,
-                                                                          const String& rCurrentText, int nId )
+AbstractScSortWarningDlg* ScAbstractDialogFactory_Impl::CreateScSortWarningDlg( Window* pParent, const String& rExtendText, const String& rCurrentText )
 {
-    Dialog * pDlg=NULL;
-    switch ( nId )
-    {
-    case RID_SCDLG_SORT_WARNING:
-        pDlg = new ScSortWarningDlg( pParent, rExtendText, rCurrentText );
-        break;
-    default:
-        break;
-    }
-    if( pDlg )
-        return new ScVclAbstractDialog_Impl( pDlg );
-    return 0;
+    ScSortWarningDlg* pDlg = new ScSortWarningDlg(pParent, rExtendText, rCurrentText );
+    return new AbstractScSortWarningDlg_Impl( pDlg );
 }
 
 
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index d4ea5ef..14c263f 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -47,6 +47,7 @@ class ScDPSubtotalDlg;
 class ScDPNumGroupDlg;
 class ScDPDateGroupDlg;
 class ScDPShowDetailDlg;
+class ScSortWarningDlg;
 class ScNewScenarioDlg;
 class ScShowTabDlg;
 class ScStringInputDlg;
@@ -343,6 +344,12 @@ class AbstractScShowTabDlg_Impl : public AbstractScShowTabDlg  //add for ScShowT
     virtual sal_uInt16  GetSelectEntryPos(sal_uInt16 nPos) const;
 };
 
+class AbstractScSortWarningDlg_Impl : public AbstractScSortWarningDlg
+{
+    DECL_ABSTDLG_BASE( AbstractScSortWarningDlg_Impl, ScSortWarningDlg )
+};
+
+
 class AbstractScStringInputDlg_Impl :  public AbstractScStringInputDlg  //add for ScStringInputDlg
 {
     DECL_ABSTDLG_BASE( AbstractScStringInputDlg_Impl, ScStringInputDlg )
@@ -412,7 +419,7 @@ public:
                                                     int nId,
                                                     sal_Bool                bColDefault = sal_True );
 
-    virtual VclAbstractDialog * CreateScSortWarningDlg( Window* pParent, const String& rExtendText, const String& rCurrentText, int nId );
+    virtual AbstractScSortWarningDlg * CreateScSortWarningDlg(Window* pParent, const String& rExtendText, const String& rCurrentText );
 
     virtual AbstractScCondFormatManagerDlg* CreateScCondFormatMgrDlg(Window* pParent, ScDocument* pDoc, const ScConditionalFormatList* pFormatList,
                                                                 const ScAddress& rPos, int nId );
diff --git a/sc/source/ui/dbgui/sortdlg.cxx b/sc/source/ui/dbgui/sortdlg.cxx
index 171a785..d096e4e 100644
--- a/sc/source/ui/dbgui/sortdlg.cxx
+++ b/sc/source/ui/dbgui/sortdlg.cxx
@@ -48,22 +48,19 @@ ScSortDlg::~ScSortDlg()
 ScSortWarningDlg::ScSortWarningDlg( Window* pParent,
                                    const String& rExtendText,
                                    const String& rCurrentText ):
-        ModalDialog     ( pParent, ScResId( RID_SCDLG_SORT_WARNING ) ),
-        aFtText         ( this, ScResId( FT_TEXT ) ),
-        aFtTip          ( this, ScResId( FT_TIP ) ),
-        aBtnExtSort     ( this, ScResId( BTN_EXTSORT ) ),
-        aBtnCurSort     ( this, ScResId( BTN_CURSORT ) ),
-        aBtnCancel      ( this, ScResId( BTN_CANCEL ) )
+    ModalDialog     ( pParent, "SortWarning", "modules/scalc/ui/sortwarning.ui" )
 {
-    String sTextName = aFtText.GetText();
+    get(aFtText, "sorttext" );
+    get( aBtnExtSort, "extend" );
+    get( aBtnCurSort, "current" );
+
+    String sTextName = aFtText->GetText();
     sTextName.SearchAndReplaceAscii("%1", rExtendText);
     sTextName.SearchAndReplaceAscii("%2", rCurrentText);
-    aFtText.SetText( sTextName );
-
-    aBtnExtSort .SetClickHdl( LINK( this, ScSortWarningDlg, BtnHdl ) );
-    aBtnCurSort .SetClickHdl( LINK( this, ScSortWarningDlg, BtnHdl ) );
+    aFtText->SetText( sTextName );
 
-    FreeResource();
+    aBtnExtSort->SetClickHdl( LINK( this, ScSortWarningDlg, BtnHdl ) );
+    aBtnCurSort->SetClickHdl( LINK( this, ScSortWarningDlg, BtnHdl ) );
 }
 
 ScSortWarningDlg::~ScSortWarningDlg()
@@ -72,11 +69,11 @@ ScSortWarningDlg::~ScSortWarningDlg()
 
 IMPL_LINK( ScSortWarningDlg, BtnHdl, PushButton*, pBtn )
 {
-    if ( pBtn == &aBtnExtSort )
+    if ( pBtn == aBtnExtSort )
     {
         EndDialog( BTN_EXTEND_RANGE );
     }
-    else if( pBtn == &aBtnCurSort )
+    else if( pBtn == aBtnCurSort )
     {
         EndDialog( BTN_CURRENT_SELECTION );
     }
diff --git a/sc/source/ui/inc/sortdlg.hrc b/sc/source/ui/inc/sortdlg.hrc
index 15e5de6..d97022f 100644
--- a/sc/source/ui/inc/sortdlg.hrc
+++ b/sc/source/ui/inc/sortdlg.hrc
@@ -20,7 +20,6 @@
 
 #include "sc.hrc"   // -> RID_SCDLG_SORT
                     // -> RID_SCPAGE_SORT_FIELDS
-                    // -> RID_SCDLG_SORT_WARNING
                     // -> SCSTR_NONAME
                     // -> SCSTR_UNDEFINED
                     // -> SCSTR_FIELD
@@ -33,10 +32,4 @@
 #define WIN_MANAGESORTKEY   2
 #define SB_SORT             3
 
-#define FT_TEXT             1
-#define FT_TIP              2
-#define BTN_EXTSORT         3
-#define BTN_CURSORT         4
-#define BTN_CANCEL          5
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/sortdlg.hxx b/sc/source/ui/inc/sortdlg.hxx
index d38e51c..1023e7c 100644
--- a/sc/source/ui/inc/sortdlg.hxx
+++ b/sc/source/ui/inc/sortdlg.hxx
@@ -56,11 +56,9 @@ public:
             ~ScSortWarningDlg();
     DECL_LINK( BtnHdl, PushButton* );
 private:
-    FixedText       aFtText;
-    FixedText       aFtTip;
-    PushButton      aBtnExtSort;
-    PushButton      aBtnCurSort;
-    CancelButton    aBtnCancel;
+    FixedText*       aFtText;
+    PushButton*      aBtnExtSort;
+    PushButton*      aBtnCurSort;
 };
 
 #endif // SC_SORTDLG_HXX
diff --git a/sc/source/ui/src/sortdlg.src b/sc/source/ui/src/sortdlg.src
index 6dc6eb6..cf8e351 100644
--- a/sc/source/ui/src/sortdlg.src
+++ b/sc/source/ui/src/sortdlg.src
@@ -74,52 +74,4 @@ TabDialog RID_SCDLG_SORT
     };
 };
 
-ModalDialog RID_SCDLG_SORT_WARNING
-{
-    HelpID = "sc:ModalDialog:RID_SCDLG_SORT_WARNING";
-    OutputSize = TRUE ;
-    SVLook = TRUE ;
-    Size = MAP_APPFONT ( 180 , 91 ) ;
-    Text [ en-US ] = "Sort Range" ;
-    Moveable = TRUE ;
-    Closeable = FALSE ;
-    FixedText FT_TEXT
-    {
-        Pos = MAP_APPFONT ( 8 , 3 ) ;
-        Size = MAP_APPFONT ( 170 , 33 ) ;
-        WordBreak = TRUE;
-        Text [ en-US ] = "The cells next to the current selection also contain data. Do you want to extend the sort range to %1, or sort the currently selected range, %2?";
-    };
-    FixedText FT_TIP
-    {
-        Pos = MAP_APPFONT ( 8 , 55 ) ;
-        Size = MAP_APPFONT ( 170 , 33 ) ;
-        WordBreak = TRUE ;
-        Text [ en-US ] = "Tip: The sort range can be detected automatically. Place the cell cursor inside a list and execute sort. The whole range of neighboring non-empty cells will then be sorted.";
-    };
-    PushButton BTN_EXTSORT
-    {
-        HelpID = "sc:PushButton:RID_SCDLG_SORT_WARNING:BTN_EXTSORT";
-        Pos = MAP_APPFONT ( 6 , 39 ) ;
-        Size = MAP_APPFONT ( 60 , 14 ) ;
-        TabStop = TRUE ;
-        DefButton = TRUE ;
-        Text [ en-US ] = "Extend selection";
-    };
-    PushButton BTN_CURSORT
-    {
-        HelpID = "sc:PushButton:RID_SCDLG_SORT_WARNING:BTN_CURSORT";
-        Pos = MAP_APPFONT ( 70 , 39 ) ;
-        Size = MAP_APPFONT ( 60 , 14 ) ;
-        TabStop = TRUE ;
-        Text [ en-US ] = "Current selection";
-    };
-    CancelButton BTN_CANCEL
-    {
-        Pos = MAP_APPFONT ( 134 , 39 ) ;
-        Size = MAP_APPFONT ( 40 , 14 ) ;
-        TabStop = TRUE ;
-    };
-};
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 8f30e18..3989261 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -150,7 +150,7 @@ static sal_Bool lcl_GetSortParam( const ScViewData* pData, ScSortParam& rSortPar
         ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
         OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
 
-        VclAbstractDialog* pWarningDlg = pFact->CreateScSortWarningDlg( pTabViewShell->GetDialogParent(),aExtendStr,aCurrentStr,RID_SCDLG_SORT_WARNING );
+        AbstractScSortWarningDlg* pWarningDlg = pFact->CreateScSortWarningDlg( pTabViewShell->GetDialogParent(), aExtendStr, aCurrentStr );
         OSL_ENSURE(pWarningDlg, "Dialog create fail!");
         short bResult = pWarningDlg->Execute();
         if( bResult == BTN_EXTEND_RANGE || bResult == BTN_CURRENT_SELECTION )
diff --git a/sc/uiconfig/scalc/ui/sortwarning.ui b/sc/uiconfig/scalc/ui/sortwarning.ui
new file mode 100644
index 0000000..e743ad8
--- /dev/null
+++ b/sc/uiconfig/scalc/ui/sortwarning.ui
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkWindow" id="SortWarning">
+    <property name="can_focus">False</property>
+    <property name="valign">start</property>
+    <property name="default_height">200</property>
+    <property name="type_hint">dialog</property>
+    <child>
+      <object class="GtkAlignment" id="alignment1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="left_padding">6</property>
+        <property name="right_padding">6</property>
+        <child>
+          <object class="GtkBox" id="box1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">start</property>
+            <property name="valign">start</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkLabel" id="sorttext">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">start</property>
+                <property name="valign">start</property>
+                <property name="margin_left">6</property>
+                <property name="margin_right">6</property>
+                <property name="margin_top">6</property>
+                <property name="margin_bottom">6</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">The cells next to the current selection also contain data. Do you want to extend the sort range to %1, or sort the currently selected range, %2?</property>
+                <property name="wrap">True</property>
+                <property name="wrap_mode">word-char</property>
+                <property name="max_width_chars">72</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButtonBox" id="buttonbox1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">center</property>
+                <property name="spacing">12</property>
+                <property name="layout_style">start</property>
+                <child>
+                  <object class="GtkButton" id="extend">
+                    <property name="label" translatable="yes">_Extend selection</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="current">
+                    <property name="label" translatable="yes">Current selection</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="cancel">
+                    <property name="label">gtk-cancel</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="use_stock">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="padding">6</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="sorttip">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">start</property>
+                <property name="valign">start</property>
+                <property name="margin_left">6</property>
+                <property name="margin_right">6</property>
+                <property name="margin_top">6</property>
+                <property name="margin_bottom">6</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Tip: The sort range can be detected automatically. Place the cell cursor inside a list and execute sort. The whole range of neighboring non-empty cells will then be sorted.</property>
+                <property name="wrap">True</property>
+                <property name="wrap_mode">word-char</property>
+                <property name="max_width_chars">72</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>


More information about the Libreoffice-commits mailing list