diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-02-26 16:53:37 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-02-27 11:22:49 +0100 |
commit | 082e69fefb7439fd4f3d543f0c402039e94c1e9c (patch) | |
tree | 8348cacdc54a15dae722b93fc198995756924fc0 /sfx2 | |
parent | f41a08183504a59d6ffc7a00ed7f24e6b19995ab (diff) |
convert various MessBox to weld::MessageDialog
Change-Id: I4d2d0393c753114aeb9bb7e646dfdc810f6caa38
Reviewed-on: https://gerrit.libreoffice.org/50398
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/Library_sfx.mk | 1 | ||||
-rw-r--r-- | sfx2/source/doc/objcont.cxx | 28 | ||||
-rw-r--r-- | sfx2/source/doc/querytemplate.cxx | 43 | ||||
-rw-r--r-- | sfx2/source/doc/querytemplate.hxx | 37 |
4 files changed, 24 insertions, 85 deletions
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: */ |