From cd841115fa28f8be5778e540819f963407b4c05b Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 1 May 2013 13:39:31 +0100 Subject: use new MessageDialog Change-Id: I4fdc54d5a6e0f133c53588e255274b9f103269b4 --- include/sfx2/QuerySaveDocument.hxx | 8 ++-- include/sfx2/sfx.hrc | 4 +- sfx2/UIConfig_sfx.mk | 1 + sfx2/source/doc/QuerySaveDocument.cxx | 26 ++++------- sfx2/source/doc/doc.hrc | 2 +- sfx2/source/doc/doc.src | 13 ------ sfx2/uiconfig/ui/querysavedialog.ui | 83 +++++++++++++++++++++++++++++++++++ 7 files changed, 100 insertions(+), 37 deletions(-) create mode 100644 sfx2/uiconfig/ui/querysavedialog.ui diff --git a/include/sfx2/QuerySaveDocument.hxx b/include/sfx2/QuerySaveDocument.hxx index e442b482ff53..ecdf0aa6a67e 100644 --- a/include/sfx2/QuerySaveDocument.hxx +++ b/include/sfx2/QuerySaveDocument.hxx @@ -19,11 +19,11 @@ #ifndef SFX_QUERYSAVEDOCUMENT_HXX #define SFX_QUERYSAVEDOCUMENT_HXX -#include "sal/config.h" -#include "sfx2/dllapi.h" +#include +#include class Window; -class String; + /** Opens the general query save document dialog. @param _pParent The parent window. @@ -31,7 +31,7 @@ class String; The title of the document. */ SFX2_DLLPUBLIC short ExecuteQuerySaveDocument( - Window* _pParent,const String& _rTitle); + Window* _pParent, const OUString& _rTitle); #endif //SFX_QUERYSAVEDOCUMENT_HXX diff --git a/include/sfx2/sfx.hrc b/include/sfx2/sfx.hrc index 245daa2f062a..b018a73b212d 100644 --- a/include/sfx2/sfx.hrc +++ b/include/sfx2/sfx.hrc @@ -152,12 +152,12 @@ #define STR_SFX_FILTERNAME_ALL (RID_SFX_START+106) #define STR_EDIT (RID_SFX_START+108) -#define STR_QUERY_SAVE_DOCUMENT (RID_SFX_START+110) + #define STR_BYTES (RID_SFX_START+111) #define STR_KB (RID_SFX_START+112) #define STR_MB (RID_SFX_START+113) #define STR_GB (RID_SFX_START+114) -#define STR_QUERY_SAVE_DOCUMENT_TITLE (RID_SFX_START+115) + #define STR_STANDARD_SHORTCUT (RID_SFX_START+117) #define STR_REPAIREDDOCUMENT (RID_SFX_START+118) diff --git a/sfx2/UIConfig_sfx.mk b/sfx2/UIConfig_sfx.mk index 2a551930361e..2adb858dc84c 100644 --- a/sfx2/UIConfig_sfx.mk +++ b/sfx2/UIConfig_sfx.mk @@ -20,6 +20,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\ sfx2/uiconfig/ui/optprintpage \ sfx2/uiconfig/ui/password \ sfx2/uiconfig/ui/printeroptionsdialog \ + sfx2/uiconfig/ui/querysavedialog \ sfx2/uiconfig/ui/securityinfopage \ sfx2/uiconfig/ui/singletabdialog \ sfx2/uiconfig/ui/documentfontspage \ diff --git a/sfx2/source/doc/QuerySaveDocument.cxx b/sfx2/source/doc/QuerySaveDocument.cxx index 7b24f7d55e15..9c073d07c279 100644 --- a/sfx2/source/doc/QuerySaveDocument.cxx +++ b/sfx2/source/doc/QuerySaveDocument.cxx @@ -17,29 +17,21 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "sfx2/QuerySaveDocument.hxx" - -#include -#include "sfx2/sfxresid.hxx" -#include -#include "doc.hrc" -#include +#include +#include #include -// ----------------------------------------------------------------------------- -short ExecuteQuerySaveDocument(Window* _pParent,const String& _rTitle) + +short ExecuteQuerySaveDocument(Window* _pParent, const OUString& _rTitle) { if (Application::IsHeadlessModeEnabled()) - { // don't block Desktop::terminate() if there's no user to ask + { + // don't block Desktop::terminate() if there's no user to ask return RET_NO; } - OUString aText( SfxResId(STR_QUERY_SAVE_DOCUMENT).toString() ); - aText = aText.replaceFirst( "$(DOC)", _rTitle ); - QueryBox aQBox( _pParent, WB_YES_NO_CANCEL | WB_DEF_YES, aText ); - aQBox.SetText(SfxResId(STR_QUERY_SAVE_DOCUMENT_TITLE).toString()); // Window title - aQBox.SetButtonText( BUTTONID_NO, SfxResId(STR_NOSAVEANDCLOSE).toString() ); - aQBox.SetButtonText( BUTTONID_YES, SfxResId(STR_SAVEDOC).toString() ); + + MessageDialog aQBox(_pParent, "QuerySaveDialog", "sfx/ui/querysavedialog.ui"); + aQBox.set_primary_text(aQBox.get_primary_text().replaceFirst("$(DOC)", _rTitle)); return aQBox.Execute(); } -// ----------------------------------------------------------------------------- /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/doc.hrc b/sfx2/source/doc/doc.hrc index 26947bd366f3..0ccbede03071 100644 --- a/sfx2/source/doc/doc.hrc +++ b/sfx2/source/doc/doc.hrc @@ -114,7 +114,7 @@ #define STR_DOCTYPENAME_MESSAGE (RID_SFX_DOC_START+ 75) #define RID_STR_NEW_TASK (RID_SFX_DOC_START+ 76) -#define STR_NOSAVEANDCLOSE (RID_SFX_DOC_START+ 78) + #define STR_PACKNGO_NOACCESS (RID_SFX_DOC_START+ 79) #define STR_PACKNGO_NEWMEDIUM (RID_SFX_DOC_START+ 80) diff --git a/sfx2/source/doc/doc.src b/sfx2/source/doc/doc.src index fa5889e0bcda..c1341cd6144d 100644 --- a/sfx2/source/doc/doc.src +++ b/sfx2/source/doc/doc.src @@ -47,14 +47,6 @@ QueryBox MSG_REGION_NOTEMPTY DefButton = WB_DEF_NO ; Message [ en-US ] = "The category is not empty.\nDelete anyway?" ; }; -String STR_QUERY_SAVE_DOCUMENT_TITLE -{ - Text [ en-US ] = "Save document" ; -}; -String STR_QUERY_SAVE_DOCUMENT -{ - Text [ en-US ] = "Save changes to document \"$(DOC)\" before closing?" ; -}; Bitmap BMP_STYLES_CLOSED { File = "newex.bmp" ; }; Bitmap BMP_STYLES_OPENED { File = "newex.bmp" ; }; @@ -314,11 +306,6 @@ String STR_DOCTYPENAME_MESSAGE Text [ en-US ] = "Message"; }; -String STR_NOSAVEANDCLOSE -{ - Text [ en-US ] = "Close ~without saving" ; -}; - String STR_PACKNGO_NOACCESS { Text [ en-US ] = "Access to the current data medium not possible." ; diff --git a/sfx2/uiconfig/ui/querysavedialog.ui b/sfx2/uiconfig/ui/querysavedialog.ui new file mode 100644 index 000000000000..42d0371bfd07 --- /dev/null +++ b/sfx2/uiconfig/ui/querysavedialog.ui @@ -0,0 +1,83 @@ + + + + + False + 12 + Save document + dialog + True + warning + Save changes to document "$(DOC)" before closing? + Your changes will be lost if you don't save them. + + + False + vertical + 24 + + + False + end + + + Close _without saving + True + True + True + True + + + False + True + 0 + + + + + gtk-cancel + True + True + True + True + bottom + + + False + True + 1 + + + + + gtk-save + True + True + True + True + True + True + + + False + True + 2 + + + + + False + True + end + 0 + + + + + + button3 + button1 + button2 + + + -- cgit