cURL: follow redirects
[LibreOffice.git] / reportdesign / source / core / api / Section.cxx
bloba6e228ca05adf8f56d84ed6f9bbb04f3c3eae505
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 const OUString pProps[] = {
52 OUString(PROPERTY_CANGROW)
53 ,OUString(PROPERTY_CANSHRINK)
56 return uno::Sequence< OUString >(pProps,SAL_N_ELEMENTS(pProps));
60 uno::Sequence< OUString> lcl_getAbsent(bool _bPageSection)
62 if ( _bPageSection )
64 const 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,SAL_N_ELEMENTS(pProps));
75 const OUString pProps[] = {
76 OUString(PROPERTY_CANGROW)
77 ,OUString(PROPERTY_CANSHRINK)
78 ,OUString(PROPERTY_REPEATSECTION)
81 return uno::Sequence< OUString >(pProps,SAL_N_ELEMENTS(pProps));
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, nullptr, 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(nullptr, 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 { SERVICE_SECTION };
183 return aSupported;
186 uno::Sequence< OUString> SAL_CALL OSection::getSupportedServiceNames() throw(uno::RuntimeException, std::exception)
188 return getSupportedServiceNames_Static();
191 sal_Bool SAL_CALL OSection::supportsService( const OUString& _rServiceName ) throw(uno::RuntimeException, std::exception)
193 return cppu::supportsService(this, _rServiceName);
196 void OSection::init()
198 SolarMutexGuard g; // lock while manipulating SdrModel
199 uno::Reference< report::XReportDefinition> xReport = getReportDefinition();
200 std::shared_ptr<rptui::OReportModel> pModel = OReportDefinition::getSdrModel(xReport);
201 assert(pModel && "No model set at the report definition!");
202 if ( pModel )
204 uno::Reference<report::XSection> const xSection(this);
205 SdrPage & rSdrPage(*pModel->createNewPage(xSection));
206 m_xDrawPage.set(rSdrPage.getUnoPage(), uno::UNO_QUERY_THROW);
207 m_xDrawPage_ShapeGrouper.set(m_xDrawPage, uno::UNO_QUERY_THROW);
208 // apparently we may also get OReportDrawPage which doesn't support this
209 m_xDrawPage_FormSupplier.set(m_xDrawPage, uno::UNO_QUERY);
210 m_xDrawPage_Tunnel.set(m_xDrawPage, uno::UNO_QUERY_THROW);
211 // fdo#53872: now also exchange the XDrawPage in the SdrPage so that
212 // rSdrPage.getUnoPage returns this
213 rSdrPage.SetUnoPage(this);
214 // createNewPage _should_ have stored away 2 uno::References to this,
215 // so our ref count cannot be 1 here, so this isn't destroyed here
216 assert(m_refCount > 1);
220 // XSection
222 sal_Bool SAL_CALL OSection::getVisible() throw (uno::RuntimeException, std::exception)
224 ::osl::MutexGuard aGuard(m_aMutex);
225 return m_bVisible;
228 void SAL_CALL OSection::setVisible( sal_Bool _visible ) throw (uno::RuntimeException, std::exception)
230 set(PROPERTY_VISIBLE,_visible,m_bVisible);
233 OUString SAL_CALL OSection::getName() throw (uno::RuntimeException, std::exception)
235 ::osl::MutexGuard aGuard(m_aMutex);
236 return m_sName;
239 void SAL_CALL OSection::setName( const OUString& _name ) throw (uno::RuntimeException, std::exception)
241 set(PROPERTY_NAME,_name,m_sName);
244 ::sal_uInt32 SAL_CALL OSection::getHeight() throw (uno::RuntimeException, std::exception)
246 ::osl::MutexGuard aGuard(m_aMutex);
247 return m_nHeight;
250 void SAL_CALL OSection::setHeight( ::sal_uInt32 _height ) throw (uno::RuntimeException, std::exception)
252 set(PROPERTY_HEIGHT,_height,m_nHeight);
255 ::sal_Int32 SAL_CALL OSection::getBackColor() throw (uno::RuntimeException, std::exception)
257 ::osl::MutexGuard aGuard(m_aMutex);
258 return m_bBacktransparent ? COL_TRANSPARENT : m_nBackgroundColor;
261 void SAL_CALL OSection::setBackColor( ::sal_Int32 _backgroundcolor ) throw (uno::RuntimeException, std::exception)
263 bool bTransparent = _backgroundcolor == static_cast<sal_Int32>(COL_TRANSPARENT);
264 setBackTransparent(bTransparent);
265 if ( !bTransparent )
266 set(PROPERTY_BACKCOLOR,_backgroundcolor,m_nBackgroundColor);
269 sal_Bool SAL_CALL OSection::getBackTransparent() throw (uno::RuntimeException, std::exception)
271 ::osl::MutexGuard aGuard(m_aMutex);
272 return m_bBacktransparent;
275 void SAL_CALL OSection::setBackTransparent( sal_Bool _backtransparent ) throw (uno::RuntimeException, std::exception)
277 set(PROPERTY_BACKTRANSPARENT,_backtransparent,m_bBacktransparent);
278 if ( _backtransparent )
279 set(PROPERTY_BACKCOLOR,static_cast<sal_Int32>(COL_TRANSPARENT),m_nBackgroundColor);
282 OUString SAL_CALL OSection::getConditionalPrintExpression() throw (uno::RuntimeException, std::exception)
284 ::osl::MutexGuard aGuard(m_aMutex);
285 return m_sConditionalPrintExpression;
288 void SAL_CALL OSection::setConditionalPrintExpression( const OUString& _conditionalprintexpression ) throw (uno::RuntimeException, std::exception)
290 set(PROPERTY_CONDITIONALPRINTEXPRESSION,_conditionalprintexpression,m_sConditionalPrintExpression);
293 void OSection::checkNotPageHeaderFooter()
295 ::osl::MutexGuard aGuard(m_aMutex);
296 uno::Reference< report::XReportDefinition > xRet = m_xReportDefinition;
297 if ( xRet.is() )
299 if ( xRet->getPageHeaderOn() && xRet->getPageHeader() == *this )
300 throw beans::UnknownPropertyException();
301 if ( xRet->getPageFooterOn() && xRet->getPageFooter() == *this )
302 throw beans::UnknownPropertyException();
306 ::sal_Int16 SAL_CALL OSection::getForceNewPage() throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
308 ::osl::MutexGuard aGuard(m_aMutex);
310 checkNotPageHeaderFooter();
311 return m_nForceNewPage;
314 void SAL_CALL OSection::setForceNewPage( ::sal_Int16 _forcenewpage ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException, std::exception)
316 if ( _forcenewpage < report::ForceNewPage::NONE || _forcenewpage > report::ForceNewPage::BEFORE_AFTER_SECTION )
317 throwIllegallArgumentException("css::report::ForceNewPage"
318 ,*this
319 ,1);
320 checkNotPageHeaderFooter();
321 set(PROPERTY_FORCENEWPAGE,_forcenewpage,m_nForceNewPage);
324 ::sal_Int16 SAL_CALL OSection::getNewRowOrCol() throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
326 ::osl::MutexGuard aGuard(m_aMutex);
327 checkNotPageHeaderFooter();
328 return m_nNewRowOrCol;
331 void SAL_CALL OSection::setNewRowOrCol( ::sal_Int16 _newroworcol ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException, std::exception)
333 if ( _newroworcol < report::ForceNewPage::NONE || _newroworcol > report::ForceNewPage::BEFORE_AFTER_SECTION )
334 throwIllegallArgumentException("css::report::ForceNewPage"
335 ,*this
336 ,1);
337 checkNotPageHeaderFooter();
339 set(PROPERTY_NEWROWORCOL,_newroworcol,m_nNewRowOrCol);
342 sal_Bool SAL_CALL OSection::getKeepTogether() throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
344 ::osl::MutexGuard aGuard(m_aMutex);
345 checkNotPageHeaderFooter();
346 return m_bKeepTogether;
349 void SAL_CALL OSection::setKeepTogether( sal_Bool _keeptogether ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException, std::exception)
352 ::osl::MutexGuard aGuard(m_aMutex);
353 checkNotPageHeaderFooter();
356 set(PROPERTY_KEEPTOGETHER,_keeptogether,m_bKeepTogether);
359 sal_Bool SAL_CALL OSection::getCanGrow() throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
361 throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment
364 void SAL_CALL OSection::setCanGrow( sal_Bool /*_cangrow*/ ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException, std::exception)
366 throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment
369 sal_Bool SAL_CALL OSection::getCanShrink() throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
371 throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment
374 void SAL_CALL OSection::setCanShrink( sal_Bool /*_canshrink*/ ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException, std::exception)
376 throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment
379 sal_Bool SAL_CALL OSection::getRepeatSection() throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception)
381 ::osl::MutexGuard aGuard(m_aMutex);
382 uno::Reference< report::XGroup > xGroup = m_xGroup;
383 if ( !xGroup.is() )
384 throw beans::UnknownPropertyException();
385 return m_bRepeatSection;
388 void SAL_CALL OSection::setRepeatSection( sal_Bool _repeatsection ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException, std::exception)
391 ::osl::MutexGuard aGuard(m_aMutex);
392 uno::Reference< report::XGroup > xGroup = m_xGroup;
393 if ( !xGroup.is() )
394 throw beans::UnknownPropertyException();
396 set(PROPERTY_REPEATSECTION,_repeatsection,m_bRepeatSection);
399 uno::Reference< report::XGroup > SAL_CALL OSection::getGroup() throw (uno::RuntimeException, std::exception)
401 ::osl::MutexGuard aGuard(m_aMutex);
402 return m_xGroup;
405 uno::Reference< report::XReportDefinition > SAL_CALL OSection::getReportDefinition() throw (uno::RuntimeException, std::exception)
407 ::osl::MutexGuard aGuard(m_aMutex);
408 uno::Reference< report::XReportDefinition > xRet = m_xReportDefinition;
409 uno::Reference< report::XGroup > xGroup = m_xGroup;
410 if ( !xRet.is() && xGroup.is() )
412 uno::Reference< report::XGroups> xGroups(xGroup->getGroups());
413 if ( xGroups.is() )
414 xRet = xGroups->getReportDefinition();
417 return xRet;
420 // XChild
421 uno::Reference< uno::XInterface > SAL_CALL OSection::getParent( ) throw (uno::RuntimeException, std::exception)
423 uno::Reference< uno::XInterface > xRet;
425 ::osl::MutexGuard aGuard(m_aMutex);
426 xRet = m_xReportDefinition;
427 if ( !xRet.is() )
428 xRet = m_xGroup;
430 return xRet;
433 void SAL_CALL OSection::setParent( const uno::Reference< uno::XInterface >& /*Parent*/ ) throw (lang::NoSupportException, uno::RuntimeException, std::exception)
435 throw lang::NoSupportException();
438 // XContainer
439 void SAL_CALL OSection::addContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException, std::exception)
441 m_aContainerListeners.addInterface(xListener);
444 void SAL_CALL OSection::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException, std::exception)
446 m_aContainerListeners.removeInterface(xListener);
449 // XElementAccess
450 uno::Type SAL_CALL OSection::getElementType( ) throw (uno::RuntimeException, std::exception)
452 return cppu::UnoType<report::XReportComponent>::get();
455 sal_Bool SAL_CALL OSection::hasElements( ) throw (uno::RuntimeException, std::exception)
457 ::osl::MutexGuard aGuard(m_aMutex);
458 return m_xDrawPage.is() && m_xDrawPage->hasElements();
461 // XIndexAccess
462 ::sal_Int32 SAL_CALL OSection::getCount( ) throw (uno::RuntimeException, std::exception)
464 ::osl::MutexGuard aGuard(m_aMutex);
465 return m_xDrawPage.is() ? m_xDrawPage->getCount() : 0;
468 uno::Any SAL_CALL OSection::getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
470 ::osl::MutexGuard aGuard(m_aMutex);
471 return m_xDrawPage.is() ? m_xDrawPage->getByIndex(Index) : uno::Any();
474 // XEnumerationAccess
475 uno::Reference< container::XEnumeration > SAL_CALL OSection::createEnumeration( ) throw (uno::RuntimeException, std::exception)
477 ::osl::MutexGuard aGuard(m_aMutex);
478 return new ::comphelper::OEnumerationByIndex(static_cast<XSection*>(this));
481 uno::Reference< beans::XPropertySetInfo > SAL_CALL OSection::getPropertySetInfo( ) throw(uno::RuntimeException, std::exception)
483 return SectionPropertySet::getPropertySetInfo();
486 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)
488 SectionPropertySet::setPropertyValue( aPropertyName, aValue );
491 uno::Any SAL_CALL OSection::getPropertyValue( const OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
493 return SectionPropertySet::getPropertyValue( PropertyName);
496 void SAL_CALL OSection::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
498 SectionPropertySet::addPropertyChangeListener( aPropertyName, xListener );
501 void SAL_CALL OSection::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
503 SectionPropertySet::removePropertyChangeListener( aPropertyName, aListener );
506 void SAL_CALL OSection::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
508 SectionPropertySet::addVetoableChangeListener( PropertyName, aListener );
511 void SAL_CALL OSection::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
513 SectionPropertySet::removeVetoableChangeListener( PropertyName, aListener );
516 void SAL_CALL OSection::add( const uno::Reference< drawing::XShape >& xShape ) throw (uno::RuntimeException, std::exception)
519 ::osl::MutexGuard aGuard(m_aMutex);
520 m_bInInsertNotify = true;
521 OSL_ENSURE(m_xDrawPage.is(),"No DrawPage!");
522 m_xDrawPage->add(xShape);
523 m_bInInsertNotify = false;
525 notifyElementAdded(xShape);
528 void SAL_CALL OSection::remove( const uno::Reference< drawing::XShape >& xShape ) throw (uno::RuntimeException, std::exception)
531 ::osl::MutexGuard aGuard(m_aMutex);
532 m_bInRemoveNotify = true;
533 OSL_ENSURE(m_xDrawPage.is(),"No DrawPage!");
534 m_xDrawPage->remove(xShape);
535 m_bInRemoveNotify = false;
537 notifyElementRemoved(xShape);
540 // XShapeGrouper
541 uno::Reference< drawing::XShapeGroup > SAL_CALL
542 OSection::group(uno::Reference< drawing::XShapes > const& xShapes)
543 throw (uno::RuntimeException, std::exception)
545 // no lock because m_xDrawPage_ShapeGrouper is const
546 return (m_xDrawPage_ShapeGrouper.is())
547 ? m_xDrawPage_ShapeGrouper->group(xShapes)
548 : nullptr;
550 void SAL_CALL
551 OSection::ungroup(uno::Reference<drawing::XShapeGroup> const& xGroup)
552 throw (uno::RuntimeException, std::exception)
554 // no lock because m_xDrawPage_ShapeGrouper is const
555 if (m_xDrawPage_ShapeGrouper.is()) {
556 m_xDrawPage_ShapeGrouper->ungroup(xGroup);
560 // XFormsSupplier
561 uno::Reference<container::XNameContainer> SAL_CALL OSection::getForms()
562 throw (uno::RuntimeException, std::exception)
564 // no lock because m_xDrawPage_FormSupplier is const
565 return (m_xDrawPage_FormSupplier.is())
566 ? m_xDrawPage_FormSupplier->getForms()
567 : nullptr;
569 // XFormsSupplier2
570 sal_Bool SAL_CALL OSection::hasForms() throw (uno::RuntimeException, std::exception)
572 // no lock because m_xDrawPage_FormSupplier is const
573 return (m_xDrawPage_FormSupplier.is())
574 && m_xDrawPage_FormSupplier->hasForms();
578 // css::lang::XUnoTunnel
580 sal_Int64 OSection::getSomething( const uno::Sequence< sal_Int8 > & rId ) throw (uno::RuntimeException, std::exception)
582 if (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
583 return reinterpret_cast<sal_Int64>(this);
584 return (m_xDrawPage_Tunnel.is()) ? m_xDrawPage_Tunnel->getSomething(rId) : 0;
588 OSection* OSection::getImplementation( const uno::Reference< uno::XInterface >& _rxComponent )
590 OSection* pContent( nullptr );
592 uno::Reference< lang::XUnoTunnel > xUnoTunnel( _rxComponent, uno::UNO_QUERY );
593 if ( xUnoTunnel.is() )
594 pContent = reinterpret_cast< OSection* >( xUnoTunnel->getSomething( getUnoTunnelImplementationId() ) );
596 return pContent;
599 uno::Sequence< sal_Int8 > OSection::getUnoTunnelImplementationId()
601 static ::cppu::OImplementationId * pId = nullptr;
602 if (! pId)
604 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
605 if (! pId)
607 static ::cppu::OImplementationId aId;
608 pId = &aId;
611 return pId->getImplementationId();
614 void OSection::notifyElementAdded(const uno::Reference< drawing::XShape >& xShape )
616 if ( !m_bInInsertNotify )
618 container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::Any(), uno::makeAny(xShape), uno::Any());
619 m_aContainerListeners.notifyEach(&container::XContainerListener::elementInserted,aEvent);
623 void OSection::notifyElementRemoved(const uno::Reference< drawing::XShape >& xShape)
625 if ( !m_bInRemoveNotify )
627 // notify our container listeners
628 container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::Any(), uno::makeAny(xShape), uno::Any());
629 m_aContainerListeners.notifyEach(&container::XContainerListener::elementRemoved,aEvent);
633 } // namespace reportdesign
636 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */