diff options
Diffstat (limited to 'uui/source')
-rw-r--r-- | uui/source/alreadyopen.cxx | 1 | ||||
-rw-r--r-- | uui/source/iahndl-locking.cxx | 104 | ||||
-rw-r--r-- | uui/source/iahndl.cxx | 6 | ||||
-rw-r--r-- | uui/source/iahndl.hxx | 6 | ||||
-rw-r--r-- | uui/source/lockcorrupt.cxx | 1 | ||||
-rw-r--r-- | uui/source/lockfailed.cxx | 1 | ||||
-rw-r--r-- | uui/source/openlocked.cxx | 1 | ||||
-rw-r--r-- | uui/source/readonlyopen.cxx | 38 | ||||
-rw-r--r-- | uui/source/readonlyopen.hxx | 35 | ||||
-rw-r--r-- | uui/source/reloadeditable.cxx | 37 | ||||
-rw-r--r-- | uui/source/reloadeditable.hxx | 35 |
11 files changed, 263 insertions, 2 deletions
diff --git a/uui/source/alreadyopen.cxx b/uui/source/alreadyopen.cxx index 2fe5dcbc424f..7c387d8b7a7c 100644 --- a/uui/source/alreadyopen.cxx +++ b/uui/source/alreadyopen.cxx @@ -35,6 +35,7 @@ AlreadyOpenQueryBox::AlreadyOpenQueryBox(weld::Window* pParent, const std::local else { m_xQueryBox->add_button(Translate::get(STR_ALREADYOPEN_READONLY_BTN, rLocale), RET_YES); + m_xQueryBox->add_button(Translate::get(STR_ALREADYOPEN_READONLY_NOTIFY_BTN, rLocale), RET_RETRY); m_xQueryBox->add_button(Translate::get(STR_ALREADYOPEN_OPEN_BTN, rLocale), RET_NO); } m_xQueryBox->add_button(GetStandardText(StandardButtonType::Cancel), RET_CANCEL); diff --git a/uui/source/iahndl-locking.cxx b/uui/source/iahndl-locking.cxx index 52b9d2108347..23493c16053c 100644 --- a/uui/source/iahndl-locking.cxx +++ b/uui/source/iahndl-locking.cxx @@ -23,6 +23,8 @@ #include <com/sun/star/document/LockFileIgnoreRequest.hpp> #include <com/sun/star/document/LockFileCorruptRequest.hpp> #include <com/sun/star/document/OwnLockOnDocumentRequest.hpp> +#include <com/sun/star/document/ReadOnlyOpenRequest.hpp> +#include <com/sun/star/document/ReloadEditableRequest.hpp> #include <com/sun/star/task/XInteractionApprove.hpp> #include <com/sun/star/task/XInteractionDisapprove.hpp> #include <com/sun/star/task/XInteractionAbort.hpp> @@ -41,6 +43,8 @@ #include "filechanged.hxx" #include "lockfailed.hxx" #include "lockcorrupt.hxx" +#include "readonlyopen.hxx" +#include "reloadeditable.hxx" #include "iahndl.hxx" @@ -53,6 +57,66 @@ using namespace com::sun::star; namespace { +void handleReadOnlyOpenRequest_( + weld::Window* pParent, const OUString& aDocumentURL, + uno::Sequence<uno::Reference<task::XInteractionContinuation>> const& rContinuations) +{ + uno::Reference<task::XInteractionApprove> xApprove; + uno::Reference<task::XInteractionAbort> xAbort; + getContinuations(rContinuations, &xApprove, &xAbort); + + if (!xApprove.is() || !xAbort.is()) + return; + + SolarMutexGuard aGuard; + std::locale aResLocale = Translate::Create("uui"); + + OUString aMessage; + std::vector<OUString> aArguments; + aArguments.push_back(aDocumentURL); + + aMessage = Translate::get(STR_READONLYOPEN_MSG, aResLocale); + aMessage = UUIInteractionHelper::replaceMessageWithArguments(aMessage, aArguments); + + ReadOnlyOpenQueryBox aDialog(pParent, aResLocale, aMessage); + int nResult = aDialog.run(); + + if (nResult == RET_YES) + xApprove->select(); + else if (nResult != RET_RETRY) + xAbort->select(); +} + +void handleReloadEditableRequest_( + weld::Window* pParent, const OUString& aDocumentURL, + uno::Sequence<uno::Reference<task::XInteractionContinuation>> const& rContinuations) +{ + uno::Reference<task::XInteractionApprove> xApprove; + uno::Reference<task::XInteractionAbort> xAbort; + getContinuations(rContinuations, &xApprove, &xAbort); + + if (!xApprove.is() || !xAbort.is()) + return; + + SolarMutexGuard aGuard; + std::locale aResLocale = Translate::Create("uui"); + + OUString aMessage; + std::vector<OUString> aArguments; + aArguments.push_back(aDocumentURL); + + aMessage = Translate::get(STR_RELOADEDITABLE_MSG, aResLocale); + aMessage = UUIInteractionHelper::replaceMessageWithArguments(aMessage, aArguments); + + ReloadEditableQueryBox aDialog(pParent, aResLocale, aMessage); + int nResult = aDialog.run(); + + if (nResult == RET_YES) + xApprove->select(); + else + xAbort->select(); +} + void handleLockedDocumentRequest_( weld::Window * pParent, @@ -132,7 +196,7 @@ handleLockedDocumentRequest_( xDisapprove->select(); else if ( nResult == RET_IGNORE && xRetry.is() ) xRetry->select(); - else + else if ( nResult != RET_RETRY ) xAbort->select(); } @@ -196,7 +260,7 @@ handleLockFileProblemRequest_( if ( nResult == RET_OK ) xApprove->select(); - else + else if ( nResult != RET_RETRY ) xAbort->select(); } @@ -293,5 +357,41 @@ UUIInteractionHelper::handleLockFileProblemRequest( return false; } +bool UUIInteractionHelper::handleReadOnlyOpenRequest( + uno::Reference<task::XInteractionRequest> const& rRequest) +{ + uno::Any aAnyRequest(rRequest->getRequest()); + + document::ReadOnlyOpenRequest aReadOnlyOpenRequest; + if (aAnyRequest >>= aReadOnlyOpenRequest) + { + uno::Reference<awt::XWindow> xParent = getParentXWindow(); + handleReadOnlyOpenRequest_(Application::GetFrameWeld(xParent), + aReadOnlyOpenRequest.DocumentURL, + rRequest->getContinuations()); + return true; + } + + return false; +} + +bool UUIInteractionHelper::handleReloadEditableRequest( + uno::Reference<task::XInteractionRequest> const& rRequest) +{ + uno::Any aAnyRequest(rRequest->getRequest()); + + document::ReloadEditableRequest aReloadEditableRequest; + if (aAnyRequest >>= aReloadEditableRequest) + { + uno::Reference<awt::XWindow> xParent = getParentXWindow(); + handleReloadEditableRequest_( + Application::GetFrameWeld(xParent), aReloadEditableRequest.DocumentURL, + rRequest->getContinuations()); + return true; + } + + return false; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index ec8cb02258db..2897a582c3e9 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -815,6 +815,12 @@ UUIInteractionHelper::handleRequest_impl( if ( handleLockFileProblemRequest( rRequest ) ) return true; + if ( handleReloadEditableRequest( rRequest ) ) + return true; + + if ( handleReadOnlyOpenRequest( rRequest ) ) + return true; + task::DocumentMacroConfirmationRequest aMacroConfirmRequest; if (aAnyRequest >>= aMacroConfirmRequest) { diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx index ff6973245dad..8dc828a7dd5f 100644 --- a/uui/source/iahndl.hxx +++ b/uui/source/iahndl.hxx @@ -231,6 +231,12 @@ private: bool handleLockFileProblemRequest( css::uno::Reference< css::task::XInteractionRequest > const & rRequest); + bool handleReloadEditableRequest( + css::uno::Reference<css::task::XInteractionRequest> const& rRequest); + + bool + handleReadOnlyOpenRequest(css::uno::Reference<css::task::XInteractionRequest> const& rRequest); + bool handleCustomRequest( const css::uno::Reference< css::task::XInteractionRequest >& i_rRequest, const OUString& i_rServiceName diff --git a/uui/source/lockcorrupt.cxx b/uui/source/lockcorrupt.cxx index 28e8e71f00c4..d3abee07a185 100644 --- a/uui/source/lockcorrupt.cxx +++ b/uui/source/lockcorrupt.cxx @@ -29,6 +29,7 @@ LockCorruptQueryBox::LockCorruptQueryBox(weld::Window* pParent, const std::local { m_xQueryBox->set_title(Translate::get(STR_LOCKCORRUPT_TITLE, rResLocale)); m_xQueryBox->add_button(Translate::get(STR_LOCKCORRUPT_OPENREADONLY_BTN, rResLocale), RET_OK); + m_xQueryBox->add_button(Translate::get(STR_LOCKCORRUPT_OPENREADONLY_NOTIFY_BTN, rResLocale), RET_RETRY); m_xQueryBox->add_button(GetStandardText(StandardButtonType::Cancel), RET_CANCEL); m_xQueryBox->set_default_response(RET_OK); } diff --git a/uui/source/lockfailed.cxx b/uui/source/lockfailed.cxx index 8254b19e509b..340cc9638806 100644 --- a/uui/source/lockfailed.cxx +++ b/uui/source/lockfailed.cxx @@ -29,6 +29,7 @@ LockFailedQueryBox::LockFailedQueryBox(weld::Window* pParent, const std::locale& { 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(Translate::get(STR_LOCKFAILED_OPENREADONLY_NOTIFY_BTN, rLocale), RET_RETRY); m_xQueryBox->add_button(GetStandardText(StandardButtonType::Cancel), RET_CANCEL); m_xQueryBox->set_default_response(RET_OK); } diff --git a/uui/source/openlocked.cxx b/uui/source/openlocked.cxx index fa2a4616c7c1..a0284b194b14 100644 --- a/uui/source/openlocked.cxx +++ b/uui/source/openlocked.cxx @@ -29,6 +29,7 @@ OpenLockedQueryBox::OpenLockedQueryBox(weld::Window* pParent, const std::locale& { 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_OPENREADONLY_NOTIFY_BTN, rResLocale), RET_RETRY); m_xQueryBox->add_button(Translate::get(STR_OPENLOCKED_OPENCOPY_BTN, rResLocale), RET_NO); if (bEnableOverride && officecfg::Office::Common::Misc::AllowOverrideLocking::get()) { diff --git a/uui/source/readonlyopen.cxx b/uui/source/readonlyopen.cxx new file mode 100644 index 000000000000..72a3b989e079 --- /dev/null +++ b/uui/source/readonlyopen.cxx @@ -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/. + * + * 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 <strings.hrc> +#include "readonlyopen.hxx" +#include <officecfg/Office/Common.hxx> +#include <unotools/resmgr.hxx> +#include <vcl/stdtext.hxx> +#include <vcl/svapp.hxx> + +ReadOnlyOpenQueryBox::ReadOnlyOpenQueryBox(weld::Window* pParent, const std::locale& rResLocale, + const OUString& rMessage) + : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, + VclButtonsType::NONE, rMessage)) +{ + m_xQueryBox->set_title(Translate::get(STR_READONLYOPEN_TITLE, rResLocale)); + m_xQueryBox->add_button(Translate::get(STR_READONLYOPEN_BTN, rResLocale), RET_YES); + m_xQueryBox->add_button(Translate::get(STR_READONLYOPEN_NOTIFY_BTN, rResLocale), RET_RETRY); + m_xQueryBox->add_button(GetStandardText(StandardButtonType::Cancel), RET_CANCEL); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/uui/source/readonlyopen.hxx b/uui/source/readonlyopen.hxx new file mode 100644 index 000000000000..08063d10be0e --- /dev/null +++ b/uui/source/readonlyopen.hxx @@ -0,0 +1,35 @@ +/* -*- 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/. + * + * 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 . + */ + +#pragma once + +#include <vcl/weld.hxx> + +class ReadOnlyOpenQueryBox +{ +private: + std::unique_ptr<weld::MessageDialog> m_xQueryBox; + +public: + ReadOnlyOpenQueryBox(weld::Window* pParent, const std::locale& rResLocale, + const OUString& rMessage); + int run() { return m_xQueryBox->run(); } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/uui/source/reloadeditable.cxx b/uui/source/reloadeditable.cxx new file mode 100644 index 000000000000..9dad2e183abf --- /dev/null +++ b/uui/source/reloadeditable.cxx @@ -0,0 +1,37 @@ +/* -*- 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/. + * + * 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 <strings.hrc> +#include "reloadeditable.hxx" +#include <officecfg/Office/Common.hxx> +#include <unotools/resmgr.hxx> +#include <vcl/stdtext.hxx> +#include <vcl/svapp.hxx> + +ReloadEditableQueryBox::ReloadEditableQueryBox(weld::Window* pParent, const std::locale& rResLocale, + const OUString& rMessage) + : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, + VclButtonsType::NONE, rMessage)) +{ + m_xQueryBox->set_title(Translate::get(STR_RELOADEDITABLE_TITLE, rResLocale)); + m_xQueryBox->add_button(Translate::get(STR_RELOADEDITABLE_BTN, rResLocale), RET_YES); + m_xQueryBox->add_button(GetStandardText(StandardButtonType::Cancel), RET_CANCEL); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/uui/source/reloadeditable.hxx b/uui/source/reloadeditable.hxx new file mode 100644 index 000000000000..00a15f7ba89c --- /dev/null +++ b/uui/source/reloadeditable.hxx @@ -0,0 +1,35 @@ +/* -*- 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/. + * + * 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 . + */ + +#pragma once + +#include <vcl/weld.hxx> + +class ReloadEditableQueryBox +{ +private: + std::unique_ptr<weld::MessageDialog> m_xQueryBox; + +public: + ReloadEditableQueryBox(weld::Window* pParent, const std::locale& rResLocale, + const OUString& rMessage); + int run() { return m_xQueryBox->run(); } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |