LibreOffice Module dbaccess (master) 1
definitioncontainer.cxx
Go to the documentation of this file.
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
21#include <core_resource.hxx>
22#include <strings.hrc>
23#include <strings.hxx>
24
26#include <o3tl/safeint.hxx>
27#include <osl/diagnose.h>
30#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
31#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
32#include <com/sun/star/beans/XPropertySet.hpp>
33#include <com/sun/star/sdb/ErrorCondition.hpp>
35#include <comphelper/types.hxx>
36#include <rtl/ref.hxx>
37
38using namespace ::com::sun::star::uno;
39using namespace ::com::sun::star::lang;
40using namespace ::com::sun::star::util;
41using namespace ::com::sun::star::beans;
42using namespace ::com::sun::star::container;
43using namespace ::com::sun::star::sdbcx;
44using namespace ::com::sun::star::sdb;
45using namespace ::osl;
46using namespace ::comphelper;
47using namespace ::cppu;
48using namespace ::com::sun::star::ucb;
49
50namespace dbaccess
51{
52
53// ODefinitionContainer_Impl
55{
56 NamedDefinitions::const_iterator aPos = find( _pDefinition );
57 if ( aPos != end() )
58 m_aDefinitions.erase( aPos );
59}
60
62{
63 return std::find_if(
64 m_aDefinitions.begin(),
65 m_aDefinitions.end(),
66 [&_pDefinition] (const NamedDefinitions::value_type& namedDef) {
67 return namedDef.second == _pDefinition;
68 });
69}
70
72{
73 return std::find_if(
74 m_aDefinitions.begin(),
75 m_aDefinitions.end(),
76 [&_pDefinition] (const NamedDefinitions::value_type& namedDef) {
77 return namedDef.second == _pDefinition;
78 });
79}
80
81// ODefinitionContainer
82
83ODefinitionContainer::ODefinitionContainer( const Reference< XComponentContext >& _xORB
84 , const Reference< XInterface >& _xParentContainer
85 , const TContentPtr& _pImpl
86 , bool _bCheckSlash
87 )
88 :OContentHelper(_xORB,_xParentContainer,_pImpl)
89 ,m_aApproveListeners(m_aMutex)
90 ,m_aContainerListeners(m_aMutex)
91 ,m_bInPropertyChange(false)
92 ,m_bCheckSlash(_bCheckSlash)
93{
94 assert(m_pImpl);
95 m_pImpl->m_aProps.bIsDocument = false;
96 m_pImpl->m_aProps.bIsFolder = true;
97
98 const ODefinitionContainer_Impl& rDefinitions( getDefinitions() );
99 for (auto const& definition : rDefinitions)
100 m_aDocuments.push_back(
101 m_aDocumentMap.emplace(definition.first, Documents::mapped_type() ).first );
102
103}
104
106{
108
109 MutexGuard aGuard(m_aMutex);
110
111 // say goodbye to our listeners
112 EventObject aEvt(*this);
115
116 // dispose our elements
117 for (auto const& elem : m_aDocumentMap)
118 {
119 Reference<XContent> xProp = elem.second;
120 if ( xProp.is() )
121 {
123 ::comphelper::disposeComponent(xProp);
124 }
125 }
126
127 // remove our elements
128 m_aDocuments.clear();
129 // !!! do this before clearing the map which the vector elements refer to !!!
130 m_aDocumentMap.clear();
131}
132
134{
135}
136
138css::uno::Sequence< css::uno::Type > ODefinitionContainer::getTypes()
139{
140 return ::comphelper::concatSequences(
141 OContentHelper::getTypes( ),
143 );
144}
145
146
147css::uno::Sequence<sal_Int8> ODefinitionContainer::getImplementationId()
148{
149 return css::uno::Sequence<sal_Int8>();
150}
151
152// XServiceInfo
154{
155 return "com.sun.star.sdb.ODefinitionContainer";
156}
157
159{
160 return { "com.sun.star.sdb.DefinitionContainer", "com.sun.star.ucb.Content" };
161}
162
163// XNameContainer
164void SAL_CALL ODefinitionContainer::insertByName( const OUString& _rName, const Any& aElement )
165{
166 ResettableMutexGuard aGuard(m_aMutex);
167
168 // approve the new object
169 Reference< XContent > xNewElement(aElement,UNO_QUERY);
170 approveNewObject( _rName, xNewElement ); // will throw if necessary
171
172 notifyByName( aGuard, _rName, xNewElement, nullptr, E_INSERTED, ApproveListeners );
173 implAppend( _rName, xNewElement );
174 notifyByName( aGuard, _rName, xNewElement, nullptr, E_INSERTED, ContainerListemers );
175}
176
177void SAL_CALL ODefinitionContainer::removeByName( const OUString& _rName )
178{
179 ResettableMutexGuard aGuard(m_aMutex);
180
181 // check the arguments
182 if (_rName.isEmpty())
183 throw IllegalArgumentException();
184
185 if (!checkExistence(_rName))
186 throw NoSuchElementException(_rName,*this);
187
188 // the old element (for the notifications)
189 Reference< XContent > xOldElement = implGetByName( _rName, impl_haveAnyListeners_nothrow() );
190
191 // do the removal
192 notifyByName( aGuard, _rName, nullptr, xOldElement, E_REMOVED, ApproveListeners );
193 implRemove( _rName );
194 notifyByName( aGuard, _rName, nullptr, xOldElement, E_REMOVED, ContainerListemers );
195
196 removeObjectListener( xOldElement );
197 disposeComponent(xOldElement);
198}
199
200// XNameReplace
201void SAL_CALL ODefinitionContainer::replaceByName( const OUString& _rName, const Any& aElement )
202{
203 ResettableMutexGuard aGuard(m_aMutex);
204
205 try
206 {
207 // let derived classes approve the new object
208 Reference< XContent > xNewElement(aElement,UNO_QUERY);
209 approveNewObject( _rName, xNewElement ); // will throw if necessary
210
211 // the old element (for the notifications)
212 Reference< XContent > xOldElement = implGetByName( _rName, impl_haveAnyListeners_nothrow() );
213
214 notifyByName( aGuard, _rName, xNewElement, xOldElement, E_REPLACED, ApproveListeners );
215 implReplace( _rName, xNewElement );
216 notifyByName( aGuard, _rName, xNewElement, xOldElement, E_REPLACED, ContainerListemers );
217
218 // and dispose it
219 disposeComponent(xOldElement);
220 }
221 catch (const RuntimeException&)
222 {
223 throw;
224 }
225 catch (const NoSuchElementException&)
226 {
227 throw;
228 }
229 catch (const WrappedTargetException&)
230 {
231 throw;
232 }
233 catch (const Exception& e)
234 {
235 css::uno::Any a(cppu::getCaughtException());
236 throw css::lang::WrappedTargetException(
237 "wrapped Exception " + e.Message,
238 css::uno::Reference<css::uno::XInterface>(), a);
239 }
240}
241
242namespace
243{
244 typedef Reference< XVeto > ( SAL_CALL XContainerApproveListener::*ContainerApprovalMethod )( const ContainerEvent& );
245
246 struct RaiseExceptionFromVeto
247 {
248 private:
249 ContainerApprovalMethod m_pMethod;
250 const ContainerEvent& m_rEvent;
251
252 public:
253 explicit RaiseExceptionFromVeto( ContainerApprovalMethod _pMethod, const ContainerEvent& _rEvent )
254 :m_pMethod( _pMethod )
255 ,m_rEvent( _rEvent )
256 {
257 }
258
259 void operator()( const Reference< XContainerApproveListener >& Listener ) const
260 {
261 Reference< XVeto > xVeto = (Listener.get()->*m_pMethod)( m_rEvent );
262 if ( !xVeto.is() )
263 return;
264
265 Any eVetoDetails = xVeto->getDetails();
266
267 IllegalArgumentException aIllegalArgumentError;
268 if ( eVetoDetails >>= aIllegalArgumentError )
269 throw aIllegalArgumentError;
270
271 WrappedTargetException aWrappedError;
272 if ( eVetoDetails >>= aWrappedError )
273 throw aWrappedError;
274
275 throw WrappedTargetException( xVeto->getReason(), Listener, eVetoDetails );
276 }
277 };
278}
279
280void ODefinitionContainer::notifyByName( ResettableMutexGuard& _rGuard, const OUString& _rName,
281 const Reference< XContent >& _xNewElement, const Reference< XContent >& _xOldElement,
282 ContainerOperation _eOperation, ListenerType _eType )
283{
284 bool bApprove = ( _eType == ApproveListeners );
285
287 if ( !rContainer.getLength() )
288 return;
289
290 ContainerEvent aEvent( *this, Any( _rName ), Any( _xNewElement ), Any( _xOldElement ) );
291
292 _rGuard.clear();
293 switch ( _eOperation )
294 {
295 case E_INSERTED:
296 if ( bApprove )
297 rContainer.forEach< XContainerApproveListener, RaiseExceptionFromVeto >(
298 RaiseExceptionFromVeto( &XContainerApproveListener::approveInsertElement, aEvent ) );
299 else
300 rContainer.notifyEach( &XContainerListener::elementInserted, aEvent );
301 break;
302 case E_REPLACED:
303 if ( bApprove )
304 rContainer.forEach< XContainerApproveListener, RaiseExceptionFromVeto >(
305 RaiseExceptionFromVeto( &XContainerApproveListener::approveReplaceElement, aEvent ) );
306 else
307 rContainer.notifyEach( &XContainerListener::elementReplaced, aEvent );
308 break;
309 case E_REMOVED:
310 if ( bApprove )
311 rContainer.forEach< XContainerApproveListener, RaiseExceptionFromVeto >(
312 RaiseExceptionFromVeto( &XContainerApproveListener::approveRemoveElement, aEvent ) );
313 else
314 rContainer.notifyEach( &XContainerListener::elementRemoved, aEvent );
315 break;
316 }
317
318 if ( bApprove )
319 _rGuard.reset();
320}
321
322void SAL_CALL ODefinitionContainer::addContainerListener( const Reference< XContainerListener >& _rxListener )
323{
324 if (_rxListener.is())
326}
327
328void SAL_CALL ODefinitionContainer::removeContainerListener( const Reference< XContainerListener >& _rxListener )
329{
330 if (_rxListener.is())
332}
333
334void SAL_CALL ODefinitionContainer::addContainerApproveListener( const Reference< XContainerApproveListener >& Listener )
335{
336 if ( Listener.is() )
338}
339
340void SAL_CALL ODefinitionContainer::removeContainerApproveListener( const Reference< XContainerApproveListener >& Listener )
341{
342 if ( Listener.is() )
344}
345
346// XElementAccess
348{
350}
351
353{
354 MutexGuard aGuard(m_aMutex);
355 return !m_aDocuments.empty();
356}
357
358// XEnumerationAccess
359Reference< XEnumeration > SAL_CALL ODefinitionContainer::createEnumeration( )
360{
361 MutexGuard aGuard(m_aMutex);
362 return new ::comphelper::OEnumerationByIndex(static_cast<XIndexAccess*>(this));
363}
364
365// XIndexAccess
367{
368 MutexGuard aGuard(m_aMutex);
369 return m_aDocuments.size();
370}
371
372Any SAL_CALL ODefinitionContainer::getByIndex( sal_Int32 _nIndex )
373{
374 MutexGuard aGuard(m_aMutex);
375
376 if ((_nIndex < 0) || (o3tl::make_unsigned(_nIndex) >= m_aDocuments.size()))
377 throw IndexOutOfBoundsException();
378
379 Documents::iterator aPos = m_aDocuments[_nIndex];
380 Reference<XContent> xProp = aPos->second;
381 if (!xProp.is())
382 { // that's the first access to the object
383 // -> create it
384 xProp = createObject(aPos->first);
385 aPos->second = Documents::mapped_type();
386 // and update the name-access map
387 }
388
389 return Any(xProp);
390}
391
392Any SAL_CALL ODefinitionContainer::getByName( const OUString& _rName )
393{
394 MutexGuard aGuard(m_aMutex);
395
396 return Any( implGetByName( _rName, true ) );
397}
398
399Reference< XContent > ODefinitionContainer::implGetByName(const OUString& _rName, bool _bReadIfNecessary)
400{
401 Documents::iterator aMapPos = m_aDocumentMap.find(_rName);
402 if (aMapPos == m_aDocumentMap.end())
403 throw NoSuchElementException(_rName,*this);
404
405 Reference< XContent > xProp = aMapPos->second;
406
407 if (_bReadIfNecessary && !xProp.is())
408 { // the object has never been accessed before, so we have to read it now
409 // (that's the expensive part)
410
411 // create the object and insert it into the map
412 xProp = createObject(_rName);
413 aMapPos->second = xProp;
414 addObjectListener(xProp);
415 }
416
417 return xProp;
418}
419
420Sequence< OUString > SAL_CALL ODefinitionContainer::getElementNames( )
421{
422 MutexGuard aGuard(m_aMutex);
423
424 Sequence< OUString > aNames(m_aDocumentMap.size());
425 OUString* pNames = aNames.getArray();
426 for (auto const& elem : m_aDocumentMap)
427 {
428 *pNames = elem.first;
429 ++pNames;
430 }
431
432 return aNames;
433}
434
435sal_Bool SAL_CALL ODefinitionContainer::hasByName( const OUString& _rName )
436{
437 MutexGuard aGuard(m_aMutex);
438
439 return checkExistence(_rName);
440}
441
442void SAL_CALL ODefinitionContainer::disposing( const EventObject& _rSource )
443{
444 MutexGuard aGuard(m_aMutex);
445 Reference< XContent > xSource(_rSource.Source, UNO_QUERY);
446 // it's one of our documents...
447 for (auto & elem : m_aDocumentMap)
448 {
449 if ( xSource == elem.second.get() )
450 {
451 removeObjectListener(xSource);
452 // and clear our document map/vector, so the object will be recreated on next access
453 elem.second = Documents::mapped_type();
454 }
455 }
456}
457
458void ODefinitionContainer::implRemove(const OUString& _rName)
459{
460 // from the object maps
461 Documents::const_iterator aFind = m_aDocumentMap.find(_rName);
462 if ( aFind != m_aDocumentMap.end() )
463 {
464 m_aDocuments.erase( std::find(m_aDocuments.begin(),m_aDocuments.end(),aFind));
465 m_aDocumentMap.erase(aFind);
466
467 getDefinitions().erase( _rName );
468
470 }
471}
472
473namespace
474{
475 bool lcl_ensureName( const Reference< XContent >& _rxContent, const OUString& _rName )
476 {
477 if ( !_rxContent.is() )
478 return true;
479
480 // obtain the current name. If it's the same as the new one,
481 // don't do anything
482 try
483 {
484 Reference< XPropertySet > xProps( _rxContent, UNO_QUERY );
485 if ( xProps.is() )
486 {
487 OUString sCurrentName;
488 OSL_VERIFY( xProps->getPropertyValue( PROPERTY_NAME ) >>= sCurrentName );
489 if ( sCurrentName == _rName )
490 return true;
491 }
492 }
493 catch( const Exception& )
494 {
495 TOOLS_WARN_EXCEPTION( "dbaccess", "lcl_ensureName: caught an exception while obtaining the current name!" );
496 }
497
498 // set the new name
499 Reference< XRename > xRename( _rxContent, UNO_QUERY );
500 OSL_ENSURE( xRename.is(), "lcl_ensureName: invalid content (not renameable)!" );
501 if ( !xRename.is() )
502 return false;
503 try
504 {
505 xRename->rename( _rName );
506 return true;
507 }
508 catch( const Exception& )
509 {
510 TOOLS_WARN_EXCEPTION( "dbaccess", "lcl_ensureName" );
511 }
512 return false;
513 }
514}
515
516void ODefinitionContainer::implAppend(const OUString& _rName, const Reference< XContent >& _rxNewObject)
517{
518 MutexGuard aGuard(m_aMutex);
519 try
520 {
521 Reference<XChild> xChild(_rxNewObject,UNO_QUERY);
522 if ( xChild.is() )
523 xChild->setParent(static_cast<OWeakObject*>(this));
524
525 ODefinitionContainer_Impl& rDefinitions( getDefinitions() );
526 ODefinitionContainer_Impl::const_iterator aFind = rDefinitions.find( _rName );
527 if ( aFind == rDefinitions.end() )
528 {
529 // ensure that the new object has the proper name.
530 // Somebody could create an object with name "foo", and insert it as "bar"
531 // into a container. In this case, we need to ensure that the object name
532 // is also "bar"
533 // #i44786#
534 lcl_ensureName( _rxNewObject, _rName );
535
536 ::rtl::Reference< OContentHelper > pContent = dynamic_cast<OContentHelper*>( _rxNewObject.get() );
537 if ( pContent.is() )
538 {
539 TContentPtr pImpl = pContent->getImpl();
540 rDefinitions.erase( pImpl );
541 pImpl->m_aProps.aTitle = _rName;
542 rDefinitions.insert( _rName, pImpl );
543 }
544 }
545
546 m_aDocuments.push_back(m_aDocumentMap.emplace(_rName,_rxNewObject).first);
548 // now update our structures
549 if ( _rxNewObject.is() )
550 addObjectListener(_rxNewObject);
551 }
552 catch(Exception&)
553 {
554 OSL_FAIL("ODefinitionContainer::implAppend: caught something !");
555 }
556}
557
558void ODefinitionContainer::implReplace(const OUString& _rName, const Reference< XContent >& _rxNewObject)
559{
560 OSL_ENSURE(checkExistence(_rName), "ODefinitionContainer::implReplace : invalid name !");
561
562 Documents::iterator aFind = m_aDocumentMap.find(_rName);
563 removeObjectListener(aFind->second);
564 aFind->second = _rxNewObject;
565 addObjectListener(aFind->second);
566}
567
568void ODefinitionContainer::approveNewObject(const OUString& _sName,const Reference< XContent >& _rxObject) const
569{
570 // check the arguments
571 if ( _sName.isEmpty() )
572 throw IllegalArgumentException(
573 DBA_RES( RID_STR_NAME_MUST_NOT_BE_EMPTY ),
574 *this,
575 0 );
576
577 if ( m_bCheckSlash && _sName.indexOf( '/' ) != -1 )
578 throw IllegalArgumentException(
579 m_aErrorHelper.getErrorMessage( ErrorCondition::DB_OBJECT_NAME_WITH_SLASHES ),
580 *this,
581 0 );
582
583 if ( !_rxObject.is() )
584 throw IllegalArgumentException(
585 DBA_RES( RID_STR_NO_NULL_OBJECTS_IN_CONTAINER ),
586 *this,
587 0 );
588
589 const ODefinitionContainer_Impl& rDefinitions( getDefinitions() );
590 if ( rDefinitions.find( _sName ) != rDefinitions.end() )
591 throw ElementExistException(
592 DBA_RES( RID_STR_NAME_ALREADY_USED ),
593 *this );
594
595 ::rtl::Reference< OContentHelper > pContent( dynamic_cast<OContentHelper*>( _rxObject.get() ) );
596 if ( !pContent.is() )
597 throw IllegalArgumentException(
598 DBA_RES( RID_STR_OBJECT_CONTAINER_MISMATCH ),
599 *this,
600 1 );
601
602 if ( rDefinitions.find( pContent->getImpl() ) != rDefinitions.end() )
603 throw ElementExistException(
604 DBA_RES( RID_STR_OBJECT_ALREADY_CONTAINED ),
605 *this );
606}
607
608// XPropertyChangeListener
609void SAL_CALL ODefinitionContainer::propertyChange( const PropertyChangeEvent& evt )
610{
611 if( evt.PropertyName != PROPERTY_NAME && evt.PropertyName != "Title" )
612 return;
613
614 MutexGuard aGuard(m_aMutex);
615
616 m_bInPropertyChange = true;
617 try
618 {
619 OUString sNewName,sOldName;
620 evt.OldValue >>= sOldName;
621 evt.NewValue >>= sNewName;
622 Reference<XContent> xContent( evt.Source, UNO_QUERY );
623 removeObjectListener( xContent );
624 implRemove( sOldName );
625 implAppend( sNewName, xContent );
626 }
627 catch(const Exception& ex)
628 {
629 css::uno::Any anyEx = cppu::getCaughtException();
630 throw css::lang::WrappedTargetRuntimeException( ex.Message,
631 nullptr, anyEx );
632 }
633 m_bInPropertyChange = false;
634}
635
636// XVetoableChangeListener
637void SAL_CALL ODefinitionContainer::vetoableChange( const PropertyChangeEvent& aEvent )
638{
639 MutexGuard aGuard(m_aMutex);
640
641 if( aEvent.PropertyName == PROPERTY_NAME || aEvent.PropertyName == "Title" )
642 {
643 OUString sNewName;
644 aEvent.NewValue >>= sNewName;
645 if(hasByName(sNewName))
646 throw PropertyVetoException();
647 }
648}
649
650void ODefinitionContainer::addObjectListener(const Reference< XContent >& _xNewObject)
651{
652 OSL_ENSURE(_xNewObject.is(),"ODefinitionContainer::addObjectListener: Object is null!");
653 Reference<XPropertySet> xProp(_xNewObject,UNO_QUERY);
654 if ( xProp.is() )
655 {
656 xProp->addPropertyChangeListener(PROPERTY_NAME, this);
657 xProp->addVetoableChangeListener(PROPERTY_NAME, this);
658 }
659}
660
661void ODefinitionContainer::removeObjectListener(const Reference< XContent >& _xNewObject)
662{
663 Reference<XPropertySet> xProp(_xNewObject,UNO_QUERY);
664 if ( xProp.is() )
665 {
666 xProp->removePropertyChangeListener(PROPERTY_NAME, this);
667 xProp->removeVetoableChangeListener(PROPERTY_NAME, this);
668 }
669}
670
671bool ODefinitionContainer::checkExistence(const OUString& _rName)
672{
673 return m_aDocumentMap.find(_rName) != m_aDocumentMap.end();
674}
675
676}
677
678// namespace dbaccess
679/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
AnyEventRef aEvent
void notifyEach(void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event)
void disposeAndClear(const css::lang::EventObject &rEvt)
sal_Int32 removeInterface(const css::uno::Reference< css::uno::XInterface > &rxIFace)
sal_Int32 addInterface(const css::uno::Reference< css::uno::XInterface > &rxIFace)
OUString getErrorMessage(const ErrorCondition _eCondition) const
mutable::osl::Mutex m_aMutex
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() SAL_OVERRIDE
css::uno::Type const & get()
virtual void SAL_CALL disposing() override
const ::connectivity::SQLError m_aErrorHelper
void insert(const OUString &_rName, TContentPtr _pDefinition)
NamedDefinitions::const_iterator const_iterator
const_iterator find(const OUString &_rName) const
void erase(const OUString &_rName)
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
virtual void SAL_CALL addContainerApproveListener(const css::uno::Reference< css::container::XContainerApproveListener > &Listener) override
const ODefinitionContainer_Impl & getDefinitions() const
void implReplace(const OUString &_rName, const css::uno::Reference< css::ucb::XContent > &_rxNewObject)
remove an object in the container.
void implAppend(const OUString &_rName, const css::uno::Reference< css::ucb::XContent > &_rxNewObject)
append a new object to the container.
virtual css::uno::Reference< css::ucb::XContent > createObject(const OUString &_rName)=0
create an object from its persistent data within the configuration.
void removeObjectListener(const css::uno::Reference< css::ucb::XContent > &_xNewObject)
ODefinitionContainer(const css::uno::Reference< css::uno::XComponentContext > &_xORB, const css::uno::Reference< css::uno::XInterface > &_xParentContainer, const TContentPtr &_pImpl, bool _bCheckSlash=true)
constructs the container.
virtual void SAL_CALL replaceByName(const OUString &_rName, const css::uno::Any &aElement) override
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
virtual void SAL_CALL vetoableChange(const css::beans::PropertyChangeEvent &aEvent) override
::comphelper::OInterfaceContainerHelper2 m_aApproveListeners
::comphelper::OInterfaceContainerHelper2 m_aContainerListeners
virtual sal_Int32 SAL_CALL getCount() override
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
void approveNewObject(const OUString &_sName, const css::uno::Reference< css::ucb::XContent > &_rxObject) const
approve that the object given may be inserted into the container.
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
void notifyByName(::osl::ResettableMutexGuard &_rGuard, const OUString &_rName, const css::uno::Reference< css::ucb::XContent > &_xNewElement, const css::uno::Reference< css::ucb::XContent > &xOldElement, ContainerOperation _eOperation, ListenerType _eType)
notifies our container/approve listeners
virtual void SAL_CALL insertByName(const OUString &_rName, const css::uno::Any &aElement) override
virtual void SAL_CALL disposing() override
void implRemove(const OUString &_rName)
remove all references to an object from the container.
virtual void SAL_CALL removeContainerApproveListener(const css::uno::Reference< css::container::XContainerApproveListener > &Listener) override
virtual OUString SAL_CALL getImplementationName() override
virtual sal_Bool SAL_CALL hasElements() override
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 _nIndex) override
virtual void SAL_CALL removeContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent &evt) override
void addObjectListener(const css::uno::Reference< css::ucb::XContent > &_xNewObject)
virtual void SAL_CALL removeByName(const OUString &_rName) override
virtual void SAL_CALL addContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
css::uno::Reference< css::ucb::XContent > implGetByName(const OUString &_rName, bool _bCreateIfNecessary)
get the object specified by the given name.
std::vector< Documents::iterator > m_aDocuments
virtual bool checkExistence(const OUString &_rName)
quickly checks if there already is an element with a given name.
virtual css::uno::Type SAL_CALL getElementType() override
#define DBA_RES(id)
const ContainerEvent & m_rEvent
ContainerApprovalMethod m_pMethod
#define TOOLS_WARN_EXCEPTION(area, stream)
std::mutex m_aMutex
uno_Any a
@ Exception
void disposeComponent(css::uno::Reference< TYPE > &_rxComp)
Type
Any SAL_CALL getCaughtException()
std::shared_ptr< OContentHelper_Impl > TContentPtr
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
IMPLEMENT_FORWARD_XINTERFACE2(OStatement, OStatementBase, OStatement_IFACE)
constexpr OUStringLiteral PROPERTY_NAME(u"Name")
unsigned char sal_Bool