diff options
33 files changed, 266 insertions, 443 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 23bc4f2483ca..f27cff062a77 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -491,7 +491,7 @@ void ModulWindow::ImportDialog() { const ScriptDocument& rDocument = GetDocument(); OUString aLibName = GetLibName(); - implImportDialog( this, m_sCurPath, rDocument, aLibName ); + implImportDialog(GetFrameWeld(), m_sCurPath, rDocument, aLibName); } void ModulWindow::ToggleBreakPoint( sal_uLong nLine ) diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index 322097b38105..4ea41cba9036 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -50,7 +50,6 @@ #include <tools/diagnose_ex.h> #include <tools/urlobj.hxx> #include <vcl/weld.hxx> -#include <vcl/msgbox.hxx> #include <vcl/settings.hxx> #include <xmlscript/xmldlg_imexp.hxx> @@ -782,56 +781,44 @@ std::vector< lang::Locale > implGetLanguagesOnlyContainedInFirstSeq } -class NameClashQueryBox : public MessBox +class NameClashQueryBox { +private: + std::unique_ptr<weld::MessageDialog> m_xQueryBox; public: - NameClashQueryBox( vcl::Window* pParent, - const OUString& rTitle, const OUString& rMessage ); + NameClashQueryBox(weld::Window* pParent, const OUString& rTitle, const OUString& rMessage) + : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, VclButtonsType::NONE, rMessage)) + { + if (!rTitle.isEmpty()) + m_xQueryBox->set_title(rTitle); + m_xQueryBox->add_button(IDEResId(RID_STR_DLGIMP_CLASH_RENAME), RET_YES); + m_xQueryBox->add_button(IDEResId(RID_STR_DLGIMP_CLASH_REPLACE), RET_NO); + m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL); + m_xQueryBox->set_default_response(RET_YES); + } + short run() { return m_xQueryBox->run(); } }; -NameClashQueryBox::NameClashQueryBox( vcl::Window* pParent, - const OUString& rTitle, const OUString& rMessage ) - : MessBox( pParent, MessBoxStyle::NONE, 0, rTitle, rMessage ) -{ - if ( !rTitle.isEmpty() ) - SetText( rTitle ); - - maMessText = rMessage; - - AddButton( IDEResId(RID_STR_DLGIMP_CLASH_RENAME), RET_YES, - ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus ); - AddButton( IDEResId(RID_STR_DLGIMP_CLASH_REPLACE), RET_NO ); - AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel ); - - SetImage(GetStandardQueryBoxImage()); -} - - -class LanguageMismatchQueryBox : public MessBox +class LanguageMismatchQueryBox { +private: + std::unique_ptr<weld::MessageDialog> m_xQueryBox; public: - LanguageMismatchQueryBox( vcl::Window* pParent, - const OUString& rTitle, const OUString& rMessage ); + LanguageMismatchQueryBox(weld::Window* pParent, const OUString& rTitle, const OUString& rMessage) + : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, VclButtonsType::NONE, rMessage)) + { + if (!rTitle.isEmpty()) + m_xQueryBox->set_title(rTitle); + m_xQueryBox->add_button(IDEResId(RID_STR_DLGIMP_MISMATCH_ADD), RET_YES); + m_xQueryBox->add_button(IDEResId(RID_STR_DLGIMP_MISMATCH_OMIT), RET_NO); + m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL); + m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Help), RET_HELP); + m_xQueryBox->set_default_response(RET_YES); + } + short run() { return m_xQueryBox->run(); } }; -LanguageMismatchQueryBox::LanguageMismatchQueryBox( vcl::Window* pParent, - const OUString& rTitle, const OUString& rMessage ) - : MessBox( pParent, MessBoxStyle::NONE, 0, rTitle, rMessage ) -{ - if ( !rTitle.isEmpty() ) - SetText( rTitle ); - - maMessText = rMessage; - AddButton( IDEResId(RID_STR_DLGIMP_MISMATCH_ADD), RET_YES, - ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus ); - AddButton( IDEResId(RID_STR_DLGIMP_MISMATCH_OMIT), RET_NO ); - AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel ); - AddButton( StandardButtonType::Help, RET_HELP, ButtonDialogFlags::Help, 4 ); - - SetImage(GetStandardQueryBoxImage() ); -} - -bool implImportDialog( vcl::Window* pWin, const OUString& rCurPath, const ScriptDocument& rDocument, const OUString& aLibName ) +bool implImportDialog(weld::Window* pWin, const OUString& rCurPath, const ScriptDocument& rDocument, const OUString& aLibName) { bool bDone = false; @@ -914,8 +901,8 @@ bool implImportDialog( vcl::Window* pWin, const OUString& rCurPath, const Script OUString aQueryBoxText(IDEResId(RID_STR_DLGIMP_CLASH_TEXT)); aQueryBoxText = aQueryBoxText.replaceAll("$(ARG1)", aXmlDlgName); - ScopedVclPtrInstance< NameClashQueryBox > aQueryBox( pWin, aQueryBoxTitle, aQueryBoxText ); - sal_uInt16 nRet = aQueryBox->Execute(); + NameClashQueryBox aQueryBox(pWin, aQueryBoxTitle, aQueryBoxText); + sal_uInt16 nRet = aQueryBox.run(); if( nRet == RET_YES ) { // RET_YES == Rename, see NameClashQueryBox::NameClashQueryBox @@ -975,8 +962,8 @@ bool implImportDialog( vcl::Window* pWin, const OUString& rCurPath, const Script { OUString aQueryBoxTitle(IDEResId(RID_STR_DLGIMP_MISMATCH_TITLE)); OUString aQueryBoxText(IDEResId(RID_STR_DLGIMP_MISMATCH_TEXT)); - ScopedVclPtrInstance< LanguageMismatchQueryBox > aQueryBox( pWin, aQueryBoxTitle, aQueryBoxText ); - sal_uInt16 nRet = aQueryBox->Execute(); + LanguageMismatchQueryBox aQueryBox(pWin, aQueryBoxTitle, aQueryBoxText); + sal_uInt16 nRet = aQueryBox.run(); if( nRet == RET_YES ) { // RET_YES == Add, see LanguageMismatchQueryBox::LanguageMismatchQueryBox @@ -1117,12 +1104,11 @@ bool implImportDialog( vcl::Window* pWin, const OUString& rCurPath, const Script return bDone; } - void DialogWindow::ImportDialog() { const ScriptDocument& rDocument = GetDocument(); OUString aLibName = GetLibName(); - implImportDialog( this, m_sCurPath, rDocument, aLibName ); + implImportDialog(GetFrameWeld(), m_sCurPath, rDocument, aLibName); } DlgEdModel& DialogWindow::GetModel() const diff --git a/basctl/source/inc/baside3.hxx b/basctl/source/inc/baside3.hxx index 5062e8050751..c553466268c8 100644 --- a/basctl/source/inc/baside3.hxx +++ b/basctl/source/inc/baside3.hxx @@ -49,7 +49,7 @@ class DlgEdView; class DialogWindowLayout; class ObjectCatalog; -bool implImportDialog( vcl::Window* pWin, const OUString& rCurPath, const ScriptDocument& rDocument, const OUString& aLibName ); +bool implImportDialog(weld::Window* pWin, const OUString& rCurPath, const ScriptDocument& rDocument, const OUString& rLibName); class DialogWindow: public BaseWindow { diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx index 6e5aa6f5185e..0362ad0bbcea 100644 --- a/basctl/source/inc/basidesh.hxx +++ b/basctl/source/inc/basidesh.hxx @@ -59,7 +59,7 @@ public: private: friend class JavaDebuggingListenerImpl; friend class LocalizationMgr; - friend bool implImportDialog( vcl::Window* pWin, const OUString& rCurPath, const ScriptDocument& rDocument, const OUString& aLibName ); // defined in baside3.cxx + friend bool implImportDialog(weld::Window* pWin, const OUString& rCurPath, const ScriptDocument& rDocument, const OUString& rLibName); // defined in baside3.cxx WindowTable aWindowTable; sal_uInt16 nCurKey; diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 6f6ec630d613..9b96ccc0e7e4 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -3242,6 +3242,42 @@ bool SvxIconSelectorDialog::ReplaceGraphicItem( return bResult; } +namespace +{ + OUString ReplaceIconName(const OUString& rMessage) + { + OUString name; + OUString message = CuiResId( RID_SVXSTR_REPLACE_ICON_WARNING ); + OUString placeholder("%ICONNAME" ); + sal_Int32 pos = message.indexOf( placeholder ); + if ( pos != -1 ) + { + name = message.replaceAt( + pos, placeholder.getLength(), rMessage ); + } + return name; + } + + class SvxIconReplacementDialog + { + private: + std::unique_ptr<weld::MessageDialog> m_xQueryBox; + public: + SvxIconReplacementDialog(weld::Window *pParent, const OUString& rMessage, bool bYestoAll) + : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Warning, VclButtonsType::NONE, ReplaceIconName(rMessage))) + { + m_xQueryBox->set_title(CuiResId(RID_SVXSTR_REPLACE_ICON_CONFIRM)); + m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Yes), 2); + if (bYestoAll) + m_xQueryBox->add_button(CuiResId(RID_SVXSTR_YESTOALL), 5); + m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::No), 4); + m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), 6); + m_xQueryBox->set_default_response(2); + } + short run() { return m_xQueryBox->run(); } + }; +} + void SvxIconSelectorDialog::ImportGraphics( const uno::Sequence< OUString >& rPaths ) { @@ -3260,7 +3296,8 @@ void SvxIconSelectorDialog::ImportGraphics( { aIndex = rPaths[0].lastIndexOf( '/' ); aIconName = rPaths[0].copy( aIndex+1 ); - ret = ScopedVclPtrInstance<SvxIconReplacementDialog>(this, aIconName)->ShowDialog(); + SvxIconReplacementDialog aDlg(GetFrameWeld(), aIconName, false); + ret = aDlg.run(); if ( ret == 2 ) { ReplaceGraphicItem( rPaths[0] ); @@ -3288,7 +3325,8 @@ void SvxIconSelectorDialog::ImportGraphics( { aIndex = rPaths[i].lastIndexOf( '/' ); aIconName = rPaths[i].copy( aIndex+1 ); - ret = ScopedVclPtrInstance<SvxIconReplacementDialog>(this, aIconName, true)->ShowDialog(); + SvxIconReplacementDialog aDlg(GetFrameWeld(), aIconName, true); + ret = aDlg.run(); if ( ret == 2 ) { ReplaceGraphicItem( aPath ); @@ -3420,53 +3458,6 @@ bool SvxIconSelectorDialog::ImportGraphic( const OUString& aURL ) /******************************************************************************* * -* The SvxIconReplacementDialog class -* -*******************************************************************************/ -SvxIconReplacementDialog::SvxIconReplacementDialog( - vcl::Window *pWindow, const OUString& aMessage, bool /*bYestoAll*/ ) - : -MessBox( pWindow, MessBoxStyle::DefaultYes, 0, CuiResId( RID_SVXSTR_REPLACE_ICON_CONFIRM ), CuiResId( RID_SVXSTR_REPLACE_ICON_WARNING ) ) - -{ - SetImage( GetStandardWarningBoxImage() ); - SetMessText( ReplaceIconName( aMessage ) ); - RemoveButton( 1 ); - AddButton( StandardButtonType::Yes, 2); - AddButton( CuiResId( RID_SVXSTR_YESTOALL ), 5); - AddButton( StandardButtonType::No, 3); - AddButton( StandardButtonType::Cancel, 4); -} - -SvxIconReplacementDialog::SvxIconReplacementDialog( - vcl::Window *pWindow, const OUString& aMessage ) - : MessBox( pWindow, MessBoxStyle::YesNoCancel, 0, CuiResId( RID_SVXSTR_REPLACE_ICON_CONFIRM ), CuiResId( RID_SVXSTR_REPLACE_ICON_WARNING ) ) -{ - SetImage( GetStandardWarningBoxImage() ); - SetMessText( ReplaceIconName( aMessage )); -} - -OUString SvxIconReplacementDialog::ReplaceIconName( const OUString& rMessage ) -{ - OUString name; - OUString message = CuiResId( RID_SVXSTR_REPLACE_ICON_WARNING ); - OUString placeholder("%ICONNAME" ); - sal_Int32 pos = message.indexOf( placeholder ); - if ( pos != -1 ) - { - name = message.replaceAt( - pos, placeholder.getLength(), rMessage ); - } - return name; -} - -sal_uInt16 SvxIconReplacementDialog::ShowDialog() -{ - Execute(); - return GetCurButtonId(); -} -/******************************************************************************* -* * The SvxIconChangeDialog class added for issue83555 * *******************************************************************************/ diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx index d69da888059e..52bb3facb3c9 100644 --- a/cui/source/inc/cfg.hxx +++ b/cui/source/inc/cfg.hxx @@ -635,21 +635,6 @@ public: DECL_LINK( DeleteHdl, Button *, void ); }; -class SvxIconReplacementDialog : public MessBox -{ -public: - SvxIconReplacementDialog( - vcl::Window *pWindow, - const OUString& aMessage, - bool aYestoAll); - - SvxIconReplacementDialog( - vcl::Window *pWindow, - const OUString& aMessage ); - - static OUString ReplaceIconName( const OUString& ); - sal_uInt16 ShowDialog(); -}; //added for issue83555 class SvxIconChangeDialog : public ModalDialog { diff --git a/include/svx/prtqry.hxx b/include/svx/prtqry.hxx deleted file mode 100644 index a2f4e9298262..000000000000 --- a/include/svx/prtqry.hxx +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SVX_PRTQRY_HXX -#define INCLUDED_SVX_PRTQRY_HXX - -#include <vcl/msgbox.hxx> -#include <svx/svxdllapi.h> - -class SVX_DLLPUBLIC SvxPrtQryBox : public MessBox -{ -public: - SvxPrtQryBox(vcl::Window* pParent); -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 5c87a005fe61..4b7887e1c45a 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -45,6 +45,7 @@ public: virtual int get_text_height() const = 0; virtual Size get_pixel_size(const OUString& rText) const = 0; virtual OString get_buildable_name() const = 0; + virtual void set_help_id(const OString& rName) = 0; virtual OString get_help_id() const = 0; virtual Container* weld_parent() const = 0; @@ -492,10 +493,6 @@ public: virtual TextView* weld_text_view(const OString& id, bool bTakeOwnership = false) = 0; virtual Entry* weld_entry(const OString& id, bool bTakeOwnership = false) = 0; virtual DrawingArea* weld_drawing_area(const OString& id, bool bTakeOwnership = false) = 0; - OString get_help_id(const Widget& rWidget) const - { - return m_sHelpRoot + rWidget.get_buildable_name(); - } virtual ~Builder() {} }; } diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index dedd4d6346df..2c67a32a1ae6 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -30,7 +30,6 @@ #include <svx/fmpage.hxx> #include <svx/fmshell.hxx> #include <editeng/sizeitem.hxx> -#include <svx/prtqry.hxx> #include <svx/sidebar/ContextChangeEventMultiplexer.hxx> #include <sfx2/request.hxx> #include <sfx2/printer.hxx> diff --git a/sd/source/ui/view/viewshe3.cxx b/sd/source/ui/view/viewshe3.cxx index f342cb53193f..2427b6836c39 100644 --- a/sd/source/ui/view/viewshe3.cxx +++ b/sd/source/ui/view/viewshe3.cxx @@ -37,7 +37,6 @@ #include <fupoor.hxx> #include <sfx2/dispatch.hxx> -#include <svx/prtqry.hxx> #include <svx/svdopage.hxx> #include <sfx2/progress.hxx> #include <svx/svdobj.hxx> diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index d721b72438a8..e4c8ab9afe4a 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -229,7 +229,6 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/doc/oleprops \ sfx2/source/doc/ownsubfilterservice \ sfx2/source/doc/printhelper \ - sfx2/source/doc/querytemplate \ sfx2/source/doc/docundomanager \ sfx2/source/doc/sfxbasemodel \ sfx2/source/doc/sfxmodelfactory \ diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 021315b53678..524b07a2e2d6 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -25,7 +25,7 @@ #include <com/sun/star/document/UpdateDocMode.hpp> #include <com/sun/star/embed/ElementModes.hpp> #include <comphelper/fileurl.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <svl/style.hxx> #include <vcl/wrkwin.hxx> @@ -72,8 +72,8 @@ #include <sfx2/docfile.hxx> #include <sfx2/request.hxx> #include <openflag.hxx> -#include "querytemplate.hxx" #include <memory> +#include <helpids.h> #include <LibreOfficeKit/LibreOfficeKitTypes.h> @@ -362,6 +362,25 @@ sfx2::StyleManager* SfxObjectShell::GetStyleManager() return nullptr; } +namespace +{ + class QueryTemplateBox + { + private: + std::unique_ptr<weld::MessageDialog> m_xQueryBox; + public: + QueryTemplateBox(weld::Window* pParent, const OUString& rMessage) + : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, VclButtonsType::NONE, rMessage)) + { + m_xQueryBox->add_button(SfxResId(STR_QRYTEMPL_UPDATE_BTN), RET_YES); + m_xQueryBox->add_button(SfxResId(STR_QRYTEMPL_KEEP_BTN), RET_NO); + m_xQueryBox->set_default_response(RET_YES); + m_xQueryBox->set_help_id(HID_QUERY_LOAD_TEMPLATE); + } + short run() { return m_xQueryBox->run(); } + }; +} + void SfxObjectShell::UpdateFromTemplate_Impl( ) /* [Description] @@ -466,8 +485,9 @@ void SfxObjectShell::UpdateFromTemplate_Impl( ) else if ( bCanUpdateFromTemplate == document::UpdateDocMode::ACCORDING_TO_CONFIG ) { const OUString sMessage( SfxResId(STR_QRYTEMPL_MESSAGE).replaceAll( "$(ARG1)", aTemplName ) ); - ScopedVclPtrInstance< sfx2::QueryTemplateBox > aBox(GetDialogParent(), sMessage); - if ( RET_YES == aBox->Execute() ) + vcl::Window *pWin = GetDialogParent(); + QueryTemplateBox aBox(pWin ? pWin->GetFrameWeld() : nullptr, sMessage); + if (RET_YES == aBox.run()) bLoad = true; } diff --git a/sfx2/source/doc/querytemplate.cxx b/sfx2/source/doc/querytemplate.cxx deleted file mode 100644 index bc9ff49bf977..000000000000 --- a/sfx2/source/doc/querytemplate.cxx +++ /dev/null @@ -1,43 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include "querytemplate.hxx" -#include <sfx2/sfxresid.hxx> -#include <sfx2/strings.hrc> -#include <helpids.h> -#include <vcl/svapp.hxx> - -namespace sfx2 -{ - -QueryTemplateBox::QueryTemplateBox( vcl::Window* pParent, const OUString& rMessage ) : - MessBox ( pParent, MessBoxStyle::NONE, 0, Application::GetDisplayName(), rMessage ) -{ - SetImage(GetStandardQueryBoxImage()); - SetHelpId( HID_QUERY_LOAD_TEMPLATE ); - - AddButton( SfxResId( STR_QRYTEMPL_UPDATE_BTN ), RET_YES, - ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus ); - AddButton( SfxResId(STR_QRYTEMPL_KEEP_BTN), RET_NO, ButtonDialogFlags::Cancel ); -} - -} // end of namespace sfx2 - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/doc/querytemplate.hxx b/sfx2/source/doc/querytemplate.hxx deleted file mode 100644 index 8c7411d5db39..000000000000 --- a/sfx2/source/doc/querytemplate.hxx +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SFX2_SOURCE_DOC_QUERYTEMPLATE_HXX -#define INCLUDED_SFX2_SOURCE_DOC_QUERYTEMPLATE_HXX - -#include <vcl/msgbox.hxx> - -namespace sfx2 -{ - - class QueryTemplateBox : public MessBox - { - public: - QueryTemplateBox( vcl::Window* pParent, const OUString& rMessage ); - }; - -} // end of namespace sfx2 - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist index a0be17a89a7b..5b7ca947e375 100644 --- a/solenv/clang-format/blacklist +++ b/solenv/clang-format/blacklist @@ -7354,7 +7354,6 @@ include/svx/passwd.hxx include/svx/polygn3d.hxx include/svx/polypolygoneditor.hxx include/svx/postattr.hxx -include/svx/prtqry.hxx include/svx/pszctrl.hxx include/svx/rectenum.hxx include/svx/relfld.hxx diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk index ad1b1dc3a423..3c374744b314 100644 --- a/svx/Library_svx.mk +++ b/svx/Library_svx.mk @@ -143,7 +143,6 @@ $(eval $(call gb_Library_add_exception_objects,svx,\ svx/source/dialog/pagectrl \ svx/source/dialog/paraprev \ svx/source/dialog/passwd \ - svx/source/dialog/prtqry \ svx/source/dialog/relfld \ svx/source/dialog/rlrcitem \ svx/source/dialog/rubydialog \ diff --git a/svx/source/dialog/prtqry.cxx b/svx/source/dialog/prtqry.cxx deleted file mode 100644 index 6be88dff8c31..000000000000 --- a/svx/source/dialog/prtqry.cxx +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include <svx/strings.hrc> -#include <svx/prtqry.hxx> -#include <svx/dialmgr.hxx> - -SvxPrtQryBox::SvxPrtQryBox(vcl::Window* pParent) : - MessBox(pParent, MessBoxStyle::NONE, 0, - SvxResId(RID_SVXSTR_QRY_PRINT_TITLE), - SvxResId(RID_SVXSTR_QRY_PRINT_MSG)) -{ - SetImage(GetStandardQueryBoxImage()); - - AddButton(SvxResId(RID_SVXSTR_QRY_PRINT_SELECTION), RET_OK, - ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus); - - AddButton(SvxResId(RID_SVXSTR_QRY_PRINT_ALL), 2); - AddButton(StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel); - SetButtonHelpText( RET_OK, OUString() ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx index 9c4b94c53c2b..cb52705363cb 100644 --- a/sw/source/uibase/uiview/viewprt.cxx +++ b/sw/source/uibase/uiview/viewprt.cxx @@ -30,7 +30,8 @@ #include <editeng/paperinf.hxx> #include <sfx2/dispatch.hxx> #include <unotools/misccfg.hxx> -#include <svx/prtqry.hxx> +#include <svx/dialmgr.hxx> +#include <svx/strings.hrc> #include <svx/svdview.hxx> #include <svl/eitem.hxx> #include <svl/stritem.hxx> @@ -146,6 +147,27 @@ bool SwView::HasPrintOptionsPage() const return true; } +namespace +{ + class SvxPrtQryBox + { + private: + std::unique_ptr<weld::MessageDialog> m_xQueryBox; + public: + SvxPrtQryBox(weld::Window* pParent) + : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, VclButtonsType::NONE, SvxResId(RID_SVXSTR_QRY_PRINT_MSG))) + { + m_xQueryBox->set_title(SvxResId(RID_SVXSTR_QRY_PRINT_TITLE)); + + m_xQueryBox->add_button(SvxResId(RID_SVXSTR_QRY_PRINT_SELECTION), RET_OK); + m_xQueryBox->add_button(SvxResId(RID_SVXSTR_QRY_PRINT_ALL), 2); + m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL); + m_xQueryBox->set_default_response(RET_OK); + } + short run() { return m_xQueryBox->run(); } + }; +} + // TabPage for application-specific print options VclPtr<SfxTabPage> SwView::CreatePrintOptionsPage(vcl::Window* pParent, @@ -223,7 +245,8 @@ void SwView::ExecutePrint(SfxRequest& rReq) { if( pSh->IsSelection() || pSh->IsFrameSelected() || pSh->IsObjSelected() ) { - short nBtn = ScopedVclPtrInstance<SvxPrtQryBox>(&GetEditWin())->Execute(); + SvxPrtQryBox aBox(GetEditWin().GetFrameWeld()); + short nBtn = aBox.run(); if( RET_CANCEL == nBtn ) return; diff --git a/uui/source/alreadyopen.cxx b/uui/source/alreadyopen.cxx index 6a5660fda6b7..9f94e22dc49a 100644 --- a/uui/source/alreadyopen.cxx +++ b/uui/source/alreadyopen.cxx @@ -20,35 +20,25 @@ #include <strings.hrc> #include "alreadyopen.hxx" #include <unotools/resmgr.hxx> +#include <vcl/button.hxx> +#include <vcl/svapp.hxx> -AlreadyOpenQueryBox::AlreadyOpenQueryBox( vcl::Window* pParent, const std::locale& rLocale, const OUString& aMessage, bool bIsStoring ) : - MessBox(pParent, MessBoxStyle::NONE, 0, - Translate::get(STR_ALREADYOPEN_TITLE, rLocale), - aMessage ) +AlreadyOpenQueryBox::AlreadyOpenQueryBox(weld::Window* pParent, const std::locale& rLocale, const OUString& rMessage, bool bIsStoring) + : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, VclButtonsType::NONE, rMessage)) { - SetImage(GetStandardQueryBoxImage()); - - if ( bIsStoring ) + m_xQueryBox->set_title(Translate::get(STR_ALREADYOPEN_TITLE, rLocale)); + if (bIsStoring) { - AddButton( Translate::get(STR_ALREADYOPEN_RETRY_SAVE_BTN, rLocale), RET_YES, - ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus ); - AddButton( Translate::get(STR_ALREADYOPEN_SAVE_BTN, rLocale), RET_NO); - AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel ); + m_xQueryBox->add_button(Translate::get(STR_ALREADYOPEN_RETRY_SAVE_BTN, rLocale), RET_YES); + m_xQueryBox->add_button(Translate::get(STR_ALREADYOPEN_SAVE_BTN, rLocale), RET_NO); } else { - AddButton( Translate::get(STR_ALREADYOPEN_READONLY_BTN, rLocale), RET_YES, - ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus ); - AddButton( Translate::get(STR_ALREADYOPEN_OPEN_BTN, rLocale), RET_NO); - AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel ); + m_xQueryBox->add_button(Translate::get(STR_ALREADYOPEN_READONLY_BTN, rLocale), RET_YES); + m_xQueryBox->add_button(Translate::get(STR_ALREADYOPEN_OPEN_BTN, rLocale), RET_NO); } - - SetButtonHelpText( RET_YES, OUString() ); - SetButtonHelpText( RET_NO, OUString() ); -} - -AlreadyOpenQueryBox::~AlreadyOpenQueryBox() -{ + m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL); + m_xQueryBox->set_default_response(RET_YES); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uui/source/alreadyopen.hxx b/uui/source/alreadyopen.hxx index 809044bc120e..3d6e5a8fab80 100644 --- a/uui/source/alreadyopen.hxx +++ b/uui/source/alreadyopen.hxx @@ -19,13 +19,15 @@ #ifndef INCLUDED_UUI_SOURCE_ALREADYOPEN_HXX #define INCLUDED_UUI_SOURCE_ALREADYOPEN_HXX -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> -class AlreadyOpenQueryBox : public MessBox +class AlreadyOpenQueryBox { +private: + std::unique_ptr<weld::MessageDialog> m_xQueryBox; public: - AlreadyOpenQueryBox( vcl::Window* pParent, const std::locale& rResLocale, const OUString& aMessage, bool bIsStoring ); - virtual ~AlreadyOpenQueryBox() override; + AlreadyOpenQueryBox(weld::Window* pParent, const std::locale& rResLocale, const OUString& aMessage, bool bIsStoring); + short run() { return m_xQueryBox->run(); } }; #endif diff --git a/uui/source/filechanged.cxx b/uui/source/filechanged.cxx index 54917bb1bb2a..0c0b5d53dcc9 100644 --- a/uui/source/filechanged.cxx +++ b/uui/source/filechanged.cxx @@ -19,25 +19,18 @@ #include <strings.hrc> #include <unotools/resmgr.hxx> +#include <vcl/button.hxx> +#include <vcl/svapp.hxx> #include "filechanged.hxx" -FileChangedQueryBox::FileChangedQueryBox( vcl::Window* pParent, const std::locale& rLocale ) : - MessBox(pParent, MessBoxStyle::NONE, 0, - Translate::get(STR_FILECHANGED_TITLE, rLocale), - OUString() ) -{ - SetImage(GetStandardQueryBoxImage()); - - AddButton(Translate::get(STR_FILECHANGED_SAVEANYWAY_BTN, rLocale), RET_YES, - ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus); - AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel ); - - SetButtonHelpText( RET_YES, OUString() ); - SetMessText(Translate::get(STR_FILECHANGED_MSG, rLocale)); -} - -FileChangedQueryBox::~FileChangedQueryBox() +FileChangedQueryBox::FileChangedQueryBox(weld::Window* pParent, const std::locale& rLocale) + : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, + VclButtonsType::NONE, Translate::get(STR_FILECHANGED_MSG, rLocale))) { + m_xQueryBox->set_title(Translate::get(STR_FILECHANGED_TITLE, rLocale)); + m_xQueryBox->add_button(Translate::get(STR_FILECHANGED_SAVEANYWAY_BTN, rLocale), RET_YES); + m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL); + m_xQueryBox->set_default_response(RET_YES); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uui/source/filechanged.hxx b/uui/source/filechanged.hxx index f15e1ced340d..6e73d17407ab 100644 --- a/uui/source/filechanged.hxx +++ b/uui/source/filechanged.hxx @@ -19,13 +19,15 @@ #ifndef INCLUDED_UUI_SOURCE_FILECHANGED_HXX #define INCLUDED_UUI_SOURCE_FILECHANGED_HXX -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> -class FileChangedQueryBox : public MessBox +class FileChangedQueryBox { +private: + std::unique_ptr<weld::MessageDialog> m_xQueryBox; public: - FileChangedQueryBox( vcl::Window* pParent, const std::locale& pResLocale ); - virtual ~FileChangedQueryBox() override; + FileChangedQueryBox(weld::Window* pParent, const std::locale& pResLocale); + short run() { return m_xQueryBox->run(); } }; #endif diff --git a/uui/source/iahndl-locking.cxx b/uui/source/iahndl-locking.cxx index ecd49ea55baf..d52142da4667 100644 --- a/uui/source/iahndl-locking.cxx +++ b/uui/source/iahndl-locking.cxx @@ -57,7 +57,7 @@ namespace { void handleLockedDocumentRequest_( - vcl::Window * pParent, + weld::Window * pParent, const OUString& aDocumentURL, const OUString& aInfo, uno::Sequence< uno::Reference< task::XInteractionContinuation > > const & @@ -96,8 +96,8 @@ handleLockedDocumentRequest_( aMessage = UUIInteractionHelper::replaceMessageWithArguments( aMessage, aArguments ); - ScopedVclPtrInstance< OpenLockedQueryBox > xDialog(pParent, aResLocale, aMessage, xRetry.is()); - nResult = xDialog->Execute(); + OpenLockedQueryBox aDialog(pParent, aResLocale, aMessage, xRetry.is()); + nResult = aDialog.run(); } else if ( nMode == UUI_DOC_SAVE_LOCK ) { @@ -110,8 +110,8 @@ handleLockedDocumentRequest_( aMessage = UUIInteractionHelper::replaceMessageWithArguments( aMessage, aArguments ); - ScopedVclPtrInstance< TryLaterQueryBox > xDialog(pParent, aResLocale, aMessage, xRetry.is()); - nResult = xDialog->Execute(); + TryLaterQueryBox aDialog(pParent, aResLocale, aMessage, xRetry.is()); + nResult = aDialog.run(); } else if ( nMode == UUI_DOC_OWN_LOAD_LOCK || nMode == UUI_DOC_OWN_SAVE_LOCK ) @@ -124,11 +124,8 @@ handleLockedDocumentRequest_( aMessage = UUIInteractionHelper::replaceMessageWithArguments( aMessage, aArguments ); - ScopedVclPtrInstance< AlreadyOpenQueryBox > xDialog( pParent, - aResLocale, - aMessage, - nMode == UUI_DOC_OWN_SAVE_LOCK ); - nResult = xDialog->Execute(); + AlreadyOpenQueryBox aDialog(pParent, aResLocale, aMessage, nMode == UUI_DOC_OWN_SAVE_LOCK); + nResult = aDialog.run(); } if ( nResult == RET_YES ) @@ -148,7 +145,7 @@ handleLockedDocumentRequest_( void handleChangedByOthersRequest_( - vcl::Window * pParent, + weld::Window * pParent, uno::Sequence< uno::Reference< task::XInteractionContinuation > > const & rContinuations ) { @@ -163,8 +160,8 @@ handleChangedByOthersRequest_( { SolarMutexGuard aGuard; std::locale aResLocale = Translate::Create("uui"); - ScopedVclPtrInstance< FileChangedQueryBox > xDialog(pParent, aResLocale); - sal_Int32 nResult = xDialog->Execute(); + FileChangedQueryBox aDialog(pParent, aResLocale); + sal_Int32 nResult = aDialog.run(); if ( nResult == RET_YES ) xApprove->select(); @@ -184,7 +181,7 @@ const sal_uInt16 UUI_DOC_CorruptErrDlg = 1; void handleLockFileProblemRequest_( - vcl::Window * pParent, + weld::Window * pParent, uno::Sequence< uno::Reference< task::XInteractionContinuation > > const & rContinuations, sal_uInt16 nWhichDlg ) { @@ -204,13 +201,13 @@ handleLockFileProblemRequest_( if (nWhichDlg == UUI_DOC_CreateErrDlg) { - ScopedVclPtrInstance< LockFailedQueryBox > xDialog(pParent, aResLocale); - nResult = xDialog->Execute(); + LockFailedQueryBox aDialog(pParent, aResLocale); + nResult = aDialog.run(); } else { - ScopedVclPtrInstance< LockCorruptQueryBox > xDialog(pParent, aResLocale); - nResult = xDialog->Execute(); + LockCorruptQueryBox aDialog(pParent, aResLocale); + nResult = aDialog.run(); } if ( nResult == RET_OK ) @@ -235,7 +232,8 @@ UUIInteractionHelper::handleLockedDocumentRequest( document::LockedDocumentRequest aLockedDocumentRequest; if (aAnyRequest >>= aLockedDocumentRequest ) { - handleLockedDocumentRequest_( getParentProperty(), + vcl::Window* pWin = getParentProperty(); + handleLockedDocumentRequest_( pWin ? pWin->GetFrameWeld() : nullptr, aLockedDocumentRequest.DocumentURL, aLockedDocumentRequest.UserInfo, rRequest->getContinuations(), @@ -246,7 +244,8 @@ UUIInteractionHelper::handleLockedDocumentRequest( document::OwnLockOnDocumentRequest aOwnLockOnDocumentRequest; if (aAnyRequest >>= aOwnLockOnDocumentRequest ) { - handleLockedDocumentRequest_( getParentProperty(), + vcl::Window* pWin = getParentProperty(); + handleLockedDocumentRequest_( pWin ? pWin->GetFrameWeld() : nullptr, aOwnLockOnDocumentRequest.DocumentURL, aOwnLockOnDocumentRequest.TimeInfo, rRequest->getContinuations(), @@ -259,7 +258,8 @@ UUIInteractionHelper::handleLockedDocumentRequest( document::LockedOnSavingRequest aLockedOnSavingRequest; if (aAnyRequest >>= aLockedOnSavingRequest ) { - handleLockedDocumentRequest_( getParentProperty(), + vcl::Window* pWin = getParentProperty(); + handleLockedDocumentRequest_( pWin ? pWin->GetFrameWeld() : nullptr, aLockedOnSavingRequest.DocumentURL, aLockedOnSavingRequest.UserInfo, rRequest->getContinuations(), @@ -278,7 +278,8 @@ UUIInteractionHelper::handleChangedByOthersRequest( document::ChangedByOthersRequest aChangedByOthersRequest; if (aAnyRequest >>= aChangedByOthersRequest ) { - handleChangedByOthersRequest_( getParentProperty(), + vcl::Window* pWin = getParentProperty(); + handleChangedByOthersRequest_( pWin ? pWin->GetFrameWeld() : nullptr, rRequest->getContinuations() ); return true; } @@ -295,7 +296,8 @@ UUIInteractionHelper::handleLockFileProblemRequest( document::LockFileIgnoreRequest aLockFileIgnoreRequest; if (aAnyRequest >>= aLockFileIgnoreRequest ) { - handleLockFileProblemRequest_( getParentProperty(), + vcl::Window* pWin = getParentProperty(); + handleLockFileProblemRequest_( pWin ? pWin->GetFrameWeld() : nullptr, rRequest->getContinuations(), UUI_DOC_CreateErrDlg ); return true; } @@ -303,7 +305,8 @@ UUIInteractionHelper::handleLockFileProblemRequest( document::LockFileCorruptRequest aLockFileCorruptRequest; if (aAnyRequest >>= aLockFileCorruptRequest ) { - handleLockFileProblemRequest_( getParentProperty(), + vcl::Window* pWin = getParentProperty(); + handleLockFileProblemRequest_( pWin ? pWin->GetFrameWeld() : nullptr, rRequest->getContinuations(), UUI_DOC_CorruptErrDlg ); return true; } diff --git a/uui/source/lockcorrupt.cxx b/uui/source/lockcorrupt.cxx index ce6a3545d13e..bba82db1db3f 100644 --- a/uui/source/lockcorrupt.cxx +++ b/uui/source/lockcorrupt.cxx @@ -22,22 +22,16 @@ #include "lockcorrupt.hxx" #include <unotools/resmgr.hxx> #include <vcl/button.hxx> +#include <vcl/svapp.hxx> -LockCorruptQueryBox::LockCorruptQueryBox(vcl::Window* pParent, const std::locale& rResLocale) - : MessBox(pParent, MessBoxStyle::NONE, 0, Translate::get(STR_LOCKCORRUPT_TITLE, rResLocale), OUString()) -{ - SetImage(GetStandardErrorBoxImage()); - - AddButton(Translate::get(STR_LOCKCORRUPT_OPENREADONLY_BTN, rResLocale), RET_OK, - ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus); - - AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel ); - - SetMessText(Translate::get(STR_LOCKCORRUPT_MSG, rResLocale)); -} - -LockCorruptQueryBox::~LockCorruptQueryBox() +LockCorruptQueryBox::LockCorruptQueryBox(weld::Window* pParent, const std::locale& rResLocale) + : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, + VclButtonsType::NONE, Translate::get(STR_LOCKCORRUPT_MSG, rResLocale))) { + m_xQueryBox->set_title(Translate::get(STR_LOCKCORRUPT_MSG, rResLocale)); + m_xQueryBox->add_button(Translate::get(STR_LOCKCORRUPT_OPENREADONLY_BTN, rResLocale), RET_OK); + m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL); + m_xQueryBox->set_default_response(RET_OK); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uui/source/lockcorrupt.hxx b/uui/source/lockcorrupt.hxx index 425117144e14..3d6a13f50658 100644 --- a/uui/source/lockcorrupt.hxx +++ b/uui/source/lockcorrupt.hxx @@ -19,13 +19,15 @@ #ifndef INCLUDED_UUI_SOURCE_LOCKCORRUPT_HXX #define INCLUDED_UUI_SOURCE_LOCKCORRUPT_HXX -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> -class LockCorruptQueryBox : public MessBox +class LockCorruptQueryBox { +private: + std::unique_ptr<weld::MessageDialog> m_xQueryBox; public: - LockCorruptQueryBox(vcl::Window* pParent, const std::locale& rResLocale); - virtual ~LockCorruptQueryBox() override; + LockCorruptQueryBox(weld::Window* pParent, const std::locale& rResLocale); + short run() { return m_xQueryBox->run(); } }; #endif diff --git a/uui/source/lockfailed.cxx b/uui/source/lockfailed.cxx index 51266f0b3420..0f2167294f21 100644 --- a/uui/source/lockfailed.cxx +++ b/uui/source/lockfailed.cxx @@ -21,22 +21,16 @@ #include "lockfailed.hxx" #include <unotools/resmgr.hxx> #include <vcl/button.hxx> +#include <vcl/svapp.hxx> -LockFailedQueryBox::LockFailedQueryBox(vcl::Window* pParent, const std::locale& rResLocale) - : MessBox(pParent, MessBoxStyle::NONE, 0, Translate::get(STR_LOCKFAILED_TITLE, rResLocale), OUString()) -{ - SetImage(GetStandardErrorBoxImage()); - - AddButton(Translate::get(STR_LOCKFAILED_OPENREADONLY_BTN, rResLocale), RET_OK, - ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus); - - AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel ); - - SetMessText(Translate::get(STR_LOCKFAILED_MSG, rResLocale)); -} - -LockFailedQueryBox::~LockFailedQueryBox() +LockFailedQueryBox::LockFailedQueryBox(weld::Window* pParent, const std::locale& rLocale) + : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Error, + VclButtonsType::NONE, Translate::get(STR_LOCKFAILED_MSG, rLocale))) { + m_xQueryBox->set_title(Translate::get(STR_LOCKFAILED_TITLE, rLocale)); + m_xQueryBox->add_button(Translate::get(STR_LOCKFAILED_OPENREADONLY_BTN, rLocale), RET_OK); + m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL); + m_xQueryBox->set_default_response(RET_OK); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uui/source/lockfailed.hxx b/uui/source/lockfailed.hxx index 5cf9ceda1ee7..62ac5f8528dc 100644 --- a/uui/source/lockfailed.hxx +++ b/uui/source/lockfailed.hxx @@ -19,13 +19,15 @@ #ifndef INCLUDED_UUI_SOURCE_LOCKFAILED_HXX #define INCLUDED_UUI_SOURCE_LOCKFAILED_HXX -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> -class LockFailedQueryBox : public MessBox +class LockFailedQueryBox { +private: + std::unique_ptr<weld::MessageDialog> m_xQueryBox; public: - LockFailedQueryBox(vcl::Window* pParent, const std::locale& rResLocale); - virtual ~LockFailedQueryBox() override; + LockFailedQueryBox(weld::Window* pParent, const std::locale& rResLocale); + short run() { return m_xQueryBox->run(); } }; #endif diff --git a/uui/source/openlocked.cxx b/uui/source/openlocked.cxx index 81d8b896477e..453067f8e3ae 100644 --- a/uui/source/openlocked.cxx +++ b/uui/source/openlocked.cxx @@ -20,34 +20,21 @@ #include <strings.hrc> #include "openlocked.hxx" #include <unotools/resmgr.hxx> +#include <vcl/button.hxx> +#include <vcl/svapp.hxx> -OpenLockedQueryBox::OpenLockedQueryBox( vcl::Window* pParent, const std::locale& rResLocale, const OUString& aMessage, bool bEnableOverride ) : - MessBox(pParent, MessBoxStyle::NONE, 0, - Translate::get(STR_OPENLOCKED_TITLE, rResLocale), - aMessage ) +OpenLockedQueryBox::OpenLockedQueryBox(weld::Window* pParent, const std::locale& rResLocale, const OUString& rMessage, bool bEnableOverride) + : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, VclButtonsType::NONE, rMessage)) { - SetImage(GetStandardQueryBoxImage()); - - AddButton(Translate::get(STR_OPENLOCKED_OPENREADONLY_BTN, rResLocale), RET_YES, - ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus); - SetButtonHelpText(RET_YES, OUString()); - - AddButton(Translate::get(STR_OPENLOCKED_OPENCOPY_BTN, rResLocale), RET_NO); - SetButtonHelpText(RET_NO, OUString()); - + m_xQueryBox->set_title(Translate::get(STR_OPENLOCKED_TITLE, rResLocale)); + m_xQueryBox->add_button(Translate::get(STR_OPENLOCKED_OPENREADONLY_BTN, rResLocale), RET_YES); + m_xQueryBox->add_button(Translate::get(STR_OPENLOCKED_OPENCOPY_BTN, rResLocale), RET_NO); if (bEnableOverride) { // Present option to ignore the (stale?) lock file and open the document - AddButton(Translate::get(STR_ALREADYOPEN_OPEN_BTN, rResLocale), RET_IGNORE); - SetButtonHelpText(RET_IGNORE, OUString()); + m_xQueryBox->add_button(Translate::get(STR_ALREADYOPEN_OPEN_BTN, rResLocale), RET_IGNORE); } - - AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel ); + m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL); } -OpenLockedQueryBox::~OpenLockedQueryBox() -{ -} - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uui/source/openlocked.hxx b/uui/source/openlocked.hxx index bb80a3c64146..c4835c8c1314 100644 --- a/uui/source/openlocked.hxx +++ b/uui/source/openlocked.hxx @@ -19,13 +19,15 @@ #ifndef INCLUDED_UUI_SOURCE_OPENLOCKED_HXX #define INCLUDED_UUI_SOURCE_OPENLOCKED_HXX -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> -class OpenLockedQueryBox : public MessBox +class OpenLockedQueryBox { +private: + std::unique_ptr<weld::MessageDialog> m_xQueryBox; public: - OpenLockedQueryBox(vcl::Window* pParent, const std::locale& rResLocale, const OUString& rMessage, bool bEnableOverride); - virtual ~OpenLockedQueryBox() override; + OpenLockedQueryBox(weld::Window* pParent, const std::locale& rResLocale, const OUString& rMessage, bool bEnableOverride); + short run() { return m_xQueryBox->run(); } }; #endif diff --git a/uui/source/trylater.cxx b/uui/source/trylater.cxx index cacc68bc7d7c..242c1fa7bb22 100644 --- a/uui/source/trylater.cxx +++ b/uui/source/trylater.cxx @@ -18,41 +18,32 @@ */ #include <unotools/resmgr.hxx> +#include <vcl/button.hxx> +#include <vcl/svapp.hxx> #include <strings.hrc> #include "trylater.hxx" -TryLaterQueryBox::TryLaterQueryBox(vcl::Window* pParent, const std::locale& rResLocale, const OUString& aMessage, bool bEnableOverride) - : MessBox(pParent, MessBoxStyle::NONE, 0, Translate::get(STR_TRYLATER_TITLE, rResLocale), aMessage) +TryLaterQueryBox::TryLaterQueryBox(weld::Window* pParent, const std::locale& rResLocale, const OUString& rMessage, bool bEnableOverride) + : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, VclButtonsType::NONE, rMessage)) { - SetImage(GetStandardQueryBoxImage()); + m_xQueryBox->set_title(Translate::get(STR_TRYLATER_TITLE, rResLocale)); // Currently we don't have the retry/save-as functionality implemented for cases when file is locked. // So threat them mutually exclusive with overwrite here. TODO/LATER: just add the overwrite option // as third option when retrying and saving with another name would be possible along with overwriting if (bEnableOverride) { - AddButton(Translate::get(STR_FILECHANGED_SAVEANYWAY_BTN, rResLocale), RET_IGNORE, - ButtonDialogFlags::OK); - AddButton(StandardButtonType::Cancel, RET_CANCEL, - ButtonDialogFlags::Default | ButtonDialogFlags::Cancel | ButtonDialogFlags::Focus); - - SetButtonHelpText(RET_IGNORE, OUString()); + m_xQueryBox->add_button(Translate::get(STR_FILECHANGED_SAVEANYWAY_BTN, rResLocale), RET_IGNORE); + m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL); + m_xQueryBox->set_default_response(RET_IGNORE); } else { - AddButton(Translate::get(STR_TRYLATER_RETRYSAVING_BTN, rResLocale), RET_YES, - ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus); - AddButton(Translate::get(STR_TRYLATER_SAVEAS_BTN, rResLocale), RET_NO); - AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel ); - - SetButtonHelpText( RET_YES, OUString() ); - SetButtonHelpText( RET_NO, OUString() ); + m_xQueryBox->add_button(Translate::get(STR_TRYLATER_RETRYSAVING_BTN, rResLocale), RET_YES); + m_xQueryBox->add_button(Translate::get(STR_TRYLATER_SAVEAS_BTN, rResLocale), RET_NO); + m_xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL); + m_xQueryBox->set_default_response(RET_YES); } } -TryLaterQueryBox::~TryLaterQueryBox() -{ -} - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uui/source/trylater.hxx b/uui/source/trylater.hxx index f03f3cf92187..26b1d6714b9c 100644 --- a/uui/source/trylater.hxx +++ b/uui/source/trylater.hxx @@ -19,13 +19,15 @@ #ifndef INCLUDED_UUI_SOURCE_TRYLATER_HXX #define INCLUDED_UUI_SOURCE_TRYLATER_HXX -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> -class TryLaterQueryBox : public MessBox +class TryLaterQueryBox { +private: + std::unique_ptr<weld::MessageDialog> m_xQueryBox; public: - TryLaterQueryBox(vcl::Window* pParent, const std::locale& rLocale, const OUString& aMessage, bool bEnableOverride); - virtual ~TryLaterQueryBox() override; + TryLaterQueryBox(weld::Window* pParent, const std::locale& rLocale, const OUString& aMessage, bool bEnableOverride); + short run() { return m_xQueryBox->run(); } }; #endif diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 46755b48b07c..d2f648a696c1 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -258,6 +258,11 @@ public: return m_xWidget->get_id().toUtf8(); } + virtual void set_help_id(const OString& rId) override + { + return m_xWidget->SetHelpId(rId); + } + virtual OString get_help_id() const override { return m_xWidget->GetHelpId(); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index feec34bf58ea..e31606fffbad 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -1158,6 +1158,12 @@ class GtkInstanceBuilder; namespace { + void set_help_id(const GtkWidget *pWidget, const OString& rHelpId) + { + gchar *helpid = g_strdup(rHelpId.getStr()); + g_object_set_data_full(G_OBJECT(pWidget), "helpid", helpid, g_free); + } + OString get_help_id(const GtkWidget *pWidget) { void* pData = g_object_get_data(G_OBJECT(pWidget), "helpid"); @@ -1274,6 +1280,11 @@ public: return OString(pStr, pStr ? strlen(pStr) : 0); } + virtual void set_help_id(const OString& rHelpId) override + { + ::set_help_id(m_pWidget, rHelpId); + } + virtual OString get_help_id() const override { OString sRet = ::get_help_id(m_pWidget); @@ -2462,8 +2473,7 @@ namespace if (!nLen) return; OString sHelpId = *pHelpRoot + OString(pStr, nLen); - gchar *helpid = g_strdup(sHelpId.getStr()); - g_object_set_data_full(pObject, "helpid", helpid, g_free); + set_help_id(pWidget, sHelpId); //hook up for extended help const ImplSVData* pSVData = ImplGetSVData(); if (pSVData->maHelpData.mbBalloonHelp) |