1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: interaction.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_framework.hxx"
34 //_________________________________________________________________________________________________________________
36 //_________________________________________________________________________________________________________________
37 #include <dispatch/interaction.hxx>
40 //_________________________________________________________________________________________________________________
42 //_________________________________________________________________________________________________________________
44 //_________________________________________________________________________________________________________________
45 // includes of other projects
46 //_________________________________________________________________________________________________________________
48 //_________________________________________________________________________________________________________________
50 //_________________________________________________________________________________________________________________
54 //_________________________________________________________________________________________________________________
56 //_________________________________________________________________________________________________________________
58 //_________________________________________________________________________________________________________________
59 // non exported definitions
60 //_________________________________________________________________________________________________________________
62 //_________________________________________________________________________________________________________________
64 //_________________________________________________________________________________________________________________
66 //---------------------------------------------------------------------------------------------------------
67 // initialize continuation with right start values
68 //---------------------------------------------------------------------------------------------------------
69 ContinuationFilterSelect::ContinuationFilterSelect()
70 : m_sFilter( ::rtl::OUString() )
74 //---------------------------------------------------------------------------------------------------------
75 // handler should use it after selection to set user specified filter for transport
76 //---------------------------------------------------------------------------------------------------------
77 void SAL_CALL
ContinuationFilterSelect::setFilter( const ::rtl::OUString
& sFilter
) throw( css::uno::RuntimeException
)
82 //---------------------------------------------------------------------------------------------------------
83 // read access to transported filter
84 //---------------------------------------------------------------------------------------------------------
85 ::rtl::OUString SAL_CALL
ContinuationFilterSelect::getFilter() throw( css::uno::RuntimeException
)
90 //---------------------------------------------------------------------------------------------------------
91 // initialize instance with all neccessary informations
92 // We use it without any further checks on our member then ...!
93 //---------------------------------------------------------------------------------------------------------
94 RequestFilterSelect::RequestFilterSelect( const ::rtl::OUString
& sURL
)
97 css::uno::Reference
< css::uno::XInterface
> temp2
;
98 css::document::NoSuchFilterRequest
aFilterRequest( temp
,
101 m_aRequest
<<= aFilterRequest
;
103 m_pAbort
= new ContinuationAbort
;
104 m_pFilter
= new ContinuationFilterSelect
;
106 m_lContinuations
.realloc( 2 );
107 m_lContinuations
[0] = css::uno::Reference
< css::task::XInteractionContinuation
>( m_pAbort
);
108 m_lContinuations
[1] = css::uno::Reference
< css::task::XInteractionContinuation
>( m_pFilter
);
111 //---------------------------------------------------------------------------------------------------------
112 // return abort state of interaction
113 // If it is true, return value of method "getFilter()" will be unspecified then!
114 //---------------------------------------------------------------------------------------------------------
115 sal_Bool
RequestFilterSelect::isAbort() const
117 return m_pAbort
->isSelected();
120 //---------------------------------------------------------------------------------------------------------
121 // return user selected filter
122 // Return value valid for non aborted interaction only. Please check "isAbort()" before you call these ony!
123 //---------------------------------------------------------------------------------------------------------
124 ::rtl::OUString
RequestFilterSelect::getFilter() const
126 return m_pFilter
->getFilter();
129 //---------------------------------------------------------------------------------------------------------
130 // handler call it to get type of request
131 // Is hard coded to "please select filter" here. see ctor for further informations.
132 //---------------------------------------------------------------------------------------------------------
133 css::uno::Any SAL_CALL
RequestFilterSelect::getRequest() throw( css::uno::RuntimeException
)
138 //---------------------------------------------------------------------------------------------------------
139 // handler call it to get possible continuations
140 // We support "abort/select_filter" only here.
141 // After interaction we support read access on these continuations on our c++ interface to
142 // return user decision.
143 //---------------------------------------------------------------------------------------------------------
144 css::uno::Sequence
< css::uno::Reference
< css::task::XInteractionContinuation
> > SAL_CALL
RequestFilterSelect::getContinuations() throw( css::uno::RuntimeException
)
146 return m_lContinuations
;
149 //---------------------------------------------------------------------------------------------------------
150 // initialize instance with all neccessary informations
151 // We use it without any further checks on our member then ...!
152 //---------------------------------------------------------------------------------------------------------
153 RequestAmbigousFilter::RequestAmbigousFilter( const ::rtl::OUString
& sURL
,
154 const ::rtl::OUString
& sSelectedFilter
,
155 const ::rtl::OUString
& sDetectedFilter
)
157 ::rtl::OUString temp
;
158 css::uno::Reference
< css::uno::XInterface
> temp2
;
159 css::document::AmbigousFilterRequest
aFilterRequest( temp
,
164 m_aRequest
<<= aFilterRequest
;
166 m_pAbort
= new ContinuationAbort
;
167 m_pFilter
= new ContinuationFilterSelect
;
169 m_lContinuations
.realloc( 2 );
170 m_lContinuations
[0] = css::uno::Reference
< css::task::XInteractionContinuation
>( m_pAbort
);
171 m_lContinuations
[1] = css::uno::Reference
< css::task::XInteractionContinuation
>( m_pFilter
);
174 //---------------------------------------------------------------------------------------------------------
175 // return abort state of interaction
176 // If it is true, return value of method "getFilter()" will be unspecified then!
177 //---------------------------------------------------------------------------------------------------------
178 sal_Bool
RequestAmbigousFilter::isAbort() const
180 return m_pAbort
->isSelected();
183 //---------------------------------------------------------------------------------------------------------
184 // return user selected filter
185 // Return value valid for non aborted interaction only. Please check "isAbort()" before you call these ony!
186 //---------------------------------------------------------------------------------------------------------
187 ::rtl::OUString
RequestAmbigousFilter::getFilter() const
189 return m_pFilter
->getFilter();
192 //---------------------------------------------------------------------------------------------------------
193 // handler call it to get type of request
194 // Is hard coded to "please select filter" here. see ctor for further informations.
195 //---------------------------------------------------------------------------------------------------------
196 css::uno::Any SAL_CALL
RequestAmbigousFilter::getRequest() throw( css::uno::RuntimeException
)
201 //---------------------------------------------------------------------------------------------------------
202 // handler call it to get possible continuations
203 // We support "abort/select_filter" only here.
204 // After interaction we support read access on these continuations on our c++ interface to
205 // return user decision.
206 //---------------------------------------------------------------------------------------------------------
207 css::uno::Sequence
< css::uno::Reference
< css::task::XInteractionContinuation
> > SAL_CALL
RequestAmbigousFilter::getContinuations() throw( css::uno::RuntimeException
)
209 return m_lContinuations
;
212 } // namespace framework