/* -*- 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 #include "com/sun/star/document/ChangedByOthersRequest.hpp" #include "com/sun/star/document/LockedDocumentRequest.hpp" #include "com/sun/star/document/LockedOnSavingRequest.hpp" #include "com/sun/star/document/LockFileIgnoreRequest.hpp" #include "com/sun/star/document/OwnLockOnDocumentRequest.hpp" #include "com/sun/star/task/XInteractionApprove.hpp" #include "com/sun/star/task/XInteractionDisapprove.hpp" #include "com/sun/star/task/XInteractionAbort.hpp" #include "com/sun/star/task/XInteractionRequest.hpp" #include "osl/mutex.hxx" #include "vcl/svapp.hxx" #include "vcl/msgbox.hxx" #include "ids.hrc" #include "getcontinuations.hxx" #include "openlocked.hxx" #include "trylater.hxx" #include "alreadyopen.hxx" #include "filechanged.hxx" #include "lockfailed.hxx" #include "iahndl.hxx" #include #define UUI_DOC_LOAD_LOCK 0 #define UUI_DOC_OWN_LOAD_LOCK 1 #define UUI_DOC_SAVE_LOCK 2 #define UUI_DOC_OWN_SAVE_LOCK 3 using namespace com::sun::star; namespace { void handleLockedDocumentRequest_( Window * pParent, const OUString& aDocumentURL, const OUString& aInfo, uno::Sequence< uno::Reference< task::XInteractionContinuation > > const & rContinuations, sal_uInt16 nMode ) SAL_THROW((uno::RuntimeException)) { uno::Reference< task::XInteractionApprove > xApprove; uno::Reference< task::XInteractionDisapprove > xDisapprove; uno::Reference< task::XInteractionAbort > xAbort; getContinuations(rContinuations, &xApprove, &xDisapprove, &xAbort); if ( !xApprove.is() || !xDisapprove.is() || !xAbort.is() ) return; try { SolarMutexGuard aGuard; boost::scoped_ptr< ResMgr > xManager(ResMgr::CreateResMgr("uui")); if (!xManager.get()) return; OUString aMessage; std::vector< OUString > aArguments; aArguments.push_back( aDocumentURL ); sal_Int32 nResult = RET_CANCEL; if ( nMode == UUI_DOC_LOAD_LOCK ) { aArguments.push_back( !aInfo.isEmpty() ? aInfo : ResId( STR_UNKNOWNUSER, *xManager.get() ).toString() ); aMessage = ResId(STR_OPENLOCKED_MSG, *xManager.get()).toString(); aMessage = UUIInteractionHelper::replaceMessageWithArguments( aMessage, aArguments ); boost::scoped_ptr< OpenLockedQueryBox > xDialog(new OpenLockedQueryBox( pParent, xManager.get(), aMessage ) ); nResult = xDialog->Execute(); } else if ( nMode == UUI_DOC_SAVE_LOCK ) { aArguments.push_back( !aInfo.isEmpty() ? aInfo : ResId( STR_UNKNOWNUSER, *xManager.get() ).toString() ); aMessage = ResId(STR_TRYLATER_MSG, *xManager.get()).toString(); aMessage = UUIInteractionHelper::replaceMessageWithArguments( aMessage, aArguments ); boost::scoped_ptr< TryLaterQueryBox > xDialog( new TryLaterQueryBox( pParent, xManager.get(), aMessage ) ); nResult = xDialog->Execute(); } else if ( nMode == UUI_DOC_OWN_LOAD_LOCK || nMode == UUI_DOC_OWN_SAVE_LOCK ) { aArguments.push_back( aInfo ); aMessage = ResId(nMode == UUI_DOC_OWN_SAVE_LOCK ? STR_ALREADYOPEN_SAVE_MSG : STR_ALREADYOPEN_MSG, *xManager.get() ).toString(); aMessage = UUIInteractionHelper::replaceMessageWithArguments( aMessage, aArguments ); boost::scoped_ptr< AlreadyOpenQueryBox > xDialog( new AlreadyOpenQueryBox( pParent, xManager.get(), aMessage, nMode == UUI_DOC_OWN_SAVE_LOCK ) ); nResult = xDialog->Execute(); } if ( nResult == RET_YES ) xApprove->select(); else if ( nResult == RET_NO ) xDisapprove->select(); else xAbort->select(); } catch (std::bad_alloc const &) { throw uno::RuntimeException("out of memory", uno::Reference< uno::XInterface >()); } } void handleChangedByOthersRequest_( Window * pParent, uno::Sequence< uno::Reference< task::XInteractionContinuation > > const & rContinuations ) SAL_THROW((uno::RuntimeException)) { uno::Reference< task::XInteractionApprove > xApprove; uno::Reference< task::XInteractionAbort > xAbort; getContinuations(rContinuations, &xApprove, &xAbort); if ( !xApprove.is() || !xAbort.is() ) return; try { SolarMutexGuard aGuard; boost::scoped_ptr< ResMgr > xManager(ResMgr::CreateResMgr("uui")); if (!xManager.get()) return; boost::scoped_ptr< FileChangedQueryBox > xDialog( new FileChangedQueryBox( pParent, xManager.get() ) ); sal_Int32 nResult = xDialog->Execute(); if ( nResult == RET_YES ) xApprove->select(); else xAbort->select(); } catch (std::bad_alloc const &) { throw uno::RuntimeException("out of memory", uno::Reference< uno::XInterface >()); } } void handleLockFileIgnoreRequest_( Window * pParent, uno::Sequence< uno::Reference< task::XInteractionContinuation > > const & rContinuations ) SAL_THROW((uno::RuntimeException)) { uno::Reference< task::XInteractionApprove > xApprove; uno::Reference< task::XInteractionAbort > xAbort; getContinuations(rContinuations, &xApprove, &xAbort); if ( !xApprove.is() || !xAbort.is() ) return; try { SolarMutexGuard aGuard; boost::scoped_ptr< ResMgr > xManager(ResMgr::CreateResMgr("uui")); if (!xManager.get()) return; boost::scoped_ptr< LockFailedQueryBox > xDialog( new LockFailedQueryBox( pParent, xManager.get() ) ); sal_Int32 nResult = xDialog->Execute(); if ( nResult == RET_OK ) xApprove->select(); else xAbort->select(); } catch (std::bad_alloc const &) { throw uno::RuntimeException("out of memory", uno::Reference< uno::XInterface >()); } } } // namespace bool UUIInteractionHelper::handleLockedDocumentRequest( uno::Reference< task::XInteractionRequest > const & rRequest) SAL_THROW((::com::sun::star::uno::RuntimeException)) { uno::Any aAnyRequest(rRequest->getRequest()); document::LockedDocumentRequest aLockedDocumentRequest; if (aAnyRequest >>= aLockedDocumentRequest ) { handleLockedDocumentRequest_( getParentProperty(), aLockedDocumentRequest.DocumentURL, aLockedDocumentRequest.UserInfo, rRequest->getContinuations(), UUI_DOC_LOAD_LOCK ); return true; } document::OwnLockOnDocumentRequest aOwnLockOnDocumentRequest; if (aAnyRequest >>= aOwnLockOnDocumentRequest ) { handleLockedDocumentRequest_( getParentProperty(), aOwnLockOnDocumentRequest.DocumentURL, aOwnLockOnDocumentRequest.TimeInfo, rRequest->getContinuations(), aOwnLockOnDocumentRequest.IsStoring ? UUI_DOC_OWN_SAVE_LOCK : UUI_DOC_OWN_LOAD_LOCK ); return true; } document::LockedOnSavingRequest aLockedOnSavingRequest; if (aAnyRequest >>= aLockedOnSavingRequest ) { handleLockedDocumentRequest_( getParentProperty(), aLockedOnSavingRequest.DocumentURL, aLockedOnSavingRequest.UserInfo, rRequest->getContinuations(), UUI_DOC_SAVE_LOCK ); return true; } return false; } bool UUIInteractionHelper::handleChangedByOthersRequest( uno::Reference< task::XInteractionRequest > const & rRequest) SAL_THROW((uno::RuntimeException)) { uno::Any aAnyRequest(rRequest->getRequest()); document::ChangedByOthersRequest aChangedByOthersRequest; if (aAnyRequest >>= aChangedByOthersRequest ) { handleChangedByOthersRequest_( getParentProperty(), rRequest->getContinuations() ); return true; } return false; } bool UUIInteractionHelper::handleLockFileIgnoreRequest( uno::Reference< task::XInteractionRequest > const & rRequest) SAL_THROW((uno::RuntimeException)) { uno::Any aAnyRequest(rRequest->getRequest()); document::LockFileIgnoreRequest aLockFileIgnoreRequest; if (aAnyRequest >>= aLockFileIgnoreRequest ) { handleLockFileIgnoreRequest_( getParentProperty(), rRequest->getContinuations() ); return true; } return false; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ wFrameBorder'>feature/SwFrameBorder LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-02-25add GatherField member functionBjoern Michaelsen
Change-Id: Ifa2ea333ccccec240cc10374fd6539a8b3f6df46 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89316 Tested-by: Jenkins Reviewed-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-02-16GatherRefFields for ww8Bjoern Michaelsen
Change-Id: Ic40c1241854bdbcdf7987ab592e0f07ecdd73f0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88823 Tested-by: Jenkins Reviewed-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-02-16no more SwIterator in GatherChapterFieldsBjoern Michaelsen
Change-Id: Iab5e210199948b2fbe9cca2f2ff6a36341a6c1c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88780 Tested-by: Jenkins Reviewed-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-02-16no more SwIterator in HasHiddenInformationNotesBjoern Michaelsen
Change-Id: Ic2a4340972ad29305dadc56a33081a211cc0205b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88758 Reviewed-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org> Tested-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-02-10refactor PostIt access to SwFormatFields in ...Bjoern Michaelsen
- SwTextShell::ExecField() - PostItManager Change-Id: I7eabf0a7d8170d0dacf3069925abfe1a91a4a9f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88334 Tested-by: Jenkins Reviewed-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-02-08introduce SwFieldType::FindFormatForField and use it (once)Bjoern Michaelsen
Change-Id: Id7136b936c0585e7013f3d06ad97436b51522da3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88264 Tested-by: Jenkins Reviewed-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
2020-02-07SwFormatField::Modify no more (folded into SwClientNotify)Bjoern Michaelsen
- refactor out field formatting * make direct calls explicit with new UpdateTextNode() call * try to bring at least some sanity to the event handler Change-Id: I40a39ddf70476b7fa0bf5e157fb263e863bb1d20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87927 Tested-by: Jenkins Reviewed-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
2019-12-12use covariant return type for SfxPoolItem::CloneCaolán McNamara
and can then remove some casting Change-Id: Id821c32ca2cbcdb7f57ef7a5fa1960042e630ffc Reviewed-on: https://gerrit.libreoffice.org/85022 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-11-04loplugin:finalclasses in sw/incNoel Grandin
Change-Id: I084502d8c5607f103ef987b54252ef95341f0bef Reviewed-on: https://gerrit.libreoffice.org/81981 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-14Change some handling for resolved commentsScott Clarke
Changed the way the lcl_CommentNotification method is called when a comment is resolved such that resolution is distinct from other changes. Resolved flag is now only stored in the top annotation of a thread when saved as ODT. Change-Id: I5ef36718fd7e1dfcc16c077871653a70476e8804 Reviewed-on: https://gerrit.libreoffice.org/77411 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2019-05-05[API CHANGE] SwXTextField: no more SwModify/SwClientBjoern Michaelsen
- fix unittest assuming the double-insertion of annotation throwing an IllegalArgumentException was intentional - remove SwModify/SwClient in SwXTextField - also: add basic C++ api test Change-Id: Ia4657dc65dfadc3e975bdf409bd5e43413ea1f5a Reviewed-on: https://gerrit.libreoffice.org/71452 Tested-by: Jenkins Reviewed-by: Björn Michaelsen <bjoern.michaelsen@libreoffice.org>
2019-02-28use the xmlTextWriterPtr typedef consistentlyNoel Grandin
this is the single biggest chunk of stuff my upcoming paramtypedef loplugin will warn about, so do it separately Change-Id: I412e69e76406d6d947101885d4cd92c65e021508 Reviewed-on: https://gerrit.libreoffice.org/68486 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-03loplugin:constfields in swNoel Grandin
Change-Id: I1eb6583bb9ec815bc0564b0d7c676f5b1fb9045f Reviewed-on: https://gerrit.libreoffice.org/61177 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>