23#include <com/sun/star/report/XReportComponent.hpp>
24#include <com/sun/star/report/ForceNewPage.hpp>
25#include <com/sun/star/lang/NoSupportException.hpp>
43 const OUString pProps[] = {
56 const OUString pProps[] = {
67 const OUString pProps[] = {
77 const uno::Reference< report::XReportDefinition >& xParentDef,
78 const uno::Reference< uno::XComponentContext >& context,
79 bool const bPageSection)
88 const uno::Reference< report::XGroup >& xParentGroup,
89 const uno::Reference< uno::XComponentContext >& context)
99 ,
const uno::Reference< report::XGroup >& xParentGroup
100 ,
const uno::Reference< uno::XComponentContext >& context
101 ,uno::Sequence< OUString>
const& rStrings)
105,m_xGroup(xParentGroup)
106,m_xReportDefinition(xParentDef)
109,m_nForceNewPage(report::ForceNewPage::
NONE)
110,m_nNewRowOrCol(report::ForceNewPage::
NONE)
111,m_bKeepTogether(false)
112,m_bRepeatSection(false)
114,m_bBacktransparent(true)
115,m_bInRemoveNotify(false)
116,m_bInInsertNotify(false)
131 uno::Any aReturn = SectionBase::queryInterface(_rType);
133 aReturn = SectionPropertySet::queryInterface(_rType);
135 if ( !aReturn.
hasValue() && OReportControlModel::isInterfaceForbidden(_rType) )
142void SAL_CALL OSection::dispose()
144 OSL_ENSURE(!rBHelper.bDisposed,
"Already disposed!");
145 SectionPropertySet::dispose();
146 uno::Reference<lang::XComponent>
const xPageComponent(m_xDrawPage,
148 if (xPageComponent.is())
150 xPageComponent->dispose();
152 cppu::WeakComponentImplHelperBase::dispose();
158void SAL_CALL OSection::disposing()
160 lang::EventObject aDisposeEvent( getXWeak() );
161 m_aContainerListeners.disposeAndClear( aDisposeEvent );
164OUString SAL_CALL OSection::getImplementationName( )
166 return "com.sun.star.comp.report.Section";
169uno::Sequence< OUString> OSection::getSupportedServiceNames_Static()
175uno::Sequence< OUString> SAL_CALL OSection::getSupportedServiceNames()
177 return getSupportedServiceNames_Static();
180sal_Bool SAL_CALL OSection::supportsService(
const OUString& _rServiceName )
188 uno::Reference< report::XReportDefinition> xReport = getReportDefinition();
189 std::shared_ptr<rptui::OReportModel> pModel = OReportDefinition::getSdrModel(xReport);
190 assert(pModel &&
"No model set at the report definition!");
194 uno::Reference<report::XSection>
const xSection(
this);
195 SdrPage & rSdrPage(*pModel->createNewPage(xSection));
196 m_xDrawPage.set(rSdrPage.
getUnoPage(), uno::UNO_QUERY_THROW);
197 m_xDrawPage_ShapeGrouper.set(m_xDrawPage, uno::UNO_QUERY_THROW);
199 m_xDrawPage_FormSupplier.set(m_xDrawPage, uno::UNO_QUERY);
200 m_xDrawPage_Tunnel.set(m_xDrawPage, uno::UNO_QUERY_THROW);
217void SAL_CALL OSection::setVisible(
sal_Bool _visible )
222OUString SAL_CALL OSection::getName()
228void SAL_CALL OSection::setName(
const OUString& _name )
233::sal_uInt32 SAL_CALL OSection::getHeight()
239void SAL_CALL OSection::setHeight( ::sal_uInt32 _height )
244::sal_Int32 SAL_CALL OSection::getBackColor()
247 return m_bBacktransparent ?
static_cast<sal_Int32
>(
COL_TRANSPARENT) : m_nBackgroundColor;
250void SAL_CALL OSection::setBackColor( ::sal_Int32 _backgroundcolor )
252 bool bTransparent = _backgroundcolor ==
static_cast<sal_Int32
>(
COL_TRANSPARENT);
253 setBackTransparent(bTransparent);
261 return m_bBacktransparent;
264void SAL_CALL OSection::setBackTransparent(
sal_Bool _backtransparent )
267 if ( _backtransparent )
271OUString SAL_CALL OSection::getConditionalPrintExpression()
274 return m_sConditionalPrintExpression;
277void SAL_CALL OSection::setConditionalPrintExpression(
const OUString& _conditionalprintexpression )
282void OSection::checkNotPageHeaderFooter()
285 uno::Reference< report::XReportDefinition > xRet = m_xReportDefinition;
288 if ( xRet->getPageHeaderOn() && xRet->getPageHeader() == *
this )
289 throw beans::UnknownPropertyException();
290 if ( xRet->getPageFooterOn() && xRet->getPageFooter() == *
this )
291 throw beans::UnknownPropertyException();
295::sal_Int16 SAL_CALL OSection::getForceNewPage()
299 checkNotPageHeaderFooter();
300 return m_nForceNewPage;
303void SAL_CALL OSection::setForceNewPage( ::sal_Int16 _forcenewpage )
305 if ( _forcenewpage < report::ForceNewPage::NONE || _forcenewpage > report::ForceNewPage::BEFORE_AFTER_SECTION )
309 checkNotPageHeaderFooter();
313::sal_Int16 SAL_CALL OSection::getNewRowOrCol()
316 checkNotPageHeaderFooter();
317 return m_nNewRowOrCol;
320void SAL_CALL OSection::setNewRowOrCol( ::sal_Int16 _newroworcol )
322 if ( _newroworcol < report::ForceNewPage::NONE || _newroworcol > report::ForceNewPage::BEFORE_AFTER_SECTION )
326 checkNotPageHeaderFooter();
334 checkNotPageHeaderFooter();
335 return m_bKeepTogether;
338void SAL_CALL OSection::setKeepTogether(
sal_Bool _keeptogether )
342 checkNotPageHeaderFooter();
350 throw beans::UnknownPropertyException();
355 throw beans::UnknownPropertyException();
360 throw beans::UnknownPropertyException();
365 throw beans::UnknownPropertyException();
371 uno::Reference< report::XGroup > xGroup = m_xGroup;
373 throw beans::UnknownPropertyException();
374 return m_bRepeatSection;
377void SAL_CALL OSection::setRepeatSection(
sal_Bool _repeatsection )
381 uno::Reference< report::XGroup > xGroup = m_xGroup;
383 throw beans::UnknownPropertyException();
388uno::Reference< report::XGroup > SAL_CALL OSection::getGroup()
394uno::Reference< report::XReportDefinition > SAL_CALL OSection::getReportDefinition()
397 uno::Reference< report::XReportDefinition > xRet = m_xReportDefinition;
398 uno::Reference< report::XGroup > xGroup = m_xGroup;
399 if ( !xRet.is() && xGroup.is() )
401 uno::Reference< report::XGroups> xGroups(xGroup->getGroups());
403 xRet = xGroups->getReportDefinition();
410uno::Reference< uno::XInterface > SAL_CALL OSection::getParent( )
412 uno::Reference< uno::XInterface > xRet;
415 xRet = m_xReportDefinition;
422void SAL_CALL OSection::setParent(
const uno::Reference< uno::XInterface >& )
424 throw lang::NoSupportException();
428void SAL_CALL OSection::addContainerListener(
const uno::Reference< container::XContainerListener >& xListener )
430 m_aContainerListeners.addInterface(xListener);
433void SAL_CALL OSection::removeContainerListener(
const uno::Reference< container::XContainerListener >& xListener )
435 m_aContainerListeners.removeInterface(xListener);
447 return m_xDrawPage.is() && m_xDrawPage->hasElements();
451::sal_Int32 SAL_CALL OSection::getCount( )
454 return m_xDrawPage.is() ? m_xDrawPage->getCount() : 0;
460 return m_xDrawPage.is() ? m_xDrawPage->getByIndex(
Index) :
uno::Any();
464uno::Reference< container::XEnumeration > SAL_CALL OSection::createEnumeration( )
467 return new ::comphelper::OEnumerationByIndex(
static_cast<XSection*
>(
this));
470uno::Reference< beans::XPropertySetInfo > SAL_CALL OSection::getPropertySetInfo( )
472 return SectionPropertySet::getPropertySetInfo();
475void SAL_CALL OSection::setPropertyValue(
const OUString& aPropertyName,
const uno::Any& aValue )
477 SectionPropertySet::setPropertyValue( aPropertyName, aValue );
480uno::Any SAL_CALL OSection::getPropertyValue(
const OUString& PropertyName )
482 return SectionPropertySet::getPropertyValue( PropertyName);
485void SAL_CALL OSection::addPropertyChangeListener(
const OUString& aPropertyName,
const uno::Reference< beans::XPropertyChangeListener >& xListener )
487 SectionPropertySet::addPropertyChangeListener( aPropertyName, xListener );
490void SAL_CALL OSection::removePropertyChangeListener(
const OUString& aPropertyName,
const uno::Reference< beans::XPropertyChangeListener >& aListener )
492 SectionPropertySet::removePropertyChangeListener( aPropertyName, aListener );
495void SAL_CALL OSection::addVetoableChangeListener(
const OUString& PropertyName,
const uno::Reference< beans::XVetoableChangeListener >& aListener )
497 SectionPropertySet::addVetoableChangeListener( PropertyName, aListener );
500void SAL_CALL OSection::removeVetoableChangeListener(
const OUString& PropertyName,
const uno::Reference< beans::XVetoableChangeListener >& aListener )
502 SectionPropertySet::removeVetoableChangeListener( PropertyName, aListener );
505void SAL_CALL OSection::add(
const uno::Reference< drawing::XShape >& xShape )
509 m_bInInsertNotify =
true;
510 OSL_ENSURE(m_xDrawPage.is(),
"No DrawPage!");
511 m_xDrawPage->add(xShape);
512 m_bInInsertNotify =
false;
514 notifyElementAdded(xShape);
517void SAL_CALL OSection::remove(
const uno::Reference< drawing::XShape >& xShape )
521 m_bInRemoveNotify =
true;
522 OSL_ENSURE(m_xDrawPage.is(),
"No DrawPage!");
523 m_xDrawPage->remove(xShape);
524 m_bInRemoveNotify =
false;
526 notifyElementRemoved(xShape);
530uno::Reference< drawing::XShapeGroup > SAL_CALL
531OSection::group(uno::Reference< drawing::XShapes >
const& xShapes)
534 return (m_xDrawPage_ShapeGrouper.is())
535 ? m_xDrawPage_ShapeGrouper->group(xShapes)
539OSection::ungroup(uno::Reference<drawing::XShapeGroup>
const& xGroup)
542 if (m_xDrawPage_ShapeGrouper.is()) {
543 m_xDrawPage_ShapeGrouper->ungroup(xGroup);
548uno::Reference<container::XNameContainer> SAL_CALL OSection::getForms()
551 return (m_xDrawPage_FormSupplier.is())
552 ? m_xDrawPage_FormSupplier->getForms()
559 return (m_xDrawPage_FormSupplier.is())
560 && m_xDrawPage_FormSupplier->hasForms();
566sal_Int64 OSection::getSomething(
const uno::Sequence< sal_Int8 > & rId )
568 if (comphelper::isUnoTunnelId<OSection>(rId) )
570 return (m_xDrawPage_Tunnel.is()) ? m_xDrawPage_Tunnel->getSomething(rId) : 0;
573const uno::Sequence< sal_Int8 > & OSection::getUnoTunnelId()
579void OSection::notifyElementAdded(
const uno::Reference< drawing::XShape >& xShape )
581 if ( !m_bInInsertNotify )
584 m_aContainerListeners.notifyEach(&container::XContainerListener::elementInserted,
aEvent);
588void OSection::notifyElementRemoved(
const uno::Reference< drawing::XShape >& xShape)
590 if ( !m_bInRemoveNotify )
594 m_aContainerListeners.notifyEach(&container::XContainerListener::elementRemoved,
aEvent);
css::uno::Reference< css::uno::XInterface > const & getUnoPage()
void SetUnoPage(css::uno::Reference< css::drawing::XDrawPage > const &)
const css::uno::Sequence< sal_Int8 > & getSeq() const
css::uno::Type const & get()
static css::uno::Reference< css::report::XSection > createOSection(const css::uno::Reference< css::report::XReportDefinition > &_xParent, const css::uno::Reference< css::uno::XComponentContext > &context, bool _bPageSection=false)
OSection(const OSection &)=delete
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
#define SAL_N_ELEMENTS(arr)
void set(css::uno::UnoInterfaceReference const &value)
sal_Int64 getSomething_cast(void *p)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
static uno::Sequence< OUString > lcl_getAbsent(bool _bPageSection)
void throwIllegallArgumentException(std::u16string_view _sTypeName, const uno::Reference< uno::XInterface > &ExceptionContext_, sal_Int16 ArgumentPosition_)
::cppu::PropertySetMixin< css::report::XSection > SectionPropertySet
static uno::Sequence< OUString > lcl_getGroupAbsent()
::cppu::WeakComponentImplHelper< css::report::XSection, css::lang::XServiceInfo, css::lang::XUnoTunnel, css::drawing::XDrawPage, css::drawing::XShapeGrouper, css::form::XFormsSupplier2 > SectionBase
constexpr OUStringLiteral PROPERTY_NAME
constexpr OUStringLiteral SERVICE_SECTION
constexpr OUStringLiteral PROPERTY_VISIBLE
constexpr OUStringLiteral PROPERTY_FORCENEWPAGE
constexpr OUStringLiteral PROPERTY_CANGROW
constexpr OUStringLiteral PROPERTY_HEIGHT
constexpr OUStringLiteral PROPERTY_REPEATSECTION
constexpr OUStringLiteral PROPERTY_CANSHRINK
constexpr OUStringLiteral PROPERTY_BACKTRANSPARENT
constexpr OUStringLiteral PROPERTY_NEWROWORCOL
constexpr OUStringLiteral PROPERTY_KEEPTOGETHER
constexpr OUStringLiteral PROPERTY_BACKCOLOR
constexpr OUStringLiteral PROPERTY_CONDITIONALPRINTEXPRESSION
#define IMPLEMENT_FORWARD_REFCOUNT(classname, refcountbase)