diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-04-09 15:29:24 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-04-09 21:17:03 +0200 |
commit | 9b6545773605c421a9266fcffca95d21131f5ada (patch) | |
tree | eb4a184c87ec58738054f58c0fb6f9208d53278f | |
parent | 6c6046a83e0285f4c4303ee8a049759113dac16d (diff) |
remove vcl/waitobj.hxx
create vcl/locktoplevels.hxx for the utility to set all
toplevel windows modally locked
Change-Id: I964484d238852e830e1e5c0b86b3bebb3b41a6b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113889
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | basctl/source/basicide/baside2.cxx | 2 | ||||
-rw-r--r-- | compilerplugins/clang/unusedvariableplus.cxx | 1 | ||||
-rw-r--r-- | cui/source/dialogs/hlmarkwn.cxx | 2 | ||||
-rw-r--r-- | cui/source/inc/hltpbase.hxx | 2 | ||||
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_dialog2.hxx | 6 | ||||
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_service.cxx | 1 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltersettingsdialog.hxx | 2 | ||||
-rw-r--r-- | include/vcl/locktoplevels.hxx | 38 | ||||
-rw-r--r-- | include/vcl/waitobj.hxx | 54 | ||||
-rw-r--r-- | sfx2/source/appl/sfxhelp.cxx | 2 | ||||
-rw-r--r-- | solenv/clang-format/excludelist | 1 | ||||
-rw-r--r-- | vcl/source/window/dialog.cxx | 29 | ||||
-rw-r--r-- | vcl/source/window/window3.cxx | 14 |
13 files changed, 73 insertions, 81 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 6cabab5df38d..bebbe643874c 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -55,7 +55,7 @@ #include <svl/whiter.hxx> #include <svx/svxids.hrc> #include <tools/debug.hxx> -#include <vcl/waitobj.hxx> +#include <vcl/locktoplevels.hxx> #include <vcl/errinf.hxx> #include <vcl/event.hxx> #include <vcl/print.hxx> diff --git a/compilerplugins/clang/unusedvariableplus.cxx b/compilerplugins/clang/unusedvariableplus.cxx index 596dc7978f8a..b5c92082c400 100644 --- a/compilerplugins/clang/unusedvariableplus.cxx +++ b/compilerplugins/clang/unusedvariableplus.cxx @@ -438,7 +438,6 @@ public: "webdav_ucp::NeonHeadRequest", "webdav_ucp::NeonPropFindRequest", "webdav_ucp::NeonUri", - "WaitObject", "weld::WaitObject", "writerfilter::ooxml::(anonymous namespace)::StatusIndicatorGuard", "WriterSpecificAutoFormatBlock", diff --git a/cui/source/dialogs/hlmarkwn.cxx b/cui/source/dialogs/hlmarkwn.cxx index 1f6a85494e82..42445b383a51 100644 --- a/cui/source/dialogs/hlmarkwn.cxx +++ b/cui/source/dialogs/hlmarkwn.cxx @@ -39,6 +39,8 @@ #include <hltpbase.hxx> #include <hlmarkwn_def.hxx> +#include <stack> + using namespace ::com::sun::star; namespace { diff --git a/cui/source/inc/hltpbase.hxx b/cui/source/inc/hltpbase.hxx index 00cda67f9d02..2ad0007c83cb 100644 --- a/cui/source/inc/hltpbase.hxx +++ b/cui/source/inc/hltpbase.hxx @@ -23,7 +23,7 @@ #include <sfx2/dispatch.hxx> #include <svtools/inettbc.hxx> #include <vcl/timer.hxx> -#include <vcl/waitobj.hxx> +#include <vcl/locktoplevels.hxx> #include <com/sun/star/frame/XFrame.hpp> #include <svx/hlnkitem.hxx> diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index fe0a953dc213..40faf4548313 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -21,7 +21,7 @@ #include <vcl/timer.hxx> #include <vcl/idle.hxx> -#include <vcl/waitobj.hxx> +#include <vcl/locktoplevels.hxx> #include <vcl/customweld.hxx> #include <vcl/weld.hxx> @@ -36,14 +36,14 @@ #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> -namespace dp_gui { +struct ImplSVEvent; +namespace dp_gui { class ExtBoxWithBtns_Impl; class ExtensionBox_Impl; class TheExtensionManager; - class DialogHelper { css::uno::Reference< css::uno::XComponentContext > m_xContext; diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx index fb36589e01c5..c359cb7501c7 100644 --- a/desktop/source/deployment/gui/dp_gui_service.cxx +++ b/desktop/source/deployment/gui/dp_gui_service.cxx @@ -28,6 +28,7 @@ #include <comphelper/unwrapargs.hxx> #include <unotools/resmgr.hxx> #include <vcl/weld.hxx> +#include <vcl/window.hxx> #include <vcl/svapp.hxx> #include <com/sun/star/task/XJobExecutor.hpp> #include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp> diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx index 114d32d12e21..c555e8b16e15 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx @@ -21,7 +21,7 @@ #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <vcl/weld.hxx> -#include <vcl/waitobj.hxx> +#include <vcl/locktoplevels.hxx> #include <unotools/moduleoptions.hxx> #include "xmlfiltercommon.hxx" diff --git a/include/vcl/locktoplevels.hxx b/include/vcl/locktoplevels.hxx new file mode 100644 index 000000000000..9d0bf5f39b44 --- /dev/null +++ b/include/vcl/locktoplevels.hxx @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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/. + */ + +#pragma once + +#include <vcl/dllapi.h> +#include <memory> + +namespace weld +{ +class Widget; +} + +struct TopLevelWindowLockerImpl; + +class VCL_DLLPUBLIC TopLevelWindowLocker +{ +private: + std::unique_ptr<TopLevelWindowLockerImpl> m_xImpl; + +public: + TopLevelWindowLocker(); + ~TopLevelWindowLocker(); + + // lock all toplevels, except the argument + void incBusy(const weld::Widget* pIgnore); + // unlock previous lock + void decBusy(); + bool isBusy() const; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/include/vcl/waitobj.hxx b/include/vcl/waitobj.hxx deleted file mode 100644 index cd6b0c5cfe95..000000000000 --- a/include/vcl/waitobj.hxx +++ /dev/null @@ -1,54 +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_VCL_WAITOBJ_HXX -#define INCLUDED_VCL_WAITOBJ_HXX - -#include <vcl/dllapi.h> -#include <vcl/window.hxx> - -#include <stack> -#include <vector> - -namespace weld { class Widget; } - -class VCL_DLLPUBLIC WaitObject -{ -private: - VclPtr<vcl::Window> mpWindow; -public: - WaitObject(vcl::Window* pWindow); - ~WaitObject(); -}; - -class VCL_DLLPUBLIC TopLevelWindowLocker -{ -private: - std::stack<std::vector<VclPtr<vcl::Window>>> m_aBusyStack; -public: - // lock all toplevels, except the argument - void incBusy(const weld::Widget* pIgnore); - // unlock previous lock - void decBusy(); - bool isBusy() const { return !m_aBusyStack.empty(); } -}; - -#endif // INCLUDED_VCL_WAITOBJ_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 8df199b55649..38b6327ffa92 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -60,7 +60,7 @@ #include <vcl/commandinfoprovider.hxx> #include <vcl/keycod.hxx> #include <vcl/settings.hxx> -#include <vcl/waitobj.hxx> +#include <vcl/locktoplevels.hxx> #include <vcl/weld.hxx> #include <openuriexternally.hxx> diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 9aacb7ba1b77..3fa742fc959a 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -6508,7 +6508,6 @@ include/vcl/vclptr.hxx include/vcl/vclreferencebase.hxx include/vcl/vectorgraphicdata.hxx include/vcl/virdev.hxx -include/vcl/waitobj.hxx include/vcl/wall.hxx include/vcl/window.hxx include/vcl/wizardmachine.hxx diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index e18b9f18cd4b..d5fcad21571e 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -47,7 +47,7 @@ #include <vcl/layout.hxx> #include <vcl/svapp.hxx> #include <vcl/event.hxx> -#include <vcl/waitobj.hxx> +#include <vcl/locktoplevels.hxx> #include <vcl/wrkwin.hxx> #include <vcl/toolkit/button.hxx> #include <vcl/mnemonic.hxx> @@ -64,7 +64,9 @@ #include <tools/json_writer.hxx> #include <iostream> +#include <stack> #include <utility> +#include <vector> static OString ImplGetDialogText( Dialog* pDialog ) { @@ -1607,6 +1609,16 @@ void Dialog::Command(const CommandEvent& rCEvt) SystemWindow::Command(rCEvt); } +struct TopLevelWindowLockerImpl +{ + std::stack<std::vector<VclPtr<vcl::Window>>> m_aBusyStack; +}; + +TopLevelWindowLocker::TopLevelWindowLocker() + : m_xImpl(std::make_unique<TopLevelWindowLockerImpl>()) +{ +} + void TopLevelWindowLocker::incBusy(const weld::Widget* pIgnore) { // lock any toplevel windows from being closed until busy is over @@ -1632,20 +1644,29 @@ void TopLevelWindowLocker::incBusy(const weld::Widget* pIgnore) a->IncModalCount(); a->ImplGetFrame()->NotifyModalHierarchy(true); } - m_aBusyStack.push(aTopLevels); + m_xImpl->m_aBusyStack.push(aTopLevels); } void TopLevelWindowLocker::decBusy() { // unlock locked toplevel windows from being closed now busy is over - for (auto& a : m_aBusyStack.top()) + for (auto& a : m_xImpl->m_aBusyStack.top()) { if (a->IsDisposed()) continue; a->DecModalCount(); a->ImplGetFrame()->NotifyModalHierarchy(false); } - m_aBusyStack.pop(); + m_xImpl->m_aBusyStack.pop(); +} + +bool TopLevelWindowLocker::isBusy() const +{ + return !m_xImpl->m_aBusyStack.empty(); +} + +TopLevelWindowLocker::~TopLevelWindowLocker() +{ } void Dialog::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx index a4ebb21e1ae6..c06e8d0eb54b 100644 --- a/vcl/source/window/window3.cxx +++ b/vcl/source/window/window3.cxx @@ -18,23 +18,9 @@ */ #include <vcl/window.hxx> -#include <vcl/waitobj.hxx> #include <window.h> #include <vcl/cursor.hxx> -WaitObject::WaitObject(vcl::Window* pWindow) - : mpWindow(pWindow) -{ - if (mpWindow) - mpWindow->EnterWait(); -} - -WaitObject::~WaitObject() -{ - if (mpWindow) - mpWindow->LeaveWait(); -} - namespace vcl { Size Window::GetOptimalSize() const { return Size(); } |