include/vcl/layout.hxx | 3 sw/UIConfig_swriter.mk | 1 sw/inc/dbui.hrc | 1 sw/inc/helpid.h | 1 sw/source/ui/dbui/mmoutputpage.cxx | 60 +++----- sw/source/ui/dbui/mmoutputpage.hrc | 2 sw/source/ui/dbui/mmoutputpage.src | 51 ------ sw/uiconfig/swriter/ui/alreadyexistsdialog.ui | 194 ++++++++++++++++++++++++++ vcl/source/window/layout.cxx | 28 ++- 9 files changed, 246 insertions(+), 95 deletions(-)
New commits: commit a9ad0c3d4a4cfa70ba89d8fb366a782f58f44f07 Author: Caolán McNamara <caol...@redhat.com> Date: Sat Sep 7 20:25:59 2013 +0100 convert already exists dialog to .ui Change-Id: I6cb2a11b6ee2f94f611aa852c79dd1a6534381da diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx index adecb94..1d817dd 100644 --- a/include/vcl/layout.hxx +++ b/include/vcl/layout.hxx @@ -719,6 +719,9 @@ public: void set_primary_text(const OUString &rPrimaryString); void set_secondary_text(const OUString &rSecondaryString); ~MessageDialog(); + + static void SetMessagesWidths(Window *pParent, VclMultiLineEdit *pPrimaryMessage, + VclMultiLineEdit *pSecondaryMessage); }; VCL_DLLPUBLIC Size bestmaxFrameSizeForScreenSize(const Size &rScreenSize); diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk index d50ba65..83cf408 100644 --- a/sw/UIConfig_swriter.mk +++ b/sw/UIConfig_swriter.mk @@ -60,6 +60,7 @@ $(eval $(call gb_UIConfig_add_toolbarfiles,modules/swriter,\ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\ sw/uiconfig/swriter/ui/abstractdialog \ + sw/uiconfig/swriter/ui/alreadyexistsdialog \ sw/uiconfig/swriter/ui/asciifilterdialog \ sw/uiconfig/swriter/ui/assignstylesdialog \ sw/uiconfig/swriter/ui/authenticationsettingsdialog \ diff --git a/sw/inc/dbui.hrc b/sw/inc/dbui.hrc index 7103489..681a6e3 100644 --- a/sw/inc/dbui.hrc +++ b/sw/inc/dbui.hrc @@ -48,7 +48,6 @@ #define DLG_MM_MAILBODY (RC_DBUI_BEGIN + 24) #define DLG_MM_SENDMAILS (RC_DBUI_BEGIN + 25) #define DLG_MAILMERGECHILD (RC_DBUI_BEGIN + 26) -#define DLG_MM_SAVEWARNING (RC_DBUI_BEGIN + 27) #define DLG_MM_QUERY (RC_DBUI_BEGIN + 28) #define DLG_MM_SENDWARNING (RC_DBUI_BEGIN + 29) #define DLG_MM_CREATIONMONITOR (RC_DBUI_BEGIN + 30) diff --git a/sw/inc/helpid.h b/sw/inc/helpid.h index 83b8cd4..56f931c 100644 --- a/sw/inc/helpid.h +++ b/sw/inc/helpid.h @@ -400,7 +400,6 @@ #define HID_MM_CUSTOMFIELDS "SW_HID_MM_CUSTOMFIELDS" #define HID_MM_MAILSTATUS_TLB "SW_HID_MM_MAILSTATUS_TLB" #define HID_RETURN_TO_MAILMERGE "SW_HID_RETURN_TO_MAILMERGE" -#define HID_MM_SAVEWARNING "SW_HID_MM_SAVEWARNING" #define HID_MM_QUERY "SW_HID_MM_QUERY" #define HID_MM_SENDWARNING "SW_HID_MM_SENDWARNING" diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index 35d9881..2a5de59 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -35,6 +35,7 @@ #include <svl/stritem.hxx> #include <svtools/ehdl.hxx> #include <svtools/sfxecode.hxx> +#include <vcl/layout.hxx> #include <vcl/msgbox.hxx> #include <sfx2/dinfdlg.hxx> #include <sfx2/printer.hxx> @@ -107,22 +108,20 @@ static OUString lcl_GetColumnValueOf(const OUString& rColumn, Reference < contai class SwSaveWarningBox_Impl : public ModalDialog { - FixedImage aWarningImageIM; - FixedInfo aWarningFI; - - FixedText aFileNameFT; - Edit aFileNameED; - - FixedLine aSeparatorFL; - OKButton aOKPB; - CancelButton aCancelPB; + OKButton* m_pOKPB; + FixedImage* m_pWarningImageIM; + VclMultiLineEdit* m_pPrimaryMessage; + VclMultiLineEdit* m_pSecondaryMessage; + Edit* m_pFileNameED; DECL_LINK( ModifyHdl, Edit*); public: - SwSaveWarningBox_Impl(Window* pParent, const String& rFileName); - ~SwSaveWarningBox_Impl(); + SwSaveWarningBox_Impl(Window* pParent, const OUString& rFileName); - String GetFileName() const {return aFileNameED.GetText();} + OUString GetFileName() const + { + return m_pFileNameED->GetText(); + } }; class SwSendQueryBox_Impl : public ModalDialog @@ -156,35 +155,32 @@ public: } }; -SwSaveWarningBox_Impl::SwSaveWarningBox_Impl(Window* pParent, const String& rFileName) : - ModalDialog(pParent, SW_RES( DLG_MM_SAVEWARNING )), - aWarningImageIM(this, SW_RES( IM_WARNING )), - aWarningFI(this, SW_RES( FI_WARNING )), - aFileNameFT(this, SW_RES( FT_FILENAME )), - aFileNameED(this, SW_RES( ED_FILENAME )), - aSeparatorFL(this, SW_RES( FL_SEPARATOR )), - aOKPB(this, SW_RES( PB_OK )), - aCancelPB(this, SW_RES( PB_CANCEL )) +SwSaveWarningBox_Impl::SwSaveWarningBox_Impl(Window* pParent, const OUString& rFileName) + : ModalDialog(pParent, "AlreadyExistsDialog", + "modules/swriter/ui/alreadyexistsdialog.ui") { - FreeResource(); - aWarningImageIM.SetImage(WarningBox::GetStandardImage()); - aFileNameED.SetText(rFileName); - aFileNameED.SetModifyHdl(LINK(this, SwSaveWarningBox_Impl, ModifyHdl)); + get(m_pOKPB, "ok"); + get(m_pPrimaryMessage, "primarymessage"); + m_pPrimaryMessage->SetPaintTransparent(true); + get(m_pSecondaryMessage, "secondarymessage"); + m_pSecondaryMessage->SetPaintTransparent(true); + MessageDialog::SetMessagesWidths(this, m_pPrimaryMessage, m_pSecondaryMessage); + get(m_pWarningImageIM, "image"); + get(m_pFileNameED, "filename"); + m_pWarningImageIM->SetImage(WarningBox::GetStandardImage()); + m_pFileNameED->SetText(rFileName); + m_pFileNameED->SetModifyHdl(LINK(this, SwSaveWarningBox_Impl, ModifyHdl)); INetURLObject aTmp(rFileName); - aWarningFI.SetText(aWarningFI.GetText().replaceAll("%1", aTmp.getName( + m_pPrimaryMessage->SetText(m_pPrimaryMessage->GetText().replaceAll("%1", aTmp.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET))); - ModifyHdl( &aFileNameED ); -} - -SwSaveWarningBox_Impl::~SwSaveWarningBox_Impl() -{ + ModifyHdl(m_pFileNameED); } IMPL_LINK( SwSaveWarningBox_Impl, ModifyHdl, Edit*, pEdit) { - aOKPB.Enable(!pEdit->GetText().isEmpty()); + m_pOKPB->Enable(!pEdit->GetText().isEmpty()); return 0; } diff --git a/sw/source/ui/dbui/mmoutputpage.hrc b/sw/source/ui/dbui/mmoutputpage.hrc index f9b3b07..94825ee 100644 --- a/sw/source/ui/dbui/mmoutputpage.hrc +++ b/sw/source/ui/dbui/mmoutputpage.hrc @@ -87,8 +87,6 @@ #define IM_WARNING 1 #define FI_WARNING 2 -#define FT_FILENAME 3 -#define ED_FILENAME 4 #endif diff --git a/sw/source/ui/dbui/mmoutputpage.src b/sw/source/ui/dbui/mmoutputpage.src index 1bf8035..d9fa4e3 100644 --- a/sw/source/ui/dbui/mmoutputpage.src +++ b/sw/source/ui/dbui/mmoutputpage.src @@ -384,57 +384,6 @@ ModalDialog DLG_MM_COPYTO }; }; -ModalDialog DLG_MM_SAVEWARNING -{ - OutputSize = TRUE ; - SVLook = TRUE ; - HelpID = HID_MM_SAVEWARNING; - Size = MAP_APPFONT ( 200 , 99 ) ; - Moveable = TRUE ; - - Text = "%PRODUCTNAME"; - FixedImage IM_WARNING - { - Pos = MAP_APPFONT ( 6 , 3 ) ; - Size = MAP_APPFONT ( 30 , 30 ) ; - }; - FixedText FI_WARNING - { - Pos = MAP_APPFONT ( 40 , 3 ) ; - Size = MAP_APPFONT ( 150 , 30 ) ; - WordBreak = TRUE; - Text[ en-US ] = "A document with the name '%1' already exists. Please save this document under a different name."; - }; - FixedText FT_FILENAME - { - Pos = MAP_APPFONT ( 40, 39 ) ; - Size = MAP_APPFONT ( 154, 8 ) ; - Text[ en-US ] = "New document name"; - }; - Edit ED_FILENAME - { - HelpID = "sw:Edit:DLG_MM_SAVEWARNING:ED_FILENAME"; - Pos = MAP_APPFONT ( 40 , 50 ) ; - Size = MAP_APPFONT ( 154 , 12 ) ; - Border = TRUE; - }; - FixedLine FL_SEPARATOR - { - Pos = MAP_APPFONT ( 0 , 68 ) ; - Size = MAP_APPFONT ( 200 , 8 ) ; - }; - OKButton PB_OK - { - Pos = MAP_APPFONT ( 40 , 79) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE; - }; - CancelButton PB_CANCEL - { - Pos = MAP_APPFONT ( 93 , 79 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; -}; ModalDialog DLG_MM_QUERY { OutputSize = TRUE ; diff --git a/sw/uiconfig/swriter/ui/alreadyexistsdialog.ui b/sw/uiconfig/swriter/ui/alreadyexistsdialog.ui new file mode 100644 index 0000000..e62e04c --- /dev/null +++ b/sw/uiconfig/swriter/ui/alreadyexistsdialog.ui @@ -0,0 +1,194 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkDialog" id="AlreadyExistsDialog"> + <property name="can_focus">False</property> + <property name="border_width">12</property> + <property name="title" translatable="yes">File already exists</property> + <property name="resizable">False</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">24</property> + <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">0</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="row_spacing">12</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkGrid" id="grid2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="row_spacing">6</property> + <child> + <object class="GtkTextView" id="primarymessage"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="editable">False</property> + <property name="wrap_mode">word</property> + <property name="cursor_visible">False</property> + <property name="buffer">textbuffer1</property> + <property name="accepts_tab">False</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="GtkTextView" id="secondarymessage"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="editable">False</property> + <property name="wrap_mode">word</property> + <property name="cursor_visible">False</property> + <property name="buffer">textbuffer2</property> + <property name="accepts_tab">False</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> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <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">7</property> + <child> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">New document name:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">filename</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="filename"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="invisible_char">â</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> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkImage" id="image"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">center</property> + <property name="valign">start</property> + <property name="icon-size">6</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">True</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> + <object class="GtkTextBuffer" id="textbuffer1"> + <property name="text" translatable="yes">A document with the name '%1' already exists.</property> + </object> + <object class="GtkTextBuffer" id="textbuffer2"> + <property name="text" translatable="yes">Please save this document under a different name.</property> + </object> +</interface> diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 898cd11..30a6c84 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -1859,6 +1859,24 @@ void MessageDialog::setButtonHandlers(VclButtonBox *pButtonBox) } } +void MessageDialog::SetMessagesWidths(Window *pParent, + VclMultiLineEdit *pPrimaryMessage, VclMultiLineEdit *pSecondaryMessage) +{ + if (pSecondaryMessage) + { + assert(pPrimaryMessage); + Font aFont = pParent->GetSettings().GetStyleSettings().GetLabelFont(); + aFont.SetSize(Size(0, aFont.GetSize().Height() * 1.2)); + aFont.SetWeight(WEIGHT_BOLD); + pPrimaryMessage->SetControlFont(aFont); + pPrimaryMessage->SetMaxTextWidth(pPrimaryMessage->approximate_char_width() * 60); + pSecondaryMessage->SetMaxTextWidth(pSecondaryMessage->approximate_char_width() * 80); + } + else + pPrimaryMessage->SetMaxTextWidth(pPrimaryMessage->approximate_char_width() * 80); +} + + short MessageDialog::Execute() { setDeferredProperties(); @@ -1899,19 +1917,12 @@ short MessageDialog::Execute() m_pPrimaryMessage = new VclMultiLineEdit(m_pGrid, nWinStyle); m_pPrimaryMessage->SetPaintTransparent(true); m_pPrimaryMessage->EnableCursor(false); - Font aFont = GetSettings().GetStyleSettings().GetLabelFont(); - - if (bHasSecondaryText) - aFont.SetSize(Size(0, aFont.GetSize().Height() * 1.2)); - aFont.SetWeight(WEIGHT_BOLD); - m_pPrimaryMessage->SetControlFont(aFont); m_pPrimaryMessage->set_grid_left_attach(1); m_pPrimaryMessage->set_grid_top_attach(0); m_pPrimaryMessage->set_hexpand(true); m_pPrimaryMessage->SetText(m_sPrimaryString); m_pPrimaryMessage->Show(!m_sPrimaryString.isEmpty()); - m_pPrimaryMessage->SetMaxTextWidth(m_pPrimaryMessage->approximate_char_width() * 60); m_pSecondaryMessage = new VclMultiLineEdit(m_pGrid, nWinStyle); m_pSecondaryMessage->SetPaintTransparent(true); @@ -1921,7 +1932,8 @@ short MessageDialog::Execute() m_pSecondaryMessage->set_hexpand(true); m_pSecondaryMessage->SetText(m_sSecondaryString); m_pSecondaryMessage->Show(bHasSecondaryText); - m_pSecondaryMessage->SetMaxTextWidth(m_pSecondaryMessage->approximate_char_width() * 80); + + MessageDialog::SetMessagesWidths(this, m_pPrimaryMessage, bHasSecondaryText ? m_pSecondaryMessage : NULL); VclButtonBox *pButtonBox = get_action_area(); assert(pButtonBox);
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits