diff options
author | Manal Alhassoun <malhassoun@kacst.edu.sa> | 2013-11-07 15:12:10 +0300 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-11-12 12:07:33 +0000 |
commit | eb505c259d0d7bd05d1bb5be5a14ad8613c2a9c7 (patch) | |
tree | d1852eccb10ffb0a4e8a02e85540edadaa0f9955 /sfx2 | |
parent | 12fd49a2701f4d23f23f0770bd40c8cd20b523c7 (diff) |
Convert New Style dialog to widget UI
Change-Id: Idaea69f674e1e84e3e1e649006c2d92176897fe0
Reviewed-on: https://gerrit.libreoffice.org/6607
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/UIConfig_sfx.mk | 1 | ||||
-rw-r--r-- | sfx2/source/dialog/newstyle.cxx | 24 | ||||
-rw-r--r-- | sfx2/source/dialog/newstyle.hrc | 4 | ||||
-rw-r--r-- | sfx2/source/dialog/newstyle.src | 36 | ||||
-rw-r--r-- | sfx2/uiconfig/ui/newstyle.ui | 120 |
5 files changed, 132 insertions, 53 deletions
diff --git a/sfx2/UIConfig_sfx.mk b/sfx2/UIConfig_sfx.mk index a2629d20ca31..1ae909102b69 100644 --- a/sfx2/UIConfig_sfx.mk +++ b/sfx2/UIConfig_sfx.mk @@ -19,6 +19,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\ sfx2/uiconfig/ui/errorfindemaildialog \ sfx2/uiconfig/ui/licensedialog \ sfx2/uiconfig/ui/managestylepage \ + sfx2/uiconfig/ui/newstyle \ sfx2/uiconfig/ui/optprintpage \ sfx2/uiconfig/ui/password \ sfx2/uiconfig/ui/printeroptionsdialog \ diff --git a/sfx2/source/dialog/newstyle.cxx b/sfx2/source/dialog/newstyle.cxx index 2995a7111243..5f8e24e87425 100644 --- a/sfx2/source/dialog/newstyle.cxx +++ b/sfx2/source/dialog/newstyle.cxx @@ -31,7 +31,7 @@ IMPL_LINK( SfxNewStyleDlg, OKHdl, Control *, pControl ) { (void)pControl; //unused - const OUString aName( aColBox.GetText() ); + const OUString aName( m_pColBox->GetText() ); SfxStyleSheetBase* pStyle = rPool.Find( aName, rPool.GetSearchFamily(), SFXSTYLEBIT_ALL ); if ( pStyle ) { @@ -54,7 +54,7 @@ IMPL_LINK( SfxNewStyleDlg, OKHdl, Control *, pControl ) IMPL_LINK_INLINE_START( SfxNewStyleDlg, ModifyHdl, ComboBox *, pBox ) { - aOKBtn.Enable( !comphelper::string::remove(pBox->GetText(), ' ').isEmpty() ); + m_pOKBtn->Enable( !comphelper::string::remove(pBox->GetText(), ' ').isEmpty() ); return 0; } IMPL_LINK_INLINE_END( SfxNewStyleDlg, ModifyHdl, ComboBox *, pBox ) @@ -63,28 +63,26 @@ IMPL_LINK_INLINE_END( SfxNewStyleDlg, ModifyHdl, ComboBox *, pBox ) SfxNewStyleDlg::SfxNewStyleDlg( Window* pParent, SfxStyleSheetBasePool& rInPool ) : - ModalDialog( pParent, SfxResId( DLG_NEW_STYLE_BY_EXAMPLE ) ), + ModalDialog( pParent, "CreateStyleDialog", "sfx/ui/newstyle.ui" ), - aColFL ( this, SfxResId( FL_COL ) ), - aColBox ( this, SfxResId( LB_COL ) ), - aOKBtn ( this, SfxResId( BT_OK ) ), - aCancelBtn ( this, SfxResId( BT_CANCEL ) ), aQueryOverwriteBox ( this, SfxResId( MSG_OVERWRITE ) ), rPool( rInPool ) { - FreeResource(); + get(m_pColBox, "stylename"); + m_pColBox->set_width_request(m_pColBox->approximate_char_width() * 25); + m_pColBox->set_height_request(m_pColBox->GetTextHeight() * 10); + get(m_pOKBtn, "ok"); - aOKBtn.SetClickHdl(LINK(this, SfxNewStyleDlg, OKHdl)); - aColBox.SetModifyHdl(LINK(this, SfxNewStyleDlg, ModifyHdl)); - aColBox.SetDoubleClickHdl(LINK(this, SfxNewStyleDlg, OKHdl)); -// aColBox.SetAccessibleName(SfxResId(FL_COL).toString()); + m_pOKBtn->SetClickHdl(LINK(this, SfxNewStyleDlg, OKHdl)); + m_pColBox->SetModifyHdl(LINK(this, SfxNewStyleDlg, ModifyHdl)); + m_pColBox->SetDoubleClickHdl(LINK(this, SfxNewStyleDlg, OKHdl)); SfxStyleSheetBase *pStyle = rPool.First(); while ( pStyle ) { - aColBox.InsertEntry(pStyle->GetName()); + m_pColBox->InsertEntry(pStyle->GetName()); pStyle = rPool.Next(); } } diff --git a/sfx2/source/dialog/newstyle.hrc b/sfx2/source/dialog/newstyle.hrc index 0262c89d4da5..4725dbdb9d8a 100644 --- a/sfx2/source/dialog/newstyle.hrc +++ b/sfx2/source/dialog/newstyle.hrc @@ -17,10 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#define BT_OK 100 -#define BT_CANCEL 101 -#define LB_COL 1 -#define FL_COL 2 #define MSG_OVERWRITE 3 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/newstyle.src b/sfx2/source/dialog/newstyle.src index 8a8d147ed32a..375bac54ad4e 100644 --- a/sfx2/source/dialog/newstyle.src +++ b/sfx2/source/dialog/newstyle.src @@ -22,47 +22,11 @@ #include "newstyle.hrc" #include <sfx2/sfxcommands.h> -ModalDialog DLG_NEW_STYLE_BY_EXAMPLE -{ - HelpId = CMD_SID_STYLE_NEW_BY_EXAMPLE ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT ( 177 , 112 ) ; - Text [ en-US ] = "Create Style" ; - Moveable = TRUE ; - FixedLine FL_COL - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 109 , 8 ) ; - Text [ en-US ] = "Style name" ; - }; - ComboBox LB_COL - { - HelpID = "sfx2:ComboBox:DLG_NEW_STYLE_BY_EXAMPLE:LB_COL"; - Pos = MAP_APPFONT ( 12 , 14 ) ; - Size = MAP_APPFONT ( 94 , 92 ) ; - TabStop = TRUE ; - }; - OKButton BT_OK - { - Disable = TRUE ; - Pos = MAP_APPFONT ( 121 , 6 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton BT_CANCEL - { - Pos = MAP_APPFONT ( 121 , 23 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; QueryBox MSG_OVERWRITE { Buttons = WB_YES_NO ; DefButton = WB_DEF_NO ; Message [ en-US ] = "Style already exists. Overwrite?" ; }; -}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/uiconfig/ui/newstyle.ui b/sfx2/uiconfig/ui/newstyle.ui new file mode 100644 index 000000000000..e44b94fac37f --- /dev/null +++ b/sfx2/uiconfig/ui/newstyle.ui @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkDialog" id="CreateStyleDialog"> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <property name="title" translatable="yes">Create Style</property> + <property name="type_hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox3"> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="spacing">12</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area3"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="layout_style">start</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_action_appearance">False</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_action_appearance">False</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">0</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="frame1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="VclComboBoxText" id="stylename"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="has_entry">True</property> + <property name="entry_text_column">0</property> + <property name="id_column">1</property> + <property name="dropdown">False</property> + <property name="max_width_chars">60</property> + <child internal-child="entry"> + <object class="GtkEntry" id="comboboxtext-entry"> + <property name="can_focus">False</property> + </object> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Style name</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</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> |