summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-11-22 15:15:08 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-11-23 09:52:15 +0100
commit6d5aeece56e0ab33150bdcf8a037cdb004ae2d1d (patch)
tree813e0cbd6944ff21ce043558be5fa3e900c56430 /framework
parenta8681f24d786a5498844e29a3029cf9e60e74ca3 (diff)
move preventduplicateinteraction from framework to sfx2 consumer
Change-Id: I1388a88ba20b5cde65cd1d88694775b071a0dff6 Reviewed-on: https://gerrit.libreoffice.org/45099 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'framework')
-rw-r--r--framework/Library_fwe.mk1
-rw-r--r--framework/source/fwe/interaction/preventduplicateinteraction.cxx232
2 files changed, 0 insertions, 233 deletions
diff --git a/framework/Library_fwe.mk b/framework/Library_fwe.mk
index 5f70d38eb004..bff052f499ad 100644
--- a/framework/Library_fwe.mk
+++ b/framework/Library_fwe.mk
@@ -68,7 +68,6 @@ $(eval $(call gb_Library_add_exception_objects,fwe,\
framework/source/fwe/helper/titlehelper \
framework/source/fwe/helper/documentundoguard \
framework/source/fwe/helper/undomanagerhelper \
- framework/source/fwe/interaction/preventduplicateinteraction \
framework/source/fwe/xml/menuconfiguration \
framework/source/fwe/xml/menudocumenthandler \
framework/source/fwe/xml/saxnamespacefilter \
diff --git a/framework/source/fwe/interaction/preventduplicateinteraction.cxx b/framework/source/fwe/interaction/preventduplicateinteraction.cxx
deleted file mode 100644
index 910c0891f077..000000000000
--- a/framework/source/fwe/interaction/preventduplicateinteraction.cxx
+++ /dev/null
@@ -1,232 +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 <framework/preventduplicateinteraction.hxx>
-
-#include <osl/diagnose.h>
-
-#include <com/sun/star/task/InteractionHandler.hpp>
-#include <com/sun/star/task/XInteractionAbort.hpp>
-#include <com/sun/star/task/XInteractionRetry.hpp>
-
-namespace framework{
-
-PreventDuplicateInteraction::PreventDuplicateInteraction(const css::uno::Reference< css::uno::XComponentContext >& rxContext)
- : ThreadHelpBase2()
- , m_xContext(rxContext)
-{
-}
-
-PreventDuplicateInteraction::~PreventDuplicateInteraction()
-{
-}
-
-void PreventDuplicateInteraction::setHandler(const css::uno::Reference< css::task::XInteractionHandler >& xHandler)
-{
- // SAFE ->
- ::osl::ResettableMutexGuard aLock(m_aLock);
- m_xHandler = xHandler;
- aLock.clear();
- // <- SAFE
-}
-
-void PreventDuplicateInteraction::useDefaultUUIHandler()
-{
- // SAFE ->
- ::osl::ResettableMutexGuard aLock(m_aLock);
- aLock.clear();
- // <- SAFE
-
- css::uno::Reference< css::task::XInteractionHandler > xHandler( css::task::InteractionHandler::createWithParent( m_xContext, nullptr ), css::uno::UNO_QUERY_THROW );
-
- // SAFE ->
- aLock.reset();
- m_xHandler = xHandler;
- aLock.clear();
- // <- SAFE
-}
-
-css::uno::Any SAL_CALL PreventDuplicateInteraction::queryInterface( const css::uno::Type& aType )
-{
- if ( aType.equals( cppu::UnoType<XInteractionHandler2>::get() ) )
- {
- ::osl::ResettableMutexGuard aLock(m_aLock);
- css::uno::Reference< css::task::XInteractionHandler2 > xHandler( m_xHandler, css::uno::UNO_QUERY );
- if ( !xHandler.is() )
- return css::uno::Any();
- }
- return ::cppu::WeakImplHelper< css::task::XInteractionHandler2 >::queryInterface( aType );
-}
-
-void SAL_CALL PreventDuplicateInteraction::handle(const css::uno::Reference< css::task::XInteractionRequest >& xRequest)
-{
- css::uno::Any aRequest = xRequest->getRequest();
- bool bHandleIt = true;
-
- // SAFE ->
- ::osl::ResettableMutexGuard aLock(m_aLock);
-
- InteractionList::iterator pIt;
- for ( pIt = m_lInteractionRules.begin();
- pIt != m_lInteractionRules.end();
- ++pIt )
- {
- InteractionInfo& rInfo = *pIt;
-
- if (aRequest.isExtractableTo(rInfo.m_aInteraction))
- {
- ++rInfo.m_nCallCount;
- rInfo.m_xRequest = xRequest;
- bHandleIt = (rInfo.m_nCallCount <= rInfo.m_nMaxCount);
- break;
- }
- }
-
- css::uno::Reference< css::task::XInteractionHandler > xHandler = m_xHandler;
-
- aLock.clear();
- // <- SAFE
-
- if ( bHandleIt && xHandler.is() )
- {
- xHandler->handle(xRequest);
- }
- else
- {
- const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > lContinuations = xRequest->getContinuations();
- sal_Int32 c = lContinuations.getLength();
- sal_Int32 i = 0;
- for (i=0; i<c; ++i)
- {
- css::uno::Reference< css::task::XInteractionAbort > xAbort(lContinuations[i], css::uno::UNO_QUERY);
- if (xAbort.is())
- {
- xAbort->select();
- break;
- }
- }
- }
-}
-
-sal_Bool SAL_CALL PreventDuplicateInteraction::handleInteractionRequest( const css::uno::Reference< css::task::XInteractionRequest >& xRequest )
-{
- css::uno::Any aRequest = xRequest->getRequest();
- bool bHandleIt = true;
-
- // SAFE ->
- ::osl::ResettableMutexGuard aLock(m_aLock);
-
- InteractionList::iterator pIt;
- for ( pIt = m_lInteractionRules.begin();
- pIt != m_lInteractionRules.end();
- ++pIt )
- {
- InteractionInfo& rInfo = *pIt;
-
- if (aRequest.isExtractableTo(rInfo.m_aInteraction))
- {
- ++rInfo.m_nCallCount;
- rInfo.m_xRequest = xRequest;
- bHandleIt = (rInfo.m_nCallCount <= rInfo.m_nMaxCount);
- break;
- }
- }
-
- css::uno::Reference< css::task::XInteractionHandler2 > xHandler( m_xHandler, css::uno::UNO_QUERY );
- OSL_ENSURE( xHandler.is() || !m_xHandler.is(),
- "PreventDuplicateInteraction::handleInteractionRequest: inconsistency!" );
-
- aLock.clear();
- // <- SAFE
-
- if ( bHandleIt && xHandler.is() )
- {
- return xHandler->handleInteractionRequest(xRequest);
- }
- else
- {
- const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > lContinuations = xRequest->getContinuations();
- sal_Int32 c = lContinuations.getLength();
- sal_Int32 i = 0;
- for (i=0; i<c; ++i)
- {
- css::uno::Reference< css::task::XInteractionAbort > xAbort(lContinuations[i], css::uno::UNO_QUERY);
- if (xAbort.is())
- {
- xAbort->select();
- break;
- }
- }
- }
- return false;
-}
-
-void PreventDuplicateInteraction::addInteractionRule(const PreventDuplicateInteraction::InteractionInfo& aInteractionInfo)
-{
- // SAFE ->
- ::osl::ResettableMutexGuard aLock(m_aLock);
-
- InteractionList::iterator pIt;
- for ( pIt = m_lInteractionRules.begin();
- pIt != m_lInteractionRules.end();
- ++pIt )
- {
- InteractionInfo& rInfo = *pIt;
- if (rInfo.m_aInteraction == aInteractionInfo.m_aInteraction)
- {
- rInfo.m_nMaxCount = aInteractionInfo.m_nMaxCount;
- rInfo.m_nCallCount = aInteractionInfo.m_nCallCount;
- return;
- }
- }
-
- m_lInteractionRules.push_back(aInteractionInfo);
-
- aLock.clear();
- // <- SAFE
-}
-
-bool PreventDuplicateInteraction::getInteractionInfo(const css::uno::Type& aInteraction,
- PreventDuplicateInteraction::InteractionInfo* pReturn ) const
-{
- // SAFE ->
- ::osl::ResettableMutexGuard aLock(m_aLock);
-
- PreventDuplicateInteraction::InteractionList::const_iterator pIt;
- for ( pIt = m_lInteractionRules.begin();
- pIt != m_lInteractionRules.end();
- ++pIt )
- {
- const PreventDuplicateInteraction::InteractionInfo& rInfo = *pIt;
- if (rInfo.m_aInteraction == aInteraction)
- {
- *pReturn = rInfo;
- return true;
- }
- }
-
- aLock.clear();
- // <- SAFE
-
- return false;
-}
-
-} // namespace framework
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */