Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include "model.hxx"
22 :
23 : #include "model_helper.hxx"
24 : #include "unohelper.hxx"
25 : #include "binding.hxx"
26 : #include "submission.hxx"
27 : #include "mip.hxx"
28 : #include "evaluationcontext.hxx"
29 : #include "xmlhelper.hxx"
30 : #include "datatyperepository.hxx"
31 : #include "NameContainer.hxx"
32 :
33 : #include <rtl/ustring.hxx>
34 : #include <rtl/ustrbuf.hxx>
35 : #include <tools/debug.hxx>
36 :
37 : #include <comphelper/propertysetinfo.hxx>
38 : #include <comphelper/processfactory.hxx>
39 : #include <cppuhelper/supportsservice.hxx>
40 : #include <cppuhelper/typeprovider.hxx>
41 :
42 : #include <algorithm>
43 :
44 : // UNO classes
45 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
46 : #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
47 : #include <com/sun/star/lang/IllegalArgumentException.hpp>
48 : #include <com/sun/star/xml/dom/XDocument.hpp>
49 : #include <com/sun/star/xml/dom/XCharacterData.hpp>
50 : #include <com/sun/star/xml/dom/NodeType.hpp>
51 : #include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
52 : #include <com/sun/star/uno/Sequence.hxx>
53 : #include <com/sun/star/beans/PropertyValue.hpp>
54 : #include <com/sun/star/ucb/SimpleFileAccess.hpp>
55 : #include <com/sun/star/io/XInputStream.hpp>
56 :
57 :
58 : using com::sun::star::lang::XMultiServiceFactory;
59 : using com::sun::star::lang::XUnoTunnel;
60 : using com::sun::star::beans::XPropertySet;
61 : using com::sun::star::beans::PropertyValue;
62 : using com::sun::star::beans::PropertyVetoException;
63 : using com::sun::star::beans::UnknownPropertyException;
64 : using com::sun::star::util::VetoException;
65 : using com::sun::star::lang::WrappedTargetException;
66 : using com::sun::star::lang::IllegalArgumentException;
67 : using com::sun::star::ucb::XSimpleFileAccess3;
68 : using com::sun::star::ucb::SimpleFileAccess;
69 : using com::sun::star::io::XInputStream;
70 :
71 : using namespace com::sun::star::uno;
72 : using namespace com::sun::star::xml::dom;
73 : using namespace xforms;
74 :
75 :
76 : #if OSL_DEBUG_LEVEL > 1
77 : #define DBG_INVARIANT_TYPE(TYPE) class DBG_##TYPE { const TYPE* mpT; void check() { mpT->dbg_assertInvariant(); } public: DBG_##TYPE(const TYPE* pT) : mpT(pT) { check(); } ~DBG_##TYPE() { check(); } } _DBG_##TYPE(this);
78 :
79 : #define DBG_INVARIANT() DBG_INVARIANT_TYPE(Model)
80 : #else
81 : #define DBG_INVARIANT()
82 : #endif
83 :
84 :
85 :
86 :
87 : // The Model
88 :
89 :
90 0 : void Model::ensureAtLeastOneInstance()
91 : {
92 0 : if( ! mpInstances->hasItems() )
93 : {
94 : // create a default instance
95 0 : newInstance( OUString(), OUString(), true );
96 : }
97 0 : }
98 :
99 :
100 :
101 : /** Model default constructor; create empty model */
102 1 : Model::Model() :
103 : msID(),
104 : mpBindings( NULL ),
105 : mpSubmissions( NULL ),
106 1 : mpInstances( new InstanceCollection ),
107 0 : mxNamespaces( new NameContainer<OUString>() ),
108 : mxBindings( mpBindings ),
109 : mxSubmissions( mpSubmissions ),
110 : mxInstances( mpInstances ),
111 : mbInitialized( false ),
112 2 : mbExternalData( true )
113 : {
114 1 : initializePropertySet();
115 :
116 : // initialize bindings collections
117 : // (not in initializer list to avoid use of incomplete 'this')
118 1 : mpBindings = new BindingCollection( this );
119 1 : mxBindings = mpBindings;
120 :
121 1 : mpSubmissions = new SubmissionCollection( this );
122 1 : mxSubmissions = mpSubmissions;
123 :
124 : // invariant only holds after construction
125 : DBG_INVARIANT();
126 1 : }
127 :
128 3 : Model::~Model() throw()
129 : {
130 : // give up bindings & submissions; the mxBindings/mxSubmissions
131 : // references will then delete them
132 1 : mpBindings = NULL;
133 1 : mpSubmissions = NULL;
134 2 : }
135 :
136 0 : static Model* lcl_getModel( const Reference<XUnoTunnel>& xTunnel )
137 : {
138 0 : Model* pModel = NULL;
139 0 : if( xTunnel.is() )
140 : pModel = reinterpret_cast<Model*>(
141 0 : xTunnel->getSomething( Model::getUnoTunnelID() ) );
142 0 : return pModel;
143 : }
144 :
145 0 : Model* Model::getModel( const Reference<XModel>& xModel )
146 : {
147 0 : return lcl_getModel( Reference<XUnoTunnel>( xModel, UNO_QUERY ) );
148 : }
149 :
150 0 : EvaluationContext Model::getEvaluationContext()
151 : {
152 : // the default context is the top-level element node. A default
153 : // node (instanceData' is inserted when there is no default node
154 0 : Reference<XDocument> xInstance = getDefaultInstance();
155 0 : Reference<XNode> xElement( xInstance->getDocumentElement(), UNO_QUERY );
156 :
157 : // no element found? Then insert default element 'instanceData'
158 0 : if( ! xElement.is() )
159 : {
160 0 : xElement = Reference<XNode>(
161 0 : xInstance->createElement( "instanceData" ),
162 0 : UNO_QUERY_THROW );
163 0 : xInstance->appendChild( xElement );
164 : }
165 :
166 : OSL_ENSURE( xElement.is() &&
167 : xElement->getNodeType() == NodeType_ELEMENT_NODE,
168 : "no element in evaluation context" );
169 :
170 0 : return EvaluationContext( xElement, this, mxNamespaces, 0, 1 );
171 : }
172 :
173 :
174 0 : Model::IntSequence_t Model::getUnoTunnelID()
175 : {
176 0 : static cppu::OImplementationId aImplementationId;
177 0 : return aImplementationId.getImplementationId();
178 : }
179 :
180 :
181 0 : void Model::setForeignSchema( const XDocument_t& rDocument )
182 : {
183 0 : mxForeignSchema = rDocument;
184 0 : }
185 :
186 :
187 0 : void Model::setSchemaRef( const OUString& rSchemaRef )
188 : {
189 0 : msSchemaRef = rSchemaRef;
190 0 : }
191 :
192 :
193 0 : void Model::setNamespaces( const XNameContainer_t& rNamespaces )
194 : {
195 0 : if( rNamespaces.is() )
196 0 : mxNamespaces = rNamespaces;
197 0 : }
198 :
199 :
200 0 : void Model::setExternalData( bool _bData )
201 : {
202 0 : mbExternalData = _bData;
203 0 : }
204 :
205 : #if OSL_DEBUG_LEVEL > 1
206 : void Model::dbg_assertInvariant() const
207 : {
208 : OSL_ENSURE( mpInstances != NULL, "no instances found" );
209 : OSL_ENSURE( mxInstances.is(), "No instance container!" );
210 :
211 : OSL_ENSURE( mpBindings != NULL, "no bindings element" );
212 : OSL_ENSURE( mxBindings.is(), "No Bindings container" );
213 :
214 : OSL_ENSURE( mpSubmissions != NULL, "no submissions element" );
215 : OSL_ENSURE( mxSubmissions.is(), "No Submission container" );
216 : }
217 : #endif
218 :
219 :
220 :
221 : // MIP management
222 0 : void Model::addMIP( void* pTag, const XNode_t& xNode, const MIP& rMIP )
223 : {
224 : OSL_ENSURE( pTag != NULL, "empty tag?" );
225 : OSL_ENSURE( xNode.is(), "no node" );
226 :
227 0 : MIPs_t::value_type aValue( xNode, ::std::pair<void*,MIP>( pTag, rMIP ) );
228 0 : maMIPs.insert( aValue );
229 0 : }
230 :
231 0 : void Model::removeMIPs( void* pTag )
232 : {
233 : OSL_ENSURE( pTag != NULL, "empty tag?" );
234 :
235 0 : for( MIPs_t::iterator aIter = maMIPs.begin();
236 0 : aIter != maMIPs.end(); )
237 : {
238 0 : if( aIter->second.first == pTag )
239 : {
240 0 : MIPs_t::iterator next( aIter ); ++next;
241 0 : maMIPs.erase( aIter );
242 0 : aIter = next;
243 : }
244 : else
245 0 : ++aIter;
246 : }
247 0 : }
248 :
249 0 : MIP Model::queryMIP( const XNode_t& xNode ) const
250 : {
251 : // travel up inheritance chain and inherit MIPs
252 0 : MIP aRet;
253 0 : for( XNode_t xCurrent = xNode;
254 : xCurrent.is();
255 0 : xCurrent = xCurrent->getParentNode() )
256 : {
257 : // iterate over all MIPs for this node, and join MIPs
258 0 : MIP aMIP;
259 0 : MIPs_t::const_iterator aEnd = maMIPs.upper_bound( xCurrent );
260 0 : MIPs_t::const_iterator aIter = maMIPs.lower_bound( xCurrent );
261 0 : for( ; aIter != aEnd; ++aIter )
262 0 : aMIP.join( aIter->second.second );
263 :
264 : // inherit from current node (or set if we are at the start node)
265 0 : if( xCurrent == xNode )
266 0 : aRet = aMIP;
267 : else
268 0 : aRet.inherit( aMIP );
269 0 : }
270 :
271 0 : return aRet;
272 : }
273 :
274 :
275 :
276 0 : void Model::rebind()
277 : {
278 : OSL_ENSURE( mpBindings != NULL, "bindings?" );
279 :
280 : // iterate over all bindings and call update
281 0 : sal_Int32 nCount = mpBindings->countItems();
282 0 : for( sal_Int32 i = 0; i < nCount; i++ )
283 : {
284 0 : Binding* pBind = Binding::getBinding( mpBindings->Collection<XPropertySet_t>::getItem( i ) );
285 : OSL_ENSURE( pBind != NULL, "binding?" );
286 0 : pBind->update();
287 : }
288 0 : }
289 :
290 :
291 :
292 0 : void Model::deferNotifications( bool bDefer )
293 : {
294 : // iterate over all bindings and defer notifications
295 0 : sal_Int32 nCount = mpBindings->countItems();
296 0 : for( sal_Int32 i = 0; i < nCount; i++ )
297 : {
298 0 : Binding* pBind = Binding::getBinding( mpBindings->Collection<XPropertySet_t>::getItem( i ) );
299 : OSL_ENSURE( pBind != NULL, "binding?" );
300 0 : pBind->deferNotifications( bDefer );
301 : }
302 0 : }
303 :
304 :
305 0 : bool Model::setSimpleContent( const XNode_t& xConstNode,
306 : const OUString& sValue )
307 : {
308 : OSL_ENSURE( xConstNode.is(), "need node to set data" );
309 :
310 0 : bool bRet = false;
311 0 : if( xConstNode.is() )
312 : {
313 : // non-const node reference so we can assign children (if necessary)
314 0 : XNode_t xNode( xConstNode );
315 :
316 0 : switch( xNode->getNodeType() )
317 : {
318 : case NodeType_ELEMENT_NODE:
319 : {
320 : // find first text node child
321 0 : Reference<XNode> xChild;
322 0 : for( xChild = xNode->getFirstChild();
323 0 : xChild.is() && xChild->getNodeType() != NodeType_TEXT_NODE;
324 0 : xChild = xChild->getNextSibling() )
325 : ; // empty loop; only find first text node child
326 :
327 : // create text node, if none is found
328 0 : if( ! xChild.is() )
329 : {
330 0 : xChild = Reference<XNode>(
331 0 : xNode->getOwnerDocument()->createTextNode( OUString() ),
332 0 : UNO_QUERY_THROW );
333 0 : xNode->appendChild( xChild );
334 : }
335 0 : xNode = xChild;
336 :
337 : OSL_ENSURE( xNode.is() &&
338 : xNode->getNodeType() == NodeType_TEXT_NODE,
339 0 : "text node creation failed?" );
340 : }
341 : // no break; continue as with text node:
342 :
343 : case NodeType_TEXT_NODE:
344 : case NodeType_ATTRIBUTE_NODE:
345 : {
346 : // set the node value (defer notifications)
347 0 : if( xNode->getNodeValue() != sValue )
348 : {
349 0 : deferNotifications( true );
350 0 : xNode->setNodeValue( sValue );
351 0 : deferNotifications( false );
352 : }
353 0 : bRet = true;
354 : }
355 0 : break;
356 :
357 : default:
358 : {
359 : OSL_FAIL( "bound to unknown node type?" );
360 : }
361 0 : break;
362 :
363 0 : }
364 : }
365 0 : return bRet;
366 : }
367 :
368 0 : void Model::loadInstance( sal_Int32 nInstance )
369 : {
370 0 : Sequence<PropertyValue> aSequence = mpInstances->getItem( nInstance );
371 :
372 : // find URL from instance
373 0 : OUString sURL;
374 0 : bool bOnce = false;
375 0 : getInstanceData( aSequence, NULL, NULL, &sURL, &bOnce );
376 :
377 : // if we have a URL, load the document and set it into the instance
378 0 : if( !sURL.isEmpty() )
379 : {
380 : try
381 : {
382 : Reference<XInputStream> xInput =
383 0 : Reference<XSimpleFileAccess3>( SimpleFileAccess::create( ::comphelper::getProcessComponentContext() ) )->openFileRead( sURL );
384 0 : if( xInput.is() )
385 : {
386 : Reference<XDocument> xInstance =
387 0 : getDocumentBuilder()->parse( xInput );
388 0 : if( xInstance.is() )
389 : {
390 0 : OUString sEmpty;
391 : setInstanceData( aSequence, NULL, &xInstance,
392 0 : bOnce ? &sEmpty : &sURL, NULL);
393 0 : mpInstances->setItem( nInstance, aSequence );
394 0 : }
395 0 : }
396 : }
397 0 : catch( const Exception& )
398 : {
399 : // couldn't load the instance -> ignore!
400 : }
401 0 : }
402 0 : }
403 :
404 0 : void Model::loadInstances()
405 : {
406 : // iterate over instance array to get PropertyValue-Sequence
407 0 : const sal_Int32 nInstances = mpInstances->countItems();
408 0 : for( sal_Int32 nInstance = 0; nInstance < nInstances; nInstance++ )
409 : {
410 0 : loadInstance( nInstance );
411 : }
412 0 : }
413 :
414 :
415 0 : bool Model::isValid() const
416 : {
417 0 : bool bValid = true;
418 0 : sal_Int32 nCount = mpBindings->countItems();
419 0 : for( sal_Int32 i = 0; bValid && i < nCount; i++ )
420 : {
421 0 : Binding* pBind = Binding::getBinding( mpBindings->Collection<XPropertySet_t>::getItem( i ) );
422 : OSL_ENSURE( pBind != NULL, "binding?" );
423 0 : bValid = pBind->isValid();
424 : }
425 0 : return bValid;
426 : }
427 :
428 :
429 :
430 :
431 : // implement xforms::XModel
432 :
433 :
434 0 : OUString Model::getID()
435 : throw( RuntimeException, std::exception )
436 : {
437 : DBG_INVARIANT();
438 0 : return msID;
439 : }
440 :
441 0 : void Model::setID( const OUString& sID )
442 : throw( RuntimeException, std::exception )
443 : {
444 : DBG_INVARIANT();
445 0 : msID = sID;
446 0 : }
447 :
448 0 : void Model::initialize()
449 : throw( RuntimeException, std::exception )
450 : {
451 : DBG_ASSERT( ! mbInitialized, "model already initialized" );
452 :
453 : // load instances
454 0 : loadInstances();
455 :
456 : // let's pretend we're initialized and rebind all bindings
457 0 : mbInitialized = true;
458 0 : rebind();
459 0 : }
460 :
461 0 : void Model::rebuild()
462 : throw( RuntimeException, std::exception )
463 : {
464 0 : if( ! mbInitialized )
465 0 : initialize();
466 : else
467 0 : rebind();
468 0 : }
469 :
470 0 : void Model::recalculate()
471 : throw( RuntimeException, std::exception )
472 : {
473 0 : rebind();
474 0 : }
475 :
476 0 : void Model::revalidate()
477 : throw( RuntimeException, std::exception )
478 : {
479 : // do nothing. We don't validate anyways!
480 0 : }
481 :
482 0 : void Model::refresh()
483 : throw( RuntimeException, std::exception )
484 : {
485 0 : rebind();
486 0 : }
487 :
488 :
489 0 : void SAL_CALL Model::submitWithInteraction(
490 : const OUString& sID,
491 : const XInteractionHandler_t& _rxHandler )
492 : throw( VetoException,
493 : WrappedTargetException,
494 : RuntimeException, std::exception )
495 : {
496 : DBG_INVARIANT();
497 :
498 0 : if( mpSubmissions->hasItem( sID ) )
499 : {
500 : Submission* pSubmission =
501 0 : Submission::getSubmission( mpSubmissions->getItem( sID ) );
502 : OSL_ENSURE( pSubmission != NULL, "no submission?" );
503 : OSL_ENSURE( pSubmission->getModel() == Reference<XModel>( this ),
504 : "wrong model" );
505 :
506 : // submit. All exceptions are allowed to leave.
507 0 : pSubmission->submitWithInteraction( _rxHandler );
508 : }
509 0 : }
510 :
511 0 : void Model::submit( const OUString& sID )
512 : throw( VetoException, WrappedTargetException, RuntimeException, std::exception )
513 : {
514 0 : submitWithInteraction( sID, NULL );
515 0 : }
516 :
517 0 : Model::XDataTypeRepository_t SAL_CALL Model::getDataTypeRepository( )
518 : throw( RuntimeException, std::exception )
519 : {
520 0 : if ( !mxDataTypes.is() )
521 0 : mxDataTypes = new ODataTypeRepository;
522 :
523 0 : return mxDataTypes;
524 : }
525 :
526 :
527 : // instance management
528 :
529 :
530 0 : Model::XSet_t Model::getInstances()
531 : throw( RuntimeException, std::exception )
532 : {
533 0 : return mxInstances;
534 : }
535 :
536 0 : Model::XDocument_t Model::getInstanceDocument( const OUString& rName )
537 : throw( RuntimeException, std::exception )
538 : {
539 0 : ensureAtLeastOneInstance();
540 0 : Reference<XDocument> aInstance;
541 0 : sal_Int32 nInstance = lcl_findInstance( mpInstances, rName );
542 0 : if( nInstance != -1 )
543 0 : getInstanceData( mpInstances->getItem( nInstance ),
544 0 : NULL, &aInstance, NULL, NULL );
545 0 : return aInstance;
546 : }
547 :
548 0 : Model::XDocument_t SAL_CALL Model::getDefaultInstance()
549 : throw( RuntimeException, std::exception )
550 : {
551 0 : ensureAtLeastOneInstance();
552 : DBG_ASSERT( mpInstances->countItems() > 0, "no instance?" );
553 0 : Reference<XDocument> aInstance;
554 0 : getInstanceData( mpInstances->getItem( 0 ), NULL, &aInstance, NULL, NULL );
555 0 : return aInstance;
556 : }
557 :
558 :
559 :
560 :
561 : // bindings management
562 :
563 :
564 0 : Model::XPropertySet_t SAL_CALL Model::createBinding()
565 : throw( RuntimeException, std::exception )
566 : {
567 : DBG_INVARIANT();
568 0 : return new Binding();
569 : }
570 :
571 0 : Model::XPropertySet_t Model::cloneBinding( const XPropertySet_t& xBinding )
572 : throw( RuntimeException, std::exception )
573 : {
574 : DBG_INVARIANT();
575 0 : XPropertySet_t xNewBinding = createBinding();
576 0 : copy( xBinding, xNewBinding );
577 0 : return xNewBinding;
578 : }
579 :
580 0 : Model::XPropertySet_t Model::getBinding( const OUString& sId )
581 : throw( RuntimeException, std::exception )
582 : {
583 : DBG_INVARIANT();
584 0 : return mpBindings->hasItem( sId ) ? mpBindings->getItem( sId ) : NULL;
585 : }
586 :
587 0 : Model::XSet_t Model::getBindings()
588 : throw( RuntimeException, std::exception )
589 : {
590 : DBG_INVARIANT();
591 0 : return mxBindings;
592 : }
593 :
594 :
595 :
596 :
597 : // submission management
598 :
599 :
600 0 : Model::XSubmission_t Model::createSubmission()
601 : throw( RuntimeException, std::exception )
602 : {
603 : DBG_INVARIANT();
604 0 : return new Submission();
605 : }
606 :
607 0 : Model::XSubmission_t Model::cloneSubmission(const XPropertySet_t& xSubmission)
608 : throw( RuntimeException, std::exception )
609 : {
610 : DBG_INVARIANT();
611 0 : XSubmission_t xNewSubmission = createSubmission();
612 0 : XPropertySet_t xAsPropertySet( xNewSubmission.get() );
613 0 : copy( xSubmission.get(), xAsPropertySet );
614 0 : return xNewSubmission;
615 : }
616 :
617 0 : Model::XSubmission_t Model::getSubmission( const OUString& sId )
618 : throw( RuntimeException, std::exception )
619 : {
620 : DBG_INVARIANT();
621 0 : XSubmission_t xSubmission;
622 0 : if ( mpSubmissions->hasItem( sId ) )
623 0 : xSubmission.set(mpSubmissions->getItem( sId ), css::uno::UNO_QUERY);
624 0 : return xSubmission;
625 : }
626 :
627 0 : Model::XSet_t Model::getSubmissions()
628 : throw( RuntimeException, std::exception )
629 : {
630 : DBG_INVARIANT();
631 0 : return mxSubmissions;
632 : }
633 :
634 :
635 : // implement XPropertySet & friends
636 :
637 :
638 : #define HANDLE_ID 0
639 : #define HANDLE_ForeignSchema 3
640 : #define HANDLE_SchemaRef 4
641 : #define HANDLE_Namespaces 5
642 : #define HANDLE_ExternalData 6
643 :
644 : #define REGISTER_PROPERTY( property, type ) \
645 : registerProperty( PROPERTY( property, type ), \
646 : new DirectPropertyAccessor< Model, type >( this, &Model::set##property, &Model::get##property ) );
647 :
648 : #define REGISTER_PROPERTY_API( property, type ) \
649 : registerProperty( PROPERTY( property, type ), \
650 : new APIPropertyAccessor< Model, type >( this, &Model::set##property, &Model::get##property ) );
651 :
652 : #define REGISTER_BOOL_PROPERTY( property ) \
653 : registerProperty( PROPERTY( property, sal_Bool ), \
654 : new BooleanPropertyAccessor< Model, bool >( this, &Model::set##property, &Model::get##property ) );
655 :
656 1 : void Model::initializePropertySet()
657 : {
658 1 : REGISTER_PROPERTY_API ( ID, OUString );
659 1 : REGISTER_PROPERTY ( ForeignSchema, XDocument_t );
660 1 : REGISTER_PROPERTY ( SchemaRef, OUString );
661 1 : REGISTER_PROPERTY ( Namespaces, XNameContainer_t );
662 1 : REGISTER_BOOL_PROPERTY( ExternalData );
663 1 : }
664 :
665 0 : void Model::update()
666 : throw( RuntimeException, std::exception )
667 : {
668 0 : rebuild();
669 0 : }
670 :
671 :
672 0 : sal_Int64 Model::getSomething( const IntSequence_t& xId )
673 : throw( RuntimeException, std::exception )
674 : {
675 0 : return reinterpret_cast<sal_Int64>( ( xId == getUnoTunnelID() ) ? this : NULL );
676 : }
677 :
678 0 : Sequence<sal_Int8> Model::getImplementationId()
679 : throw( RuntimeException )
680 : {
681 0 : return css::uno::Sequence<sal_Int8>();
682 : }
683 :
684 1 : OUString Model::getImplementationName()
685 : throw (css::uno::RuntimeException, std::exception)
686 : {
687 1 : return OUString("com.sun.star.form.Model");
688 : }
689 :
690 0 : sal_Bool Model::supportsService(OUString const & ServiceName)
691 : throw (css::uno::RuntimeException, std::exception)
692 : {
693 0 : return cppu::supportsService(this, ServiceName);
694 : }
695 :
696 1 : css::uno::Sequence<OUString> Model::getSupportedServiceNames()
697 : throw (css::uno::RuntimeException, std::exception)
698 : {
699 1 : return css::uno::Sequence<OUString>{"com.sun.star.xforms.Model"};
700 : }
701 :
702 : extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL
703 1 : com_sun_star_form_Model_get_implementation(::com::sun::star::uno::XComponentContext*,
704 : ::com::sun::star::uno::Sequence<css::uno::Any> const &)
705 : {
706 1 : return cppu::acquire(new xforms::Model());
707 : }
708 :
709 :
710 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|