summaryrefslogtreecommitdiffstats
path: root/reportdesign/source/core/api
diff options
context:
space:
mode:
Diffstat (limited to 'reportdesign/source/core/api')
-rw-r--r--reportdesign/source/core/api/FixedLine.cxx565
-rw-r--r--reportdesign/source/core/api/FixedText.cxx323
-rw-r--r--reportdesign/source/core/api/FormatCondition.cxx147
-rw-r--r--reportdesign/source/core/api/FormattedField.cxx361
-rw-r--r--reportdesign/source/core/api/Function.cxx201
-rw-r--r--reportdesign/source/core/api/Functions.cxx193
-rw-r--r--reportdesign/source/core/api/Group.cxx321
-rw-r--r--reportdesign/source/core/api/Groups.cxx195
-rw-r--r--reportdesign/source/core/api/ImageControl.cxx482
-rw-r--r--reportdesign/source/core/api/ReportComponent.cxx133
-rw-r--r--reportdesign/source/core/api/ReportControlModel.cxx134
-rw-r--r--reportdesign/source/core/api/ReportDefinition.cxx2666
-rw-r--r--reportdesign/source/core/api/ReportEngineJFree.cxx370
-rw-r--r--reportdesign/source/core/api/ReportVisitor.cxx90
-rw-r--r--reportdesign/source/core/api/Section.cxx601
-rw-r--r--reportdesign/source/core/api/Shape.cxx494
-rw-r--r--reportdesign/source/core/api/Tools.cxx67
-rw-r--r--reportdesign/source/core/api/services.cxx82
18 files changed, 7425 insertions, 0 deletions
diff --git a/reportdesign/source/core/api/FixedLine.cxx b/reportdesign/source/core/api/FixedLine.cxx
new file mode 100644
index 000000000..8a70f07a5
--- /dev/null
+++ b/reportdesign/source/core/api/FixedLine.cxx
@@ -0,0 +1,565 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#include <FixedLine.hxx>
+#include <strings.hxx>
+#include <strings.hrc>
+#include <core_resource.hxx>
+#include <cppuhelper/supportsservice.hxx>
+#include <tools/diagnose_ex.h>
+#include <Tools.hxx>
+#include <FormatCondition.hxx>
+#include <ReportHelperImpl.hxx>
+
+#define MIN_WIDTH 80
+#define MIN_HEIGHT 20
+
+namespace reportdesign
+{
+
+ using namespace com::sun::star;
+static uno::Sequence< OUString > lcl_getLineOptionals()
+{
+ OUString pProps[] = {
+ OUString(PROPERTY_DATAFIELD)
+ ,OUString(PROPERTY_DEFAULTCONTROL)
+ ,OUString(PROPERTY_CONTROLBORDER)
+ ,OUString(PROPERTY_CONTROLBORDERCOLOR)
+ ,OUString(PROPERTY_CHARCOLOR)
+ ,OUString(PROPERTY_CHAREMPHASIS)
+ ,OUString(PROPERTY_CHARFONTCHARSET)
+ ,OUString(PROPERTY_CHARFONTFAMILY)
+ ,OUString(PROPERTY_CHARFONTNAME)
+ ,OUString(PROPERTY_CHARFONTPITCH)
+ ,OUString(PROPERTY_CHARFONTSTYLENAME)
+ ,OUString(PROPERTY_CHARHEIGHT)
+ ,OUString(PROPERTY_CHARPOSTURE)
+ ,OUString(PROPERTY_CHARRELIEF)
+ ,OUString(PROPERTY_FONTDESCRIPTOR)
+ ,OUString(PROPERTY_FONTDESCRIPTORASIAN)
+ ,OUString(PROPERTY_FONTDESCRIPTORCOMPLEX)
+ ,OUString(PROPERTY_CONTROLTEXTEMPHASISMARK)
+ ,OUString(PROPERTY_CHARROTATION)
+ ,OUString(PROPERTY_CHARSCALEWIDTH)
+ ,OUString(PROPERTY_CHARSTRIKEOUT)
+ ,OUString(PROPERTY_CHARUNDERLINECOLOR)
+ ,OUString(PROPERTY_CHARUNDERLINE)
+ ,OUString(PROPERTY_CHARWEIGHT)
+ ,OUString(PROPERTY_CHARWORDMODE)
+ ,OUString(PROPERTY_CONTROLBACKGROUND)
+ ,OUString(PROPERTY_CONTROLBACKGROUNDTRANSPARENT)
+ ,OUString(PROPERTY_CHARFLASH)
+ ,OUString(PROPERTY_CHARAUTOKERNING)
+ ,OUString(PROPERTY_CHARESCAPEMENTHEIGHT)
+ ,OUString(PROPERTY_CHARLOCALE)
+ ,OUString(PROPERTY_CHARESCAPEMENT)
+ ,OUString(PROPERTY_CHARCASEMAP)
+ ,OUString(PROPERTY_CHARCOMBINEISON)
+ ,OUString(PROPERTY_CHARCOMBINEPREFIX)
+ ,OUString(PROPERTY_CHARCOMBINESUFFIX)
+ ,OUString(PROPERTY_CHARHIDDEN)
+ ,OUString(PROPERTY_CHARSHADOWED)
+ ,OUString(PROPERTY_CHARCONTOURED)
+ ,OUString(PROPERTY_HYPERLINKURL)
+ ,OUString(PROPERTY_HYPERLINKTARGET)
+ ,OUString(PROPERTY_HYPERLINKNAME)
+ ,OUString(PROPERTY_VISITEDCHARSTYLENAME)
+ ,OUString(PROPERTY_UNVISITEDCHARSTYLENAME)
+ ,OUString(PROPERTY_CHARKERNING)
+ ,OUString(PROPERTY_PRINTREPEATEDVALUES)
+ ,OUString(PROPERTY_CONDITIONALPRINTEXPRESSION)
+ ,OUString(PROPERTY_PRINTWHENGROUPCHANGE)
+ ,OUString(PROPERTY_MASTERFIELDS)
+ ,OUString(PROPERTY_DETAILFIELDS)
+ ,OUString(PROPERTY_PARAADJUST)
+
+ , OUString(PROPERTY_CHAREMPHASISASIAN)
+ , OUString(PROPERTY_CHARFONTNAMEASIAN)
+ , OUString(PROPERTY_CHARFONTSTYLENAMEASIAN)
+ , OUString(PROPERTY_CHARFONTFAMILYASIAN)
+ , OUString(PROPERTY_CHARFONTCHARSETASIAN)
+ , OUString(PROPERTY_CHARFONTPITCHASIAN)
+ , OUString(PROPERTY_CHARHEIGHTASIAN)
+ , OUString(PROPERTY_CHARUNDERLINEASIAN)
+ , OUString(PROPERTY_CHARWEIGHTASIAN)
+ , OUString(PROPERTY_CHARPOSTUREASIAN)
+ , OUString(PROPERTY_CHARWORDMODEASIAN)
+ , OUString(PROPERTY_CHARROTATIONASIAN)
+ , OUString(PROPERTY_CHARSCALEWIDTHASIAN)
+ , OUString(PROPERTY_CHARLOCALEASIAN)
+ , OUString(PROPERTY_CHAREMPHASISCOMPLEX)
+ , OUString(PROPERTY_CHARFONTNAMECOMPLEX)
+ , OUString(PROPERTY_CHARFONTSTYLENAMECOMPLEX)
+ , OUString(PROPERTY_CHARFONTFAMILYCOMPLEX)
+ , OUString(PROPERTY_CHARFONTCHARSETCOMPLEX)
+ , OUString(PROPERTY_CHARFONTPITCHCOMPLEX)
+ , OUString(PROPERTY_CHARHEIGHTCOMPLEX)
+ , OUString(PROPERTY_CHARUNDERLINECOMPLEX)
+ , OUString(PROPERTY_CHARWEIGHTCOMPLEX)
+ , OUString(PROPERTY_CHARPOSTURECOMPLEX)
+ , OUString(PROPERTY_CHARWORDMODECOMPLEX)
+ , OUString(PROPERTY_CHARROTATIONCOMPLEX)
+ , OUString(PROPERTY_CHARSCALEWIDTHCOMPLEX)
+ , OUString(PROPERTY_CHARLOCALECOMPLEX)
+
+
+ };
+ return uno::Sequence< OUString >(pProps,SAL_N_ELEMENTS(pProps));
+}
+
+OFixedLine::OFixedLine(uno::Reference< uno::XComponentContext > const & _xContext)
+:FixedLineBase(m_aMutex)
+,FixedLinePropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,lcl_getLineOptionals())
+,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext)
+,m_LineStyle( drawing::LineStyle_NONE )
+,m_nOrientation(1)
+,m_LineColor(0)
+,m_LineTransparence(0)
+,m_LineWidth(0)
+{
+ m_aProps.aComponent.m_sName = RptResId(RID_STR_FIXEDLINE);
+ m_aProps.aComponent.m_nWidth = MIN_WIDTH;
+}
+
+OFixedLine::OFixedLine(uno::Reference< uno::XComponentContext > const & _xContext
+ ,const uno::Reference< lang::XMultiServiceFactory>& _xFactory
+ ,uno::Reference< drawing::XShape >& _xShape
+ ,sal_Int32 _nOrientation)
+:FixedLineBase(m_aMutex)
+,FixedLinePropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,lcl_getLineOptionals())
+,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext)
+,m_LineStyle( drawing::LineStyle_NONE )
+,m_nOrientation(_nOrientation)
+,m_LineColor(0)
+,m_LineTransparence(0)
+,m_LineWidth(0)
+{
+ m_aProps.aComponent.m_sName = RptResId(RID_STR_FIXEDLINE);
+ m_aProps.aComponent.m_xFactory = _xFactory;
+ osl_atomic_increment( &m_refCount );
+ try
+ {
+ awt::Size aSize = _xShape->getSize();
+ if ( m_nOrientation == 1 )
+ {
+ if ( aSize.Width < MIN_WIDTH )
+ {
+ aSize.Width = MIN_WIDTH;
+ _xShape->setSize(aSize);
+ }
+ }
+ else if ( MIN_HEIGHT > aSize.Height )
+ {
+ aSize.Height = MIN_HEIGHT;
+ _xShape->setSize(aSize);
+ }
+ m_aProps.aComponent.setShape(_xShape,this,m_refCount);
+ }
+ catch(uno::Exception&)
+ {
+ TOOLS_WARN_EXCEPTION( "reportdesign", "OFixedLine::OFixedLine");
+ }
+ osl_atomic_decrement( &m_refCount );
+}
+
+OFixedLine::~OFixedLine()
+{
+}
+
+IMPLEMENT_FORWARD_REFCOUNT( OFixedLine, FixedLineBase )
+
+uno::Any SAL_CALL OFixedLine::queryInterface( const uno::Type& _rType )
+{
+ uno::Any aReturn = FixedLineBase::queryInterface(_rType);
+ if ( !aReturn.hasValue() )
+ aReturn = FixedLinePropertySet::queryInterface(_rType);
+ if ( !aReturn.hasValue() && OReportControlModel::isInterfaceForbidden(_rType) )
+ return aReturn;
+
+ return aReturn.hasValue() ? aReturn : (m_aProps.aComponent.m_xProxy.is() ? m_aProps.aComponent.m_xProxy->queryAggregation(_rType) : aReturn);
+}
+
+void SAL_CALL OFixedLine::dispose()
+{
+ FixedLinePropertySet::dispose();
+ cppu::WeakComponentImplHelperBase::dispose();
+}
+
+OUString OFixedLine::getImplementationName_Static( )
+{
+ return "com.sun.star.comp.report.OFixedLine";
+}
+
+
+OUString SAL_CALL OFixedLine::getImplementationName( )
+{
+ return getImplementationName_Static();
+}
+
+uno::Sequence< OUString > OFixedLine::getSupportedServiceNames_Static( )
+{
+ uno::Sequence< OUString > aServices { SERVICE_FIXEDLINE };
+
+ return aServices;
+}
+
+uno::Reference< uno::XInterface > OFixedLine::create(uno::Reference< uno::XComponentContext > const & xContext)
+{
+ return *(new OFixedLine(xContext));
+}
+
+
+uno::Sequence< OUString > SAL_CALL OFixedLine::getSupportedServiceNames( )
+{
+ return getSupportedServiceNames_Static();
+}
+
+sal_Bool SAL_CALL OFixedLine::supportsService(const OUString& ServiceName)
+{
+ return cppu::supportsService(this, ServiceName);
+}
+
+// XReportComponent
+REPORTCOMPONENT_IMPL3(OFixedLine,m_aProps.aComponent)
+REPORTCOMPONENT_NOMASTERDETAIL(OFixedLine)
+
+::sal_Int16 SAL_CALL OFixedLine::getControlBorder( )
+{
+ throw beans::UnknownPropertyException();
+}
+
+void SAL_CALL OFixedLine::setControlBorder( ::sal_Int16 /*_border*/ )
+{
+ throw beans::UnknownPropertyException();
+}
+
+::sal_Int32 SAL_CALL OFixedLine::getControlBorderColor()
+{
+ throw beans::UnknownPropertyException();
+}
+
+void SAL_CALL OFixedLine::setControlBorderColor( ::sal_Int32 /*_bordercolor*/ )
+{
+ throw beans::UnknownPropertyException();
+}
+
+uno::Reference< beans::XPropertySetInfo > SAL_CALL OFixedLine::getPropertySetInfo( )
+{
+ return FixedLinePropertySet::getPropertySetInfo();
+}
+
+void SAL_CALL OFixedLine::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
+{
+ FixedLinePropertySet::setPropertyValue( aPropertyName, aValue );
+}
+
+uno::Any SAL_CALL OFixedLine::getPropertyValue( const OUString& PropertyName )
+{
+ return FixedLinePropertySet::getPropertyValue( PropertyName);
+}
+
+void SAL_CALL OFixedLine::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener )
+{
+ FixedLinePropertySet::addPropertyChangeListener( aPropertyName, xListener );
+}
+
+void SAL_CALL OFixedLine::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener )
+{
+ FixedLinePropertySet::removePropertyChangeListener( aPropertyName, aListener );
+}
+
+void SAL_CALL OFixedLine::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+{
+ FixedLinePropertySet::addVetoableChangeListener( PropertyName, aListener );
+}
+
+void SAL_CALL OFixedLine::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+{
+ FixedLinePropertySet::removeVetoableChangeListener( PropertyName, aListener );
+}
+
+// XReportControlModel
+OUString SAL_CALL OFixedLine::getDataField()
+{
+ throw beans::UnknownPropertyException();
+}
+
+void SAL_CALL OFixedLine::setDataField( const OUString& /*_datafield*/ )
+{
+ throw beans::UnknownPropertyException();
+}
+
+::sal_Int32 SAL_CALL OFixedLine::getControlBackground()
+{
+ throw beans::UnknownPropertyException();
+}
+
+void SAL_CALL OFixedLine::setControlBackground( ::sal_Int32 /*_backgroundcolor*/ )
+{
+ throw beans::UnknownPropertyException();
+}
+
+sal_Bool SAL_CALL OFixedLine::getControlBackgroundTransparent()
+{
+ throw beans::UnknownPropertyException();
+}
+
+void SAL_CALL OFixedLine::setControlBackgroundTransparent( sal_Bool /*_controlbackgroundtransparent*/ )
+{
+ throw beans::UnknownPropertyException();
+}
+
+sal_Bool SAL_CALL OFixedLine::getPrintWhenGroupChange()
+{
+ throw beans::UnknownPropertyException();
+}
+
+void SAL_CALL OFixedLine::setPrintWhenGroupChange( sal_Bool /*_printwhengroupchange*/ )
+{
+ throw beans::UnknownPropertyException();
+}
+
+OUString SAL_CALL OFixedLine::getConditionalPrintExpression()
+{
+ throw beans::UnknownPropertyException();
+}
+
+void SAL_CALL OFixedLine::setConditionalPrintExpression( const OUString& /*_conditionalprintexpression*/ )
+{
+ throw beans::UnknownPropertyException();
+}
+
+// XCloneable
+uno::Reference< util::XCloneable > SAL_CALL OFixedLine::createClone( )
+{
+ uno::Reference< report::XReportComponent> xSource = this;
+ uno::Reference< report::XFixedLine> xSet(cloneObject(xSource,m_aProps.aComponent.m_xFactory,SERVICE_FIXEDLINE),uno::UNO_QUERY_THROW);
+ return xSet;
+}
+
+
+// XFixedLine
+
+::sal_Int32 SAL_CALL OFixedLine::getOrientation()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_nOrientation;
+}
+
+void SAL_CALL OFixedLine::setOrientation( ::sal_Int32 _orientation )
+{
+ set(PROPERTY_ORIENTATION,_orientation,m_nOrientation);
+}
+
+drawing::LineStyle SAL_CALL OFixedLine::getLineStyle()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_LineStyle;
+}
+
+void SAL_CALL OFixedLine::setLineStyle( drawing::LineStyle _linestyle )
+{
+ set(PROPERTY_LINESTYLE,_linestyle,m_LineStyle);
+}
+
+drawing::LineDash SAL_CALL OFixedLine::getLineDash()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_LineDash;
+}
+
+void SAL_CALL OFixedLine::setLineDash( const drawing::LineDash& _linedash )
+{
+ set(PROPERTY_LINEDASH,_linedash,m_LineDash);
+}
+
+::sal_Int32 SAL_CALL OFixedLine::getLineColor()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_LineColor;
+}
+
+void SAL_CALL OFixedLine::setLineColor( ::sal_Int32 _linecolor )
+{
+ set(PROPERTY_LINECOLOR,_linecolor,m_LineColor);
+}
+
+::sal_Int16 SAL_CALL OFixedLine::getLineTransparence()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_LineTransparence;
+}
+
+void SAL_CALL OFixedLine::setLineTransparence( ::sal_Int16 _linetransparence )
+{
+ set(PROPERTY_LINETRANSPARENCE,_linetransparence,m_LineTransparence);
+}
+
+::sal_Int32 SAL_CALL OFixedLine::getLineWidth()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_LineWidth;
+}
+
+void SAL_CALL OFixedLine::setLineWidth( ::sal_Int32 _linewidth )
+{
+ set(PROPERTY_LINEWIDTH,_linewidth,m_LineWidth);
+}
+
+
+// XChild
+uno::Reference< uno::XInterface > SAL_CALL OFixedLine::getParent( )
+{
+ return OShapeHelper::getParent(this);
+}
+
+void SAL_CALL OFixedLine::setParent( const uno::Reference< uno::XInterface >& Parent )
+{
+ OShapeHelper::setParent(Parent,this);
+}
+
+uno::Reference< report::XFormatCondition > SAL_CALL OFixedLine::createFormatCondition( )
+{
+ return new OFormatCondition(m_aProps.aComponent.m_xContext);
+}
+
+// XContainer
+void SAL_CALL OFixedLine::addContainerListener( const uno::Reference< container::XContainerListener >& xListener )
+{
+ m_aProps.addContainerListener(xListener);
+}
+
+void SAL_CALL OFixedLine::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener )
+{
+ m_aProps.removeContainerListener(xListener);
+}
+
+// XElementAccess
+uno::Type SAL_CALL OFixedLine::getElementType( )
+{
+ return cppu::UnoType<report::XFormatCondition>::get();
+}
+
+sal_Bool SAL_CALL OFixedLine::hasElements( )
+{
+ return m_aProps.hasElements();
+}
+
+// XIndexContainer
+void SAL_CALL OFixedLine::insertByIndex( ::sal_Int32 Index, const uno::Any& Element )
+{
+ m_aProps.insertByIndex(Index,Element);
+}
+
+void SAL_CALL OFixedLine::removeByIndex( ::sal_Int32 Index )
+{
+ m_aProps.removeByIndex(Index);
+}
+
+// XIndexReplace
+void SAL_CALL OFixedLine::replaceByIndex( ::sal_Int32 Index, const uno::Any& Element )
+{
+ m_aProps.replaceByIndex(Index,Element);
+}
+
+// XIndexAccess
+::sal_Int32 SAL_CALL OFixedLine::getCount( )
+{
+ return m_aProps.getCount();
+}
+
+uno::Any SAL_CALL OFixedLine::getByIndex( ::sal_Int32 Index )
+{
+ return m_aProps.getByIndex( Index );
+}
+
+// XShape
+awt::Point SAL_CALL OFixedLine::getPosition( )
+{
+ return OShapeHelper::getPosition(this);
+}
+
+void SAL_CALL OFixedLine::setPosition( const awt::Point& aPosition )
+{
+ OShapeHelper::setPosition(aPosition,this);
+}
+
+awt::Size SAL_CALL OFixedLine::getSize( )
+{
+ return OShapeHelper::getSize(this);
+}
+
+void SAL_CALL OFixedLine::setSize( const awt::Size& aSize )
+{
+ if ( aSize.Width < MIN_WIDTH && m_nOrientation == 1 )
+ throw beans::PropertyVetoException("Too small width for FixedLine; minimum is " + OUString::number(MIN_WIDTH) + "0 micrometer", static_cast<cppu::OWeakObject*>(this));
+ else if ( aSize.Height < MIN_HEIGHT && m_nOrientation == 0 )
+ throw beans::PropertyVetoException("Too small height for FixedLine; minimum is " + OUString::number(MIN_HEIGHT) + "0 micrometer", static_cast<cppu::OWeakObject*>(this));
+ OShapeHelper::setSize(aSize,this);
+}
+
+// XShapeDescriptor
+OUString SAL_CALL OFixedLine::getShapeType( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if ( m_aProps.aComponent.m_xShape.is() )
+ return m_aProps.aComponent.m_xShape->getShapeType();
+ return "com.sun.star.drawing.ControlShape";
+}
+
+OUString SAL_CALL OFixedLine::getHyperLinkURL()
+{
+ throw beans::UnknownPropertyException();
+}
+void SAL_CALL OFixedLine::setHyperLinkURL(const OUString & /*the_value*/)
+{
+ throw beans::UnknownPropertyException();
+}
+OUString SAL_CALL OFixedLine::getHyperLinkTarget()
+{
+ throw beans::UnknownPropertyException();
+}
+void SAL_CALL OFixedLine::setHyperLinkTarget(const OUString & /*the_value*/)
+{
+ throw beans::UnknownPropertyException();
+}
+OUString SAL_CALL OFixedLine::getHyperLinkName()
+{
+ throw beans::UnknownPropertyException();
+}
+void SAL_CALL OFixedLine::setHyperLinkName(const OUString & /*the_value*/)
+{
+ throw beans::UnknownPropertyException();
+}
+
+NO_REPORTCONTROLFORMAT_IMPL(OFixedLine)
+
+sal_Bool SAL_CALL OFixedLine::getPrintRepeatedValues()
+{
+ throw beans::UnknownPropertyException();
+}
+void SAL_CALL OFixedLine::setPrintRepeatedValues( sal_Bool /*_printrepeatedvalues*/ )
+{
+ throw beans::UnknownPropertyException();
+}
+
+
+} // namespace reportdesign
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/reportdesign/source/core/api/FixedText.cxx b/reportdesign/source/core/api/FixedText.cxx
new file mode 100644
index 000000000..f8c7bef51
--- /dev/null
+++ b/reportdesign/source/core/api/FixedText.cxx
@@ -0,0 +1,323 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#include <FixedText.hxx>
+#include <strings.hxx>
+#include <strings.hrc>
+#include <core_resource.hxx>
+#include <Tools.hxx>
+#include <tools/color.hxx>
+#include <cppuhelper/supportsservice.hxx>
+#include <FormatCondition.hxx>
+#include <ReportHelperImpl.hxx>
+
+namespace reportdesign
+{
+
+ using namespace com::sun::star;
+
+static uno::Sequence< OUString > lcl_getFixedTextOptionals()
+{
+ OUString pProps[] = { OUString(PROPERTY_DATAFIELD),OUString(PROPERTY_MASTERFIELDS),OUString(PROPERTY_DETAILFIELDS) };
+ return uno::Sequence< OUString >(pProps,SAL_N_ELEMENTS(pProps));
+}
+
+OFixedText::OFixedText(uno::Reference< uno::XComponentContext > const & _xContext)
+:FixedTextBase(m_aMutex)
+,FixedTextPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,lcl_getFixedTextOptionals())
+,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext)
+{
+ m_aProps.aComponent.m_sName = RptResId(RID_STR_FIXEDTEXT);
+ m_aProps.aComponent.m_nBorder = 0; // no border
+}
+
+OFixedText::OFixedText(uno::Reference< uno::XComponentContext > const & _xContext
+ ,const uno::Reference< lang::XMultiServiceFactory>& _xFactory
+ ,uno::Reference< drawing::XShape >& _xShape)
+:FixedTextBase(m_aMutex)
+,FixedTextPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,lcl_getFixedTextOptionals())
+,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext)
+{
+ m_aProps.aComponent.m_sName = RptResId(RID_STR_FIXEDTEXT);
+ m_aProps.aComponent.m_nBorder = 0; // no border
+ m_aProps.aComponent.m_xFactory = _xFactory;
+ osl_atomic_increment( &m_refCount );
+ {
+ m_aProps.aComponent.setShape(_xShape,this,m_refCount);
+ }
+ osl_atomic_decrement( &m_refCount );
+}
+
+OFixedText::~OFixedText()
+{
+}
+
+IMPLEMENT_FORWARD_REFCOUNT( OFixedText, FixedTextBase )
+
+uno::Any SAL_CALL OFixedText::queryInterface( const uno::Type& _rType )
+{
+ uno::Any aReturn = FixedTextBase::queryInterface(_rType);
+ if ( !aReturn.hasValue() )
+ aReturn = FixedTextPropertySet::queryInterface(_rType);
+ if ( !aReturn.hasValue() && OReportControlModel::isInterfaceForbidden(_rType) )
+ return aReturn;
+
+ return aReturn.hasValue() ? aReturn : (m_aProps.aComponent.m_xProxy.is() ? m_aProps.aComponent.m_xProxy->queryAggregation(_rType) : aReturn);
+}
+
+
+void SAL_CALL OFixedText::dispose()
+{
+ FixedTextPropertySet::dispose();
+ cppu::WeakComponentImplHelperBase::dispose();
+ uno::Reference< report::XFixedText> xHoldAlive = this;
+}
+
+OUString OFixedText::getImplementationName_Static( )
+{
+ return "com.sun.star.comp.report.OFixedText";
+}
+
+
+OUString SAL_CALL OFixedText::getImplementationName( )
+{
+ return getImplementationName_Static();
+}
+
+uno::Sequence< OUString > OFixedText::getSupportedServiceNames_Static( )
+{
+ uno::Sequence< OUString > aServices { SERVICE_FIXEDTEXT };
+
+ return aServices;
+}
+
+uno::Reference< uno::XInterface > OFixedText::create(uno::Reference< uno::XComponentContext > const & xContext)
+{
+ return *(new OFixedText(xContext));
+}
+
+
+uno::Sequence< OUString > SAL_CALL OFixedText::getSupportedServiceNames( )
+{
+ return getSupportedServiceNames_Static();
+}
+
+sal_Bool SAL_CALL OFixedText::supportsService(const OUString& ServiceName)
+{
+ return cppu::supportsService(this, ServiceName);
+}
+
+// XReportComponent
+REPORTCOMPONENT_IMPL(OFixedText,m_aProps.aComponent)
+REPORTCOMPONENT_IMPL2(OFixedText,m_aProps.aComponent)
+REPORTCOMPONENT_NOMASTERDETAIL(OFixedText)
+REPORTCONTROLFORMAT_IMPL(OFixedText,m_aProps.aFormatProperties)
+
+uno::Reference< beans::XPropertySetInfo > SAL_CALL OFixedText::getPropertySetInfo( )
+{
+ return FixedTextPropertySet::getPropertySetInfo();
+}
+
+void SAL_CALL OFixedText::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
+{
+ FixedTextPropertySet::setPropertyValue( aPropertyName, aValue );
+}
+
+uno::Any SAL_CALL OFixedText::getPropertyValue( const OUString& PropertyName )
+{
+ return FixedTextPropertySet::getPropertyValue( PropertyName);
+}
+
+void SAL_CALL OFixedText::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener )
+{
+ FixedTextPropertySet::addPropertyChangeListener( aPropertyName, xListener );
+}
+
+void SAL_CALL OFixedText::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener )
+{
+ FixedTextPropertySet::removePropertyChangeListener( aPropertyName, aListener );
+}
+
+void SAL_CALL OFixedText::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+{
+ FixedTextPropertySet::addVetoableChangeListener( PropertyName, aListener );
+}
+
+void SAL_CALL OFixedText::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+{
+ FixedTextPropertySet::removeVetoableChangeListener( PropertyName, aListener );
+}
+
+// XReportControlModel
+OUString SAL_CALL OFixedText::getDataField()
+{
+ throw beans::UnknownPropertyException();
+}
+
+void SAL_CALL OFixedText::setDataField( const OUString& /*_datafield*/ )
+{
+ throw beans::UnknownPropertyException();
+}
+
+
+sal_Bool SAL_CALL OFixedText::getPrintWhenGroupChange()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aProps.bPrintWhenGroupChange;
+}
+
+void SAL_CALL OFixedText::setPrintWhenGroupChange( sal_Bool _printwhengroupchange )
+{
+ set(PROPERTY_PRINTWHENGROUPCHANGE,_printwhengroupchange,m_aProps.bPrintWhenGroupChange);
+}
+
+OUString SAL_CALL OFixedText::getConditionalPrintExpression()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aProps.aConditionalPrintExpression;
+}
+
+void SAL_CALL OFixedText::setConditionalPrintExpression( const OUString& _conditionalprintexpression )
+{
+ set(PROPERTY_CONDITIONALPRINTEXPRESSION,_conditionalprintexpression,m_aProps.aConditionalPrintExpression);
+}
+
+
+// XCloneable
+uno::Reference< util::XCloneable > SAL_CALL OFixedText::createClone( )
+{
+ uno::Reference< report::XReportComponent> xSource = this;
+ uno::Reference< report::XFixedText> xSet(cloneObject(xSource,m_aProps.aComponent.m_xFactory,SERVICE_FIXEDTEXT),uno::UNO_QUERY_THROW);
+ return xSet;
+}
+
+
+// XFixedText
+OUString SAL_CALL OFixedText::getLabel()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_sLabel;
+}
+
+void SAL_CALL OFixedText::setLabel( const OUString& _label )
+{
+ set(PROPERTY_LABEL,_label,m_sLabel);
+}
+
+// XChild
+uno::Reference< uno::XInterface > SAL_CALL OFixedText::getParent( )
+{
+ return OShapeHelper::getParent(this);
+}
+
+void SAL_CALL OFixedText::setParent( const uno::Reference< uno::XInterface >& Parent )
+{
+ OShapeHelper::setParent(Parent,this);
+}
+
+uno::Reference< report::XFormatCondition > SAL_CALL OFixedText::createFormatCondition( )
+{
+ return new OFormatCondition(m_aProps.aComponent.m_xContext);
+}
+
+// XContainer
+void SAL_CALL OFixedText::addContainerListener( const uno::Reference< container::XContainerListener >& xListener )
+{
+ m_aProps.addContainerListener(xListener);
+}
+
+void SAL_CALL OFixedText::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener )
+{
+ m_aProps.removeContainerListener(xListener);
+}
+
+// XElementAccess
+uno::Type SAL_CALL OFixedText::getElementType( )
+{
+ return cppu::UnoType<report::XFormatCondition>::get();
+}
+
+sal_Bool SAL_CALL OFixedText::hasElements( )
+{
+ return m_aProps.hasElements();
+}
+
+// XIndexContainer
+void SAL_CALL OFixedText::insertByIndex( ::sal_Int32 Index, const uno::Any& Element )
+{
+ m_aProps.insertByIndex(Index,Element);
+}
+
+void SAL_CALL OFixedText::removeByIndex( ::sal_Int32 Index )
+{
+ m_aProps.removeByIndex(Index);
+}
+
+// XIndexReplace
+void SAL_CALL OFixedText::replaceByIndex( ::sal_Int32 Index, const uno::Any& Element )
+{
+ m_aProps.replaceByIndex(Index,Element);
+}
+
+// XIndexAccess
+::sal_Int32 SAL_CALL OFixedText::getCount( )
+{
+ return m_aProps.getCount();
+}
+
+uno::Any SAL_CALL OFixedText::getByIndex( ::sal_Int32 Index )
+{
+ return m_aProps.getByIndex( Index );
+}
+
+// XShape
+awt::Point SAL_CALL OFixedText::getPosition( )
+{
+ return OShapeHelper::getPosition(this);
+}
+
+void SAL_CALL OFixedText::setPosition( const awt::Point& aPosition )
+{
+ OShapeHelper::setPosition(aPosition,this);
+}
+
+awt::Size SAL_CALL OFixedText::getSize( )
+{
+ return OShapeHelper::getSize(this);
+}
+
+void SAL_CALL OFixedText::setSize( const awt::Size& aSize )
+{
+ OShapeHelper::setSize(aSize,this);
+}
+
+
+// XShapeDescriptor
+OUString SAL_CALL OFixedText::getShapeType( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if ( m_aProps.aComponent.m_xShape.is() )
+ return m_aProps.aComponent.m_xShape->getShapeType();
+ return "com.sun.star.drawing.ControlShape";
+}
+
+
+} // namespace reportdesign
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/reportdesign/source/core/api/FormatCondition.cxx b/reportdesign/source/core/api/FormatCondition.cxx
new file mode 100644
index 000000000..04558f710
--- /dev/null
+++ b/reportdesign/source/core/api/FormatCondition.cxx
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#include <FormatCondition.hxx>
+#include <strings.hxx>
+#include <tools/color.hxx>
+#include <cppuhelper/supportsservice.hxx>
+#include <ReportHelperImpl.hxx>
+
+namespace reportdesign
+{
+
+ using namespace com::sun::star;
+
+uno::Reference< uno::XInterface > OFormatCondition::create(uno::Reference< uno::XComponentContext > const & xContext)
+{
+ return *(new OFormatCondition(xContext));
+}
+
+
+OFormatCondition::OFormatCondition(uno::Reference< uno::XComponentContext > const & _xContext)
+:FormatConditionBase(m_aMutex)
+,FormatConditionPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,uno::Sequence< OUString >())
+,m_bEnabled(true)
+{
+}
+
+OFormatCondition::~OFormatCondition()
+{
+}
+
+IMPLEMENT_FORWARD_XINTERFACE2(OFormatCondition,FormatConditionBase,FormatConditionPropertySet)
+
+void SAL_CALL OFormatCondition::dispose()
+{
+ FormatConditionPropertySet::dispose();
+ cppu::WeakComponentImplHelperBase::dispose();
+}
+
+OUString OFormatCondition::getImplementationName_Static( )
+{
+ return "com.sun.star.comp.report.OFormatCondition";
+}
+
+
+OUString SAL_CALL OFormatCondition::getImplementationName( )
+{
+ return getImplementationName_Static();
+}
+
+uno::Sequence< OUString > OFormatCondition::getSupportedServiceNames_Static( )
+{
+ uno::Sequence< OUString > aServices { SERVICE_FORMATCONDITION };
+
+ return aServices;
+}
+
+uno::Sequence< OUString > SAL_CALL OFormatCondition::getSupportedServiceNames( )
+{
+ return getSupportedServiceNames_Static();
+}
+
+sal_Bool SAL_CALL OFormatCondition::supportsService(const OUString& ServiceName)
+{
+ return cppu::supportsService(this, ServiceName);
+}
+
+uno::Reference< beans::XPropertySetInfo > SAL_CALL OFormatCondition::getPropertySetInfo( )
+{
+ return FormatConditionPropertySet::getPropertySetInfo();
+}
+
+void SAL_CALL OFormatCondition::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
+{
+ FormatConditionPropertySet::setPropertyValue( aPropertyName, aValue );
+}
+
+uno::Any SAL_CALL OFormatCondition::getPropertyValue( const OUString& PropertyName )
+{
+ return FormatConditionPropertySet::getPropertyValue( PropertyName);
+}
+
+void SAL_CALL OFormatCondition::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener )
+{
+ FormatConditionPropertySet::addPropertyChangeListener( aPropertyName, xListener );
+}
+
+void SAL_CALL OFormatCondition::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener )
+{
+ FormatConditionPropertySet::removePropertyChangeListener( aPropertyName, aListener );
+}
+
+void SAL_CALL OFormatCondition::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+{
+ FormatConditionPropertySet::addVetoableChangeListener( PropertyName, aListener );
+}
+
+void SAL_CALL OFormatCondition::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+{
+ FormatConditionPropertySet::removeVetoableChangeListener( PropertyName, aListener );
+}
+
+// XFormatCondition
+sal_Bool SAL_CALL OFormatCondition::getEnabled()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_bEnabled;
+}
+
+void SAL_CALL OFormatCondition::setEnabled( sal_Bool _enabled )
+{
+ set(PROPERTY_ENABLED,_enabled,m_bEnabled);
+}
+
+OUString SAL_CALL OFormatCondition::getFormula()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_sFormula;
+}
+
+void SAL_CALL OFormatCondition::setFormula( const OUString& _formula )
+{
+ set(PROPERTY_FORMULA,_formula,m_sFormula);
+}
+
+// XReportControlFormat
+REPORTCONTROLFORMAT_IMPL(OFormatCondition,m_aFormatProperties)
+
+} // namespace reportdesign
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/reportdesign/source/core/api/FormattedField.cxx b/reportdesign/source/core/api/FormattedField.cxx
new file mode 100644
index 000000000..c8bcad859
--- /dev/null
+++ b/reportdesign/source/core/api/FormattedField.cxx
@@ -0,0 +1,361 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#include <FormattedField.hxx>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <strings.hxx>
+#include <strings.hrc>
+#include <core_resource.hxx>
+#include <tools/color.hxx>
+#include <connectivity/dbtools.hxx>
+#include <comphelper/property.hxx>
+#include <cppuhelper/supportsservice.hxx>
+#include <Tools.hxx>
+#include <FormatCondition.hxx>
+#include <ReportHelperImpl.hxx>
+
+namespace reportdesign
+{
+
+ using namespace com::sun::star;
+ using namespace comphelper;
+
+uno::Reference< uno::XInterface > OFormattedField::create(uno::Reference< uno::XComponentContext > const & xContext)
+{
+ return *(new OFormattedField(xContext));
+}
+
+static uno::Sequence< OUString > lcl_getFormattedFieldOptionals()
+{
+ OUString pProps[] = { OUString(PROPERTY_MASTERFIELDS),OUString(PROPERTY_DETAILFIELDS) };
+ return uno::Sequence< OUString >(pProps,SAL_N_ELEMENTS(pProps));
+}
+
+OFormattedField::OFormattedField(uno::Reference< uno::XComponentContext > const & _xContext)
+:FormattedFieldBase(m_aMutex)
+,FormattedFieldPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,lcl_getFormattedFieldOptionals())
+,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext)
+,m_nFormatKey(0)
+{
+ m_aProps.aComponent.m_sName = RptResId(RID_STR_FORMATTEDFIELD);
+}
+
+OFormattedField::OFormattedField(uno::Reference< uno::XComponentContext > const & _xContext
+ ,const uno::Reference< lang::XMultiServiceFactory>& _xFactory
+ ,uno::Reference< drawing::XShape >& _xShape)
+:FormattedFieldBase(m_aMutex)
+,FormattedFieldPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,lcl_getFormattedFieldOptionals())
+,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext)
+,m_nFormatKey(0)
+{
+ m_aProps.aComponent.m_sName = RptResId(RID_STR_FORMATTEDFIELD);
+ m_aProps.aComponent.m_xFactory = _xFactory;
+ osl_atomic_increment( &m_refCount );
+ {
+ m_aProps.aComponent.setShape(_xShape,this,m_refCount);
+ }
+ osl_atomic_decrement( &m_refCount );
+}
+
+OFormattedField::~OFormattedField()
+{
+}
+
+IMPLEMENT_FORWARD_REFCOUNT( OFormattedField, FormattedFieldBase )
+
+uno::Any SAL_CALL OFormattedField::queryInterface( const uno::Type& _rType )
+{
+ uno::Any aReturn = FormattedFieldBase::queryInterface(_rType);
+ if ( !aReturn.hasValue() )
+ aReturn = FormattedFieldPropertySet::queryInterface(_rType);
+ if ( !aReturn.hasValue() && OReportControlModel::isInterfaceForbidden(_rType) )
+ return aReturn;
+
+ return aReturn.hasValue() ? aReturn : (m_aProps.aComponent.m_xProxy.is() ? m_aProps.aComponent.m_xProxy->queryAggregation(_rType) : aReturn);
+}
+
+
+void SAL_CALL OFormattedField::dispose()
+{
+ FormattedFieldPropertySet::dispose();
+ cppu::WeakComponentImplHelperBase::dispose();
+ m_xFormatsSupplier.clear();
+}
+
+OUString OFormattedField::getImplementationName_Static( )
+{
+ return "com.sun.star.comp.report.OFormattedField";
+}
+
+
+OUString SAL_CALL OFormattedField::getImplementationName( )
+{
+ return getImplementationName_Static();
+}
+
+uno::Sequence< OUString > OFormattedField::getSupportedServiceNames_Static( )
+{
+ return { SERVICE_FORMATTEDFIELD, "com.sun.star.awt.UnoControlFormattedFieldModel" };
+}
+
+uno::Sequence< OUString > SAL_CALL OFormattedField::getSupportedServiceNames( )
+{
+ return getSupportedServiceNames_Static();
+}
+
+sal_Bool SAL_CALL OFormattedField::supportsService(const OUString& ServiceName)
+{
+ return cppu::supportsService(this, ServiceName);
+}
+
+// XReportComponent
+REPORTCOMPONENT_IMPL(OFormattedField,m_aProps.aComponent)
+REPORTCOMPONENT_IMPL2(OFormattedField,m_aProps.aComponent)
+REPORTCOMPONENT_NOMASTERDETAIL(OFormattedField)
+REPORTCONTROLFORMAT_IMPL(OFormattedField,m_aProps.aFormatProperties)
+
+
+uno::Reference< beans::XPropertySetInfo > SAL_CALL OFormattedField::getPropertySetInfo( )
+{
+ return FormattedFieldPropertySet::getPropertySetInfo();
+}
+
+void SAL_CALL OFormattedField::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
+{
+ // special case here /// TODO check
+ if ( !aValue.hasValue() && aPropertyName == PROPERTY_FORMATKEY )
+ m_nFormatKey = 0;
+ else
+ FormattedFieldPropertySet::setPropertyValue( aPropertyName, aValue );
+}
+
+uno::Any SAL_CALL OFormattedField::getPropertyValue( const OUString& PropertyName )
+{
+ return FormattedFieldPropertySet::getPropertyValue( PropertyName);
+}
+
+void SAL_CALL OFormattedField::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener )
+{
+ FormattedFieldPropertySet::addPropertyChangeListener( aPropertyName, xListener );
+}
+
+void SAL_CALL OFormattedField::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener )
+{
+ FormattedFieldPropertySet::removePropertyChangeListener( aPropertyName, aListener );
+}
+
+void SAL_CALL OFormattedField::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+{
+ FormattedFieldPropertySet::addVetoableChangeListener( PropertyName, aListener );
+}
+
+void SAL_CALL OFormattedField::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+{
+ FormattedFieldPropertySet::removeVetoableChangeListener( PropertyName, aListener );
+}
+
+// XReportControlModel
+OUString SAL_CALL OFormattedField::getDataField()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aProps.aDataField;
+}
+
+void SAL_CALL OFormattedField::setDataField( const OUString& _datafield )
+{
+ set(PROPERTY_DATAFIELD,_datafield,m_aProps.aDataField);
+}
+
+sal_Bool SAL_CALL OFormattedField::getPrintWhenGroupChange()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aProps.bPrintWhenGroupChange;
+}
+
+void SAL_CALL OFormattedField::setPrintWhenGroupChange( sal_Bool _printwhengroupchange )
+{
+ set(PROPERTY_PRINTWHENGROUPCHANGE,_printwhengroupchange,m_aProps.bPrintWhenGroupChange);
+}
+
+OUString SAL_CALL OFormattedField::getConditionalPrintExpression()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aProps.aConditionalPrintExpression;
+}
+
+void SAL_CALL OFormattedField::setConditionalPrintExpression( const OUString& _conditionalprintexpression )
+{
+ set(PROPERTY_CONDITIONALPRINTEXPRESSION,_conditionalprintexpression,m_aProps.aConditionalPrintExpression);
+}
+
+
+// XCloneable
+uno::Reference< util::XCloneable > SAL_CALL OFormattedField::createClone( )
+{
+ uno::Reference< report::XReportComponent> xSource = this;
+ uno::Reference< report::XFormattedField> xSet(cloneObject(xSource,m_aProps.aComponent.m_xFactory,SERVICE_FORMATTEDFIELD),uno::UNO_QUERY_THROW);
+
+ sal_Int32 i = 0;
+ for (const auto& rxFormatCondition : m_aProps.m_aFormatConditions)
+ {
+ uno::Reference< report::XFormatCondition > xCond = xSet->createFormatCondition();
+ ::comphelper::copyProperties(rxFormatCondition, xCond);
+ xSet->insertByIndex(i,uno::Any(xCond));
+ ++i;
+ }
+ return xSet;
+}
+
+// XFormattedField
+
+::sal_Int32 SAL_CALL OFormattedField::getFormatKey()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_nFormatKey;
+}
+
+void SAL_CALL OFormattedField::setFormatKey(::sal_Int32 _formatkey)
+{
+ set(PROPERTY_FORMATKEY,_formatkey,m_nFormatKey);
+}
+
+uno::Reference< util::XNumberFormatsSupplier > SAL_CALL OFormattedField::getFormatsSupplier()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if ( !m_xFormatsSupplier.is() )
+ {
+ uno::Reference< report::XSection> xSection = getSection();
+ if ( xSection.is() )
+ m_xFormatsSupplier.set(xSection->getReportDefinition(),uno::UNO_QUERY);
+ if ( !m_xFormatsSupplier.is() )
+ {
+ uno::Reference< beans::XPropertySet> xProp(::dbtools::findDataSource(getParent()),uno::UNO_QUERY);
+ if ( xProp.is() )
+ m_xFormatsSupplier.set(xProp->getPropertyValue("NumberFormatsSupplier"),uno::UNO_QUERY);
+ }
+ }
+ return m_xFormatsSupplier;
+}
+
+void SAL_CALL OFormattedField::setFormatsSupplier( const uno::Reference< util::XNumberFormatsSupplier >& _formatssupplier )
+{
+ set(PROPERTY_FORMATSSUPPLIER,_formatssupplier,m_xFormatsSupplier);
+}
+
+// XChild
+uno::Reference< uno::XInterface > SAL_CALL OFormattedField::getParent( )
+{
+ return OShapeHelper::getParent(this);
+}
+
+void SAL_CALL OFormattedField::setParent( const uno::Reference< uno::XInterface >& Parent )
+{
+ OShapeHelper::setParent(Parent,this);
+}
+
+uno::Reference< report::XFormatCondition > SAL_CALL OFormattedField::createFormatCondition( )
+{
+ return new OFormatCondition(m_aProps.aComponent.m_xContext);
+}
+
+// XContainer
+void SAL_CALL OFormattedField::addContainerListener( const uno::Reference< container::XContainerListener >& xListener )
+{
+ m_aProps.addContainerListener(xListener);
+}
+
+void SAL_CALL OFormattedField::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener )
+{
+ m_aProps.removeContainerListener(xListener);
+}
+
+// XElementAccess
+uno::Type SAL_CALL OFormattedField::getElementType( )
+{
+ return cppu::UnoType<report::XFormatCondition>::get();
+}
+
+sal_Bool SAL_CALL OFormattedField::hasElements( )
+{
+ return m_aProps.hasElements();
+}
+
+// XIndexContainer
+void SAL_CALL OFormattedField::insertByIndex( ::sal_Int32 Index, const uno::Any& Element )
+{
+ m_aProps.insertByIndex(Index,Element);
+}
+
+void SAL_CALL OFormattedField::removeByIndex( ::sal_Int32 Index )
+{
+ m_aProps.removeByIndex(Index);
+}
+
+// XIndexReplace
+void SAL_CALL OFormattedField::replaceByIndex( ::sal_Int32 Index, const uno::Any& Element )
+{
+ m_aProps.replaceByIndex(Index,Element);
+}
+
+// XIndexAccess
+::sal_Int32 SAL_CALL OFormattedField::getCount( )
+{
+ return m_aProps.getCount();
+}
+
+uno::Any SAL_CALL OFormattedField::getByIndex( ::sal_Int32 Index )
+{
+ return m_aProps.getByIndex( Index );
+}
+
+// XShape
+awt::Point SAL_CALL OFormattedField::getPosition( )
+{
+ return OShapeHelper::getPosition(this);
+}
+
+void SAL_CALL OFormattedField::setPosition( const awt::Point& aPosition )
+{
+ OShapeHelper::setPosition(aPosition,this);
+}
+
+awt::Size SAL_CALL OFormattedField::getSize( )
+{
+ return OShapeHelper::getSize(this);
+}
+
+void SAL_CALL OFormattedField::setSize( const awt::Size& aSize )
+{
+ OShapeHelper::setSize(aSize,this);
+}
+
+
+// XShapeDescriptor
+OUString SAL_CALL OFormattedField::getShapeType( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if ( m_aProps.aComponent.m_xShape.is() )
+ return m_aProps.aComponent.m_xShape->getShapeType();
+ return "com.sun.star.drawing.ControlShape";
+}
+
+
+} // namespace reportdesign
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/reportdesign/source/core/api/Function.cxx b/reportdesign/source/core/api/Function.cxx
new file mode 100644
index 000000000..55150a992
--- /dev/null
+++ b/reportdesign/source/core/api/Function.cxx
@@ -0,0 +1,201 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#include <Function.hxx>
+#include <strings.hxx>
+#include <cppuhelper/supportsservice.hxx>
+
+namespace reportdesign
+{
+
+ using namespace com::sun::star;
+
+uno::Reference< uno::XInterface > OFunction::create(uno::Reference< uno::XComponentContext > const & xContext)
+{
+ return *(new OFunction(xContext));
+}
+
+
+OFunction::OFunction(uno::Reference< uno::XComponentContext > const & _xContext)
+:FunctionBase(m_aMutex)
+,FunctionPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,uno::Sequence< OUString >())
+,m_bPreEvaluated(false)
+,m_bDeepTraversing(false)
+{
+ m_sInitialFormula.IsPresent = false;
+}
+
+OFunction::~OFunction()
+{
+}
+
+IMPLEMENT_FORWARD_XINTERFACE2(OFunction,FunctionBase,FunctionPropertySet)
+
+void SAL_CALL OFunction::dispose()
+{
+ FunctionPropertySet::dispose();
+ cppu::WeakComponentImplHelperBase::dispose();
+}
+
+OUString OFunction::getImplementationName_Static( )
+{
+ return "com.sun.star.comp.report.OFunction";
+}
+
+
+OUString SAL_CALL OFunction::getImplementationName( )
+{
+ return getImplementationName_Static();
+}
+
+uno::Sequence< OUString > OFunction::getSupportedServiceNames_Static( )
+{
+ uno::Sequence< OUString > aServices { SERVICE_FUNCTION };
+
+ return aServices;
+}
+
+uno::Sequence< OUString > SAL_CALL OFunction::getSupportedServiceNames( )
+{
+ return getSupportedServiceNames_Static();
+}
+
+sal_Bool SAL_CALL OFunction::supportsService(const OUString& ServiceName)
+{
+ return cppu::supportsService(this, ServiceName);
+}
+
+uno::Reference< beans::XPropertySetInfo > SAL_CALL OFunction::getPropertySetInfo( )
+{
+ return FunctionPropertySet::getPropertySetInfo();
+}
+
+void SAL_CALL OFunction::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
+{
+ FunctionPropertySet::setPropertyValue( aPropertyName, aValue );
+}
+
+uno::Any SAL_CALL OFunction::getPropertyValue( const OUString& PropertyName )
+{
+ return FunctionPropertySet::getPropertyValue( PropertyName);
+}
+
+void SAL_CALL OFunction::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener )
+{
+ FunctionPropertySet::addPropertyChangeListener( aPropertyName, xListener );
+}
+
+void SAL_CALL OFunction::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener )
+{
+ FunctionPropertySet::removePropertyChangeListener( aPropertyName, aListener );
+}
+
+void SAL_CALL OFunction::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+{
+ FunctionPropertySet::addVetoableChangeListener( PropertyName, aListener );
+}
+
+void SAL_CALL OFunction::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+{
+ FunctionPropertySet::removeVetoableChangeListener( PropertyName, aListener );
+}
+
+// report::XFunction:
+sal_Bool SAL_CALL OFunction::getPreEvaluated()
+{
+ osl::MutexGuard g(m_aMutex);
+ return m_bPreEvaluated;
+}
+
+
+void SAL_CALL OFunction::setPreEvaluated(sal_Bool the_value)
+{
+ set(PROPERTY_PREEVALUATED,the_value,m_bPreEvaluated);
+}
+
+sal_Bool SAL_CALL OFunction::getDeepTraversing()
+{
+ osl::MutexGuard g(m_aMutex);
+ return m_bDeepTraversing;
+}
+
+
+void SAL_CALL OFunction::setDeepTraversing(sal_Bool the_value)
+{
+ set(PROPERTY_DEEPTRAVERSING,the_value,m_bDeepTraversing);
+}
+
+
+OUString SAL_CALL OFunction::getName()
+{
+ osl::MutexGuard g(m_aMutex);
+ return m_sName;
+}
+
+
+void SAL_CALL OFunction::setName(const OUString & the_value)
+{
+ set(PROPERTY_NAME,the_value,m_sName);
+}
+
+OUString SAL_CALL OFunction::getFormula()
+{
+ osl::MutexGuard g(m_aMutex);
+ return m_sFormula;
+}
+
+void SAL_CALL OFunction::setFormula(const OUString & the_value)
+{
+ set(PROPERTY_FORMULA,the_value,m_sFormula);
+}
+
+beans::Optional< OUString> SAL_CALL OFunction::getInitialFormula()
+{
+ osl::MutexGuard g(m_aMutex);
+ return m_sInitialFormula;
+}
+
+void SAL_CALL OFunction::setInitialFormula(const beans::Optional< OUString> & the_value)
+{
+ set(PROPERTY_INITIALFORMULA,the_value,m_sInitialFormula);
+}
+
+// XChild
+uno::Reference< uno::XInterface > SAL_CALL OFunction::getParent( )
+{
+ osl::MutexGuard g(m_aMutex);
+ return m_xParent;
+}
+
+void SAL_CALL OFunction::setParent( const uno::Reference< uno::XInterface >& Parent )
+{
+ osl::MutexGuard g(m_aMutex);
+ if ( Parent.is() )
+ {
+ uno::Reference< report::XFunctions> xFunctions(Parent,uno::UNO_QUERY_THROW);
+ m_xParent = xFunctions;
+ }
+ else
+ m_xParent.clear();
+}
+
+
+} // namespace reportdesign
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/reportdesign/source/core/api/Functions.cxx b/reportdesign/source/core/api/Functions.cxx
new file mode 100644
index 000000000..820d3c0ea
--- /dev/null
+++ b/reportdesign/source/core/api/Functions.cxx
@@ -0,0 +1,193 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#include <Functions.hxx>
+#include <Function.hxx>
+#include <core_resource.hxx>
+#include <strings.hrc>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/lang/NoSupportException.hpp>
+#include <o3tl/safeint.hxx>
+
+namespace reportdesign
+{
+
+ using namespace com::sun::star;
+
+OFunctions::OFunctions(const uno::Reference< report::XFunctionsSupplier >& _xParent,const uno::Reference< uno::XComponentContext >& context)
+:FunctionsBase(m_aMutex)
+,m_aContainerListeners(m_aMutex)
+,m_xContext(context)
+,m_xParent(_xParent)
+{
+}
+
+// TODO: VirtualFunctionFinder: This is virtual function!
+
+OFunctions::~OFunctions()
+{
+}
+
+void SAL_CALL OFunctions::dispose()
+{
+ cppu::WeakComponentImplHelperBase::dispose();
+}
+
+// TODO: VirtualFunctionFinder: This is virtual function!
+
+void SAL_CALL OFunctions::disposing()
+{
+ for (auto& rFunction : m_aFunctions)
+ rFunction->dispose();
+ m_aFunctions.clear();
+ lang::EventObject aDisposeEvent( static_cast< ::cppu::OWeakObject* >( this ) );
+ m_aContainerListeners.disposeAndClear( aDisposeEvent );
+ m_xContext.clear();
+}
+
+// XFunctionsSupplier
+
+uno::Reference< report::XFunction > SAL_CALL OFunctions::createFunction( )
+{
+ return new OFunction(m_xContext);
+}
+
+// XIndexContainer
+void SAL_CALL OFunctions::insertByIndex( ::sal_Int32 Index, const uno::Any& aElement )
+{
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ bool bAdd = (Index == static_cast<sal_Int32>(m_aFunctions.size()));
+ if ( !bAdd )
+ checkIndex(Index);
+ uno::Reference< report::XFunction > xFunction(aElement,uno::UNO_QUERY);
+ if ( !xFunction.is() )
+ throw lang::IllegalArgumentException(RptResId(RID_STR_ARGUMENT_IS_NULL),*this,2);
+
+ if ( bAdd )
+ m_aFunctions.push_back(xFunction);
+ else
+ {
+ TFunctions::iterator aPos = m_aFunctions.begin();
+ ::std::advance(aPos,Index);
+ m_aFunctions.insert(aPos, xFunction);
+ }
+ xFunction->setParent(*this);
+ }
+ // notify our container listeners
+ container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::Any(Index), aElement, uno::Any());
+ m_aContainerListeners.notifyEach(&container::XContainerListener::elementInserted,aEvent);
+}
+
+
+void SAL_CALL OFunctions::removeByIndex( ::sal_Int32 Index )
+{
+ uno::Reference< report::XFunction > xFunction;
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ checkIndex(Index);
+ TFunctions::iterator aPos = m_aFunctions.begin();
+ ::std::advance(aPos,Index);
+ xFunction = *aPos;
+ m_aFunctions.erase(aPos);
+ xFunction->setParent(nullptr);
+ }
+ container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::Any(Index), uno::Any(xFunction), uno::Any());
+ m_aContainerListeners.notifyEach(&container::XContainerListener::elementRemoved,aEvent);
+}
+
+// XIndexReplace
+void SAL_CALL OFunctions::replaceByIndex( ::sal_Int32 Index, const uno::Any& Element )
+{
+ uno::Any aOldElement;
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ checkIndex(Index);
+ uno::Reference< report::XFunction > xFunction(Element,uno::UNO_QUERY);
+ if ( !xFunction.is() )
+ throw lang::IllegalArgumentException(RptResId(RID_STR_ARGUMENT_IS_NULL),*this,2);
+ TFunctions::iterator aPos = m_aFunctions.begin();
+ ::std::advance(aPos,Index);
+ aOldElement <<= *aPos;
+ *aPos = xFunction;
+ }
+
+ container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::Any(Index), Element, aOldElement);
+ m_aContainerListeners.notifyEach(&container::XContainerListener::elementReplaced,aEvent);
+}
+
+// XIndexAccess
+::sal_Int32 SAL_CALL OFunctions::getCount( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aFunctions.size();
+}
+
+uno::Any SAL_CALL OFunctions::getByIndex( ::sal_Int32 Index )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ checkIndex(Index);
+ TFunctions::const_iterator aPos = m_aFunctions.begin();
+ ::std::advance(aPos,Index);
+ return uno::Any(*aPos);
+}
+
+// XElementAccess
+uno::Type SAL_CALL OFunctions::getElementType( )
+{
+ return cppu::UnoType<report::XFunction>::get();
+}
+
+sal_Bool SAL_CALL OFunctions::hasElements( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return !m_aFunctions.empty();
+}
+
+// XChild
+uno::Reference< uno::XInterface > SAL_CALL OFunctions::getParent( )
+{
+ return m_xParent;
+}
+
+void SAL_CALL OFunctions::setParent( const uno::Reference< uno::XInterface >& /*Parent*/ )
+{
+ throw lang::NoSupportException();
+}
+
+// XContainer
+void SAL_CALL OFunctions::addContainerListener( const uno::Reference< container::XContainerListener >& xListener )
+{
+ m_aContainerListeners.addInterface(xListener);
+}
+
+void SAL_CALL OFunctions::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener )
+{
+ m_aContainerListeners.removeInterface(xListener);
+}
+
+void OFunctions::checkIndex(sal_Int32 _nIndex)
+{
+ if ( _nIndex < 0 || m_aFunctions.size() <= o3tl::make_unsigned(_nIndex) )
+ throw lang::IndexOutOfBoundsException();
+}
+
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/reportdesign/source/core/api/Group.cxx b/reportdesign/source/core/api/Group.cxx
new file mode 100644
index 000000000..b78e433cb
--- /dev/null
+++ b/reportdesign/source/core/api/Group.cxx
@@ -0,0 +1,321 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#include <Group.hxx>
+#include <Section.hxx>
+#include <com/sun/star/lang/NoSupportException.hpp>
+#include <com/sun/star/report/GroupOn.hpp>
+#include <com/sun/star/report/KeepTogether.hpp>
+#include <strings.hxx>
+#include <strings.hrc>
+#include <core_resource.hxx>
+#include <Tools.hxx>
+#include <cppuhelper/supportsservice.hxx>
+#include <comphelper/types.hxx>
+#include <Functions.hxx>
+
+
+namespace reportdesign
+{
+
+ using namespace com::sun::star;
+
+OGroup::OGroup(const uno::Reference< report::XGroups >& _xParent
+ ,const uno::Reference< uno::XComponentContext >& _xContext)
+:GroupBase(m_aMutex)
+,GroupPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,uno::Sequence< OUString >())
+,m_xContext(_xContext)
+,m_xParent(_xParent)
+{
+ osl_atomic_increment(&m_refCount);
+ {
+ m_xFunctions = new OFunctions(this,m_xContext);
+ }
+ osl_atomic_decrement( &m_refCount );
+}
+
+// TODO: VirtualFunctionFinder: This is virtual function!
+
+OGroup::~OGroup()
+{
+}
+
+IMPLEMENT_FORWARD_XINTERFACE2(OGroup,GroupBase,GroupPropertySet)
+
+OUString SAL_CALL OGroup::getImplementationName( )
+{
+ return "com.sun.star.comp.report.Group";
+}
+
+uno::Sequence< OUString> OGroup::getSupportedServiceNames_Static()
+{
+ uno::Sequence<OUString> aSupported { SERVICE_GROUP };
+ return aSupported;
+}
+
+uno::Sequence< OUString> SAL_CALL OGroup::getSupportedServiceNames()
+{
+ return getSupportedServiceNames_Static();
+}
+
+sal_Bool SAL_CALL OGroup::supportsService( const OUString& _rServiceName )
+{
+ return cppu::supportsService(this, _rServiceName);
+}
+
+void SAL_CALL OGroup::dispose()
+{
+ GroupPropertySet::dispose();
+ cppu::WeakComponentImplHelperBase::dispose();
+}
+
+// TODO: VirtualFunctionFinder: This is virtual function!
+
+void SAL_CALL OGroup::disposing()
+{
+ m_xHeader.clear();
+ m_xFooter.clear();
+ ::comphelper::disposeComponent(m_xFunctions);
+ m_xContext.clear();
+}
+
+// XGroup
+sal_Bool SAL_CALL OGroup::getSortAscending()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aProps.m_eSortAscending;
+}
+
+void SAL_CALL OGroup::setSortAscending( sal_Bool _sortascending )
+{
+ set(PROPERTY_SORTASCENDING,_sortascending,m_aProps.m_eSortAscending);
+}
+
+sal_Bool SAL_CALL OGroup::getHeaderOn()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_xHeader.is();
+}
+
+void SAL_CALL OGroup::setHeaderOn( sal_Bool _headeron )
+{
+ if ( bool(_headeron) != m_xHeader.is() )
+ {
+ OUString sName(RptResId(RID_STR_GROUP_HEADER));
+ setSection(PROPERTY_HEADERON,_headeron,sName,m_xHeader);
+ }
+}
+
+sal_Bool SAL_CALL OGroup::getFooterOn()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_xFooter.is();
+}
+
+void SAL_CALL OGroup::setFooterOn( sal_Bool _footeron )
+{
+ if ( bool(_footeron) != m_xFooter.is() )
+ {
+ OUString sName(RptResId(RID_STR_GROUP_FOOTER));
+ setSection(PROPERTY_FOOTERON,_footeron,sName,m_xFooter);
+ }
+}
+
+uno::Reference< report::XSection > SAL_CALL OGroup::getHeader()
+{
+ uno::Reference< report::XSection > xRet;
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ xRet = m_xHeader;
+ }
+
+ if ( !xRet.is() )
+ throw container::NoSuchElementException();
+ return xRet;
+}
+
+uno::Reference< report::XSection > SAL_CALL OGroup::getFooter()
+{
+ uno::Reference< report::XSection > xRet;
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ xRet = m_xFooter;
+ }
+
+ if ( !xRet.is() )
+ throw container::NoSuchElementException();
+ return xRet;
+}
+
+::sal_Int16 SAL_CALL OGroup::getGroupOn()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aProps.m_nGroupOn;
+}
+
+void SAL_CALL OGroup::setGroupOn( ::sal_Int16 _groupon )
+{
+ if ( _groupon < report::GroupOn::DEFAULT || _groupon > report::GroupOn::INTERVAL )
+ throwIllegallArgumentException(u"css::report::GroupOn"
+ ,*this
+ ,1);
+ set(PROPERTY_GROUPON,_groupon,m_aProps.m_nGroupOn);
+}
+
+::sal_Int32 SAL_CALL OGroup::getGroupInterval()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aProps.m_nGroupInterval;
+}
+
+void SAL_CALL OGroup::setGroupInterval( ::sal_Int32 _groupinterval )
+{
+ set(PROPERTY_GROUPINTERVAL,_groupinterval,m_aProps.m_nGroupInterval);
+}
+
+::sal_Int16 SAL_CALL OGroup::getKeepTogether()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aProps.m_nKeepTogether;
+}
+
+void SAL_CALL OGroup::setKeepTogether( ::sal_Int16 _keeptogether )
+{
+ if ( _keeptogether < report::KeepTogether::NO || _keeptogether > report::KeepTogether::WITH_FIRST_DETAIL )
+ throwIllegallArgumentException(u"css::report::KeepTogether"
+ ,*this
+ ,1);
+ set(PROPERTY_KEEPTOGETHER,_keeptogether,m_aProps.m_nKeepTogether);
+}
+
+uno::Reference< report::XGroups > SAL_CALL OGroup::getGroups()
+{
+ return m_xParent;
+}
+
+OUString SAL_CALL OGroup::getExpression()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aProps.m_sExpression;
+}
+
+void SAL_CALL OGroup::setExpression( const OUString& _expression )
+{
+ set(PROPERTY_EXPRESSION,_expression,m_aProps.m_sExpression);
+}
+
+sal_Bool SAL_CALL OGroup::getStartNewColumn()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aProps.m_bStartNewColumn;
+}
+
+void SAL_CALL OGroup::setStartNewColumn( sal_Bool _startnewcolumn )
+{
+ set(PROPERTY_STARTNEWCOLUMN,_startnewcolumn,m_aProps.m_bStartNewColumn);
+}
+
+
+sal_Bool SAL_CALL OGroup::getResetPageNumber()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aProps.m_bResetPageNumber;
+}
+
+void SAL_CALL OGroup::setResetPageNumber( sal_Bool _resetpagenumber )
+{
+ set(PROPERTY_RESETPAGENUMBER,_resetpagenumber,m_aProps.m_bResetPageNumber);
+}
+
+// XChild
+uno::Reference< uno::XInterface > SAL_CALL OGroup::getParent( )
+{
+ return m_xParent;
+}
+
+void SAL_CALL OGroup::setParent( const uno::Reference< uno::XInterface >& /*Parent*/ )
+{
+ throw lang::NoSupportException();
+}
+
+uno::Reference< beans::XPropertySetInfo > SAL_CALL OGroup::getPropertySetInfo( )
+{
+ return GroupPropertySet::getPropertySetInfo();
+}
+
+void SAL_CALL OGroup::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
+{
+ GroupPropertySet::setPropertyValue( aPropertyName, aValue );
+}
+
+uno::Any SAL_CALL OGroup::getPropertyValue( const OUString& PropertyName )
+{
+ return GroupPropertySet::getPropertyValue( PropertyName);
+}
+
+void SAL_CALL OGroup::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener )
+{
+ GroupPropertySet::addPropertyChangeListener( aPropertyName, xListener );
+}
+
+void SAL_CALL OGroup::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener )
+{
+ GroupPropertySet::removePropertyChangeListener( aPropertyName, aListener );
+}
+
+void SAL_CALL OGroup::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+{
+ GroupPropertySet::addVetoableChangeListener( PropertyName, aListener );
+}
+
+void SAL_CALL OGroup::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+{
+ GroupPropertySet::removeVetoableChangeListener( PropertyName, aListener );
+}
+
+void OGroup::setSection( const OUString& _sProperty
+ ,bool _bOn
+ ,const OUString& _sName
+ ,uno::Reference< report::XSection>& _member)
+{
+ BoundListeners l;
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ prepareSet(_sProperty, uno::Any(_member), uno::Any(_bOn), &l);
+
+ // create section if needed
+ if ( _bOn && !_member.is() )
+ _member = OSection::createOSection(this, m_xContext);
+ else if ( !_bOn )
+ ::comphelper::disposeComponent(_member);
+
+ if ( _member.is() )
+ _member->setName(_sName);
+ }
+ l.notify();
+}
+
+uno::Reference< report::XFunctions > SAL_CALL OGroup::getFunctions()
+{
+ return m_xFunctions;
+}
+
+} // namespace reportdesign
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/reportdesign/source/core/api/Groups.cxx b/reportdesign/source/core/api/Groups.cxx
new file mode 100644
index 000000000..780c6093b
--- /dev/null
+++ b/reportdesign/source/core/api/Groups.cxx
@@ -0,0 +1,195 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#include <Groups.hxx>
+#include <Group.hxx>
+#include <com/sun/star/lang/NoSupportException.hpp>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <o3tl/safeint.hxx>
+#include <core_resource.hxx>
+#include <strings.hrc>
+
+namespace reportdesign
+{
+
+ using namespace com::sun::star;
+
+OGroups::OGroups(const uno::Reference< report::XReportDefinition >& _xParent,const uno::Reference< uno::XComponentContext >& context)
+:GroupsBase(m_aMutex)
+,m_aContainerListeners(m_aMutex)
+,m_xContext(context)
+,m_xParent(_xParent)
+{
+}
+
+// TODO: VirtualFunctionFinder: This is virtual function!
+
+OGroups::~OGroups()
+{
+}
+
+void SAL_CALL OGroups::dispose()
+{
+ cppu::WeakComponentImplHelperBase::dispose();
+}
+
+// TODO: VirtualFunctionFinder: This is virtual function!
+
+void SAL_CALL OGroups::disposing()
+{
+ for(auto& rGroup : m_aGroups)
+ rGroup->dispose();
+ m_aGroups.clear();
+ lang::EventObject aDisposeEvent( static_cast< ::cppu::OWeakObject* >( this ) );
+ m_aContainerListeners.disposeAndClear( aDisposeEvent );
+ m_xContext.clear();
+}
+
+// XGroups
+uno::Reference< report::XReportDefinition > SAL_CALL OGroups::getReportDefinition()
+{
+ return m_xParent;
+}
+
+uno::Reference< report::XGroup > SAL_CALL OGroups::createGroup( )
+{
+ return new OGroup(this,m_xContext);
+}
+
+// XIndexContainer
+void SAL_CALL OGroups::insertByIndex( ::sal_Int32 Index, const uno::Any& aElement )
+{
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ bool bAdd = (Index == static_cast<sal_Int32>(m_aGroups.size()));
+ if ( !bAdd )
+ checkIndex(Index);
+ uno::Reference< report::XGroup > xGroup(aElement,uno::UNO_QUERY);
+ if ( !xGroup.is() )
+ throw lang::IllegalArgumentException(RptResId(RID_STR_ARGUMENT_IS_NULL),*this,2);
+
+ if ( bAdd )
+ m_aGroups.push_back(xGroup);
+ else
+ {
+ TGroups::iterator aPos = m_aGroups.begin();
+ ::std::advance(aPos,Index);
+ m_aGroups.insert(aPos, xGroup);
+ }
+ }
+ // notify our container listeners
+ container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::Any(Index), aElement, uno::Any());
+ m_aContainerListeners.notifyEach(&container::XContainerListener::elementInserted,aEvent);
+}
+
+
+void SAL_CALL OGroups::removeByIndex( ::sal_Int32 Index )
+{
+ uno::Reference< report::XGroup > xGroup;
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ checkIndex(Index);
+ TGroups::iterator aPos = m_aGroups.begin();
+ ::std::advance(aPos,Index);
+ xGroup = *aPos;
+ m_aGroups.erase(aPos);
+ }
+ container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::Any(Index), uno::Any(xGroup), uno::Any());
+ m_aContainerListeners.notifyEach(&container::XContainerListener::elementRemoved,aEvent);
+}
+
+// XIndexReplace
+void SAL_CALL OGroups::replaceByIndex( ::sal_Int32 Index, const uno::Any& Element )
+{
+ uno::Any aOldElement;
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ checkIndex(Index);
+ uno::Reference< report::XGroup > xGroup(Element,uno::UNO_QUERY);
+ if ( !xGroup.is() )
+ throw lang::IllegalArgumentException(RptResId(RID_STR_ARGUMENT_IS_NULL),*this,2);
+ TGroups::iterator aPos = m_aGroups.begin();
+ ::std::advance(aPos,Index);
+ aOldElement <<= *aPos;
+ *aPos = xGroup;
+ }
+
+ container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::Any(Index), Element, aOldElement);
+ m_aContainerListeners.notifyEach(&container::XContainerListener::elementReplaced,aEvent);
+}
+
+// XIndexAccess
+::sal_Int32 SAL_CALL OGroups::getCount( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aGroups.size();
+}
+
+uno::Any SAL_CALL OGroups::getByIndex( ::sal_Int32 Index )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ checkIndex(Index);
+ TGroups::const_iterator aPos = m_aGroups.begin();
+ ::std::advance(aPos,Index);
+ return uno::Any(*aPos);
+}
+
+// XElementAccess
+uno::Type SAL_CALL OGroups::getElementType( )
+{
+ return cppu::UnoType<report::XGroup>::get();
+}
+
+sal_Bool SAL_CALL OGroups::hasElements( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return !m_aGroups.empty();
+}
+
+// XChild
+uno::Reference< uno::XInterface > SAL_CALL OGroups::getParent( )
+{
+ return m_xParent;
+}
+
+void SAL_CALL OGroups::setParent( const uno::Reference< uno::XInterface >& /*Parent*/ )
+{
+ throw lang::NoSupportException();
+}
+
+// XContainer
+void SAL_CALL OGroups::addContainerListener( const uno::Reference< container::XContainerListener >& xListener )
+{
+ m_aContainerListeners.addInterface(xListener);
+}
+
+void SAL_CALL OGroups::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener )
+{
+ m_aContainerListeners.removeInterface(xListener);
+}
+
+void OGroups::checkIndex(sal_Int32 _nIndex)
+{
+ if ( _nIndex < 0 || m_aGroups.size() <= o3tl::make_unsigned(_nIndex) )
+ throw lang::IndexOutOfBoundsException();
+}
+
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/reportdesign/source/core/api/ImageControl.cxx b/reportdesign/source/core/api/ImageControl.cxx
new file mode 100644
index 000000000..371f8831e
--- /dev/null
+++ b/reportdesign/source/core/api/ImageControl.cxx
@@ -0,0 +1,482 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#include <ImageControl.hxx>
+#include <strings.hxx>
+#include <strings.hrc>
+#include <core_resource.hxx>
+#include <Tools.hxx>
+#include <tools/color.hxx>
+#include <cppuhelper/supportsservice.hxx>
+#include <FormatCondition.hxx>
+#include <com/sun/star/awt/ImageScaleMode.hpp>
+#include <ReportHelperImpl.hxx>
+
+namespace reportdesign
+{
+
+ using namespace com::sun::star;
+static uno::Sequence< OUString > lcl_getImageOptionals()
+{
+ OUString pProps[] = {
+ OUString(PROPERTY_CHARCOLOR)
+ ,OUString(PROPERTY_CHAREMPHASIS)
+ ,OUString(PROPERTY_CHARFONTCHARSET)
+ ,OUString(PROPERTY_CHARFONTFAMILY)
+ ,OUString(PROPERTY_CHARFONTNAME)
+ ,OUString(PROPERTY_CHARFONTPITCH)
+ ,OUString(PROPERTY_CHARFONTSTYLENAME)
+ ,OUString(PROPERTY_CHARHEIGHT)
+ ,OUString(PROPERTY_CHARPOSTURE)
+ ,OUString(PROPERTY_CHARRELIEF)
+ ,OUString(PROPERTY_FONTDESCRIPTOR)
+ ,OUString(PROPERTY_FONTDESCRIPTORASIAN)
+ ,OUString(PROPERTY_FONTDESCRIPTORCOMPLEX)
+ ,OUString(PROPERTY_CONTROLTEXTEMPHASISMARK)
+ ,OUString(PROPERTY_CHARROTATION)
+ ,OUString(PROPERTY_CHARSCALEWIDTH)
+ ,OUString(PROPERTY_CHARSTRIKEOUT)
+ ,OUString(PROPERTY_CHARUNDERLINECOLOR)
+ ,OUString(PROPERTY_CHARUNDERLINE)
+ ,OUString(PROPERTY_CHARWEIGHT)
+ ,OUString(PROPERTY_CHARWORDMODE)
+ ,OUString(PROPERTY_CHARFLASH)
+ ,OUString(PROPERTY_CHARAUTOKERNING)
+ ,OUString(PROPERTY_CHARESCAPEMENTHEIGHT)
+ ,OUString(PROPERTY_CHARLOCALE)
+ ,OUString(PROPERTY_CHARESCAPEMENT)
+ ,OUString(PROPERTY_CHARCASEMAP)
+ ,OUString(PROPERTY_CHARCOMBINEISON)
+ ,OUString(PROPERTY_CHARCOMBINEPREFIX)
+ ,OUString(PROPERTY_CHARCOMBINESUFFIX)
+ ,OUString(PROPERTY_CHARHIDDEN)
+ ,OUString(PROPERTY_CHARSHADOWED)
+ ,OUString(PROPERTY_CHARCONTOURED)
+ ,OUString(PROPERTY_VISITEDCHARSTYLENAME)
+ ,OUString(PROPERTY_UNVISITEDCHARSTYLENAME)
+ ,OUString(PROPERTY_CHARKERNING)
+ ,OUString(PROPERTY_MASTERFIELDS)
+ ,OUString(PROPERTY_DETAILFIELDS)
+ ,OUString(PROPERTY_PARAADJUST)
+ , OUString(PROPERTY_CHAREMPHASISASIAN)
+ , OUString(PROPERTY_CHARFONTNAMEASIAN)
+ , OUString(PROPERTY_CHARFONTSTYLENAMEASIAN)
+ , OUString(PROPERTY_CHARFONTFAMILYASIAN)
+ , OUString(PROPERTY_CHARFONTCHARSETASIAN)
+ , OUString(PROPERTY_CHARFONTPITCHASIAN)
+ , OUString(PROPERTY_CHARHEIGHTASIAN)
+ , OUString(PROPERTY_CHARUNDERLINEASIAN)
+ , OUString(PROPERTY_CHARWEIGHTASIAN)
+ , OUString(PROPERTY_CHARPOSTUREASIAN)
+ , OUString(PROPERTY_CHARWORDMODEASIAN)
+ , OUString(PROPERTY_CHARROTATIONASIAN)
+ , OUString(PROPERTY_CHARSCALEWIDTHASIAN)
+ , OUString(PROPERTY_CHARLOCALEASIAN)
+ , OUString(PROPERTY_CHAREMPHASISCOMPLEX)
+ , OUString(PROPERTY_CHARFONTNAMECOMPLEX)
+ , OUString(PROPERTY_CHARFONTSTYLENAMECOMPLEX)
+ , OUString(PROPERTY_CHARFONTFAMILYCOMPLEX)
+ , OUString(PROPERTY_CHARFONTCHARSETCOMPLEX)
+ , OUString(PROPERTY_CHARFONTPITCHCOMPLEX)
+ , OUString(PROPERTY_CHARHEIGHTCOMPLEX)
+ , OUString(PROPERTY_CHARUNDERLINECOMPLEX)
+ , OUString(PROPERTY_CHARWEIGHTCOMPLEX)
+ , OUString(PROPERTY_CHARPOSTURECOMPLEX)
+ , OUString(PROPERTY_CHARWORDMODECOMPLEX)
+ , OUString(PROPERTY_CHARROTATIONCOMPLEX)
+ , OUString(PROPERTY_CHARSCALEWIDTHCOMPLEX)
+ , OUString(PROPERTY_CHARLOCALECOMPLEX)
+
+ };
+ return uno::Sequence< OUString >(pProps,SAL_N_ELEMENTS(pProps));
+}
+
+
+OImageControl::OImageControl(uno::Reference< uno::XComponentContext > const & _xContext)
+:ImageControlBase(m_aMutex)
+,ImageControlPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,lcl_getImageOptionals())
+,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext)
+,m_nScaleMode(awt::ImageScaleMode::NONE)
+,m_bPreserveIRI(true)
+{
+ m_aProps.aComponent.m_sName = RptResId(RID_STR_IMAGECONTROL);
+}
+
+OImageControl::OImageControl(uno::Reference< uno::XComponentContext > const & _xContext
+ ,const uno::Reference< lang::XMultiServiceFactory>& _xFactory
+ ,uno::Reference< drawing::XShape >& _xShape)
+:ImageControlBase(m_aMutex)
+,ImageControlPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,lcl_getImageOptionals())
+,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext)
+,m_nScaleMode(awt::ImageScaleMode::NONE)
+,m_bPreserveIRI(true)
+{
+ m_aProps.aComponent.m_sName = RptResId(RID_STR_IMAGECONTROL);
+ m_aProps.aComponent.m_xFactory = _xFactory;
+ osl_atomic_increment( &m_refCount );
+ {
+ m_aProps.aComponent.setShape(_xShape,this,m_refCount);
+ }
+ osl_atomic_decrement( &m_refCount );
+}
+
+OImageControl::~OImageControl()
+{
+}
+
+//IMPLEMENT_FORWARD_XINTERFACE2(OImageControl,ImageControlBase,ImageControlPropertySet)
+IMPLEMENT_FORWARD_REFCOUNT( OImageControl, ImageControlBase )
+
+uno::Any SAL_CALL OImageControl::queryInterface( const uno::Type& _rType )
+{
+ uno::Any aReturn = ImageControlBase::queryInterface(_rType);
+ if ( !aReturn.hasValue() )
+ aReturn = ImageControlPropertySet::queryInterface(_rType);
+
+ if ( !aReturn.hasValue() && OReportControlModel::isInterfaceForbidden(_rType) )
+ return aReturn;
+
+ return aReturn.hasValue() ? aReturn : (m_aProps.aComponent.m_xProxy.is() ? m_aProps.aComponent.m_xProxy->queryAggregation(_rType) : aReturn);
+}
+
+
+void SAL_CALL OImageControl::dispose()
+{
+ ImageControlPropertySet::dispose();
+ cppu::WeakComponentImplHelperBase::dispose();
+}
+
+OUString OImageControl::getImplementationName_Static( )
+{
+ return "com.sun.star.comp.report.OImageControl";
+}
+
+
+OUString SAL_CALL OImageControl::getImplementationName( )
+{
+ return getImplementationName_Static();
+}
+
+uno::Sequence< OUString > OImageControl::getSupportedServiceNames_Static( )
+{
+ uno::Sequence< OUString > aServices { SERVICE_IMAGECONTROL };
+
+ return aServices;
+}
+
+uno::Reference< uno::XInterface > OImageControl::create(uno::Reference< uno::XComponentContext > const & xContext)
+{
+ return *(new OImageControl(xContext));
+}
+
+
+uno::Sequence< OUString > SAL_CALL OImageControl::getSupportedServiceNames( )
+{
+ return getSupportedServiceNames_Static();
+}
+
+sal_Bool SAL_CALL OImageControl::supportsService(const OUString& ServiceName)
+{
+ return cppu::supportsService(this, ServiceName);
+}
+
+// XReportComponent
+REPORTCOMPONENT_IMPL(OImageControl,m_aProps.aComponent)
+REPORTCOMPONENT_IMPL2(OImageControl,m_aProps.aComponent)
+REPORTCOMPONENT_NOMASTERDETAIL(OImageControl)
+NO_REPORTCONTROLFORMAT_IMPL(OImageControl)
+OUString SAL_CALL OImageControl::getHyperLinkURL()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aProps.aFormatProperties.sHyperLinkURL;
+}
+void SAL_CALL OImageControl::setHyperLinkURL(const OUString & the_value)
+{
+ set(PROPERTY_HYPERLINKURL,the_value,m_aProps.aFormatProperties.sHyperLinkURL);
+}
+OUString SAL_CALL OImageControl::getHyperLinkTarget()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aProps.aFormatProperties.sHyperLinkTarget;
+}
+void SAL_CALL OImageControl::setHyperLinkTarget(const OUString & the_value)
+{
+ set(PROPERTY_HYPERLINKTARGET,the_value,m_aProps.aFormatProperties.sHyperLinkTarget);
+}
+OUString SAL_CALL OImageControl::getHyperLinkName()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aProps.aFormatProperties.sHyperLinkName;
+}
+void SAL_CALL OImageControl::setHyperLinkName(const OUString & the_value)
+{
+ set(PROPERTY_HYPERLINKNAME,the_value,m_aProps.aFormatProperties.sHyperLinkName);
+}
+
+
+::sal_Int32 SAL_CALL OImageControl::getControlBackground()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aProps.aFormatProperties.m_bBackgroundTransparent ? static_cast<sal_Int32>(COL_TRANSPARENT) : m_aProps.aFormatProperties.nBackgroundColor;
+}
+
+void SAL_CALL OImageControl::setControlBackground( ::sal_Int32 _backgroundcolor )
+{
+ bool bTransparent = _backgroundcolor == static_cast<sal_Int32>(COL_TRANSPARENT);
+ setControlBackgroundTransparent(bTransparent);
+ if ( !bTransparent )
+ set(PROPERTY_CONTROLBACKGROUND,_backgroundcolor,m_aProps.aFormatProperties.nBackgroundColor);
+}
+
+sal_Bool SAL_CALL OImageControl::getControlBackgroundTransparent()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aProps.aFormatProperties.m_bBackgroundTransparent;
+}
+
+void SAL_CALL OImageControl::setControlBackgroundTransparent( sal_Bool _controlbackgroundtransparent )
+{
+ set(PROPERTY_CONTROLBACKGROUNDTRANSPARENT,_controlbackgroundtransparent,m_aProps.aFormatProperties.m_bBackgroundTransparent);
+ if ( _controlbackgroundtransparent )
+ set(PROPERTY_CONTROLBACKGROUND,static_cast<sal_Int32>(COL_TRANSPARENT),m_aProps.aFormatProperties.nBackgroundColor);
+}
+
+
+uno::Reference< beans::XPropertySetInfo > SAL_CALL OImageControl::getPropertySetInfo( )
+{
+ return ImageControlPropertySet::getPropertySetInfo();
+}
+
+void SAL_CALL OImageControl::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
+{
+ ImageControlPropertySet::setPropertyValue( aPropertyName, aValue );
+}
+
+uno::Any SAL_CALL OImageControl::getPropertyValue( const OUString& PropertyName )
+{
+ return ImageControlPropertySet::getPropertyValue( PropertyName);
+}
+
+void SAL_CALL OImageControl::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener )
+{
+ ImageControlPropertySet::addPropertyChangeListener( aPropertyName, xListener );
+}
+
+void SAL_CALL OImageControl::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener )
+{
+ ImageControlPropertySet::removePropertyChangeListener( aPropertyName, aListener );
+}
+
+void SAL_CALL OImageControl::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+{
+ ImageControlPropertySet::addVetoableChangeListener( PropertyName, aListener );
+}
+
+void SAL_CALL OImageControl::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+{
+ ImageControlPropertySet::removeVetoableChangeListener( PropertyName, aListener );
+}
+
+// XReportControlModel
+OUString SAL_CALL OImageControl::getDataField()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aProps.aDataField;
+}
+
+void SAL_CALL OImageControl::setDataField( const OUString& _datafield )
+{
+ set(PROPERTY_DATAFIELD,_datafield,m_aProps.aDataField);
+}
+
+
+sal_Bool SAL_CALL OImageControl::getPrintWhenGroupChange()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aProps.bPrintWhenGroupChange;
+}
+
+void SAL_CALL OImageControl::setPrintWhenGroupChange( sal_Bool _printwhengroupchange )
+{
+ set(PROPERTY_PRINTWHENGROUPCHANGE,_printwhengroupchange,m_aProps.bPrintWhenGroupChange);
+}
+
+OUString SAL_CALL OImageControl::getConditionalPrintExpression()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aProps.aConditionalPrintExpression;
+}
+
+void SAL_CALL OImageControl::setConditionalPrintExpression( const OUString& _conditionalprintexpression )
+{
+ set(PROPERTY_CONDITIONALPRINTEXPRESSION,_conditionalprintexpression,m_aProps.aConditionalPrintExpression);
+}
+
+
+// XCloneable
+uno::Reference< util::XCloneable > SAL_CALL OImageControl::createClone( )
+{
+ uno::Reference< report::XReportComponent> xSource = this;
+ uno::Reference< report::XImageControl> xSet(cloneObject(xSource,m_aProps.aComponent.m_xFactory,SERVICE_IMAGECONTROL),uno::UNO_QUERY_THROW);
+ return xSet;
+}
+
+
+// XImageControl
+
+OUString SAL_CALL OImageControl::getImageURL()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aImageURL;
+}
+
+void SAL_CALL OImageControl::setImageURL( const OUString& _imageurl )
+{
+ set(PROPERTY_IMAGEURL,_imageurl,m_aImageURL);
+}
+
+uno::Reference< awt::XImageProducer > SAL_CALL OImageControl::getImageProducer( )
+{
+ return uno::Reference< awt::XImageProducer >();
+}
+
+// XChild
+uno::Reference< uno::XInterface > SAL_CALL OImageControl::getParent( )
+{
+ return OShapeHelper::getParent(this);
+}
+
+void SAL_CALL OImageControl::setParent( const uno::Reference< uno::XInterface >& Parent )
+{
+ OShapeHelper::setParent(Parent,this);
+}
+uno::Reference< report::XFormatCondition > SAL_CALL OImageControl::createFormatCondition( )
+{
+ return new OFormatCondition(m_aProps.aComponent.m_xContext);
+}
+
+// XContainer
+void SAL_CALL OImageControl::addContainerListener( const uno::Reference< container::XContainerListener >& xListener )
+{
+ m_aProps.addContainerListener(xListener);
+}
+
+void SAL_CALL OImageControl::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener )
+{
+ m_aProps.removeContainerListener(xListener);
+}
+
+// XElementAccess
+uno::Type SAL_CALL OImageControl::getElementType( )
+{
+ return cppu::UnoType<report::XFormatCondition>::get();
+}
+
+sal_Bool SAL_CALL OImageControl::hasElements( )
+{
+ return m_aProps.hasElements();
+}
+
+// XIndexContainer
+void SAL_CALL OImageControl::insertByIndex( ::sal_Int32 Index, const uno::Any& Element )
+{
+ m_aProps.insertByIndex(Index,Element);
+}
+
+void SAL_CALL OImageControl::removeByIndex( ::sal_Int32 Index )
+{
+ m_aProps.removeByIndex(Index);
+}
+
+// XIndexReplace
+void SAL_CALL OImageControl::replaceByIndex( ::sal_Int32 Index, const uno::Any& Element )
+{
+ m_aProps.replaceByIndex(Index,Element);
+}
+
+// XIndexAccess
+::sal_Int32 SAL_CALL OImageControl::getCount( )
+{
+ return m_aProps.getCount();
+}
+
+uno::Any SAL_CALL OImageControl::getByIndex( ::sal_Int32 Index )
+{
+ return m_aProps.getByIndex( Index );
+}
+
+
+// XShape
+awt::Point SAL_CALL OImageControl::getPosition( )
+{
+ return OShapeHelper::getPosition(this);
+}
+
+void SAL_CALL OImageControl::setPosition( const awt::Point& aPosition )
+{
+ OShapeHelper::setPosition(aPosition,this);
+}
+
+awt::Size SAL_CALL OImageControl::getSize( )
+{
+ return OShapeHelper::getSize(this);
+}
+
+void SAL_CALL OImageControl::setSize( const awt::Size& aSize )
+{
+ OShapeHelper::setSize(aSize,this);
+}
+
+
+// XShapeDescriptor
+OUString SAL_CALL OImageControl::getShapeType( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if ( m_aProps.aComponent.m_xShape.is() )
+ return m_aProps.aComponent.m_xShape->getShapeType();
+ return "com.sun.star.drawing.ControlShape";
+}
+
+::sal_Int16 SAL_CALL OImageControl::getScaleMode()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_nScaleMode;
+}
+
+void SAL_CALL OImageControl::setScaleMode( ::sal_Int16 _scalemode )
+{
+ if ( _scalemode < awt::ImageScaleMode::NONE ||_scalemode > awt::ImageScaleMode::ANISOTROPIC )
+ throw lang::IllegalArgumentException();
+ set(PROPERTY_SCALEMODE,_scalemode,m_nScaleMode);
+}
+
+sal_Bool SAL_CALL OImageControl::getPreserveIRI()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_bPreserveIRI;
+}
+
+void SAL_CALL OImageControl::setPreserveIRI( sal_Bool _preserveiri )
+{
+ set(PROPERTY_PRESERVEIRI,_preserveiri,m_bPreserveIRI);
+}
+
+} // namespace reportdesign
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/reportdesign/source/core/api/ReportComponent.cxx b/reportdesign/source/core/api/ReportComponent.cxx
new file mode 100644
index 000000000..5c036b5d6
--- /dev/null
+++ b/reportdesign/source/core/api/ReportComponent.cxx
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#include <ReportComponent.hxx>
+
+#include <vcl/svapp.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/settings.hxx>
+
+#include <toolkit/helper/vclunohelper.hxx>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontWidth.hpp>
+#include <ReportControlModel.hxx>
+#include <com/sun/star/i18n/ScriptType.hpp>
+#include <comphelper/uno3.hxx>
+#include <unotools/lingucfg.hxx>
+#include <i18nlangtag/mslangid.hxx>
+#include <i18nlangtag/languagetag.hxx>
+
+
+namespace reportdesign
+{
+
+ using namespace com::sun::star;
+ using namespace comphelper;
+
+static void lcl_getDefaultFonts( vcl::Font& rLatinFont, vcl::Font& rCJKFont, vcl::Font& rCTLFont, LanguageType _eLatin, LanguageType _eCJK, LanguageType _eCTL )
+{
+ LanguageType eLatin = _eLatin;
+
+ // If the UI language is Korean, the default Latin font has to
+ // be queried for Korean, too (the Latin language from the document can't be Korean).
+ // This is the same logic as in SwDocShell::InitNew.
+ LanguageType eUiLanguage = Application::GetSettings().GetUILanguageTag().getLanguageType();
+ if (MsLangId::isKorean(eUiLanguage))
+ eLatin = eUiLanguage;
+
+ rLatinFont = OutputDevice::GetDefaultFont( DefaultFontType::LATIN_PRESENTATION, eLatin, GetDefaultFontFlags::OnlyOne );
+ rCJKFont = OutputDevice::GetDefaultFont( DefaultFontType::CJK_PRESENTATION, _eCJK, GetDefaultFontFlags::OnlyOne );
+ rCTLFont = OutputDevice::GetDefaultFont( DefaultFontType::CTL_PRESENTATION, _eCTL, GetDefaultFontFlags::OnlyOne ) ;
+}
+OFormatProperties::OFormatProperties()
+ :nAlign(style::ParagraphAdjust_LEFT)
+ ,nFontEmphasisMark(0)
+ ,nFontRelief(0)
+ ,nTextColor(0)
+ ,nTextLineColor(0)
+ ,nBackgroundColor(COL_TRANSPARENT)
+ ,aVerticalAlignment( style::VerticalAlignment_TOP )
+ ,nCharEscapement(0)
+ ,nCharCaseMap(0)
+ ,nCharKerning(0)
+ ,nCharEscapementHeight(100)
+ ,m_bBackgroundTransparent(true)
+ ,bCharFlash(false)
+ ,bCharAutoKerning(false)
+ ,bCharCombineIsOn(false)
+ ,bCharHidden(false)
+ ,bCharShadowed(false)
+ ,bCharContoured(false)
+{
+ try
+ {
+ SvtLinguConfig aLinguConfig;
+ using namespace ::com::sun::star::i18n::ScriptType;
+
+ aLinguConfig.GetProperty(u"DefaultLocale") >>= aCharLocale;
+ LanguageType eCurLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag::convertToLanguageType( aCharLocale, false), LATIN);
+ aLinguConfig.GetProperty(u"DefaultLocale_CJK") >>= aCharLocaleAsian;
+ LanguageType eCurLangCJK = MsLangId::resolveSystemLanguageByScriptType(LanguageTag::convertToLanguageType( aCharLocaleAsian, false), ASIAN);
+ aLinguConfig.GetProperty(u"DefaultLocale_CTL") >>= aCharLocaleComplex;
+ LanguageType eCurLangCTL = MsLangId::resolveSystemLanguageByScriptType(LanguageTag::convertToLanguageType( aCharLocaleComplex, false), COMPLEX);
+
+ vcl::Font aLatin,aCJK,aCTL;
+ lcl_getDefaultFonts(aLatin,aCJK,aCTL,eCurLang,eCurLangCJK,eCurLangCTL);
+ aFontDescriptor = VCLUnoHelper::CreateFontDescriptor(aLatin);
+ aAsianFontDescriptor = VCLUnoHelper::CreateFontDescriptor(aCJK);
+ aComplexFontDescriptor = VCLUnoHelper::CreateFontDescriptor(aCTL);
+ }
+ catch(const uno::Exception&)
+ {
+ }
+ aFontDescriptor.Weight = awt::FontWeight::NORMAL;
+ aFontDescriptor.CharacterWidth = awt::FontWidth::NORMAL;
+}
+
+void OReportComponentProperties::setShape(uno::Reference< drawing::XShape >& _xShape,const uno::Reference< report::XReportComponent>& _xTunnel,oslInterlockedCount& _rRefCount)
+{
+ osl_atomic_increment( &_rRefCount );
+ {
+ m_xProxy.set(_xShape,uno::UNO_QUERY);
+ ::comphelper::query_aggregation(m_xProxy,m_xShape);
+ ::comphelper::query_aggregation(m_xProxy,m_xProperty);
+ _xShape.clear();
+ m_xTypeProvider.set(m_xShape,uno::UNO_QUERY);
+ m_xUnoTunnel.set(m_xShape,uno::UNO_QUERY);
+ m_xServiceInfo.set(m_xShape,uno::UNO_QUERY);
+
+ // set ourself as delegator
+ if ( m_xProxy.is() )
+ m_xProxy->setDelegator( _xTunnel );
+ }
+ osl_atomic_decrement( &_rRefCount );
+}
+
+OReportComponentProperties::~OReportComponentProperties()
+{
+ if ( m_xProxy.is() )
+ {
+ m_xProxy->setDelegator( nullptr );
+ m_xProxy.clear();
+ }
+}
+
+} // namespace reportdesign
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/reportdesign/source/core/api/ReportControlModel.cxx b/reportdesign/source/core/api/ReportControlModel.cxx
new file mode 100644
index 000000000..16dee9bd1
--- /dev/null
+++ b/reportdesign/source/core/api/ReportControlModel.cxx
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#include <ReportControlModel.hxx>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <o3tl/safeint.hxx>
+namespace reportdesign
+{
+using namespace com::sun::star;
+using namespace comphelper;
+
+// XContainer
+void OReportControlModel::addContainerListener(
+ const uno::Reference<container::XContainerListener>& xListener)
+{
+ aContainerListeners.addInterface(xListener);
+}
+
+void OReportControlModel::removeContainerListener(
+ const uno::Reference<container::XContainerListener>& xListener)
+{
+ aContainerListeners.removeInterface(xListener);
+}
+
+bool OReportControlModel::hasElements()
+{
+ ::osl::MutexGuard aGuard(m_rMutex);
+ return !m_aFormatConditions.empty();
+}
+
+// XIndexContainer
+void OReportControlModel::insertByIndex(::sal_Int32 Index, const uno::Any& Element)
+{
+ uno::Reference<report::XFormatCondition> xElement(Element, uno::UNO_QUERY);
+ if (!xElement.is())
+ throw lang::IllegalArgumentException();
+
+ uno::Reference<container::XContainer> xBroadcaster;
+ {
+ ::osl::MutexGuard aGuard(m_rMutex);
+ xBroadcaster = m_pOwner;
+ if (Index > static_cast<sal_Int32>(m_aFormatConditions.size()))
+ throw lang::IndexOutOfBoundsException();
+
+ m_aFormatConditions.insert(m_aFormatConditions.begin() + Index, xElement);
+ }
+
+ // notify our container listeners
+ container::ContainerEvent aEvent(xBroadcaster, uno::Any(Index), Element, uno::Any());
+ aContainerListeners.notifyEach(&container::XContainerListener::elementInserted, aEvent);
+}
+
+void OReportControlModel::removeByIndex(::sal_Int32 Index)
+{
+ uno::Any Element;
+ uno::Reference<container::XContainer> xBroadcaster;
+ {
+ ::osl::MutexGuard aGuard(m_rMutex);
+ xBroadcaster = m_pOwner;
+ checkIndex(Index);
+ Element <<= m_aFormatConditions[Index];
+ m_aFormatConditions.erase(m_aFormatConditions.begin() + Index);
+ }
+ container::ContainerEvent aEvent(xBroadcaster, uno::Any(Index), Element, uno::Any());
+ aContainerListeners.notifyEach(&container::XContainerListener::elementRemoved, aEvent);
+}
+
+// XIndexReplace
+void OReportControlModel::replaceByIndex(::sal_Int32 Index, const uno::Any& Element)
+{
+ uno::Reference<report::XFormatCondition> xElement(Element, uno::UNO_QUERY);
+ if (!xElement.is())
+ throw lang::IllegalArgumentException();
+ uno::Reference<container::XContainer> xBroadcaster;
+ {
+ ::osl::MutexGuard aGuard(m_rMutex);
+ xBroadcaster = m_pOwner;
+ checkIndex(Index);
+ m_aFormatConditions[Index] = xElement;
+ }
+ container::ContainerEvent aEvent(xBroadcaster, uno::Any(Index), Element, uno::Any());
+ aContainerListeners.notifyEach(&container::XContainerListener::elementReplaced, aEvent);
+}
+
+// XIndexAccess
+::sal_Int32 OReportControlModel::getCount()
+{
+ ::osl::MutexGuard aGuard(m_rMutex);
+ return m_aFormatConditions.size();
+}
+
+uno::Any OReportControlModel::getByIndex(::sal_Int32 Index)
+{
+ uno::Any aElement;
+ {
+ ::osl::MutexGuard aGuard(m_rMutex);
+ checkIndex(Index);
+ aElement <<= m_aFormatConditions[Index];
+ }
+ return aElement;
+}
+
+void OReportControlModel::checkIndex(sal_Int32 _nIndex)
+{
+ if (_nIndex < 0 || m_aFormatConditions.size() <= o3tl::make_unsigned(_nIndex))
+ throw lang::IndexOutOfBoundsException();
+}
+
+bool OReportControlModel::isInterfaceForbidden(const uno::Type& _rType)
+{
+ return (_rType == cppu::UnoType<beans::XPropertyState>::get()
+ || _rType == cppu::UnoType<beans::XMultiPropertySet>::get());
+}
+
+} // reportdesign
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
new file mode 100644
index 000000000..282b66b06
--- /dev/null
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -0,0 +1,2666 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <sal/config.h>
+
+#include <vector>
+#include <string_view>
+
+#include <officecfg/Office/Common.hxx>
+#include <ReportDefinition.hxx>
+
+#include <Functions.hxx>
+#include <Groups.hxx>
+#include <ReportComponent.hxx>
+#include <ReportHelperImpl.hxx>
+#include <RptDef.hxx>
+#include <RptModel.hxx>
+#include <Section.hxx>
+#include <Tools.hxx>
+#include <UndoEnv.hxx>
+#include <strings.hrc>
+#include <core_resource.hxx>
+#include <strings.hxx>
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/beans/XMultiPropertyStates.hpp>
+#include <com/sun/star/chart2/data/DatabaseDataProvider.hpp>
+#include <com/sun/star/datatransfer/UnsupportedFlavorException.hpp>
+#include <com/sun/star/document/DocumentProperties.hpp>
+#include <com/sun/star/document/IndexedPropertyValues.hpp>
+#include <com/sun/star/document/EventObject.hpp>
+#include <com/sun/star/document/XEventListener.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/embed/Aspects.hpp>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include <com/sun/star/embed/EmbedMapUnits.hpp>
+#include <com/sun/star/embed/XTransactedObject.hpp>
+#include <com/sun/star/embed/StorageFactory.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/io/IOException.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/report/GroupKeepTogether.hpp>
+#include <com/sun/star/report/ReportPrintOption.hpp>
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/style/GraphicLocation.hpp>
+#include <com/sun/star/style/NumberingType.hpp>
+#include <com/sun/star/style/PageStyleLayout.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
+#include <com/sun/star/table/ShadowFormat.hpp>
+#include <com/sun/star/task/InteractionHandler.hpp>
+#include <com/sun/star/task/XStatusIndicator.hpp>
+#include <com/sun/star/ui/UIConfigurationManager.hpp>
+#include <com/sun/star/util/CloseVetoException.hpp>
+#include <com/sun/star/util/NumberFormatsSupplier.hpp>
+#include <com/sun/star/xml/AttributeData.hpp>
+#include <com/sun/star/xml/sax/Writer.hpp>
+
+#include <comphelper/broadcasthelper.hxx>
+#include <comphelper/documentconstants.hxx>
+#include <comphelper/genericpropertyset.hxx>
+#include <comphelper/indexedpropertyvalues.hxx>
+#include <unotools/mediadescriptor.hxx>
+#include <comphelper/namecontainer.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <comphelper/numberedcollection.hxx>
+#include <comphelper/proparrhlp.hxx>
+#include <comphelper/propertysetinfo.hxx>
+#include <comphelper/propertystatecontainer.hxx>
+#include <comphelper/seqstream.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/servicehelper.hxx>
+#include <comphelper/storagehelper.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/interfacecontainer3.hxx>
+#include <connectivity/CommonTools.hxx>
+#include <connectivity/dbtools.hxx>
+#include <cppuhelper/exc_hlp.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <cppuhelper/interfacecontainer.h>
+#include <cppuhelper/supportsservice.hxx>
+#include <comphelper/types.hxx>
+#include <dbaccess/dbaundomanager.hxx>
+#include <editeng/paperinf.hxx>
+#include <framework/titlehelper.hxx>
+#include <o3tl/safeint.hxx>
+#include <svl/itempool.hxx>
+#include <svl/undo.hxx>
+#include <svx/svdlayer.hxx>
+#include <svx/unofill.hxx>
+#include <svx/xmleohlp.hxx>
+#include <svx/xmlgrhlp.hxx>
+#include <tools/diagnose_ex.h>
+#include <vcl/svapp.hxx>
+
+// page styles
+constexpr OUStringLiteral SC_UNO_PAGE_LEFTBORDER = u"LeftBorder";
+constexpr OUStringLiteral SC_UNO_PAGE_RIGHTBORDER = u"RightBorder";
+constexpr OUStringLiteral SC_UNO_PAGE_BOTTBORDER = u"BottomBorder";
+constexpr OUStringLiteral SC_UNO_PAGE_TOPBORDER = u"TopBorder";
+constexpr OUStringLiteral SC_UNO_PAGE_LEFTBRDDIST = u"LeftBorderDistance";
+constexpr OUStringLiteral SC_UNO_PAGE_RIGHTBRDDIST = u"RightBorderDistance";
+constexpr OUStringLiteral SC_UNO_PAGE_BOTTBRDDIST = u"BottomBorderDistance";
+constexpr OUStringLiteral SC_UNO_PAGE_TOPBRDDIST = u"TopBorderDistance";
+constexpr OUStringLiteral SC_UNO_PAGE_BORDERDIST = u"BorderDistance";
+constexpr OUStringLiteral SC_UNO_PAGE_SHADOWFORM = u"ShadowFormat";
+constexpr OUStringLiteral SC_UNO_PAGE_PAPERTRAY = u"PrinterPaperTray";
+constexpr OUStringLiteral SC_UNO_PAGE_SCALEVAL = u"PageScale";
+constexpr OUStringLiteral SC_UNO_PAGE_SCALETOPAG = u"ScaleToPages";
+constexpr OUStringLiteral SC_UNO_PAGE_SCALETOX = u"ScaleToPagesX";
+constexpr OUStringLiteral SC_UNO_PAGE_SCALETOY = u"ScaleToPagesY";
+constexpr OUStringLiteral SC_UNO_PAGE_HDRBACKCOL = u"HeaderBackColor";
+constexpr OUStringLiteral SC_UNO_PAGE_HDRBACKTRAN = u"HeaderBackTransparent";
+constexpr OUStringLiteral SC_UNO_PAGE_HDRGRFFILT = u"HeaderBackGraphicFilter";
+constexpr OUStringLiteral SC_UNO_PAGE_HDRGRFLOC = u"HeaderBackGraphicLocation";
+constexpr OUStringLiteral SC_UNO_PAGE_HDRGRF = u"HeaderBackGraphic";
+constexpr OUStringLiteral SC_UNO_PAGE_HDRLEFTBOR = u"HeaderLeftBorder";
+constexpr OUStringLiteral SC_UNO_PAGE_HDRRIGHTBOR = u"HeaderRightBorder";
+constexpr OUStringLiteral SC_UNO_PAGE_HDRBOTTBOR = u"HeaderBottomBorder";
+constexpr OUStringLiteral SC_UNO_PAGE_HDRTOPBOR = u"HeaderTopBorder";
+constexpr OUStringLiteral SC_UNO_PAGE_HDRLEFTBDIS = u"HeaderLeftBorderDistance";
+constexpr OUStringLiteral SC_UNO_PAGE_HDRRIGHTBDIS = u"HeaderRightBorderDistance";
+constexpr OUStringLiteral SC_UNO_PAGE_HDRBOTTBDIS = u"HeaderBottomBorderDistance";
+constexpr OUStringLiteral SC_UNO_PAGE_HDRTOPBDIS = u"HeaderTopBorderDistance";
+constexpr OUStringLiteral SC_UNO_PAGE_HDRBRDDIST = u"HeaderBorderDistance";
+constexpr OUStringLiteral SC_UNO_PAGE_HDRSHADOW = u"HeaderShadowFormat";
+constexpr OUStringLiteral SC_UNO_PAGE_HDRLEFTMAR = u"HeaderLeftMargin";
+constexpr OUStringLiteral SC_UNO_PAGE_HDRRIGHTMAR = u"HeaderRightMargin";
+constexpr OUStringLiteral SC_UNO_PAGE_HDRBODYDIST = u"HeaderBodyDistance";
+constexpr OUStringLiteral SC_UNO_PAGE_HDRHEIGHT = u"HeaderHeight";
+constexpr OUStringLiteral SC_UNO_PAGE_HDRON = u"HeaderIsOn";
+constexpr OUStringLiteral SC_UNO_PAGE_HDRDYNAMIC = u"HeaderIsDynamicHeight";
+constexpr OUStringLiteral SC_UNO_PAGE_HDRSHARED = u"HeaderIsShared";
+constexpr OUStringLiteral SC_UNO_PAGE_FIRSTHDRSHARED = u"FirstPageHeaderIsShared";
+constexpr OUStringLiteral SC_UNO_PAGE_FTRBACKCOL = u"FooterBackColor";
+constexpr OUStringLiteral SC_UNO_PAGE_FTRBACKTRAN = u"FooterBackTransparent";
+constexpr OUStringLiteral SC_UNO_PAGE_FTRGRFFILT = u"FooterBackGraphicFilter";
+constexpr OUStringLiteral SC_UNO_PAGE_FTRGRFLOC = u"FooterBackGraphicLocation";
+constexpr OUStringLiteral SC_UNO_PAGE_FTRGRF = u"FooterBackGraphic";
+constexpr OUStringLiteral SC_UNO_PAGE_FTRLEFTBOR = u"FooterLeftBorder";
+constexpr OUStringLiteral SC_UNO_PAGE_FTRRIGHTBOR = u"FooterRightBorder";
+constexpr OUStringLiteral SC_UNO_PAGE_FTRBOTTBOR = u"FooterBottomBorder";
+constexpr OUStringLiteral SC_UNO_PAGE_FTRTOPBOR = u"FooterTopBorder";
+constexpr OUStringLiteral SC_UNO_PAGE_FTRLEFTBDIS = u"FooterLeftBorderDistance";
+constexpr OUStringLiteral SC_UNO_PAGE_FTRRIGHTBDIS = u"FooterRightBorderDistance";
+constexpr OUStringLiteral SC_UNO_PAGE_FTRBOTTBDIS = u"FooterBottomBorderDistance";
+constexpr OUStringLiteral SC_UNO_PAGE_FTRTOPBDIS = u"FooterTopBorderDistance";
+constexpr OUStringLiteral SC_UNO_PAGE_FTRBRDDIST = u"FooterBorderDistance";
+constexpr OUStringLiteral SC_UNO_PAGE_FTRSHADOW = u"FooterShadowFormat";
+constexpr OUStringLiteral SC_UNO_PAGE_FTRLEFTMAR = u"FooterLeftMargin";
+constexpr OUStringLiteral SC_UNO_PAGE_FTRRIGHTMAR = u"FooterRightMargin";
+constexpr OUStringLiteral SC_UNO_PAGE_FTRBODYDIST = u"FooterBodyDistance";
+constexpr OUStringLiteral SC_UNO_PAGE_FTRHEIGHT = u"FooterHeight";
+constexpr OUStringLiteral SC_UNO_PAGE_FTRON = u"FooterIsOn";
+constexpr OUStringLiteral SC_UNO_PAGE_FTRDYNAMIC = u"FooterIsDynamicHeight";
+constexpr OUStringLiteral SC_UNO_PAGE_FTRSHARED = u"FooterIsShared";
+constexpr OUStringLiteral SC_UNO_PAGE_FIRSTFTRSHARED = u"FirstPageFooterIsShared";
+
+namespace reportdesign
+{
+ using namespace com::sun::star;
+ using namespace rptui;
+
+static void lcl_setModelReadOnly(const uno::Reference< embed::XStorage >& _xStorage,std::shared_ptr<rptui::OReportModel> const & _rModel)
+{
+ uno::Reference<beans::XPropertySet> xProp(_xStorage,uno::UNO_QUERY);
+ sal_Int32 nOpenMode = embed::ElementModes::READ;
+ if ( xProp.is() )
+ xProp->getPropertyValue("OpenMode") >>= nOpenMode;
+
+ _rModel->SetReadOnly((nOpenMode & embed::ElementModes::WRITE) != embed::ElementModes::WRITE);
+}
+static void lcl_stripLoadArguments( utl::MediaDescriptor& _rDescriptor, uno::Sequence< beans::PropertyValue >& _rArgs )
+{
+ _rDescriptor.erase( "StatusIndicator" );
+ _rDescriptor.erase( "InteractionHandler" );
+ _rDescriptor.erase( "Model" );
+ _rDescriptor >> _rArgs;
+}
+
+static void lcl_extractAndStartStatusIndicator( const utl::MediaDescriptor& _rDescriptor, uno::Reference< task::XStatusIndicator >& _rxStatusIndicator,
+ uno::Sequence< uno::Any >& _rCallArgs )
+{
+ try
+ {
+ _rxStatusIndicator = _rDescriptor.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_STATUSINDICATOR, _rxStatusIndicator );
+ if ( _rxStatusIndicator.is() )
+ {
+ _rxStatusIndicator->start( OUString(), sal_Int32(1000000) );
+
+ sal_Int32 nLength = _rCallArgs.getLength();
+ _rCallArgs.realloc( nLength + 1 );
+ _rCallArgs.getArray()[ nLength ] <<= _rxStatusIndicator;
+ }
+ }
+ catch (const uno::Exception&)
+ {
+ TOOLS_WARN_EXCEPTION( "reportdesign", "lcl_extractAndStartStatusIndicator" );
+ }
+}
+
+typedef ::comphelper::OPropertyStateContainer OStyle_PBASE;
+
+namespace {
+
+class OStyle;
+
+}
+
+typedef ::comphelper::OPropertyArrayUsageHelper < OStyle
+ > OStyle_PABASE;
+typedef ::cppu::WeakImplHelper< style::XStyle, beans::XMultiPropertyStates> TStyleBASE;
+
+namespace {
+
+class OStyle : public ::comphelper::OMutexAndBroadcastHelper
+ ,public TStyleBASE
+ ,public OStyle_PBASE
+ ,public OStyle_PABASE
+{
+ awt::Size m_aSize;
+
+protected:
+ void getPropertyDefaultByHandle( sal_Int32 _nHandle, uno::Any& _rDefault ) const override;
+ virtual ~OStyle() override {}
+public:
+ OStyle();
+
+
+ DECLARE_XINTERFACE( )
+
+ // XPropertySet
+ css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
+ ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
+
+ // XStyle
+ sal_Bool SAL_CALL isUserDefined( ) override;
+ sal_Bool SAL_CALL isInUse( ) override;
+ OUString SAL_CALL getParentStyle( ) override;
+ void SAL_CALL setParentStyle( const OUString& aParentStyle ) override;
+
+ // XNamed
+ OUString SAL_CALL getName( ) override;
+ void SAL_CALL setName( const OUString& aName ) override;
+
+ // XMultiPropertyState
+ uno::Sequence< beans::PropertyState > SAL_CALL getPropertyStates( const uno::Sequence< OUString >& aPropertyNames ) override
+ {
+ return OStyle_PBASE::getPropertyStates(aPropertyNames);
+ }
+ void SAL_CALL setAllPropertiesToDefault( ) override;
+ void SAL_CALL setPropertiesToDefault( const uno::Sequence< OUString >& aPropertyNames ) override;
+ uno::Sequence< uno::Any > SAL_CALL getPropertyDefaults( const uno::Sequence< OUString >& aPropertyNames ) override;
+};
+
+}
+
+OStyle::OStyle()
+:OStyle_PBASE(m_aBHelper)
+,m_aSize(21000,29700)
+{
+ const ::Size aDefaultSize = SvxPaperInfo::GetDefaultPaperSize( MapUnit::Map100thMM );
+ m_aSize.Height = aDefaultSize.Height();
+ m_aSize.Width = aDefaultSize.Width();
+
+ const sal_Int32 nMargin = 2000;
+ const sal_Int32 nBound = beans::PropertyAttribute::BOUND;
+ const sal_Int32 nMayBeVoid = beans::PropertyAttribute::MAYBEVOID;
+
+ sal_Int32 i = 0;
+ registerPropertyNoMember( PROPERTY_NAME, ++i, nBound, cppu::UnoType<OUString>::get(), css::uno::Any(OUString("Default")) );
+
+ registerPropertyNoMember(PROPERTY_BACKCOLOR, ++i,nBound, cppu::UnoType<sal_Int32>::get(), css::uno::Any(COL_TRANSPARENT));
+
+ registerPropertyNoMember(PROPERTY_BACKGRAPHICLOCATION, ++i,nBound, cppu::UnoType<style::GraphicLocation>::get(), css::uno::Any(style::GraphicLocation_NONE));
+ registerPropertyNoMember(PROPERTY_BACKTRANSPARENT, ++i,nBound,cppu::UnoType<bool>::get(), css::uno::Any(true));
+ registerPropertyNoMember(SC_UNO_PAGE_BORDERDIST, ++i,nBound, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)));
+ registerPropertyNoMember(SC_UNO_PAGE_BOTTBORDER, ++i,nBound, cppu::UnoType<table::BorderLine2>::get(), css::uno::Any(table::BorderLine2()));
+ registerPropertyNoMember(SC_UNO_PAGE_BOTTBRDDIST, ++i,nBound, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)));
+ registerPropertyNoMember(PROPERTY_BOTTOMMARGIN, ++i,nBound, cppu::UnoType<sal_Int32>::get(), css::uno::Any(nMargin));
+ registerPropertyNoMember("DisplayName", ++i,nBound, cppu::UnoType<OUString>::get(), css::uno::Any(OUString()));
+ registerPropertyNoMember(SC_UNO_PAGE_FTRBACKCOL, ++i,nBound, cppu::UnoType<sal_Int32>::get(), css::uno::Any(COL_TRANSPARENT));
+ registerPropertyNoMember(SC_UNO_PAGE_FTRGRFFILT, ++i,nBound, cppu::UnoType<OUString>::get(), css::uno::Any(OUString()));
+ registerPropertyNoMember(SC_UNO_PAGE_FTRGRFLOC, ++i,nBound, cppu::UnoType<style::GraphicLocation>::get(), css::uno::Any(style::GraphicLocation_NONE));
+ registerPropertyNoMember(SC_UNO_PAGE_FTRGRF, ++i,nBound|nMayBeVoid, cppu::UnoType<graphic::XGraphic>::get(), css::uno::Any(uno::Reference<graphic::XGraphic>()));
+ registerPropertyNoMember(SC_UNO_PAGE_FTRBACKTRAN, ++i,nBound,cppu::UnoType<bool>::get(), css::uno::Any(true));
+ registerPropertyNoMember(SC_UNO_PAGE_FTRBODYDIST, ++i,nBound, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)));
+ registerPropertyNoMember(SC_UNO_PAGE_FTRBRDDIST, ++i,nBound, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)));
+ registerPropertyNoMember(SC_UNO_PAGE_FTRBOTTBOR, ++i,nBound, cppu::UnoType<table::BorderLine2>::get(), css::uno::Any(table::BorderLine2()));
+ registerPropertyNoMember(SC_UNO_PAGE_FTRBOTTBDIS, ++i,nBound, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)));
+ registerPropertyNoMember(SC_UNO_PAGE_FTRHEIGHT, ++i,nBound, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)));
+ registerPropertyNoMember(SC_UNO_PAGE_FTRDYNAMIC, ++i,nBound,cppu::UnoType<bool>::get(), css::uno::Any(false));
+ registerPropertyNoMember(SC_UNO_PAGE_FTRON, ++i,nBound,cppu::UnoType<bool>::get(), css::uno::Any(false));
+ registerPropertyNoMember(SC_UNO_PAGE_FTRSHARED, ++i,nBound,cppu::UnoType<bool>::get(), css::uno::Any(false));
+ registerPropertyNoMember(SC_UNO_PAGE_FIRSTFTRSHARED, ++i,nBound,cppu::UnoType<bool>::get(), css::uno::Any(false));
+ registerPropertyNoMember(SC_UNO_PAGE_FTRLEFTBOR, ++i,nBound, cppu::UnoType<table::BorderLine2>::get(), css::uno::Any(table::BorderLine2()));
+ registerPropertyNoMember(SC_UNO_PAGE_FTRLEFTBDIS, ++i,nBound, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)));
+ registerPropertyNoMember(SC_UNO_PAGE_FTRLEFTMAR, ++i,nBound, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)));
+ registerPropertyNoMember(SC_UNO_PAGE_FTRRIGHTBOR, ++i,nBound, cppu::UnoType<table::BorderLine2>::get(), css::uno::Any(table::BorderLine2()));
+ registerPropertyNoMember(SC_UNO_PAGE_FTRRIGHTBDIS,++i,nBound, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)));
+ registerPropertyNoMember(SC_UNO_PAGE_FTRRIGHTMAR, ++i,nBound, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)));
+ registerPropertyNoMember(SC_UNO_PAGE_FTRSHADOW, ++i,nBound, cppu::UnoType<table::ShadowFormat>::get(), css::uno::Any(table::ShadowFormat()));
+ registerPropertyNoMember(SC_UNO_PAGE_FTRTOPBOR, ++i,nBound, cppu::UnoType<table::BorderLine2>::get(), css::uno::Any(table::BorderLine2()));
+ registerPropertyNoMember(SC_UNO_PAGE_FTRTOPBDIS, ++i,nBound, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)));
+
+ registerPropertyNoMember(SC_UNO_PAGE_HDRBACKCOL, ++i,nBound|nMayBeVoid, cppu::UnoType<sal_Int32>::get(), css::uno::Any(COL_TRANSPARENT));
+ registerPropertyNoMember(SC_UNO_PAGE_HDRGRFFILT, ++i,nBound|nMayBeVoid, cppu::UnoType<OUString>::get(), css::uno::Any(OUString()));
+ registerPropertyNoMember(SC_UNO_PAGE_HDRGRFLOC, ++i,nBound|nMayBeVoid, cppu::UnoType<style::GraphicLocation>::get(), css::uno::Any(style::GraphicLocation_NONE));
+ registerPropertyNoMember(SC_UNO_PAGE_HDRGRF, ++i,nBound|nMayBeVoid, cppu::UnoType<graphic::XGraphic>::get(), css::uno::Any(uno::Reference<graphic::XGraphic>()));
+ registerPropertyNoMember(SC_UNO_PAGE_HDRBACKTRAN, ++i,nBound|nMayBeVoid,cppu::UnoType<bool>::get(), css::uno::Any(true));
+ registerPropertyNoMember(SC_UNO_PAGE_HDRBODYDIST, ++i,nBound|nMayBeVoid, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)));
+ registerPropertyNoMember(SC_UNO_PAGE_HDRBRDDIST, ++i,nBound|nMayBeVoid, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)));
+ registerPropertyNoMember(SC_UNO_PAGE_HDRBOTTBOR, ++i,nBound|nMayBeVoid, cppu::UnoType<table::BorderLine2>::get(), css::uno::Any(table::BorderLine2()));
+ registerPropertyNoMember(SC_UNO_PAGE_HDRBOTTBDIS, ++i,nBound|nMayBeVoid, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)));
+ registerPropertyNoMember(SC_UNO_PAGE_HDRHEIGHT, ++i,nBound|nMayBeVoid, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)));
+ registerPropertyNoMember(SC_UNO_PAGE_HDRDYNAMIC, ++i,nBound|nMayBeVoid,cppu::UnoType<bool>::get(), css::uno::Any(false));
+ registerPropertyNoMember(SC_UNO_PAGE_HDRON, ++i,nBound|nMayBeVoid,cppu::UnoType<bool>::get(), css::uno::Any(false));
+ registerPropertyNoMember(SC_UNO_PAGE_HDRSHARED, ++i,nBound|nMayBeVoid,cppu::UnoType<bool>::get(), css::uno::Any(false));
+ registerPropertyNoMember(SC_UNO_PAGE_FIRSTHDRSHARED, ++i,nBound|nMayBeVoid,cppu::UnoType<bool>::get(), css::uno::Any(false));
+ registerPropertyNoMember(SC_UNO_PAGE_HDRLEFTBOR, ++i,nBound|nMayBeVoid, cppu::UnoType<table::BorderLine2>::get(), css::uno::Any(table::BorderLine2()));
+ registerPropertyNoMember(SC_UNO_PAGE_HDRLEFTBDIS, ++i,nBound|nMayBeVoid, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)));
+ registerPropertyNoMember(SC_UNO_PAGE_HDRLEFTMAR, ++i,nBound|nMayBeVoid, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)));
+ registerPropertyNoMember(SC_UNO_PAGE_HDRRIGHTBOR, ++i,nBound|nMayBeVoid, cppu::UnoType<table::BorderLine2>::get(), css::uno::Any(table::BorderLine2()));
+ registerPropertyNoMember(SC_UNO_PAGE_HDRRIGHTBDIS,++i,nBound|nMayBeVoid, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)));
+ registerPropertyNoMember(SC_UNO_PAGE_HDRRIGHTMAR, ++i,nBound|nMayBeVoid, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)));
+ registerPropertyNoMember(SC_UNO_PAGE_HDRSHADOW, ++i,nBound|nMayBeVoid, cppu::UnoType<table::ShadowFormat>::get(), css::uno::Any(table::ShadowFormat()));
+ registerPropertyNoMember(SC_UNO_PAGE_HDRTOPBOR, ++i,nBound|nMayBeVoid, cppu::UnoType<table::BorderLine2>::get(), css::uno::Any(table::BorderLine2()));
+ registerPropertyNoMember(SC_UNO_PAGE_HDRTOPBDIS, ++i,nBound|nMayBeVoid, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)));
+
+ registerProperty(PROPERTY_HEIGHT, ++i,nBound,&m_aSize.Height, ::cppu::UnoType<sal_Int32>::get() );
+ registerPropertyNoMember(PROPERTY_ISLANDSCAPE, ++i,nBound, cppu::UnoType<bool>::get(), css::uno::Any(false));
+ registerPropertyNoMember(SC_UNO_PAGE_LEFTBORDER, ++i,nBound, cppu::UnoType<table::BorderLine2>::get(), css::uno::Any(table::BorderLine2()));
+ registerPropertyNoMember(SC_UNO_PAGE_LEFTBRDDIST, ++i,nBound, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)));
+ registerPropertyNoMember(PROPERTY_LEFTMARGIN, ++i,beans::PropertyAttribute::BOUND, ::cppu::UnoType<sal_Int32>::get(), css::uno::Any(nMargin));
+ registerPropertyNoMember(PROPERTY_NUMBERINGTYPE, ++i,nBound, cppu::UnoType<sal_Int16>::get(), css::uno::Any(style::NumberingType::ARABIC));
+ registerPropertyNoMember(SC_UNO_PAGE_SCALEVAL, ++i,nBound, cppu::UnoType<sal_Int16>::get(), css::uno::Any(sal_Int16(0)));
+ registerPropertyNoMember(PROPERTY_PAGESTYLELAYOUT, ++i,nBound, cppu::UnoType<style::PageStyleLayout>::get(), css::uno::Any(style::PageStyleLayout_ALL));
+ registerPropertyNoMember(SC_UNO_PAGE_PAPERTRAY, ++i,nBound, cppu::UnoType<OUString>::get(), css::uno::Any(OUString("[From printer settings]")));
+ registerPropertyNoMember(SC_UNO_PAGE_RIGHTBORDER, ++i,nBound, cppu::UnoType<table::BorderLine2>::get(), css::uno::Any(table::BorderLine2()));
+ registerPropertyNoMember(SC_UNO_PAGE_RIGHTBRDDIST,++i,nBound, cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)));
+ registerPropertyNoMember(PROPERTY_RIGHTMARGIN, ++i,beans::PropertyAttribute::BOUND,::cppu::UnoType<sal_Int32>::get(), css::uno::Any(nMargin));
+ registerPropertyNoMember(SC_UNO_PAGE_SCALETOPAG, ++i,nBound, cppu::UnoType<sal_Int16>::get(), css::uno::Any(sal_Int16(0)));
+ registerPropertyNoMember(SC_UNO_PAGE_SCALETOX, ++i,nBound, cppu::UnoType<sal_Int16>::get(), css::uno::Any(sal_Int16(0)));
+ registerPropertyNoMember(SC_UNO_PAGE_SCALETOY, ++i,nBound, cppu::UnoType<sal_Int16>::get(), css::uno::Any(sal_Int16(0)));
+ registerPropertyNoMember(SC_UNO_PAGE_SHADOWFORM, ++i,nBound, cppu::UnoType<table::ShadowFormat>::get(), css::uno::Any(table::ShadowFormat()));
+ registerProperty(PROPERTY_PAPERSIZE, ++i,beans::PropertyAttribute::BOUND,&m_aSize, cppu::UnoType<awt::Size>::get() );
+ registerPropertyNoMember(SC_UNO_PAGE_TOPBORDER, ++i,nBound, cppu::UnoType<table::BorderLine2>::get(), css::uno::Any(table::BorderLine2()));
+ registerPropertyNoMember(SC_UNO_PAGE_TOPBRDDIST, ++i,nBound,::cppu::UnoType<sal_Int32>::get(), css::uno::Any(sal_Int32(0)));
+ registerPropertyNoMember(PROPERTY_TOPMARGIN, ++i,nBound,::cppu::UnoType<sal_Int32>::get(), css::uno::Any(nMargin));
+ registerPropertyNoMember("UserDefinedAttributes", ++i,nBound, cppu::UnoType<container::XNameContainer>::get(), css::uno::Any(comphelper::NameContainer_createInstance(cppu::UnoType<xml::AttributeData>::get())));
+ registerProperty(PROPERTY_WIDTH, ++i,nBound,&m_aSize.Width, cppu::UnoType<sal_Int32>::get() );
+ registerPropertyNoMember("PrinterName", ++i,nBound, cppu::UnoType<OUString>::get(), css::uno::Any(OUString()));
+ registerPropertyNoMember("PrinterSetup", ++i,nBound,cppu::UnoType<uno::Sequence<sal_Int8>>::get(), css::uno::Any(uno::Sequence<sal_Int8>()));
+
+
+}
+
+IMPLEMENT_FORWARD_XINTERFACE2(OStyle,TStyleBASE,OStyle_PBASE)
+
+uno::Reference< beans::XPropertySetInfo> SAL_CALL OStyle::getPropertySetInfo()
+{
+ return createPropertySetInfo( getInfoHelper() );
+}
+
+void OStyle::getPropertyDefaultByHandle( sal_Int32 /*_nHandle*/, uno::Any& /*_rDefault*/ ) const
+{
+}
+
+::cppu::IPropertyArrayHelper& OStyle::getInfoHelper()
+{
+ return *getArrayHelper();
+}
+
+::cppu::IPropertyArrayHelper* OStyle::createArrayHelper( ) const
+{
+ uno::Sequence< beans::Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+}
+
+// XStyle
+sal_Bool SAL_CALL OStyle::isUserDefined( )
+{
+ return false;
+}
+
+sal_Bool SAL_CALL OStyle::isInUse( )
+{
+ return true;
+}
+
+OUString SAL_CALL OStyle::getParentStyle( )
+{
+ return OUString();
+}
+
+void SAL_CALL OStyle::setParentStyle( const OUString& /*aParentStyle*/ )
+{
+}
+
+// XNamed
+OUString SAL_CALL OStyle::getName( )
+{
+ OUString sName;
+ getPropertyValue(PROPERTY_NAME) >>= sName;
+ return sName;
+}
+
+void SAL_CALL OStyle::setName( const OUString& aName )
+{
+ setPropertyValue(PROPERTY_NAME,uno::Any(aName));
+}
+
+void SAL_CALL OStyle::setAllPropertiesToDefault( )
+{
+}
+
+void SAL_CALL OStyle::setPropertiesToDefault( const uno::Sequence< OUString >& aPropertyNames )
+{
+ for(const OUString& rName : aPropertyNames)
+ setPropertyToDefault(rName);
+}
+
+uno::Sequence< uno::Any > SAL_CALL OStyle::getPropertyDefaults( const uno::Sequence< OUString >& aPropertyNames )
+{
+ uno::Sequence< uno::Any > aRet(aPropertyNames.getLength());
+ std::transform(aPropertyNames.begin(), aPropertyNames.end(), aRet.getArray(),
+ [this](const OUString& rName) -> uno::Any { return getPropertyDefault(rName); });
+ return aRet;
+}
+
+struct OReportDefinitionImpl
+{
+ uno::WeakReference< uno::XInterface > m_xParent;
+ ::comphelper::OInterfaceContainerHelper3<document::XStorageChangeListener> m_aStorageChangeListeners;
+ ::comphelper::OInterfaceContainerHelper3<util::XCloseListener> m_aCloseListener;
+ ::comphelper::OInterfaceContainerHelper3<util::XModifyListener> m_aModifyListeners;
+ ::comphelper::OInterfaceContainerHelper3<document::XEventListener> m_aLegacyEventListeners;
+ ::comphelper::OInterfaceContainerHelper3<document::XDocumentEventListener> m_aDocEventListeners;
+ ::std::vector< uno::Reference< frame::XController> > m_aControllers;
+ uno::Sequence< beans::PropertyValue > m_aArgs;
+
+ uno::Reference< report::XGroups > m_xGroups;
+ uno::Reference< report::XSection> m_xReportHeader;
+ uno::Reference< report::XSection> m_xReportFooter;
+ uno::Reference< report::XSection> m_xPageHeader;
+ uno::Reference< report::XSection> m_xPageFooter;
+ uno::Reference< report::XSection> m_xDetail;
+ uno::Reference< embed::XStorage > m_xStorage;
+ uno::Reference< frame::XController > m_xCurrentController;
+ uno::Reference< container::XIndexAccess > m_xViewData;
+ uno::Reference< container::XNameAccess > m_xStyles;
+ uno::Reference< container::XNameAccess> m_xXMLNamespaceMap;
+ uno::Reference< container::XNameAccess> m_xGradientTable;
+ uno::Reference< container::XNameAccess> m_xHatchTable;
+ uno::Reference< container::XNameAccess> m_xBitmapTable;
+ uno::Reference< container::XNameAccess> m_xTransparencyGradientTable;
+ uno::Reference< container::XNameAccess> m_xDashTable;
+ uno::Reference< container::XNameAccess> m_xMarkerTable;
+ uno::Reference< report::XFunctions > m_xFunctions;
+ uno::Reference< ui::XUIConfigurationManager2> m_xUIConfigurationManager;
+ uno::Reference< util::XNumberFormatsSupplier> m_xNumberFormatsSupplier;
+ uno::Reference< sdbc::XConnection> m_xActiveConnection;
+ uno::Reference< frame::XTitle > m_xTitleHelper;
+ uno::Reference< frame::XUntitledNumbers > m_xNumberedControllers;
+ uno::Reference< document::XDocumentProperties > m_xDocumentProperties;
+
+ std::shared_ptr< ::comphelper::EmbeddedObjectContainer>
+ m_pObjectContainer;
+ std::shared_ptr<rptui::OReportModel> m_pReportModel;
+ ::rtl::Reference< ::dbaui::UndoManager > m_pUndoManager;
+ OUString m_sCaption;
+ OUString m_sCommand;
+ OUString m_sFilter;
+ OUString m_sMimeType;
+ OUString m_sIdentifier;
+ OUString m_sDataSourceName;
+ awt::Size m_aVisualAreaSize;
+ ::sal_Int64 m_nAspect;
+ ::sal_Int16 m_nGroupKeepTogether;
+ ::sal_Int16 m_nPageHeaderOption;
+ ::sal_Int16 m_nPageFooterOption;
+ ::sal_Int32 m_nCommandType;
+ bool m_bControllersLocked;
+ bool m_bModified;
+ bool m_bEscapeProcessing;
+ bool m_bSetModifiedEnabled;
+
+ explicit OReportDefinitionImpl(::osl::Mutex& _aMutex)
+ :m_aStorageChangeListeners(_aMutex)
+ ,m_aCloseListener(_aMutex)
+ ,m_aModifyListeners(_aMutex)
+ ,m_aLegacyEventListeners(_aMutex)
+ ,m_aDocEventListeners(_aMutex)
+ ,m_sMimeType(MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII)
+ ,m_sIdentifier(SERVICE_REPORTDEFINITION)
+ // default visual area is 8 x 7 cm
+ ,m_aVisualAreaSize( 8000, 7000 )
+ ,m_nAspect(embed::Aspects::MSOLE_CONTENT)
+ ,m_nGroupKeepTogether(0)
+ ,m_nPageHeaderOption(0)
+ ,m_nPageFooterOption(0)
+ ,m_nCommandType(sdb::CommandType::TABLE)
+ ,m_bControllersLocked(false)
+ ,m_bModified(false)
+ ,m_bEscapeProcessing(true)
+ ,m_bSetModifiedEnabled( true )
+ {}
+};
+
+OReportDefinition::OReportDefinition(uno::Reference< uno::XComponentContext > const & _xContext)
+: ::cppu::BaseMutex(),
+ ReportDefinitionBase(m_aMutex),
+ ReportDefinitionPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,uno::Sequence< OUString >()),
+ ::comphelper::IEmbeddedHelper(),
+ m_aProps(std::make_shared<OReportComponentProperties>(_xContext)),
+ m_pImpl(std::make_shared<OReportDefinitionImpl>(m_aMutex))
+{
+ m_aProps->m_sName = RptResId(RID_STR_REPORT);
+ osl_atomic_increment(&m_refCount);
+ {
+ init();
+ m_pImpl->m_xGroups = new OGroups(this,m_aProps->m_xContext);
+ m_pImpl->m_xDetail = OSection::createOSection(this,m_aProps->m_xContext);
+ m_pImpl->m_xDetail->setName(RptResId(RID_STR_DETAIL));
+ }
+ osl_atomic_decrement( &m_refCount );
+}
+
+OReportDefinition::OReportDefinition(
+ uno::Reference< uno::XComponentContext > const & _xContext,
+ const uno::Reference< lang::XMultiServiceFactory>& _xFactory,
+ uno::Reference< drawing::XShape >& _xShape)
+: ::cppu::BaseMutex(),
+ ReportDefinitionBase(m_aMutex),
+ ReportDefinitionPropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,uno::Sequence< OUString >()),
+ ::comphelper::IEmbeddedHelper(),
+ m_aProps(std::make_shared<OReportComponentProperties>(_xContext)),
+ m_pImpl(std::make_shared<OReportDefinitionImpl>(m_aMutex))
+{
+ m_aProps->m_sName = RptResId(RID_STR_REPORT);
+ m_aProps->m_xFactory = _xFactory;
+ osl_atomic_increment(&m_refCount);
+ {
+ m_aProps->setShape(_xShape,this,m_refCount);
+ init();
+ m_pImpl->m_xGroups = new OGroups(this,m_aProps->m_xContext);
+ m_pImpl->m_xDetail = OSection::createOSection(this,m_aProps->m_xContext);
+ m_pImpl->m_xDetail->setName(RptResId(RID_STR_DETAIL));
+ }
+ osl_atomic_decrement( &m_refCount );
+}
+
+OReportDefinition::~OReportDefinition()
+{
+ if ( !ReportDefinitionBase::rBHelper.bInDispose && !ReportDefinitionBase::rBHelper.bDisposed )
+ {
+ acquire();
+ dispose();
+ }
+}
+
+IMPLEMENT_FORWARD_REFCOUNT( OReportDefinition, ReportDefinitionBase )
+void OReportDefinition::init()
+{
+ try
+ {
+ m_pImpl->m_pReportModel = std::make_shared<OReportModel>(this);
+ m_pImpl->m_pReportModel->GetItemPool().FreezeIdRanges();
+ m_pImpl->m_pReportModel->SetScaleUnit( MapUnit::Map100thMM );
+ SdrLayerAdmin& rAdmin = m_pImpl->m_pReportModel->GetLayerAdmin();
+ rAdmin.NewLayer("front", RPT_LAYER_FRONT.get());
+ rAdmin.NewLayer("back", RPT_LAYER_BACK.get());
+ rAdmin.NewLayer("HiddenLayer", RPT_LAYER_HIDDEN.get());
+
+ m_pImpl->m_pUndoManager = new ::dbaui::UndoManager( *this, m_aMutex );
+ m_pImpl->m_pReportModel->SetSdrUndoManager( &m_pImpl->m_pUndoManager->GetSfxUndoManager() );
+
+ m_pImpl->m_xFunctions = new OFunctions(this,m_aProps->m_xContext);
+ if ( !m_pImpl->m_xStorage.is() )
+ m_pImpl->m_xStorage = ::comphelper::OStorageHelper::GetTemporaryStorage();
+
+ uno::Reference<beans::XPropertySet> xStorProps(m_pImpl->m_xStorage,uno::UNO_QUERY);
+ if ( xStorProps.is())
+ {
+ OUString sMediaType;
+ xStorProps->getPropertyValue("MediaType") >>= sMediaType;
+ if ( sMediaType.isEmpty() )
+ xStorProps->setPropertyValue("MediaType",uno::Any(OUString(MIMETYPE_OASIS_OPENDOCUMENT_REPORT_ASCII)));
+ }
+ m_pImpl->m_pObjectContainer = std::make_shared<comphelper::EmbeddedObjectContainer>(m_pImpl->m_xStorage , static_cast<cppu::OWeakObject*>(this) );
+ }
+ catch (const uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("reportdesign");
+ }
+}
+
+void SAL_CALL OReportDefinition::dispose()
+{
+ ReportDefinitionPropertySet::dispose();
+ cppu::WeakComponentImplHelperBase::dispose();
+}
+
+void SAL_CALL OReportDefinition::disposing()
+{
+ notifyEvent("OnUnload");
+
+ uno::Reference< frame::XModel > xHoldAlive( this );
+
+ lang::EventObject aDisposeEvent( static_cast< ::cppu::OWeakObject* >( this ) );
+ m_pImpl->m_aModifyListeners.disposeAndClear( aDisposeEvent );
+ m_pImpl->m_aCloseListener.disposeAndClear( aDisposeEvent );
+ m_pImpl->m_aLegacyEventListeners.disposeAndClear( aDisposeEvent );
+ m_pImpl->m_aDocEventListeners.disposeAndClear( aDisposeEvent );
+ m_pImpl->m_aStorageChangeListeners.disposeAndClear( aDisposeEvent );
+
+ // SYNCHRONIZED --->
+ {
+ SolarMutexGuard aSolarGuard;
+ osl::MutexGuard aGuard(m_aMutex);
+
+ m_pImpl->m_aControllers.clear();
+
+ ::comphelper::disposeComponent(m_pImpl->m_xGroups);
+ m_pImpl->m_xReportHeader.clear();
+ m_pImpl->m_xReportFooter.clear();
+ m_pImpl->m_xPageHeader.clear();
+ m_pImpl->m_xPageFooter.clear();
+ m_pImpl->m_xDetail.clear();
+ ::comphelper::disposeComponent(m_pImpl->m_xFunctions);
+
+ //::comphelper::disposeComponent(m_pImpl->m_xStorage);
+ // don't dispose, this currently is the task of either the ref count going to
+ // 0, or of the embedded object (if we're embedded, which is the only possible
+ // case so far)
+ // #i78366#
+ m_pImpl->m_xStorage.clear();
+ m_pImpl->m_xViewData.clear();
+ m_pImpl->m_xCurrentController.clear();
+ m_pImpl->m_xNumberFormatsSupplier.clear();
+ m_pImpl->m_xStyles.clear();
+ m_pImpl->m_xXMLNamespaceMap.clear();
+ m_pImpl->m_xGradientTable.clear();
+ m_pImpl->m_xHatchTable.clear();
+ m_pImpl->m_xBitmapTable.clear();
+ m_pImpl->m_xTransparencyGradientTable.clear();
+ m_pImpl->m_xDashTable.clear();
+ m_pImpl->m_xMarkerTable.clear();
+ m_pImpl->m_xUIConfigurationManager.clear();
+ m_pImpl->m_pReportModel.reset();
+ m_pImpl->m_pObjectContainer.reset();
+ m_pImpl->m_aArgs.realloc(0);
+ m_pImpl->m_xTitleHelper.clear();
+ m_pImpl->m_xNumberedControllers.clear();
+ }
+ // <--- SYNCHRONIZED
+}
+
+
+OUString OReportDefinition::getImplementationName_Static( )
+{
+ return "com.sun.star.comp.report.OReportDefinition";
+}
+
+OUString SAL_CALL OReportDefinition::getImplementationName( )
+{
+ return getImplementationName_Static();
+}
+
+uno::Sequence< OUString > OReportDefinition::getSupportedServiceNames_Static( )
+{
+ uno::Sequence< OUString > aServices { SERVICE_REPORTDEFINITION };
+
+ return aServices;
+}
+
+uno::Sequence< OUString > SAL_CALL OReportDefinition::getSupportedServiceNames( )
+{
+ // first collect the services which are supported by our aggregate
+ uno::Sequence< OUString > aSupported;
+ if ( m_aProps->m_xServiceInfo.is() )
+ aSupported = m_aProps->m_xServiceInfo->getSupportedServiceNames();
+
+ // append our own service, if necessary
+ if ( ::comphelper::findValue( aSupported, SERVICE_REPORTDEFINITION ) == -1 )
+ {
+ sal_Int32 nLen = aSupported.getLength();
+ aSupported.realloc( nLen + 1 );
+ aSupported.getArray()[ nLen ] = SERVICE_REPORTDEFINITION;
+ }
+
+ // outta here
+ return aSupported;
+}
+
+sal_Bool SAL_CALL OReportDefinition::supportsService( const OUString& _rServiceName )
+{
+ return cppu::supportsService(this, _rServiceName);
+}
+
+uno::Any SAL_CALL OReportDefinition::queryInterface( const uno::Type& _rType )
+{
+ uno::Any aReturn = ReportDefinitionBase::queryInterface(_rType);
+ if ( !aReturn.hasValue() )
+ aReturn = ReportDefinitionPropertySet::queryInterface(_rType);
+
+ return aReturn.hasValue() ? aReturn : (m_aProps->m_xProxy.is() ? m_aProps->m_xProxy->queryAggregation(_rType) : aReturn);
+}
+uno::Sequence< uno::Type > SAL_CALL OReportDefinition::getTypes( )
+{
+ if ( m_aProps->m_xTypeProvider.is() )
+ return ::comphelper::concatSequences(
+ ReportDefinitionBase::getTypes(),
+ m_aProps->m_xTypeProvider->getTypes()
+ );
+ return ReportDefinitionBase::getTypes();
+}
+
+uno::Reference< uno::XInterface > OReportDefinition::create(uno::Reference< uno::XComponentContext > const & xContext)
+{
+ return *(new OReportDefinition(xContext));
+}
+
+// XReportDefinition
+OUString SAL_CALL OReportDefinition::getCaption()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->m_sCaption;
+}
+
+void SAL_CALL OReportDefinition::setCaption( const OUString& _caption )
+{
+ set(PROPERTY_CAPTION,_caption,m_pImpl->m_sCaption);
+}
+
+::sal_Int16 SAL_CALL OReportDefinition::getGroupKeepTogether()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->m_nGroupKeepTogether;
+}
+
+void SAL_CALL OReportDefinition::setGroupKeepTogether( ::sal_Int16 _groupkeeptogether )
+{
+ if ( _groupkeeptogether < report::GroupKeepTogether::PER_PAGE || _groupkeeptogether > report::GroupKeepTogether::PER_COLUMN )
+ throwIllegallArgumentException(u"css::report::GroupKeepTogether"
+ ,*this
+ ,1);
+ set(PROPERTY_GROUPKEEPTOGETHER,_groupkeeptogether,m_pImpl->m_nGroupKeepTogether);
+}
+
+::sal_Int16 SAL_CALL OReportDefinition::getPageHeaderOption()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->m_nPageHeaderOption;
+}
+
+void SAL_CALL OReportDefinition::setPageHeaderOption( ::sal_Int16 _pageheaderoption )
+{
+ if ( _pageheaderoption < report::ReportPrintOption::ALL_PAGES || _pageheaderoption > report::ReportPrintOption::NOT_WITH_REPORT_HEADER_FOOTER )
+ throwIllegallArgumentException(u"css::report::ReportPrintOption"
+ ,*this
+ ,1);
+ set(PROPERTY_PAGEHEADEROPTION,_pageheaderoption,m_pImpl->m_nPageHeaderOption);
+}
+
+::sal_Int16 SAL_CALL OReportDefinition::getPageFooterOption()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->m_nPageFooterOption;
+}
+
+void SAL_CALL OReportDefinition::setPageFooterOption( ::sal_Int16 _pagefooteroption )
+{
+ if ( _pagefooteroption < report::ReportPrintOption::ALL_PAGES || _pagefooteroption > report::ReportPrintOption::NOT_WITH_REPORT_HEADER_FOOTER )
+ throwIllegallArgumentException(u"css::report::ReportPrintOption"
+ ,*this
+ ,1);
+ set(PROPERTY_PAGEFOOTEROPTION,_pagefooteroption,m_pImpl->m_nPageFooterOption);
+}
+
+OUString SAL_CALL OReportDefinition::getCommand()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->m_sCommand;
+}
+
+void SAL_CALL OReportDefinition::setCommand( const OUString& _command )
+{
+ set(PROPERTY_COMMAND,_command,m_pImpl->m_sCommand);
+}
+
+::sal_Int32 SAL_CALL OReportDefinition::getCommandType()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->m_nCommandType;
+}
+
+void SAL_CALL OReportDefinition::setCommandType( ::sal_Int32 _commandtype )
+{
+ if ( _commandtype < sdb::CommandType::TABLE || _commandtype > sdb::CommandType::COMMAND )
+ throwIllegallArgumentException(u"css::sdb::CommandType"
+ ,*this
+ ,1);
+ set(PROPERTY_COMMANDTYPE,_commandtype,m_pImpl->m_nCommandType);
+}
+
+OUString SAL_CALL OReportDefinition::getFilter()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->m_sFilter;
+}
+
+void SAL_CALL OReportDefinition::setFilter( const OUString& _filter )
+{
+ set(PROPERTY_FILTER,_filter,m_pImpl->m_sFilter);
+}
+
+sal_Bool SAL_CALL OReportDefinition::getEscapeProcessing()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->m_bEscapeProcessing;
+}
+
+void SAL_CALL OReportDefinition::setEscapeProcessing( sal_Bool _escapeprocessing )
+{
+ set(PROPERTY_ESCAPEPROCESSING,_escapeprocessing,m_pImpl->m_bEscapeProcessing);
+}
+
+sal_Bool SAL_CALL OReportDefinition::getReportHeaderOn()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->m_xReportHeader.is();
+}
+
+void SAL_CALL OReportDefinition::setReportHeaderOn( sal_Bool _reportheaderon )
+{
+ if ( bool(_reportheaderon) != m_pImpl->m_xReportHeader.is() )
+ {
+ setSection(PROPERTY_REPORTHEADERON,_reportheaderon,RptResId(RID_STR_REPORT_HEADER),m_pImpl->m_xReportHeader);
+ }
+}
+
+sal_Bool SAL_CALL OReportDefinition::getReportFooterOn()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->m_xReportFooter.is();
+}
+
+void SAL_CALL OReportDefinition::setReportFooterOn( sal_Bool _reportfooteron )
+{
+ if ( bool(_reportfooteron) != m_pImpl->m_xReportFooter.is() )
+ {
+ setSection(PROPERTY_REPORTFOOTERON,_reportfooteron,RptResId(RID_STR_REPORT_FOOTER),m_pImpl->m_xReportFooter);
+ }
+}
+
+sal_Bool SAL_CALL OReportDefinition::getPageHeaderOn()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->m_xPageHeader.is();
+}
+
+void SAL_CALL OReportDefinition::setPageHeaderOn( sal_Bool _pageheaderon )
+{
+ if ( bool(_pageheaderon) != m_pImpl->m_xPageHeader.is() )
+ {
+ setSection(PROPERTY_PAGEHEADERON,_pageheaderon,RptResId(RID_STR_PAGE_HEADER),m_pImpl->m_xPageHeader);
+ }
+}
+
+sal_Bool SAL_CALL OReportDefinition::getPageFooterOn()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->m_xPageFooter.is();
+}
+
+void SAL_CALL OReportDefinition::setPageFooterOn( sal_Bool _pagefooteron )
+{
+ if ( bool(_pagefooteron) != m_pImpl->m_xPageFooter.is() )
+ {
+ setSection(PROPERTY_PAGEFOOTERON,_pagefooteron,RptResId(RID_STR_PAGE_FOOTER),m_pImpl->m_xPageFooter);
+ }
+}
+
+uno::Reference< report::XGroups > SAL_CALL OReportDefinition::getGroups()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->m_xGroups;
+}
+
+uno::Reference< report::XSection > SAL_CALL OReportDefinition::getReportHeader()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if ( !m_pImpl->m_xReportHeader.is() )
+ throw container::NoSuchElementException();
+ return m_pImpl->m_xReportHeader;
+}
+
+uno::Reference< report::XSection > SAL_CALL OReportDefinition::getPageHeader()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if ( !m_pImpl->m_xPageHeader.is() )
+ throw container::NoSuchElementException();
+ return m_pImpl->m_xPageHeader;
+}
+
+uno::Reference< report::XSection > SAL_CALL OReportDefinition::getDetail()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->m_xDetail;
+}
+
+uno::Reference< report::XSection > SAL_CALL OReportDefinition::getPageFooter()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if ( !m_pImpl->m_xPageFooter.is() )
+ throw container::NoSuchElementException();
+ return m_pImpl->m_xPageFooter;
+}
+
+uno::Reference< report::XSection > SAL_CALL OReportDefinition::getReportFooter()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if ( !m_pImpl->m_xReportFooter.is() )
+ throw container::NoSuchElementException();
+ return m_pImpl->m_xReportFooter;
+}
+
+uno::Reference< document::XEventBroadcaster > SAL_CALL OReportDefinition::getEventBroadcaster( )
+{
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ return this;
+}
+
+// XReportComponent
+REPORTCOMPONENT_MASTERDETAIL(OReportDefinition,*m_aProps)
+REPORTCOMPONENT_IMPL(OReportDefinition,*m_aProps)
+REPORTCOMPONENT_IMPL2(OReportDefinition,*m_aProps)
+
+uno::Reference< beans::XPropertySetInfo > SAL_CALL OReportDefinition::getPropertySetInfo( )
+{
+ return ReportDefinitionPropertySet::getPropertySetInfo();
+}
+
+void SAL_CALL OReportDefinition::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
+{
+ ReportDefinitionPropertySet::setPropertyValue( aPropertyName, aValue );
+}
+
+uno::Any SAL_CALL OReportDefinition::getPropertyValue( const OUString& PropertyName )
+{
+ return ReportDefinitionPropertySet::getPropertyValue( PropertyName);
+}
+
+void SAL_CALL OReportDefinition::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener )
+{
+ ReportDefinitionPropertySet::addPropertyChangeListener( aPropertyName, xListener );
+}
+
+void SAL_CALL OReportDefinition::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener )
+{
+ ReportDefinitionPropertySet::removePropertyChangeListener( aPropertyName, aListener );
+}
+
+void SAL_CALL OReportDefinition::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+{
+ ReportDefinitionPropertySet::addVetoableChangeListener( PropertyName, aListener );
+}
+
+void SAL_CALL OReportDefinition::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+{
+ ReportDefinitionPropertySet::removeVetoableChangeListener( PropertyName, aListener );
+}
+
+// XChild
+uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::getParent( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ uno::Reference< container::XChild > xChild;
+ comphelper::query_aggregation(m_aProps->m_xProxy,xChild);
+ if ( xChild.is() )
+ return xChild->getParent();
+ return m_pImpl->m_xParent;
+}
+
+void SAL_CALL OReportDefinition::setParent( const uno::Reference< uno::XInterface >& Parent )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ m_aProps->m_xParent = uno::Reference< container::XChild >(Parent,uno::UNO_QUERY);
+ m_pImpl->m_xParent = Parent;
+ uno::Reference< container::XChild > xChild;
+ comphelper::query_aggregation(m_aProps->m_xProxy,xChild);
+ if ( xChild.is() )
+ xChild->setParent(Parent);
+}
+
+// XCloneable
+uno::Reference< util::XCloneable > SAL_CALL OReportDefinition::createClone( )
+{
+ OSL_FAIL("Not yet implemented correctly");
+ uno::Reference< report::XReportComponent> xSource = this;
+ uno::Reference< report::XReportDefinition> xSet(cloneObject(xSource,m_aProps->m_xFactory,SERVICE_REPORTDEFINITION),uno::UNO_QUERY_THROW);
+ return xSet;
+}
+
+void OReportDefinition::setSection( const OUString& _sProperty
+ ,bool _bOn
+ ,const OUString& _sName
+ ,uno::Reference< report::XSection>& _member)
+{
+ BoundListeners l;
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ prepareSet(_sProperty, uno::Any(_member), uno::Any(_bOn), &l);
+
+ // create section if needed
+ if ( _bOn && !_member.is() )
+ _member = OSection::createOSection(this, getContext(), _sProperty == PROPERTY_PAGEHEADERON || _sProperty == PROPERTY_PAGEFOOTERON);
+ else if ( !_bOn )
+ ::comphelper::disposeComponent(_member);
+
+ if ( _member.is() )
+ _member->setName(_sName);
+ }
+ l.notify();
+}
+
+// XCloseBroadcaster
+void SAL_CALL OReportDefinition::addCloseListener( const uno::Reference< util::XCloseListener >& _xListener )
+{
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ if ( _xListener.is() )
+ m_pImpl->m_aCloseListener.addInterface(_xListener);
+}
+
+void SAL_CALL OReportDefinition::removeCloseListener( const uno::Reference< util::XCloseListener >& _xListener )
+{
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ m_pImpl->m_aCloseListener.removeInterface(_xListener);
+}
+
+// XCloseable
+void SAL_CALL OReportDefinition::close(sal_Bool bDeliverOwnership)
+{
+ SolarMutexGuard aSolarGuard;
+
+ ::osl::ResettableMutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ // notify our container listeners
+ lang::EventObject aEvt( static_cast< ::cppu::OWeakObject* >( this ) );
+ aGuard.clear();
+ m_pImpl->m_aCloseListener.forEach(
+ [&aEvt, &bDeliverOwnership] (uno::Reference<util::XCloseListener> const& xListener) {
+ return xListener->queryClosing(aEvt, bDeliverOwnership);
+ });
+ aGuard.reset();
+
+
+ ::std::vector< uno::Reference< frame::XController> > aCopy = m_pImpl->m_aControllers;
+ for (auto& rxController : aCopy)
+ {
+ if ( rxController.is() )
+ {
+ try
+ {
+ uno::Reference< util::XCloseable> xFrame( rxController->getFrame(), uno::UNO_QUERY );
+ if ( xFrame.is() )
+ xFrame->close( bDeliverOwnership );
+ }
+ catch (const util::CloseVetoException&) { throw; }
+ catch (const uno::Exception&)
+ {
+ TOOLS_WARN_EXCEPTION( "reportdesign", "ODatabaseDocument::impl_closeControllerFrames" );
+ }
+ }
+ }
+
+ aGuard.clear();
+ m_pImpl->m_aCloseListener.notifyEach(&util::XCloseListener::notifyClosing,aEvt);
+ aGuard.reset();
+
+ dispose();
+}
+
+// XModel
+sal_Bool SAL_CALL OReportDefinition::attachResource( const OUString& /*_rURL*/, const uno::Sequence< beans::PropertyValue >& _aArguments )
+{
+ // LLA: we had a deadlock problem in our context, so we get the SolarMutex earlier.
+ SolarMutexGuard aSolarGuard;
+
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed );
+ utl::MediaDescriptor aDescriptor( _aArguments );
+
+ m_pImpl->m_pUndoManager->GetSfxUndoManager().EnableUndo( false );
+ try
+ {
+ fillArgs(aDescriptor);
+ m_pImpl->m_pReportModel->SetModified(false);
+ }
+ catch (...)
+ {
+ m_pImpl->m_pUndoManager->GetSfxUndoManager().EnableUndo( true );
+ throw;
+ }
+ m_pImpl->m_pUndoManager->GetSfxUndoManager().EnableUndo( true );
+ return true;
+}
+
+void OReportDefinition::fillArgs(utl::MediaDescriptor& _aDescriptor)
+{
+ uno::Sequence<beans::PropertyValue> aComponentData;
+ aComponentData = _aDescriptor.getUnpackedValueOrDefault("ComponentData",aComponentData);
+ if ( aComponentData.hasElements() && (!m_pImpl->m_xActiveConnection.is() || !m_pImpl->m_xNumberFormatsSupplier.is()) )
+ {
+ ::comphelper::SequenceAsHashMap aComponentDataMap( aComponentData );
+ m_pImpl->m_xActiveConnection = aComponentDataMap.getUnpackedValueOrDefault("ActiveConnection",m_pImpl->m_xActiveConnection);
+ m_pImpl->m_xNumberFormatsSupplier = dbtools::getNumberFormats(m_pImpl->m_xActiveConnection);
+ }
+ if ( !m_pImpl->m_xNumberFormatsSupplier.is() )
+ {
+ m_pImpl->m_xNumberFormatsSupplier.set( util::NumberFormatsSupplier::createWithDefaultLocale( m_aProps->m_xContext ) );
+ }
+ lcl_stripLoadArguments( _aDescriptor, m_pImpl->m_aArgs );
+ OUString sCaption;
+ sCaption = _aDescriptor.getUnpackedValueOrDefault("DocumentTitle",sCaption);
+ setCaption(sCaption);
+}
+
+OUString SAL_CALL OReportDefinition::getURL( )
+{
+ return OUString();
+}
+
+uno::Sequence< beans::PropertyValue > SAL_CALL OReportDefinition::getArgs( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ return m_pImpl->m_aArgs;
+}
+
+void SAL_CALL OReportDefinition::connectController( const uno::Reference< frame::XController >& _xController )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ m_pImpl->m_aControllers.push_back(_xController);
+ if ( _xController.is() && m_pImpl->m_xViewData.is() )
+ {
+ sal_Int32 nCount = m_pImpl->m_xViewData->getCount();
+ if (nCount)
+ _xController->restoreViewData(m_pImpl->m_xViewData->getByIndex(nCount - 1));
+ }
+}
+
+void SAL_CALL OReportDefinition::disconnectController( const uno::Reference< frame::XController >& _xController )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ ::std::vector< uno::Reference< frame::XController> >::iterator aFind = ::std::find(m_pImpl->m_aControllers.begin(),m_pImpl->m_aControllers.end(),_xController);
+ if ( aFind != m_pImpl->m_aControllers.end() )
+ m_pImpl->m_aControllers.erase(aFind);
+ if ( m_pImpl->m_xCurrentController == _xController )
+ m_pImpl->m_xCurrentController.clear();
+}
+
+void SAL_CALL OReportDefinition::lockControllers( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ m_pImpl->m_bControllersLocked = true;
+}
+
+void SAL_CALL OReportDefinition::unlockControllers( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ m_pImpl->m_bControllersLocked = false;
+}
+
+sal_Bool SAL_CALL OReportDefinition::hasControllersLocked( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ return m_pImpl->m_bControllersLocked;
+}
+
+uno::Reference< frame::XController > SAL_CALL OReportDefinition::getCurrentController( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ return m_pImpl->m_xCurrentController;
+}
+
+void SAL_CALL OReportDefinition::setCurrentController( const uno::Reference< frame::XController >& _xController )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ if ( ::std::find(m_pImpl->m_aControllers.begin(),m_pImpl->m_aControllers.end(),_xController) == m_pImpl->m_aControllers.end() )
+ throw container::NoSuchElementException();
+ m_pImpl->m_xCurrentController = _xController;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::getCurrentSelection( )
+{
+ return uno::Reference< uno::XInterface >();
+}
+
+void OReportDefinition::impl_loadFromStorage_nolck_throw( const uno::Reference< embed::XStorage >& _xStorageToLoadFrom,
+ const uno::Sequence< beans::PropertyValue >& _aMediaDescriptor )
+{
+ m_pImpl->m_xStorage = _xStorageToLoadFrom;
+
+ utl::MediaDescriptor aDescriptor( _aMediaDescriptor );
+ fillArgs(aDescriptor);
+ aDescriptor.createItemIfMissing("Storage",uno::Any(_xStorageToLoadFrom));
+
+ uno::Sequence< uno::Any > aDelegatorArguments(_aMediaDescriptor.getLength());
+ uno::Any* pIter = aDelegatorArguments.getArray();
+ uno::Any* pEnd = pIter + aDelegatorArguments.getLength();
+ for(sal_Int32 i = 0;pIter != pEnd;++pIter,++i)
+ {
+ *pIter <<= _aMediaDescriptor[i];
+ }
+ sal_Int32 nPos = aDelegatorArguments.getLength();
+ aDelegatorArguments.realloc(nPos+1);
+ beans::PropertyValue aPropVal;
+ aPropVal.Name = "Storage";
+ aPropVal.Value <<= _xStorageToLoadFrom;
+ aDelegatorArguments.getArray()[nPos] <<= aPropVal;
+
+ rptui::OXUndoEnvironment& rEnv = m_pImpl->m_pReportModel->GetUndoEnv();
+ rptui::OXUndoEnvironment::OUndoEnvLock aLock(rEnv);
+ {
+ uno::Reference< document::XFilter > xFilter(
+ m_aProps->m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.comp.report.OReportFilter",aDelegatorArguments,m_aProps->m_xContext),
+ uno::UNO_QUERY_THROW );
+
+ uno::Reference< document::XImporter> xImporter(xFilter,uno::UNO_QUERY_THROW);
+ uno::Reference<XComponent> xComponent(static_cast<OWeakObject*>(this),uno::UNO_QUERY);
+ xImporter->setTargetDocument(xComponent);
+
+ utl::MediaDescriptor aTemp;
+ aTemp << aDelegatorArguments;
+ xFilter->filter(aTemp.getAsConstPropertyValueList());
+
+ lcl_setModelReadOnly(m_pImpl->m_xStorage,m_pImpl->m_pReportModel);
+ m_pImpl->m_pObjectContainer->SwitchPersistence(m_pImpl->m_xStorage);
+ }
+}
+
+// XStorageBasedDocument
+void SAL_CALL OReportDefinition::loadFromStorage( const uno::Reference< embed::XStorage >& _xStorageToLoadFrom
+ , const uno::Sequence< beans::PropertyValue >& _aMediaDescriptor )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+
+ impl_loadFromStorage_nolck_throw( _xStorageToLoadFrom, _aMediaDescriptor );
+}
+
+void SAL_CALL OReportDefinition::storeToStorage( const uno::Reference< embed::XStorage >& _xStorageToSaveTo, const uno::Sequence< beans::PropertyValue >& _aMediaDescriptor )
+{
+ if ( !_xStorageToSaveTo.is() )
+ throw lang::IllegalArgumentException(RptResId(RID_STR_ARGUMENT_IS_NULL),*this,1);
+
+ SolarMutexGuard aSolarGuard;
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ // create XStatusIndicator
+ uno::Reference<task::XStatusIndicator> xStatusIndicator;
+ uno::Sequence< uno::Any > aDelegatorArguments;
+ utl::MediaDescriptor aDescriptor( _aMediaDescriptor );
+ lcl_extractAndStartStatusIndicator( aDescriptor, xStatusIndicator, aDelegatorArguments );
+ bool AutoSaveEvent = false;
+ aDescriptor[utl::MediaDescriptor::PROP_AUTOSAVEEVENT] >>= AutoSaveEvent;
+
+ // properties
+ uno::Sequence < beans::PropertyValue > aProps;
+
+ // export sub streams for package, else full stream into a file
+ uno::Reference< beans::XPropertySet> xProp(_xStorageToSaveTo,uno::UNO_QUERY);
+ if ( xProp.is() )
+ {
+ static constexpr OUStringLiteral sPropName = u"MediaType";
+ OUString sOldMediaType;
+ xProp->getPropertyValue(sPropName) >>= sOldMediaType;
+ if ( !xProp->getPropertyValue(sPropName).hasValue() || sOldMediaType.isEmpty() || MIMETYPE_OASIS_OPENDOCUMENT_REPORT_ASCII != sOldMediaType )
+ xProp->setPropertyValue( sPropName, uno::Any(OUString(MIMETYPE_OASIS_OPENDOCUMENT_REPORT_ASCII)) );
+ }
+
+ /** property map for export info set */
+ static comphelper::PropertyMapEntry const aExportInfoMap[] =
+ {
+ { OUString("UsePrettyPrinting") , 0, cppu::UnoType<sal_Bool>::get(), beans::PropertyAttribute::MAYBEVOID, 0 },
+ { OUString("StreamName") , 0, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0 },
+ { OUString("StreamRelPath") , 0, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0 },
+ { OUString("BaseURI") , 0, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0 },
+ };
+ uno::Reference< beans::XPropertySet > xInfoSet( comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aExportInfoMap ) ) );
+
+ xInfoSet->setPropertyValue("UsePrettyPrinting", uno::Any(officecfg::Office::Common::Save::Document::PrettyPrinting::get()));
+ if ( officecfg::Office::Common::Save::URL::FileSystem::get() )
+ {
+ const OUString sVal( aDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_DOCUMENTBASEURL, OUString()) );
+ xInfoSet->setPropertyValue("BaseURI", uno::Any(sVal));
+ }
+ const OUString sHierarchicalDocumentName( aDescriptor.getUnpackedValueOrDefault("HierarchicalDocumentName",OUString()) );
+ xInfoSet->setPropertyValue("StreamRelPath", uno::Any(sHierarchicalDocumentName));
+
+
+ sal_Int32 nArgsLen = aDelegatorArguments.getLength();
+ aDelegatorArguments.realloc(nArgsLen+3);
+ auto pDelegatorArguments = aDelegatorArguments.getArray();
+ pDelegatorArguments[nArgsLen++] <<= xInfoSet;
+
+ uno::Reference< document::XEmbeddedObjectResolver > xObjectResolver;
+ uno::Reference<document::XGraphicStorageHandler> xGraphicStorageHandler;
+ rtl::Reference<SvXMLGraphicHelper> xGraphicHelper = SvXMLGraphicHelper::Create(_xStorageToSaveTo,SvXMLGraphicHelperMode::Write);
+ xGraphicStorageHandler = xGraphicHelper.get();
+ xGraphicHelper.clear();
+ xObjectResolver = SvXMLEmbeddedObjectHelper::Create( _xStorageToSaveTo,*this, SvXMLEmbeddedObjectHelperMode::Write ).get();
+
+ pDelegatorArguments[nArgsLen++] <<= xGraphicStorageHandler;
+ pDelegatorArguments[nArgsLen++] <<= xObjectResolver;
+
+ uno::Reference<XComponent> xCom(static_cast<OWeakObject*>(this),uno::UNO_QUERY);
+ // Try to write to settings.xml, meta.xml, and styles.xml; only really care about success of
+ // write to content.xml (keeping logic of commit 94ccba3eebc83b58e74e18f0e028c6a995ce6aa6)
+ xInfoSet->setPropertyValue("StreamName", uno::Any(OUString("settings.xml")));
+ WriteThroughComponent(xCom, "settings.xml", "com.sun.star.comp.report.XMLSettingsExporter",
+ aDelegatorArguments, aProps, _xStorageToSaveTo);
+
+ xInfoSet->setPropertyValue("StreamName", uno::Any(OUString("meta.xml")));
+ WriteThroughComponent(xCom, "meta.xml", "com.sun.star.comp.report.XMLMetaExporter",
+ aDelegatorArguments, aProps, _xStorageToSaveTo);
+
+ xInfoSet->setPropertyValue("StreamName", uno::Any(OUString("styles.xml")));
+ WriteThroughComponent(xCom, "styles.xml", "com.sun.star.comp.report.XMLStylesExporter",
+ aDelegatorArguments, aProps, _xStorageToSaveTo);
+
+ xInfoSet->setPropertyValue("StreamName", uno::Any(OUString("content.xml")));
+ bool bOk = WriteThroughComponent(xCom, "content.xml", "com.sun.star.comp.report.ExportFilter",
+ aDelegatorArguments, aProps, _xStorageToSaveTo);
+
+ uno::Any aImage;
+ uno::Reference< embed::XVisualObject > xCurrentController(getCurrentController(),uno::UNO_QUERY);
+ if ( xCurrentController.is() )
+ {
+ xCurrentController->setVisualAreaSize(m_pImpl->m_nAspect,m_pImpl->m_aVisualAreaSize);
+ aImage = xCurrentController->getPreferredVisualRepresentation( m_pImpl->m_nAspect ).Data;
+ }
+ if ( aImage.hasValue() )
+ {
+ uno::Sequence<sal_Int8> aSeq;
+ aImage >>= aSeq;
+ uno::Reference<io::XInputStream> xStream = new ::comphelper::SequenceInputStream( aSeq );
+ m_pImpl->m_pObjectContainer->InsertGraphicStreamDirectly(xStream, "report", "image/png");
+ }
+
+ if (bOk)
+ {
+ bool bPersist = false;
+ if ( _xStorageToSaveTo == m_pImpl->m_xStorage )
+ bPersist = m_pImpl->m_pObjectContainer->StoreChildren(true,false);
+ else
+ bPersist = m_pImpl->m_pObjectContainer->StoreAsChildren(true,true,AutoSaveEvent,_xStorageToSaveTo);
+
+ if( bPersist )
+ m_pImpl->m_pObjectContainer->SetPersistentEntries(m_pImpl->m_xStorage);
+ try
+ {
+ uno::Reference<embed::XTransactedObject> xTransact(_xStorageToSaveTo,uno::UNO_QUERY);
+ if ( xTransact.is() )
+ xTransact->commit();
+ }
+ catch (const uno::Exception&)
+ {
+ TOOLS_WARN_EXCEPTION( "reportdesign", "Could not commit report storage!");
+ throw io::IOException();
+ }
+
+ if ( _xStorageToSaveTo == m_pImpl->m_xStorage )
+ setModified(false);
+ }
+ if ( xStatusIndicator.is() )
+ xStatusIndicator->end();
+}
+
+void SAL_CALL OReportDefinition::switchToStorage(
+ const uno::Reference< embed::XStorage >& xStorage)
+{
+ if (!xStorage.is())
+ throw lang::IllegalArgumentException(RptResId(RID_STR_ARGUMENT_IS_NULL),*this,1);
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ m_pImpl->m_xStorage = xStorage;
+ lcl_setModelReadOnly(m_pImpl->m_xStorage,m_pImpl->m_pReportModel);
+ m_pImpl->m_pObjectContainer->SwitchPersistence(m_pImpl->m_xStorage);
+ }
+ // notify our container listeners
+ m_pImpl->m_aStorageChangeListeners.forEach(
+ [this, &xStorage] (uno::Reference<document::XStorageChangeListener> const& xListener) {
+ return xListener->notifyStorageChange(static_cast<OWeakObject*>(this), xStorage);
+ });
+}
+
+uno::Reference< embed::XStorage > SAL_CALL OReportDefinition::getDocumentStorage( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ return m_pImpl->m_xStorage;
+}
+
+void SAL_CALL OReportDefinition::addStorageChangeListener( const uno::Reference< document::XStorageChangeListener >& xListener )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ if ( xListener.is() )
+ m_pImpl->m_aStorageChangeListeners.addInterface(xListener);
+}
+
+void SAL_CALL OReportDefinition::removeStorageChangeListener( const uno::Reference< document::XStorageChangeListener >& xListener )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ m_pImpl->m_aStorageChangeListeners.removeInterface(xListener);
+}
+
+bool OReportDefinition::WriteThroughComponent(
+ const uno::Reference<lang::XComponent> & xComponent,
+ const char* pStreamName,
+ const char* pServiceName,
+ const uno::Sequence<uno::Any> & rArguments,
+ const uno::Sequence<beans::PropertyValue> & rMediaDesc,
+ const uno::Reference<embed::XStorage>& _xStorageToSaveTo)
+{
+ OSL_ENSURE( nullptr != pStreamName, "Need stream name!" );
+ OSL_ENSURE( nullptr != pServiceName, "Need service name!" );
+
+ // open stream
+ OUString sStreamName = OUString::createFromAscii( pStreamName );
+ uno::Reference<io::XStream> xStream = _xStorageToSaveTo->openStreamElement( sStreamName,embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
+ if ( !xStream.is() )
+ return false;
+ uno::Reference<io::XOutputStream> xOutputStream = xStream->getOutputStream();
+ OSL_ENSURE(xOutputStream.is(), "Can't create output stream in package!");
+ if ( ! xOutputStream.is() )
+ return false;
+
+ uno::Reference<beans::XPropertySet> xStreamProp(xOutputStream,uno::UNO_QUERY);
+ OSL_ENSURE(xStreamProp.is(),"No valid property set for the output stream!");
+
+ uno::Reference<io::XSeekable> xSeek(xStreamProp,uno::UNO_QUERY);
+ if ( xSeek.is() )
+ {
+ xSeek->seek(0);
+ }
+
+ xStreamProp->setPropertyValue( "MediaType", uno::Any(OUString("text/xml")) );
+
+ // encrypt all streams
+ xStreamProp->setPropertyValue( "UseCommonStoragePasswordEncryption",
+ uno::Any( true ) );
+
+ // set buffer and create outputstream
+
+ // write the stuff
+ bool bRet = WriteThroughComponent(
+ xOutputStream, xComponent,
+ pServiceName, rArguments, rMediaDesc );
+ // finally, commit stream.
+ return bRet;
+}
+
+bool OReportDefinition::WriteThroughComponent(
+ const uno::Reference<io::XOutputStream> & xOutputStream,
+ const uno::Reference<lang::XComponent> & xComponent,
+ const char* pServiceName,
+ const uno::Sequence<uno::Any> & rArguments,
+ const uno::Sequence<beans::PropertyValue> & rMediaDesc)
+{
+ OSL_ENSURE( xOutputStream.is(), "I really need an output stream!" );
+ OSL_ENSURE( xComponent.is(), "Need component!" );
+ OSL_ENSURE( nullptr != pServiceName, "Need component name!" );
+
+ // get component
+ uno::Reference< xml::sax::XWriter > xSaxWriter(
+ xml::sax::Writer::create(m_aProps->m_xContext) );
+
+ // connect XML writer to output stream
+ xSaxWriter->setOutputStream( xOutputStream );
+
+ // prepare arguments (prepend doc handler to given arguments)
+ uno::Sequence<uno::Any> aArgs( 1 + rArguments.getLength() );
+ auto pArgs = aArgs.getArray();
+ *pArgs <<= xSaxWriter;
+ std::copy(rArguments.begin(), rArguments.end(), std::next(pArgs));
+
+ // get filter component
+ uno::Reference< document::XExporter > xExporter(
+ m_aProps->m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+ OUString::createFromAscii(pServiceName), aArgs,m_aProps->m_xContext), uno::UNO_QUERY);
+ OSL_ENSURE( xExporter.is(),
+ "can't instantiate export filter component" );
+ if( !xExporter.is() )
+ return false;
+
+ // connect model and filter
+ xExporter->setSourceDocument( xComponent );
+
+ // filter!
+ uno::Reference<document::XFilter> xFilter( xExporter, uno::UNO_QUERY );
+ return xFilter->filter( rMediaDesc );
+}
+
+// XLoadable
+void SAL_CALL OReportDefinition::initNew( )
+{
+ setPageHeaderOn( true );
+ setPageFooterOn( true );
+}
+
+void SAL_CALL OReportDefinition::load( const uno::Sequence< beans::PropertyValue >& _rArguments )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+
+ // TODO: this code is pretty similar to what happens in ODatabaseModelImpl::getOrCreateRootStorage,
+ // perhaps we can share code here.
+
+ ::comphelper::NamedValueCollection aArguments( _rArguments );
+
+ // the source for the to-be-created storage: either a URL, or a stream
+ uno::Reference< io::XInputStream > xStream;
+ OUString sURL;
+
+ if ( aArguments.has( "Stream" ) )
+ {
+ aArguments.get_ensureType( "Stream", xStream );
+ aArguments.remove( "Stream" );
+ }
+ else if ( aArguments.has( "InputStream" ) )
+ {
+ aArguments.get_ensureType( "InputStream", xStream );
+ aArguments.remove( "InputStream" );
+ }
+
+ if ( aArguments.has( "FileName" ) )
+ {
+ aArguments.get_ensureType( "FileName", sURL );
+ aArguments.remove( "FileName" );
+ }
+ else if ( aArguments.has( "URL" ) )
+ {
+ aArguments.get_ensureType( "URL", sURL );
+ aArguments.remove( "URL" );
+ }
+
+ uno::Any aStorageSource;
+ if ( xStream.is() )
+ aStorageSource <<= xStream;
+ else if ( !sURL.isEmpty() )
+ aStorageSource <<= sURL;
+ else
+ throw lang::IllegalArgumentException(
+ "No input source (URL or InputStream) found.",
+ // TODO: resource
+ *this,
+ 1
+ );
+
+ uno::Reference< lang::XSingleServiceFactory > xStorageFactory( embed::StorageFactory::create( m_aProps->m_xContext ) );
+
+ // open read-write per default, unless told otherwise in the MediaDescriptor
+ uno::Reference< embed::XStorage > xDocumentStorage;
+ const sal_Int32 nOpenModes[2] = {
+ embed::ElementModes::READWRITE,
+ embed::ElementModes::READ
+ };
+ size_t nFirstOpenMode = 0;
+ if ( aArguments.has( "ReadOnly" ) )
+ {
+ bool bReadOnly = false;
+ aArguments.get_ensureType( "ReadOnly", bReadOnly );
+ nFirstOpenMode = bReadOnly ? 1 : 0;
+ }
+ const size_t nLastOpenMode = SAL_N_ELEMENTS( nOpenModes ) - 1;
+ for ( size_t i=nFirstOpenMode; i <= nLastOpenMode; ++i )
+ {
+ uno::Sequence< uno::Any > aStorageCreationArgs{ aStorageSource, uno::Any(nOpenModes[i]) };
+
+ try
+ {
+ xDocumentStorage.set( xStorageFactory->createInstanceWithArguments( aStorageCreationArgs ), uno::UNO_QUERY_THROW );
+ }
+ catch (const uno::Exception&)
+ {
+ if ( i == nLastOpenMode )
+ {
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw lang::WrappedTargetException(
+ "An error occurred while creating the document storage.",
+ // TODO: resource
+ *this,
+ anyEx
+ );
+ }
+ }
+ }
+
+ if ( !xDocumentStorage.is() )
+ {
+ throw uno::RuntimeException();
+ }
+
+ if (!aArguments.has("DocumentBaseURL") && !sURL.isEmpty())
+ {
+ aArguments.put("DocumentBaseURL", sURL);
+ }
+
+ impl_loadFromStorage_nolck_throw( xDocumentStorage, aArguments.getPropertyValues() );
+ // TODO: do we need to take ownership of the storage? In opposite to loadFromStorage, we created the storage
+ // ourself here, and perhaps this means we're also responsible for it ...?
+}
+
+// XVisualObject
+void SAL_CALL OReportDefinition::setVisualAreaSize( ::sal_Int64 _nAspect, const awt::Size& _aSize )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ bool bChanged =
+ (m_pImpl->m_aVisualAreaSize.Width != _aSize.Width ||
+ m_pImpl->m_aVisualAreaSize.Height != _aSize.Height);
+ m_pImpl->m_aVisualAreaSize = _aSize;
+ if( bChanged )
+ setModified( true );
+ m_pImpl->m_nAspect = _nAspect;
+}
+
+awt::Size SAL_CALL OReportDefinition::getVisualAreaSize( ::sal_Int64 /*_nAspect*/ )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ return m_pImpl->m_aVisualAreaSize;
+}
+
+embed::VisualRepresentation SAL_CALL OReportDefinition::getPreferredVisualRepresentation( ::sal_Int64 /*_nAspect*/ )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ embed::VisualRepresentation aResult;
+ OUString sMimeType;
+ uno::Reference<io::XInputStream> xStream = m_pImpl->m_pObjectContainer->GetGraphicStream("report", &sMimeType);
+ if ( xStream.is() )
+ {
+ uno::Sequence<sal_Int8> aSeq;
+ xStream->readBytes(aSeq,xStream->available());
+ xStream->closeInput();
+ aResult.Data <<= aSeq;
+ aResult.Flavor.MimeType = sMimeType;
+ aResult.Flavor.DataType = cppu::UnoType<decltype(aSeq)>::get();
+ }
+
+ return aResult;
+}
+
+::sal_Int32 SAL_CALL OReportDefinition::getMapUnit( ::sal_Int64 /*nAspect*/ )
+{
+ return embed::EmbedMapUnits::ONE_100TH_MM;
+}
+
+// XModifiable
+sal_Bool SAL_CALL OReportDefinition::disableSetModified( )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed );
+
+ const bool bWasEnabled = m_pImpl->m_bSetModifiedEnabled;
+ m_pImpl->m_bSetModifiedEnabled = false;
+ return bWasEnabled;
+}
+
+sal_Bool SAL_CALL OReportDefinition::enableSetModified( )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed );
+
+ const bool bWasEnabled = m_pImpl->m_bSetModifiedEnabled;
+ m_pImpl->m_bSetModifiedEnabled = true;
+ return bWasEnabled;
+}
+
+sal_Bool SAL_CALL OReportDefinition::isSetModifiedEnabled( )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed );
+
+ return m_pImpl->m_bSetModifiedEnabled;
+}
+
+// XModifiable
+sal_Bool SAL_CALL OReportDefinition::isModified( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ return m_pImpl->m_bModified;
+}
+
+void SAL_CALL OReportDefinition::setModified( sal_Bool _bModified )
+{
+ osl::ClearableMutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+
+ if ( !m_pImpl->m_bSetModifiedEnabled )
+ return;
+
+ if ( m_pImpl->m_pReportModel->IsReadOnly() && _bModified )
+ throw beans::PropertyVetoException();
+ if ( m_pImpl->m_bModified != bool(_bModified) )
+ {
+ m_pImpl->m_bModified = _bModified;
+ if ( m_pImpl->m_pReportModel->IsChanged() != bool(_bModified) )
+ m_pImpl->m_pReportModel->SetChanged(_bModified);
+
+ lang::EventObject aEvent(*this);
+ aGuard.clear();
+ m_pImpl->m_aModifyListeners.notifyEach(&util::XModifyListener::modified,aEvent);
+ notifyEvent("OnModifyChanged");
+ }
+}
+
+// XModifyBroadcaster
+void SAL_CALL OReportDefinition::addModifyListener( const uno::Reference< util::XModifyListener >& _xListener )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ if ( _xListener.is() )
+ m_pImpl->m_aModifyListeners.addInterface(_xListener);
+}
+
+void SAL_CALL OReportDefinition::removeModifyListener( const uno::Reference< util::XModifyListener >& _xListener )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ m_pImpl->m_aModifyListeners.removeInterface(_xListener);
+}
+
+void OReportDefinition::notifyEvent(const OUString& _sEventName)
+{
+ try
+ {
+ osl::ClearableMutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ document::EventObject aEvt(*this, _sEventName);
+ aGuard.clear();
+ m_pImpl->m_aLegacyEventListeners.notifyEach(&document::XEventListener::notifyEvent,aEvt);
+ }
+ catch (const uno::Exception&)
+ {
+ }
+
+ notifyDocumentEvent(_sEventName, nullptr, css::uno::Any());
+}
+
+// document::XDocumentEventBroadcaster
+void SAL_CALL OReportDefinition::notifyDocumentEvent( const OUString& rEventName, const uno::Reference< frame::XController2 >& rViewController, const uno::Any& rSupplement )
+{
+ try
+ {
+ osl::ClearableMutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ document::DocumentEvent aEvt(*this, rEventName, rViewController, rSupplement);
+ aGuard.clear();
+ m_pImpl->m_aDocEventListeners.notifyEach(&document::XDocumentEventListener::documentEventOccured,aEvt);
+ }
+ catch (const uno::Exception&)
+ {
+ }
+}
+
+void SAL_CALL OReportDefinition::addDocumentEventListener( const uno::Reference< document::XDocumentEventListener >& rListener )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ if ( rListener.is() )
+ m_pImpl->m_aDocEventListeners.addInterface(rListener);
+}
+
+void SAL_CALL OReportDefinition::removeDocumentEventListener( const uno::Reference< document::XDocumentEventListener >& rListener )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ m_pImpl->m_aDocEventListeners.removeInterface(rListener);
+}
+
+// document::XEventBroadcaster
+void SAL_CALL OReportDefinition::addEventListener(const uno::Reference< document::XEventListener >& _xListener )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ if ( _xListener.is() )
+ m_pImpl->m_aLegacyEventListeners.addInterface(_xListener);
+}
+
+void SAL_CALL OReportDefinition::removeEventListener( const uno::Reference< document::XEventListener >& _xListener )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ m_pImpl->m_aLegacyEventListeners.removeInterface(_xListener);
+}
+
+// document::XViewDataSupplier
+uno::Reference< container::XIndexAccess > SAL_CALL OReportDefinition::getViewData( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ if ( !m_pImpl->m_xViewData.is() )
+ {
+ rtl::Reference<comphelper::IndexedPropertyValuesContainer> xNewViewData = new comphelper::IndexedPropertyValuesContainer();
+ m_pImpl->m_xViewData = xNewViewData;
+ for (const auto& rxController : m_pImpl->m_aControllers)
+ {
+ if ( rxController.is() )
+ {
+ try
+ {
+ xNewViewData->insertByIndex(xNewViewData->getCount(), rxController->getViewData());
+ }
+ catch (const uno::Exception&)
+ {
+ }
+ }
+ }
+
+ }
+ return m_pImpl->m_xViewData;
+}
+
+void SAL_CALL OReportDefinition::setViewData( const uno::Reference< container::XIndexAccess >& Data )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ m_pImpl->m_xViewData = Data;
+}
+
+uno::Reference< report::XFunctions > SAL_CALL OReportDefinition::getFunctions()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ return m_pImpl->m_xFunctions;
+}
+
+uno::Reference< ui::XUIConfigurationManager > SAL_CALL OReportDefinition::getUIConfigurationManager( )
+{
+ return uno::Reference< ui::XUIConfigurationManager >( getUIConfigurationManager2(), uno::UNO_QUERY_THROW );
+}
+
+uno::Reference< ui::XUIConfigurationManager2 > OReportDefinition::getUIConfigurationManager2( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+
+ if ( !m_pImpl->m_xUIConfigurationManager.is() )
+ {
+ m_pImpl->m_xUIConfigurationManager = ui::UIConfigurationManager::create(m_aProps->m_xContext);
+
+ uno::Reference< embed::XStorage > xConfigStorage;
+ // initialize ui configuration manager with document substorage
+ m_pImpl->m_xUIConfigurationManager->setStorage( xConfigStorage );
+ }
+
+ return m_pImpl->m_xUIConfigurationManager;
+}
+
+uno::Reference< embed::XStorage > SAL_CALL OReportDefinition::getDocumentSubStorage( const OUString& aStorageName, sal_Int32 nMode )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ return m_pImpl->m_xStorage->openStorageElement(aStorageName, nMode);
+}
+
+uno::Sequence< OUString > SAL_CALL OReportDefinition::getDocumentSubStoragesNames( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ uno::Reference<container::XNameAccess> xNameAccess = m_pImpl->m_xStorage;
+ return xNameAccess.is() ? xNameAccess->getElementNames() : uno::Sequence< OUString >();
+}
+
+OUString SAL_CALL OReportDefinition::getMimeType()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ return m_pImpl->m_sMimeType;
+}
+
+void SAL_CALL OReportDefinition::setMimeType( const OUString& _mimetype )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ const uno::Sequence< OUString > aList = getAvailableMimeTypes();
+ if ( ::std::find(aList.begin(), aList.end(), _mimetype) == aList.end() )
+ throwIllegallArgumentException(u"getAvailableMimeTypes()"
+ ,*this
+ ,1);
+ set(PROPERTY_MIMETYPE,_mimetype,m_pImpl->m_sMimeType);
+}
+
+uno::Sequence< OUString > SAL_CALL OReportDefinition::getAvailableMimeTypes( )
+{
+ return { MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII, MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII };
+}
+
+// css::XUnoTunnel
+sal_Int64 SAL_CALL OReportDefinition::getSomething( const uno::Sequence< sal_Int8 >& rId )
+{
+ sal_Int64 nRet = 0;
+ if (comphelper::isUnoTunnelId<OReportDefinition>(rId) )
+ nRet = comphelper::getSomething_cast(this);
+ else
+ {
+ uno::Reference< lang::XUnoTunnel> xUnoTunnel(m_pImpl->m_xNumberFormatsSupplier,uno::UNO_QUERY);
+ if ( xUnoTunnel.is() )
+ nRet = xUnoTunnel->getSomething(rId);
+ }
+ if ( !nRet )
+ {
+ uno::Reference< lang::XUnoTunnel> xTunnel;
+ ::comphelper::query_aggregation(m_aProps->m_xProxy,xTunnel);
+ if ( xTunnel.is() )
+ nRet = xTunnel->getSomething(rId);
+ }
+
+ return nRet;
+}
+
+uno::Sequence< sal_Int8 > SAL_CALL OReportDefinition::getImplementationId( )
+{
+ return css::uno::Sequence<sal_Int8>();
+}
+
+const uno::Sequence< sal_Int8 > & OReportDefinition::getUnoTunnelId()
+{
+ static const comphelper::UnoIdInit implId;
+ return implId.getSeq();
+}
+
+uno::Reference< uno::XComponentContext > OReportDefinition::getContext()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ return m_aProps->m_xContext;
+}
+
+std::shared_ptr<rptui::OReportModel> OReportDefinition::getSdrModel(const uno::Reference< report::XReportDefinition >& _xReportDefinition)
+{
+ std::shared_ptr<rptui::OReportModel> pReportModel;
+ auto pReportDefinition = comphelper::getFromUnoTunnel<OReportDefinition>(_xReportDefinition);
+ if (pReportDefinition)
+ pReportModel = pReportDefinition->m_pImpl->m_pReportModel;
+ return pReportModel;
+}
+
+SdrModel& OReportDefinition::getSdrModelFromUnoModel() const
+{
+ OSL_ENSURE(m_pImpl->m_pReportModel, "No SdrModel in ReportDesign, should not happen");
+ return *m_pImpl->m_pReportModel;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::createInstanceWithArguments( const OUString& aServiceSpecifier, const uno::Sequence< uno::Any >& _aArgs)
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+
+ uno::Reference< uno::XInterface > xRet;
+ if ( aServiceSpecifier.startsWith( "com.sun.star.document.ImportEmbeddedObjectResolver") )
+ {
+ uno::Reference< embed::XStorage > xStorage;
+ for(const uno::Any& rArg : _aArgs)
+ {
+ beans::NamedValue aValue;
+ rArg >>= aValue;
+ if ( aValue.Name == "Storage" )
+ aValue.Value >>= xStorage;
+ }
+ m_pImpl->m_pObjectContainer->SwitchPersistence(xStorage);
+ xRet = static_cast< ::cppu::OWeakObject* >(SvXMLEmbeddedObjectHelper::Create( xStorage,*this, SvXMLEmbeddedObjectHelperMode::Read ).get());
+ }
+ return xRet;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::createInstance( const OUString& aServiceSpecifier )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ uno::Reference< drawing::XShape > xShape;
+ if ( aServiceSpecifier.startsWith( "com.sun.star.report." ) )
+ {
+ if ( aServiceSpecifier == SERVICE_SHAPE )
+ xShape.set(SvxUnoDrawMSFactory::createInstance("com.sun.star.drawing.CustomShape"),uno::UNO_QUERY_THROW);
+ else if ( aServiceSpecifier == SERVICE_FORMATTEDFIELD
+ || aServiceSpecifier == SERVICE_FIXEDTEXT
+ || aServiceSpecifier == SERVICE_FIXEDLINE
+ || aServiceSpecifier == SERVICE_IMAGECONTROL )
+ xShape.set(SvxUnoDrawMSFactory::createInstance("com.sun.star.drawing.ControlShape"),uno::UNO_QUERY_THROW);
+ else
+ xShape.set(SvxUnoDrawMSFactory::createInstance("com.sun.star.drawing.OLE2Shape"),uno::UNO_QUERY_THROW);
+ }
+ else if ( aServiceSpecifier.startsWith( "com.sun.star.form.component." ) )
+ {
+ xShape.set(m_aProps->m_xContext->getServiceManager()->createInstanceWithContext(aServiceSpecifier,m_aProps->m_xContext),uno::UNO_QUERY);
+ }
+ else if ( aServiceSpecifier == "com.sun.star.style.PageStyle" ||
+ aServiceSpecifier == "com.sun.star.style.FrameStyle" ||
+ aServiceSpecifier == "com.sun.star.style.GraphicStyle"
+ )
+ {
+ uno::Reference< style::XStyle> xStyle = new OStyle();
+ xStyle->setName("Default");
+ return xStyle;
+ }
+ else if ( aServiceSpecifier == "com.sun.star.document.Settings" )
+ {
+ uno::Reference<beans::XPropertySet> xProp = new OStyle();
+
+ return xProp;
+ }
+ else if ( aServiceSpecifier == "com.sun.star.drawing.Defaults" )
+ {
+ uno::Reference<beans::XPropertySet> xProp = new OStyle();
+ return xProp;
+ }
+ else if ( aServiceSpecifier == "com.sun.star.drawing.GradientTable" )
+ {
+ if ( !m_pImpl->m_xGradientTable.is() )
+ m_pImpl->m_xGradientTable.set(SvxUnoGradientTable_createInstance(m_pImpl->m_pReportModel.get()),uno::UNO_QUERY);
+ return m_pImpl->m_xGradientTable;
+ }
+ else if ( aServiceSpecifier == "com.sun.star.drawing.HatchTable" )
+ {
+ if ( !m_pImpl->m_xHatchTable.is() )
+ m_pImpl->m_xHatchTable.set(SvxUnoHatchTable_createInstance(m_pImpl->m_pReportModel.get()),uno::UNO_QUERY);
+ return m_pImpl->m_xHatchTable;
+ }
+ else if ( aServiceSpecifier == "com.sun.star.drawing.BitmapTable" )
+ {
+ if ( !m_pImpl->m_xBitmapTable.is() )
+ m_pImpl->m_xBitmapTable.set(SvxUnoBitmapTable_createInstance(m_pImpl->m_pReportModel.get()),uno::UNO_QUERY);
+ return m_pImpl->m_xBitmapTable;
+ }
+ else if ( aServiceSpecifier == "com.sun.star.drawing.TransparencyGradientTable" )
+ {
+ if ( !m_pImpl->m_xTransparencyGradientTable.is() )
+ m_pImpl->m_xTransparencyGradientTable.set(SvxUnoTransGradientTable_createInstance(m_pImpl->m_pReportModel.get()),uno::UNO_QUERY);
+ return m_pImpl->m_xTransparencyGradientTable;
+ }
+ else if ( aServiceSpecifier == "com.sun.star.drawing.DashTable" )
+ {
+ if ( !m_pImpl->m_xDashTable.is() )
+ m_pImpl->m_xDashTable.set(SvxUnoDashTable_createInstance(m_pImpl->m_pReportModel.get()),uno::UNO_QUERY);
+ return m_pImpl->m_xDashTable;
+ }
+ else if( aServiceSpecifier == "com.sun.star.drawing.MarkerTable" )
+ {
+ if( !m_pImpl->m_xMarkerTable.is() )
+ m_pImpl->m_xMarkerTable.set(SvxUnoMarkerTable_createInstance( m_pImpl->m_pReportModel.get() ),uno::UNO_QUERY);
+ return m_pImpl->m_xMarkerTable;
+ }
+ else if ( aServiceSpecifier == "com.sun.star.document.ImportEmbeddedObjectResolver" )
+ return static_cast< ::cppu::OWeakObject* >(SvXMLEmbeddedObjectHelper::Create( m_pImpl->m_xStorage,*this, SvXMLEmbeddedObjectHelperMode::Read ).get());
+ else if ( aServiceSpecifier == "com.sun.star.document.ExportEmbeddedObjectResolver" )
+ return static_cast< ::cppu::OWeakObject* >(SvXMLEmbeddedObjectHelper::Create( m_pImpl->m_xStorage,*this, SvXMLEmbeddedObjectHelperMode::Write ).get());
+ else if (aServiceSpecifier == "com.sun.star.document.ImportGraphicStorageHandler")
+ {
+ rtl::Reference<SvXMLGraphicHelper> xGraphicHelper = SvXMLGraphicHelper::Create(m_pImpl->m_xStorage,SvXMLGraphicHelperMode::Write);
+ uno::Reference< uno::XInterface> xRet(static_cast< ::cppu::OWeakObject* >(xGraphicHelper.get()));
+ return xRet;
+ }
+ else if (aServiceSpecifier == "com.sun.star.document.ExportGraphicStorageHandler")
+ {
+ rtl::Reference<SvXMLGraphicHelper> xGraphicHelper = SvXMLGraphicHelper::Create(m_pImpl->m_xStorage,SvXMLGraphicHelperMode::Write);
+ uno::Reference< uno::XInterface> xRet(static_cast< ::cppu::OWeakObject* >(xGraphicHelper.get()));
+ return xRet;
+ }
+ else if ( aServiceSpecifier == "com.sun.star.chart2.data.DataProvider" )
+ {
+ uno::Reference<chart2::data::XDatabaseDataProvider> xDataProvider(chart2::data::DatabaseDataProvider::createWithConnection( m_aProps->m_xContext, m_pImpl->m_xActiveConnection ));
+ xDataProvider->setRowLimit(10);
+ uno::Reference< container::XChild > xChild(xDataProvider,uno::UNO_QUERY);
+ if ( xChild.is() )
+ xChild->setParent(*this);
+ return uno::Reference< uno::XInterface >(xDataProvider,uno::UNO_QUERY);
+ }
+ else if ( aServiceSpecifier == "com.sun.star.xml.NamespaceMap" )
+ {
+ if ( !m_pImpl->m_xXMLNamespaceMap.is() )
+ m_pImpl->m_xXMLNamespaceMap = comphelper::NameContainer_createInstance( cppu::UnoType<OUString>::get() ).get();
+ return m_pImpl->m_xXMLNamespaceMap;
+ }
+ else
+ xShape.set(SvxUnoDrawMSFactory::createInstance( aServiceSpecifier ),uno::UNO_QUERY_THROW);
+
+ return m_pImpl->m_pReportModel->createShape(aServiceSpecifier,xShape);
+}
+
+uno::Sequence< OUString > SAL_CALL OReportDefinition::getAvailableServiceNames()
+{
+ static const std::u16string_view aSvxComponentServiceNameList[] =
+ {
+ u"com.sun.star.form.component.FixedText",
+ u"com.sun.star.form.component.DatabaseImageControl",
+ u"com.sun.star.style.PageStyle",
+ u"com.sun.star.style.GraphicStyle",
+ u"com.sun.star.style.FrameStyle",
+ u"com.sun.star.drawing.Defaults",
+ u"com.sun.star.document.ImportEmbeddedObjectResolver",
+ u"com.sun.star.document.ExportEmbeddedObjectResolver",
+ u"com.sun.star.document.ImportGraphicStorageHandler",
+ u"com.sun.star.document.ExportGraphicStorageHandler",
+ u"com.sun.star.chart2.data.DataProvider",
+ u"com.sun.star.xml.NamespaceMap",
+ u"com.sun.star.document.Settings",
+ u"com.sun.star.drawing.GradientTable",
+ u"com.sun.star.drawing.HatchTable",
+ u"com.sun.star.drawing.BitmapTable",
+ u"com.sun.star.drawing.TransparencyGradientTable",
+ u"com.sun.star.drawing.DashTable",
+ u"com.sun.star.drawing.MarkerTable"
+ };
+
+ static const sal_uInt16 nSvxComponentServiceNameListCount = SAL_N_ELEMENTS(aSvxComponentServiceNameList);
+
+ uno::Sequence< OUString > aSeq( nSvxComponentServiceNameListCount );
+ OUString* pStrings = aSeq.getArray();
+ for( sal_uInt16 nIdx = 0; nIdx < nSvxComponentServiceNameListCount; nIdx++ )
+ pStrings[nIdx] = aSvxComponentServiceNameList[nIdx];
+
+ uno::Sequence< OUString > aParentSeq( SvxUnoDrawMSFactory::getAvailableServiceNames() );
+ return comphelper::concatSequences( aParentSeq, aSeq );
+}
+
+// XShape
+awt::Point SAL_CALL OReportDefinition::getPosition( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ if ( m_aProps->m_xShape.is() )
+ return m_aProps->m_xShape->getPosition();
+ return awt::Point(m_aProps->m_nPosX,m_aProps->m_nPosY);
+}
+
+void SAL_CALL OReportDefinition::setPosition( const awt::Point& aPosition )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ if ( m_aProps->m_xShape.is() )
+ m_aProps->m_xShape->setPosition(aPosition);
+ set(PROPERTY_POSITIONX,aPosition.X,m_aProps->m_nPosX);
+ set(PROPERTY_POSITIONY,aPosition.Y,m_aProps->m_nPosY);
+}
+
+awt::Size SAL_CALL OReportDefinition::getSize( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ if ( m_aProps->m_xShape.is() )
+ return m_aProps->m_xShape->getSize();
+ return awt::Size(m_aProps->m_nWidth,m_aProps->m_nHeight);
+}
+
+void SAL_CALL OReportDefinition::setSize( const awt::Size& aSize )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ if ( m_aProps->m_xShape.is() )
+ m_aProps->m_xShape->setSize(aSize);
+ set(PROPERTY_WIDTH,aSize.Width,m_aProps->m_nWidth);
+ set(PROPERTY_HEIGHT,aSize.Height,m_aProps->m_nHeight);
+}
+
+
+// XShapeDescriptor
+OUString SAL_CALL OReportDefinition::getShapeType( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ if ( m_aProps->m_xShape.is() )
+ return m_aProps->m_xShape->getShapeType();
+ return "com.sun.star.drawing.OLE2Shape";
+}
+
+typedef ::cppu::WeakImplHelper< container::XNameContainer,
+ container::XIndexAccess
+ > TStylesBASE;
+
+namespace {
+
+class OStylesHelper:
+ public cppu::BaseMutex, public TStylesBASE
+{
+ typedef ::std::map< OUString, uno::Any , ::comphelper::UStringMixLess> TStyleElements;
+ TStyleElements m_aElements;
+ ::std::vector<TStyleElements::iterator> m_aElementsPos;
+ uno::Type m_aType;
+
+protected:
+ virtual ~OStylesHelper() override {}
+public:
+ explicit OStylesHelper(const uno::Type& rType = cppu::UnoType<container::XElementAccess>::get());
+ OStylesHelper(const OStylesHelper&) = delete;
+ OStylesHelper& operator=(const OStylesHelper&) = delete;
+
+ // XNameContainer
+ virtual void SAL_CALL insertByName( const OUString& aName, const uno::Any& aElement ) override;
+ virtual void SAL_CALL removeByName( const OUString& Name ) override;
+
+ // XNameReplace
+ virtual void SAL_CALL replaceByName( const OUString& aName, const uno::Any& aElement ) override;
+
+ // container::XElementAccess
+ virtual uno::Type SAL_CALL getElementType( ) override;
+ virtual sal_Bool SAL_CALL hasElements( ) override;
+ // container::XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount( ) override;
+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
+
+ // container::XNameAccess
+ virtual uno::Any SAL_CALL getByName( const OUString& aName ) override;
+ virtual uno::Sequence< OUString > SAL_CALL getElementNames( ) override;
+ virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
+};
+
+}
+
+OStylesHelper::OStylesHelper(const uno::Type& rType)
+ : cppu::BaseMutex()
+ , m_aType(rType)
+{
+}
+;
+
+// container::XElementAccess
+uno::Type SAL_CALL OStylesHelper::getElementType( )
+{
+ return m_aType;
+}
+
+sal_Bool SAL_CALL OStylesHelper::hasElements( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return !m_aElementsPos.empty();
+}
+
+// container::XIndexAccess
+sal_Int32 SAL_CALL OStylesHelper::getCount( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aElementsPos.size();
+}
+
+uno::Any SAL_CALL OStylesHelper::getByIndex( sal_Int32 Index )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if ( Index < 0 || o3tl::make_unsigned(Index) >= m_aElementsPos.size() )
+ throw lang::IndexOutOfBoundsException();
+ return m_aElementsPos[Index]->second;
+}
+
+// container::XNameAccess
+uno::Any SAL_CALL OStylesHelper::getByName( const OUString& aName )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ TStyleElements::const_iterator aFind = m_aElements.find(aName);
+ if ( aFind == m_aElements.end() )
+ throw container::NoSuchElementException();
+ return aFind->second;
+}
+
+uno::Sequence< OUString > SAL_CALL OStylesHelper::getElementNames( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ uno::Sequence< OUString > aNameList(m_aElementsPos.size());
+
+ OUString* pStringArray = aNameList.getArray();
+ for(const auto& rIter : m_aElementsPos)
+ {
+ *pStringArray = rIter->first;
+ ++pStringArray;
+ }
+
+ return aNameList;
+}
+
+sal_Bool SAL_CALL OStylesHelper::hasByName( const OUString& aName )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aElements.find(aName) != m_aElements.end();
+}
+
+// XNameContainer
+void SAL_CALL OStylesHelper::insertByName( const OUString& aName, const uno::Any& aElement )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if ( m_aElements.find(aName) != m_aElements.end() )
+ throw container::ElementExistException();
+
+ if ( !aElement.isExtractableTo(m_aType) )
+ throw lang::IllegalArgumentException();
+
+ m_aElementsPos.push_back(m_aElements.emplace(aName,aElement).first);
+}
+
+void SAL_CALL OStylesHelper::removeByName( const OUString& aName )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ TStyleElements::const_iterator aFind = m_aElements.find(aName);
+ if ( aFind != m_aElements.end() )
+ throw container::NoSuchElementException();
+ m_aElementsPos.erase(::std::find(m_aElementsPos.begin(),m_aElementsPos.end(),aFind));
+ m_aElements.erase(aFind);
+}
+
+// XNameReplace
+void SAL_CALL OStylesHelper::replaceByName( const OUString& aName, const uno::Any& aElement )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ TStyleElements::iterator aFind = m_aElements.find(aName);
+ if ( aFind == m_aElements.end() )
+ throw container::NoSuchElementException();
+ if ( !aElement.isExtractableTo(m_aType) )
+ throw lang::IllegalArgumentException();
+ aFind->second = aElement;
+}
+
+uno::Reference< container::XNameAccess > SAL_CALL OReportDefinition::getStyleFamilies( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ if ( !m_pImpl->m_xStyles.is() )
+ {
+ m_pImpl->m_xStyles = new OStylesHelper();
+ uno::Reference< container::XNameContainer> xStyles(m_pImpl->m_xStyles,uno::UNO_QUERY);
+
+ uno::Reference< container::XNameContainer> xPageStyles = new OStylesHelper(cppu::UnoType<style::XStyle>::get());
+ xStyles->insertByName("PageStyles",uno::Any(xPageStyles));
+ uno::Reference< style::XStyle> xPageStyle(createInstance("com.sun.star.style.PageStyle"),uno::UNO_QUERY);
+ xPageStyles->insertByName(xPageStyle->getName(),uno::Any(xPageStyle));
+
+ uno::Reference< container::XNameContainer> xFrameStyles = new OStylesHelper(cppu::UnoType<style::XStyle>::get());
+ xStyles->insertByName("FrameStyles",uno::Any(xFrameStyles));
+ uno::Reference< style::XStyle> xFrameStyle(createInstance("com.sun.star.style.FrameStyle"),uno::UNO_QUERY);
+ xFrameStyles->insertByName(xFrameStyle->getName(),uno::Any(xFrameStyle));
+
+ uno::Reference< container::XNameContainer> xGraphicStyles = new OStylesHelper(cppu::UnoType<style::XStyle>::get());
+ xStyles->insertByName("graphics",uno::Any(xGraphicStyles));
+ uno::Reference< style::XStyle> xGraphicStyle(createInstance("com.sun.star.style.GraphicStyle"),uno::UNO_QUERY);
+ xGraphicStyles->insertByName(xGraphicStyle->getName(),uno::Any(xGraphicStyle));
+ }
+ return m_pImpl->m_xStyles;
+}
+OUString SAL_CALL OReportDefinition::getIdentifier( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ return m_pImpl->m_sIdentifier;
+}
+
+void SAL_CALL OReportDefinition::setIdentifier( const OUString& Identifier )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ m_pImpl->m_sIdentifier = Identifier;
+}
+
+// XNumberFormatsSupplier
+uno::Reference< beans::XPropertySet > SAL_CALL OReportDefinition::getNumberFormatSettings( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if ( m_pImpl->m_xNumberFormatsSupplier.is() )
+ return m_pImpl->m_xNumberFormatsSupplier->getNumberFormatSettings();
+ return uno::Reference< beans::XPropertySet >();
+}
+
+uno::Reference< util::XNumberFormats > SAL_CALL OReportDefinition::getNumberFormats( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if ( m_pImpl->m_xNumberFormatsSupplier.is() )
+ return m_pImpl->m_xNumberFormatsSupplier->getNumberFormats();
+ return uno::Reference< util::XNumberFormats >();
+}
+
+::comphelper::EmbeddedObjectContainer& OReportDefinition::getEmbeddedObjectContainer() const
+{
+ return *m_pImpl->m_pObjectContainer;
+}
+
+uno::Reference< embed::XStorage > OReportDefinition::getStorage() const
+{
+ return m_pImpl->m_xStorage;
+}
+
+uno::Reference< task::XInteractionHandler > OReportDefinition::getInteractionHandler() const
+{
+ uno::Reference< task::XInteractionHandler > xRet(
+ task::InteractionHandler::createWithParent(m_aProps->m_xContext, nullptr), uno::UNO_QUERY_THROW);
+ return xRet;
+}
+
+uno::Reference< sdbc::XConnection > SAL_CALL OReportDefinition::getActiveConnection()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_pImpl->m_xActiveConnection;
+}
+
+void SAL_CALL OReportDefinition::setActiveConnection( const uno::Reference< sdbc::XConnection >& _activeconnection )
+{
+ if ( !_activeconnection.is() )
+ throw lang::IllegalArgumentException();
+ set(PROPERTY_ACTIVECONNECTION,_activeconnection,m_pImpl->m_xActiveConnection);
+}
+
+OUString SAL_CALL OReportDefinition::getDataSourceName()
+{
+ osl::MutexGuard g(m_aMutex);
+ return m_pImpl->m_sDataSourceName;
+}
+
+void SAL_CALL OReportDefinition::setDataSourceName(const OUString& the_value)
+{
+ set(PROPERTY_DATASOURCENAME,the_value,m_pImpl->m_sDataSourceName);
+}
+
+bool OReportDefinition::isEnableSetModified() const
+{
+ return true;
+}
+
+OUString OReportDefinition::getDocumentBaseURL() const
+{
+ // TODO: should this be in getURL()? not sure...
+ uno::Reference<frame::XModel> const xParent(
+ const_cast<OReportDefinition*>(this)->getParent(), uno::UNO_QUERY);
+ if (xParent.is())
+ {
+ return xParent->getURL();
+ }
+
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ for (beans::PropertyValue const& it : std::as_const(m_pImpl->m_aArgs))
+ {
+ if (it.Name == "DocumentBaseURL")
+ return it.Value.get<OUString>();
+ }
+
+ return OUString();
+}
+
+uno::Reference< frame::XTitle > OReportDefinition::impl_getTitleHelper_throw()
+{
+ SolarMutexGuard aSolarGuard;
+
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+
+ if ( ! m_pImpl->m_xTitleHelper.is ())
+ {
+ uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create(m_aProps->m_xContext);
+
+ m_pImpl->m_xTitleHelper = new ::framework::TitleHelper( m_aProps->m_xContext, uno::Reference< frame::XModel >(this),
+ uno::Reference<frame::XUntitledNumbers>(xDesktop, uno::UNO_QUERY_THROW) );
+ }
+
+ return m_pImpl->m_xTitleHelper;
+}
+
+uno::Reference< frame::XUntitledNumbers > OReportDefinition::impl_getUntitledHelper_throw()
+{
+ SolarMutexGuard aSolarGuard;
+
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+
+ if ( ! m_pImpl->m_xNumberedControllers.is ())
+ {
+ rtl::Reference<::comphelper::NumberedCollection> pHelper = new ::comphelper::NumberedCollection();
+ m_pImpl->m_xNumberedControllers = pHelper;
+
+ pHelper->setOwner (uno::Reference< frame::XModel >(this));
+ pHelper->setUntitledPrefix (" : ");
+ }
+
+ return m_pImpl->m_xNumberedControllers;
+}
+
+// css.frame.XTitle
+OUString SAL_CALL OReportDefinition::getTitle()
+{
+ // SYNCHRONIZED ->
+ SolarMutexGuard aSolarGuard;
+
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+
+ return impl_getTitleHelper_throw()->getTitle ();
+}
+
+// css.frame.XTitle
+void SAL_CALL OReportDefinition::setTitle( const OUString& sTitle )
+{
+ // SYNCHRONIZED ->
+ SolarMutexGuard aSolarGuard;
+
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+
+ impl_getTitleHelper_throw()->setTitle (sTitle);
+}
+
+// css.frame.XTitleChangeBroadcaster
+void SAL_CALL OReportDefinition::addTitleChangeListener( const uno::Reference< frame::XTitleChangeListener >& xListener )
+{
+ // SYNCHRONIZED ->
+ SolarMutexGuard aSolarGuard;
+
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+
+ uno::Reference< frame::XTitleChangeBroadcaster > xBroadcaster(impl_getTitleHelper_throw(), uno::UNO_QUERY);
+ if (xBroadcaster.is ())
+ xBroadcaster->addTitleChangeListener (xListener);
+}
+
+// css.frame.XTitleChangeBroadcaster
+void SAL_CALL OReportDefinition::removeTitleChangeListener( const uno::Reference< frame::XTitleChangeListener >& xListener )
+{
+ // SYNCHRONIZED ->
+ SolarMutexGuard aSolarGuard;
+
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+
+ uno::Reference< frame::XTitleChangeBroadcaster > xBroadcaster(impl_getTitleHelper_throw(), uno::UNO_QUERY);
+ if (xBroadcaster.is ())
+ xBroadcaster->removeTitleChangeListener (xListener);
+}
+
+// css.frame.XUntitledNumbers
+::sal_Int32 SAL_CALL OReportDefinition::leaseNumber( const uno::Reference< uno::XInterface >& xComponent )
+{
+ // object already disposed?
+ SolarMutexGuard aSolarGuard;
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+
+ return impl_getUntitledHelper_throw()->leaseNumber (xComponent);
+}
+
+// css.frame.XUntitledNumbers
+void SAL_CALL OReportDefinition::releaseNumber( ::sal_Int32 nNumber )
+{
+ // object already disposed?
+ SolarMutexGuard aSolarGuard;
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+
+ impl_getUntitledHelper_throw()->releaseNumber (nNumber);
+}
+
+// css.frame.XUntitledNumbers
+void SAL_CALL OReportDefinition::releaseNumberForComponent( const uno::Reference< uno::XInterface >& xComponent )
+{
+ // object already disposed?
+ SolarMutexGuard aSolarGuard;
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+
+ impl_getUntitledHelper_throw()->releaseNumberForComponent (xComponent);
+}
+
+// css.frame.XUntitledNumbers
+OUString SAL_CALL OReportDefinition::getUntitledPrefix()
+{
+ // object already disposed?
+ SolarMutexGuard aSolarGuard;
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+
+ return impl_getUntitledHelper_throw()->getUntitledPrefix ();
+}
+
+uno::Reference< document::XDocumentProperties > SAL_CALL OReportDefinition::getDocumentProperties( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
+ if ( !m_pImpl->m_xDocumentProperties.is() )
+ {
+ m_pImpl->m_xDocumentProperties.set(document::DocumentProperties::create(m_aProps->m_xContext));
+ }
+ return m_pImpl->m_xDocumentProperties;
+}
+
+uno::Any SAL_CALL OReportDefinition::getTransferData( const datatransfer::DataFlavor& aFlavor )
+{
+ uno::Any aResult;
+ if( !isDataFlavorSupported( aFlavor ) )
+ {
+ throw datatransfer::UnsupportedFlavorException(aFlavor.MimeType, static_cast< ::cppu::OWeakObject* >( this ));
+ }
+
+ try
+ {
+ aResult = getPreferredVisualRepresentation(0).Data;
+ }
+ catch (const uno::Exception &)
+ {
+ DBG_UNHANDLED_EXCEPTION("reportdesign");
+ }
+
+
+ return aResult;
+}
+
+uno::Sequence< datatransfer::DataFlavor > SAL_CALL OReportDefinition::getTransferDataFlavors( )
+{
+ return { { "image/png", "PNG", cppu::UnoType<uno::Sequence< sal_Int8 >>::get() } };
+}
+
+sal_Bool SAL_CALL OReportDefinition::isDataFlavorSupported( const datatransfer::DataFlavor& aFlavor )
+{
+ return aFlavor.MimeType == "image/png";
+}
+
+
+uno::Reference< document::XUndoManager > SAL_CALL OReportDefinition::getUndoManager( )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ return m_pImpl->m_pUndoManager;
+}
+
+}// namespace reportdesign
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/reportdesign/source/core/api/ReportEngineJFree.cxx b/reportdesign/source/core/api/ReportEngineJFree.cxx
new file mode 100644
index 000000000..30a51d7b9
--- /dev/null
+++ b/reportdesign/source/core/api/ReportEngineJFree.cxx
@@ -0,0 +1,370 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <ReportEngineJFree.hxx>
+#include <comphelper/storagehelper.hxx>
+#include <connectivity/dbtools.hxx>
+#include <comphelper/mimeconfighelper.hxx>
+#include <comphelper/string.hxx>
+#include <cppuhelper/supportsservice.hxx>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#include <com/sun/star/embed/XTransactedObject.hpp>
+
+#include <com/sun/star/task/XJob.hpp>
+
+#include <unotools/useroptions.hxx>
+#include <unotools/tempfile.hxx>
+#include <unotools/sharedunocomponent.hxx>
+
+#include <strings.hxx>
+#include <strings.hrc>
+#include <core_resource.hxx>
+
+#include <connectivity/CommonTools.hxx>
+#include <sfx2/docfilt.hxx>
+
+namespace reportdesign
+{
+
+ using namespace com::sun::star;
+ using namespace comphelper;
+
+
+OReportEngineJFree::OReportEngineJFree( const uno::Reference< uno::XComponentContext >& context)
+:ReportEngineBase(m_aMutex)
+,ReportEnginePropertySet(context,IMPLEMENTS_PROPERTY_SET,uno::Sequence< OUString >())
+,m_xContext(context)
+,m_nMaxRows(0)
+{
+}
+
+// TODO: VirtualFunctionFinder: This is virtual function!
+
+OReportEngineJFree::~OReportEngineJFree()
+{
+}
+
+IMPLEMENT_FORWARD_XINTERFACE2(OReportEngineJFree,ReportEngineBase,ReportEnginePropertySet)
+
+void SAL_CALL OReportEngineJFree::dispose()
+{
+ ReportEnginePropertySet::dispose();
+ cppu::WeakComponentImplHelperBase::dispose();
+ m_xActiveConnection.clear();
+}
+
+OUString OReportEngineJFree::getImplementationName_Static( )
+{
+ return "com.sun.star.comp.report.OReportEngineJFree";
+}
+
+
+OUString SAL_CALL OReportEngineJFree::getImplementationName( )
+{
+ return getImplementationName_Static();
+}
+
+uno::Sequence< OUString > OReportEngineJFree::getSupportedServiceNames_Static( )
+{
+ uno::Sequence< OUString > aServices { "com.sun.star.report.ReportEngine" };
+
+ return aServices;
+}
+
+uno::Reference< uno::XInterface > OReportEngineJFree::create(uno::Reference< uno::XComponentContext > const & xContext)
+{
+ return *(new OReportEngineJFree(xContext));
+}
+
+
+uno::Sequence< OUString > SAL_CALL OReportEngineJFree::getSupportedServiceNames( )
+{
+ return getSupportedServiceNames_Static();
+}
+
+sal_Bool SAL_CALL OReportEngineJFree::supportsService(const OUString& ServiceName)
+{
+ return cppu::supportsService(this, ServiceName);
+}
+
+// XReportEngine
+ // Attributes
+uno::Reference< report::XReportDefinition > SAL_CALL OReportEngineJFree::getReportDefinition()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_xReport;
+}
+
+void SAL_CALL OReportEngineJFree::setReportDefinition( const uno::Reference< report::XReportDefinition >& _report )
+{
+ if ( !_report.is() )
+ throw lang::IllegalArgumentException();
+ BoundListeners l;
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if ( m_xReport != _report )
+ {
+ prepareSet(PROPERTY_REPORTDEFINITION, uno::Any(m_xReport), uno::Any(_report), &l);
+ m_xReport = _report;
+ }
+ }
+ l.notify();
+}
+
+uno::Reference< task::XStatusIndicator > SAL_CALL OReportEngineJFree::getStatusIndicator()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_StatusIndicator;
+}
+
+void SAL_CALL OReportEngineJFree::setStatusIndicator( const uno::Reference< task::XStatusIndicator >& _statusindicator )
+{
+ set(PROPERTY_STATUSINDICATOR,_statusindicator,m_StatusIndicator);
+}
+
+OUString OReportEngineJFree::getNewOutputName()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportEngineBase::rBHelper.bDisposed);
+ if ( !m_xReport.is() || !m_xActiveConnection.is() )
+ throw lang::IllegalArgumentException();
+
+ static constexpr OUStringLiteral s_sMediaType = u"MediaType";
+
+ MimeConfigurationHelper aConfighelper(m_xContext);
+ const OUString sMimeType = m_xReport->getMimeType();
+ std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetDefaultFilter( aConfighelper.GetDocServiceNameFromMediaType(sMimeType) );
+ OUString sExt(".rpt");
+ if ( pFilter )
+ sExt = ::comphelper::string::stripStart(pFilter->GetDefaultExtension(), '*');
+
+ uno::Reference< embed::XStorage > xTemp = OStorageHelper::GetTemporaryStorage(/*sFileTemp,embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE,*/ m_xContext);
+ utl::DisposableComponent aTemp(xTemp);
+ uno::Sequence< beans::PropertyValue > aEmpty;
+ uno::Reference< beans::XPropertySet> xStorageProp(xTemp,uno::UNO_QUERY);
+ if ( xStorageProp.is() )
+ {
+ xStorageProp->setPropertyValue( s_sMediaType, uno::Any(sMimeType));
+ }
+ m_xReport->storeToStorage(xTemp,aEmpty); // store to temp file because it may contain information which isn't in the database yet.
+
+ OUString sFileURL;
+ OUString sName = m_xReport->getCaption();
+ if ( sName.isEmpty() )
+ sName = m_xReport->getName();
+ {
+ ::utl::TempFile aTestFile(sName, false, &sExt);
+ if ( !aTestFile.IsValid() )
+ {
+ sName = RptResId(RID_STR_REPORT);
+ ::utl::TempFile aFile(sName, false, &sExt);
+ sFileURL = aFile.GetURL();
+ }
+ else
+ sFileURL = aTestFile.GetURL();
+ }
+
+ uno::Reference< embed::XStorage > xOut = OStorageHelper::GetStorageFromURL(sFileURL,embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE, m_xContext);
+ utl::DisposableComponent aOut(xOut);
+ xStorageProp.set(xOut,uno::UNO_QUERY);
+ if ( xStorageProp.is() )
+ {
+ xStorageProp->setPropertyValue( s_sMediaType, uno::Any(sMimeType));
+ }
+
+ // some meta data
+ SvtUserOptions aUserOpts;
+ OUString sAuthor = aUserOpts.GetFirstName() +
+ " " +
+ aUserOpts.GetLastName();
+
+ uno::Sequence< beans::NamedValue > aConvertedProperties{
+ {"InputStorage", uno::Any(xTemp) },
+ {"OutputStorage", uno::Any(xOut) },
+ {PROPERTY_REPORTDEFINITION, uno::Any(m_xReport) },
+ {PROPERTY_ACTIVECONNECTION, uno::Any(m_xActiveConnection) },
+ {PROPERTY_MAXROWS, uno::Any(m_nMaxRows) },
+ {"Author", uno::Any(sAuthor) },
+ {"Title", uno::Any(m_xReport->getCaption()) }
+ };
+
+ OUString sOutputName;
+
+ // create job factory and initialize
+ const OUString sReportEngineServiceName = ::dbtools::getDefaultReportEngineServiceName(m_xContext);
+ uno::Reference<task::XJob> xJob(m_xContext->getServiceManager()->createInstanceWithContext(sReportEngineServiceName,m_xContext),uno::UNO_QUERY_THROW);
+ if ( !m_xReport->getCommand().isEmpty() )
+ {
+ xJob->execute(aConvertedProperties);
+ if ( xStorageProp.is() )
+ {
+ sOutputName = sFileURL;
+ }
+ }
+
+ uno::Reference<embed::XTransactedObject> xTransact(xOut,uno::UNO_QUERY);
+ if ( !sOutputName.isEmpty() && xTransact.is() )
+ xTransact->commit();
+
+ if ( sOutputName.isEmpty() )
+ throw lang::IllegalArgumentException();
+
+ return sOutputName;
+}
+
+// Methods
+uno::Reference< frame::XModel > SAL_CALL OReportEngineJFree::createDocumentModel( )
+{
+ return createDocumentAlive(nullptr,true);
+}
+
+uno::Reference< frame::XModel > SAL_CALL OReportEngineJFree::createDocumentAlive( const uno::Reference< frame::XFrame >& _frame )
+{
+ return createDocumentAlive(_frame,false);
+}
+
+uno::Reference< frame::XModel > OReportEngineJFree::createDocumentAlive( const uno::Reference< frame::XFrame >& _frame,bool _bHidden )
+{
+ uno::Reference< frame::XModel > xModel;
+ OUString sOutputName = getNewOutputName(); // starts implicitly the report generator
+ if ( !sOutputName.isEmpty() )
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportEngineBase::rBHelper.bDisposed);
+ uno::Reference<frame::XComponentLoader> xFrameLoad(_frame,uno::UNO_QUERY);
+ if ( !xFrameLoad.is() )
+ {
+ // if there is no frame given, find the right
+ xFrameLoad = frame::Desktop::create(m_xContext);
+ sal_Int32 const nFrameSearchFlag = frame::FrameSearchFlag::TASKS | frame::FrameSearchFlag::CREATE;
+ uno::Reference< frame::XFrame> xFrame = uno::Reference< frame::XFrame>(xFrameLoad,uno::UNO_QUERY_THROW)->findFrame("_blank",nFrameSearchFlag);
+ xFrameLoad.set( xFrame,uno::UNO_QUERY);
+ }
+
+ if ( xFrameLoad.is() )
+ {
+ uno::Sequence < beans::PropertyValue > aArgs( _bHidden ? 3 : 2 );
+ auto pArgs = aArgs.getArray();
+ sal_Int32 nLen = 0;
+ pArgs[nLen].Name = "AsTemplate";
+ pArgs[nLen++].Value <<= false;
+
+ pArgs[nLen].Name = "ReadOnly";
+ pArgs[nLen++].Value <<= true;
+
+ if ( _bHidden )
+ {
+ pArgs[nLen].Name = "Hidden";
+ pArgs[nLen++].Value <<= true;
+ }
+
+ xModel.set( xFrameLoad->loadComponentFromURL(
+ sOutputName,
+ OUString(), // empty frame name
+ 0,
+ aArgs
+ ),uno::UNO_QUERY);
+ }
+ }
+ return xModel;
+}
+
+util::URL SAL_CALL OReportEngineJFree::createDocument( )
+{
+ util::URL aRet;
+ uno::Reference< frame::XModel > xModel = createDocumentModel();
+ if ( xModel.is() )
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportEngineBase::rBHelper.bDisposed);
+ }
+ return aRet;
+}
+
+void SAL_CALL OReportEngineJFree::interrupt( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ ::connectivity::checkDisposed(ReportEngineBase::rBHelper.bDisposed);
+}
+
+uno::Reference< beans::XPropertySetInfo > SAL_CALL OReportEngineJFree::getPropertySetInfo( )
+{
+ return ReportEnginePropertySet::getPropertySetInfo();
+}
+
+void SAL_CALL OReportEngineJFree::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
+{
+ ReportEnginePropertySet::setPropertyValue( aPropertyName, aValue );
+}
+
+uno::Any SAL_CALL OReportEngineJFree::getPropertyValue( const OUString& PropertyName )
+{
+ return ReportEnginePropertySet::getPropertyValue( PropertyName);
+}
+
+void SAL_CALL OReportEngineJFree::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener )
+{
+ ReportEnginePropertySet::addPropertyChangeListener( aPropertyName, xListener );
+}
+
+void SAL_CALL OReportEngineJFree::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener )
+{
+ ReportEnginePropertySet::removePropertyChangeListener( aPropertyName, aListener );
+}
+
+void SAL_CALL OReportEngineJFree::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+{
+ ReportEnginePropertySet::addVetoableChangeListener( PropertyName, aListener );
+}
+
+void SAL_CALL OReportEngineJFree::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+{
+ ReportEnginePropertySet::removeVetoableChangeListener( PropertyName, aListener );
+}
+
+uno::Reference< sdbc::XConnection > SAL_CALL OReportEngineJFree::getActiveConnection()
+{
+ return m_xActiveConnection;
+}
+
+void SAL_CALL OReportEngineJFree::setActiveConnection( const uno::Reference< sdbc::XConnection >& _activeconnection )
+{
+ if ( !_activeconnection.is() )
+ throw lang::IllegalArgumentException();
+ set(PROPERTY_ACTIVECONNECTION,_activeconnection,m_xActiveConnection);
+}
+
+::sal_Int32 SAL_CALL OReportEngineJFree::getMaxRows()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_nMaxRows;
+}
+
+void SAL_CALL OReportEngineJFree::setMaxRows( ::sal_Int32 MaxRows )
+{
+ set(PROPERTY_MAXROWS,MaxRows,m_nMaxRows);
+}
+
+} // namespace reportdesign
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/reportdesign/source/core/api/ReportVisitor.cxx b/reportdesign/source/core/api/ReportVisitor.cxx
new file mode 100644
index 000000000..3e62fd69e
--- /dev/null
+++ b/reportdesign/source/core/api/ReportVisitor.cxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <ReportVisitor.hxx>
+
+#include <osl/diagnose.h>
+
+namespace reportdesign
+{
+using namespace com::sun::star;
+
+OReportVisitor::OReportVisitor(ITraverseReport* _pTraverseReport)
+ : m_pTraverseReport(_pTraverseReport)
+{
+ OSL_ENSURE(m_pTraverseReport, "ReportDefinition must be not NULL!");
+}
+
+void OReportVisitor::start(const uno::Reference<report::XReportDefinition>& _xReportDefinition)
+{
+ OSL_ENSURE(_xReportDefinition.is(), "ReportDefinition is NULL!");
+ if (!_xReportDefinition.is())
+ return;
+
+ m_pTraverseReport->traverseReport(_xReportDefinition);
+ m_pTraverseReport->traverseReportFunctions(_xReportDefinition->getFunctions());
+ if (_xReportDefinition->getPageHeaderOn())
+ m_pTraverseReport->traversePageHeader(_xReportDefinition->getPageHeader());
+ if (_xReportDefinition->getReportHeaderOn())
+ m_pTraverseReport->traverseReportHeader(_xReportDefinition->getReportHeader());
+
+ uno::Reference<report::XGroups> xGroups = _xReportDefinition->getGroups();
+ m_pTraverseReport->traverseGroups(xGroups);
+ const sal_Int32 nCount = xGroups->getCount();
+ sal_Int32 i = 0;
+ for (; i < nCount; ++i)
+ {
+ uno::Reference<report::XGroup> xGroup(xGroups->getByIndex(i), uno::UNO_QUERY);
+ m_pTraverseReport->traverseGroup(xGroup);
+ m_pTraverseReport->traverseGroupFunctions(xGroup->getFunctions());
+ if (xGroup->getHeaderOn())
+ m_pTraverseReport->traverseGroupHeader(xGroup->getHeader());
+ }
+
+ m_pTraverseReport->traverseDetail(_xReportDefinition->getDetail());
+
+ for (i = 0; i < nCount; ++i)
+ {
+ uno::Reference<report::XGroup> xGroup(xGroups->getByIndex(i), uno::UNO_QUERY);
+ if (xGroup->getFooterOn())
+ m_pTraverseReport->traverseGroupFooter(xGroup->getFooter());
+ }
+
+ if (_xReportDefinition->getPageFooterOn())
+ m_pTraverseReport->traversePageFooter(_xReportDefinition->getPageFooter());
+ if (_xReportDefinition->getReportFooterOn())
+ m_pTraverseReport->traverseReportFooter(_xReportDefinition->getReportFooter());
+}
+
+void OReportVisitor::start(const uno::Reference<report::XGroup>& _xGroup)
+{
+ OSL_ENSURE(_xGroup.is(), "Group is NULL!");
+ if (!_xGroup.is())
+ return;
+ m_pTraverseReport->traverseGroup(_xGroup);
+ m_pTraverseReport->traverseGroupFunctions(_xGroup->getFunctions());
+ if (_xGroup->getHeaderOn())
+ m_pTraverseReport->traverseGroupHeader(_xGroup->getHeader());
+ if (_xGroup->getFooterOn())
+ m_pTraverseReport->traverseGroupFooter(_xGroup->getFooter());
+}
+
+} // namespace reportdesign
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/reportdesign/source/core/api/Section.cxx b/reportdesign/source/core/api/Section.cxx
new file mode 100644
index 000000000..e7a8e7561
--- /dev/null
+++ b/reportdesign/source/core/api/Section.cxx
@@ -0,0 +1,601 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#include <Section.hxx>
+#include <comphelper/enumhelper.hxx>
+#include <comphelper/servicehelper.hxx>
+#include <cppuhelper/supportsservice.hxx>
+#include <com/sun/star/report/XReportComponent.hpp>
+#include <com/sun/star/report/ForceNewPage.hpp>
+#include <com/sun/star/lang/NoSupportException.hpp>
+#include <strings.hxx>
+#include <Tools.hxx>
+#include <RptModel.hxx>
+#include <RptPage.hxx>
+#include <ReportControlModel.hxx>
+#include <ReportDefinition.hxx>
+#include <vcl/svapp.hxx>
+
+namespace reportdesign
+{
+
+ using namespace com::sun::star;
+ using namespace comphelper;
+
+
+static uno::Sequence< OUString> lcl_getGroupAbsent()
+{
+ const OUString pProps[] = {
+ OUString(PROPERTY_CANGROW)
+ ,OUString(PROPERTY_CANSHRINK)
+ };
+
+ return uno::Sequence< OUString >(pProps,SAL_N_ELEMENTS(pProps));
+}
+
+
+static uno::Sequence< OUString> lcl_getAbsent(bool _bPageSection)
+{
+ if ( _bPageSection )
+ {
+ const OUString pProps[] = {
+ OUString(PROPERTY_FORCENEWPAGE)
+ ,OUString(PROPERTY_NEWROWORCOL)
+ ,OUString(PROPERTY_KEEPTOGETHER)
+ ,OUString(PROPERTY_CANGROW)
+ ,OUString(PROPERTY_CANSHRINK)
+ ,OUString(PROPERTY_REPEATSECTION)
+ };
+ return uno::Sequence< OUString >(pProps,SAL_N_ELEMENTS(pProps));
+ }
+
+ const OUString pProps[] = {
+ OUString(PROPERTY_CANGROW)
+ ,OUString(PROPERTY_CANSHRINK)
+ ,OUString(PROPERTY_REPEATSECTION)
+ };
+
+ return uno::Sequence< OUString >(pProps,SAL_N_ELEMENTS(pProps));
+}
+
+uno::Reference<report::XSection> OSection::createOSection(
+ const uno::Reference< report::XReportDefinition >& xParentDef,
+ const uno::Reference< uno::XComponentContext >& context,
+ bool const bPageSection)
+{
+ rtl::Reference<OSection> pNew =
+ new OSection(xParentDef, nullptr, context, lcl_getAbsent(bPageSection));
+ pNew->init();
+ return pNew;
+}
+
+uno::Reference<report::XSection> OSection::createOSection(
+ const uno::Reference< report::XGroup >& xParentGroup,
+ const uno::Reference< uno::XComponentContext >& context)
+{
+ rtl::Reference<OSection> pNew =
+ new OSection(nullptr, xParentGroup, context, lcl_getGroupAbsent());
+ pNew->init();
+ return pNew;
+}
+
+
+OSection::OSection(const uno::Reference< report::XReportDefinition >& xParentDef
+ ,const uno::Reference< report::XGroup >& xParentGroup
+ ,const uno::Reference< uno::XComponentContext >& context
+ ,uno::Sequence< OUString> const& rStrings)
+:SectionBase(m_aMutex)
+,SectionPropertySet(context,SectionPropertySet::IMPLEMENTS_PROPERTY_SET,rStrings)
+,m_aContainerListeners(m_aMutex)
+,m_xGroup(xParentGroup)
+,m_xReportDefinition(xParentDef)
+,m_nHeight(3000)
+,m_nBackgroundColor(COL_TRANSPARENT)
+,m_nForceNewPage(report::ForceNewPage::NONE)
+,m_nNewRowOrCol(report::ForceNewPage::NONE)
+,m_bKeepTogether(false)
+,m_bRepeatSection(false)
+,m_bVisible(true)
+,m_bBacktransparent(true)
+,m_bInRemoveNotify(false)
+,m_bInInsertNotify(false)
+{
+}
+
+// TODO: VirtualFunctionFinder: This is virtual function!
+
+OSection::~OSection()
+{
+}
+
+//IMPLEMENT_FORWARD_XINTERFACE2(OSection,SectionBase,SectionPropertySet)
+IMPLEMENT_FORWARD_REFCOUNT( OSection, SectionBase )
+
+uno::Any SAL_CALL OSection::queryInterface( const uno::Type& _rType )
+{
+ uno::Any aReturn = SectionBase::queryInterface(_rType);
+ if ( !aReturn.hasValue() )
+ aReturn = SectionPropertySet::queryInterface(_rType);
+
+ if ( !aReturn.hasValue() && OReportControlModel::isInterfaceForbidden(_rType) )
+ return aReturn;
+
+ return aReturn;
+}
+
+
+void SAL_CALL OSection::dispose()
+{
+ OSL_ENSURE(!rBHelper.bDisposed,"Already disposed!");
+ SectionPropertySet::dispose();
+ uno::Reference<lang::XComponent> const xPageComponent(m_xDrawPage,
+ uno::UNO_QUERY);
+ if (xPageComponent.is())
+ {
+ xPageComponent->dispose();
+ }
+ cppu::WeakComponentImplHelperBase::dispose();
+
+}
+
+// TODO: VirtualFunctionFinder: This is virtual function!
+
+void SAL_CALL OSection::disposing()
+{
+ lang::EventObject aDisposeEvent( static_cast< ::cppu::OWeakObject* >( this ) );
+ m_aContainerListeners.disposeAndClear( aDisposeEvent );
+}
+
+OUString SAL_CALL OSection::getImplementationName( )
+{
+ return "com.sun.star.comp.report.Section";
+}
+
+uno::Sequence< OUString> OSection::getSupportedServiceNames_Static()
+{
+ uno::Sequence<OUString> aSupported { SERVICE_SECTION };
+ return aSupported;
+}
+
+uno::Sequence< OUString> SAL_CALL OSection::getSupportedServiceNames()
+{
+ return getSupportedServiceNames_Static();
+}
+
+sal_Bool SAL_CALL OSection::supportsService( const OUString& _rServiceName )
+{
+ return cppu::supportsService(this, _rServiceName);
+}
+
+void OSection::init()
+{
+ SolarMutexGuard g; // lock while manipulating SdrModel
+ uno::Reference< report::XReportDefinition> xReport = getReportDefinition();
+ std::shared_ptr<rptui::OReportModel> pModel = OReportDefinition::getSdrModel(xReport);
+ assert(pModel && "No model set at the report definition!");
+ if ( !pModel )
+ return;
+
+ uno::Reference<report::XSection> const xSection(this);
+ SdrPage & rSdrPage(*pModel->createNewPage(xSection));
+ m_xDrawPage.set(rSdrPage.getUnoPage(), uno::UNO_QUERY_THROW);
+ m_xDrawPage_ShapeGrouper.set(m_xDrawPage, uno::UNO_QUERY_THROW);
+ // apparently we may also get OReportDrawPage which doesn't support this
+ m_xDrawPage_FormSupplier.set(m_xDrawPage, uno::UNO_QUERY);
+ m_xDrawPage_Tunnel.set(m_xDrawPage, uno::UNO_QUERY_THROW);
+ // fdo#53872: now also exchange the XDrawPage in the SdrPage so that
+ // rSdrPage.getUnoPage returns this
+ rSdrPage.SetUnoPage(this);
+ // createNewPage _should_ have stored away 2 uno::References to this,
+ // so our ref count cannot be 1 here, so this isn't destroyed here
+ assert(m_refCount > 1);
+}
+
+// XSection
+
+sal_Bool SAL_CALL OSection::getVisible()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_bVisible;
+}
+
+void SAL_CALL OSection::setVisible( sal_Bool _visible )
+{
+ set(PROPERTY_VISIBLE,_visible,m_bVisible);
+}
+
+OUString SAL_CALL OSection::getName()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_sName;
+}
+
+void SAL_CALL OSection::setName( const OUString& _name )
+{
+ set(PROPERTY_NAME,_name,m_sName);
+}
+
+::sal_uInt32 SAL_CALL OSection::getHeight()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_nHeight;
+}
+
+void SAL_CALL OSection::setHeight( ::sal_uInt32 _height )
+{
+ set(PROPERTY_HEIGHT,_height,m_nHeight);
+}
+
+::sal_Int32 SAL_CALL OSection::getBackColor()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_bBacktransparent ? static_cast<sal_Int32>(COL_TRANSPARENT) : m_nBackgroundColor;
+}
+
+void SAL_CALL OSection::setBackColor( ::sal_Int32 _backgroundcolor )
+{
+ bool bTransparent = _backgroundcolor == static_cast<sal_Int32>(COL_TRANSPARENT);
+ setBackTransparent(bTransparent);
+ if ( !bTransparent )
+ set(PROPERTY_BACKCOLOR,_backgroundcolor,m_nBackgroundColor);
+}
+
+sal_Bool SAL_CALL OSection::getBackTransparent()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_bBacktransparent;
+}
+
+void SAL_CALL OSection::setBackTransparent( sal_Bool _backtransparent )
+{
+ set(PROPERTY_BACKTRANSPARENT,_backtransparent,m_bBacktransparent);
+ if ( _backtransparent )
+ set(PROPERTY_BACKCOLOR,static_cast<sal_Int32>(COL_TRANSPARENT),m_nBackgroundColor);
+}
+
+OUString SAL_CALL OSection::getConditionalPrintExpression()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_sConditionalPrintExpression;
+}
+
+void SAL_CALL OSection::setConditionalPrintExpression( const OUString& _conditionalprintexpression )
+{
+ set(PROPERTY_CONDITIONALPRINTEXPRESSION,_conditionalprintexpression,m_sConditionalPrintExpression);
+}
+
+void OSection::checkNotPageHeaderFooter()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ uno::Reference< report::XReportDefinition > xRet = m_xReportDefinition;
+ if ( xRet.is() )
+ {
+ if ( xRet->getPageHeaderOn() && xRet->getPageHeader() == *this )
+ throw beans::UnknownPropertyException();
+ if ( xRet->getPageFooterOn() && xRet->getPageFooter() == *this )
+ throw beans::UnknownPropertyException();
+ }
+}
+
+::sal_Int16 SAL_CALL OSection::getForceNewPage()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+
+ checkNotPageHeaderFooter();
+ return m_nForceNewPage;
+}
+
+void SAL_CALL OSection::setForceNewPage( ::sal_Int16 _forcenewpage )
+{
+ if ( _forcenewpage < report::ForceNewPage::NONE || _forcenewpage > report::ForceNewPage::BEFORE_AFTER_SECTION )
+ throwIllegallArgumentException(u"css::report::ForceNewPage"
+ ,*this
+ ,1);
+ checkNotPageHeaderFooter();
+ set(PROPERTY_FORCENEWPAGE,_forcenewpage,m_nForceNewPage);
+}
+
+::sal_Int16 SAL_CALL OSection::getNewRowOrCol()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ checkNotPageHeaderFooter();
+ return m_nNewRowOrCol;
+}
+
+void SAL_CALL OSection::setNewRowOrCol( ::sal_Int16 _newroworcol )
+{
+ if ( _newroworcol < report::ForceNewPage::NONE || _newroworcol > report::ForceNewPage::BEFORE_AFTER_SECTION )
+ throwIllegallArgumentException(u"css::report::ForceNewPage"
+ ,*this
+ ,1);
+ checkNotPageHeaderFooter();
+
+ set(PROPERTY_NEWROWORCOL,_newroworcol,m_nNewRowOrCol);
+}
+
+sal_Bool SAL_CALL OSection::getKeepTogether()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ checkNotPageHeaderFooter();
+ return m_bKeepTogether;
+}
+
+void SAL_CALL OSection::setKeepTogether( sal_Bool _keeptogether )
+{
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ checkNotPageHeaderFooter();
+ }
+
+ set(PROPERTY_KEEPTOGETHER,_keeptogether,m_bKeepTogether);
+}
+
+sal_Bool SAL_CALL OSection::getCanGrow()
+{
+ throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment
+}
+
+void SAL_CALL OSection::setCanGrow( sal_Bool /*_cangrow*/ )
+{
+ throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment
+}
+
+sal_Bool SAL_CALL OSection::getCanShrink()
+{
+ throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment
+}
+
+void SAL_CALL OSection::setCanShrink( sal_Bool /*_canshrink*/ )
+{
+ throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment
+}
+
+sal_Bool SAL_CALL OSection::getRepeatSection()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ uno::Reference< report::XGroup > xGroup = m_xGroup;
+ if ( !xGroup.is() )
+ throw beans::UnknownPropertyException();
+ return m_bRepeatSection;
+}
+
+void SAL_CALL OSection::setRepeatSection( sal_Bool _repeatsection )
+{
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ uno::Reference< report::XGroup > xGroup = m_xGroup;
+ if ( !xGroup.is() )
+ throw beans::UnknownPropertyException();
+ }
+ set(PROPERTY_REPEATSECTION,_repeatsection,m_bRepeatSection);
+}
+
+uno::Reference< report::XGroup > SAL_CALL OSection::getGroup()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_xGroup;
+}
+
+uno::Reference< report::XReportDefinition > SAL_CALL OSection::getReportDefinition()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ uno::Reference< report::XReportDefinition > xRet = m_xReportDefinition;
+ uno::Reference< report::XGroup > xGroup = m_xGroup;
+ if ( !xRet.is() && xGroup.is() )
+ {
+ uno::Reference< report::XGroups> xGroups(xGroup->getGroups());
+ if ( xGroups.is() )
+ xRet = xGroups->getReportDefinition();
+ }
+
+ return xRet;
+}
+
+// XChild
+uno::Reference< uno::XInterface > SAL_CALL OSection::getParent( )
+{
+ uno::Reference< uno::XInterface > xRet;
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ xRet = m_xReportDefinition;
+ if ( !xRet.is() )
+ xRet = m_xGroup;
+ }
+ return xRet;
+}
+
+void SAL_CALL OSection::setParent( const uno::Reference< uno::XInterface >& /*Parent*/ )
+{
+ throw lang::NoSupportException();
+}
+
+// XContainer
+void SAL_CALL OSection::addContainerListener( const uno::Reference< container::XContainerListener >& xListener )
+{
+ m_aContainerListeners.addInterface(xListener);
+}
+
+void SAL_CALL OSection::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener )
+{
+ m_aContainerListeners.removeInterface(xListener);
+}
+
+// XElementAccess
+uno::Type SAL_CALL OSection::getElementType( )
+{
+ return cppu::UnoType<report::XReportComponent>::get();
+}
+
+sal_Bool SAL_CALL OSection::hasElements( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_xDrawPage.is() && m_xDrawPage->hasElements();
+}
+
+// XIndexAccess
+::sal_Int32 SAL_CALL OSection::getCount( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_xDrawPage.is() ? m_xDrawPage->getCount() : 0;
+}
+
+uno::Any SAL_CALL OSection::getByIndex( ::sal_Int32 Index )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_xDrawPage.is() ? m_xDrawPage->getByIndex(Index) : uno::Any();
+}
+
+// XEnumerationAccess
+uno::Reference< container::XEnumeration > SAL_CALL OSection::createEnumeration( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return new ::comphelper::OEnumerationByIndex(static_cast<XSection*>(this));
+}
+
+uno::Reference< beans::XPropertySetInfo > SAL_CALL OSection::getPropertySetInfo( )
+{
+ return SectionPropertySet::getPropertySetInfo();
+}
+
+void SAL_CALL OSection::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
+{
+ SectionPropertySet::setPropertyValue( aPropertyName, aValue );
+}
+
+uno::Any SAL_CALL OSection::getPropertyValue( const OUString& PropertyName )
+{
+ return SectionPropertySet::getPropertyValue( PropertyName);
+}
+
+void SAL_CALL OSection::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener )
+{
+ SectionPropertySet::addPropertyChangeListener( aPropertyName, xListener );
+}
+
+void SAL_CALL OSection::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener )
+{
+ SectionPropertySet::removePropertyChangeListener( aPropertyName, aListener );
+}
+
+void SAL_CALL OSection::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+{
+ SectionPropertySet::addVetoableChangeListener( PropertyName, aListener );
+}
+
+void SAL_CALL OSection::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+{
+ SectionPropertySet::removeVetoableChangeListener( PropertyName, aListener );
+}
+
+void SAL_CALL OSection::add( const uno::Reference< drawing::XShape >& xShape )
+{
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ m_bInInsertNotify = true;
+ OSL_ENSURE(m_xDrawPage.is(),"No DrawPage!");
+ m_xDrawPage->add(xShape);
+ m_bInInsertNotify = false;
+ }
+ notifyElementAdded(xShape);
+}
+
+void SAL_CALL OSection::remove( const uno::Reference< drawing::XShape >& xShape )
+{
+ {
+ ::osl::MutexGuard aGuard(m_aMutex);
+ m_bInRemoveNotify = true;
+ OSL_ENSURE(m_xDrawPage.is(),"No DrawPage!");
+ m_xDrawPage->remove(xShape);
+ m_bInRemoveNotify = false;
+ }
+ notifyElementRemoved(xShape);
+}
+
+// XShapeGrouper
+uno::Reference< drawing::XShapeGroup > SAL_CALL
+OSection::group(uno::Reference< drawing::XShapes > const& xShapes)
+{
+ // no lock because m_xDrawPage_ShapeGrouper is const
+ return (m_xDrawPage_ShapeGrouper.is())
+ ? m_xDrawPage_ShapeGrouper->group(xShapes)
+ : nullptr;
+}
+void SAL_CALL
+OSection::ungroup(uno::Reference<drawing::XShapeGroup> const& xGroup)
+{
+ // no lock because m_xDrawPage_ShapeGrouper is const
+ if (m_xDrawPage_ShapeGrouper.is()) {
+ m_xDrawPage_ShapeGrouper->ungroup(xGroup);
+ }
+}
+
+// XFormsSupplier
+uno::Reference<container::XNameContainer> SAL_CALL OSection::getForms()
+{
+ // no lock because m_xDrawPage_FormSupplier is const
+ return (m_xDrawPage_FormSupplier.is())
+ ? m_xDrawPage_FormSupplier->getForms()
+ : nullptr;
+}
+// XFormsSupplier2
+sal_Bool SAL_CALL OSection::hasForms()
+{
+ // no lock because m_xDrawPage_FormSupplier is const
+ return (m_xDrawPage_FormSupplier.is())
+ && m_xDrawPage_FormSupplier->hasForms();
+}
+
+
+// css::lang::XUnoTunnel
+
+sal_Int64 OSection::getSomething( const uno::Sequence< sal_Int8 > & rId )
+{
+ if (comphelper::isUnoTunnelId<OSection>(rId) )
+ return comphelper::getSomething_cast(this);
+ return (m_xDrawPage_Tunnel.is()) ? m_xDrawPage_Tunnel->getSomething(rId) : 0;
+}
+
+const uno::Sequence< sal_Int8 > & OSection::getUnoTunnelId()
+{
+ static const comphelper::UnoIdInit implId;
+ return implId.getSeq();
+}
+
+void OSection::notifyElementAdded(const uno::Reference< drawing::XShape >& xShape )
+{
+ if ( !m_bInInsertNotify )
+ {
+ container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::Any(), uno::Any(xShape), uno::Any());
+ m_aContainerListeners.notifyEach(&container::XContainerListener::elementInserted,aEvent);
+ }
+}
+
+void OSection::notifyElementRemoved(const uno::Reference< drawing::XShape >& xShape)
+{
+ if ( !m_bInRemoveNotify )
+ {
+ // notify our container listeners
+ container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::Any(), uno::Any(xShape), uno::Any());
+ m_aContainerListeners.notifyEach(&container::XContainerListener::elementRemoved,aEvent);
+ }
+}
+
+} // namespace reportdesign
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/reportdesign/source/core/api/Shape.cxx b/reportdesign/source/core/api/Shape.cxx
new file mode 100644
index 000000000..413f02e1b
--- /dev/null
+++ b/reportdesign/source/core/api/Shape.cxx
@@ -0,0 +1,494 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#include <Shape.hxx>
+
+#include <cppuhelper/supportsservice.hxx>
+#include <svx/svdobj.hxx>
+#include <tools/diagnose_ex.h>
+
+#include <strings.hxx>
+#include <strings.hrc>
+#include <core_resource.hxx>
+#include <Tools.hxx>
+#include <FormatCondition.hxx>
+#include <ReportHelperImpl.hxx>
+
+namespace reportdesign
+{
+
+ using namespace com::sun::star;
+ using namespace comphelper;
+static uno::Sequence< OUString > lcl_getShapeOptionals()
+{
+ const OUString pProps[] = {
+ OUString(PROPERTY_DATAFIELD)
+ ,OUString(PROPERTY_CONTROLBACKGROUND)
+ ,OUString(PROPERTY_CONTROLBACKGROUNDTRANSPARENT)
+ };
+ return uno::Sequence< OUString >(pProps,SAL_N_ELEMENTS(pProps));
+}
+
+
+OShape::OShape(uno::Reference< uno::XComponentContext > const & _xContext)
+:ShapeBase(m_aMutex)
+,ShapePropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,lcl_getShapeOptionals())
+,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext)
+,m_nZOrder(0)
+,m_bOpaque(false)
+{
+ m_aProps.aComponent.m_sName = RptResId(RID_STR_SHAPE);
+}
+
+OShape::OShape(uno::Reference< uno::XComponentContext > const & _xContext
+ ,const uno::Reference< lang::XMultiServiceFactory>& _xFactory
+ ,uno::Reference< drawing::XShape >& _xShape
+ ,const OUString& _sServiceName)
+:ShapeBase(m_aMutex)
+,ShapePropertySet(_xContext,IMPLEMENTS_PROPERTY_SET,lcl_getShapeOptionals())
+,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext)
+,m_nZOrder(0)
+,m_bOpaque(false)
+,m_sServiceName(_sServiceName)
+{
+ m_aProps.aComponent.m_sName = RptResId(RID_STR_SHAPE);
+ m_aProps.aComponent.m_xFactory = _xFactory;
+ osl_atomic_increment( &m_refCount );
+ {
+ uno::Reference<beans::XPropertySet> xProp(_xShape,uno::UNO_QUERY);
+ if ( xProp.is() )
+ {
+ xProp->getPropertyValue(PROPERTY_ZORDER) >>= m_nZOrder;
+ xProp.clear();
+ }
+ m_aProps.aComponent.setShape(_xShape,this,m_refCount);
+ }
+ osl_atomic_decrement( &m_refCount );
+}
+
+OShape::~OShape()
+{
+}
+
+//IMPLEMENT_FORWARD_XINTERFACE2(OShape,ShapeBase,ShapePropertySet)
+IMPLEMENT_FORWARD_REFCOUNT( OShape, ShapeBase )
+
+uno::Any SAL_CALL OShape::queryInterface( const uno::Type& _rType )
+{
+ uno::Any aReturn = ShapeBase::queryInterface(_rType);
+ if ( !aReturn.hasValue() )
+ aReturn = ShapePropertySet::queryInterface(_rType);
+
+ if ( !aReturn.hasValue() && OReportControlModel::isInterfaceForbidden(_rType) )
+ return aReturn;
+
+ return aReturn.hasValue() ? aReturn : (m_aProps.aComponent.m_xProxy.is() ? m_aProps.aComponent.m_xProxy->queryAggregation(_rType) : aReturn);
+}
+
+
+void SAL_CALL OShape::dispose()
+{
+ ShapePropertySet::dispose();
+ cppu::WeakComponentImplHelperBase::dispose();
+}
+
+uno::Reference< uno::XInterface > OShape::create(uno::Reference< uno::XComponentContext > const & xContext)
+{
+ return *(new OShape(xContext));
+}
+
+
+OUString OShape::getImplementationName_Static( )
+{
+ return "com.sun.star.comp.report.Shape";
+}
+
+
+OUString SAL_CALL OShape::getImplementationName( )
+{
+ return getImplementationName_Static();
+}
+
+uno::Sequence< OUString > OShape::getSupportedServiceNames_Static( )
+{
+ return { SERVICE_SHAPE };
+}
+
+uno::Sequence< OUString > SAL_CALL OShape::getSupportedServiceNames( )
+{
+ if(m_sServiceName.isEmpty())
+ {
+ return getSupportedServiceNames_Static();
+ }
+ else
+ {
+ return { SERVICE_SHAPE, m_sServiceName };
+ }
+}
+
+sal_Bool SAL_CALL OShape::supportsService(const OUString& ServiceName)
+{
+ return cppu::supportsService(this, ServiceName);
+}
+
+// XReportComponent
+REPORTCOMPONENT_IMPL(OShape,m_aProps.aComponent)
+REPORTCOMPONENT_IMPL2(OShape,m_aProps.aComponent)
+REPORTCOMPONENT_MASTERDETAIL(OShape,m_aProps.aComponent)
+REPORTCONTROLFORMAT_IMPL2(OShape,m_aProps.aFormatProperties)
+
+::sal_Int32 SAL_CALL OShape::getControlBackground()
+{
+ throw beans::UnknownPropertyException();
+}
+
+void SAL_CALL OShape::setControlBackground( ::sal_Int32 /*_backgroundcolor*/ )
+{
+ throw beans::UnknownPropertyException();
+}
+
+sal_Bool SAL_CALL OShape::getControlBackgroundTransparent()
+{
+ throw beans::UnknownPropertyException();
+}
+
+void SAL_CALL OShape::setControlBackgroundTransparent( sal_Bool /*_controlbackgroundtransparent*/ )
+{
+ throw beans::UnknownPropertyException();
+}
+
+uno::Reference< beans::XPropertySetInfo > SAL_CALL OShape::getPropertySetInfo( )
+{
+
+ //return ShapePropertySet::getPropertySetInfo();
+ return cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() );
+}
+
+cppu::IPropertyArrayHelper& OShape::getInfoHelper()
+{
+ if (!m_pAggHelper)
+ {
+ uno::Sequence<beans::Property> aAggSeq;
+ if ( m_aProps.aComponent.m_xProperty.is() )
+ aAggSeq = m_aProps.aComponent.m_xProperty->getPropertySetInfo()->getProperties();
+ m_pAggHelper.reset(new OPropertyArrayAggregationHelper(ShapePropertySet::getPropertySetInfo()->getProperties(),aAggSeq));
+ }
+ return *m_pAggHelper;
+}
+
+
+void SAL_CALL OShape::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
+{
+ getInfoHelper();
+ if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate )
+ m_aProps.aComponent.m_xProperty->setPropertyValue( aPropertyName,aValue);
+ // can be in both
+ if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Delegator )
+ ShapePropertySet::setPropertyValue( aPropertyName, aValue );
+}
+
+uno::Any SAL_CALL OShape::getPropertyValue( const OUString& PropertyName )
+{
+ getInfoHelper();
+ if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate )
+ return m_aProps.aComponent.m_xProperty->getPropertyValue( PropertyName);
+ // can be in both
+ if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Delegator )
+ return ShapePropertySet::getPropertyValue( PropertyName);
+ return uno::Any();
+}
+
+void SAL_CALL OShape::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener )
+{
+ getInfoHelper();
+ if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate || aPropertyName.isEmpty() )
+ m_aProps.aComponent.m_xProperty->addPropertyChangeListener( aPropertyName, xListener);
+ // can be in both
+ if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Delegator || aPropertyName.isEmpty() )
+ ShapePropertySet::addPropertyChangeListener( aPropertyName, xListener );
+}
+
+void SAL_CALL OShape::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener )
+{
+ getInfoHelper();
+ if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate || aPropertyName.isEmpty() )
+ m_aProps.aComponent.m_xProperty->removePropertyChangeListener( aPropertyName, aListener );
+ // can be in both
+ if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Delegator || aPropertyName.isEmpty() )
+ ShapePropertySet::removePropertyChangeListener( aPropertyName, aListener );
+}
+
+void SAL_CALL OShape::addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+{
+ getInfoHelper();
+ if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate || PropertyName.isEmpty() )
+ m_aProps.aComponent.m_xProperty->addVetoableChangeListener( PropertyName, aListener );
+ // can be in both
+ if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Delegator || PropertyName.isEmpty() )
+ ShapePropertySet::addVetoableChangeListener( PropertyName, aListener );
+}
+
+void SAL_CALL OShape::removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+{
+ getInfoHelper();
+ if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Aggregate || PropertyName.isEmpty() )
+ m_aProps.aComponent.m_xProperty->removeVetoableChangeListener( PropertyName, aListener );
+ // can be in both
+ if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::PropertyOrigin::Delegator || PropertyName.isEmpty() )
+ ShapePropertySet::removeVetoableChangeListener( PropertyName, aListener );
+}
+
+// XReportControlModel
+OUString SAL_CALL OShape::getDataField()
+{
+ throw beans::UnknownPropertyException();
+}
+
+void SAL_CALL OShape::setDataField( const OUString& /*_datafield*/ )
+{
+ throw beans::UnknownPropertyException();
+}
+
+sal_Bool SAL_CALL OShape::getPrintWhenGroupChange()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aProps.bPrintWhenGroupChange;
+}
+
+void SAL_CALL OShape::setPrintWhenGroupChange( sal_Bool _printwhengroupchange )
+{
+ set(PROPERTY_PRINTWHENGROUPCHANGE,_printwhengroupchange,m_aProps.bPrintWhenGroupChange);
+}
+
+OUString SAL_CALL OShape::getConditionalPrintExpression()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_aProps.aConditionalPrintExpression;
+}
+
+void SAL_CALL OShape::setConditionalPrintExpression( const OUString& _conditionalprintexpression )
+{
+ set(PROPERTY_CONDITIONALPRINTEXPRESSION,_conditionalprintexpression,m_aProps.aConditionalPrintExpression);
+}
+
+
+// XCloneable
+uno::Reference< util::XCloneable > SAL_CALL OShape::createClone( )
+{
+ uno::Reference< report::XReportComponent> xSource = this;
+ uno::Reference< report::XReportComponent> xSet;
+ try
+ {
+ SdrObject* pObject = SdrObject::getSdrObjectFromXShape( xSource );
+ if ( pObject )
+ {
+ SdrObject* pClone(pObject->CloneSdrObject(pObject->getSdrModelFromSdrObject()));
+ if ( pClone )
+ {
+ xSet.set(pClone->getUnoShape(),uno::UNO_QUERY_THROW );
+ }
+ }
+ }
+ catch(const uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION("reportdesign");
+ }
+ return xSet;
+}
+
+// XChild
+uno::Reference< uno::XInterface > SAL_CALL OShape::getParent( )
+{
+ return OShapeHelper::getParent(this);
+}
+
+void SAL_CALL OShape::setParent( const uno::Reference< uno::XInterface >& Parent )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ m_aProps.aComponent.m_xParent = uno::Reference< container::XChild >(Parent,uno::UNO_QUERY);
+}
+uno::Reference< report::XFormatCondition > SAL_CALL OShape::createFormatCondition( )
+{
+ return new OFormatCondition(m_aProps.aComponent.m_xContext);
+}
+
+// XContainer
+void SAL_CALL OShape::addContainerListener( const uno::Reference< container::XContainerListener >& xListener )
+{
+ m_aProps.addContainerListener(xListener);
+}
+
+void SAL_CALL OShape::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener )
+{
+ m_aProps.removeContainerListener(xListener);
+}
+
+// XElementAccess
+uno::Type SAL_CALL OShape::getElementType( )
+{
+ return cppu::UnoType<report::XFormatCondition>::get();
+}
+
+sal_Bool SAL_CALL OShape::hasElements( )
+{
+ return m_aProps.hasElements();
+}
+
+// XIndexContainer
+void SAL_CALL OShape::insertByIndex( ::sal_Int32 Index, const uno::Any& Element )
+{
+ m_aProps.insertByIndex(Index,Element);
+}
+
+void SAL_CALL OShape::removeByIndex( ::sal_Int32 Index )
+{
+ m_aProps.removeByIndex(Index);
+}
+
+// XIndexReplace
+void SAL_CALL OShape::replaceByIndex( ::sal_Int32 Index, const uno::Any& Element )
+{
+ m_aProps.replaceByIndex(Index,Element);
+}
+
+// XIndexAccess
+::sal_Int32 SAL_CALL OShape::getCount( )
+{
+ return m_aProps.getCount();
+}
+
+uno::Any SAL_CALL OShape::getByIndex( ::sal_Int32 Index )
+{
+ return m_aProps.getByIndex( Index );
+}
+
+// XShape
+awt::Point SAL_CALL OShape::getPosition( )
+{
+ return OShapeHelper::getPosition(this);
+}
+
+void SAL_CALL OShape::setPosition( const awt::Point& aPosition )
+{
+ OShapeHelper::setPosition(aPosition,this);
+}
+
+awt::Size SAL_CALL OShape::getSize( )
+{
+ return OShapeHelper::getSize(this);
+}
+
+void SAL_CALL OShape::setSize( const awt::Size& aSize )
+{
+ OShapeHelper::setSize(aSize,this);
+}
+
+
+// XShapeDescriptor
+OUString SAL_CALL OShape::getShapeType( )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if ( m_aProps.aComponent.m_xShape.is() )
+ return m_aProps.aComponent.m_xShape->getShapeType();
+ return "com.sun.star.drawing.CustomShape";
+}
+
+::sal_Int32 SAL_CALL OShape::getZOrder()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ m_aProps.aComponent.m_xProperty->getPropertyValue(PROPERTY_ZORDER) >>= m_nZOrder;
+ return m_nZOrder;
+}
+
+void SAL_CALL OShape::setZOrder( ::sal_Int32 _zorder )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ m_aProps.aComponent.m_xProperty->setPropertyValue(PROPERTY_ZORDER,uno::Any(_zorder));
+ set(PROPERTY_ZORDER,_zorder,m_nZOrder);
+}
+
+sal_Bool SAL_CALL OShape::getOpaque()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ return m_bOpaque;
+}
+
+void SAL_CALL OShape::setOpaque( sal_Bool _opaque )
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ set(PROPERTY_OPAQUE,_opaque,m_bOpaque);
+}
+
+drawing::HomogenMatrix3 SAL_CALL OShape::getTransformation()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ m_aProps.aComponent.m_xProperty->getPropertyValue(PROPERTY_TRANSFORMATION) >>= m_Transformation;
+ return m_Transformation;
+}
+
+void SAL_CALL OShape::setTransformation( const drawing::HomogenMatrix3& _transformation )
+{
+ m_aProps.aComponent.m_xProperty->setPropertyValue(PROPERTY_TRANSFORMATION,uno::Any(_transformation));
+ set(PROPERTY_TRANSFORMATION,_transformation,m_Transformation);
+}
+
+OUString SAL_CALL OShape::getCustomShapeEngine()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ m_aProps.aComponent.m_xProperty->getPropertyValue(PROPERTY_CUSTOMSHAPEENGINE) >>= m_CustomShapeEngine;
+
+ return m_CustomShapeEngine;
+}
+
+void SAL_CALL OShape::setCustomShapeEngine( const OUString& _customshapeengine )
+{
+ m_aProps.aComponent.m_xProperty->setPropertyValue(PROPERTY_CUSTOMSHAPEENGINE,uno::Any(_customshapeengine));
+ set(PROPERTY_CUSTOMSHAPEENGINE,_customshapeengine,m_CustomShapeEngine);
+}
+
+OUString SAL_CALL OShape::getCustomShapeData()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ m_aProps.aComponent.m_xProperty->getPropertyValue(PROPERTY_CUSTOMSHAPEDATA) >>= m_CustomShapeData;
+ return m_CustomShapeData;
+}
+
+void SAL_CALL OShape::setCustomShapeData( const OUString& _customshapedata )
+{
+ m_aProps.aComponent.m_xProperty->setPropertyValue(PROPERTY_CUSTOMSHAPEDATA,uno::Any(_customshapedata));
+ set(PROPERTY_CUSTOMSHAPEDATA,_customshapedata,m_CustomShapeData);
+}
+
+uno::Sequence< beans::PropertyValue > SAL_CALL OShape::getCustomShapeGeometry()
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ m_aProps.aComponent.m_xProperty->getPropertyValue(PROPERTY_CUSTOMSHAPEGEOMETRY) >>= m_CustomShapeGeometry;
+ return m_CustomShapeGeometry;
+}
+
+void SAL_CALL OShape::setCustomShapeGeometry( const uno::Sequence< beans::PropertyValue >& _customshapegeometry )
+{
+ m_aProps.aComponent.m_xProperty->setPropertyValue(PROPERTY_CUSTOMSHAPEGEOMETRY,uno::Any(_customshapegeometry));
+ set(PROPERTY_CUSTOMSHAPEGEOMETRY,_customshapegeometry,m_CustomShapeGeometry);
+}
+
+
+}// namespace reportdesign
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/reportdesign/source/core/api/Tools.cxx b/reportdesign/source/core/api/Tools.cxx
new file mode 100644
index 000000000..8f066a68d
--- /dev/null
+++ b/reportdesign/source/core/api/Tools.cxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#include <Tools.hxx>
+#include <strings.hrc>
+#include <core_resource.hxx>
+#include <comphelper/property.hxx>
+
+
+namespace reportdesign
+{
+
+using namespace com::sun::star;
+
+uno::Reference< report::XSection> lcl_getSection(const uno::Reference< uno::XInterface>& _xReportComponent)
+{
+ uno::Reference< container::XChild> xChild(_xReportComponent,uno::UNO_QUERY);
+ uno::Reference< report::XSection> xRet(_xReportComponent,uno::UNO_QUERY);
+ while( !xRet.is() && xChild.is() )
+ {
+ uno::Reference< uno::XInterface> xTemp = xChild->getParent();
+ xChild.set(xTemp,uno::UNO_QUERY);
+ xRet.set(xTemp,uno::UNO_QUERY);
+ }
+ return xRet;
+}
+
+void throwIllegallArgumentException( std::u16string_view _sTypeName
+ ,const uno::Reference< uno::XInterface >& ExceptionContext_
+ ,sal_Int16 ArgumentPosition_
+ )
+{
+ OUString sErrorMessage(RptResId(RID_STR_ERROR_WRONG_ARGUMENT));
+ sErrorMessage = sErrorMessage.replaceAt(sErrorMessage.indexOf('#'),2,_sTypeName);
+ throw lang::IllegalArgumentException(sErrorMessage,ExceptionContext_,ArgumentPosition_);
+}
+
+uno::Reference< util::XCloneable > cloneObject(const uno::Reference< report::XReportComponent>& _xReportComponent
+ ,const uno::Reference< lang::XMultiServiceFactory>& _xFactory
+ ,const OUString& _sServiceName)
+{
+ OSL_ENSURE(_xReportComponent.is() && _xFactory.is() ,"reportcomponent is null -> GPF");
+ uno::Reference< report::XReportComponent> xClone(_xFactory->createInstance(_sServiceName),uno::UNO_QUERY_THROW);
+ ::comphelper::copyProperties(_xReportComponent, xClone);
+ return xClone;
+}
+
+
+} // namespace reportdesign
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/reportdesign/source/core/api/services.cxx b/reportdesign/source/core/api/services.cxx
new file mode 100644
index 000000000..de07c51e8
--- /dev/null
+++ b/reportdesign/source/core/api/services.cxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#include <sal/types.h>
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/implementationentry.hxx>
+#include <ReportDefinition.hxx>
+#include <FormattedField.hxx>
+#include <FixedText.hxx>
+#include <ImageControl.hxx>
+#include <FormatCondition.hxx>
+#include <ReportEngineJFree.hxx>
+#include <Function.hxx>
+#include <Shape.hxx>
+#include <FixedLine.hxx>
+
+/********************************************************************************************/
+
+using namespace ::reportdesign;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+
+// registry functions
+namespace
+{
+cppu::ImplementationEntry const entries[]
+ = { { &OReportDefinition::create, &OReportDefinition::getImplementationName_Static,
+ &OReportDefinition::getSupportedServiceNames_Static, &cppu::createSingleComponentFactory,
+ nullptr, 0 },
+ { &OFormattedField::create, &OFormattedField::getImplementationName_Static,
+ &OFormattedField::getSupportedServiceNames_Static, &cppu::createSingleComponentFactory,
+ nullptr, 0 },
+ { &OFixedText::create, &OFixedText::getImplementationName_Static,
+ &OFixedText::getSupportedServiceNames_Static, &cppu::createSingleComponentFactory,
+ nullptr, 0 },
+ { &OImageControl::create, &OImageControl::getImplementationName_Static,
+ &OImageControl::getSupportedServiceNames_Static, &cppu::createSingleComponentFactory,
+ nullptr, 0 },
+ { &OFormatCondition::create, &OFormatCondition::getImplementationName_Static,
+ &OFormatCondition::getSupportedServiceNames_Static, &cppu::createSingleComponentFactory,
+ nullptr, 0 },
+ { &OReportEngineJFree::create, &OReportEngineJFree::getImplementationName_Static,
+ &OReportEngineJFree::getSupportedServiceNames_Static, &cppu::createSingleComponentFactory,
+ nullptr, 0 },
+ { &OFunction::create, &OFunction::getImplementationName_Static,
+ &OFunction::getSupportedServiceNames_Static, &cppu::createSingleComponentFactory, nullptr,
+ 0 },
+ { &OShape::create, &OShape::getImplementationName_Static,
+ &OShape::getSupportedServiceNames_Static, &cppu::createSingleComponentFactory, nullptr,
+ 0 },
+ { &OFixedLine::create, &OFixedLine::getImplementationName_Static,
+ &OFixedLine::getSupportedServiceNames_Static, &cppu::createSingleComponentFactory,
+ nullptr, 0 },
+ { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } };
+}
+
+extern "C" {
+SAL_DLLPUBLIC_EXPORT void* rpt_component_getFactory(char const* implName, void* serviceManager,
+ void* registryKey)
+{
+ return cppu::component_getFactoryHelper(implName, serviceManager, registryKey, entries);
+}
+
+} // extern "C"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */