[Libreoffice-commits] core.git: 2 commits - cui/source cui/uiconfig cui/UIConfig_cui.mk

Caolán McNamara caolanm at redhat.com
Sat Jan 4 08:59:13 PST 2014


 cui/UIConfig_cui.mk              |    1 
 cui/source/dialogs/scriptdlg.cxx |   77 ++++-------------
 cui/source/dialogs/scriptdlg.src |   56 -------------
 cui/source/inc/cuires.hrc        |    1 
 cui/source/inc/scriptdlg.hxx     |   21 ++--
 cui/uiconfig/ui/newlibdialog.ui  |  168 +++++++++++++++++++++++++++++++++++++++
 6 files changed, 200 insertions(+), 124 deletions(-)

New commits:
commit e6f6818b44fe1dbaba815aed31510609ec456bc6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jan 4 16:55:30 2014 +0000

    convert new lib dialog to .ui
    
    Change-Id: I99043f2c259b56a7bfc2e7251f128b692e7d0e7f

diff --git a/cui/UIConfig_cui.mk b/cui/UIConfig_cui.mk
index d059ad0..9a3b15a 100644
--- a/cui/UIConfig_cui.mk
+++ b/cui/UIConfig_cui.mk
@@ -65,6 +65,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
 	cui/uiconfig/ui/messbox \
 	cui/uiconfig/ui/movemenu \
 	cui/uiconfig/ui/namedialog \
+	cui/uiconfig/ui/newlibdialog \
 	cui/uiconfig/ui/newtabledialog \
 	cui/uiconfig/ui/newtoolbardialog \
 	cui/uiconfig/ui/numberingformatpage \
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index 15217c6..6339593 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -427,68 +427,36 @@ void SFTreeListBox::ExpandedHdl()
 // CuiInputDialog ------------------------------------------------------------
 // ----------------------------------------------------------------------------
 CuiInputDialog::CuiInputDialog(Window * pParent, sal_uInt16 nMode )
-    : ModalDialog( pParent, CUI_RES( RID_DLG_NEWLIB ) ),
-        aText( this, CUI_RES( FT_NEWLIB ) ),
-        aEdit( this, CUI_RES( ED_LIBNAME ) ),
-        aOKButton( this, CUI_RES( PB_OK ) ),
-        aCancelButton( this, CUI_RES( PB_CANCEL ) )
+    : ModalDialog(pParent, "NewLibDialog",
+        "cui/ui/newlibdialog.ui")
 {
-    aEdit.GrabFocus();
-    if ( nMode == INPUTMODE_NEWLIB )
-    {
-        SetText( OUString( CUI_RES( STR_NEWLIB ) ) );
-    }
-    else if ( nMode == INPUTMODE_NEWMACRO )
+    get(m_pEdit, "entry");
+    m_pEdit->GrabFocus();
+
+    FixedText *pNewLibFT = get<FixedText>("newlibft");
+
+    if ( nMode == INPUTMODE_NEWMACRO )
     {
-        SetText( OUString( CUI_RES( STR_NEWMACRO ) ) );
-        aText.SetText( OUString( CUI_RES( STR_FT_NEWMACRO ) ) );
+        pNewLibFT->Hide();
+        FixedText *pNewMacroFT = get<FixedText>("newmacroft");
+        pNewMacroFT->Show();
+        SetText(get<FixedText>("altmacrotitle")->GetText());
     }
     else if ( nMode == INPUTMODE_RENAME )
     {
-        SetText( OUString( CUI_RES( STR_RENAME ) ) );
-        aText.SetText( OUString( CUI_RES( STR_FT_RENAME ) ) );
+        pNewLibFT->Hide();
+        FixedText *pRenameFT = get<FixedText>("renameft");
+        pRenameFT->Show();
+        SetText(get<FixedText>("altrenametitle")->GetText());
     }
-    FreeResource();
-
-    // some resizing so that the text fits
-    Point point, newPoint;
-    Size siz, newSiz;
-    long gap;
-
-    sal_uInt16 style = TEXT_DRAW_MULTILINE | TEXT_DRAW_TOP |
-                   TEXT_DRAW_LEFT | TEXT_DRAW_WORDBREAK;
-
-    // get dimensions of dialog instructions control
-    point = aText.GetPosPixel();
-    siz = aText.GetSizePixel();
-
-    // get dimensions occupied by text in the control
-    Rectangle rect =
-        GetTextRect( Rectangle( point, siz ), aText.GetText(), style );
-    newSiz = rect.GetSize();
-
-    // the gap is the difference between the text width and its control width
-    gap = siz.Height() - newSiz.Height();
-
-    //resize the text field
-    newSiz = Size( siz.Width(), siz.Height() - gap );
-    aText.SetSizePixel( newSiz );
-
-    //move the OK & cancel buttons
-    point = aEdit.GetPosPixel();
-    newPoint = Point( point.X(), point.Y() - gap );
-    aEdit.SetPosPixel( newPoint );
-
 }
 
-CuiInputDialog::~CuiInputDialog()
-{
-}
 // ----------------------------------------------------------------------------
 // ScriptOrgDialog ------------------------------------------------------------
 // ----------------------------------------------------------------------------
 SvxScriptOrgDialog::SvxScriptOrgDialog( Window* pParent, OUString language )
-    : SfxModalDialog(pParent, "ScriptOrganizerDialog", "cui/ui/scriptorganizer.ui")
+    : SfxModalDialog(pParent, "ScriptOrganizerDialog",
+        "cui/ui/scriptorganizer.ui")
     , m_sLanguage(language)
     , m_delErrStr(CUI_RESSTR(RID_SVXSTR_DELFAILED))
     , m_delErrTitleStr(CUI_RESSTR(RID_SVXSTR_DELFAILED_TITLE))
diff --git a/cui/source/dialogs/scriptdlg.src b/cui/source/dialogs/scriptdlg.src
index e1e2a13..b2ea470 100644
--- a/cui/source/dialogs/scriptdlg.src
+++ b/cui/source/dialogs/scriptdlg.src
@@ -21,62 +21,6 @@
 #include "scriptdlg.hrc"
 #include "helpid.hrc"
 
-ModalDialog RID_DLG_NEWLIB
-{
-    HelpID = "cui:ModalDialog:RID_DLG_NEWLIB";
-    Text [ en-US ] = "Create Library" ;
-    Size = MAP_APPFONT ( 160 , 50 ) ;
-    Moveable = TRUE ;
-    Closeable = TRUE ;
-    OKButton PB_OK
-    {
-        Pos = MAP_APPFONT ( 104 , 6 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        TabStop = TRUE ;
-        DefButton = TRUE ;
-    };
-    CancelButton PB_CANCEL
-    {
-        Pos = MAP_APPFONT ( 104 , 23 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        TabStop = TRUE ;
-    };
-    FixedText FT_NEWLIB
-    {
-        Pos = MAP_APPFONT ( 6 , 6 ) ;
-        Size = MAP_APPFONT ( 100 , 50 ) ;
-        WordBreak = TRUE ;
-        Text [ en-US ] = "Enter the name for the new library." ;
-    };
-    Edit ED_LIBNAME
-    {
-        HelpID = "cui:Edit:RID_DLG_NEWLIB:ED_LIBNAME";
-        Border = TRUE ;
-        Pos = MAP_APPFONT ( 6 , 59 ) ;
-        Size = MAP_APPFONT ( 92 , 12 ) ;
-        TabStop = TRUE ;
-    };
-    String STR_NEWLIB
-    {
-        Text [ en-US ] = "Create Library" ;
-    };
-    String STR_NEWMACRO
-    {
-        Text [ en-US ] = "Create Macro" ;
-    };
-    String STR_FT_NEWMACRO
-    {
-        Text [ en-US ] = "Enter the name for the new macro." ;
-    };
-    String STR_RENAME
-    {
-        Text [ en-US ] = "Rename" ;
-    };
-    String STR_FT_RENAME
-    {
-        Text [ en-US ] = "Enter the new name for the selected object." ;
-    };
-};
 String RID_SVXSTR_DELQUERY
 {
     Text [ en-US ] = "Do you want to delete the following object?";
diff --git a/cui/source/inc/cuires.hrc b/cui/source/inc/cuires.hrc
index e774f80..2fe95b9 100644
--- a/cui/source/inc/cuires.hrc
+++ b/cui/source/inc/cuires.hrc
@@ -241,7 +241,6 @@
 
 // script organizer
 #define RID_DLG_SCRIPTORGANIZER             (RID_SVX_START + 258)
-#define RID_DLG_NEWLIB                      (RID_SVX_START + 290)
 #define RID_SVXSTR_DELQUERY                 (RID_SVX_START + 1027)
 #define RID_SVXSTR_DELQUERY_TITLE           (RID_SVX_START + 1028)
 #define RID_SVXSTR_DELFAILED                (RID_SVX_START + 1029)
diff --git a/cui/source/inc/scriptdlg.hxx b/cui/source/inc/scriptdlg.hxx
index 0874154b..bbf35c0 100644
--- a/cui/source/inc/scriptdlg.hxx
+++ b/cui/source/inc/scriptdlg.hxx
@@ -101,23 +101,22 @@ public:
 class CuiInputDialog : public ModalDialog
 {
 private:
-    FixedText       aText;
-    Edit            aEdit;
-    OKButton        aOKButton;
-    CancelButton    aCancelButton;
-
+    Edit* m_pEdit;
 public:
-    CuiInputDialog( Window * pParent, sal_uInt16 nMode );
-    ~CuiInputDialog();
-
-    OUString    GetObjectName() const { return aEdit.GetText(); }
-    void        SetObjectName( const OUString& rName ) { aEdit.SetText( rName ); aEdit.SetSelection( Selection( 0, rName.getLength() ) );}
+    CuiInputDialog(Window * pParent, sal_uInt16 nMode);
+
+    OUString GetObjectName() const { return m_pEdit->GetText(); }
+    void SetObjectName(const OUString& rName)
+    {
+        m_pEdit->SetText( rName );
+        m_pEdit->SetSelection( Selection( 0, rName.getLength() ) );
+    }
 };
 
 class SFEntry
 {
 private:
-    sal_uInt8           nType;
+    sal_uInt8       nType;
     bool            loaded;
         ::com::sun::star::uno::Reference< ::com::sun::star::script::browse::XBrowseNode > nodes;
         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > model;
diff --git a/cui/uiconfig/ui/newlibdialog.ui b/cui/uiconfig/ui/newlibdialog.ui
new file mode 100644
index 0000000..7b28431
--- /dev/null
+++ b/cui/uiconfig/ui/newlibdialog.ui
@@ -0,0 +1,168 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.0 on Sat Jan  4 16:52:18 2014 -->
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkDialog" id="NewLibDialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes">Create Library</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox1">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">12</property>
+        <child>
+          <object class="GtkGrid" id="grid3">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <property name="row_spacing">6</property>
+            <property name="column_spacing">12</property>
+            <property name="row_homogeneous">True</property>
+            <child>
+              <object class="GtkLabel" id="newlibft">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Enter the name for the new library.</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">entry</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="entry">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hexpand">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">3</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="newmacroft">
+                <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Enter the name for the new macro.</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">entry</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="renameft">
+                <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Enter the new name for the selected object.</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">entry</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">2</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="altmacrotitle">
+                <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
+                <property name="label" translatable="yes">Create Macro</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">4</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="altrenametitle">
+                <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
+                <property name="label" translatable="yes">Rename</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">5</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="ok">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">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">0</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">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">ok</action-widget>
+      <action-widget response="0">cancel</action-widget>
+    </action-widgets>
+  </object>
+</interface>
commit bb90d11bd892b6114aa2515549f62967428cef48
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jan 4 16:28:38 2014 +0000

    std::auto_ptr -> boost::scoped_ptr
    
    Change-Id: Iec75c8356aac9d75a478eaae329dbd2400e3a06b

diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index 141c65f..15217c6 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -60,6 +60,7 @@
 #include <tools/urlobj.hxx>
 #include <vector>
 #include <algorithm>
+#include <boost/scoped_ptr.hpp>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -922,9 +923,7 @@ void SvxScriptOrgDialog::createEntry( SvTreeListEntry* pEntry )
             }
         }
 
-        SAL_WNODEPRECATED_DECLARATIONS_PUSH
-        std::auto_ptr< CuiInputDialog > xNewDlg( new CuiInputDialog( static_cast<Window*>(this), nMode ) );
-        SAL_WNODEPRECATED_DECLARATIONS_POP
+        boost::scoped_ptr< CuiInputDialog > xNewDlg( new CuiInputDialog( static_cast<Window*>(this), nMode ) );
         xNewDlg->SetObjectName( aNewName );
 
         do
@@ -1052,9 +1051,7 @@ void SvxScriptOrgDialog::renameEntry( SvTreeListEntry* pEntry )
         }
         sal_uInt16 nMode = INPUTMODE_RENAME;
 
-        SAL_WNODEPRECATED_DECLARATIONS_PUSH
-        std::auto_ptr< CuiInputDialog > xNewDlg( new CuiInputDialog( static_cast<Window*>(this), nMode ) );
-        SAL_WNODEPRECATED_DECLARATIONS_POP
+        boost::scoped_ptr< CuiInputDialog > xNewDlg( new CuiInputDialog( static_cast<Window*>(this), nMode ) );
         xNewDlg->SetObjectName( aNewName );
 
         sal_Bool bValid;


More information about the Libreoffice-commits mailing list