Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "formcellbinding.hxx"
30 : : #include <com/sun/star/form/binding/XBindableValue.hpp>
31 : : #include <com/sun/star/form/binding/XListEntrySink.hpp>
32 : : #include <com/sun/star/form/XGridColumnFactory.hpp>
33 : : #include <com/sun/star/frame/XModel.hpp>
34 : : #include <com/sun/star/container/XChild.hpp>
35 : : #include <com/sun/star/container/XNamed.hpp>
36 : : #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
37 : : #include <com/sun/star/table/XCellRange.hpp>
38 : : #include <com/sun/star/form/XFormsSupplier.hpp>
39 : : #include <com/sun/star/form/XForm.hpp>
40 : : #include <com/sun/star/lang/XServiceInfo.hpp>
41 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
42 : : #include <com/sun/star/beans/NamedValue.hpp>
43 : : #include "strings.hxx"
44 : : #include <osl/diagnose.h>
45 : : #include <rtl/logfile.hxx>
46 : :
47 : : #include <functional>
48 : : #include <algorithm>
49 : :
50 : : //............................................................................
51 : : namespace xmloff
52 : : {
53 : : //............................................................................
54 : :
55 : : using namespace ::com::sun::star::uno;
56 : : using namespace ::com::sun::star::beans;
57 : : using namespace ::com::sun::star::frame;
58 : : using namespace ::com::sun::star::sheet;
59 : : using namespace ::com::sun::star::container;
60 : : using namespace ::com::sun::star::drawing;
61 : : using namespace ::com::sun::star::table;
62 : : using namespace ::com::sun::star::form;
63 : : using namespace ::com::sun::star::lang;
64 : : using namespace ::com::sun::star::form::binding;
65 : :
66 : : namespace
67 : : {
68 : : using ::com::sun::star::uno::Reference;
69 : : using ::com::sun::star::uno::XInterface;
70 : : using ::com::sun::star::container::XChild;
71 : : using ::com::sun::star::frame::XModel;
72 : : using ::com::sun::star::uno::UNO_QUERY;
73 : :
74 : : //....................................................................
75 : : template< class TYPE >
76 : 0 : Reference< TYPE > getTypedModelNode( const Reference< XInterface >& _rxModelNode )
77 : : {
78 [ # # ]: 0 : Reference< TYPE > xTypedNode( _rxModelNode, UNO_QUERY );
79 [ # # ]: 0 : if ( xTypedNode.is() )
80 : 0 : return xTypedNode;
81 : : else
82 : : {
83 [ # # ]: 0 : Reference< XChild > xChild( _rxModelNode, UNO_QUERY );
84 [ # # ]: 0 : if ( xChild.is() )
85 [ # # ][ # # ]: 0 : return getTypedModelNode< TYPE >( xChild->getParent() );
[ # # ]
86 : : else
87 [ # # ]: 0 : return NULL;
88 : : }
89 : : }
90 : :
91 : : //....................................................................
92 : 0 : Reference< XModel > getDocument( const Reference< XInterface >& _rxModelNode )
93 : : {
94 : 0 : return getTypedModelNode< XModel >( _rxModelNode );
95 : : }
96 : :
97 : : //....................................................................
98 : 0 : struct StringCompare : public ::std::unary_function< ::rtl::OUString, bool >
99 : : {
100 : : private:
101 : : const ::rtl::OUString m_sReference;
102 : :
103 : : public:
104 : 0 : StringCompare( const ::rtl::OUString& _rReference ) : m_sReference( _rReference ) { }
105 : :
106 : 0 : inline bool operator()( const ::rtl::OUString& _rCompare )
107 : : {
108 : 0 : return ( _rCompare == m_sReference );
109 : : }
110 : : };
111 : : }
112 : :
113 : : //========================================================================
114 : : //= FormCellBindingHelper
115 : : //========================================================================
116 : : //------------------------------------------------------------------------
117 : 0 : FormCellBindingHelper::FormCellBindingHelper( const Reference< XPropertySet >& _rxControlModel, const Reference< XModel >& _rxDocument )
118 : : :m_xControlModel( _rxControlModel )
119 [ # # ]: 0 : ,m_xDocument( _rxDocument, UNO_QUERY )
120 : : {
121 : : OSL_ENSURE( m_xControlModel.is(), "FormCellBindingHelper::FormCellBindingHelper: invalid control model!" );
122 : :
123 [ # # ]: 0 : if ( !m_xDocument.is() )
124 [ # # ][ # # ]: 0 : m_xDocument = m_xDocument.query( getDocument( m_xControlModel ) );
[ # # ]
125 : : OSL_ENSURE( m_xDocument.is(), "FormCellBindingHelper::FormCellBindingHelper: Did not find the spreadsheet document!" );
126 : 0 : }
127 : :
128 : : //------------------------------------------------------------------------
129 : 0 : sal_Bool FormCellBindingHelper::livesInSpreadsheetDocument( const Reference< XPropertySet >& _rxControlModel )
130 : : {
131 [ # # ][ # # ]: 0 : Reference< XSpreadsheetDocument > xDocument( getDocument( _rxControlModel ), UNO_QUERY );
132 : 0 : return xDocument.is();
133 : : }
134 : :
135 : : //------------------------------------------------------------------------
136 : 0 : bool FormCellBindingHelper::convertStringAddress( const ::rtl::OUString& _rAddressDescription, CellAddress& /* [out] */ _rAddress, sal_Int16 /*_nAssumeSheet*/ ) const
137 : : {
138 : 0 : Any aAddress;
139 : : return doConvertAddressRepresentations(
140 : : PROPERTY_FILE_REPRESENTATION,
141 : : makeAny( _rAddressDescription ),
142 : : PROPERTY_ADDRESS,
143 : : aAddress,
144 : : false
145 [ # # ][ # # ]: 0 : )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # #
# # ][ # # ]
146 [ # # ][ # # ]: 0 : && ( aAddress >>= _rAddress );
[ # # ]
147 : : }
148 : :
149 : : //------------------------------------------------------------------------
150 : 0 : bool FormCellBindingHelper::convertStringAddress( const ::rtl::OUString& _rAddressDescription,
151 : : CellRangeAddress& /* [out] */ _rAddress ) const
152 : : {
153 : 0 : Any aAddress;
154 : : return doConvertAddressRepresentations(
155 : : PROPERTY_FILE_REPRESENTATION,
156 : : makeAny( _rAddressDescription ),
157 : : PROPERTY_ADDRESS,
158 : : aAddress,
159 : : true
160 [ # # ][ # # ]: 0 : )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # #
# # ][ # # ]
161 [ # # ][ # # ]: 0 : && ( aAddress >>= _rAddress );
[ # # ]
162 : : }
163 : :
164 : : //------------------------------------------------------------------------
165 : 0 : Reference< XValueBinding > FormCellBindingHelper::createCellBindingFromStringAddress( const ::rtl::OUString& _rAddress, bool _bUseIntegerBinding ) const
166 : : {
167 : 0 : Reference< XValueBinding > xBinding;
168 [ # # ]: 0 : if ( !m_xDocument.is() )
169 : : // very bad ...
170 : : return xBinding;
171 : :
172 : : // get the UNO representation of the address
173 : 0 : CellAddress aAddress;
174 [ # # ][ # # ]: 0 : if ( _rAddress.isEmpty() || !convertStringAddress( _rAddress, aAddress ) )
[ # # ][ # # ]
175 : : return xBinding;
176 : :
177 : : xBinding = xBinding.query( createDocumentDependentInstance(
178 : : _bUseIntegerBinding ? SERVICE_LISTINDEXCELLBINDING : SERVICE_CELLVALUEBINDING,
179 : : PROPERTY_BOUND_CELL,
180 : : makeAny( aAddress )
181 [ # # ][ # # ]: 0 : ) );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
182 : :
183 : 0 : return xBinding;
184 : : }
185 : :
186 : : //------------------------------------------------------------------------
187 : 0 : Reference< XListEntrySource > FormCellBindingHelper::createCellListSourceFromStringAddress( const ::rtl::OUString& _rAddress ) const
188 : : {
189 : 0 : Reference< XListEntrySource > xSource;
190 : :
191 : 0 : CellRangeAddress aRangeAddress;
192 [ # # ][ # # ]: 0 : if ( !convertStringAddress( _rAddress, aRangeAddress ) )
193 : : return xSource;
194 : :
195 : : // create a range object for this address
196 : : xSource = xSource.query( createDocumentDependentInstance(
197 : : SERVICE_CELLRANGELISTSOURCE,
198 : : PROPERTY_LIST_CELL_RANGE,
199 : : makeAny( aRangeAddress )
200 [ # # ][ # # ]: 0 : ) );
[ # # ][ # # ]
[ # # ][ # # ]
201 : :
202 : 0 : return xSource;
203 : : }
204 : :
205 : : //------------------------------------------------------------------------
206 : 0 : ::rtl::OUString FormCellBindingHelper::getStringAddressFromCellBinding( const Reference< XValueBinding >& _rxBinding ) const
207 : : {
208 : : OSL_PRECOND( !_rxBinding.is() || isCellBinding( _rxBinding ), "FormCellBindingHelper::getStringAddressFromCellBinding: this is no cell binding!" );
209 : :
210 : 0 : ::rtl::OUString sAddress;
211 : : try
212 : : {
213 [ # # ]: 0 : Reference< XPropertySet > xBindingProps( _rxBinding, UNO_QUERY );
214 : : OSL_ENSURE( xBindingProps.is() || !_rxBinding.is(), "FormCellBindingHelper::getStringAddressFromCellBinding: no property set for the binding!" );
215 [ # # ]: 0 : if ( xBindingProps.is() )
216 : : {
217 : 0 : CellAddress aAddress;
218 [ # # ][ # # ]: 0 : xBindingProps->getPropertyValue( PROPERTY_BOUND_CELL ) >>= aAddress;
[ # # ][ # # ]
219 : :
220 : 0 : Any aStringAddress;
221 : : doConvertAddressRepresentations( PROPERTY_ADDRESS, makeAny( aAddress ),
222 [ # # ][ # # ]: 0 : PROPERTY_FILE_REPRESENTATION, aStringAddress, false );
[ # # ][ # # ]
223 : :
224 : 0 : aStringAddress >>= sAddress;
225 [ # # ]: 0 : }
226 : : }
227 [ # # ]: 0 : catch( const Exception& )
228 : : {
229 : : OSL_FAIL( "FormCellBindingHelper::getStringAddressFromCellBinding: caught an exception!" );
230 : : }
231 : :
232 : 0 : return sAddress;
233 : : }
234 : :
235 : : //------------------------------------------------------------------------
236 : 0 : ::rtl::OUString FormCellBindingHelper::getStringAddressFromCellListSource( const Reference< XListEntrySource >& _rxSource ) const
237 : : {
238 : : OSL_PRECOND( !_rxSource.is() || isCellRangeListSource( _rxSource ), "FormCellBindingHelper::getStringAddressFromCellListSource: this is no cell list source!" );
239 : :
240 : 0 : ::rtl::OUString sAddress;
241 : : try
242 : : {
243 [ # # ]: 0 : Reference< XPropertySet > xSourceProps( _rxSource, UNO_QUERY );
244 : : OSL_ENSURE( xSourceProps.is() || !_rxSource.is(), "FormCellBindingHelper::getStringAddressFromCellListSource: no property set for the list source!" );
245 [ # # ]: 0 : if ( xSourceProps.is() )
246 : : {
247 : 0 : CellRangeAddress aRangeAddress;
248 [ # # ][ # # ]: 0 : xSourceProps->getPropertyValue( PROPERTY_LIST_CELL_RANGE ) >>= aRangeAddress;
[ # # ][ # # ]
249 : :
250 : 0 : Any aStringAddress;
251 : : doConvertAddressRepresentations( PROPERTY_ADDRESS, makeAny( aRangeAddress ),
252 [ # # ][ # # ]: 0 : PROPERTY_FILE_REPRESENTATION, aStringAddress, true );
[ # # ][ # # ]
253 : 0 : aStringAddress >>= sAddress;
254 [ # # ]: 0 : }
255 : : }
256 [ # # ]: 0 : catch( const Exception& )
257 : : {
258 : : OSL_FAIL( "FormCellBindingHelper::getStringAddressFromCellListSource: caught an exception!" );
259 : : }
260 : :
261 : 0 : return sAddress;
262 : : }
263 : :
264 : : //------------------------------------------------------------------------
265 : 0 : bool FormCellBindingHelper::isSpreadsheetDocumentWhichSupplies( const Reference< XSpreadsheetDocument >& _rxDocument, const ::rtl::OUString& _rService ) SAL_THROW(())
266 : : {
267 : 0 : bool bYesItIs = false;
268 : :
269 : : try
270 : : {
271 [ # # ]: 0 : Reference< XServiceInfo > xSI( _rxDocument, UNO_QUERY );
272 [ # # ][ # # ]: 0 : if ( xSI.is() && xSI->supportsService( SERVICE_SPREADSHEET_DOCUMENT ) )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # # # ]
273 : : {
274 [ # # ]: 0 : Reference< XMultiServiceFactory > xDocumentFactory( _rxDocument, UNO_QUERY );
275 : : OSL_ENSURE( xDocumentFactory.is(), "FormCellBindingHelper::isSpreadsheetDocumentWhichSupplies: spreadsheet document, but no factory?" );
276 : :
277 [ # # ]: 0 : Sequence< ::rtl::OUString > aAvailableServices;
278 [ # # ]: 0 : if ( xDocumentFactory.is() )
279 [ # # ][ # # ]: 0 : aAvailableServices = xDocumentFactory->getAvailableServiceNames( );
[ # # ][ # # ]
280 : :
281 : : const ::rtl::OUString* pFound = ::std::find_if(
282 : : aAvailableServices.getConstArray(),
283 : 0 : aAvailableServices.getConstArray() + aAvailableServices.getLength(),
284 : : StringCompare( _rService )
285 [ # # ]: 0 : );
286 [ # # ]: 0 : if ( pFound - aAvailableServices.getConstArray() < aAvailableServices.getLength() )
287 : : {
288 : 0 : bYesItIs = true;
289 [ # # ]: 0 : }
290 [ # # ]: 0 : }
291 : : }
292 : 0 : catch( const Exception& )
293 : : {
294 : : OSL_FAIL( "FormCellBindingHelper::isSpreadsheetDocumentWhichSupplies: caught an exception!" );
295 : : }
296 : :
297 : 0 : return bYesItIs;
298 : : }
299 : :
300 : : //------------------------------------------------------------------------
301 : 0 : bool FormCellBindingHelper::isSpreadsheetDocumentWhichSupplies( const ::rtl::OUString& _rService ) const SAL_THROW(())
302 : : {
303 : 0 : return isSpreadsheetDocumentWhichSupplies( m_xDocument, _rService );
304 : : }
305 : :
306 : : //------------------------------------------------------------------------
307 : 0 : bool FormCellBindingHelper::isListCellRangeAllowed( const Reference< XModel >& _rxDocument )
308 : : {
309 : : return isSpreadsheetDocumentWhichSupplies(
310 : : Reference< XSpreadsheetDocument >( _rxDocument, UNO_QUERY ),
311 : : SERVICE_CELLRANGELISTSOURCE
312 [ # # ][ # # ]: 0 : );
313 : : }
314 : :
315 : : //------------------------------------------------------------------------
316 : 0 : bool FormCellBindingHelper::isListCellRangeAllowed( ) const
317 : : {
318 : 0 : bool bAllow( false );
319 : :
320 [ # # ]: 0 : Reference< XListEntrySink > xSink( m_xControlModel, UNO_QUERY );
321 [ # # ]: 0 : if ( xSink.is() )
322 : : {
323 [ # # ][ # # ]: 0 : bAllow = isSpreadsheetDocumentWhichSupplies( SERVICE_CELLRANGELISTSOURCE );
324 : : }
325 : :
326 : 0 : return bAllow;
327 : : }
328 : :
329 : : //------------------------------------------------------------------------
330 : 0 : bool FormCellBindingHelper::isCellBindingAllowed( ) const
331 : : {
332 : 0 : bool bAllow( false );
333 : :
334 [ # # ]: 0 : Reference< XBindableValue > xBindable( m_xControlModel, UNO_QUERY );
335 [ # # ]: 0 : if ( xBindable.is() )
336 : : {
337 : : // the control can potentially be bound to an external value
338 : : // Does it live within a Calc document, and is able to supply CellBindings?
339 [ # # ][ # # ]: 0 : bAllow = isSpreadsheetDocumentWhichSupplies( SERVICE_CELLVALUEBINDING );
340 : : }
341 : :
342 : 0 : return bAllow;
343 : : }
344 : :
345 : : //------------------------------------------------------------------------
346 : 0 : bool FormCellBindingHelper::isCellBindingAllowed( const Reference< XModel >& _rxDocument )
347 : : {
348 : : return isSpreadsheetDocumentWhichSupplies(
349 : : Reference< XSpreadsheetDocument >( _rxDocument, UNO_QUERY ),
350 : : SERVICE_CELLVALUEBINDING
351 [ # # ][ # # ]: 0 : );
352 : : }
353 : :
354 : : //------------------------------------------------------------------------
355 : 0 : bool FormCellBindingHelper::isCellBinding( const Reference< XValueBinding >& _rxBinding ) const
356 : : {
357 [ # # ][ # # ]: 0 : return doesComponentSupport( _rxBinding.get(), SERVICE_CELLVALUEBINDING );
[ # # ]
358 : : }
359 : :
360 : : //------------------------------------------------------------------------
361 : 0 : bool FormCellBindingHelper::isCellIntegerBinding( const Reference< XValueBinding >& _rxBinding ) const
362 : : {
363 [ # # ][ # # ]: 0 : return doesComponentSupport( _rxBinding.get(), SERVICE_LISTINDEXCELLBINDING );
[ # # ]
364 : : }
365 : :
366 : : //------------------------------------------------------------------------
367 : 0 : bool FormCellBindingHelper::isCellRangeListSource( const Reference< XListEntrySource >& _rxSource ) const
368 : : {
369 [ # # ][ # # ]: 0 : return doesComponentSupport( _rxSource.get(), SERVICE_CELLRANGELISTSOURCE );
[ # # ]
370 : : }
371 : :
372 : : //------------------------------------------------------------------------
373 : 0 : bool FormCellBindingHelper::doesComponentSupport( const Reference< XInterface >& _rxComponent, const ::rtl::OUString& _rService ) const
374 : : {
375 : 0 : bool bDoes = false;
376 [ # # ]: 0 : Reference< XServiceInfo > xSI( _rxComponent, UNO_QUERY );
377 [ # # ][ # # ]: 0 : bDoes = xSI.is() && xSI->supportsService( _rService );
[ # # ][ # # ]
378 : 0 : return bDoes;
379 : : }
380 : :
381 : : //------------------------------------------------------------------------
382 : 0 : Reference< XValueBinding > FormCellBindingHelper::getCurrentBinding( ) const
383 : : {
384 : 0 : Reference< XValueBinding > xBinding;
385 [ # # ]: 0 : Reference< XBindableValue > xBindable( m_xControlModel, UNO_QUERY );
386 [ # # ]: 0 : if ( xBindable.is() )
387 [ # # ][ # # ]: 0 : xBinding = xBindable->getValueBinding();
[ # # ]
388 : 0 : return xBinding;
389 : : }
390 : :
391 : : //------------------------------------------------------------------------
392 : 0 : Reference< XListEntrySource > FormCellBindingHelper::getCurrentListSource( ) const
393 : : {
394 : 0 : Reference< XListEntrySource > xSource;
395 [ # # ]: 0 : Reference< XListEntrySink > xSink( m_xControlModel, UNO_QUERY );
396 [ # # ]: 0 : if ( xSink.is() )
397 [ # # ][ # # ]: 0 : xSource = xSink->getListEntrySource();
[ # # ]
398 : 0 : return xSource;
399 : : }
400 : :
401 : : //------------------------------------------------------------------------
402 : 0 : void FormCellBindingHelper::setBinding( const Reference< XValueBinding >& _rxBinding )
403 : : {
404 [ # # ]: 0 : Reference< XBindableValue > xBindable( m_xControlModel, UNO_QUERY );
405 : : OSL_PRECOND( xBindable.is(), "FormCellBindingHelper::setBinding: the object is not bindable!" );
406 [ # # ]: 0 : if ( xBindable.is() )
407 [ # # ][ # # ]: 0 : xBindable->setValueBinding( _rxBinding );
408 : 0 : }
409 : :
410 : : //------------------------------------------------------------------------
411 : 0 : void FormCellBindingHelper::setListSource( const Reference< XListEntrySource >& _rxSource )
412 : : {
413 [ # # ]: 0 : Reference< XListEntrySink > xSink( m_xControlModel, UNO_QUERY );
414 : : OSL_PRECOND( xSink.is(), "FormCellBindingHelper::setListSource: the object is no list entry sink!" );
415 [ # # ]: 0 : if ( xSink.is() )
416 [ # # ][ # # ]: 0 : xSink->setListEntrySource( _rxSource );
417 : 0 : }
418 : :
419 : : //------------------------------------------------------------------------
420 : 0 : Reference< XInterface > FormCellBindingHelper::createDocumentDependentInstance( const ::rtl::OUString& _rService, const ::rtl::OUString& _rArgumentName,
421 : : const Any& _rArgumentValue ) const
422 : : {
423 : 0 : Reference< XInterface > xReturn;
424 : :
425 [ # # ]: 0 : Reference< XMultiServiceFactory > xDocumentFactory( m_xDocument, UNO_QUERY );
426 : : OSL_ENSURE( xDocumentFactory.is(), "FormCellBindingHelper::createDocumentDependentInstance: no document service factory!" );
427 [ # # ]: 0 : if ( xDocumentFactory.is() )
428 : : {
429 : : try
430 : : {
431 [ # # ]: 0 : if ( !_rArgumentName.isEmpty() )
432 : : {
433 : 0 : NamedValue aArg;
434 : 0 : aArg.Name = _rArgumentName;
435 : 0 : aArg.Value = _rArgumentValue;
436 : :
437 [ # # ]: 0 : Sequence< Any > aArgs( 1 );
438 [ # # ][ # # ]: 0 : aArgs[ 0 ] <<= aArg;
439 : :
440 [ # # ][ # # ]: 0 : xReturn = xDocumentFactory->createInstanceWithArguments( _rService, aArgs );
[ # # ][ # # ]
441 : : }
442 : : else
443 : : {
444 [ # # ][ # # ]: 0 : xReturn = xDocumentFactory->createInstance( _rService );
[ # # ][ # # ]
445 : : }
446 : : }
447 [ # # ]: 0 : catch ( const Exception& )
448 : : {
449 : : OSL_FAIL( "FormCellBindingHelper::createDocumentDependentInstance: could not create the binding at the document!" );
450 : : }
451 : : }
452 : 0 : return xReturn;
453 : : }
454 : :
455 : : //------------------------------------------------------------------------
456 : 0 : bool FormCellBindingHelper::doConvertAddressRepresentations( const ::rtl::OUString& _rInputProperty, const Any& _rInputValue,
457 : : const ::rtl::OUString& _rOutputProperty, Any& _rOutputValue, bool _bIsRange ) const SAL_THROW(())
458 : : {
459 : 0 : bool bSuccess = false;
460 : :
461 : : Reference< XPropertySet > xConverter(
462 : : createDocumentDependentInstance(
463 : : _bIsRange ? SERVICE_RANGEADDRESS_CONVERSION : SERVICE_ADDRESS_CONVERSION,
464 : : ::rtl::OUString(),
465 : : Any()
466 : : ),
467 : : UNO_QUERY
468 [ # # ][ # # ]: 0 : );
[ # # ][ # # ]
[ # # ]
469 : : OSL_ENSURE( xConverter.is(), "FormCellBindingHelper::doConvertAddressRepresentations: could not get a converter service!" );
470 [ # # ]: 0 : if ( xConverter.is() )
471 : : {
472 : : try
473 : : {
474 [ # # ][ # # ]: 0 : xConverter->setPropertyValue( _rInputProperty, _rInputValue );
475 [ # # ][ # # ]: 0 : _rOutputValue = xConverter->getPropertyValue( _rOutputProperty );
476 : 0 : bSuccess = true;
477 : : }
478 [ # # ]: 0 : catch( const Exception& )
479 : : {
480 : : OSL_FAIL( "FormCellBindingHelper::doConvertAddressRepresentations: caught an exception!" );
481 : : }
482 : : }
483 : :
484 : 0 : return bSuccess;
485 : : }
486 : :
487 : : //............................................................................
488 : : } // namespace xmloff
489 : : //............................................................................
490 : :
491 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|