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>
diff --git a/include/sfx2/newstyle.hxx b/include/sfx2/newstyle.hxx
index 9584396..368d154 100644
--- a/include/sfx2/newstyle.hxx
+++ b/include/sfx2/newstyle.hxx
@@ -33,10 +33,8 @@ class SfxStyleSheetBasePool;
class SFX2_DLLPUBLIC SfxNewStyleDlg : public ModalDialog
{
private:
FixedLine aColFL;
ComboBox aColBox;
OKButton aOKBtn;
CancelButton aCancelBtn;
ComboBox* m_pColBox;
OKButton* m_pOKBtn;
QueryBox aQueryOverwriteBox;
SfxStyleSheetBasePool& rPool;
@@ -48,7 +46,7 @@ public:
SfxNewStyleDlg( Window* pParent, SfxStyleSheetBasePool& );
~SfxNewStyleDlg();
OUString GetName() const { return comphelper::string::stripStart(aColBox.GetText(), ' '); }
OUString GetName() const { return comphelper::string::stripStart(m_pColBox->GetText(), ' '); }
};
#endif
diff --git a/sfx2/UIConfig_sfx.mk b/sfx2/UIConfig_sfx.mk
index a2629d2..1ae9091 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 2995a71..5f8e24e 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 0262c89..4725dbd 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 8a8d147..375bac5 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 0000000..e44b94f
--- /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>