AmbigousFilterRequest is only ever extracted, never created

Change-Id: I79c669c1635192199d6ef135e1ab9b48a9e7e63a
This commit is contained in:
Caolán McNamara
2014-07-23 10:49:30 +01:00
parent 2c5f02539d
commit 23e818d4f5
9 changed files with 1 additions and 157 deletions

View File

@@ -38,7 +38,6 @@ namespace framework{
But it can be used to intercept problems e.g. during loading of documents.
In current implementation we solve conflicts for following situations only:
- AmbigousFilterRequest
- InteractiveIOException
- InteractiveAugmentedIOException
All other requests will be aborted.

View File

@@ -82,7 +82,6 @@
#include <com/sun/star/container/XNameReplace.hpp>
#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
#include <com/sun/star/document/AmbigousFilterRequest.hpp>
#include <com/sun/star/document/FilterOptionsRequest.hpp>
#include <com/sun/star/document/LockedDocumentRequest.hpp>
#include <com/sun/star/document/MacroExecMode.hpp>

View File

@@ -25,7 +25,6 @@
#include <com/sun/star/task/XInteractionApprove.hpp>
#include <com/sun/star/document/XInteractionFilterSelect.hpp>
#include <com/sun/star/document/XInteractionFilterOptions.hpp>
#include <com/sun/star/document/AmbigousFilterRequest.hpp>
#include <com/sun/star/document/FilterOptionsRequest.hpp>
#include <com/sun/star/task/ErrorCodeRequest.hpp>
@@ -81,20 +80,9 @@ void SAL_CALL QuietInteraction::handle( const css::uno::Reference< css::task::XI
// differ between abortable interactions (error, unknown filter ...)
// and other ones (ambigous but not unknown filter ...)
css::task::ErrorCodeRequest aErrorCodeRequest;
css::document::AmbigousFilterRequest aAmbigousFilterRequest;
css::document::LockedDocumentRequest aLockedDocumentRequest;
css::document::FilterOptionsRequest aFilterOptionsRequest;
if (aRequest>>=aAmbigousFilterRequest)
{
if (xFilter.is())
{
// user selected filter wins every time!
xFilter->setFilter( aAmbigousFilterRequest.SelectedFilter );
xFilter->select();
}
}
else
if( aRequest >>= aErrorCodeRequest )
{
// warnings can be ignored => approve

View File

@@ -46,7 +46,6 @@
#include <com/sun/star/task/XInteractionAbort.hpp>
#include <com/sun/star/task/XInteractionApprove.hpp>
#include <com/sun/star/document/XInteractionFilterSelect.hpp>
#include <com/sun/star/document/AmbigousFilterRequest.hpp>
#include <com/sun/star/task/ErrorCodeRequest.hpp>
#include <com/sun/star/ucb/InteractiveIOException.hpp>
#include <com/sun/star/ucb/InteractiveAugmentedIOException.hpp>
@@ -1220,16 +1219,7 @@ void SAL_CALL Desktop::handle( const css::uno::Reference< css::task::XInteractio
// differ between abortable interactions (error, unknown filter ...)
// and other ones (ambigous but not unknown filter ...)
css::task::ErrorCodeRequest aErrorCodeRequest;
css::document::AmbigousFilterRequest aAmbigousFilterRequest;
if( aRequest >>= aAmbigousFilterRequest )
{
if( xFilterSelect.is() )
{
xFilterSelect->setFilter( aAmbigousFilterRequest.SelectedFilter ); // user selected filter wins!
xFilterSelect->select();
}
}
else if( aRequest >>= aErrorCodeRequest )
if( aRequest >>= aErrorCodeRequest )
{
bool bWarning = ((aErrorCodeRequest.ErrCode & ERRCODE_WARNING_MASK) == ERRCODE_WARNING_MASK);
if (xApprove.is() && bWarning)

View File

@@ -28,7 +28,6 @@
#include <com/sun/star/task/XInteractionRetry.hpp>
#include <com/sun/star/document/XInteractionFilterSelect.hpp>
#include <com/sun/star/document/NoSuchFilterRequest.hpp>
#include <com/sun/star/document/AmbigousFilterRequest.hpp>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <rtl/ustring.hxx>

View File

@@ -25,7 +25,6 @@
#include <com/sun/star/container/XContainerQuery.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/document/AmbigousFilterRequest.hpp>
#include <com/sun/star/document/BrokenPackageRequest.hpp>
#include <com/sun/star/document/ChangedByOthersRequest.hpp>
#include <com/sun/star/document/FilterOptionsRequest.hpp>

View File

@@ -20,7 +20,6 @@
#include <com/sun/star/beans/XPropertyAccess.hpp>
#include <com/sun/star/container/XContainerQuery.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/document/AmbigousFilterRequest.hpp>
#include <com/sun/star/document/FilterOptionsRequest.hpp>
#include <com/sun/star/document/NoSuchFilterRequest.hpp>
#include <com/sun/star/document/XImporter.hpp>
@@ -189,109 +188,6 @@ handleNoSuchFilterRequest_(
xFilterTransport->select();
}
void
handleAmbigousFilterRequest_(
Window * pParent,
uno::Reference< uno::XComponentContext > const & xContext,
document::AmbigousFilterRequest const & rRequest,
uno::Sequence<
uno::Reference<
task::XInteractionContinuation > > const & rContinuations)
{
uno::Reference< task::XInteractionAbort > xAbort;
uno::Reference< document::XInteractionFilterSelect > xFilterTransport;
getContinuations(rContinuations, &xAbort, &xFilterTransport);
uui::FilterNameList lNames;
uno::Reference< container::XNameContainer > xFilterContainer;
try
{
xFilterContainer.set( xContext->getServiceManager()->createInstanceWithContext(
OUString( "com.sun.star.document.FilterFactory"), xContext ),
uno::UNO_QUERY );
}
catch ( uno::Exception & )
{
}
if( xFilterContainer.is() )
{
uno::Any aPackedSet ;
uno::Sequence< beans::PropertyValue > lProps ;
sal_Int32 nStep ;
uui::FilterNamePair aPair ;
try
{
aPackedSet = xFilterContainer->getByName( rRequest.SelectedFilter );
}
catch(const container::NoSuchElementException&)
{
aPackedSet.clear();
}
aPackedSet >>= lProps;
for( nStep=0; nStep<lProps.getLength(); ++nStep )
{
if( lProps[nStep].Name.equalsAscii("UIName") )
{
OUString sTemp;
lProps[nStep].Value >>= sTemp;
aPair.sUI = sTemp;
aPair.sInternal = rRequest.SelectedFilter;
lNames.push_back( aPair );
break;
}
}
try
{
aPackedSet = xFilterContainer->getByName( rRequest.DetectedFilter );
}
catch(const container::NoSuchElementException&)
{
aPackedSet.clear();
}
aPackedSet >>= lProps;
for( nStep=0; nStep<lProps.getLength(); ++nStep )
{
if( lProps[nStep].Name.equalsAscii("UIName") )
{
OUString sTemp;
lProps[nStep].Value >>= sTemp;
aPair.sUI = sTemp;
aPair.sInternal = rRequest.DetectedFilter;
lNames.push_back( aPair );
break;
}
}
}
if( xAbort.is() && xFilterTransport.is() )
{
if( lNames.size() < 1 )
{
xAbort->select();
}
else
{
OUString sFilter;
executeFilterDialog( pParent,
rRequest.URL,
lNames,
sFilter );
if( !sFilter.isEmpty() )
{
xFilterTransport->setFilter( sFilter );
xFilterTransport->select();
}
else
xAbort->select();
}
}
}
void
handleFilterOptionsRequest_(
uno::Reference< uno::XComponentContext > const & xContext,
@@ -411,24 +307,6 @@ UUIInteractionHelper::handleNoSuchFilterRequest(
return false;
}
bool
UUIInteractionHelper::handleAmbigousFilterRequest(
uno::Reference< task::XInteractionRequest > const & rRequest)
{
uno::Any aAnyRequest(rRequest->getRequest());
document::AmbigousFilterRequest aAmbigousFilterRequest;
if (aAnyRequest >>= aAmbigousFilterRequest)
{
handleAmbigousFilterRequest_(getParentProperty(),
m_xContext,
aAmbigousFilterRequest,
rRequest->getContinuations());
return true;
}
return false;
}
bool
UUIInteractionHelper::handleFilterOptionsRequest(
uno::Reference< task::XInteractionRequest > const & rRequest)

View File

@@ -852,9 +852,6 @@ UUIInteractionHelper::handleRequest_impl(
if ( handleNoSuchFilterRequest( rRequest ) )
return true;
if ( handleAmbigousFilterRequest( rRequest ) )
return true;
if ( handleFilterOptionsRequest( rRequest ) )
return true;

View File

@@ -216,11 +216,6 @@ private:
com::sun::star::uno::Reference<
com::sun::star::task::XInteractionRequest > const & rRequest);
bool
handleAmbigousFilterRequest(
com::sun::star::uno::Reference<
com::sun::star::task::XInteractionRequest > const & rRequest);
bool
handleFilterOptionsRequest(
com::sun::star::uno::Reference<