xref: /trunk/main/comphelper/source/misc/ihwrapnofilter.cxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
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     {
64         if( !m_xInter.is() )
65             return;
66 
67         uno::Any aRequest = xRequest->getRequest();
68         document::NoSuchFilterRequest aNoSuchFilterRequest;
69         if ( aRequest >>= aNoSuchFilterRequest )
70             return;
71         else
72             m_xInter->handle( xRequest );
73     }
74 
75     //----------------------------------------------------------------------------------------------------
76     // XInitialization
77     //----------------------------------------------------------------------------------------------------
initialize(const uno::Sequence<uno::Any> &)78     void SAL_CALL OIHWrapNoFilterDialog::initialize( const uno::Sequence< uno::Any >& )
79     {
80     }
81 
82     //----------------------------------------------------------------------------------------------------
83     // XServiceInfo
84     //----------------------------------------------------------------------------------------------------
85 
getImplementationName()86     ::rtl::OUString SAL_CALL OIHWrapNoFilterDialog::getImplementationName()
87     {
88         return impl_staticGetImplementationName();
89     }
90 
supportsService(const::rtl::OUString & ServiceName)91     ::sal_Bool SAL_CALL OIHWrapNoFilterDialog::supportsService( const ::rtl::OUString& ServiceName )
92     {
93         uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
94 
95         for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
96             if ( ServiceName.compareTo( aSeq[nInd] ) == 0 )
97                 return sal_True;
98 
99         return sal_False;
100     }
101 
getSupportedServiceNames()102     uno::Sequence< ::rtl::OUString > SAL_CALL OIHWrapNoFilterDialog::getSupportedServiceNames()
103     {
104         return impl_staticGetSupportedServiceNames();
105     }
106 }
107