bump product version to 5.0.4.1
[LibreOffice.git] / reportdesign / source / core / api / Section.cxx
blob0007774750ed2c110eba3221b619bcdd3aa6f2fe
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #include "Section.hxx"
20 #include <comphelper/enumhelper.hxx>
21 #include <connectivity/dbtools.hxx>
22 #include <cppuhelper/supportsservice.hxx>
23 #include <com/sun/star/report/XReportComponent.hpp>
24 #include <com/sun/star/report/ForceNewPage.hpp>
25 #include <com/sun/star/beans/PropertyAttribute.hpp>
26 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
27 #include "corestrings.hrc"
28 #include "core_resource.hxx"
29 #include "core_resource.hrc"
30 #include <tools/debug.hxx>
31 #include "Tools.hxx"
32 #include "RptModel.hxx"
33 #include "RptPage.hxx"
34 #include "ReportDefinition.hxx"
35 #include "Shape.hxx"
36 #include <svx/unoshape.hxx>
37 #include <vcl/svapp.hxx>
38 #include "RptObject.hxx"
39 #include "ReportDrawPage.hxx"
40 #include <comphelper/property.hxx>
42 namespace reportdesign
45 using namespace com::sun::star;
46 using namespace comphelper;
49 uno::Sequence< OUString> lcl_getGroupAbsent()
51 OUString pProps[] = {
52 OUString(PROPERTY_CANGROW)
53 ,OUString(PROPERTY_CANSHRINK)
56 return uno::Sequence< OUString >(pProps,sizeof(pProps)/sizeof(pProps[0]));
60 uno::Sequence< OUString> lcl_getAbsent(bool _bPageSection)
62 if ( _bPageSection )
64 OUString pProps[] = {
65 OUString(PROPERTY_FORCENEWPAGE)
66 ,OUString(PROPERTY_NEWROWORCOL)
67 ,OUString(PROPERTY_KEEPTOGETHER)
68 ,OUString(PROPERTY_CANGROW)
69 ,OUString(PROPERTY_CANSHRINK)
70 ,OUString(PROPERTY_REPEATSECTION)
72 return uno::Sequence< OUString >(pProps,sizeof(pProps)/sizeof(pProps[0]));
75 OUString pProps[] = {
76 OUString(PROPERTY_CANGROW)
77 ,OUString(PROPERTY_CANSHRINK)
78 ,OUString(PROPERTY_REPEATSECTION)
81 return uno::Sequence< OUString >(pProps,sizeof(pProps)/sizeof(pProps[0]));
84 uno::Reference<report::XSection> OSection::createOSection(
85 const uno::Reference< report::XReportDefinition >& xParentDef,
86 const uno::Reference< uno::XComponentContext >& context,
87 bool const bPageSection)
89 OSection *const pNew =
90 new OSection(xParentDef, 0, context, lcl_getAbsent(bPageSection));
91 pNew->init();
92 return pNew;
95 uno::Reference<report::XSection> OSection::createOSection(
96 const uno::Reference< report::XGroup >& xParentGroup,
97 const uno::Reference< uno::XComponentContext >& context,
98 bool const)
100 OSection *const pNew =
101 new OSection(0, xParentGroup, context, lcl_getGroupAbsent());
102 pNew->init();
103 return pNew;
107 OSection::OSection(const uno::Reference< report::XReportDefinition >& xParentDef
108 ,const uno::Reference< report::XGroup >& xParentGroup
109 ,const uno::Reference< uno::XComponentContext >& context
110 ,uno::Sequence< OUString> const& rStrings)
111 :SectionBase(m_aMutex)
112 ,SectionPropertySet(context,SectionPropertySet::IMPLEMENTS_PROPERTY_SET,rStrings)
113 ,m_aContainerListeners(m_aMutex)
114 ,m_xContext(context)
115 ,m_xGroup(xParentGroup)
116 ,m_xReportDefinition(xParentDef)
117 ,m_nHeight(3000)
118 ,m_nBackgroundColor(COL_TRANSPARENT)
119 ,m_nForceNewPage(report::ForceNewPage::NONE)
120 ,m_nNewRowOrCol(report::ForceNewPage::NONE)
121 ,m_bKeepTogether(false)
122 ,m_bRepeatSection(false)
123 ,m_bVisible(true)
124 ,m_bBacktransparent(true)
125 ,m_bInRemoveNotify(false)
126 ,m_bInInsertNotify(false)
130 // TODO: VirtualFunctionFinder: This is virtual function!
132 OSection::~OSection()
136 //IMPLEMENT_FORWARD_XINTERFACE2(OSection,SectionBase,SectionPropertySet)
137 IMPLEMENT_FORWARD_REFCOUNT( OSection, SectionBase )
139 uno::Any SAL_CALL OSection::queryInterface( const uno::Type& _rType ) throw (uno::RuntimeException, std::exception)
141 uno::Any aReturn = SectionBase::queryInterface(_rType);
142 if ( !aReturn.hasValue() )
143 aReturn = SectionPropertySet::queryInterface(_rType);
145 if ( !aReturn.hasValue() && OReportControlModel::isInterfaceForbidden(_rType) )
146 return aReturn;
148 return aReturn;
152 void SAL_CALL OSection::dispose() throw(uno::RuntimeException, std::exception)
154 OSL_ENSURE(!rBHelper.bDisposed,"Already disposed!");
155 SectionPropertySet::dispose();
156 uno::Reference<lang::XComponent> const xPageComponent(m_xDrawPage,
157 uno::UNO_QUERY);
158 if (xPageComponent.is())
160 xPageComponent->dispose();
162 cppu::WeakComponentImplHelperBase::dispose();
166 // TODO: VirtualFunctionFinder: This is virtual function!
168 void SAL_CALL OSection::disposing()
170 lang::EventObject aDisposeEvent( static_cast< ::cppu::OWeakObject* >( this ) );
171 m_aContainerListeners.disposeAndClear( aDisposeEvent );
172 m_xContext.clear();
175 OUString SAL_CALL OSection::getImplementationName( ) throw(uno::RuntimeException, std::exception)
177 return OUString("com.sun.star.comp.report.Section");
180 uno::Sequence< OUString> OSection::getSupportedServiceNames_Static() throw( uno::RuntimeException )
182 uno::Sequence< OUString> aSupported(1);
183 aSupported.getArray()[0] = SERVICE_SECTION;
184 return aSupported;
187 uno::Sequence< OUString> SAL_CALL OSection::getSupportedServiceNames() throw(uno::RuntimeException, std::exception)
189 return getSupportedServiceNames_Static();
192 sal_Bool SAL_CALL OSection::supportsService( const OUString& _rServiceName ) throw(uno::RuntimeException, std::exception)
194 return cppu::supportsService(this, _rServiceName);
197 void OSection::init()
199 SolarMutexGuard g; // lock while manipulating SdrModel
200 uno::Reference< report::XReportDefinition> xReport = getReportDefinition();
201 ::boost::shared_ptr<rptui::OReportModel> pModel = OReportDefinition::getSdrModel(xReport);
202 assert(pModel && "No model set at the report definition!");
203 if ( pModel )
205 uno::Reference<report::XSection> const xSection(this);
206 SdrPage & rSdrPage(*pModel->createNewPage(xSection));
207 m_xDrawPage.set(rSdrPage.getUnoPage(), uno::UNO_QUERY_THROW);
208 m_xDrawPage_ShapeGrouper.set(m_xDrawPage, uno::UNO_QUERY_THROW);
209 // apparently we may also get OReportDrawPage which doesn't support this
210 m_xDrawPage_FormSupplier.set(m_xDrawPage, uno::UNO_QUERY);
211 m_xDrawPage_Tunnel.set(m_xDrawPage, uno::UNO_QUERY_THROW);
212 // fdo#53872: now also exchange the XDrawPage in the SdrPage so that
213 // rSdrPage.getUnoPage returns this
214 rSdrPage.SetUnoPage(this);
215 // createNewPage _should_ have stored away 2 uno::References to this,
216 // so our ref count cannot be 1 here, so this isn't destroyed here
217 assert(m_refCount > 1);
221 // XSection
223 sal_Bool SAL_CALL OSection::getVisible() throw (uno::RuntimeException, std::exception)
225 ::osl::MutexGuard aGuard(m_aMutex);
226 return m_bVisible;
229 void SAL_CALL OSection::setVisible( sal_Bool _visible ) throw (uno::RuntimeException, std::exception)
231 set(PROPERTY_VISIBLE,_visible,m_bVisible);
234 OUString SAL_CALL OSection::getName() throw (uno::RuntimeException, std::exception)
236 ::osl::MutexGuard aGuard(m_aMutex);
237 return m_sName;
240 void SAL_CALL OSection::setName( const OUString& _name ) throw (uno::RuntimeException, std::exception)
242 set(PROPERTY_NAME,_name,m_sName);
245 ::sal_uInt32 SAL_CALL OSection::getHeight() throw (uno::RuntimeException, std::exception)
247 ::osl::MutexGuard aGuard(m_aMutex);
248 return m_nHeight;
251 void SAL_CALL OSection::setHeight( ::sal_uInt32 _height ) throw (uno::RuntimeException, std::exception)
253 set(PROPERTY_HEIGHT,_height,m_nHeight);
256 ::sal_Int32 SAL_CALL OSection::getBackColor() throw (uno::RuntimeException, std::exception)
258 ::osl::MutexGuard aGuard(m_aMutex);
259 return m_bBacktransparent ? COL_TRANSPARENT : m_nBackgroundColor;
262 void SAL_CALL OSection::setBackColor( ::sal_Int32 _backgroundcolor ) throw (uno::RuntimeException, std::exception)
264 bool bTransparent = _backgroundcolor == static_cast<sal_Int32>(COL_TRANSPARENT);
265 setBackTransparent(bTransparent);
266 if ( !bTransparent )
267 set(PROPERTY_BACKCOLOR,_backgroundcolor,m_nBackgroundColor);
270 sal_Bool SAL_CALL OSection::getBackTransparent() throw (uno::RuntimeException, std::exception)
272 ::osl::MutexGuard aGuard(m_aMutex);
273 return m_bBacktransparent;
276 void SAL_CALL OSection::setBackTransparent( sal_Bool _backtransparent ) throw (uno::RuntimeException, std::exception)
278 set(PROPERTY_BACKTRANSPARENT,_backtransparent,m_bBacktransparent);
279 if ( _backtransparent )
280 set(PROPERTY_BACKCOLOR,static_cast<sal_Int32>(COL_TRANSPARENT),m_nBackgroundColor);
283 OUString SAL_CALL OSection::getConditionalPrintExpression() throw (uno::RuntimeException, std::exception)
285 ::osl::MutexGuard aGuard(m_aMutex);
286 return m_sConditionalPrintExpression;
289 void SAL_CALL OSection::setConditionalPrintExpression( const OUString& _conditionalprintexpression ) throw (uno::RuntimeException, std::exception)
291 set(PROPERTY_CONDITIONALPRINTEXPRESSION,_conditionalprintexpression,m_sConditionalPrintExpression);
294 void OSection::checkNotPageHeaderFooter()
296 ::osl::MutexGuard aGuard(m_aMutex);
297 uno::Reference< report::XReportDefinition > xRet = m_xReportDefinition;
298 if ( xRet.is() )
300 if ( xRet->getPageHeaderOn() && xRet->getPageHeader() == *this )
301 throw beans::UnknownPropertyException();
302 if ( xRet->getPageFooterOn() && xRet->getPageFooter() == *this )
303 throw beans::UnknownPropertyException();
307 ::sal_Int16 SAL_CALL OSection::getForceNewPage() throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
309 ::osl::MutexGuard aGuard(m_aMutex);
311 checkNotPageHeaderFooter();
312 return m_nForceNewPage;
315 void SAL_CALL OSection::setForceNewPage( ::sal_Int16 _forcenewpage ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException, std::exception)
317 if ( _forcenewpage < report::ForceNewPage::NONE || _forcenewpage > report::ForceNewPage::BEFORE_AFTER_SECTION )
318 throwIllegallArgumentException("com::sun::star::report::ForceNewPage"
319 ,*this
321 ,m_xContext);
322 checkNotPageHeaderFooter();
323 set(PROPERTY_FORCENEWPAGE,_forcenewpage,m_nForceNewPage);
326 ::sal_Int16 SAL_CALL OSection::getNewRowOrCol() throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
328 ::osl::MutexGuard aGuard(m_aMutex);
329 checkNotPageHeaderFooter();
330 return m_nNewRowOrCol;
333 void SAL_CALL OSection::setNewRowOrCol( ::sal_Int16 _newroworcol ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException, std::exception)
335 if ( _newroworcol < report::ForceNewPage::NONE || _newroworcol > report::ForceNewPage::BEFORE_AFTER_SECTION )
336 throwIllegallArgumentException("com::sun::star::report::ForceNewPage"
337 ,*this
339 ,m_xContext);
340 checkNotPageHeaderFooter();
342 set(PROPERTY_NEWROWORCOL,_newroworcol,m_nNewRowOrCol);
345 sal_Bool SAL_CALL OSection::getKeepTogether() throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
347 ::osl::MutexGuard aGuard(m_aMutex);
348 checkNotPageHeaderFooter();
349 return m_bKeepTogether;
352 void SAL_CALL OSection::setKeepTogether( sal_Bool _keeptogether ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException, std::exception)
355 ::osl::MutexGuard aGuard(m_aMutex);
356 checkNotPageHeaderFooter();
359 set(PROPERTY_KEEPTOGETHER,_keeptogether,m_bKeepTogether);
362 sal_Bool SAL_CALL OSection::getCanGrow() throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
364 throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment
367 void SAL_CALL OSection::setCanGrow( sal_Bool /*_cangrow*/ ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException, std::exception)
369 throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment
372 sal_Bool SAL_CALL OSection::getCanShrink() throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
374 throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment
377 void SAL_CALL OSection::setCanShrink( sal_Bool /*_canshrink*/ ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException, std::exception)
379 throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment
382 sal_Bool SAL_CALL OSection::getRepeatSection() throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
384 ::osl::MutexGuard aGuard(m_aMutex);
385 uno::Reference< report::XGroup > xGroup = m_xGroup;
386 if ( !xGroup.is() )
387 throw beans::UnknownPropertyException();
388 return m_bRepeatSection;
391 void SAL_CALL OSection::setRepeatSection( sal_Bool _repeatsection ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException, std::exception)
394 ::osl::MutexGuard aGuard(m_aMutex);
395 uno::Reference< report::XGroup > xGroup = m_xGroup;
396 if ( !xGroup.is() )
397 throw beans::UnknownPropertyException();
399 set(PROPERTY_REPEATSECTION,_repeatsection,m_bRepeatSection);
402 uno::Reference< report::XGroup > SAL_CALL OSection::getGroup() throw (uno::RuntimeException, std::exception)
404 ::osl::MutexGuard aGuard(m_aMutex);
405 return m_xGroup;
408 uno::Reference< report::XReportDefinition > SAL_CALL OSection::getReportDefinition() throw (uno::RuntimeException, std::exception)
410 ::osl::MutexGuard aGuard(m_aMutex);
411 uno::Reference< report::XReportDefinition > xRet = m_xReportDefinition;
412 uno::Reference< report::XGroup > xGroup = m_xGroup;
413 if ( !xRet.is() && xGroup.is() )
415 uno::Reference< report::XGroups> xGroups(xGroup->getGroups());
416 if ( xGroups.is() )
417 xRet = xGroups->getReportDefinition();
420 return xRet;
423 // XChild
424 uno::Reference< uno::XInterface > SAL_CALL OSection::getParent( ) throw (uno::RuntimeException, std::exception)
426 uno::Reference< uno::XInterface > xRet;
428 ::osl::MutexGuard aGuard(m_aMutex);
429 xRet = m_xReportDefinition;
430 if ( !xRet.is() )
431 xRet = m_xGroup;
433 return xRet;
436 void SAL_CALL OSection::setParent( const uno::Reference< uno::XInterface >& /*Parent*/ ) throw (lang::NoSupportException, uno::RuntimeException, std::exception)
438 throw lang::NoSupportException();
441 // XContainer
442 void SAL_CALL OSection::addContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException, std::exception)
444 m_aContainerListeners.addInterface(xListener);
447 void SAL_CALL OSection::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException, std::exception)
449 m_aContainerListeners.removeInterface(xListener);
452 // XElementAccess
453 uno::Type SAL_CALL OSection::getElementType( ) throw (uno::RuntimeException, std::exception)
455 return cppu::UnoType<report::XReportComponent>::get();
458 sal_Bool SAL_CALL OSection::hasElements( ) throw (uno::RuntimeException, std::exception)
460 ::osl::MutexGuard aGuard(m_aMutex);
461 return m_xDrawPage.is() ? m_xDrawPage->hasElements() : sal_False;
464 // XIndexAccess
465 ::sal_Int32 SAL_CALL OSection::getCount( ) throw (uno::RuntimeException, std::exception)
467 ::osl::MutexGuard aGuard(m_aMutex);
468 return m_xDrawPage.is() ? m_xDrawPage->getCount() : 0;
471 uno::Any SAL_CALL OSection::getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
473 ::osl::MutexGuard aGuard(m_aMutex);
474 return m_xDrawPage.is() ? m_xDrawPage->getByIndex(Index) : uno::Any();
477 // XEnumerationAccess
478 uno::Reference< container::XEnumeration > SAL_CALL OSection::createEnumeration( ) throw (uno::RuntimeException, std::exception)
480 ::osl::MutexGuard aGuard(m_aMutex);
481 return new ::comphelper::OEnumerationByIndex(static_cast<XSection*>(this));
484 uno::Reference< beans::XPropertySetInfo > SAL_CALL OSection::getPropertySetInfo( ) throw(uno::RuntimeException, std::exception)
486 return SectionPropertySet::getPropertySetInfo();
489 void SAL_CALL OSection::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
491 SectionPropertySet::setPropertyValue( aPropertyName, aValue );
494 uno::Any SAL_CALL OSection::getPropertyValue( const OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
496 return SectionPropertySet::getPropertyValue( PropertyName);
499 void SAL_CALL OSection::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
501 SectionPropertySet::addPropertyChangeListener( aPropertyName, xListener );
504 void SAL_CALL OSection::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
506 SectionPropertySet::removePropertyChangeListener( aPropertyName, aListener );
509 void SAL_CALL OSection::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
511 SectionPropertySet::addVetoableChangeListener( PropertyName, aListener );
514 void SAL_CALL OSection::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
516 SectionPropertySet::removeVetoableChangeListener( PropertyName, aListener );
519 void SAL_CALL OSection::add( const uno::Reference< drawing::XShape >& xShape ) throw (uno::RuntimeException, std::exception)
522 ::osl::MutexGuard aGuard(m_aMutex);
523 m_bInInsertNotify = true;
524 OSL_ENSURE(m_xDrawPage.is(),"No DrawPage!");
525 m_xDrawPage->add(xShape);
526 m_bInInsertNotify = false;
528 notifyElementAdded(xShape);
531 void SAL_CALL OSection::remove( const uno::Reference< drawing::XShape >& xShape ) throw (uno::RuntimeException, std::exception)
534 ::osl::MutexGuard aGuard(m_aMutex);
535 m_bInRemoveNotify = true;
536 OSL_ENSURE(m_xDrawPage.is(),"No DrawPage!");
537 m_xDrawPage->remove(xShape);
538 m_bInRemoveNotify = false;
540 notifyElementRemoved(xShape);
543 // XShapeGrouper
544 uno::Reference< drawing::XShapeGroup > SAL_CALL
545 OSection::group(uno::Reference< drawing::XShapes > const& xShapes)
546 throw (uno::RuntimeException, std::exception)
548 // no lock because m_xDrawPage_ShapeGrouper is const
549 return (m_xDrawPage_ShapeGrouper.is())
550 ? m_xDrawPage_ShapeGrouper->group(xShapes)
551 : 0;
553 void SAL_CALL
554 OSection::ungroup(uno::Reference<drawing::XShapeGroup> const& xGroup)
555 throw (uno::RuntimeException, std::exception)
557 // no lock because m_xDrawPage_ShapeGrouper is const
558 if (m_xDrawPage_ShapeGrouper.is()) {
559 m_xDrawPage_ShapeGrouper->ungroup(xGroup);
563 // XFormsSupplier
564 uno::Reference<container::XNameContainer> SAL_CALL OSection::getForms()
565 throw (uno::RuntimeException, std::exception)
567 // no lock because m_xDrawPage_FormSupplier is const
568 return (m_xDrawPage_FormSupplier.is())
569 ? m_xDrawPage_FormSupplier->getForms()
570 : 0;
572 // XFormsSupplier2
573 sal_Bool SAL_CALL OSection::hasForms() throw (uno::RuntimeException, std::exception)
575 // no lock because m_xDrawPage_FormSupplier is const
576 return (m_xDrawPage_FormSupplier.is())
577 && m_xDrawPage_FormSupplier->hasForms();
581 // com::sun::star::lang::XUnoTunnel
583 sal_Int64 OSection::getSomething( const uno::Sequence< sal_Int8 > & rId ) throw (uno::RuntimeException, std::exception)
585 if (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
586 return reinterpret_cast<sal_Int64>(this);
587 return (m_xDrawPage_Tunnel.is()) ? m_xDrawPage_Tunnel->getSomething(rId) : 0;
591 OSection* OSection::getImplementation( const uno::Reference< uno::XInterface >& _rxComponent )
593 OSection* pContent( NULL );
595 uno::Reference< lang::XUnoTunnel > xUnoTunnel( _rxComponent, uno::UNO_QUERY );
596 if ( xUnoTunnel.is() )
597 pContent = reinterpret_cast< OSection* >( xUnoTunnel->getSomething( getUnoTunnelImplementationId() ) );
599 return pContent;
602 uno::Sequence< sal_Int8 > OSection::getUnoTunnelImplementationId()
604 static ::cppu::OImplementationId * pId = 0;
605 if (! pId)
607 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
608 if (! pId)
610 static ::cppu::OImplementationId aId;
611 pId = &aId;
614 return pId->getImplementationId();
617 void OSection::notifyElementAdded(const uno::Reference< drawing::XShape >& xShape )
619 if ( !m_bInInsertNotify )
621 container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::Any(), uno::makeAny(xShape), uno::Any());
622 m_aContainerListeners.notifyEach(&container::XContainerListener::elementInserted,aEvent);
626 void OSection::notifyElementRemoved(const uno::Reference< drawing::XShape >& xShape)
628 if ( !m_bInRemoveNotify )
630 // notify our container listeners
631 container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::Any(), uno::makeAny(xShape), uno::Any());
632 m_aContainerListeners.notifyEach(&container::XContainerListener::elementRemoved,aEvent);
636 } // namespace reportdesign
639 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */