1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include "precompiled_comphelper.hxx"
25 
26 #include "comphelper/ihwrapnofilter.hxx"
27 #include <com/sun/star/document/NoSuchFilterRequest.hpp>
28 
29 //.........................................................................
30 namespace comphelper
31 {
32 //.........................................................................
33 
34     using namespace ::com::sun::star;
35 
36     //----------------------------------------------------------------------------------------------------
OIHWrapNoFilterDialog(uno::Reference<task::XInteractionHandler> xInteraction)37     OIHWrapNoFilterDialog::OIHWrapNoFilterDialog( uno::Reference< task::XInteractionHandler > xInteraction )
38         :m_xInter( xInteraction )
39     {
40     }
41 
~OIHWrapNoFilterDialog()42     OIHWrapNoFilterDialog::~OIHWrapNoFilterDialog()
43     {
44     }
45 
46     //----------------------------------------------------------------------------------------------------
impl_staticGetSupportedServiceNames()47     uno::Sequence< ::rtl::OUString > SAL_CALL OIHWrapNoFilterDialog::impl_staticGetSupportedServiceNames()
48     {
49         uno::Sequence< ::rtl::OUString > aRet(1);
50         aRet[0] = ::rtl::OUString::createFromAscii("com.sun.star.task.InteractionHandlerWrapper");
51         return aRet;
52     }
53 
impl_staticGetImplementationName()54     ::rtl::OUString SAL_CALL OIHWrapNoFilterDialog::impl_staticGetImplementationName()
55     {
56         return ::rtl::OUString::createFromAscii("com.sun.star.comp.task.InteractionHandlerWrapper");
57     }
58 
59     //----------------------------------------------------------------------------------------------------
60     // XInteractionHandler
61     //----------------------------------------------------------------------------------------------------
handle(const uno::Reference<task::XInteractionRequest> & xRequest)62     void SAL_CALL OIHWrapNoFilterDialog::handle( const uno::Reference< task::XInteractionRequest >& xRequest)
63             throw( com::sun::star::uno::RuntimeException )
64     {
65         if( !m_xInter.is() )
66             return;
67 
68         uno::Any aRequest = xRequest->getRequest();
69         document::NoSuchFilterRequest aNoSuchFilterRequest;
70         if ( aRequest >>= aNoSuchFilterRequest )
71             return;
72         else
73             m_xInter->handle( xRequest );
74     }
75 
76     //----------------------------------------------------------------------------------------------------
77     // XInitialization
78     //----------------------------------------------------------------------------------------------------
initialize(const uno::Sequence<uno::Any> &)79     void SAL_CALL OIHWrapNoFilterDialog::initialize( const uno::Sequence< uno::Any >& )
80         throw ( uno::Exception,
81         uno::RuntimeException,
82         frame::DoubleInitializationException )
83     {
84     }
85 
86     //----------------------------------------------------------------------------------------------------
87     // XServiceInfo
88     //----------------------------------------------------------------------------------------------------
89 
getImplementationName()90     ::rtl::OUString SAL_CALL OIHWrapNoFilterDialog::getImplementationName()
91         throw ( uno::RuntimeException )
92     {
93         return impl_staticGetImplementationName();
94     }
95 
supportsService(const::rtl::OUString & ServiceName)96     ::sal_Bool SAL_CALL OIHWrapNoFilterDialog::supportsService( const ::rtl::OUString& ServiceName )
97         throw ( uno::RuntimeException )
98     {
99         uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
100 
101         for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
102             if ( ServiceName.compareTo( aSeq[nInd] ) == 0 )
103                 return sal_True;
104 
105         return sal_False;
106     }
107 
getSupportedServiceNames()108     uno::Sequence< ::rtl::OUString > SAL_CALL OIHWrapNoFilterDialog::getSupportedServiceNames()
109         throw ( uno::RuntimeException )
110     {
111         return impl_staticGetSupportedServiceNames();
112     }
113 }
114