From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- reportdesign/source/core/api/FixedLine.cxx | 565 +++++ reportdesign/source/core/api/FixedText.cxx | 323 +++ reportdesign/source/core/api/FormatCondition.cxx | 147 ++ reportdesign/source/core/api/FormattedField.cxx | 361 +++ reportdesign/source/core/api/Function.cxx | 201 ++ reportdesign/source/core/api/Functions.cxx | 193 ++ reportdesign/source/core/api/Group.cxx | 321 +++ reportdesign/source/core/api/Groups.cxx | 195 ++ reportdesign/source/core/api/ImageControl.cxx | 482 ++++ reportdesign/source/core/api/ReportComponent.cxx | 133 + .../source/core/api/ReportControlModel.cxx | 134 + reportdesign/source/core/api/ReportDefinition.cxx | 2666 ++++++++++++++++++++ reportdesign/source/core/api/ReportEngineJFree.cxx | 370 +++ reportdesign/source/core/api/ReportVisitor.cxx | 90 + reportdesign/source/core/api/Section.cxx | 601 +++++ reportdesign/source/core/api/Shape.cxx | 494 ++++ reportdesign/source/core/api/Tools.cxx | 67 + reportdesign/source/core/api/services.cxx | 82 + reportdesign/source/core/inc/FixedLine.hxx | 169 ++ reportdesign/source/core/inc/FixedText.hxx | 185 ++ reportdesign/source/core/inc/FormatCondition.hxx | 146 ++ reportdesign/source/core/inc/FormattedField.hxx | 192 ++ reportdesign/source/core/inc/Function.hxx | 134 + reportdesign/source/core/inc/Functions.hxx | 99 + reportdesign/source/core/inc/Group.hxx | 168 ++ reportdesign/source/core/inc/Groups.hxx | 100 + reportdesign/source/core/inc/ImageControl.hxx | 171 ++ reportdesign/source/core/inc/ReportComponent.hxx | 82 + .../source/core/inc/ReportControlModel.hxx | 138 + reportdesign/source/core/inc/ReportDrawPage.hxx | 42 + reportdesign/source/core/inc/ReportEngineJFree.hxx | 133 + reportdesign/source/core/inc/ReportHelperImpl.hxx | 1293 ++++++++++ reportdesign/source/core/inc/ReportUndoFactory.hxx | 74 + reportdesign/source/core/inc/RptObjectListener.hxx | 50 + reportdesign/source/core/inc/Section.hxx | 232 ++ reportdesign/source/core/inc/Shape.hxx | 209 ++ reportdesign/source/core/inc/Tools.hxx | 155 ++ reportdesign/source/core/inc/conditionupdater.hxx | 62 + .../source/core/misc/conditionalexpression.cxx | 187 ++ reportdesign/source/core/misc/conditionupdater.cxx | 118 + reportdesign/source/core/misc/reportformula.cxx | 124 + .../source/core/resource/core_resource.cxx | 23 + reportdesign/source/core/sdr/PropertyForward.cxx | 180 ++ reportdesign/source/core/sdr/ReportDrawPage.cxx | 149 ++ reportdesign/source/core/sdr/ReportUndoFactory.cxx | 157 ++ reportdesign/source/core/sdr/RptModel.cxx | 187 ++ reportdesign/source/core/sdr/RptObject.cxx | 1219 +++++++++ reportdesign/source/core/sdr/RptObjectListener.cxx | 69 + reportdesign/source/core/sdr/RptPage.cxx | 192 ++ reportdesign/source/core/sdr/UndoActions.cxx | 407 +++ reportdesign/source/core/sdr/UndoEnv.cxx | 619 +++++ reportdesign/source/core/sdr/formatnormalizer.cxx | 258 ++ reportdesign/source/core/sdr/formatnormalizer.hxx | 86 + 53 files changed, 15234 insertions(+) create mode 100644 reportdesign/source/core/api/FixedLine.cxx create mode 100644 reportdesign/source/core/api/FixedText.cxx create mode 100644 reportdesign/source/core/api/FormatCondition.cxx create mode 100644 reportdesign/source/core/api/FormattedField.cxx create mode 100644 reportdesign/source/core/api/Function.cxx create mode 100644 reportdesign/source/core/api/Functions.cxx create mode 100644 reportdesign/source/core/api/Group.cxx create mode 100644 reportdesign/source/core/api/Groups.cxx create mode 100644 reportdesign/source/core/api/ImageControl.cxx create mode 100644 reportdesign/source/core/api/ReportComponent.cxx create mode 100644 reportdesign/source/core/api/ReportControlModel.cxx create mode 100644 reportdesign/source/core/api/ReportDefinition.cxx create mode 100644 reportdesign/source/core/api/ReportEngineJFree.cxx create mode 100644 reportdesign/source/core/api/ReportVisitor.cxx create mode 100644 reportdesign/source/core/api/Section.cxx create mode 100644 reportdesign/source/core/api/Shape.cxx create mode 100644 reportdesign/source/core/api/Tools.cxx create mode 100644 reportdesign/source/core/api/services.cxx create mode 100644 reportdesign/source/core/inc/FixedLine.hxx create mode 100644 reportdesign/source/core/inc/FixedText.hxx create mode 100644 reportdesign/source/core/inc/FormatCondition.hxx create mode 100644 reportdesign/source/core/inc/FormattedField.hxx create mode 100644 reportdesign/source/core/inc/Function.hxx create mode 100644 reportdesign/source/core/inc/Functions.hxx create mode 100644 reportdesign/source/core/inc/Group.hxx create mode 100644 reportdesign/source/core/inc/Groups.hxx create mode 100644 reportdesign/source/core/inc/ImageControl.hxx create mode 100644 reportdesign/source/core/inc/ReportComponent.hxx create mode 100644 reportdesign/source/core/inc/ReportControlModel.hxx create mode 100644 reportdesign/source/core/inc/ReportDrawPage.hxx create mode 100644 reportdesign/source/core/inc/ReportEngineJFree.hxx create mode 100644 reportdesign/source/core/inc/ReportHelperImpl.hxx create mode 100644 reportdesign/source/core/inc/ReportUndoFactory.hxx create mode 100644 reportdesign/source/core/inc/RptObjectListener.hxx create mode 100644 reportdesign/source/core/inc/Section.hxx create mode 100644 reportdesign/source/core/inc/Shape.hxx create mode 100644 reportdesign/source/core/inc/Tools.hxx create mode 100644 reportdesign/source/core/inc/conditionupdater.hxx create mode 100644 reportdesign/source/core/misc/conditionalexpression.cxx create mode 100644 reportdesign/source/core/misc/conditionupdater.cxx create mode 100644 reportdesign/source/core/misc/reportformula.cxx create mode 100644 reportdesign/source/core/resource/core_resource.cxx create mode 100644 reportdesign/source/core/sdr/PropertyForward.cxx create mode 100644 reportdesign/source/core/sdr/ReportDrawPage.cxx create mode 100644 reportdesign/source/core/sdr/ReportUndoFactory.cxx create mode 100644 reportdesign/source/core/sdr/RptModel.cxx create mode 100644 reportdesign/source/core/sdr/RptObject.cxx create mode 100644 reportdesign/source/core/sdr/RptObjectListener.cxx create mode 100644 reportdesign/source/core/sdr/RptPage.cxx create mode 100644 reportdesign/source/core/sdr/UndoActions.cxx create mode 100644 reportdesign/source/core/sdr/UndoEnv.cxx create mode 100644 reportdesign/source/core/sdr/formatnormalizer.cxx create mode 100644 reportdesign/source/core/sdr/formatnormalizer.hxx (limited to 'reportdesign/source/core') 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 +#include +#include +#include +#include +#include +#include +#include +#include + +#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::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(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(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 +#include +#include +#include +#include +#include +#include +#include +#include + +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::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 +#include +#include +#include +#include + +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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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::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 +#include +#include + +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 +#include +#include +#include +#include +#include +#include + +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(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(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(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(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::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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +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 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 +#include +#include +#include +#include +#include +#include + +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(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(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(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(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::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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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(COL_TRANSPARENT) : m_aProps.aFormatProperties.nBackgroundColor; +} + +void SAL_CALL OImageControl::setControlBackground( ::sal_Int32 _backgroundcolor ) +{ + bool bTransparent = _backgroundcolor == static_cast(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(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::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 + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +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 +#include +#include +#include +#include +namespace reportdesign +{ +using namespace com::sun::star; +using namespace comphelper; + +// XContainer +void OReportControlModel::addContainerListener( + const uno::Reference& xListener) +{ + aContainerListeners.addInterface(xListener); +} + +void OReportControlModel::removeContainerListener( + const uno::Reference& 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 xElement(Element, uno::UNO_QUERY); + if (!xElement.is()) + throw lang::IllegalArgumentException(); + + uno::Reference xBroadcaster; + { + ::osl::MutexGuard aGuard(m_rMutex); + xBroadcaster = m_pOwner; + if (Index > static_cast(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 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 xElement(Element, uno::UNO_QUERY); + if (!xElement.is()) + throw lang::IllegalArgumentException(); + uno::Reference 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::get() + || _rType == cppu::UnoType::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 + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// 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 const & _rModel) +{ + uno::Reference 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 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::get(), css::uno::Any(OUString("Default")) ); + + registerPropertyNoMember(PROPERTY_BACKCOLOR, ++i,nBound, cppu::UnoType::get(), css::uno::Any(COL_TRANSPARENT)); + + registerPropertyNoMember(PROPERTY_BACKGRAPHICLOCATION, ++i,nBound, cppu::UnoType::get(), css::uno::Any(style::GraphicLocation_NONE)); + registerPropertyNoMember(PROPERTY_BACKTRANSPARENT, ++i,nBound,cppu::UnoType::get(), css::uno::Any(true)); + registerPropertyNoMember(SC_UNO_PAGE_BORDERDIST, ++i,nBound, cppu::UnoType::get(), css::uno::Any(sal_Int32(0))); + registerPropertyNoMember(SC_UNO_PAGE_BOTTBORDER, ++i,nBound, cppu::UnoType::get(), css::uno::Any(table::BorderLine2())); + registerPropertyNoMember(SC_UNO_PAGE_BOTTBRDDIST, ++i,nBound, cppu::UnoType::get(), css::uno::Any(sal_Int32(0))); + registerPropertyNoMember(PROPERTY_BOTTOMMARGIN, ++i,nBound, cppu::UnoType::get(), css::uno::Any(nMargin)); + registerPropertyNoMember("DisplayName", ++i,nBound, cppu::UnoType::get(), css::uno::Any(OUString())); + registerPropertyNoMember(SC_UNO_PAGE_FTRBACKCOL, ++i,nBound, cppu::UnoType::get(), css::uno::Any(COL_TRANSPARENT)); + registerPropertyNoMember(SC_UNO_PAGE_FTRGRFFILT, ++i,nBound, cppu::UnoType::get(), css::uno::Any(OUString())); + registerPropertyNoMember(SC_UNO_PAGE_FTRGRFLOC, ++i,nBound, cppu::UnoType::get(), css::uno::Any(style::GraphicLocation_NONE)); + registerPropertyNoMember(SC_UNO_PAGE_FTRGRF, ++i,nBound|nMayBeVoid, cppu::UnoType::get(), css::uno::Any(uno::Reference())); + registerPropertyNoMember(SC_UNO_PAGE_FTRBACKTRAN, ++i,nBound,cppu::UnoType::get(), css::uno::Any(true)); + registerPropertyNoMember(SC_UNO_PAGE_FTRBODYDIST, ++i,nBound, cppu::UnoType::get(), css::uno::Any(sal_Int32(0))); + registerPropertyNoMember(SC_UNO_PAGE_FTRBRDDIST, ++i,nBound, cppu::UnoType::get(), css::uno::Any(sal_Int32(0))); + registerPropertyNoMember(SC_UNO_PAGE_FTRBOTTBOR, ++i,nBound, cppu::UnoType::get(), css::uno::Any(table::BorderLine2())); + registerPropertyNoMember(SC_UNO_PAGE_FTRBOTTBDIS, ++i,nBound, cppu::UnoType::get(), css::uno::Any(sal_Int32(0))); + registerPropertyNoMember(SC_UNO_PAGE_FTRHEIGHT, ++i,nBound, cppu::UnoType::get(), css::uno::Any(sal_Int32(0))); + registerPropertyNoMember(SC_UNO_PAGE_FTRDYNAMIC, ++i,nBound,cppu::UnoType::get(), css::uno::Any(false)); + registerPropertyNoMember(SC_UNO_PAGE_FTRON, ++i,nBound,cppu::UnoType::get(), css::uno::Any(false)); + registerPropertyNoMember(SC_UNO_PAGE_FTRSHARED, ++i,nBound,cppu::UnoType::get(), css::uno::Any(false)); + registerPropertyNoMember(SC_UNO_PAGE_FIRSTFTRSHARED, ++i,nBound,cppu::UnoType::get(), css::uno::Any(false)); + registerPropertyNoMember(SC_UNO_PAGE_FTRLEFTBOR, ++i,nBound, cppu::UnoType::get(), css::uno::Any(table::BorderLine2())); + registerPropertyNoMember(SC_UNO_PAGE_FTRLEFTBDIS, ++i,nBound, cppu::UnoType::get(), css::uno::Any(sal_Int32(0))); + registerPropertyNoMember(SC_UNO_PAGE_FTRLEFTMAR, ++i,nBound, cppu::UnoType::get(), css::uno::Any(sal_Int32(0))); + registerPropertyNoMember(SC_UNO_PAGE_FTRRIGHTBOR, ++i,nBound, cppu::UnoType::get(), css::uno::Any(table::BorderLine2())); + registerPropertyNoMember(SC_UNO_PAGE_FTRRIGHTBDIS,++i,nBound, cppu::UnoType::get(), css::uno::Any(sal_Int32(0))); + registerPropertyNoMember(SC_UNO_PAGE_FTRRIGHTMAR, ++i,nBound, cppu::UnoType::get(), css::uno::Any(sal_Int32(0))); + registerPropertyNoMember(SC_UNO_PAGE_FTRSHADOW, ++i,nBound, cppu::UnoType::get(), css::uno::Any(table::ShadowFormat())); + registerPropertyNoMember(SC_UNO_PAGE_FTRTOPBOR, ++i,nBound, cppu::UnoType::get(), css::uno::Any(table::BorderLine2())); + registerPropertyNoMember(SC_UNO_PAGE_FTRTOPBDIS, ++i,nBound, cppu::UnoType::get(), css::uno::Any(sal_Int32(0))); + + registerPropertyNoMember(SC_UNO_PAGE_HDRBACKCOL, ++i,nBound|nMayBeVoid, cppu::UnoType::get(), css::uno::Any(COL_TRANSPARENT)); + registerPropertyNoMember(SC_UNO_PAGE_HDRGRFFILT, ++i,nBound|nMayBeVoid, cppu::UnoType::get(), css::uno::Any(OUString())); + registerPropertyNoMember(SC_UNO_PAGE_HDRGRFLOC, ++i,nBound|nMayBeVoid, cppu::UnoType::get(), css::uno::Any(style::GraphicLocation_NONE)); + registerPropertyNoMember(SC_UNO_PAGE_HDRGRF, ++i,nBound|nMayBeVoid, cppu::UnoType::get(), css::uno::Any(uno::Reference())); + registerPropertyNoMember(SC_UNO_PAGE_HDRBACKTRAN, ++i,nBound|nMayBeVoid,cppu::UnoType::get(), css::uno::Any(true)); + registerPropertyNoMember(SC_UNO_PAGE_HDRBODYDIST, ++i,nBound|nMayBeVoid, cppu::UnoType::get(), css::uno::Any(sal_Int32(0))); + registerPropertyNoMember(SC_UNO_PAGE_HDRBRDDIST, ++i,nBound|nMayBeVoid, cppu::UnoType::get(), css::uno::Any(sal_Int32(0))); + registerPropertyNoMember(SC_UNO_PAGE_HDRBOTTBOR, ++i,nBound|nMayBeVoid, cppu::UnoType::get(), css::uno::Any(table::BorderLine2())); + registerPropertyNoMember(SC_UNO_PAGE_HDRBOTTBDIS, ++i,nBound|nMayBeVoid, cppu::UnoType::get(), css::uno::Any(sal_Int32(0))); + registerPropertyNoMember(SC_UNO_PAGE_HDRHEIGHT, ++i,nBound|nMayBeVoid, cppu::UnoType::get(), css::uno::Any(sal_Int32(0))); + registerPropertyNoMember(SC_UNO_PAGE_HDRDYNAMIC, ++i,nBound|nMayBeVoid,cppu::UnoType::get(), css::uno::Any(false)); + registerPropertyNoMember(SC_UNO_PAGE_HDRON, ++i,nBound|nMayBeVoid,cppu::UnoType::get(), css::uno::Any(false)); + registerPropertyNoMember(SC_UNO_PAGE_HDRSHARED, ++i,nBound|nMayBeVoid,cppu::UnoType::get(), css::uno::Any(false)); + registerPropertyNoMember(SC_UNO_PAGE_FIRSTHDRSHARED, ++i,nBound|nMayBeVoid,cppu::UnoType::get(), css::uno::Any(false)); + registerPropertyNoMember(SC_UNO_PAGE_HDRLEFTBOR, ++i,nBound|nMayBeVoid, cppu::UnoType::get(), css::uno::Any(table::BorderLine2())); + registerPropertyNoMember(SC_UNO_PAGE_HDRLEFTBDIS, ++i,nBound|nMayBeVoid, cppu::UnoType::get(), css::uno::Any(sal_Int32(0))); + registerPropertyNoMember(SC_UNO_PAGE_HDRLEFTMAR, ++i,nBound|nMayBeVoid, cppu::UnoType::get(), css::uno::Any(sal_Int32(0))); + registerPropertyNoMember(SC_UNO_PAGE_HDRRIGHTBOR, ++i,nBound|nMayBeVoid, cppu::UnoType::get(), css::uno::Any(table::BorderLine2())); + registerPropertyNoMember(SC_UNO_PAGE_HDRRIGHTBDIS,++i,nBound|nMayBeVoid, cppu::UnoType::get(), css::uno::Any(sal_Int32(0))); + registerPropertyNoMember(SC_UNO_PAGE_HDRRIGHTMAR, ++i,nBound|nMayBeVoid, cppu::UnoType::get(), css::uno::Any(sal_Int32(0))); + registerPropertyNoMember(SC_UNO_PAGE_HDRSHADOW, ++i,nBound|nMayBeVoid, cppu::UnoType::get(), css::uno::Any(table::ShadowFormat())); + registerPropertyNoMember(SC_UNO_PAGE_HDRTOPBOR, ++i,nBound|nMayBeVoid, cppu::UnoType::get(), css::uno::Any(table::BorderLine2())); + registerPropertyNoMember(SC_UNO_PAGE_HDRTOPBDIS, ++i,nBound|nMayBeVoid, cppu::UnoType::get(), css::uno::Any(sal_Int32(0))); + + registerProperty(PROPERTY_HEIGHT, ++i,nBound,&m_aSize.Height, ::cppu::UnoType::get() ); + registerPropertyNoMember(PROPERTY_ISLANDSCAPE, ++i,nBound, cppu::UnoType::get(), css::uno::Any(false)); + registerPropertyNoMember(SC_UNO_PAGE_LEFTBORDER, ++i,nBound, cppu::UnoType::get(), css::uno::Any(table::BorderLine2())); + registerPropertyNoMember(SC_UNO_PAGE_LEFTBRDDIST, ++i,nBound, cppu::UnoType::get(), css::uno::Any(sal_Int32(0))); + registerPropertyNoMember(PROPERTY_LEFTMARGIN, ++i,beans::PropertyAttribute::BOUND, ::cppu::UnoType::get(), css::uno::Any(nMargin)); + registerPropertyNoMember(PROPERTY_NUMBERINGTYPE, ++i,nBound, cppu::UnoType::get(), css::uno::Any(style::NumberingType::ARABIC)); + registerPropertyNoMember(SC_UNO_PAGE_SCALEVAL, ++i,nBound, cppu::UnoType::get(), css::uno::Any(sal_Int16(0))); + registerPropertyNoMember(PROPERTY_PAGESTYLELAYOUT, ++i,nBound, cppu::UnoType::get(), css::uno::Any(style::PageStyleLayout_ALL)); + registerPropertyNoMember(SC_UNO_PAGE_PAPERTRAY, ++i,nBound, cppu::UnoType::get(), css::uno::Any(OUString("[From printer settings]"))); + registerPropertyNoMember(SC_UNO_PAGE_RIGHTBORDER, ++i,nBound, cppu::UnoType::get(), css::uno::Any(table::BorderLine2())); + registerPropertyNoMember(SC_UNO_PAGE_RIGHTBRDDIST,++i,nBound, cppu::UnoType::get(), css::uno::Any(sal_Int32(0))); + registerPropertyNoMember(PROPERTY_RIGHTMARGIN, ++i,beans::PropertyAttribute::BOUND,::cppu::UnoType::get(), css::uno::Any(nMargin)); + registerPropertyNoMember(SC_UNO_PAGE_SCALETOPAG, ++i,nBound, cppu::UnoType::get(), css::uno::Any(sal_Int16(0))); + registerPropertyNoMember(SC_UNO_PAGE_SCALETOX, ++i,nBound, cppu::UnoType::get(), css::uno::Any(sal_Int16(0))); + registerPropertyNoMember(SC_UNO_PAGE_SCALETOY, ++i,nBound, cppu::UnoType::get(), css::uno::Any(sal_Int16(0))); + registerPropertyNoMember(SC_UNO_PAGE_SHADOWFORM, ++i,nBound, cppu::UnoType::get(), css::uno::Any(table::ShadowFormat())); + registerProperty(PROPERTY_PAPERSIZE, ++i,beans::PropertyAttribute::BOUND,&m_aSize, cppu::UnoType::get() ); + registerPropertyNoMember(SC_UNO_PAGE_TOPBORDER, ++i,nBound, cppu::UnoType::get(), css::uno::Any(table::BorderLine2())); + registerPropertyNoMember(SC_UNO_PAGE_TOPBRDDIST, ++i,nBound,::cppu::UnoType::get(), css::uno::Any(sal_Int32(0))); + registerPropertyNoMember(PROPERTY_TOPMARGIN, ++i,nBound,::cppu::UnoType::get(), css::uno::Any(nMargin)); + registerPropertyNoMember("UserDefinedAttributes", ++i,nBound, cppu::UnoType::get(), css::uno::Any(comphelper::NameContainer_createInstance(cppu::UnoType::get()))); + registerProperty(PROPERTY_WIDTH, ++i,nBound,&m_aSize.Width, cppu::UnoType::get() ); + registerPropertyNoMember("PrinterName", ++i,nBound, cppu::UnoType::get(), css::uno::Any(OUString())); + registerPropertyNoMember("PrinterSetup", ++i,nBound,cppu::UnoType>::get(), css::uno::Any(uno::Sequence())); + + +} + +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 m_aStorageChangeListeners; + ::comphelper::OInterfaceContainerHelper3 m_aCloseListener; + ::comphelper::OInterfaceContainerHelper3 m_aModifyListeners; + ::comphelper::OInterfaceContainerHelper3 m_aLegacyEventListeners; + ::comphelper::OInterfaceContainerHelper3 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 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(_xContext)), + m_pImpl(std::make_shared(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(_xContext)), + m_pImpl(std::make_shared(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(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 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(m_pImpl->m_xStorage , static_cast(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 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 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(static_cast(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 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::get(), beans::PropertyAttribute::MAYBEVOID, 0 }, + { OUString("StreamName") , 0, cppu::UnoType::get(), beans::PropertyAttribute::MAYBEVOID, 0 }, + { OUString("StreamRelPath") , 0, cppu::UnoType::get(), beans::PropertyAttribute::MAYBEVOID, 0 }, + { OUString("BaseURI") , 0, cppu::UnoType::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 xGraphicStorageHandler; + rtl::Reference 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 xCom(static_cast(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 aSeq; + aImage >>= aSeq; + uno::Reference 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 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 const& xListener) { + return xListener->notifyStorageChange(static_cast(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 & xComponent, + const char* pStreamName, + const char* pServiceName, + const uno::Sequence & rArguments, + const uno::Sequence & rMediaDesc, + const uno::Reference& _xStorageToSaveTo) +{ + OSL_ENSURE( nullptr != pStreamName, "Need stream name!" ); + OSL_ENSURE( nullptr != pServiceName, "Need service name!" ); + + // open stream + OUString sStreamName = OUString::createFromAscii( pStreamName ); + uno::Reference xStream = _xStorageToSaveTo->openStreamElement( sStreamName,embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE ); + if ( !xStream.is() ) + return false; + uno::Reference xOutputStream = xStream->getOutputStream(); + OSL_ENSURE(xOutputStream.is(), "Can't create output stream in package!"); + if ( ! xOutputStream.is() ) + return false; + + uno::Reference xStreamProp(xOutputStream,uno::UNO_QUERY); + OSL_ENSURE(xStreamProp.is(),"No valid property set for the output stream!"); + + uno::Reference 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 & xOutputStream, + const uno::Reference & xComponent, + const char* pServiceName, + const uno::Sequence & rArguments, + const uno::Sequence & 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 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 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 xStream = m_pImpl->m_pObjectContainer->GetGraphicStream("report", &sMimeType); + if ( xStream.is() ) + { + uno::Sequence aSeq; + xStream->readBytes(aSeq,xStream->available()); + xStream->closeInput(); + aResult.Data <<= aSeq; + aResult.Flavor.MimeType = sMimeType; + aResult.Flavor.DataType = cppu::UnoType::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 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 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(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(); +} + +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 OReportDefinition::getSdrModel(const uno::Reference< report::XReportDefinition >& _xReportDefinition) +{ + std::shared_ptr pReportModel; + auto pReportDefinition = comphelper::getFromUnoTunnel(_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 xProp = new OStyle(); + + return xProp; + } + else if ( aServiceSpecifier == "com.sun.star.drawing.Defaults" ) + { + uno::Reference 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 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 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 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::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 m_aElementsPos; + uno::Type m_aType; + +protected: + virtual ~OStylesHelper() override {} +public: + explicit OStylesHelper(const uno::Type& rType = cppu::UnoType::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::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::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::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 const xParent( + const_cast(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(); + } + + 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(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>::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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include + +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 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 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 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 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 + +#include + +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& _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 xGroups = _xReportDefinition->getGroups(); + m_pTraverseReport->traverseGroups(xGroups); + const sal_Int32 nCount = xGroups->getCount(); + sal_Int32 i = 0; + for (; i < nCount; ++i) + { + uno::Reference 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 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& _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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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 OSection::createOSection( + const uno::Reference< report::XReportDefinition >& xParentDef, + const uno::Reference< uno::XComponentContext >& context, + bool const bPageSection) +{ + rtl::Reference pNew = + new OSection(xParentDef, nullptr, context, lcl_getAbsent(bPageSection)); + pNew->init(); + return pNew; +} + +uno::Reference OSection::createOSection( + const uno::Reference< report::XGroup >& xParentGroup, + const uno::Reference< uno::XComponentContext >& context) +{ + rtl::Reference 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 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 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 pModel = OReportDefinition::getSdrModel(xReport); + assert(pModel && "No model set at the report definition!"); + if ( !pModel ) + return; + + uno::Reference 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(COL_TRANSPARENT) : m_nBackgroundColor; +} + +void SAL_CALL OSection::setBackColor( ::sal_Int32 _backgroundcolor ) +{ + bool bTransparent = _backgroundcolor == static_cast(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(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::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(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 const& xGroup) +{ + // no lock because m_xDrawPage_ShapeGrouper is const + if (m_xDrawPage_ShapeGrouper.is()) { + m_xDrawPage_ShapeGrouper->ungroup(xGroup); + } +} + +// XFormsSupplier +uno::Reference 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(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(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(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 + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +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 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 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::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 +#include +#include +#include + + +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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/********************************************************************************************/ + +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: */ diff --git a/reportdesign/source/core/inc/FixedLine.hxx b/reportdesign/source/core/inc/FixedLine.hxx new file mode 100644 index 000000000..7014ef153 --- /dev/null +++ b/reportdesign/source/core/inc/FixedLine.hxx @@ -0,0 +1,169 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FIXEDLINE_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FIXEDLINE_HXX + +#include +#include +#include "ReportControlModel.hxx" +#include +#include +#include +#include +#include + + +namespace reportdesign +{ + typedef ::cppu::PropertySetMixin< css::report::XFixedLine > FixedLinePropertySet; + typedef ::cppu::WeakComponentImplHelper< css::report::XFixedLine + ,css::lang::XServiceInfo > FixedLineBase; + + /** \class OFixedLine Defines the implementation of a \interface com:::sun::star::report::XFixedLine + * \ingroup reportdesign_api + * + */ + class OFixedLine final : public cppu::BaseMutex, + public FixedLineBase, + public FixedLinePropertySet + { + friend class OShapeHelper; + OReportControlModel m_aProps; + css::drawing::LineStyle m_LineStyle; + css::drawing::LineDash m_LineDash; + sal_Int32 m_nOrientation; + ::sal_Int32 m_LineColor; + ::sal_Int16 m_LineTransparence; + ::sal_Int32 m_LineWidth; + + private: + OFixedLine(const OFixedLine&) = delete; + OFixedLine& operator=(const OFixedLine&) = delete; + + template void set( const OUString& _sProperty + ,const T& Value + ,T& _member) + { + BoundListeners l; + { + ::osl::MutexGuard aGuard(m_aMutex); + prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l); + _member = Value; + } + l.notify(); + } + virtual ~OFixedLine() override; + public: + explicit OFixedLine(css::uno::Reference< css::uno::XComponentContext > const & _xContext); + explicit OFixedLine(css::uno::Reference< css::uno::XComponentContext > const & _xContext + ,const css::uno::Reference< css::lang::XMultiServiceFactory > & _xFactory + ,css::uno::Reference< css::drawing::XShape >& _xShape + ,sal_Int32 _nOrientation); + + DECLARE_XINTERFACE( ) + // css::lang::XServiceInfo + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual OUString SAL_CALL getImplementationName( ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + /// @throws css::uno::RuntimeException + static css::uno::Sequence< OUString > getSupportedServiceNames_Static(); + /// @throws css::uno::RuntimeException + static OUString getImplementationName_Static(); + static css::uno::Reference< css::uno::XInterface > + create(css::uno::Reference< css::uno::XComponentContext > const & xContext); + // css::beans::XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + // XReportComponent + REPORTCOMPONENT_HEADER() + + // XShape + SHAPE_HEADER() + + // XShapeDescriptor + virtual OUString SAL_CALL getShapeType( ) override; + + // XReportControlModel + REPORTCONTROLMODEL_HEADER() + + // XFixedLine + virtual ::sal_Int32 SAL_CALL getOrientation() override; + virtual void SAL_CALL setOrientation( ::sal_Int32 _orientation ) override; + virtual css::drawing::LineStyle SAL_CALL getLineStyle() override; + virtual void SAL_CALL setLineStyle( css::drawing::LineStyle _linestyle ) override; + virtual css::drawing::LineDash SAL_CALL getLineDash() override; + virtual void SAL_CALL setLineDash( const css::drawing::LineDash& _linedash ) override; + virtual ::sal_Int32 SAL_CALL getLineColor() override; + virtual void SAL_CALL setLineColor( ::sal_Int32 _linecolor ) override; + virtual ::sal_Int16 SAL_CALL getLineTransparence() override; + virtual void SAL_CALL setLineTransparence( ::sal_Int16 _linetransparence ) override; + virtual ::sal_Int32 SAL_CALL getLineWidth() override; + virtual void SAL_CALL setLineWidth( ::sal_Int32 _linewidth ) override; + + // css::report::XReportControlFormat + REPORTCONTROLFORMAT_HEADER() + + // XCloneable + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override; + + // XComponent + virtual void SAL_CALL dispose() override; + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::addEventListener(aListener); + } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::removeEventListener(aListener); + } + + // XChild + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override; + virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override; + + // XContainer + virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + // XIndexReplace + virtual void SAL_CALL replaceByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override; + + // XIndexContainer + virtual void SAL_CALL insertByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override; + virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) override; + + // XIndexAccess + virtual ::sal_Int32 SAL_CALL getCount( ) override; + virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override; + }; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FIXEDLINE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/inc/FixedText.hxx b/reportdesign/source/core/inc/FixedText.hxx new file mode 100644 index 000000000..6cc63bfeb --- /dev/null +++ b/reportdesign/source/core/inc/FixedText.hxx @@ -0,0 +1,185 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FIXEDTEXT_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FIXEDTEXT_HXX + +#include +#include +#include "ReportControlModel.hxx" +#include +#include +#include +#include +#include + + +namespace reportdesign +{ + typedef ::cppu::PropertySetMixin< css::report::XFixedText > FixedTextPropertySet; + typedef ::cppu::WeakComponentImplHelper< css::report::XFixedText + ,css::lang::XServiceInfo > FixedTextBase; + + /** \class OFixedText Defines the implementation of a \interface com:::sun::star::report::XFixedText + * \ingroup reportdesign_api + * + */ + class OFixedText final : public cppu::BaseMutex, + public FixedTextBase, + public FixedTextPropertySet + { + friend class OShapeHelper; + OReportControlModel m_aProps; + OUString m_sLabel; + private: + OFixedText(const OFixedText&) = delete; + OFixedText& operator=(const OFixedText&) = delete; + + // internally, we store PROPERTY_PARAADJUST as css::style::ParagraphAdjust, but externally the property is visible as a sal_Int16 + void set( const OUString& _sProperty + ,sal_Int16 Value + ,css::style::ParagraphAdjust& _member) + { + BoundListeners l; + { + ::osl::MutexGuard aGuard(m_aMutex); + if ( static_cast(_member) != Value ) + { + prepareSet(_sProperty, css::uno::Any(static_cast(_member)), css::uno::Any(Value), &l); + _member = static_cast(Value); + } + } + l.notify(); + } + template void set( const OUString& _sProperty + ,const T& Value + ,T& _member) + { + BoundListeners l; + { + ::osl::MutexGuard aGuard(m_aMutex); + if ( _member != Value ) + { + prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l); + _member = Value; + } + } + l.notify(); + } + void set( const OUString& _sProperty + ,bool Value + ,bool& _member) + { + BoundListeners l; + { + ::osl::MutexGuard aGuard(m_aMutex); + if ( _member != Value ) + { + prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l); + _member = Value; + } + } + l.notify(); + } + virtual ~OFixedText() override; + public: + explicit OFixedText(css::uno::Reference< css::uno::XComponentContext > const & _xContext); + explicit OFixedText(css::uno::Reference< css::uno::XComponentContext > const & _xContext + ,const css::uno::Reference< css::lang::XMultiServiceFactory > & _xFactory + ,css::uno::Reference< css::drawing::XShape >& _xShape); + + DECLARE_XINTERFACE( ) + // css::lang::XServiceInfo + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual OUString SAL_CALL getImplementationName( ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + /// @throws css::uno::RuntimeException + static css::uno::Sequence< OUString > getSupportedServiceNames_Static(); + /// @throws css::uno::RuntimeException + static OUString getImplementationName_Static(); + static css::uno::Reference< css::uno::XInterface > + create(css::uno::Reference< css::uno::XComponentContext > const & xContext); + // css::beans::XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + // XReportComponent + REPORTCOMPONENT_HEADER() + // XShape + SHAPE_HEADER() + + // XShapeDescriptor + virtual OUString SAL_CALL getShapeType( ) override; + + // XReportControlModel + REPORTCONTROLMODEL_HEADER() + + // XCloneable + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override; + + // XFixedText + virtual OUString SAL_CALL getLabel() override; + virtual void SAL_CALL setLabel( const OUString& _label ) override; + + // css::report::XReportControlFormat + REPORTCONTROLFORMAT_HEADER() + + // XComponent + virtual void SAL_CALL dispose() override; + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::addEventListener(aListener); + } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::removeEventListener(aListener); + } + + // XChild + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override; + virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override; + // XContainer + virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + // XIndexReplace + virtual void SAL_CALL replaceByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override; + + // XIndexContainer + virtual void SAL_CALL insertByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override; + virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) override; + + // XIndexAccess + virtual ::sal_Int32 SAL_CALL getCount( ) override; + virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override; + }; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FIXEDTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/inc/FormatCondition.hxx b/reportdesign/source/core/inc/FormatCondition.hxx new file mode 100644 index 000000000..07b2db006 --- /dev/null +++ b/reportdesign/source/core/inc/FormatCondition.hxx @@ -0,0 +1,146 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FORMATCONDITION_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FORMATCONDITION_HXX + +#include +#include +#include "ReportControlModel.hxx" +#include +#include +#include +#include +#include + +namespace reportdesign +{ + typedef ::cppu::PropertySetMixin< css::report::XFormatCondition > FormatConditionPropertySet; + typedef ::cppu::WeakComponentImplHelper< css::report::XFormatCondition + ,css::lang::XServiceInfo > FormatConditionBase; + + /** \class OFormatCondition Defines the implementation of a \interface com:::sun::star::report::XFormatCondition + * \ingroup reportdesign_api + * + */ + class OFormatCondition final : public cppu::BaseMutex, + public FormatConditionBase, + public FormatConditionPropertySet + { + OFormatProperties m_aFormatProperties; + OUString m_sFormula; + bool m_bEnabled; + private: + OFormatCondition(const OFormatCondition&) = delete; + OFormatCondition& operator=(const OFormatCondition&) = delete; + + // internally, we store PROPERTY_PARAADJUST as css::style::ParagraphAdjust, but externally the property is visible as a sal_Int16 + void set( const OUString& _sProperty + ,sal_Int16 Value + ,css::style::ParagraphAdjust& _member) + { + BoundListeners l; + { + ::osl::MutexGuard aGuard(m_aMutex); + if ( static_cast(_member) != Value ) + { + prepareSet(_sProperty, css::uno::Any(static_cast(_member)), css::uno::Any(Value), &l); + _member = static_cast(Value); + } + } + l.notify(); + } + template void set( const OUString& _sProperty + ,const T& Value + ,T& _member) + { + BoundListeners l; + { + ::osl::MutexGuard aGuard(m_aMutex); + if ( _member != Value ) + { + prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l); + _member = Value; + } + } + l.notify(); + } + void set( const OUString& _sProperty + ,bool Value + ,bool& _member) + { + BoundListeners l; + { + ::osl::MutexGuard aGuard(m_aMutex); + if ( _member != Value ) + { + prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l); + _member = Value; + } + } + l.notify(); + } + virtual ~OFormatCondition() override; + public: + explicit OFormatCondition(css::uno::Reference< css::uno::XComponentContext > const & _xContext + ); + + DECLARE_XINTERFACE( ) + // css::lang::XServiceInfo + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual OUString SAL_CALL getImplementationName( ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + /// @throws css::uno::RuntimeException + static css::uno::Sequence< OUString > getSupportedServiceNames_Static(); + /// @throws css::uno::RuntimeException + static OUString getImplementationName_Static(); + static css::uno::Reference< css::uno::XInterface > + create(css::uno::Reference< css::uno::XComponentContext > const & xContext); + // css::beans::XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + // XFormatCondition + virtual sal_Bool SAL_CALL getEnabled() override; + virtual void SAL_CALL setEnabled( sal_Bool _enabled ) override; + virtual OUString SAL_CALL getFormula() override; + virtual void SAL_CALL setFormula( const OUString& _formula ) override; + + // XReportControlFormat + REPORTCONTROLFORMAT_HEADER() + // XComponent + virtual void SAL_CALL dispose() override; + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::addEventListener(aListener); + } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::removeEventListener(aListener); + } + }; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FORMATCONDITION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/inc/FormattedField.hxx b/reportdesign/source/core/inc/FormattedField.hxx new file mode 100644 index 000000000..e777f7b5e --- /dev/null +++ b/reportdesign/source/core/inc/FormattedField.hxx @@ -0,0 +1,192 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FORMATTEDFIELD_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FORMATTEDFIELD_HXX + +#include +#include +#include "ReportControlModel.hxx" +#include +#include +#include +#include +#include + + +namespace reportdesign +{ + typedef ::cppu::PropertySetMixin< css::report::XFormattedField > FormattedFieldPropertySet; + typedef ::cppu::WeakComponentImplHelper< css::report::XFormattedField + ,css::lang::XServiceInfo > FormattedFieldBase; + + /** \class OFormattedField Defines the implementation of a \interface com:::sun::star::report::XFormattedField + * \ingroup reportdesign_api + * + */ + class OFormattedField final : public cppu::BaseMutex, + public FormattedFieldBase, + public FormattedFieldPropertySet + { + friend class OShapeHelper; + + OReportControlModel m_aProps; + css::uno::Reference< css::util::XNumberFormatsSupplier > + m_xFormatsSupplier; + ::sal_Int32 m_nFormatKey; + + private: + OFormattedField(const OFormattedField&) = delete; + OFormattedField& operator=(const OFormattedField&) = delete; + + // internally, we store PROPERTY_PARAADJUST as css::style::ParagraphAdjust, but externally the property is visible as a sal_Int16 + void set( const OUString& _sProperty + ,sal_Int16 Value + ,css::style::ParagraphAdjust& _member) + { + BoundListeners l; + { + ::osl::MutexGuard aGuard(m_aMutex); + if ( static_cast(_member) != Value ) + { + prepareSet(_sProperty, css::uno::Any(static_cast(_member)), css::uno::Any(Value), &l); + _member = static_cast(Value); + } + } + l.notify(); + } + template void set( const OUString& _sProperty + ,const T& Value + ,T& _member) + { + BoundListeners l; + { + ::osl::MutexGuard aGuard(m_aMutex); + if ( _member != Value ) + { + prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l); + _member = Value; + } + } + l.notify(); + } + void set( const OUString& _sProperty + ,bool Value + ,bool& _member) + { + BoundListeners l; + { + ::osl::MutexGuard aGuard(m_aMutex); + if ( _member != Value ) + { + prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l); + _member = Value; + } + } + l.notify(); + } + virtual ~OFormattedField() override; + public: + explicit OFormattedField(css::uno::Reference< css::uno::XComponentContext > const & _xContext); + explicit OFormattedField(css::uno::Reference< css::uno::XComponentContext > const & _xContext + ,const css::uno::Reference< css::lang::XMultiServiceFactory > & _xFactory + ,css::uno::Reference< css::drawing::XShape >& _xShape); + + DECLARE_XINTERFACE( ) + // css::lang::XServiceInfo + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual OUString SAL_CALL getImplementationName( ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + /// @throws css::uno::RuntimeException + static css::uno::Sequence< OUString > getSupportedServiceNames_Static(); + /// @throws css::uno::RuntimeException + static OUString getImplementationName_Static(); + static css::uno::Reference< css::uno::XInterface > + create(css::uno::Reference< css::uno::XComponentContext > const & xContext); + // css::beans::XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + // XContainer + virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + // XIndexReplace + virtual void SAL_CALL replaceByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override; + + // XIndexContainer + virtual void SAL_CALL insertByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override; + virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) override; + + // XIndexAccess + virtual ::sal_Int32 SAL_CALL getCount( ) override; + virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override; + + // XReportComponent + REPORTCOMPONENT_HEADER() + + // XShape + SHAPE_HEADER() + + // XShapeDescriptor + virtual OUString SAL_CALL getShapeType( ) override; + + // XReportControlModel + REPORTCONTROLMODEL_HEADER() + + // XReportControlFormat + REPORTCONTROLFORMAT_HEADER() + + // XCloneable + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override; + + // XFormattedField + virtual ::sal_Int32 SAL_CALL getFormatKey() override; + virtual void SAL_CALL setFormatKey(::sal_Int32 the_value) override; + virtual css::uno::Reference< css::util::XNumberFormatsSupplier > SAL_CALL getFormatsSupplier() override; + virtual void SAL_CALL setFormatsSupplier( const css::uno::Reference< css::util::XNumberFormatsSupplier >& _formatssupplier ) override; + + // XComponent + virtual void SAL_CALL dispose() override; + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::addEventListener(aListener); + } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::removeEventListener(aListener); + } + + // XChild + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override; + virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override; + }; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FORMATTEDFIELD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/inc/Function.hxx b/reportdesign/source/core/inc/Function.hxx new file mode 100644 index 000000000..891b5427d --- /dev/null +++ b/reportdesign/source/core/inc/Function.hxx @@ -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 . + */ +#ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FUNCTION_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FUNCTION_HXX + +#include +#include +#include +#include +#include +#include +#include + +namespace reportdesign +{ + typedef ::cppu::PropertySetMixin< css::report::XFunction > FunctionPropertySet; + typedef ::cppu::WeakComponentImplHelper< css::report::XFunction + ,css::lang::XServiceInfo > FunctionBase; + + /** \class OFunction Defines the implementation of a \interface com:::sun::star::report::XFunction + * \ingroup reportdesign_api + * + */ + class OFunction : public cppu::BaseMutex, + public FunctionBase, + public FunctionPropertySet + { + css::beans::Optional< OUString> m_sInitialFormula; + css::uno::WeakReference< css::report::XFunctions > m_xParent; + OUString m_sName; + OUString m_sFormula; + bool m_bPreEvaluated; + bool m_bDeepTraversing; + private: + OFunction(const OFunction&) = delete; + OFunction& operator=(const OFunction&) = delete; + + template void set( const OUString& _sProperty + ,const T& Value + ,T& _member) + { + BoundListeners l; + { + ::osl::MutexGuard aGuard(m_aMutex); + prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l); + _member = Value; + } + l.notify(); + } + void set( const OUString& _sProperty + ,bool Value + ,bool& _member) + { + BoundListeners l; + { + ::osl::MutexGuard aGuard(m_aMutex); + prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l); + _member = Value; + } + l.notify(); + } + protected: + virtual ~OFunction() override; + public: + explicit OFunction(css::uno::Reference< css::uno::XComponentContext > const & _xContext); + + DECLARE_XINTERFACE( ) + // css::lang::XServiceInfo + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual OUString SAL_CALL getImplementationName( ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + /// @throws css::uno::RuntimeException + static css::uno::Sequence< OUString > getSupportedServiceNames_Static(); + /// @throws css::uno::RuntimeException + static OUString getImplementationName_Static(); + static css::uno::Reference< css::uno::XInterface > + create(css::uno::Reference< css::uno::XComponentContext > const & xContext); + // css::beans::XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + // css::report::XFunction: + virtual sal_Bool SAL_CALL getPreEvaluated() override; + virtual void SAL_CALL setPreEvaluated(sal_Bool the_value) override; + virtual sal_Bool SAL_CALL getDeepTraversing() override; + virtual void SAL_CALL setDeepTraversing(sal_Bool the_value) override; + virtual OUString SAL_CALL getName() override; + virtual void SAL_CALL setName(const OUString & the_value) override; + virtual OUString SAL_CALL getFormula() override; + virtual void SAL_CALL setFormula(const OUString & the_value) override; + virtual css::beans::Optional< OUString> SAL_CALL getInitialFormula() override; + virtual void SAL_CALL setInitialFormula(const css::beans::Optional< OUString> & the_value) override; + + // XComponent + virtual void SAL_CALL dispose() override; + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::addEventListener(aListener); + } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::removeEventListener(aListener); + } + + // XChild + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override; + virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override; + }; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FUNCTION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/inc/Functions.hxx b/reportdesign/source/core/inc/Functions.hxx new file mode 100644 index 000000000..94a54beeb --- /dev/null +++ b/reportdesign/source/core/inc/Functions.hxx @@ -0,0 +1,99 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FUNCTIONS_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FUNCTIONS_HXX + +#include +#include +#include +#include +#include +#include +#include + + +namespace reportdesign +{ + typedef ::cppu::WeakComponentImplHelper< css::report::XFunctions> FunctionsBase; + /** \class OFunctions Defines the implementation of a \interface com:::sun::star::report::XFunctions + * \ingroup reportdesign_api + * + */ + class OFunctions : public cppu::BaseMutex, + public FunctionsBase + { + typedef ::std::vector< css::uno::Reference< css::report::XFunction > > TFunctions; + ::comphelper::OInterfaceContainerHelper3 m_aContainerListeners; + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::WeakReference< css::report::XFunctionsSupplier > m_xParent; + TFunctions m_aFunctions; + private: + OFunctions& operator=(const OFunctions&) = delete; + OFunctions(const OFunctions&) = delete; + void checkIndex(sal_Int32 _nIndex); + protected: + // TODO: VirtualFunctionFinder: This is virtual function! + + virtual ~OFunctions() override; + + /** this function is called upon disposing the component + */ + // TODO: VirtualFunctionFinder: This is virtual function! + + virtual void SAL_CALL disposing() override; + public: + explicit OFunctions( const css::uno::Reference< css::report::XFunctionsSupplier >& _xParent + ,const css::uno::Reference< css::uno::XComponentContext >& context); + + // XFunctions + // Methods + virtual css::uno::Reference< css::report::XFunction > SAL_CALL createFunction( ) override; + // XIndexContainer + virtual void SAL_CALL insertByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override; + virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) override; + // XIndexReplace + virtual void SAL_CALL replaceByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override; + // XIndexAccess + virtual ::sal_Int32 SAL_CALL getCount( ) override; + virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override; + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + // XChild + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override; + virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override; + // XContainer + virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + + // XComponent + virtual void SAL_CALL dispose() override; + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::addEventListener(aListener); + } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::removeEventListener(aListener); + } + }; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FUNCTIONS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/inc/Group.hxx b/reportdesign/source/core/inc/Group.hxx new file mode 100644 index 000000000..a30debf41 --- /dev/null +++ b/reportdesign/source/core/inc/Group.hxx @@ -0,0 +1,168 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_GROUP_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_GROUP_HXX + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace reportdesign +{ + typedef ::cppu::WeakComponentImplHelper< css::report::XGroup + , css::lang::XServiceInfo> GroupBase; + typedef ::cppu::PropertySetMixin< css::report::XGroup> GroupPropertySet; + + /** \class OGroup Defines the implementation of a \interface com:::sun::star::report::XGroup + * \ingroup reportdesign_api + * + */ + class OGroup : public comphelper::OMutexAndBroadcastHelper + ,public GroupBase + ,public GroupPropertySet + { + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::WeakReference< css::report::XGroups > m_xParent; + css::uno::Reference< css::report::XSection> m_xHeader; + css::uno::Reference< css::report::XSection> m_xFooter; + css::uno::Reference< css::report::XFunctions > m_xFunctions; + ::rptshared::GroupProperties m_aProps; + + private: + OGroup& operator=(const OGroup&) = delete; + OGroup(const OGroup&) = delete; + + template void set( const OUString& _sProperty + ,const T& Value + ,T& _member) + { + BoundListeners l; + { + ::osl::MutexGuard aGuard(m_aMutex); + if ( _member != Value ) + { + prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l); + _member = Value; + } + } + l.notify(); + } + void set( const OUString& _sProperty + ,bool Value + ,bool& _member) + { + BoundListeners l; + { + ::osl::MutexGuard aGuard(m_aMutex); + if ( _member != Value ) + { + prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l); + _member = Value; + } + } + l.notify(); + } + void setSection( const OUString& _sProperty + ,bool _bOn + ,const OUString& _sName + ,css::uno::Reference< css::report::XSection>& _member); + protected: + // TODO: VirtualFunctionFinder: This is virtual function! + + virtual ~OGroup() override; + + /** this function is called upon disposing the component + */ + // TODO: VirtualFunctionFinder: This is virtual function! + + virtual void SAL_CALL disposing() override; + public: + OGroup(const css::uno::Reference< css::report::XGroups >& _xParent + ,const css::uno::Reference< css::uno::XComponentContext >& context); + + DECLARE_XINTERFACE( ) + // css::lang::XServiceInfo + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual OUString SAL_CALL getImplementationName( ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + /// @throws css::uno::RuntimeException + static css::uno::Sequence< OUString > getSupportedServiceNames_Static(); + + // css::beans::XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + // XGroup + virtual sal_Bool SAL_CALL getSortAscending() override; + virtual void SAL_CALL setSortAscending( sal_Bool _sortascending ) override; + virtual sal_Bool SAL_CALL getHeaderOn() override; + virtual void SAL_CALL setHeaderOn( sal_Bool _headeron ) override; + virtual sal_Bool SAL_CALL getFooterOn() override; + virtual void SAL_CALL setFooterOn( sal_Bool _footeron ) override; + virtual css::uno::Reference< css::report::XSection > SAL_CALL getHeader() override; + virtual css::uno::Reference< css::report::XSection > SAL_CALL getFooter() override; + virtual ::sal_Int16 SAL_CALL getGroupOn() override; + virtual void SAL_CALL setGroupOn( ::sal_Int16 _groupon ) override; + virtual ::sal_Int32 SAL_CALL getGroupInterval() override; + virtual void SAL_CALL setGroupInterval( ::sal_Int32 _groupinterval ) override; + virtual ::sal_Int16 SAL_CALL getKeepTogether() override; + virtual void SAL_CALL setKeepTogether( ::sal_Int16 _keeptogether ) override; + virtual css::uno::Reference< css::report::XGroups > SAL_CALL getGroups() override; + virtual OUString SAL_CALL getExpression() override; + virtual void SAL_CALL setExpression( const OUString& _expression ) override; + virtual sal_Bool SAL_CALL getStartNewColumn() override; + virtual void SAL_CALL setStartNewColumn( sal_Bool _startnewcolumn ) override; + virtual sal_Bool SAL_CALL getResetPageNumber() override; + virtual void SAL_CALL setResetPageNumber( sal_Bool _resetpagenumber ) override; + + //XFunctionsSupplier + virtual css::uno::Reference< css::report::XFunctions > SAL_CALL getFunctions() override; + + // XChild + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override; + virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override; + + // XComponent + virtual void SAL_CALL dispose() override; + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::addEventListener(aListener); + } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::removeEventListener(aListener); + } + }; + +} // namespace reportdesign + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/inc/Groups.hxx b/reportdesign/source/core/inc/Groups.hxx new file mode 100644 index 000000000..9897abd3a --- /dev/null +++ b/reportdesign/source/core/inc/Groups.hxx @@ -0,0 +1,100 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_GROUPS_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_GROUPS_HXX + +#include +#include +#include +#include +#include +#include + + +namespace reportdesign +{ + typedef ::cppu::WeakComponentImplHelper< css::report::XGroups> GroupsBase; + /** \class OGroups Defines the implementation of a \interface com:::sun::star::report::XGroups + * \ingroup reportdesign_api + * + */ + class OGroups : public cppu::BaseMutex, + public GroupsBase + { + typedef ::std::vector< css::uno::Reference< css::report::XGroup > > TGroups; + ::comphelper::OInterfaceContainerHelper3 m_aContainerListeners; + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::WeakReference< css::report::XReportDefinition > m_xParent; + TGroups m_aGroups; + private: + OGroups& operator=(const OGroups&) = delete; + OGroups(const OGroups&) = delete; + void checkIndex(sal_Int32 _nIndex); + protected: + // TODO: VirtualFunctionFinder: This is virtual function! + + virtual ~OGroups() override; + + /** this function is called upon disposing the component + */ + // TODO: VirtualFunctionFinder: This is virtual function! + + virtual void SAL_CALL disposing() override; + public: + OGroups( const css::uno::Reference< css::report::XReportDefinition >& _xParent + ,const css::uno::Reference< css::uno::XComponentContext >& context); + + // XGroups + // Attributes + virtual css::uno::Reference< css::report::XReportDefinition > SAL_CALL getReportDefinition() override; + // Methods + virtual css::uno::Reference< css::report::XGroup > SAL_CALL createGroup( ) override; + // XIndexContainer + virtual void SAL_CALL insertByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override; + virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) override; + // XIndexReplace + virtual void SAL_CALL replaceByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override; + // XIndexAccess + virtual ::sal_Int32 SAL_CALL getCount( ) override; + virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override; + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + // XChild + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override; + virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override; + // XContainer + virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + + // XComponent + virtual void SAL_CALL dispose() override; + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::addEventListener(aListener); + } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::removeEventListener(aListener); + } + }; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_GROUPS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/inc/ImageControl.hxx b/reportdesign/source/core/inc/ImageControl.hxx new file mode 100644 index 000000000..748659913 --- /dev/null +++ b/reportdesign/source/core/inc/ImageControl.hxx @@ -0,0 +1,171 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_IMAGECONTROL_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_IMAGECONTROL_HXX + +#include +#include +#include +#include "ReportControlModel.hxx" +#include +#include +#include +#include + +namespace reportdesign +{ + typedef ::cppu::PropertySetMixin< css::report::XImageControl > ImageControlPropertySet; + typedef ::cppu::WeakComponentImplHelper< css::report::XImageControl + ,css::lang::XServiceInfo > ImageControlBase; + + /** \class OImageControl Defines the implementation of a \interface com:::sun::star::report::XImageControl + * \ingroup reportdesign_api + * + */ + class OImageControl : public cppu::BaseMutex, + public ImageControlBase, + public ImageControlPropertySet + { + friend class OShapeHelper; + OReportControlModel m_aProps; + OUString m_aImageURL; + sal_Int16 m_nScaleMode; + bool m_bPreserveIRI; + private: + OImageControl(const OImageControl&) = delete; + OImageControl& operator=(const OImageControl&) = delete; + + template void set( const OUString& _sProperty + ,const T& Value + ,T& _member) + { + BoundListeners l; + { + ::osl::MutexGuard aGuard(m_aMutex); + prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l); + _member = Value; + } + l.notify(); + } + void set( const OUString& _sProperty + ,bool Value + ,bool& _member) + { + BoundListeners l; + { + ::osl::MutexGuard aGuard(m_aMutex); + prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l); + _member = Value; + } + l.notify(); + } + protected: + virtual ~OImageControl() override; + public: + explicit OImageControl(css::uno::Reference< css::uno::XComponentContext > const & _xContext); + explicit OImageControl(css::uno::Reference< css::uno::XComponentContext > const & _xContext + ,const css::uno::Reference< css::lang::XMultiServiceFactory > & _xFactory + ,css::uno::Reference< css::drawing::XShape >& _xShape); + + DECLARE_XINTERFACE( ) + // css::lang::XServiceInfo + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual OUString SAL_CALL getImplementationName( ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + /// @throws css::uno::RuntimeException + static css::uno::Sequence< OUString > getSupportedServiceNames_Static(); + /// @throws css::uno::RuntimeException + static OUString getImplementationName_Static(); + static css::uno::Reference< css::uno::XInterface > + create(css::uno::Reference< css::uno::XComponentContext > const & xContext); + // css::beans::XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + // XReportComponent + REPORTCOMPONENT_HEADER() + // XShape + SHAPE_HEADER() + + // XShapeDescriptor + virtual OUString SAL_CALL getShapeType( ) override; + + // XReportControlModel + REPORTCONTROLMODEL_HEADER() + + // XReportControlFormat + REPORTCONTROLFORMAT_HEADER() + + // XCloneable + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override; + + // XImageControl + virtual OUString SAL_CALL getImageURL() override; + virtual void SAL_CALL setImageURL( const OUString& _imageurl ) override; + virtual sal_Bool SAL_CALL getPreserveIRI() override; + virtual void SAL_CALL setPreserveIRI( sal_Bool _preserveiri ) override; + virtual ::sal_Int16 SAL_CALL getScaleMode() override; + virtual void SAL_CALL setScaleMode( ::sal_Int16 _scalemode ) override; + + // XImageProducerSupplier + virtual css::uno::Reference< css::awt::XImageProducer > SAL_CALL getImageProducer( ) override; + + // XComponent + virtual void SAL_CALL dispose() override; + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::addEventListener(aListener); + } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::removeEventListener(aListener); + } + + // XChild + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override; + virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override; + // XContainer + virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + // XIndexReplace + virtual void SAL_CALL replaceByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override; + + // XIndexContainer + virtual void SAL_CALL insertByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override; + virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) override; + + // XIndexAccess + virtual ::sal_Int32 SAL_CALL getCount( ) override; + virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override; + }; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_IMAGECONTROL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/inc/ReportComponent.hxx b/reportdesign/source/core/inc/ReportComponent.hxx new file mode 100644 index 000000000..b6f966040 --- /dev/null +++ b/reportdesign/source/core/inc/ReportComponent.hxx @@ -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 . + */ + +#ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_REPORTCOMPONENT_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_REPORTCOMPONENT_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace reportdesign +{ + class OReportComponentProperties + { + public: + css::uno::WeakReference m_xParent; + css::uno::Reference m_xContext; + css::uno::Reference m_xFactory; + css::uno::Reference m_xShape; + css::uno::Reference m_xProxy; + css::uno::Reference m_xProperty; + css::uno::Reference m_xTypeProvider; + css::uno::Reference m_xUnoTunnel; + css::uno::Reference m_xServiceInfo; + css::uno::Sequence m_aMasterFields; + css::uno::Sequence m_aDetailFields; + OUString m_sName; + ::sal_Int32 m_nHeight; + ::sal_Int32 m_nWidth; + ::sal_Int32 m_nPosX; + ::sal_Int32 m_nPosY; + ::sal_Int32 m_nBorderColor; + ::sal_Int16 m_nBorder; + bool m_bPrintRepeatedValues; + bool m_bAutoGrow; + + OReportComponentProperties( + css::uno::Reference const& xContext) + : m_xContext(xContext) + , m_nHeight(0) + , m_nWidth(0) + , m_nPosX(0) + , m_nPosY(0) + , m_nBorderColor(0) + , m_nBorder(2) + , m_bPrintRepeatedValues(true) + , m_bAutoGrow(false) + {} + ~OReportComponentProperties(); + + void setShape(css::uno::Reference& xShape, + const css::uno::Reference& xTunnel, + oslInterlockedCount& rRefCount); + }; +} + +#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_REPORTCOMPONENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/inc/ReportControlModel.hxx b/reportdesign/source/core/inc/ReportControlModel.hxx new file mode 100644 index 000000000..98d209fc6 --- /dev/null +++ b/reportdesign/source/core/inc/ReportControlModel.hxx @@ -0,0 +1,138 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_REPORTCONTROLMODEL_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_REPORTCONTROLMODEL_HXX + +#include "ReportComponent.hxx" +#include +#include +#include +#include +#include +#include +#include + + +namespace reportdesign +{ + struct OFormatProperties + { + css::style::ParagraphAdjust nAlign; + css::awt::FontDescriptor aFontDescriptor; + css::awt::FontDescriptor aAsianFontDescriptor; + css::awt::FontDescriptor aComplexFontDescriptor; + css::lang::Locale aCharLocale; + css::lang::Locale aCharLocaleAsian; + css::lang::Locale aCharLocaleComplex; + ::sal_Int16 nFontEmphasisMark; + ::sal_Int16 nFontRelief; + ::sal_Int32 nTextColor; + ::sal_Int32 nTextLineColor; + ::sal_Int32 nBackgroundColor; + OUString sCharCombinePrefix; + OUString sCharCombineSuffix; + OUString sHyperLinkURL; + OUString sHyperLinkTarget; + OUString sHyperLinkName; + OUString sVisitedCharStyleName; + OUString sUnvisitedCharStyleName; + css::style::VerticalAlignment aVerticalAlignment; + ::sal_Int16 nCharEscapement; + ::sal_Int16 nCharCaseMap; + ::sal_Int16 nCharKerning; + ::sal_Int8 nCharEscapementHeight; + bool m_bBackgroundTransparent; + bool bCharFlash; + bool bCharAutoKerning; + bool bCharCombineIsOn; + bool bCharHidden; + bool bCharShadowed; + bool bCharContoured; + OFormatProperties(); + }; + class OReportControlModel + { + void checkIndex(sal_Int32 _nIndex); + OReportControlModel(OReportControlModel const &) = delete; + void operator =(OReportControlModel const &) = delete; + public: + ::comphelper::OInterfaceContainerHelper3 aContainerListeners; + OReportComponentProperties aComponent; + OFormatProperties aFormatProperties; + css::container::XContainer* m_pOwner; + ::std::vector< css::uno::Reference< css::report::XFormatCondition> > + m_aFormatConditions; + osl::Mutex& m_rMutex; + OUString aDataField; + OUString aConditionalPrintExpression; + bool bPrintWhenGroupChange; + + OReportControlModel(osl::Mutex& _rMutex + ,css::container::XContainer* _pOwner + ,css::uno::Reference< css::uno::XComponentContext > const & _xContext) + :aContainerListeners(_rMutex) + ,aComponent(_xContext) + ,m_pOwner(_pOwner) + ,m_rMutex(_rMutex) + ,bPrintWhenGroupChange(true) + {} + + // XContainer + /// @throws css::uno::RuntimeException + void addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ); + /// @throws css::uno::RuntimeException + void removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ); + + // XElementAccess + /// @throws css::uno::RuntimeException + bool hasElements( ); + + // XIndexReplace + /// @throws css::lang::IllegalArgumentException + /// @throws css::lang::IndexOutOfBoundsException + /// @throws css::lang::WrappedTargetException + /// @throws css::uno::RuntimeException + void replaceByIndex( ::sal_Int32 Index, const css::uno::Any& Element ); + + // XIndexContainer + /// @throws css::lang::IllegalArgumentException + /// @throws css::lang::IndexOutOfBoundsException + /// @throws css::lang::WrappedTargetException + /// @throws css::uno::RuntimeException + void insertByIndex( ::sal_Int32 Index, const css::uno::Any& Element ); + /// @throws css::lang::IndexOutOfBoundsException + /// @throws css::lang::WrappedTargetException + /// @throws css::uno::RuntimeException + void removeByIndex( ::sal_Int32 Index ); + + // XIndexAccess + /// @throws css::uno::RuntimeException + ::sal_Int32 getCount( ); + /// @throws css::lang::IndexOutOfBoundsException + /// @throws css::lang::WrappedTargetException + /// @throws css::uno::RuntimeException + css::uno::Any getByIndex( ::sal_Int32 Index ); + + static bool isInterfaceForbidden(const css::uno::Type& _rType); + }; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_REPORTCONTROLMODEL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/inc/ReportDrawPage.hxx b/reportdesign/source/core/inc/ReportDrawPage.hxx new file mode 100644 index 000000000..e1b432247 --- /dev/null +++ b/reportdesign/source/core/inc/ReportDrawPage.hxx @@ -0,0 +1,42 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_REPORTDRAWPAGE_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_REPORTDRAWPAGE_HXX + +#include +#include + +namespace reportdesign +{ + class OReportDrawPage : public SvxDrawPage + { + css::uno::WeakReference< css::report::XSection > m_xSection; + OReportDrawPage(const OReportDrawPage&) = delete; + void operator =(const OReportDrawPage&) = delete; + protected: + virtual SdrObject *CreateSdrObject_( const css::uno::Reference< css::drawing::XShape > & xShape ) override; + virtual css::uno::Reference< css::drawing::XShape > CreateShape( SdrObject *pObj ) const override; + public: + OReportDrawPage(SdrPage* pPage,const css::uno::Reference< css::report::XSection >& _xSection); + }; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_REPORTDRAWPAGE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/inc/ReportEngineJFree.hxx b/reportdesign/source/core/inc/ReportEngineJFree.hxx new file mode 100644 index 000000000..e0ab1d60b --- /dev/null +++ b/reportdesign/source/core/inc/ReportEngineJFree.hxx @@ -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 . + */ +#ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_REPORTENGINEJFREE_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_REPORTENGINEJFREE_HXX + +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace reportdesign +{ + typedef ::cppu::WeakComponentImplHelper< css::report::XReportEngine + ,css::lang::XServiceInfo> ReportEngineBase; + typedef ::cppu::PropertySetMixin ReportEnginePropertySet; + + class OReportEngineJFree : public comphelper::OMutexAndBroadcastHelper, + public ReportEngineBase, + public ReportEnginePropertySet + { + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::Reference< css::report::XReportDefinition > m_xReport; + css::uno::Reference< css::task::XStatusIndicator> m_StatusIndicator; + css::uno::Reference< css::sdbc::XConnection > m_xActiveConnection; + ::sal_Int32 m_nMaxRows; + private: + OReportEngineJFree(const OReportEngineJFree&) = delete; + OReportEngineJFree& operator=(const OReportEngineJFree&) = delete; + template void set( const OUString& _sProperty + ,const T& Value + ,T& _member) + { + BoundListeners l; + { + ::osl::MutexGuard aGuard(m_aMutex); + prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l); + _member = Value; + } + l.notify(); + } + + /** returns the file url for a new model + * + * \return The new file url. + */ + OUString getNewOutputName(); + + protected: + // TODO: VirtualFunctionFinder: This is virtual function! + + virtual ~OReportEngineJFree() override; + public: + OReportEngineJFree(const css::uno::Reference< css::uno::XComponentContext >& context); + + DECLARE_XINTERFACE( ) + // css::lang::XServiceInfo + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual OUString SAL_CALL getImplementationName( ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + /// @throws css::uno::RuntimeException + static css::uno::Sequence< OUString > getSupportedServiceNames_Static(); + /// @throws css::uno::RuntimeException + static OUString getImplementationName_Static(); + static css::uno::Reference< css::uno::XInterface > + create(css::uno::Reference< css::uno::XComponentContext > const & xContext); + private: + // css::beans::XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + // XReportEngine + // Attributes + virtual css::uno::Reference< css::report::XReportDefinition > SAL_CALL getReportDefinition() override ; + virtual void SAL_CALL setReportDefinition( const css::uno::Reference< css::report::XReportDefinition >& _reportdefinition ) override; + virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL getActiveConnection() override; + virtual void SAL_CALL setActiveConnection( const css::uno::Reference< css::sdbc::XConnection >& _activeconnection ) override; + virtual css::uno::Reference< css::task::XStatusIndicator > SAL_CALL getStatusIndicator() override ; + virtual void SAL_CALL setStatusIndicator( const css::uno::Reference< css::task::XStatusIndicator >& _statusindicator ) override ; + virtual ::sal_Int32 SAL_CALL getMaxRows() override; + virtual void SAL_CALL setMaxRows( ::sal_Int32 MaxRows ) override; + // Methods + virtual css::uno::Reference< css::frame::XModel > SAL_CALL createDocumentModel( ) override ; + virtual css::uno::Reference< css::frame::XModel > SAL_CALL createDocumentAlive( const css::uno::Reference< css::frame::XFrame >& _frame ) override ; + /// @throws css::lang::DisposedException + /// @throws css::lang::IllegalArgumentException + /// @throws css::uno::Exception + /// @throws css::uno::RuntimeException + css::uno::Reference< css::frame::XModel > createDocumentAlive( const css::uno::Reference< css::frame::XFrame >& _frame ,bool _bHidden) ; + virtual css::util::URL SAL_CALL createDocument( ) override ; + virtual void SAL_CALL interrupt( ) override ; + + // XComponent + virtual void SAL_CALL dispose() override; + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::addEventListener(aListener); + } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::removeEventListener(aListener); + } + }; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_REPORTENGINEJFREE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/inc/ReportHelperImpl.hxx b/reportdesign/source/core/inc/ReportHelperImpl.hxx new file mode 100644 index 000000000..4d5a1f41e --- /dev/null +++ b/reportdesign/source/core/inc/ReportHelperImpl.hxx @@ -0,0 +1,1293 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_REPORTHELPERIMPL_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_REPORTHELPERIMPL_HXX +// css::report::XReportComponent: +#define REPORTCOMPONENT_IMPL3(clazz,arg) \ +OUString SAL_CALL clazz::getName() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return (arg).m_sName; \ +} \ +void SAL_CALL clazz::setName( const OUString& _name ) \ +{ \ + set(PROPERTY_NAME,_name,(arg).m_sName); \ +} \ +::sal_Int32 SAL_CALL clazz::getHeight() \ +{ \ + return getSize().Height; \ +} \ +void SAL_CALL clazz::setHeight( ::sal_Int32 _height ) \ +{ \ + awt::Size aSize = getSize(); \ + aSize.Height = _height; \ + setSize(aSize); \ +} \ +::sal_Int32 SAL_CALL clazz::getPositionX() \ +{ \ + return getPosition().X; \ +} \ +void SAL_CALL clazz::setPositionX( ::sal_Int32 _positionx ) \ +{ \ + awt::Point aPos = getPosition(); \ + aPos.X = _positionx; \ + setPosition(aPos); \ +} \ +::sal_Int32 SAL_CALL clazz::getPositionY() \ +{ \ + return getPosition().Y; \ +} \ +void SAL_CALL clazz::setPositionY( ::sal_Int32 _positiony ) \ +{ \ + awt::Point aPos = getPosition(); \ + aPos.Y = _positiony; \ + setPosition(aPos); \ +} \ +::sal_Int32 SAL_CALL clazz::getWidth() \ +{ \ + return getSize().Width; \ +} \ +void SAL_CALL clazz::setWidth( ::sal_Int32 _width ) \ +{ \ + awt::Size aSize = getSize(); \ + aSize.Width = _width; \ + setSize(aSize); \ +} \ +uno::Reference< report::XSection > SAL_CALL clazz::getSection() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + uno::Reference< container::XChild > xParent(getParent( ),uno::UNO_QUERY); \ + return lcl_getSection(xParent); \ +} \ +sal_Bool SAL_CALL clazz::getAutoGrow() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return (arg).m_bAutoGrow; \ +} \ +void SAL_CALL clazz::setAutoGrow(sal_Bool _autogrow) \ +{ \ + set(PROPERTY_AUTOGROW,static_cast(_autogrow),(arg).m_bAutoGrow); \ +} + +#define REPORTCOMPONENT_IMPL(clazz,arg) \ +REPORTCOMPONENT_IMPL3(clazz,arg)\ +sal_Bool SAL_CALL clazz::getPrintRepeatedValues() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return (arg).m_bPrintRepeatedValues; \ +} \ +void SAL_CALL clazz::setPrintRepeatedValues( sal_Bool _printrepeatedvalues ) \ +{ \ + set(PROPERTY_PRINTREPEATEDVALUES,_printrepeatedvalues,(arg).m_bPrintRepeatedValues); \ +} + +#define REPORTCOMPONENT_IMPL2(clazz,arg) \ +::sal_Int16 SAL_CALL clazz::getControlBorder() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return (arg).m_nBorder; \ +} \ +void SAL_CALL clazz::setControlBorder( ::sal_Int16 _border )\ +{ \ + set(PROPERTY_CONTROLBORDER,_border,(arg).m_nBorder); \ +} \ +::sal_Int32 SAL_CALL clazz::getControlBorderColor() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return (arg).m_nBorderColor; \ +} \ +void SAL_CALL clazz::setControlBorderColor( ::sal_Int32 _bordercolor ) \ +{ \ + set(PROPERTY_CONTROLBORDERCOLOR,_bordercolor,(arg).m_nBorderColor); \ +} + +#define REPORTCOMPONENT_MASTERDETAIL(clazz,arg) \ +css::uno::Sequence< OUString > SAL_CALL clazz::getMasterFields() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return (arg).m_aMasterFields; \ +} \ +void SAL_CALL clazz::setMasterFields( const css::uno::Sequence< OUString >& _masterfields )\ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + set(PROPERTY_MASTERFIELDS,_masterfields,(arg).m_aMasterFields); \ +} \ +css::uno::Sequence< OUString > SAL_CALL clazz::getDetailFields()\ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return (arg).m_aDetailFields; \ +} \ +void SAL_CALL clazz::setDetailFields( const css::uno::Sequence< OUString >& _detailfields )\ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + set(PROPERTY_DETAILFIELDS,_detailfields,(arg).m_aDetailFields); \ +} + +#define REPORTCOMPONENT_NOMASTERDETAIL(clazz) \ +css::uno::Sequence< OUString > SAL_CALL clazz::getMasterFields() \ +{ \ + throw css::beans::UnknownPropertyException();\ +} \ +void SAL_CALL clazz::setMasterFields( const css::uno::Sequence< OUString >& )\ +{ \ + throw css::beans::UnknownPropertyException();\ +} \ +css::uno::Sequence< OUString > SAL_CALL clazz::getDetailFields()\ +{ \ + throw css::beans::UnknownPropertyException();\ +} \ +void SAL_CALL clazz::setDetailFields( const css::uno::Sequence< OUString >& )\ +{ \ + throw css::beans::UnknownPropertyException();\ +} + +// css::report::XReportControlFormat: +#define REPORTCONTROLFORMAT_IMPL1(clazz,varName) \ +::sal_Int32 SAL_CALL clazz::getControlBackground() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.m_bBackgroundTransparent ? sal_Int32(COL_TRANSPARENT) : varName.nBackgroundColor; \ +} \ + \ +void SAL_CALL clazz::setControlBackground( ::sal_Int32 _backgroundcolor )\ +{ \ + bool bTransparent = _backgroundcolor == static_cast(COL_TRANSPARENT);\ + setControlBackgroundTransparent(bTransparent);\ + if ( !bTransparent )\ + set(PROPERTY_CONTROLBACKGROUND,_backgroundcolor,varName.nBackgroundColor);\ +} \ + \ +sal_Bool SAL_CALL clazz::getControlBackgroundTransparent() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.m_bBackgroundTransparent; \ +} \ + \ +void SAL_CALL clazz::setControlBackgroundTransparent( sal_Bool _controlbackgroundtransparent ) \ +{ \ + set(PROPERTY_CONTROLBACKGROUNDTRANSPARENT,_controlbackgroundtransparent,varName.m_bBackgroundTransparent);\ + if ( _controlbackgroundtransparent )\ + set(PROPERTY_CONTROLBACKGROUND,static_cast(COL_TRANSPARENT),varName.nBackgroundColor);\ +} + +#define REPORTCONTROLFORMAT_IMPL2(clazz,varName) \ +::sal_Int16 SAL_CALL clazz::getCharStrikeout() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aFontDescriptor.Strikeout; \ +} \ + \ +void SAL_CALL clazz::setCharStrikeout(::sal_Int16 the_value) \ +{ \ + set(PROPERTY_CHARSTRIKEOUT,the_value,varName.aFontDescriptor.Strikeout); \ +} \ + \ +sal_Bool SAL_CALL clazz::getCharWordMode() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aFontDescriptor.WordLineMode; \ +} \ + \ +void SAL_CALL clazz::setCharWordMode(sal_Bool the_value) \ +{ \ + set(PROPERTY_CHARWORDMODE,the_value,varName.aFontDescriptor.WordLineMode); \ +} \ + \ +::sal_Int16 SAL_CALL clazz::getCharRotation() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return static_cast(varName.aFontDescriptor.Orientation); \ +} \ + \ +void SAL_CALL clazz::setCharRotation(::sal_Int16 the_value) \ +{ \ + float newValue = the_value; \ + set(PROPERTY_CHARROTATION,newValue,varName.aFontDescriptor.Orientation); \ +} \ + \ +::sal_Int16 SAL_CALL clazz::getCharScaleWidth() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return static_cast(varName.aFontDescriptor.CharacterWidth); \ +} \ + \ +void SAL_CALL clazz::setCharScaleWidth(::sal_Int16 the_value) \ +{ \ + float newValue = the_value; \ + set(PROPERTY_CHARSCALEWIDTH,newValue,varName.aFontDescriptor.CharacterWidth); \ +} \ +sal_Int16 SAL_CALL clazz::getParaAdjust() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return static_cast(varName.nAlign); \ +} \ + \ +void SAL_CALL clazz::setParaAdjust( sal_Int16 _align ) \ +{ \ + set(PROPERTY_PARAADJUST,_align,varName.nAlign); \ +} \ + \ +awt::FontDescriptor SAL_CALL clazz::getFontDescriptor() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aFontDescriptor; \ +} \ + \ +void SAL_CALL clazz::setFontDescriptor( const awt::FontDescriptor& _fontdescriptor ) \ +{ \ + set(PROPERTY_FONTDESCRIPTOR,_fontdescriptor,varName.aFontDescriptor); \ +} \ +awt::FontDescriptor SAL_CALL clazz::getFontDescriptorAsian() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aAsianFontDescriptor; \ +} \ + \ +void SAL_CALL clazz::setFontDescriptorAsian( const awt::FontDescriptor& _fontdescriptor ) \ +{ \ + set(PROPERTY_FONTDESCRIPTORASIAN,_fontdescriptor,varName.aAsianFontDescriptor); \ +} \ +awt::FontDescriptor SAL_CALL clazz::getFontDescriptorComplex() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aComplexFontDescriptor; \ +} \ + \ +void SAL_CALL clazz::setFontDescriptorComplex( const awt::FontDescriptor& _fontdescriptor ) \ +{ \ + set(PROPERTY_FONTDESCRIPTORCOMPLEX,_fontdescriptor,varName.aComplexFontDescriptor); \ +} \ + \ +::sal_Int16 SAL_CALL clazz::getControlTextEmphasis() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.nFontEmphasisMark; \ +} \ + \ +void SAL_CALL clazz::setControlTextEmphasis( ::sal_Int16 _fontemphasismark ) \ +{ \ + set(PROPERTY_CONTROLTEXTEMPHASISMARK,_fontemphasismark,varName.nFontEmphasisMark); \ +} \ + \ +::sal_Int16 SAL_CALL clazz::getCharRelief() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.nFontRelief; \ +} \ + \ +void SAL_CALL clazz::setCharRelief( ::sal_Int16 _fontrelief ) \ +{ \ + set(PROPERTY_CHARRELIEF,_fontrelief,varName.nFontRelief); \ +} \ + \ +::sal_Int32 SAL_CALL clazz::getCharColor() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.nTextColor; \ +} \ + \ +void SAL_CALL clazz::setCharColor( ::sal_Int32 _textcolor ) \ +{ \ + set(PROPERTY_CHARCOLOR,_textcolor,varName.nTextColor); \ +} \ + \ +::sal_Int32 SAL_CALL clazz::getCharUnderlineColor() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.nTextLineColor; \ +} \ + \ +void SAL_CALL clazz::setCharUnderlineColor( ::sal_Int32 _textlinecolor ) \ +{ \ + set(PROPERTY_CHARUNDERLINECOLOR,_textlinecolor,varName.nTextLineColor); \ +} \ + \ +style::VerticalAlignment SAL_CALL clazz::getVerticalAlign() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aVerticalAlignment; \ +} \ + \ +void SAL_CALL clazz::setVerticalAlign( style::VerticalAlignment _verticalalign ) \ +{ \ + set(PROPERTY_VERTICALALIGN,_verticalalign,varName.aVerticalAlignment); \ +} \ + \ +::sal_Int16 SAL_CALL clazz::getCharEmphasis() \ +{ \ + return getControlTextEmphasis(); \ +} \ + \ +void SAL_CALL clazz::setCharEmphasis( ::sal_Int16 _charemphasis ) \ +{ \ + set(PROPERTY_CHAREMPHASIS,_charemphasis,varName.nFontEmphasisMark); \ +} \ + \ +OUString SAL_CALL clazz::getCharFontName() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aFontDescriptor.Name; \ +} \ + \ +void SAL_CALL clazz::setCharFontName( const OUString& _charfontname ) \ +{ \ + set(PROPERTY_CHARFONTNAME,_charfontname,varName.aFontDescriptor.Name); \ +} \ + \ +OUString SAL_CALL clazz::getCharFontStyleName() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aFontDescriptor.StyleName; \ +} \ + \ +void SAL_CALL clazz::setCharFontStyleName( const OUString& _charfontstylename ) \ +{ \ + set(PROPERTY_CHARFONTSTYLENAME,_charfontstylename,varName.aFontDescriptor.StyleName); \ +} \ + \ +::sal_Int16 SAL_CALL clazz::getCharFontFamily() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aFontDescriptor.Family; \ +} \ + \ +void SAL_CALL clazz::setCharFontFamily( ::sal_Int16 _charfontfamily ) \ +{ \ + set(PROPERTY_CHARFONTFAMILY,_charfontfamily,varName.aFontDescriptor.Family); \ +} \ + \ +::sal_Int16 SAL_CALL clazz::getCharFontCharSet() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aFontDescriptor.CharSet; \ +} \ + \ +void SAL_CALL clazz::setCharFontCharSet( ::sal_Int16 _charfontcharset ) \ +{ \ + set(PROPERTY_CHARFONTCHARSET,_charfontcharset,varName.aFontDescriptor.CharSet); \ +} \ + \ +::sal_Int16 SAL_CALL clazz::getCharFontPitch() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aFontDescriptor.Pitch; \ +} \ + \ +void SAL_CALL clazz::setCharFontPitch( ::sal_Int16 _charfontpitch ) \ +{ \ + set(PROPERTY_CHARFONTPITCH,_charfontpitch,varName.aFontDescriptor.Pitch); \ +} \ + \ +float SAL_CALL clazz::getCharHeight() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aFontDescriptor.Height; \ +} \ + \ +void SAL_CALL clazz::setCharHeight( float _charheight ) \ +{ \ + set(PROPERTY_CHARHEIGHT,static_cast(_charheight),varName.aFontDescriptor.Height); \ +} \ + \ +::sal_Int16 SAL_CALL clazz::getCharUnderline() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aFontDescriptor.Underline; \ +} \ + \ +void SAL_CALL clazz::setCharUnderline( ::sal_Int16 _charunderline ) \ +{ \ + set(PROPERTY_CHARUNDERLINE,_charunderline,varName.aFontDescriptor.Underline); \ +} \ + \ +float SAL_CALL clazz::getCharWeight() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aFontDescriptor.Weight; \ +} \ + \ +void SAL_CALL clazz::setCharWeight( float _charweight ) \ +{ \ + set(PROPERTY_CHARWEIGHT,_charweight,varName.aFontDescriptor.Weight); \ +} \ + \ +awt::FontSlant SAL_CALL clazz::getCharPosture() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aFontDescriptor.Slant; \ +} \ + \ +void SAL_CALL clazz::setCharPosture( awt::FontSlant _charposture ) \ +{ \ + set(PROPERTY_CHARPOSTURE,_charposture,varName.aFontDescriptor.Slant); \ +}\ +sal_Bool SAL_CALL clazz::getCharFlash()\ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.bCharFlash; \ +} \ +void SAL_CALL clazz::setCharFlash(sal_Bool the_value)\ +{ \ + set(PROPERTY_CHARFLASH,the_value,varName.bCharFlash); \ +}\ +sal_Bool SAL_CALL clazz::getCharAutoKerning()\ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.bCharAutoKerning; \ +} \ +void SAL_CALL clazz::setCharAutoKerning(sal_Bool the_value)\ +{ \ + set(PROPERTY_CHARAUTOKERNING,the_value,varName.bCharAutoKerning); \ +}\ +::sal_Int8 SAL_CALL clazz::getCharEscapementHeight() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.nCharEscapementHeight; \ +} \ +void SAL_CALL clazz::setCharEscapementHeight(::sal_Int8 the_value) \ +{ \ + set(PROPERTY_CHARESCAPEMENTHEIGHT,the_value,varName.nCharEscapementHeight); \ +}\ +lang::Locale SAL_CALL clazz::getCharLocale() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aCharLocale; \ +} \ +void SAL_CALL clazz::setCharLocale(const lang::Locale & the_value) \ +{ \ + BoundListeners l; \ + { \ + ::osl::MutexGuard aGuard(m_aMutex); \ + if ( varName.aCharLocale.Language != the_value.Language \ + || varName.aCharLocale.Country != the_value.Country \ + || varName.aCharLocale.Variant != the_value.Variant ) \ + { \ + prepareSet(PROPERTY_CHARLOCALE, css::uno::Any(varName.aCharLocale), css::uno::Any(the_value), &l); \ + varName.aCharLocale = the_value; \ + } \ + } \ + l.notify(); \ +}\ +::sal_Int16 SAL_CALL clazz::getCharEscapement() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.nCharEscapement; \ +} \ +void SAL_CALL clazz::setCharEscapement(::sal_Int16 the_value) \ +{ \ + set(PROPERTY_CHARESCAPEMENT,the_value,varName.nCharEscapement); \ +}\ +::sal_Int16 SAL_CALL clazz::getCharCaseMap() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.nCharCaseMap; \ +} \ +void SAL_CALL clazz::setCharCaseMap(::sal_Int16 the_value) \ +{ \ + set(PROPERTY_CHARCASEMAP,the_value,varName.nCharCaseMap); \ +}\ +sal_Bool SAL_CALL clazz::getCharCombineIsOn() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.bCharCombineIsOn; \ +} \ +void SAL_CALL clazz::setCharCombineIsOn(sal_Bool the_value) \ +{ \ + set(PROPERTY_CHARCOMBINEISON,the_value,varName.bCharCombineIsOn); \ +}\ +OUString SAL_CALL clazz::getCharCombinePrefix() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.sCharCombinePrefix; \ +} \ +void SAL_CALL clazz::setCharCombinePrefix(const OUString & the_value) \ +{ \ + set(PROPERTY_CHARCOMBINEPREFIX,the_value,varName.sCharCombinePrefix); \ +}\ +OUString SAL_CALL clazz::getCharCombineSuffix() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.sCharCombineSuffix; \ +} \ +void SAL_CALL clazz::setCharCombineSuffix(const OUString & the_value) \ +{ \ + set(PROPERTY_CHARCOMBINESUFFIX,the_value,varName.sCharCombineSuffix); \ +}\ +sal_Bool SAL_CALL clazz::getCharHidden() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.bCharHidden; \ +} \ +void SAL_CALL clazz::setCharHidden(sal_Bool the_value) \ +{ \ + set(PROPERTY_CHARHIDDEN,the_value,varName.bCharHidden); \ +}\ +sal_Bool SAL_CALL clazz::getCharShadowed() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.bCharShadowed; \ +} \ +void SAL_CALL clazz::setCharShadowed(sal_Bool the_value) \ +{ \ + set(PROPERTY_CHARSHADOWED,the_value,varName.bCharShadowed); \ +}\ +sal_Bool SAL_CALL clazz::getCharContoured() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.bCharContoured; \ +} \ +void SAL_CALL clazz::setCharContoured(sal_Bool the_value) \ +{ \ + set(PROPERTY_CHARCONTOURED,the_value,varName.bCharContoured); \ +}\ +OUString SAL_CALL clazz::getHyperLinkURL() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.sHyperLinkURL; \ +} \ +void SAL_CALL clazz::setHyperLinkURL(const OUString & the_value) \ +{ \ + set(PROPERTY_HYPERLINKURL,the_value,varName.sHyperLinkURL); \ +}\ +OUString SAL_CALL clazz::getHyperLinkTarget() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.sHyperLinkTarget; \ +} \ +void SAL_CALL clazz::setHyperLinkTarget(const OUString & the_value) \ +{ \ + set(PROPERTY_HYPERLINKTARGET,the_value,varName.sHyperLinkTarget); \ +}\ +OUString SAL_CALL clazz::getHyperLinkName() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.sHyperLinkName; \ +} \ +void SAL_CALL clazz::setHyperLinkName(const OUString & the_value) \ +{ \ + set(PROPERTY_HYPERLINKNAME,the_value,varName.sHyperLinkName); \ +}\ +OUString SAL_CALL clazz::getVisitedCharStyleName() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.sVisitedCharStyleName; \ +} \ +void SAL_CALL clazz::setVisitedCharStyleName(const OUString & the_value) \ +{ \ + set(PROPERTY_VISITEDCHARSTYLENAME,the_value,varName.sVisitedCharStyleName); \ +}\ +OUString SAL_CALL clazz::getUnvisitedCharStyleName() \ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.sUnvisitedCharStyleName; \ +} \ +void SAL_CALL clazz::setUnvisitedCharStyleName(const OUString & the_value) \ +{ \ + set(PROPERTY_UNVISITEDCHARSTYLENAME,the_value,varName.sUnvisitedCharStyleName); \ +}\ +::sal_Int16 SAL_CALL clazz::getCharKerning()\ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.nCharKerning; \ +}\ +void SAL_CALL clazz::setCharKerning(::sal_Int16 the_value)\ +{ \ + set(PROPERTY_CHARKERNING,the_value,varName.nCharKerning); \ +}\ +float SAL_CALL clazz::getCharHeightAsian()\ + { \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aAsianFontDescriptor.Height; \ +}\ +void SAL_CALL clazz::setCharHeightAsian( float the_value )\ +{ \ + set(PROPERTY_CHARHEIGHTASIAN,static_cast(the_value),varName.aAsianFontDescriptor.Height); \ +}\ +float SAL_CALL clazz::getCharWeightAsian()\ + { \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aAsianFontDescriptor.Weight; \ +}\ +void SAL_CALL clazz::setCharWeightAsian( float the_value )\ +{ \ + set(PROPERTY_CHARWEIGHTASIAN,the_value,varName.aAsianFontDescriptor.Weight); \ +}\ +OUString SAL_CALL clazz::getCharFontNameAsian()\ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aAsianFontDescriptor.Name; \ +}\ +void SAL_CALL clazz::setCharFontNameAsian( const OUString& the_value )\ +{ \ + set(PROPERTY_CHARFONTNAMEASIAN,the_value,varName.aAsianFontDescriptor.Name); \ +}\ +OUString SAL_CALL clazz::getCharFontStyleNameAsian()\ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aAsianFontDescriptor.StyleName; \ +}\ +void SAL_CALL clazz::setCharFontStyleNameAsian( const OUString& the_value )\ +{ \ + set(PROPERTY_CHARFONTSTYLENAMEASIAN,the_value,varName.aAsianFontDescriptor.StyleName); \ +}\ +::sal_Int16 SAL_CALL clazz::getCharFontFamilyAsian()\ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aAsianFontDescriptor.Family; \ +}\ +void SAL_CALL clazz::setCharFontFamilyAsian( ::sal_Int16 the_value )\ +{ \ + set(PROPERTY_CHARFONTFAMILYASIAN,the_value,varName.aAsianFontDescriptor.Family); \ +}\ +::sal_Int16 SAL_CALL clazz::getCharFontCharSetAsian()\ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aAsianFontDescriptor.CharSet; \ +}\ +void SAL_CALL clazz::setCharFontCharSetAsian( ::sal_Int16 the_value )\ +{ \ + set(PROPERTY_CHARFONTCHARSETASIAN,the_value,varName.aAsianFontDescriptor.CharSet); \ +}\ +::sal_Int16 SAL_CALL clazz::getCharFontPitchAsian()\ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aAsianFontDescriptor.Pitch; \ +}\ +void SAL_CALL clazz::setCharFontPitchAsian( ::sal_Int16 the_value )\ +{ \ + set(PROPERTY_CHARFONTPITCHASIAN,the_value,varName.aAsianFontDescriptor.Pitch); \ +}\ +css::awt::FontSlant SAL_CALL clazz::getCharPostureAsian()\ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aAsianFontDescriptor.Slant; \ +}\ +void SAL_CALL clazz::setCharPostureAsian( css::awt::FontSlant the_value )\ +{ \ + set(PROPERTY_CHARPOSTUREASIAN,the_value,varName.aAsianFontDescriptor.Slant); \ +}\ +css::lang::Locale SAL_CALL clazz::getCharLocaleAsian()\ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aCharLocaleAsian; \ +}\ +void SAL_CALL clazz::setCharLocaleAsian( const css::lang::Locale& the_value )\ +{ \ + BoundListeners l; \ + { \ + ::osl::MutexGuard aGuard(m_aMutex); \ + if ( varName.aCharLocaleAsian.Language != the_value.Language \ + || varName.aCharLocaleAsian.Country != the_value.Country \ + || varName.aCharLocaleAsian.Variant != the_value.Variant ) \ + { \ + prepareSet(PROPERTY_CHARLOCALEASIAN, css::uno::Any(varName.aCharLocaleAsian), css::uno::Any(the_value), &l); \ + varName.aCharLocaleAsian = the_value; \ + } \ + } \ + l.notify(); \ +}\ +float SAL_CALL clazz::getCharHeightComplex()\ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aComplexFontDescriptor.Height; \ +}\ +void SAL_CALL clazz::setCharHeightComplex( float the_value )\ +{ \ + set(PROPERTY_CHARHEIGHTCOMPLEX,static_cast(the_value),varName.aComplexFontDescriptor.Height); \ +}\ +float SAL_CALL clazz::getCharWeightComplex()\ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aComplexFontDescriptor.Weight; \ +}\ +void SAL_CALL clazz::setCharWeightComplex( float the_value )\ +{ \ + set(PROPERTY_CHARWEIGHTCOMPLEX,the_value,varName.aComplexFontDescriptor.Weight); \ +}\ +OUString SAL_CALL clazz::getCharFontNameComplex()\ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aComplexFontDescriptor.Name; \ +}\ +void SAL_CALL clazz::setCharFontNameComplex( const OUString& the_value )\ +{ \ + set(PROPERTY_CHARFONTNAMECOMPLEX,the_value,varName.aComplexFontDescriptor.Name); \ +}\ +OUString SAL_CALL clazz::getCharFontStyleNameComplex()\ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aComplexFontDescriptor.StyleName; \ +}\ +void SAL_CALL clazz::setCharFontStyleNameComplex( const OUString& the_value )\ +{ \ + set(PROPERTY_CHARFONTSTYLENAMECOMPLEX,the_value,varName.aComplexFontDescriptor.StyleName); \ +}\ +::sal_Int16 SAL_CALL clazz::getCharFontFamilyComplex()\ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aComplexFontDescriptor.Family; \ +}\ +void SAL_CALL clazz::setCharFontFamilyComplex( ::sal_Int16 the_value )\ +{ \ + set(PROPERTY_CHARFONTFAMILYCOMPLEX,the_value,varName.aComplexFontDescriptor.Family); \ +}\ +::sal_Int16 SAL_CALL clazz::getCharFontCharSetComplex()\ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aComplexFontDescriptor.CharSet; \ +}\ +void SAL_CALL clazz::setCharFontCharSetComplex( ::sal_Int16 the_value )\ +{ \ + set(PROPERTY_CHARFONTCHARSETCOMPLEX,the_value,varName.aComplexFontDescriptor.CharSet); \ +}\ +::sal_Int16 SAL_CALL clazz::getCharFontPitchComplex()\ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aComplexFontDescriptor.Pitch; \ +}\ +void SAL_CALL clazz::setCharFontPitchComplex( ::sal_Int16 the_value )\ +{ \ + set(PROPERTY_CHARFONTPITCHCOMPLEX,the_value,varName.aComplexFontDescriptor.Pitch); \ +}\ +css::awt::FontSlant SAL_CALL clazz::getCharPostureComplex()\ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aComplexFontDescriptor.Slant; \ +}\ +void SAL_CALL clazz::setCharPostureComplex( css::awt::FontSlant the_value )\ +{ \ + set(PROPERTY_CHARPOSTURECOMPLEX,the_value,varName.aComplexFontDescriptor.Slant); \ +}\ +css::lang::Locale SAL_CALL clazz::getCharLocaleComplex()\ +{ \ + ::osl::MutexGuard aGuard(m_aMutex); \ + return varName.aCharLocaleComplex; \ +}\ +void SAL_CALL clazz::setCharLocaleComplex( const css::lang::Locale& the_value )\ +{ \ + BoundListeners l; \ + { \ + ::osl::MutexGuard aGuard(m_aMutex); \ + if ( varName.aCharLocaleComplex.Language != the_value.Language \ + || varName.aCharLocaleComplex.Country != the_value.Country \ + || varName.aCharLocaleComplex.Variant != the_value.Variant ) \ + { \ + prepareSet(PROPERTY_CHARLOCALECOMPLEX, css::uno::Any(varName.aCharLocaleComplex), css::uno::Any(the_value), &l); \ + varName.aCharLocaleComplex = the_value; \ + } \ + } \ + l.notify(); \ +}\ + + +#define NO_REPORTCONTROLFORMAT_IMPL(clazz) \ +sal_Int16 SAL_CALL clazz::getParaAdjust()\ +{\ + throw beans::UnknownPropertyException();\ +}\ +void SAL_CALL clazz::setParaAdjust(sal_Int16 /*the_value*/)\ +{\ + throw beans::UnknownPropertyException();\ +}\ +::sal_Int16 SAL_CALL clazz::getCharStrikeout()\ +{\ + throw beans::UnknownPropertyException();\ +}\ +void SAL_CALL clazz::setCharStrikeout(::sal_Int16 /*the_value*/)\ +{\ + throw beans::UnknownPropertyException();\ +}\ +sal_Bool SAL_CALL clazz::getCharWordMode()\ +{\ + throw beans::UnknownPropertyException();\ +}\ +void SAL_CALL clazz::setCharWordMode(sal_Bool /*the_value*/)\ +{\ + throw beans::UnknownPropertyException();\ +}\ +::sal_Int16 SAL_CALL clazz::getCharRotation()\ +{\ + throw beans::UnknownPropertyException();\ +}\ +void SAL_CALL clazz::setCharRotation(::sal_Int16 /*the_value*/)\ +{\ + throw beans::UnknownPropertyException();\ +}\ +::sal_Int16 SAL_CALL clazz::getCharScaleWidth()\ +{\ + throw beans::UnknownPropertyException();\ +}\ +void SAL_CALL clazz::setCharScaleWidth(::sal_Int16 /*the_value*/)\ +{\ + throw beans::UnknownPropertyException();\ +}\ +sal_Bool SAL_CALL clazz::getCharFlash()\ +{ \ + throw beans::UnknownPropertyException();\ +} \ +void SAL_CALL clazz::setCharFlash(sal_Bool /*the_value*/)\ +{ \ + throw beans::UnknownPropertyException();\ +}\ +sal_Bool SAL_CALL clazz::getCharAutoKerning()\ +{ \ + throw beans::UnknownPropertyException();\ +} \ +void SAL_CALL clazz::setCharAutoKerning(sal_Bool /*the_value*/)\ +{ \ + throw beans::UnknownPropertyException();\ +}\ +::sal_Int8 SAL_CALL clazz::getCharEscapementHeight() \ +{ \ + throw beans::UnknownPropertyException();\ +} \ +void SAL_CALL clazz::setCharEscapementHeight(::sal_Int8 /*the_value*/) \ +{ \ + throw beans::UnknownPropertyException();\ +}\ +lang::Locale SAL_CALL clazz::getCharLocale() \ +{ \ + throw beans::UnknownPropertyException();\ +} \ +void SAL_CALL clazz::setCharLocale(const lang::Locale & /*the_value*/) \ +{ \ + throw beans::UnknownPropertyException();\ +}\ +::sal_Int16 SAL_CALL clazz::getCharEscapement() \ +{ \ + throw beans::UnknownPropertyException();\ +} \ +void SAL_CALL clazz::setCharEscapement(::sal_Int16 /*the_value*/) \ +{ \ + throw beans::UnknownPropertyException();\ +}\ +::sal_Int16 SAL_CALL clazz::getCharCaseMap() \ +{ \ + throw beans::UnknownPropertyException();\ +} \ +void SAL_CALL clazz::setCharCaseMap(::sal_Int16 /*the_value*/) \ +{ \ + throw beans::UnknownPropertyException();\ +}\ +sal_Bool SAL_CALL clazz::getCharCombineIsOn() \ +{ \ + throw beans::UnknownPropertyException();\ +} \ +void SAL_CALL clazz::setCharCombineIsOn(sal_Bool /*the_value*/) \ +{ \ + throw beans::UnknownPropertyException();\ +}\ +OUString SAL_CALL clazz::getCharCombinePrefix() \ +{ \ + throw beans::UnknownPropertyException();\ +} \ +void SAL_CALL clazz::setCharCombinePrefix(const OUString & /*the_value*/) \ +{ \ + throw beans::UnknownPropertyException();\ +}\ +OUString SAL_CALL clazz::getCharCombineSuffix() \ +{ \ + throw beans::UnknownPropertyException();\ +} \ +void SAL_CALL clazz::setCharCombineSuffix(const OUString & /*the_value*/) \ +{ \ + throw beans::UnknownPropertyException();\ +}\ +sal_Bool SAL_CALL clazz::getCharHidden() \ +{ \ + throw beans::UnknownPropertyException();\ +} \ +void SAL_CALL clazz::setCharHidden(sal_Bool /*the_value*/) \ +{ \ + throw beans::UnknownPropertyException();\ +}\ +sal_Bool SAL_CALL clazz::getCharShadowed() \ +{ \ + throw beans::UnknownPropertyException();\ +} \ +void SAL_CALL clazz::setCharShadowed(sal_Bool /*the_value*/) \ +{ \ + throw beans::UnknownPropertyException();\ +}\ +sal_Bool SAL_CALL clazz::getCharContoured() \ +{ \ + throw beans::UnknownPropertyException();\ +} \ +void SAL_CALL clazz::setCharContoured(sal_Bool /*the_value*/) \ +{ \ + throw beans::UnknownPropertyException();\ +}\ +OUString SAL_CALL clazz::getVisitedCharStyleName() \ +{ \ + throw beans::UnknownPropertyException();\ +} \ +void SAL_CALL clazz::setVisitedCharStyleName(const OUString & /*the_value*/) \ +{ \ + throw beans::UnknownPropertyException();\ +}\ +OUString SAL_CALL clazz::getUnvisitedCharStyleName() \ +{ \ + throw beans::UnknownPropertyException();\ +} \ +void SAL_CALL clazz::setUnvisitedCharStyleName(const OUString & /*the_value*/) \ +{ \ + throw beans::UnknownPropertyException();\ +}\ +::sal_Int16 SAL_CALL clazz::getCharKerning()\ +{ \ + throw beans::UnknownPropertyException();\ +}\ +void SAL_CALL clazz::setCharKerning(::sal_Int16 /*the_value*/)\ +{ \ + throw beans::UnknownPropertyException();\ +}\ +\ +awt::FontDescriptor SAL_CALL clazz::getFontDescriptor()\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +void SAL_CALL clazz::setFontDescriptor( const awt::FontDescriptor& /*_fontdescriptor*/ )\ +{\ + throw beans::UnknownPropertyException();\ +}\ +awt::FontDescriptor SAL_CALL clazz::getFontDescriptorAsian()\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +void SAL_CALL clazz::setFontDescriptorAsian( const awt::FontDescriptor& /*_fontdescriptor*/ )\ +{\ + throw beans::UnknownPropertyException();\ +}\ +awt::FontDescriptor SAL_CALL clazz::getFontDescriptorComplex()\ +{\ +throw beans::UnknownPropertyException();\ +}\ +\ +void SAL_CALL clazz::setFontDescriptorComplex( const awt::FontDescriptor& /*_fontdescriptor*/ )\ +{\ +throw beans::UnknownPropertyException();\ +}\ +\ +::sal_Int16 SAL_CALL clazz::getControlTextEmphasis()\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +void SAL_CALL clazz::setControlTextEmphasis( ::sal_Int16 /*_fontemphasismark*/ )\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +::sal_Int16 SAL_CALL clazz::getCharRelief()\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +void SAL_CALL clazz::setCharRelief( ::sal_Int16 /*_fontrelief*/ )\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +::sal_Int32 SAL_CALL clazz::getCharColor()\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +void SAL_CALL clazz::setCharColor( ::sal_Int32 /*_textcolor*/ )\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +::sal_Int32 SAL_CALL clazz::getCharUnderlineColor()\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +void SAL_CALL clazz::setCharUnderlineColor( ::sal_Int32 /*_textlinecolor*/ )\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +style::VerticalAlignment SAL_CALL clazz::getVerticalAlign()\ +{\ + ::osl::MutexGuard aGuard(m_aMutex);\ + return m_aProps.aFormatProperties.aVerticalAlignment;\ +}\ +\ +void SAL_CALL clazz::setVerticalAlign( style::VerticalAlignment _verticalalign )\ +{\ + set(PROPERTY_VERTICALALIGN,_verticalalign,m_aProps.aFormatProperties.aVerticalAlignment);\ +}\ +\ +::sal_Int16 SAL_CALL clazz::getCharEmphasis()\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +void SAL_CALL clazz::setCharEmphasis( ::sal_Int16 /*_charemphasis*/ )\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +OUString SAL_CALL clazz::getCharFontName()\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +void SAL_CALL clazz::setCharFontName( const OUString& /*_charfontname*/ )\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +OUString SAL_CALL clazz::getCharFontStyleName()\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +void SAL_CALL clazz::setCharFontStyleName( const OUString& /*_charfontstylename*/ )\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +::sal_Int16 SAL_CALL clazz::getCharFontFamily()\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +void SAL_CALL clazz::setCharFontFamily( ::sal_Int16 /*_charfontfamily*/ )\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +::sal_Int16 SAL_CALL clazz::getCharFontCharSet()\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +void SAL_CALL clazz::setCharFontCharSet( ::sal_Int16 /*_charfontcharset*/ )\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +::sal_Int16 SAL_CALL clazz::getCharFontPitch()\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +void SAL_CALL clazz::setCharFontPitch( ::sal_Int16 /*_charfontpitch*/ )\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +float SAL_CALL clazz::getCharHeight()\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +void SAL_CALL clazz::setCharHeight( float /*_charheight*/ )\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +::sal_Int16 SAL_CALL clazz::getCharUnderline()\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +void SAL_CALL clazz::setCharUnderline( ::sal_Int16 /*_charunderline*/ )\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +float SAL_CALL clazz::getCharWeight()\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +void SAL_CALL clazz::setCharWeight( float /*_charweight*/ )\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +awt::FontSlant SAL_CALL clazz::getCharPosture()\ +{\ + throw beans::UnknownPropertyException();\ +}\ +\ +void SAL_CALL clazz::setCharPosture( awt::FontSlant /*_charposture*/ )\ +{\ + throw beans::UnknownPropertyException();\ +}\ + float SAL_CALL clazz::getCharHeightAsian()\ + {\ + throw beans::UnknownPropertyException();\ +}\ + void SAL_CALL clazz::setCharHeightAsian( float )\ + {\ + throw beans::UnknownPropertyException();\ +}\ + float SAL_CALL clazz::getCharWeightAsian()\ + {\ + throw beans::UnknownPropertyException();\ +}\ + void SAL_CALL clazz::setCharWeightAsian( float )\ + {\ + throw beans::UnknownPropertyException();\ +}\ + OUString SAL_CALL clazz::getCharFontNameAsian()\ + {\ + throw beans::UnknownPropertyException();\ +}\ + void SAL_CALL clazz::setCharFontNameAsian( const OUString& )\ + {\ + throw beans::UnknownPropertyException();\ +}\ + OUString SAL_CALL clazz::getCharFontStyleNameAsian()\ + {\ + throw beans::UnknownPropertyException();\ +}\ + void SAL_CALL clazz::setCharFontStyleNameAsian( const OUString& )\ + {\ + throw beans::UnknownPropertyException();\ +}\ + ::sal_Int16 SAL_CALL clazz::getCharFontFamilyAsian()\ + {\ + throw beans::UnknownPropertyException();\ +}\ + void SAL_CALL clazz::setCharFontFamilyAsian( ::sal_Int16 )\ + {\ + throw beans::UnknownPropertyException();\ +}\ + ::sal_Int16 SAL_CALL clazz::getCharFontCharSetAsian()\ + {\ + throw beans::UnknownPropertyException();\ +}\ + void SAL_CALL clazz::setCharFontCharSetAsian( ::sal_Int16 )\ + {\ + throw beans::UnknownPropertyException();\ +}\ + ::sal_Int16 SAL_CALL clazz::getCharFontPitchAsian()\ + {\ + throw beans::UnknownPropertyException();\ +}\ + void SAL_CALL clazz::setCharFontPitchAsian( ::sal_Int16 )\ + {\ + throw beans::UnknownPropertyException();\ +}\ + css::awt::FontSlant SAL_CALL clazz::getCharPostureAsian()\ + {\ + throw beans::UnknownPropertyException();\ +}\ + void SAL_CALL clazz::setCharPostureAsian( css::awt::FontSlant )\ + {\ + throw beans::UnknownPropertyException();\ +}\ + css::lang::Locale SAL_CALL clazz::getCharLocaleAsian()\ + {\ + throw beans::UnknownPropertyException();\ +}\ + void SAL_CALL clazz::setCharLocaleAsian( const css::lang::Locale& )\ + {\ + throw beans::UnknownPropertyException();\ +}\ + float SAL_CALL clazz::getCharHeightComplex()\ + {\ + throw beans::UnknownPropertyException();\ +}\ + void SAL_CALL clazz::setCharHeightComplex( float )\ + {\ + throw beans::UnknownPropertyException();\ +}\ + float SAL_CALL clazz::getCharWeightComplex()\ + {\ + throw beans::UnknownPropertyException();\ +}\ + void SAL_CALL clazz::setCharWeightComplex( float )\ + {\ + throw beans::UnknownPropertyException();\ +}\ + OUString SAL_CALL clazz::getCharFontNameComplex()\ + {\ + throw beans::UnknownPropertyException();\ +}\ + void SAL_CALL clazz::setCharFontNameComplex( const OUString& )\ + {\ + throw beans::UnknownPropertyException();\ +}\ + OUString SAL_CALL clazz::getCharFontStyleNameComplex()\ + {\ + throw beans::UnknownPropertyException();\ +}\ + void SAL_CALL clazz::setCharFontStyleNameComplex( const OUString& )\ + {\ + throw beans::UnknownPropertyException();\ +}\ + ::sal_Int16 SAL_CALL clazz::getCharFontFamilyComplex()\ + {\ + throw beans::UnknownPropertyException();\ +}\ + void SAL_CALL clazz::setCharFontFamilyComplex( ::sal_Int16 )\ + {\ + throw beans::UnknownPropertyException();\ +}\ + ::sal_Int16 SAL_CALL clazz::getCharFontCharSetComplex()\ + {\ + throw beans::UnknownPropertyException();\ +}\ + void SAL_CALL clazz::setCharFontCharSetComplex( ::sal_Int16 )\ + {\ + throw beans::UnknownPropertyException();\ +}\ + ::sal_Int16 SAL_CALL clazz::getCharFontPitchComplex()\ + {\ + throw beans::UnknownPropertyException();\ +}\ + void SAL_CALL clazz::setCharFontPitchComplex( ::sal_Int16 )\ + {\ + throw beans::UnknownPropertyException();\ +}\ + css::awt::FontSlant SAL_CALL clazz::getCharPostureComplex()\ + {\ + throw beans::UnknownPropertyException();\ +}\ + void SAL_CALL clazz::setCharPostureComplex( css::awt::FontSlant )\ + {\ + throw beans::UnknownPropertyException();\ +}\ + css::lang::Locale SAL_CALL clazz::getCharLocaleComplex()\ + {\ + throw beans::UnknownPropertyException();\ +}\ + void SAL_CALL clazz::setCharLocaleComplex( const css::lang::Locale& )\ + {\ + throw beans::UnknownPropertyException();\ +} + + +// css::report::XReportControlFormat: +#define REPORTCONTROLFORMAT_IMPL(clazz,varName) \ + REPORTCONTROLFORMAT_IMPL1(clazz,varName) \ + REPORTCONTROLFORMAT_IMPL2(clazz,varName) + + +#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_REPORTHELPERIMPL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/inc/ReportUndoFactory.hxx b/reportdesign/source/core/inc/ReportUndoFactory.hxx new file mode 100644 index 000000000..c5721c0bc --- /dev/null +++ b/reportdesign/source/core/inc/ReportUndoFactory.hxx @@ -0,0 +1,74 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_REPORTUNDOFACTORY_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_REPORTUNDOFACTORY_HXX + +#include +#include + +namespace rptui +{ + class OReportUndoFactory : public SdrUndoFactory + { + ::std::unique_ptr m_pUndoFactory; + + OReportUndoFactory(const OReportUndoFactory&) = delete; + OReportUndoFactory& operator=(const OReportUndoFactory&) = delete; + public: + OReportUndoFactory(); + virtual ~OReportUndoFactory() override; + + // shapes + virtual std::unique_ptr CreateUndoMoveObject( SdrObject& rObject, const Size& rDist ) override; + virtual std::unique_ptr CreateUndoGeoObject( SdrObject& rObject ) override; + virtual std::unique_ptr CreateUndoAttrObject( SdrObject& rObject, bool bStyleSheet1 = false, bool bSaveText = false ) override; + virtual std::unique_ptr CreateUndoRemoveObject(SdrObject& rObject) override; + virtual std::unique_ptr CreateUndoInsertObject( SdrObject& rObject, bool bOrdNumDirect = false) override; + virtual std::unique_ptr CreateUndoDeleteObject( SdrObject& rObject, bool bOrdNumDirect = false) override; + virtual std::unique_ptr CreateUndoNewObject( SdrObject& rObject, bool bOrdNumDirect = false) override; + virtual std::unique_ptr CreateUndoCopyObject( SdrObject& rObject, bool bOrdNumDirect = false) override; + + virtual std::unique_ptr CreateUndoObjectOrdNum( SdrObject& rObject, sal_uInt32 nOldOrdNum1, sal_uInt32 nNewOrdNum1) override; + + virtual std::unique_ptr CreateUndoReplaceObject( SdrObject& rOldObject, SdrObject& rNewObject ) override; + virtual std::unique_ptr CreateUndoObjectLayerChange( SdrObject& rObject, SdrLayerID aOldLayer, SdrLayerID aNewLayer ) override; + virtual std::unique_ptr CreateUndoObjectSetText( SdrObject& rNewObj, sal_Int32 nText ) override; + + // layer + virtual std::unique_ptr CreateUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel) override; + virtual std::unique_ptr CreateUndoDeleteLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel) override; + + // page + virtual std::unique_ptr CreateUndoDeletePage(SdrPage& rPage) override; + virtual std::unique_ptr CreateUndoNewPage(SdrPage& rPage) override; + virtual std::unique_ptr CreateUndoCopyPage(SdrPage& rPage) override; + virtual std::unique_ptr CreateUndoSetPageNum(SdrPage& rNewPg, sal_uInt16 nOldPageNum1, sal_uInt16 nNewPageNum1) override; + + // master page + virtual std::unique_ptr CreateUndoPageRemoveMasterPage(SdrPage& rChangedPage) override; + virtual std::unique_ptr CreateUndoPageChangeMasterPage(SdrPage& rChangedPage) override; + + }; + +} // rptui + + +#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_REPORTUNDOFACTORY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/inc/RptObjectListener.hxx b/reportdesign/source/core/inc/RptObjectListener.hxx new file mode 100644 index 000000000..d27a4bf33 --- /dev/null +++ b/reportdesign/source/core/inc/RptObjectListener.hxx @@ -0,0 +1,50 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_RPTOBJECTLISTENER_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_RPTOBJECTLISTENER_HXX + +#include +#include + +namespace rptui +{ +class OObjectBase; + +class OObjectListener: public ::cppu::WeakImplHelper< css::beans::XPropertyChangeListener > +{ +private: + OObjectBase* m_pObject; + OObjectListener(const OObjectListener&) = delete; + void operator =(const OObjectListener&) = delete; +protected: + virtual ~OObjectListener() override; +public: + OObjectListener(OObjectBase* _pObject); + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + // XPropertyChangeListener + virtual void SAL_CALL propertyChange( const css::beans::PropertyChangeEvent& evt ) override; +}; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_RPTOBJECTLISTENER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/inc/Section.hxx b/reportdesign/source/core/inc/Section.hxx new file mode 100644 index 000000000..5417af2a9 --- /dev/null +++ b/reportdesign/source/core/inc/Section.hxx @@ -0,0 +1,232 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_SECTION_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_SECTION_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace reportdesign +{ + typedef ::cppu::WeakComponentImplHelper + < css::report::XSection + , css::lang::XServiceInfo + , css::lang::XUnoTunnel + // SvxDrawPage forward + , css::drawing::XDrawPage + , css::drawing::XShapeGrouper + // SvxFmDrawPage forward + , css::form::XFormsSupplier2 + > SectionBase; + typedef ::cppu::PropertySetMixin SectionPropertySet; + + class OSection : public comphelper::OMutexAndBroadcastHelper, + public SectionBase, + public SectionPropertySet + { + ::comphelper::OInterfaceContainerHelper3 m_aContainerListeners; + css::uno::Reference< css::drawing::XDrawPage > m_xDrawPage; + css::uno::Reference< css::drawing::XShapeGrouper > m_xDrawPage_ShapeGrouper; + css::uno::Reference< css::form::XFormsSupplier2 > m_xDrawPage_FormSupplier; + css::uno::Reference< css::lang::XUnoTunnel > m_xDrawPage_Tunnel; + css::uno::WeakReference< css::report::XGroup > m_xGroup; + css::uno::WeakReference< css::report::XReportDefinition > m_xReportDefinition; + OUString m_sName; + OUString m_sConditionalPrintExpression; + ::sal_uInt32 m_nHeight; + ::sal_Int32 m_nBackgroundColor; + ::sal_Int16 m_nForceNewPage; + ::sal_Int16 m_nNewRowOrCol; + bool m_bKeepTogether; + bool m_bRepeatSection; + bool m_bVisible; + bool m_bBacktransparent; + bool m_bInRemoveNotify; + bool m_bInInsertNotify; + + private: + OSection(const OSection&) = delete; + OSection& operator=(const OSection&) = delete; + + template void set( const OUString& _sProperty + ,const T& Value + ,T& _member) + { + BoundListeners l; + { + ::osl::MutexGuard aGuard(m_aMutex); + if ( _member != Value ) + { + prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l); + _member = Value; + } + } + l.notify(); + } + void set( const OUString& _sProperty + ,bool Value + ,bool& _member) + { + BoundListeners l; + { + ::osl::MutexGuard aGuard(m_aMutex); + if ( _member != Value ) + { + prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l); + _member = Value; + } + } + l.notify(); + } + + /** checks if this section is either the page header or footer and if so it throws an UnknownPropertyException + * + */ + void checkNotPageHeaderFooter(); + + void init(); + protected: + // TODO: VirtualFunctionFinder: This is virtual function! + + virtual ~OSection() override; + + /** this function is called upon disposing the component + */ + // TODO: VirtualFunctionFinder: This is virtual function! + + virtual void SAL_CALL disposing() override; + private: + OSection(const css::uno::Reference< css::report::XReportDefinition >& xParentDef + ,const css::uno::Reference< css::report::XGroup >& xParentGroup + ,const css::uno::Reference< css::uno::XComponentContext >& context, + css::uno::Sequence< OUString> const&); + public: + static css::uno::Reference< css::report::XSection> + createOSection(const css::uno::Reference< css::report::XReportDefinition >& _xParent + ,const css::uno::Reference< css::uno::XComponentContext >& context,bool _bPageSection=false); + static css::uno::Reference< css::report::XSection> + createOSection(const css::uno::Reference< css::report::XGroup >& _xParent + ,const css::uno::Reference< css::uno::XComponentContext >& context); + + DECLARE_XINTERFACE( ) + + // css::lang::XServiceInfo + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual OUString SAL_CALL getImplementationName( ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + /// @throws css::uno::RuntimeException + static css::uno::Sequence< OUString > getSupportedServiceNames_Static(); + // css::beans::XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + // XSection + virtual sal_Bool SAL_CALL getVisible() override; + virtual void SAL_CALL setVisible( sal_Bool _visible ) override; + virtual OUString SAL_CALL getName() override; + virtual void SAL_CALL setName( const OUString& _name ) override; + virtual ::sal_uInt32 SAL_CALL getHeight() override; + virtual void SAL_CALL setHeight( ::sal_uInt32 _height ) override; + virtual ::sal_Int32 SAL_CALL getBackColor() override; + virtual void SAL_CALL setBackColor( ::sal_Int32 _backgroundcolor ) override; + virtual sal_Bool SAL_CALL getBackTransparent() override; + virtual void SAL_CALL setBackTransparent( sal_Bool _backtransparent ) override; + virtual OUString SAL_CALL getConditionalPrintExpression() override; + virtual void SAL_CALL setConditionalPrintExpression( const OUString& _conditionalprintexpression ) override; + virtual ::sal_Int16 SAL_CALL getForceNewPage() override; + virtual void SAL_CALL setForceNewPage( ::sal_Int16 _forcenewpage ) override; + virtual ::sal_Int16 SAL_CALL getNewRowOrCol() override; + virtual void SAL_CALL setNewRowOrCol( ::sal_Int16 _newroworcol ) override; + virtual sal_Bool SAL_CALL getKeepTogether() override; + virtual void SAL_CALL setKeepTogether( sal_Bool _keeptogether ) override; + virtual sal_Bool SAL_CALL getCanGrow() override; + virtual void SAL_CALL setCanGrow( sal_Bool _cangrow ) override; + virtual sal_Bool SAL_CALL getCanShrink() override; + virtual void SAL_CALL setCanShrink( sal_Bool _canshrink ) override; + virtual sal_Bool SAL_CALL getRepeatSection() override; + virtual void SAL_CALL setRepeatSection( sal_Bool _repeatsection ) override; + virtual css::uno::Reference< css::report::XGroup > SAL_CALL getGroup() override; + virtual css::uno::Reference< css::report::XReportDefinition > SAL_CALL getReportDefinition() override; + + // XChild + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override; + virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override; + // XContainer + virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + // XShapes + virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override; + virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override; + // XShapeGrouper + virtual css::uno::Reference< css::drawing::XShapeGroup > SAL_CALL group( const css::uno::Reference< css::drawing::XShapes >& xShapes ) override; + virtual void SAL_CALL ungroup( const css::uno::Reference< css::drawing::XShapeGroup >& aGroup ) override; + + // XFormsSupplier + virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL getForms() override; + // XFormsSupplier2 + virtual sal_Bool SAL_CALL hasForms() override; + + // XIndexAccess + virtual ::sal_Int32 SAL_CALL getCount( ) override; + virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override; + // XEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration( ) override; + + // XComponent + virtual void SAL_CALL dispose() override; + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::addEventListener(aListener); + } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::removeEventListener(aListener); + } + + // css::lang::XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId(); + + void notifyElementAdded(const css::uno::Reference< css::drawing::XShape >& xShape); + void notifyElementRemoved(const css::uno::Reference< css::drawing::XShape >& xShape); + }; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_SECTION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/inc/Shape.hxx b/reportdesign/source/core/inc/Shape.hxx new file mode 100644 index 000000000..73f6c63f6 --- /dev/null +++ b/reportdesign/source/core/inc/Shape.hxx @@ -0,0 +1,209 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_SHAPE_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_SHAPE_HXX + +#include +#include +#include "ReportControlModel.hxx" +#include +#include +#include +#include +#include +#include + +namespace reportdesign +{ + typedef ::cppu::PropertySetMixin< css::report::XShape > ShapePropertySet; + typedef ::cppu::WeakComponentImplHelper< css::report::XShape + ,css::lang::XServiceInfo > ShapeBase; + + /** \class OShape Defines the implementation of a \interface com:::sun::star::report::XShape + * \ingroup reportdesign_api + * + */ + class OShape : public cppu::BaseMutex, + public ShapeBase, + public ShapePropertySet + { + friend class OShapeHelper; + ::std::unique_ptr< ::comphelper::OPropertyArrayAggregationHelper> m_pAggHelper; + OReportControlModel m_aProps; + css::drawing::HomogenMatrix3 m_Transformation; + sal_Int32 m_nZOrder; + bool m_bOpaque; + + OUString m_sServiceName; + OUString m_CustomShapeEngine; + OUString m_CustomShapeData; + css::uno::Sequence< css::beans::PropertyValue > m_CustomShapeGeometry; + + private: + OShape(const OShape&) = delete; + OShape& operator=(const OShape&) = delete; + + // internally, we store PROPERTY_PARAADJUST as css::style::ParagraphAdjust, but externally the property is visible as a sal_Int16 + void set( const OUString& _sProperty + ,sal_Int16 Value + ,css::style::ParagraphAdjust& _member) + { + BoundListeners l; + { + ::osl::MutexGuard aGuard(m_aMutex); + if ( static_cast(_member) != Value ) + { + prepareSet(_sProperty, css::uno::Any(static_cast(_member)), css::uno::Any(Value), &l); + _member = static_cast(Value); + } + } + l.notify(); + } + template void set( const OUString& _sProperty + ,const T& Value + ,T& _member) + { + BoundListeners l; + { + ::osl::MutexGuard aGuard(m_aMutex); + if ( _member != Value ) + { + prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l); + _member = Value; + } + } + l.notify(); + } + void set( const OUString& _sProperty + ,bool Value + ,bool& _member) + { + BoundListeners l; + { + ::osl::MutexGuard aGuard(m_aMutex); + if ( _member != Value ) + { + prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l); + _member = Value; + } + } + l.notify(); + } + cppu::IPropertyArrayHelper& getInfoHelper(); + protected: + virtual ~OShape() override; + public: + explicit OShape(css::uno::Reference< css::uno::XComponentContext > const & _xContext); + explicit OShape(css::uno::Reference< css::uno::XComponentContext > const & _xContext + ,const css::uno::Reference< css::lang::XMultiServiceFactory > & _xFactory + ,css::uno::Reference< css::drawing::XShape >& _xShape + ,const OUString& _sServiceName); + + DECLARE_XINTERFACE( ) + // css::lang::XServiceInfo + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual OUString SAL_CALL getImplementationName( ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + /// @throws css::uno::RuntimeException + static css::uno::Sequence< OUString > getSupportedServiceNames_Static(); + /// @throws css::uno::RuntimeException + static OUString getImplementationName_Static(); + static css::uno::Reference< css::uno::XInterface > + create(css::uno::Reference< css::uno::XComponentContext > const & xContext); + // css::beans::XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + // XReportComponent + REPORTCOMPONENT_HEADER() + + // XShape + SHAPE_HEADER() + + virtual OUString SAL_CALL getCustomShapeEngine() override; + virtual void SAL_CALL setCustomShapeEngine( const OUString& _customshapeengine ) override; + virtual OUString SAL_CALL getCustomShapeData() override; + virtual void SAL_CALL setCustomShapeData( const OUString& _customshapedata ) override; + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCustomShapeGeometry() override; + virtual void SAL_CALL setCustomShapeGeometry( const css::uno::Sequence< css::beans::PropertyValue >& _customshapegeometry ) override; + + virtual sal_Bool SAL_CALL getOpaque() override; + virtual void SAL_CALL setOpaque( sal_Bool _opaque ) override; + + // XShapeDescriptor + virtual OUString SAL_CALL getShapeType( ) override; + + // XReportControlModel + REPORTCONTROLMODEL_HEADER() + + // XReportControlFormat + REPORTCONTROLFORMAT_HEADER() + // XShape + virtual ::sal_Int32 SAL_CALL getZOrder() override; + virtual void SAL_CALL setZOrder( ::sal_Int32 _zorder ) override; + virtual css::drawing::HomogenMatrix3 SAL_CALL getTransformation() override; + virtual void SAL_CALL setTransformation( const css::drawing::HomogenMatrix3& _transformation ) override; + + // XCloneable + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override; + + // XComponent + virtual void SAL_CALL dispose() override; + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::addEventListener(aListener); + } + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override + { + cppu::WeakComponentImplHelperBase::removeEventListener(aListener); + } + + // XChild + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override; + virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override; + + // XContainer + virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + // XIndexReplace + virtual void SAL_CALL replaceByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override; + + // XIndexContainer + virtual void SAL_CALL insertByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override; + virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) override; + + // XIndexAccess + virtual ::sal_Int32 SAL_CALL getCount( ) override; + virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override; + }; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_SHAPE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/inc/Tools.hxx b/reportdesign/source/core/inc/Tools.hxx new file mode 100644 index 000000000..3e0a699ce --- /dev/null +++ b/reportdesign/source/core/inc/Tools.hxx @@ -0,0 +1,155 @@ +/* -*- 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 . + */ +#ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_TOOLS_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_TOOLS_HXX + +#include +#include +#include +#include +#include + + +#include +#include +#include + +namespace reportdesign +{ + /** uses the XChild interface to get the section from any child of it. + * + * \param _xReportComponent A report component which is a child of the section. + * \return The section where this report component resists in. + */ + css::uno::Reference< css::report::XSection> lcl_getSection(const css::uno::Reference< css::uno::XInterface>& _xReportComponent); + + /** throws an illegal argument exception. The message text is the resource RID_STR_ERROR_WRONG_ARGUMENT + the type as reference. + * + * \param _sTypeName The reference where to look for the correct values. + * \param ExceptionContext_ The exception context. + * \param ArgumentPosition_ The argument position. + */ + void throwIllegallArgumentException(std::u16string_view _sTypeName + ,const css::uno::Reference< css::uno::XInterface >& ExceptionContext_ + ,sal_Int16 ArgumentPosition_); + + /** clones the given object + * + * \param _xReportComponent the object to be cloned + * \param _xFactory the factory to create the clone + * \param _sServiceName the service of the to be cloned object + * \return the clone + */ + css::uno::Reference< css::util::XCloneable > cloneObject( + const css::uno::Reference< css::report::XReportComponent>& _xReportComponent + ,const css::uno::Reference< css::lang::XMultiServiceFactory>& _xFactory + ,const OUString& _sServiceName); + + class OShapeHelper + { + public: + template static void setSize(const css::awt::Size& aSize,T* _pShape) + { + OSL_ENSURE(aSize.Width >= 0 && aSize.Height >= 0,"Illegal width or height!"); + + ::osl::MutexGuard aGuard(_pShape->m_aMutex); + if ( _pShape->m_aProps.aComponent.m_xShape.is() ) + { + css::awt::Size aOldSize = _pShape->m_aProps.aComponent.m_xShape->getSize(); + if ( aOldSize.Height != aSize.Height || aOldSize.Width != aSize.Width ) + { + _pShape->m_aProps.aComponent.m_nWidth = aOldSize.Width; + _pShape->m_aProps.aComponent.m_nHeight = aOldSize.Height; + _pShape->m_aProps.aComponent.m_xShape->setSize(aSize); + } + } + _pShape->set(PROPERTY_WIDTH,aSize.Width,_pShape->m_aProps.aComponent.m_nWidth); + _pShape->set(PROPERTY_HEIGHT,aSize.Height,_pShape->m_aProps.aComponent.m_nHeight); + } + template static css::awt::Size getSize( T* _pShape ) + { + ::osl::MutexGuard aGuard(_pShape->m_aMutex); + if ( _pShape->m_aProps.aComponent.m_xShape.is() ) + { + css::awt::Size aSize = _pShape->m_aProps.aComponent.m_xShape->getSize(); + OSL_ENSURE(aSize.Width >= 0 && aSize.Height >= 0,"Illegal width or height!"); + return aSize; + } + return css::awt::Size(_pShape->m_aProps.aComponent.m_nWidth,_pShape->m_aProps.aComponent.m_nHeight); + } + + template static void setPosition( const css::awt::Point& _aPosition ,T* _pShape) + { + // we know it is not allowed that the position in smaller 0, but in NbcMove() it will handled right. + // only at 'Undo' it is possible to short set the position smaller 0 + // OSL_ENSURE(_aPosition.X >= 0 && _aPosition.Y >= 0,"set to Illegal position!"); + ::osl::MutexGuard aGuard(_pShape->m_aMutex); + css::awt::Point aOldPos; + aOldPos.X = _pShape->m_aProps.aComponent.m_nPosX; + aOldPos.Y = _pShape->m_aProps.aComponent.m_nPosY; + + css::awt::Point aPosition(_aPosition); + if ( _pShape->m_aProps.aComponent.m_xShape.is() ) + { + aOldPos = _pShape->m_aProps.aComponent.m_xShape->getPosition(); + if ( aOldPos.X != aPosition.X || aOldPos.Y != aPosition.Y ) + { + _pShape->m_aProps.aComponent.m_nPosX = aOldPos.X; + _pShape->m_aProps.aComponent.m_nPosY = aOldPos.Y; + _pShape->m_aProps.aComponent.m_xShape->setPosition(aPosition); + } + } + _pShape->set(PROPERTY_POSITIONX,aPosition.X,aOldPos.X); + _pShape->set(PROPERTY_POSITIONY,aPosition.Y,aOldPos.Y); + } + template static css::awt::Point getPosition(T* _pShape) + { + ::osl::MutexGuard aGuard(_pShape->m_aMutex); + if ( _pShape->m_aProps.aComponent.m_xShape.is() ) + { + css::awt::Point aPosition = _pShape->m_aProps.aComponent.m_xShape->getPosition(); + return aPosition; + } + return css::awt::Point(_pShape->m_aProps.aComponent.m_nPosX,_pShape->m_aProps.aComponent.m_nPosY); + } + template static void setParent( const css::uno::Reference< css::uno::XInterface >& Parent, T* _pShape) + { + ::osl::MutexGuard aGuard(_pShape->m_aMutex); + _pShape->m_aProps.aComponent.m_xParent = css::uno::Reference< css::container::XChild >(Parent,css::uno::UNO_QUERY); + css::uno::Reference< css::container::XChild > xChild; + comphelper::query_aggregation(_pShape->m_aProps.aComponent.m_xProxy,xChild); + if ( xChild.is() ) + xChild->setParent(Parent); + } + template static css::uno::Reference< css::uno::XInterface > getParent( T* _pShape ) + { + ::osl::MutexGuard aGuard(_pShape->m_aMutex); + css::uno::Reference< css::container::XChild > xChild; + comphelper::query_aggregation(_pShape->m_aProps.aComponent.m_xProxy,xChild); + if ( xChild.is() ) + return xChild->getParent(); + return _pShape->m_aProps.aComponent.m_xParent; + } + }; + +} // namespace reportdesign + +#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_TOOLS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/inc/conditionupdater.hxx b/reportdesign/source/core/inc/conditionupdater.hxx new file mode 100644 index 000000000..8102f6766 --- /dev/null +++ b/reportdesign/source/core/inc/conditionupdater.hxx @@ -0,0 +1,62 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_CONDITIONUPDATER_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_CONDITIONUPDATER_HXX + +#include + +#include +#include + + +namespace rptui +{ + + class ConditionUpdater + { + public: + ConditionUpdater(); + ~ConditionUpdater(); + ConditionUpdater(const ConditionUpdater&) = delete; + ConditionUpdater& operator=(const ConditionUpdater&) = delete; + + /// notifies the object about the change of a property value, somewhere in the report definition + void notifyPropertyChange( const css::beans::PropertyChangeEvent& _rEvent ); + + private: + /// does late initializations, return whether or not successful + void impl_lateInit_nothrow(); + + void impl_adjustFormatConditions_nothrow( + const css::uno::Reference< css::report::XReportControlModel >& _rxRptControlModel, + const OUString& _rOldDataSource, + const OUString& _rNewDataSource + ); + + private: + ConditionalExpressions m_aConditionalExpressions; + }; + +} // namespace rptui + + +#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_CONDITIONUPDATER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/misc/conditionalexpression.cxx b/reportdesign/source/core/misc/conditionalexpression.cxx new file mode 100644 index 000000000..0fe6dbb40 --- /dev/null +++ b/reportdesign/source/core/misc/conditionalexpression.cxx @@ -0,0 +1,187 @@ +/* -*- 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 + +#include +#include + + +namespace rptui +{ + + // = ConditionalExpression + + + ConditionalExpression::ConditionalExpression( const char* _pAsciiPattern ) + :m_sPattern( OUString::createFromAscii( _pAsciiPattern ) ) + { + } + + + OUString ConditionalExpression::assembleExpression( const OUString& _rFieldDataSource, const OUString& _rLHS, const OUString& _rRHS ) const + { + OUString sExpression( m_sPattern ); + + sal_Int32 nPatternIndex = sExpression.indexOf( '$' ); + while ( nPatternIndex > -1 ) + { + const OUString* pReplace = nullptr; + switch ( sExpression[ nPatternIndex + 1 ] ) + { + case '$': pReplace = &_rFieldDataSource; break; + case '1': pReplace = &_rLHS; break; + case '2': pReplace = &_rRHS; break; + default: break; + } + + if ( pReplace == nullptr ) + { + OSL_FAIL( "ConditionalExpression::assembleExpression: illegal pattern!" ); + break; + } + + sExpression = sExpression.replaceAt( nPatternIndex, 2, *pReplace ); + nPatternIndex = sExpression.indexOf( '$', nPatternIndex + pReplace->getLength() + 1 ); + } + return sExpression; + } + + + bool ConditionalExpression::matchExpression( const OUString& _rExpression, const OUString& _rFieldDataSource, OUString& _out_rLHS, OUString& _out_rRHS ) const + { + // if we had regular expression, the matching would be pretty easy ... + // just replace $1 and $2 in the pattern with (.*), and then get them with \1 resp. \2. + // Unfortunately, we don't have such a regexp engine ... + + // Okay, let's start with replacing all $$ in our pattern with the actual field data source + OUString sMatchExpression( m_sPattern ); + static const OUStringLiteral sFieldDataPattern( u"$$" ); + sal_Int32 nIndex( sMatchExpression.indexOf( sFieldDataPattern ) ); + while ( nIndex != -1 ) + { + sMatchExpression = sMatchExpression.replaceAt( nIndex, sFieldDataPattern.getLength(), _rFieldDataSource ); + nIndex = sMatchExpression.indexOf( sFieldDataPattern, nIndex + _rFieldDataSource.getLength() ); + } + + static const OUStringLiteral sLHSPattern( u"$1" ); + static const OUStringLiteral sRHSPattern( u"$2" ); + sal_Int32 nLHSIndex( sMatchExpression.indexOf( sLHSPattern ) ); + sal_Int32 nRHSIndex( sMatchExpression.indexOf( sRHSPattern ) ); + + // now we should have at most one occurrence of $1 and $2, resp. + OSL_ENSURE( sMatchExpression.indexOf( sLHSPattern, nLHSIndex + 1 ) == -1, + "ConditionalExpression::matchExpression: unsupported pattern (more than one LHS occurrence)!" ); + OSL_ENSURE( sMatchExpression.indexOf( sRHSPattern, nRHSIndex + 1 ) == -1, + "ConditionalExpression::matchExpression: unsupported pattern (more than one RHS occurrence)!" ); + // Also, an LHS must be present, and precede the RHS (if present) + OSL_ENSURE( ( nLHSIndex != -1 ) && ( ( nLHSIndex < nRHSIndex ) || ( nRHSIndex == -1 ) ), + "ConditionalExpression::matchExpression: no LHS, or an RHS preceding the LHS - this is not supported!" ); + + // up to the occurrence of the LHS (which must exist, see above), the two expressions + // must be identical + if ( _rExpression.getLength() < nLHSIndex ) + return false; + const std::u16string_view sExprPart1( _rExpression.subView( 0, nLHSIndex ) ); + const std::u16string_view sMatchExprPart1( sMatchExpression.subView( 0, nLHSIndex ) ); + if ( sExprPart1 != sMatchExprPart1 ) + // the left-most expression parts do not match + return false; + + // after the occurrence of the RHS (or the LHS, if there is no RHS), the two expressions + // must be identical, too + bool bHaveRHS( nRHSIndex != -1 ); + sal_Int32 nRightMostIndex( bHaveRHS ? nRHSIndex : nLHSIndex ); + const std::u16string_view sMatchExprPart3( sMatchExpression.subView( nRightMostIndex + 2 ) ); + if ( o3tl::make_unsigned(_rExpression.getLength()) < sMatchExprPart3.size() ) + // the expression is not even long enough to hold the right-most part of the match expression + return false; + const std::u16string_view sExprPart3( _rExpression.subView( _rExpression.getLength() - sMatchExprPart3.size() ) ); + if ( sExprPart3 != sMatchExprPart3 ) + // the right-most expression parts do not match + return false; + + // if we don't have an RHS, we're done + if ( !bHaveRHS ) + { + _out_rLHS = _rExpression.copy( sExprPart1.size(), _rExpression.getLength() - sExprPart1.size() - sExprPart3.size() ); + return true; + } + + // strip the match expression by its right-most and left-most part, and by the placeholders $1 and $2 + sal_Int32 nMatchExprPart2Start( nLHSIndex + sLHSPattern.getLength() ); + std::u16string_view sMatchExprPart2 = sMatchExpression.subView( + nMatchExprPart2Start, + sMatchExpression.getLength() - nMatchExprPart2Start - sMatchExprPart3.size() - 2 + ); + // strip the expression by its left-most and right-most part + const std::u16string_view sExpression( _rExpression.subView( + sExprPart1.size(), + _rExpression.getLength() - sExprPart1.size() - sExprPart3.size() + ) ); + + size_t nPart2Index = sExpression.find( sMatchExprPart2 ); + if ( nPart2Index == std::u16string_view::npos ) + // the "middle" part of the match expression does not exist in the expression at all + return false; + + OSL_ENSURE( sExpression.find( sMatchExprPart2, nPart2Index + 1 ) == std::u16string_view::npos, + "ConditionalExpression::matchExpression: ambiguous matching!" ); + // if this fires, then we're lost: The middle part exists two times in the expression, + // so we cannot reliably determine what's the LHS and what's the RHS. + // Well, the whole mechanism is flawed, anyway: + // Encoding the field content in the conditional expression will break as soon + // as somebody + // - assigns a Data Field to a control + // - creates a conditional format expression for the control + // - assigns another Data Field to the control + // - opens the Conditional Format Dialog, again + // Here, at the latest, you can see that we need another mechanism, anyway, which does not + // rely on those strange expression building/matching + + _out_rLHS = sExpression.substr( 0, nPart2Index ); + _out_rRHS = sExpression.substr( nPart2Index + sMatchExprPart2.size() ); + + return true; + } + + + // = ConditionalExpressionFactory + + + size_t ConditionalExpressionFactory::getKnownConditionalExpressions( ConditionalExpressions& _out_rCondExp ) + { + ConditionalExpressions().swap(_out_rCondExp); + + _out_rCondExp[ eBetween ] = std::make_shared( "AND( ( $$ ) >= ( $1 ); ( $$ ) <= ( $2 ) )" ); + _out_rCondExp[ eNotBetween ] = std::make_shared( "NOT( AND( ( $$ ) >= ( $1 ); ( $$ ) <= ( $2 ) ) )" ); + _out_rCondExp[ eEqualTo ] = std::make_shared( "( $$ ) = ( $1 )" ); + _out_rCondExp[ eNotEqualTo ] = std::make_shared( "( $$ ) <> ( $1 )" ); + _out_rCondExp[ eGreaterThan ] = std::make_shared( "( $$ ) > ( $1 )" ); + _out_rCondExp[ eLessThan ] = std::make_shared( "( $$ ) < ( $1 )" ); + _out_rCondExp[ eGreaterOrEqual ] = std::make_shared( "( $$ ) >= ( $1 )" ); + _out_rCondExp[ eLessOrEqual ] = std::make_shared( "( $$ ) <= ( $1 )" ); + + return _out_rCondExp.size(); + } + +} // namespace rptui + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/misc/conditionupdater.cxx b/reportdesign/source/core/misc/conditionupdater.cxx new file mode 100644 index 000000000..428c3b3e7 --- /dev/null +++ b/reportdesign/source/core/misc/conditionupdater.cxx @@ -0,0 +1,118 @@ +/* -*- 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 +#include + +#include + +#include + + +namespace rptui +{ + + + using ::com::sun::star::beans::PropertyChangeEvent; + using ::com::sun::star::uno::Reference; + using ::com::sun::star::report::XReportControlModel; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::report::XFormatCondition; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::Exception; + + + //= ConditionUpdater + + + ConditionUpdater::ConditionUpdater() + { + } + + + ConditionUpdater::~ConditionUpdater() + { + } + + + void ConditionUpdater::notifyPropertyChange( const PropertyChangeEvent& _rEvent ) + { + impl_lateInit_nothrow(); + + Reference< XReportControlModel > xRptControlModel( _rEvent.Source, UNO_QUERY ); + if ( xRptControlModel.is() && _rEvent.PropertyName == "DataField" ) + { + OUString sOldDataSource, sNewDataSource; + OSL_VERIFY( _rEvent.OldValue >>= sOldDataSource ); + OSL_VERIFY( _rEvent.NewValue >>= sNewDataSource ); + impl_adjustFormatConditions_nothrow( xRptControlModel, sOldDataSource, sNewDataSource ); + } + } + + + void ConditionUpdater::impl_lateInit_nothrow() + { + if ( !m_aConditionalExpressions.empty() ) + return; + + ConditionalExpressionFactory::getKnownConditionalExpressions( m_aConditionalExpressions ); + } + + + void ConditionUpdater::impl_adjustFormatConditions_nothrow( const Reference< XReportControlModel >& _rxRptControlModel, + const OUString& _rOldDataSource, const OUString& _rNewDataSource ) + { + try + { + ReportFormula aOldContentFormula( _rOldDataSource ); + OUString sOldUnprefixed( aOldContentFormula.getBracketedFieldOrExpression() ); + ReportFormula aNewContentFormula( _rNewDataSource ); + OUString sNewUnprefixed( aNewContentFormula.getBracketedFieldOrExpression() ); + + sal_Int32 nCount( _rxRptControlModel->getCount() ); + Reference< XFormatCondition > xFormatCondition; + OUString sFormulaExpression, sLHS, sRHS; + for ( sal_Int32 i=0; igetByIndex( i ), UNO_QUERY_THROW ); + sFormulaExpression = ReportFormula(xFormatCondition->getFormula()).getExpression(); + + for (const auto& rEntry : m_aConditionalExpressions) + { + if ( !rEntry.second->matchExpression( sFormulaExpression, sOldUnprefixed, sLHS, sRHS ) ) + continue; + + // the expression matches -> translate it to the new data source of the report control model + sFormulaExpression = rEntry.second->assembleExpression( sNewUnprefixed, sLHS, sRHS ); + ReportFormula aFormula(ReportFormula(ReportFormula::Expression, sFormulaExpression)); + xFormatCondition->setFormula(aFormula.getCompleteFormula()); + break; + } + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION("reportdesign"); + } + } + + +} // namespace rptui + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/misc/reportformula.cxx b/reportdesign/source/core/misc/reportformula.cxx new file mode 100644 index 000000000..cd6ae4df5 --- /dev/null +++ b/reportdesign/source/core/misc/reportformula.cxx @@ -0,0 +1,124 @@ +/* -*- 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 + +#include + + +namespace rptui +{ + namespace + { + + const char sExpressionPrefix[] = "rpt:"; + const char sFieldPrefix[] = "field:"; + } + + + //= ReportFormula + + + ReportFormula::ReportFormula( const OUString& _rFormula ) + :m_eType( Invalid ) + { + m_sCompleteFormula = _rFormula; + + // is it an ordinary expression? + if ( m_sCompleteFormula.startsWith( sExpressionPrefix, &m_sUndecoratedContent ) ) + { + m_eType = Expression; + return; + } + + /// does it refer to a field? + if ( m_sCompleteFormula.startsWith( sFieldPrefix ) ) + { + sal_Int32 nPrefixLen = strlen(sFieldPrefix); + if ( ( m_sCompleteFormula.getLength() >= nPrefixLen + 2 ) + && ( m_sCompleteFormula[ nPrefixLen ] == '[' ) + && ( m_sCompleteFormula[ m_sCompleteFormula.getLength() - 1 ] == ']' ) + ) + { + m_eType = Field; + m_sUndecoratedContent = m_sCompleteFormula.copy( nPrefixLen + 1, m_sCompleteFormula.getLength() - nPrefixLen - 2 ); + return; + } + } + + m_eType = Invalid; + } + + + ReportFormula::ReportFormula( const BindType _eType, const OUString& _rFieldOrExpression ) + :m_eType( _eType ) + { + switch ( m_eType ) + { + case Expression: + { + if ( _rFieldOrExpression.startsWith( sExpressionPrefix ) ) + m_sCompleteFormula = _rFieldOrExpression; + else + m_sCompleteFormula = sExpressionPrefix + _rFieldOrExpression; + } + break; + + case Field: + { + m_sCompleteFormula = sFieldPrefix + OUString::Concat(u"[") + _rFieldOrExpression + "]"; + } + break; + default: + OSL_FAIL( "ReportFormula::ReportFormula: illegal bind type!" ); + return; + } + + m_sUndecoratedContent = _rFieldOrExpression; + } + + ReportFormula::~ReportFormula() + { + } + + OUString ReportFormula::getBracketedFieldOrExpression() const + { + bool bIsField = ( getType() == Field ); + OUStringBuffer aFieldContent; + if ( bIsField ) + aFieldContent.append( "[" ); + aFieldContent.append( getUndecoratedContent() ); + if ( bIsField ) + aFieldContent.append( "]" ); + + return aFieldContent.makeStringAndClear(); + } + + bool ReportFormula::isValid() const { return getType() != Invalid; } + + OUString ReportFormula::getEqualUndecoratedContent() const + { + return "=" + getUndecoratedContent(); + } + + +} // namespace rptui + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/resource/core_resource.cxx b/reportdesign/source/core/resource/core_resource.cxx new file mode 100644 index 000000000..e11d536dc --- /dev/null +++ b/reportdesign/source/core/resource/core_resource.cxx @@ -0,0 +1,23 @@ +/* -*- 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 + +OUString RptResId(TranslateId aId) { return Translate::get(aId, Translate::Create("rpt")); } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/sdr/PropertyForward.cxx b/reportdesign/source/core/sdr/PropertyForward.cxx new file mode 100644 index 000000000..394edfc12 --- /dev/null +++ b/reportdesign/source/core/sdr/PropertyForward.cxx @@ -0,0 +1,180 @@ +/* -*- 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 +#include +#include +#include +#include + +namespace rptui +{ + + using namespace ::com::sun::star::uno; + using namespace ::com::sun::star::beans; + +OPropertyMediator::OPropertyMediator(const Reference< XPropertySet>& _xSource + ,const Reference< XPropertySet>& _xDest + ,TPropertyNamePair&& _aNameMap + ,bool _bReverse) + : OPropertyForward_Base(m_aMutex) + ,m_aNameMap(std::move(_aNameMap)) + ,m_xSource(_xSource) + ,m_xDest(_xDest) + ,m_bInChange(false) +{ + osl_atomic_increment(&m_refCount); + OSL_ENSURE(m_xDest.is(),"Dest is NULL!"); + OSL_ENSURE(m_xSource.is(),"Source is NULL!"); + if ( m_xDest.is() && m_xSource.is() ) + { + try + { + m_xDestInfo = m_xDest->getPropertySetInfo(); + m_xSourceInfo = m_xSource->getPropertySetInfo(); + if ( _bReverse ) + { + ::comphelper::copyProperties(m_xDest,m_xSource); + for (const auto& [rName, rPropConv] : m_aNameMap) + { + Property aProp = m_xSourceInfo->getPropertyByName(rName); + if (0 == (aProp.Attributes & PropertyAttribute::READONLY)) + { + Any aValue = _xDest->getPropertyValue(rPropConv.first); + if ( 0 != (aProp.Attributes & PropertyAttribute::MAYBEVOID) || aValue.hasValue() ) + _xSource->setPropertyValue(rName, rPropConv.second->operator()(rPropConv.first, aValue)); + } + } + } + else + { + ::comphelper::copyProperties(m_xSource,m_xDest); + for (const auto& [rName, rPropConv] : m_aNameMap) + _xDest->setPropertyValue(rPropConv.first, rPropConv.second->operator()(rPropConv.first, _xSource->getPropertyValue(rName))); + } + startListening(); + } + catch(Exception&) + { + DBG_UNHANDLED_EXCEPTION("reportdesign"); + } + } + osl_atomic_decrement(&m_refCount); +} + +OPropertyMediator::~OPropertyMediator() +{ +} + +void SAL_CALL OPropertyMediator::propertyChange( const PropertyChangeEvent& evt ) +{ + ::osl::MutexGuard aGuard(m_aMutex); + if ( m_bInChange ) + return; + + m_bInChange = true; + try + { + bool bDest = (evt.Source == m_xDest); + Reference xProp = bDest ? m_xSource : m_xDest; + Reference xPropInfo = bDest ? m_xSourceInfo : m_xDestInfo; + if ( xProp.is() && xPropInfo.is() ) + { + if ( xPropInfo->hasPropertyByName(evt.PropertyName) ) + xProp->setPropertyValue(evt.PropertyName,evt.NewValue); + else + { + TPropertyNamePair::const_iterator aFind = m_aNameMap.find(evt.PropertyName); + OUString sPropName; + if ( aFind != m_aNameMap.end() ) + sPropName = aFind->second.first; + else + { + aFind = ::std::find_if( + m_aNameMap.begin(), + m_aNameMap.end(), + [&evt] (const TPropertyNamePair::value_type& namePair) { + return namePair.second.first == evt.PropertyName; + }); + if ( aFind != m_aNameMap.end() ) + sPropName = aFind->first; + } + if (aFind != m_aNameMap.end() && !sPropName.isEmpty() && xPropInfo->hasPropertyByName(sPropName)) + xProp->setPropertyValue(sPropName,aFind->second.second->operator()(sPropName,evt.NewValue)); + else if ( evt.PropertyName == PROPERTY_CHARFONTNAME + || evt.PropertyName == PROPERTY_CHARFONTSTYLENAME + || evt.PropertyName == PROPERTY_CHARSTRIKEOUT + || evt.PropertyName == PROPERTY_CHARWORDMODE + || evt.PropertyName == PROPERTY_CHARROTATION + || evt.PropertyName == PROPERTY_CHARSCALEWIDTH + || evt.PropertyName == PROPERTY_CHARFONTFAMILY + || evt.PropertyName == PROPERTY_CHARFONTCHARSET + || evt.PropertyName == PROPERTY_CHARFONTPITCH + || evt.PropertyName == PROPERTY_CHARHEIGHT + || evt.PropertyName == PROPERTY_CHARUNDERLINE + || evt.PropertyName == PROPERTY_CHARWEIGHT + || evt.PropertyName == PROPERTY_CHARPOSTURE) + { + xProp->setPropertyValue(PROPERTY_FONTDESCRIPTOR,m_xSource->getPropertyValue(PROPERTY_FONTDESCRIPTOR)); + } + } + } + } + catch(Exception&) + { + TOOLS_WARN_EXCEPTION( "reportdesign", ""); + } + m_bInChange = false; +} + +void SAL_CALL OPropertyMediator::disposing( const css::lang::EventObject& /*_rSource*/ ) +{ + ::osl::MutexGuard aGuard(m_aMutex); + disposing(); +} + +void SAL_CALL OPropertyMediator::disposing() +{ + stopListening(); + m_xSource.clear(); + m_xSourceInfo.clear(); + m_xDest.clear(); + m_xDestInfo.clear(); +} + +void OPropertyMediator::stopListening() +{ + if ( m_xSource.is() ) + m_xSource->removePropertyChangeListener(OUString(), this); + if ( m_xDest.is() ) + m_xDest->removePropertyChangeListener(OUString(), this); +} + +void OPropertyMediator::startListening() +{ + if ( m_xSource.is() ) + m_xSource->addPropertyChangeListener(OUString(), this); + if ( m_xDest.is() ) + m_xDest->addPropertyChangeListener(OUString(), this); +} + + +} // namespace dbaccess + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/sdr/ReportDrawPage.cxx b/reportdesign/source/core/sdr/ReportDrawPage.cxx new file mode 100644 index 000000000..b89c3dac2 --- /dev/null +++ b/reportdesign/source/core/sdr/ReportDrawPage.cxx @@ -0,0 +1,149 @@ +/* -*- 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 +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace reportdesign +{ + using namespace ::com::sun::star; + using namespace rptui; + +OReportDrawPage::OReportDrawPage(SdrPage* _pPage + ,const uno::Reference< report::XSection >& _xSection) +: SvxDrawPage(_pPage) +,m_xSection(_xSection) +{ +} + +SdrObject* OReportDrawPage::CreateSdrObject_(const uno::Reference< drawing::XShape > & xDescr) +{ + uno::Reference< report::XReportComponent> xReportComponent(xDescr,uno::UNO_QUERY); + if ( xReportComponent.is() ) + { + return OObjectBase::createObject( + GetSdrPage()->getSdrModelFromSdrPage(), + xReportComponent); + } + + return SvxDrawPage::CreateSdrObject_( xDescr ); +} + +uno::Reference< drawing::XShape > OReportDrawPage::CreateShape( SdrObject *pObj ) const +{ + OObjectBase* pBaseObj = dynamic_cast(pObj); + if ( !pBaseObj ) + return SvxDrawPage::CreateShape( pObj ); + + uno::Reference< report::XSection> xSection = m_xSection; + uno::Reference< lang::XMultiServiceFactory> xFactory; + if ( xSection.is() ) + xFactory.set(xSection->getReportDefinition(),uno::UNO_QUERY); + uno::Reference< drawing::XShape > xRet; + uno::Reference< drawing::XShape > xShape; + if ( xFactory.is() ) + { + bool bChangeOrientation = false; + const OUString& sServiceName = pBaseObj->getServiceName(); + OSL_ENSURE(!sServiceName.isEmpty(),"No Service Name given!"); + + if (dynamic_cast< const OUnoObject* >(pObj) != nullptr) + { + OUnoObject& rUnoObj = dynamic_cast(*pObj); + if (rUnoObj.GetObjIdentifier() == SdrObjKind::ReportDesignFixedText) + { + uno::Reference xControlModel(rUnoObj.GetUnoControlModel(),uno::UNO_QUERY); + if ( xControlModel.is() ) + xControlModel->setPropertyValue( PROPERTY_MULTILINE,uno::Any(true)); + } + else + bChangeOrientation = rUnoObj.GetObjIdentifier() == SdrObjKind::ReportDesignHorizontalFixedLine; + rtl::Reference pShape = new SvxShapeControl( pObj ); + xShape = static_cast(pShape.get()); + pShape->setShapeKind(pObj->GetObjIdentifier()); + } + else if (dynamic_cast< const OCustomShape* >(pObj) != nullptr) + { + rtl::Reference pShape = new SvxCustomShape( pObj ); + xShape = pShape; + pShape->setShapeKind(pObj->GetObjIdentifier()); + } + else if (dynamic_cast< const SdrOle2Obj* >(pObj) != nullptr) + { + SdrOle2Obj& rOle2Obj = dynamic_cast(*pObj); + if (!rOle2Obj.GetObjRef().is()) + { + sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT; + uno::Reference < embed::XEmbeddedObject > xObj; + OUString sName; + xObj = pObj->getSdrModelFromSdrObject().GetPersist()->getEmbeddedObjectContainer().CreateEmbeddedObject( + ::comphelper::MimeConfigurationHelper::GetSequenceClassIDRepresentation( + u"80243D39-6741-46C5-926E-069164FF87BB"), sName ); + OSL_ENSURE(xObj.is(),"Embedded Object could not be created!"); + + /************************************************** + * The empty OLE object gets a new IPObj + **************************************************/ + pObj->SetEmptyPresObj(false); + rOle2Obj.SetOutlinerParaObject(std::nullopt); + rOle2Obj.SetObjRef(xObj); + rOle2Obj.SetPersistName(sName); + rOle2Obj.SetName(sName); + rOle2Obj.SetAspect(nAspect); + tools::Rectangle aRect = rOle2Obj.GetLogicRect(); + + Size aTmp = aRect.GetSize(); + awt::Size aSz( aTmp.Width(), aTmp.Height() ); + xObj->setVisualAreaSize( nAspect, aSz ); + } + rtl::Reference pShape = new SvxOle2Shape( pObj ); + xShape = pShape; + pShape->setShapeKind(pObj->GetObjIdentifier()); + } + + if ( !xShape.is() ) + xShape.set( SvxDrawPage::CreateShape( pObj ) ); + + try + { + OReportModel& rRptModel(static_cast< OReportModel& >(pObj->getSdrModelFromSdrObject())); + xRet.set( rRptModel.createShape(sServiceName,xShape,bChangeOrientation ? 0 : 1), uno::UNO_QUERY_THROW ); + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION("reportdesign"); + } + } + + return xRet; +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/sdr/ReportUndoFactory.cxx b/reportdesign/source/core/sdr/ReportUndoFactory.cxx new file mode 100644 index 000000000..1c36d836b --- /dev/null +++ b/reportdesign/source/core/sdr/ReportUndoFactory.cxx @@ -0,0 +1,157 @@ +/* -*- 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 +#include +#include +#include + +namespace rptui +{ + using namespace ::com::sun::star; + +static std::unique_ptr lcl_createUndo(SdrObject& rObject, Action _eAction, TranslateId pCommentId) +{ + OObjectBase* pObj = dynamic_cast(&rObject); + if ( !pObj ) + return nullptr; + uno::Reference< report::XReportComponent> xReportComponent = pObj->getReportComponent(); + uno::Reference< report::XSection> xSection = pObj->getSection(); + uno::Reference< report::XGroup> xGroup = xSection->getGroup(); + if ( xGroup.is() ) + return std::make_unique(rObject.getSdrModelFromSdrObject(),_eAction,OGroupHelper::getMemberFunction(xSection),xGroup,xReportComponent,pCommentId); + else + return std::make_unique(rObject.getSdrModelFromSdrObject(),_eAction,OReportHelper::getMemberFunction(xSection),xSection->getReportDefinition(),xReportComponent,pCommentId); +} + + +OReportUndoFactory::OReportUndoFactory() : m_pUndoFactory(new SdrUndoFactory) +{ +} + +OReportUndoFactory::~OReportUndoFactory() +{ +} + +std::unique_ptr OReportUndoFactory::CreateUndoMoveObject( SdrObject& rObject, const Size& rDist ) +{ + return m_pUndoFactory->CreateUndoMoveObject( rObject, rDist ); +} + +std::unique_ptr OReportUndoFactory::CreateUndoGeoObject( SdrObject& rObject ) +{ + return m_pUndoFactory->CreateUndoGeoObject( rObject ); +} + +std::unique_ptr OReportUndoFactory::CreateUndoAttrObject( SdrObject& rObject, bool bStyleSheet1, bool bSaveText ) +{ + return m_pUndoFactory->CreateUndoAttrObject( rObject, bStyleSheet1, bSaveText ); +} + +std::unique_ptr OReportUndoFactory::CreateUndoRemoveObject(SdrObject& rObject) +{ + return m_pUndoFactory->CreateUndoRemoveObject(rObject); +} + +std::unique_ptr OReportUndoFactory::CreateUndoInsertObject( SdrObject& rObject, bool /*bOrdNumDirect*/ ) +{ + return lcl_createUndo(rObject,rptui::Inserted,RID_STR_UNDO_INSERT_CONTROL); +} + +std::unique_ptr OReportUndoFactory::CreateUndoDeleteObject( SdrObject& rObject, bool /*bOrdNumDirect*/ ) +{ + return lcl_createUndo(rObject,rptui::Removed,RID_STR_UNDO_DELETE_CONTROL); +} + +std::unique_ptr OReportUndoFactory::CreateUndoNewObject( SdrObject& rObject, bool /*bOrdNumDirect*/ ) +{ + return lcl_createUndo(rObject,rptui::Inserted,RID_STR_UNDO_INSERT_CONTROL); +} + +std::unique_ptr OReportUndoFactory::CreateUndoCopyObject( SdrObject& rObject, bool bOrdNumDirect ) +{ + return m_pUndoFactory->CreateUndoCopyObject( rObject, bOrdNumDirect ); +} + +std::unique_ptr OReportUndoFactory::CreateUndoObjectOrdNum( SdrObject& rObject, sal_uInt32 nOldOrdNum1, sal_uInt32 nNewOrdNum1) +{ + return m_pUndoFactory->CreateUndoObjectOrdNum( rObject, nOldOrdNum1, nNewOrdNum1 ); +} + +std::unique_ptr OReportUndoFactory::CreateUndoReplaceObject( SdrObject& rOldObject, SdrObject& rNewObject ) +{ + return m_pUndoFactory->CreateUndoReplaceObject( rOldObject, rNewObject ); +} + +std::unique_ptr OReportUndoFactory::CreateUndoObjectLayerChange( SdrObject& rObject, SdrLayerID aOldLayer, SdrLayerID aNewLayer ) +{ + return m_pUndoFactory->CreateUndoObjectLayerChange( rObject, aOldLayer, aNewLayer ); +} + +std::unique_ptr OReportUndoFactory::CreateUndoObjectSetText( SdrObject& rNewObj, sal_Int32 nText ) +{ + return m_pUndoFactory->CreateUndoObjectSetText( rNewObj, nText ); +} + +// layer +std::unique_ptr OReportUndoFactory::CreateUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel) +{ + return m_pUndoFactory->CreateUndoNewLayer( nLayerNum, rNewLayerAdmin, rNewModel ); +} + +std::unique_ptr OReportUndoFactory::CreateUndoDeleteLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel) +{ + return m_pUndoFactory->CreateUndoDeleteLayer( nLayerNum, rNewLayerAdmin, rNewModel ); +} + +// page +std::unique_ptr OReportUndoFactory::CreateUndoDeletePage(SdrPage& rPage) +{ + return m_pUndoFactory->CreateUndoDeletePage(rPage); +} + +std::unique_ptr OReportUndoFactory::CreateUndoNewPage(SdrPage& rPage) +{ + return m_pUndoFactory->CreateUndoNewPage( rPage ); +} + +std::unique_ptr OReportUndoFactory::CreateUndoCopyPage(SdrPage& rPage) +{ + return m_pUndoFactory->CreateUndoCopyPage( rPage ); +} + +std::unique_ptr OReportUndoFactory::CreateUndoSetPageNum(SdrPage& rNewPg, sal_uInt16 nOldPageNum1, sal_uInt16 nNewPageNum1) +{ + return m_pUndoFactory->CreateUndoSetPageNum( rNewPg, nOldPageNum1, nNewPageNum1 ); +} + // master page +std::unique_ptr OReportUndoFactory::CreateUndoPageRemoveMasterPage(SdrPage& rChangedPage) +{ + return m_pUndoFactory->CreateUndoPageRemoveMasterPage( rChangedPage ); +} + +std::unique_ptr OReportUndoFactory::CreateUndoPageChangeMasterPage(SdrPage& rChangedPage) +{ + return m_pUndoFactory->CreateUndoPageChangeMasterPage(rChangedPage); +} + + +} //rptui + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/sdr/RptModel.cxx b/reportdesign/source/core/sdr/RptModel.cxx new file mode 100644 index 000000000..e7fa935f8 --- /dev/null +++ b/reportdesign/source/core/sdr/RptModel.cxx @@ -0,0 +1,187 @@ +/* -*- 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 +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace rptui +{ +using namespace reportdesign; +using namespace com::sun::star; + + +OReportModel::OReportModel(::reportdesign::OReportDefinition* _pReportDefinition) +: SdrModel( + nullptr, + _pReportDefinition) + ,m_pController(nullptr) + ,m_pReportDefinition(_pReportDefinition) +{ + m_xUndoEnv = new OXUndoEnvironment(*this); + SetSdrUndoFactory(new OReportUndoFactory); +} + + +OReportModel::~OReportModel() +{ + detachController(); +} + +void OReportModel::detachController() +{ + m_pReportDefinition = nullptr; + m_pController = nullptr; + m_xUndoEnv->EndListening( *this ); + ClearUndoBuffer(); + m_xUndoEnv->Clear(OXUndoEnvironment::Accessor()); +} + +rtl::Reference OReportModel::AllocPage(bool /*bMasterPage*/) +{ + OSL_FAIL("Who called me!"); + return nullptr; +} + + +void OReportModel::SetChanged( bool bChanged ) +{ + SdrModel::SetChanged( bChanged ); + SetModified( bChanged ); +} + + +void OReportModel::SetModified(bool _bModified) +{ + if ( m_pController ) + m_pController->setModified(_bModified); +} + +rtl::Reference OReportModel::RemovePage(sal_uInt16 nPgNum) +{ + rtl::Reference pPage = dynamic_cast(SdrModel::RemovePage(nPgNum).get()); + return pPage; +} + +OReportPage* OReportModel::createNewPage(const uno::Reference< report::XSection >& _xSection) +{ + SolarMutexGuard aSolarGuard; + rtl::Reference pPage = new OReportPage( *this ,_xSection); + InsertPage(pPage.get()); + m_xUndoEnv->AddSection(_xSection); + return pPage.get(); +} + +OReportPage* OReportModel::getPage(const uno::Reference< report::XSection >& _xSection) +{ + OReportPage* pPage = nullptr; + sal_uInt16 nCount = GetPageCount(); + for (sal_uInt16 i = 0; i < nCount && !pPage ; ++i) + { + OReportPage* pRptPage = dynamic_cast( GetPage(i) ); + if ( pRptPage && pRptPage->getSection() == _xSection ) + pPage = pRptPage; + } + return pPage; +} + +SvxNumType OReportModel::GetPageNumType() const +{ + uno::Reference< report::XReportDefinition > xReportDefinition( getReportDefinition() ); + if ( xReportDefinition.is() ) + return static_cast(getStyleProperty(xReportDefinition,PROPERTY_NUMBERINGTYPE)); + return SVX_NUM_ARABIC; +} + + +uno::Reference< report::XReportDefinition > OReportModel::getReportDefinition() const +{ + uno::Reference< report::XReportDefinition > xReportDefinition = m_pReportDefinition; + OSL_ENSURE( xReportDefinition.is(), "OReportModel::getReportDefinition: invalid model at our controller!" ); + return xReportDefinition; +} + +uno::Reference< uno::XInterface > OReportModel::createUnoModel() +{ + return uno::Reference< uno::XInterface >(getReportDefinition(),uno::UNO_QUERY); +} + +uno::Reference< uno::XInterface > OReportModel::createShape(const OUString& aServiceSpecifier,uno::Reference< drawing::XShape >& _rShape,sal_Int32 nOrientation) +{ + uno::Reference< uno::XInterface > xRet; + if ( _rShape.is() ) + { + if ( aServiceSpecifier == SERVICE_FORMATTEDFIELD ) + { + uno::Reference xProp = new OFormattedField(m_pReportDefinition->getContext(),m_pReportDefinition,_rShape); + xRet = xProp; + if ( _rShape.is() ) + throw uno::Exception("no shape", nullptr); + xProp->setPropertyValue( PROPERTY_FORMATSSUPPLIER, uno::Any(uno::Reference< util::XNumberFormatsSupplier >(*m_pReportDefinition,uno::UNO_QUERY)) ); + } + else if ( aServiceSpecifier == SERVICE_FIXEDTEXT) + { + xRet = static_cast(new OFixedText(m_pReportDefinition->getContext(),m_pReportDefinition,_rShape)); + if ( _rShape.is() ) + throw uno::Exception("no shape", nullptr); + } + else if ( aServiceSpecifier == SERVICE_FIXEDLINE) + { + xRet = static_cast(new OFixedLine(m_pReportDefinition->getContext(),m_pReportDefinition,_rShape,nOrientation)); + if ( _rShape.is() ) + throw uno::Exception("no shape", nullptr); + } + else if ( aServiceSpecifier == SERVICE_IMAGECONTROL ) + { + xRet = static_cast(new OImageControl(m_pReportDefinition->getContext(),m_pReportDefinition,_rShape)); + if ( _rShape.is() ) + throw uno::Exception("no shape", nullptr); + } + else if ( aServiceSpecifier == SERVICE_REPORTDEFINITION ) + { + xRet = static_cast(new OReportDefinition(m_pReportDefinition->getContext(),m_pReportDefinition,_rShape)); + if ( _rShape.is() ) + throw uno::Exception("no shape", nullptr); + } + else if ( _rShape.is() ) + { + xRet = static_cast(new OShape(m_pReportDefinition->getContext(),m_pReportDefinition,_rShape,aServiceSpecifier)); + if ( _rShape.is() ) + throw uno::Exception("no shape", nullptr); + } + } + return xRet; +} + +} //rptui + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx new file mode 100644 index 000000000..1972e892e --- /dev/null +++ b/reportdesign/source/core/sdr/RptObject.cxx @@ -0,0 +1,1219 @@ +/* -*- 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 +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace rptui +{ + +using namespace ::com::sun::star; +using namespace uno; +using namespace beans; +using namespace reportdesign; +using namespace container; +using namespace report; + +SdrObjKind OObjectBase::getObjectType(const uno::Reference< report::XReportComponent>& _xComponent) +{ + uno::Reference< lang::XServiceInfo > xServiceInfo( _xComponent , uno::UNO_QUERY ); + OSL_ENSURE(xServiceInfo.is(),"Who deletes the XServiceInfo interface!"); + if ( !xServiceInfo ) + return SdrObjKind::NONE; + + if ( xServiceInfo->supportsService( SERVICE_FIXEDTEXT )) + return SdrObjKind::ReportDesignFixedText; + if ( xServiceInfo->supportsService( SERVICE_FIXEDLINE )) + { + uno::Reference< report::XFixedLine> xFixedLine(_xComponent,uno::UNO_QUERY); + return xFixedLine->getOrientation() ? SdrObjKind::ReportDesignHorizontalFixedLine : SdrObjKind::ReportDesignVerticalFixedLine; + } + if ( xServiceInfo->supportsService( SERVICE_IMAGECONTROL)) + return SdrObjKind::ReportDesignImageControl; + if ( xServiceInfo->supportsService( SERVICE_FORMATTEDFIELD )) + return SdrObjKind::ReportDesignFormattedField; + if ( xServiceInfo->supportsService("com.sun.star.drawing.OLE2Shape") ) + return SdrObjKind::OLE2; + if ( xServiceInfo->supportsService( SERVICE_SHAPE )) + return SdrObjKind::CustomShape; + if ( xServiceInfo->supportsService( SERVICE_REPORTDEFINITION ) ) + return SdrObjKind::ReportDesignSubReport; + return SdrObjKind::OLE2; +} + +SdrObject* OObjectBase::createObject( + SdrModel& rTargetModel, + const uno::Reference< report::XReportComponent>& _xComponent) +{ + SdrObject* pNewObj = nullptr; + SdrObjKind nType = OObjectBase::getObjectType(_xComponent); + switch( nType ) + { + case SdrObjKind::ReportDesignFixedText: + { + OUnoObject* pUnoObj = new OUnoObject( + rTargetModel, + _xComponent, + OUString("com.sun.star.form.component.FixedText"), + SdrObjKind::ReportDesignFixedText); + pNewObj = pUnoObj; + + uno::Reference xControlModel(pUnoObj->GetUnoControlModel(),uno::UNO_QUERY); + if ( xControlModel.is() ) + xControlModel->setPropertyValue( PROPERTY_MULTILINE,uno::Any(true)); + } + break; + case SdrObjKind::ReportDesignImageControl: + pNewObj = new OUnoObject( + rTargetModel, + _xComponent, + OUString("com.sun.star.form.component.DatabaseImageControl"), + SdrObjKind::ReportDesignImageControl); + break; + case SdrObjKind::ReportDesignFormattedField: + pNewObj = new OUnoObject( + rTargetModel, + _xComponent, + OUString("com.sun.star.form.component.FormattedField"), + SdrObjKind::ReportDesignFormattedField); + break; + case SdrObjKind::ReportDesignHorizontalFixedLine: + case SdrObjKind::ReportDesignVerticalFixedLine: + pNewObj = new OUnoObject( + rTargetModel, + _xComponent, + OUString("com.sun.star.awt.UnoControlFixedLineModel"), + nType); + break; + case SdrObjKind::CustomShape: + pNewObj = OCustomShape::Create( + rTargetModel, + _xComponent); + try + { + bool bOpaque = false; + _xComponent->getPropertyValue(PROPERTY_OPAQUE) >>= bOpaque; + pNewObj->NbcSetLayer(bOpaque ? RPT_LAYER_FRONT : RPT_LAYER_BACK); + } + catch(const uno::Exception&) + { + DBG_UNHANDLED_EXCEPTION("reportdesign"); + } + break; + case SdrObjKind::ReportDesignSubReport: + case SdrObjKind::OLE2: + pNewObj = OOle2Obj::Create( + rTargetModel, + _xComponent, + nType); + break; + default: + OSL_FAIL("Unknown object id"); + break; + } + + if ( pNewObj ) + pNewObj->SetDoNotInsertIntoPageAutomatically( true ); + + ensureSdrObjectOwnership( _xComponent ); + + return pNewObj; +} + +namespace +{ + class ParaAdjust : public AnyConverter + { + public: + virtual css::uno::Any operator() (const OUString& _sPropertyName,const css::uno::Any& lhs) const override + { + uno::Any aRet; + if (_sPropertyName == PROPERTY_PARAADJUST) + { + sal_Int16 nTextAlign = 0; + lhs >>= nTextAlign; + style::ParagraphAdjust eAdjust; + switch(nTextAlign) + { + case awt::TextAlign::LEFT: + eAdjust = style::ParagraphAdjust_LEFT; + break; + case awt::TextAlign::CENTER: + eAdjust = style::ParagraphAdjust_CENTER; + break; + case awt::TextAlign::RIGHT: + eAdjust = style::ParagraphAdjust_RIGHT; + break; + default: + OSL_FAIL("Illegal text alignment value!"); + break; + } + aRet <<= eAdjust; + } + else + { + sal_Int16 nTextAlign = 0; + sal_Int16 eParagraphAdjust = 0; + lhs >>= eParagraphAdjust; + switch(static_cast(eParagraphAdjust)) + { + case style::ParagraphAdjust_LEFT: + case style::ParagraphAdjust_BLOCK: + nTextAlign = awt::TextAlign::LEFT; + break; + case style::ParagraphAdjust_CENTER: + nTextAlign = awt::TextAlign::CENTER; + break; + case style::ParagraphAdjust_RIGHT: + nTextAlign = awt::TextAlign::RIGHT; + break; + default: + OSL_FAIL("Illegal text alignment value!"); + break; + } + aRet <<= nTextAlign; + } + return aRet; + } + }; +} + +const TPropertyNamePair& getPropertyNameMap(SdrObjKind _nObjectId) +{ + switch(_nObjectId) + { + case SdrObjKind::ReportDesignImageControl: + { + static TPropertyNamePair s_aNameMap = []() + { + auto aNoConverter = std::make_shared(); + TPropertyNamePair tmp; + tmp.emplace(PROPERTY_CONTROLBACKGROUND,TPropertyConverter(PROPERTY_BACKGROUNDCOLOR,aNoConverter)); + tmp.emplace(PROPERTY_CONTROLBORDER,TPropertyConverter(PROPERTY_BORDER,aNoConverter)); + tmp.emplace(PROPERTY_CONTROLBORDERCOLOR,TPropertyConverter(PROPERTY_BORDERCOLOR,aNoConverter)); + return tmp; + }(); + return s_aNameMap; + } + + case SdrObjKind::ReportDesignFixedText: + { + static TPropertyNamePair s_aNameMap = []() + { + auto aNoConverter = std::make_shared(); + TPropertyNamePair tmp; + tmp.emplace(PROPERTY_CHARCOLOR,TPropertyConverter(PROPERTY_TEXTCOLOR,aNoConverter)); + tmp.emplace(PROPERTY_CONTROLBACKGROUND,TPropertyConverter(PROPERTY_BACKGROUNDCOLOR,aNoConverter)); + tmp.emplace(PROPERTY_CHARUNDERLINECOLOR,TPropertyConverter(PROPERTY_TEXTLINECOLOR,aNoConverter)); + tmp.emplace(PROPERTY_CHARRELIEF,TPropertyConverter(PROPERTY_FONTRELIEF,aNoConverter)); + tmp.emplace(PROPERTY_CHARFONTHEIGHT,TPropertyConverter(PROPERTY_FONTHEIGHT,aNoConverter)); + tmp.emplace(PROPERTY_CHARSTRIKEOUT,TPropertyConverter(PROPERTY_FONTSTRIKEOUT,aNoConverter)); + tmp.emplace(PROPERTY_CONTROLTEXTEMPHASISMARK,TPropertyConverter(PROPERTY_FONTEMPHASISMARK,aNoConverter)); + tmp.emplace(PROPERTY_CONTROLBORDER,TPropertyConverter(PROPERTY_BORDER,aNoConverter)); + tmp.emplace(PROPERTY_CONTROLBORDERCOLOR,TPropertyConverter(PROPERTY_BORDERCOLOR,aNoConverter)); + + auto aParaAdjust = std::make_shared(); + tmp.emplace(PROPERTY_PARAADJUST,TPropertyConverter(PROPERTY_ALIGN,aParaAdjust)); + return tmp; + }(); + return s_aNameMap; + } + case SdrObjKind::ReportDesignFormattedField: + { + static TPropertyNamePair s_aNameMap = []() + { + auto aNoConverter = std::make_shared(); + TPropertyNamePair tmp; + tmp.emplace(PROPERTY_CHARCOLOR,TPropertyConverter(PROPERTY_TEXTCOLOR,aNoConverter)); + tmp.emplace(PROPERTY_CONTROLBACKGROUND,TPropertyConverter(PROPERTY_BACKGROUNDCOLOR,aNoConverter)); + tmp.emplace(PROPERTY_CHARUNDERLINECOLOR,TPropertyConverter(PROPERTY_TEXTLINECOLOR,aNoConverter)); + tmp.emplace(PROPERTY_CHARRELIEF,TPropertyConverter(PROPERTY_FONTRELIEF,aNoConverter)); + tmp.emplace(PROPERTY_CHARFONTHEIGHT,TPropertyConverter(PROPERTY_FONTHEIGHT,aNoConverter)); + tmp.emplace(PROPERTY_CHARSTRIKEOUT,TPropertyConverter(PROPERTY_FONTSTRIKEOUT,aNoConverter)); + tmp.emplace(PROPERTY_CONTROLTEXTEMPHASISMARK,TPropertyConverter(PROPERTY_FONTEMPHASISMARK,aNoConverter)); + tmp.emplace(PROPERTY_CONTROLBORDER,TPropertyConverter(PROPERTY_BORDER,aNoConverter)); + tmp.emplace(PROPERTY_CONTROLBORDERCOLOR,TPropertyConverter(PROPERTY_BORDERCOLOR,aNoConverter)); + auto aParaAdjust = std::make_shared(); + tmp.emplace(PROPERTY_PARAADJUST,TPropertyConverter(PROPERTY_ALIGN,aParaAdjust)); + return tmp; + }(); + return s_aNameMap; + } + + case SdrObjKind::CustomShape: + { + static TPropertyNamePair s_aNameMap = []() + { + auto aNoConverter = std::make_shared(); + TPropertyNamePair tmp; + tmp.emplace(OUString("FillColor"),TPropertyConverter(PROPERTY_CONTROLBACKGROUND,aNoConverter)); + tmp.emplace(PROPERTY_PARAADJUST,TPropertyConverter(PROPERTY_ALIGN,aNoConverter)); + return tmp; + }(); + return s_aNameMap; + } + + default: + break; + } + static TPropertyNamePair s_aEmptyNameMap; + return s_aEmptyNameMap; +} + + +OObjectBase::OObjectBase(const uno::Reference< report::XReportComponent>& _xComponent) +:m_bIsListening(false) +{ + m_xReportComponent = _xComponent; +} + +OObjectBase::OObjectBase(const OUString& _sComponentName) +:m_sComponentName(_sComponentName) +,m_bIsListening(false) +{ +} + +OObjectBase::~OObjectBase() +{ + m_xMediator.clear(); + if ( isListening() ) + EndListening(); + m_xReportComponent.clear(); +} + +uno::Reference< report::XSection> OObjectBase::getSection() const +{ + uno::Reference< report::XSection> xSection; + OReportPage* pPage = dynamic_cast(GetImplPage()); + if ( pPage ) + xSection = pPage->getSection(); + return xSection; +} + + +uno::Reference< beans::XPropertySet> OObjectBase::getAwtComponent() +{ + return uno::Reference< beans::XPropertySet>(); +} + +void OObjectBase::StartListening() +{ + OSL_ENSURE(!isListening(), "OUnoObject::StartListening: already listening!"); + + if ( !isListening() && m_xReportComponent.is() ) + { + m_bIsListening = true; + + if ( !m_xPropertyChangeListener.is() ) + { + m_xPropertyChangeListener = new OObjectListener( this ); + // register listener to all properties + m_xReportComponent->addPropertyChangeListener( OUString() , m_xPropertyChangeListener ); + } + } +} + +void OObjectBase::EndListening() +{ + OSL_ENSURE(!m_xReportComponent.is() || isListening(), "OUnoObject::EndListening: not listening currently!"); + + if ( isListening() && m_xReportComponent.is() ) + { + // XPropertyChangeListener + if ( m_xPropertyChangeListener.is() ) + { + // remove listener + try + { + m_xReportComponent->removePropertyChangeListener( OUString() , m_xPropertyChangeListener ); + } + catch(const uno::Exception &) + { + TOOLS_WARN_EXCEPTION( "package", "OObjectBase::EndListening"); + } + } + m_xPropertyChangeListener.clear(); + } + m_bIsListening = false; +} + +void OObjectBase::SetPropsFromRect(const tools::Rectangle& _rRect) +{ + // set properties + OReportPage* pPage = dynamic_cast(GetImplPage()); + if ( pPage && !_rRect.IsEmpty() ) + { + const uno::Reference& xSection = pPage->getSection(); + assert(_rRect.getHeight() >= 0); + const sal_uInt32 newHeight( ::std::max(tools::Long(0), _rRect.getHeight()+_rRect.Top()) ); + if ( xSection.is() && ( newHeight > xSection->getHeight() ) ) + xSection->setHeight( newHeight ); + + // TODO + //pModel->GetRefDevice()->Invalidate(InvalidateFlags::Children); + } +} + +void OObjectBase::_propertyChange( const beans::PropertyChangeEvent& /*evt*/ ) +{ +} + +bool OObjectBase::supportsService( const OUString& _sServiceName ) const +{ + // TODO: cache xServiceInfo as member? + Reference< lang::XServiceInfo > xServiceInfo( m_xReportComponent , UNO_QUERY ); + + if ( xServiceInfo.is() ) + return cppu::supportsService(xServiceInfo.get(), _sServiceName); + else + return false; +} + + +void OObjectBase::ensureSdrObjectOwnership( const uno::Reference< uno::XInterface >& _rxShape ) +{ + // UNDO in the report designer is implemented at the level of the XShapes, not + // at the level of SdrObjects. That is, if an object is removed from the report + // design, then this happens by removing the XShape from the UNO DrawPage, and + // putting this XShape (resp. the ReportComponent which wraps it) into an UNDO + // action. + // Unfortunately, the SvxDrawPage implementation usually deletes SdrObjects + // which are removed from it, which is deadly for us. To prevent this, + // we give the XShape implementation the ownership of the SdrObject, which + // ensures the SvxDrawPage won't delete it. + SvxShape* pShape = comphelper::getFromUnoTunnel( _rxShape ); + OSL_ENSURE( pShape, "OObjectBase::ensureSdrObjectOwnership: can't access the SvxShape!" ); + if ( pShape ) + { + OSL_ENSURE( !pShape->HasSdrObjectOwnership(), "OObjectBase::ensureSdrObjectOwnership: called twice?" ); + pShape->TakeSdrObjectOwnership(); + } +} + + +uno::Reference< drawing::XShape > OObjectBase::getUnoShapeOf( SdrObject& _rSdrObject ) +{ + uno::Reference< drawing::XShape > xShape( _rSdrObject.getWeakUnoShape() ); + if ( xShape.is() ) + return xShape; + + xShape = _rSdrObject.SdrObject::getUnoShape(); + if ( !xShape.is() ) + return xShape; + + ensureSdrObjectOwnership( xShape ); + + m_xKeepShapeAlive = xShape; + return xShape; +} + +OCustomShape::OCustomShape( + SdrModel& rSdrModel, + const uno::Reference< report::XReportComponent>& _xComponent) +: SdrObjCustomShape(rSdrModel) + ,OObjectBase(_xComponent) +{ + setUnoShape( uno::Reference< drawing::XShape >(_xComponent,uno::UNO_QUERY_THROW) ); + m_bIsListening = true; +} + +OCustomShape::OCustomShape( + SdrModel& rSdrModel, + const OUString& _sComponentName) +: SdrObjCustomShape(rSdrModel) + ,OObjectBase(_sComponentName) +{ + m_bIsListening = true; +} + + +OCustomShape::~OCustomShape() +{ +} + +SdrObjKind OCustomShape::GetObjIdentifier() const +{ + return SdrObjKind::CustomShape; +} + +SdrInventor OCustomShape::GetObjInventor() const +{ + return SdrInventor::ReportDesign; +} + +SdrPage* OCustomShape::GetImplPage() const +{ + return getSdrPageFromSdrObject(); +} + +void OCustomShape::NbcMove( const Size& rSize ) +{ + if ( m_bIsListening ) + { + m_bIsListening = false; + + if ( m_xReportComponent.is() ) + { + OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject())); + OXUndoEnvironment::OUndoEnvLock aLock(rRptModel.GetUndoEnv()); + m_xReportComponent->setPositionX(m_xReportComponent->getPositionX() + rSize.Width()); + m_xReportComponent->setPositionY(m_xReportComponent->getPositionY() + rSize.Height()); + } + + // set geometry properties + SetPropsFromRect(GetSnapRect()); + + m_bIsListening = true; + } + else + SdrObjCustomShape::NbcMove( rSize ); +} + +void OCustomShape::NbcResize(const Point& rRef, const Fraction& xFract, const Fraction& yFract) +{ + SdrObjCustomShape::NbcResize( rRef, xFract, yFract ); + + SetPropsFromRect(GetSnapRect()); +} + +void OCustomShape::NbcSetLogicRect(const tools::Rectangle& rRect) +{ + SdrObjCustomShape::NbcSetLogicRect(rRect); + SetPropsFromRect(rRect); +} + +bool OCustomShape::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) +{ + bool bResult = SdrObjCustomShape::EndCreate(rStat, eCmd); + if ( bResult ) + { + OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject())); + OXUndoEnvironment::OUndoEnvLock aLock(rRptModel.GetUndoEnv()); + + if ( !m_xReportComponent.is() ) + m_xReportComponent.set(getUnoShape(),uno::UNO_QUERY); + + SetPropsFromRect(GetSnapRect()); + } + + return bResult; +} + + +uno::Reference< beans::XPropertySet> OCustomShape::getAwtComponent() +{ + return m_xReportComponent; +} + + +uno::Reference< drawing::XShape > OCustomShape::getUnoShape() +{ + uno::Reference xShape = OObjectBase::getUnoShapeOf( *this ); + if ( !m_xReportComponent.is() ) + { + OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject())); + OXUndoEnvironment::OUndoEnvLock aLock(rRptModel.GetUndoEnv()); + m_xReportComponent.set(xShape,uno::UNO_QUERY); + } + return xShape; +} + +void OCustomShape::setUnoShape( const uno::Reference< drawing::XShape >& rxUnoShape ) +{ + SdrObjCustomShape::setUnoShape( rxUnoShape ); + releaseUnoShape(); + m_xReportComponent.clear(); +} + +OUnoObject::OUnoObject( + SdrModel& rSdrModel, + const OUString& _sComponentName, + const OUString& rModelName, + SdrObjKind _nObjectType) +: SdrUnoObj(rSdrModel, rModelName) + ,OObjectBase(_sComponentName) + ,m_nObjectType(_nObjectType) + // tdf#119067 + ,m_bSetDefaultLabel(false) +{ + if ( !rModelName.isEmpty() ) + impl_initializeModel_nothrow(); +} + +OUnoObject::OUnoObject( + SdrModel& rSdrModel, OUnoObject const & rSource) +: SdrUnoObj(rSdrModel, rSource) + ,OObjectBase(rSource.getServiceName()) + ,m_nObjectType(rSource.m_nObjectType) + // tdf#119067 + ,m_bSetDefaultLabel(rSource.m_bSetDefaultLabel) +{ + if ( !rSource.getUnoControlModelTypeName().isEmpty() ) + impl_initializeModel_nothrow(); + Reference xSource(const_cast(rSource).getUnoShape(), uno::UNO_QUERY); + Reference xDest(getUnoShape(), uno::UNO_QUERY); + if ( xSource.is() && xDest.is() ) + comphelper::copyProperties(xSource, xDest); +} + +OUnoObject::OUnoObject( + SdrModel& rSdrModel, + const uno::Reference< report::XReportComponent>& _xComponent, + const OUString& rModelName, + SdrObjKind _nObjectType) +: SdrUnoObj(rSdrModel, rModelName) + ,OObjectBase(_xComponent) + ,m_nObjectType(_nObjectType) + // tdf#119067 + ,m_bSetDefaultLabel(false) +{ + setUnoShape( uno::Reference< drawing::XShape >( _xComponent, uno::UNO_QUERY_THROW ) ); + + if ( !rModelName.isEmpty() ) + impl_initializeModel_nothrow(); + +} + +OUnoObject::~OUnoObject() +{ +} + +void OUnoObject::impl_initializeModel_nothrow() +{ + try + { + Reference< XFormattedField > xFormatted( m_xReportComponent, UNO_QUERY ); + if ( xFormatted.is() ) + { + const Reference< XPropertySet > xModelProps( GetUnoControlModel(), UNO_QUERY_THROW ); + xModelProps->setPropertyValue( "TreatAsNumber", Any( false ) ); + xModelProps->setPropertyValue( PROPERTY_VERTICALALIGN,m_xReportComponent->getPropertyValue(PROPERTY_VERTICALALIGN)); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION("reportdesign"); + } +} + +SdrObjKind OUnoObject::GetObjIdentifier() const +{ + return m_nObjectType; +} + +SdrInventor OUnoObject::GetObjInventor() const +{ + return SdrInventor::ReportDesign; +} + +SdrPage* OUnoObject::GetImplPage() const +{ + return getSdrPageFromSdrObject(); +} + +void OUnoObject::NbcMove( const Size& rSize ) +{ + + if ( m_bIsListening ) + { + // stop listening + OObjectBase::EndListening(); + + bool bPositionFixed = false; + Size aUndoSize(0,0); + if ( m_xReportComponent.is() ) + { + bool bUndoMode = false; + OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject())); + + if (rRptModel.GetUndoEnv().IsUndoMode()) + { + // if we are locked from outside, then we must not handle wrong moves, we are in UNDO mode + bUndoMode = true; + } + OXUndoEnvironment::OUndoEnvLock aLock(rRptModel.GetUndoEnv()); + + // LLA: why there exists getPositionX and getPositionY and NOT getPosition() which return a Point? + int nNewX = m_xReportComponent->getPositionX() + rSize.Width(); + m_xReportComponent->setPositionX(nNewX); + int nNewY = m_xReportComponent->getPositionY() + rSize.Height(); + if (nNewY < 0 && !bUndoMode) + { + aUndoSize.setHeight( abs(nNewY) ); + bPositionFixed = true; + nNewY = 0; + } + m_xReportComponent->setPositionY(nNewY); + } + if (bPositionFixed) + { + getSdrModelFromSdrObject().AddUndo(getSdrModelFromSdrObject().GetSdrUndoFactory().CreateUndoMoveObject(*this, aUndoSize)); + } + // set geometry properties + SetPropsFromRect(GetLogicRect()); + + // start listening + OObjectBase::StartListening(); + } + else + SdrUnoObj::NbcMove( rSize ); +} + + +void OUnoObject::NbcResize(const Point& rRef, const Fraction& xFract, const Fraction& yFract) +{ + SdrUnoObj::NbcResize( rRef, xFract, yFract ); + + // stop listening + OObjectBase::EndListening(); + + // set geometry properties + SetPropsFromRect(GetLogicRect()); + + // start listening + OObjectBase::StartListening(); +} + +void OUnoObject::NbcSetLogicRect(const tools::Rectangle& rRect) +{ + SdrUnoObj::NbcSetLogicRect(rRect); + // stop listening + OObjectBase::EndListening(); + + // set geometry properties + SetPropsFromRect(rRect); + + // start listening + OObjectBase::StartListening(); +} + +bool OUnoObject::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) +{ + const bool bResult(SdrUnoObj::EndCreate(rStat, eCmd)); + + if(bResult) + { + // tdf#118730 remember if this object was created interactively (due to ::EndCreate being called) + m_bSetDefaultLabel = true; + + // set geometry properties + SetPropsFromRect(GetLogicRect()); + } + + return bResult; +} + +OUString OUnoObject::GetDefaultName(const OUnoObject* _pObj) +{ + OUString aDefaultName = "HERE WE HAVE TO INSERT OUR NAME!"; + if ( _pObj->supportsService( SERVICE_FIXEDTEXT ) ) + { + aDefaultName = RID_STR_CLASS_FIXEDTEXT; + } + else if ( _pObj->supportsService( SERVICE_FIXEDLINE ) ) + { + aDefaultName = RID_STR_CLASS_FIXEDLINE; + } + else if ( _pObj->supportsService( SERVICE_IMAGECONTROL ) ) + { + aDefaultName = RID_STR_CLASS_IMAGECONTROL; + } + else if ( _pObj->supportsService( SERVICE_FORMATTEDFIELD ) ) + { + aDefaultName = RID_STR_CLASS_FORMATTEDFIELD; + } + + return aDefaultName; +} + +void OUnoObject::_propertyChange( const beans::PropertyChangeEvent& evt ) +{ + OObjectBase::_propertyChange(evt); + if (!isListening()) + return; + + if ( evt.PropertyName == PROPERTY_CHARCOLOR ) + { + Reference xControlModel(GetUnoControlModel(),uno::UNO_QUERY); + if ( xControlModel.is() ) + { + OObjectBase::EndListening(); + try + { + xControlModel->setPropertyValue(PROPERTY_TEXTCOLOR,evt.NewValue); + } + catch(uno::Exception&) + { + } + OObjectBase::StartListening(); + } + } + else if ( evt.PropertyName == PROPERTY_NAME ) + { + Reference xControlModel(GetUnoControlModel(),uno::UNO_QUERY); + if ( xControlModel.is() && xControlModel->getPropertySetInfo()->hasPropertyByName(PROPERTY_NAME) ) + { + // get old name + OUString aOldName; + evt.OldValue >>= aOldName; + + // get new name + OUString aNewName; + evt.NewValue >>= aNewName; + + if ( aNewName != aOldName ) + { + // set old name property + OObjectBase::EndListening(); + if ( m_xMediator.is() ) + m_xMediator->stopListening(); + try + { + xControlModel->setPropertyValue( PROPERTY_NAME, evt.NewValue ); + } + catch(uno::Exception&) + { + } + if ( m_xMediator.is() ) + m_xMediator->startListening(); + OObjectBase::StartListening(); + } + } + } +} + +void OUnoObject::CreateMediator(bool _bReverse) +{ + if ( m_xMediator.is() ) + return; + + // tdf#118730 Directly do things formerly done in + // OUnoObject::impl_setReportComponent_nothrow here + if(!m_xReportComponent.is()) + { + OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject())); + OXUndoEnvironment::OUndoEnvLock aLock( rRptModel.GetUndoEnv() ); + m_xReportComponent.set(getUnoShape(),uno::UNO_QUERY); + + impl_initializeModel_nothrow(); + } + + if(m_xReportComponent.is() && m_bSetDefaultLabel) + { + // tdf#118730 Directly do things formerly done in + // OUnoObject::EndCreate here + // tdf#119067 ...but *only* if result of interactive + // creation in Report DesignView + m_bSetDefaultLabel = false; + + try + { + if ( supportsService( SERVICE_FIXEDTEXT ) ) + { + m_xReportComponent->setPropertyValue( + PROPERTY_LABEL, + uno::Any(GetDefaultName(this))); + } + } + catch(const uno::Exception&) + { + DBG_UNHANDLED_EXCEPTION("reportdesign"); + } + } + + if(!m_xMediator.is() && m_xReportComponent.is()) + { + Reference xControlModel(GetUnoControlModel(),uno::UNO_QUERY); + + if(xControlModel.is()) + { + m_xMediator = new OPropertyMediator( + m_xReportComponent, + xControlModel, + TPropertyNamePair(getPropertyNameMap(GetObjIdentifier())), + _bReverse); + } + } + + OObjectBase::StartListening(); +} + +uno::Reference< beans::XPropertySet> OUnoObject::getAwtComponent() +{ + return Reference(GetUnoControlModel(),uno::UNO_QUERY); +} + + +uno::Reference< drawing::XShape > OUnoObject::getUnoShape() +{ + return OObjectBase::getUnoShapeOf( *this ); +} + +void OUnoObject::setUnoShape( const uno::Reference< drawing::XShape >& rxUnoShape ) +{ + SdrUnoObj::setUnoShape( rxUnoShape ); + releaseUnoShape(); +} + +OUnoObject* OUnoObject::CloneSdrObject(SdrModel& rTargetModel) const +{ + return new OUnoObject(rTargetModel, *this); +} + +// OOle2Obj +OOle2Obj::OOle2Obj( + SdrModel& rSdrModel, + const uno::Reference< report::XReportComponent>& _xComponent, + SdrObjKind _nType) +: SdrOle2Obj(rSdrModel) + ,OObjectBase(_xComponent) + ,m_nType(_nType) + ,m_bOnlyOnce(true) +{ + setUnoShape( uno::Reference< drawing::XShape >( _xComponent, uno::UNO_QUERY_THROW ) ); + m_bIsListening = true; +} + +OOle2Obj::OOle2Obj( + SdrModel& rSdrModel, + const OUString& _sComponentName, + SdrObjKind _nType) +: SdrOle2Obj(rSdrModel) + ,OObjectBase(_sComponentName) + ,m_nType(_nType) + ,m_bOnlyOnce(true) +{ + m_bIsListening = true; +} + +static uno::Reference< chart2::data::XDatabaseDataProvider > lcl_getDataProvider(const uno::Reference < embed::XEmbeddedObject >& _xObj); + +OOle2Obj::OOle2Obj(SdrModel& rSdrModel, OOle2Obj const & rSource) +: SdrOle2Obj(rSdrModel, rSource) + ,OObjectBase(rSource.getServiceName()) + ,m_nType(rSource.m_nType) + ,m_bOnlyOnce(rSource.m_bOnlyOnce) +{ + m_bIsListening = true; + + OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject())); + svt::EmbeddedObjectRef::TryRunningState( GetObjRef() ); + impl_createDataProvider_nothrow(rRptModel.getReportDefinition()); + + uno::Reference< chart2::data::XDatabaseDataProvider > xSource( lcl_getDataProvider(rSource.GetObjRef()) ); + uno::Reference< chart2::data::XDatabaseDataProvider > xDest( lcl_getDataProvider(GetObjRef()) ); + if ( xSource.is() && xDest.is() ) + comphelper::copyProperties(xSource, xDest); + + initializeChart(rRptModel.getReportDefinition()); +} + +OOle2Obj::~OOle2Obj() +{ +} + +SdrObjKind OOle2Obj::GetObjIdentifier() const +{ + return m_nType; +} + +SdrInventor OOle2Obj::GetObjInventor() const +{ + return SdrInventor::ReportDesign; +} + +SdrPage* OOle2Obj::GetImplPage() const +{ + return getSdrPageFromSdrObject(); +} + +void OOle2Obj::NbcMove( const Size& rSize ) +{ + + if ( m_bIsListening ) + { + // stop listening + OObjectBase::EndListening(); + + bool bPositionFixed = false; + Size aUndoSize(0,0); + if ( m_xReportComponent.is() ) + { + bool bUndoMode = false; + OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject())); + + if (rRptModel.GetUndoEnv().IsUndoMode()) + { + // if we are locked from outside, then we must not handle wrong moves, we are in UNDO mode + bUndoMode = true; + } + OXUndoEnvironment::OUndoEnvLock aLock(rRptModel.GetUndoEnv()); + + // LLA: why there exists getPositionX and getPositionY and NOT getPosition() which return a Point? + int nNewX = m_xReportComponent->getPositionX() + rSize.Width(); + // can this hinder us to set components outside the area? + // if (nNewX < 0) + // { + // nNewX = 0; + // } + m_xReportComponent->setPositionX(nNewX); + int nNewY = m_xReportComponent->getPositionY() + rSize.Height(); + if (nNewY < 0 && !bUndoMode) + { + aUndoSize.setHeight( abs(nNewY) ); + bPositionFixed = true; + nNewY = 0; + } + m_xReportComponent->setPositionY(nNewY); + } + if (bPositionFixed) + { + getSdrModelFromSdrObject().AddUndo(getSdrModelFromSdrObject().GetSdrUndoFactory().CreateUndoMoveObject(*this, aUndoSize)); + } + // set geometry properties + SetPropsFromRect(GetLogicRect()); + + // start listening + OObjectBase::StartListening(); + } + else + SdrOle2Obj::NbcMove( rSize ); +} + + +void OOle2Obj::NbcResize(const Point& rRef, const Fraction& xFract, const Fraction& yFract) +{ + SdrOle2Obj::NbcResize( rRef, xFract, yFract ); + + // stop listening + OObjectBase::EndListening(); + + // set geometry properties + SetPropsFromRect(GetLogicRect()); + + // start listening + OObjectBase::StartListening(); +} + +void OOle2Obj::NbcSetLogicRect(const tools::Rectangle& rRect) +{ + SdrOle2Obj::NbcSetLogicRect(rRect); + // stop listening + OObjectBase::EndListening(); + + // set geometry properties + SetPropsFromRect(rRect); + + // start listening + OObjectBase::StartListening(); +} + + +bool OOle2Obj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) +{ + bool bResult = SdrOle2Obj::EndCreate(rStat, eCmd); + if ( bResult ) + { + OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject())); + OXUndoEnvironment::OUndoEnvLock aLock(rRptModel.GetUndoEnv()); + + if ( !m_xReportComponent.is() ) + m_xReportComponent.set(getUnoShape(),uno::UNO_QUERY); + + // set geometry properties + SetPropsFromRect(GetLogicRect()); + } + + return bResult; +} + +uno::Reference< beans::XPropertySet> OOle2Obj::getAwtComponent() +{ + return m_xReportComponent; +} + + +uno::Reference< drawing::XShape > OOle2Obj::getUnoShape() +{ + uno::Reference< drawing::XShape> xShape = OObjectBase::getUnoShapeOf( *this ); + if ( !m_xReportComponent.is() ) + { + OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject())); + OXUndoEnvironment::OUndoEnvLock aLock(rRptModel.GetUndoEnv()); + m_xReportComponent.set(xShape,uno::UNO_QUERY); + } + return xShape; +} + +void OOle2Obj::setUnoShape( const uno::Reference< drawing::XShape >& rxUnoShape ) +{ + SdrOle2Obj::setUnoShape( rxUnoShape ); + releaseUnoShape(); + m_xReportComponent.clear(); +} + + +static uno::Reference< chart2::data::XDatabaseDataProvider > lcl_getDataProvider(const uno::Reference < embed::XEmbeddedObject >& _xObj) +{ + uno::Reference< chart2::data::XDatabaseDataProvider > xSource; + uno::Reference< embed::XComponentSupplier > xCompSupp(_xObj); + if( xCompSupp.is()) + { + uno::Reference< chart2::XChartDocument> xChartDoc( xCompSupp->getComponent(), uno::UNO_QUERY ); + if ( xChartDoc.is() ) + { + xSource.set(xChartDoc->getDataProvider(),uno::UNO_QUERY); + } + } + return xSource; +} + +// Clone() should make a complete copy of the object. +OOle2Obj* OOle2Obj::CloneSdrObject(SdrModel& rTargetModel) const +{ + return new OOle2Obj(rTargetModel, *this); +} + +void OOle2Obj::impl_createDataProvider_nothrow(const uno::Reference< frame::XModel>& _xModel) +{ + try + { + uno::Reference < embed::XEmbeddedObject > xObj = GetObjRef(); + uno::Reference< chart2::data::XDataReceiver > xReceiver; + uno::Reference< embed::XComponentSupplier > xCompSupp( xObj ); + if( xCompSupp.is()) + xReceiver.set( xCompSupp->getComponent(), uno::UNO_QUERY ); + OSL_ASSERT( xReceiver.is()); + if( xReceiver.is() ) + { + uno::Reference< lang::XMultiServiceFactory> xFac(_xModel,uno::UNO_QUERY); + uno::Reference< chart2::data::XDatabaseDataProvider > xDataProvider( xFac->createInstance("com.sun.star.chart2.data.DataProvider"),uno::UNO_QUERY); + xReceiver->attachDataProvider( xDataProvider ); + } + } + catch(const uno::Exception &) + { + } +} + +void OOle2Obj::initializeOle() +{ + if ( !m_bOnlyOnce ) + return; + + m_bOnlyOnce = false; + uno::Reference < embed::XEmbeddedObject > xObj = GetObjRef(); + OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject())); + rRptModel.GetUndoEnv().AddElement(lcl_getDataProvider(xObj)); + + uno::Reference< embed::XComponentSupplier > xCompSupp( xObj ); + if( xCompSupp.is() ) + { + uno::Reference< beans::XPropertySet > xChartProps( xCompSupp->getComponent(), uno::UNO_QUERY ); + if ( xChartProps.is() ) + xChartProps->setPropertyValue("NullDate", + uno::Any(util::DateTime(0,0,0,0,30,12,1899,false))); + } +} + +void OOle2Obj::initializeChart( const uno::Reference< frame::XModel>& _xModel) +{ + uno::Reference < embed::XEmbeddedObject > xObj = GetObjRef(); + uno::Reference< chart2::data::XDataReceiver > xReceiver; + uno::Reference< embed::XComponentSupplier > xCompSupp( xObj ); + if( xCompSupp.is()) + xReceiver.set( xCompSupp->getComponent(), uno::UNO_QUERY ); + OSL_ASSERT( xReceiver.is()); + if( !xReceiver.is() ) + return; + + // lock the model to suppress any internal updates + uno::Reference< frame::XModel > xChartModel( xReceiver, uno::UNO_QUERY ); + if( xChartModel.is() ) + xChartModel->lockControllers(); + + if ( !lcl_getDataProvider(xObj).is() ) + impl_createDataProvider_nothrow(_xModel); + + OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject())); + rRptModel.GetUndoEnv().AddElement(lcl_getDataProvider(xObj)); + + ::comphelper::NamedValueCollection aArgs; + aArgs.put( "CellRangeRepresentation", uno::Any( OUString( "all" ) ) ); + aArgs.put( "HasCategories", uno::Any( true ) ); + aArgs.put( "FirstCellAsLabel", uno::Any( true ) ); + aArgs.put( "DataRowSource", uno::Any( chart::ChartDataRowSource_COLUMNS ) ); + xReceiver->setArguments( aArgs.getPropertyValues() ); + + if( xChartModel.is() ) + xChartModel->unlockControllers(); +} + +uno::Reference< style::XStyle> getUsedStyle(const uno::Reference< report::XReportDefinition>& _xReport) +{ + uno::Reference xStyles = _xReport->getStyleFamilies(); + uno::Reference xPageStyles(xStyles->getByName("PageStyles"),uno::UNO_QUERY); + + uno::Reference< style::XStyle> xReturn; + const uno::Sequence< OUString> aSeq = xPageStyles->getElementNames(); + for(const OUString& rName : aSeq) + { + uno::Reference< style::XStyle> xStyle(xPageStyles->getByName(rName),uno::UNO_QUERY); + if ( xStyle->isInUse() ) + { + xReturn = xStyle; + break; + } + } + return xReturn; +} + + +} // rptui + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/sdr/RptObjectListener.cxx b/reportdesign/source/core/sdr/RptObjectListener.cxx new file mode 100644 index 000000000..0cc6a42b2 --- /dev/null +++ b/reportdesign/source/core/sdr/RptObjectListener.cxx @@ -0,0 +1,69 @@ +/* -*- 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 +#include + +namespace rptui +{ + +// OObjectListener + + +OObjectListener::OObjectListener(OObjectBase* _pObject) + :m_pObject(_pObject) +{ +} + + +OObjectListener::~OObjectListener() +{ +} + +// XEventListener + + +void SAL_CALL OObjectListener::disposing( const css::lang::EventObject& ) +{ +} + +// XPropertyChangeListener + + +void SAL_CALL OObjectListener::propertyChange( const css::beans::PropertyChangeEvent& evt ) +{ + m_pObject->_propertyChange( evt ); +} + + +// DlgEdHint + + +DlgEdHint::DlgEdHint(DlgEdHintKind eHint) + : eHintKind(eHint) +{ +} + + +DlgEdHint::~DlgEdHint() +{ +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/sdr/RptPage.cxx b/reportdesign/source/core/sdr/RptPage.cxx new file mode 100644 index 000000000..1ad1cb8e1 --- /dev/null +++ b/reportdesign/source/core/sdr/RptPage.cxx @@ -0,0 +1,192 @@ +/* -*- 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 +#include +#include +#include +#include + +namespace rptui +{ +using namespace ::com::sun::star; + +OReportPage::OReportPage( + OReportModel& _rModel, + const uno::Reference< report::XSection >& _xSection) +: SdrPage(_rModel, false/*bMasterPage*/) + ,rModel(_rModel) + ,m_xSection(_xSection) + ,m_bSpecialInsertMode(false) +{ +} + +OReportPage::~OReportPage() +{ +} + +rtl::Reference OReportPage::CloneSdrPage(SdrModel& rTargetModel) const +{ + OReportModel& rOReportModel(static_cast< OReportModel& >(rTargetModel)); + rtl::Reference pClonedOReportPage( + new OReportPage( + rOReportModel, + m_xSection)); + pClonedOReportPage->SdrPage::lateInit(*this); + return pClonedOReportPage; +} + + +size_t OReportPage::getIndexOf(const uno::Reference< report::XReportComponent >& _xObject) +{ + const size_t nCount = GetObjCount(); + size_t i = 0; + for (; i < nCount; ++i) + { + OObjectBase* pObj = dynamic_cast(GetObj(i)); + OSL_ENSURE(pObj,"Invalid object found!"); + if ( pObj && pObj->getReportComponent() == _xObject ) + { + break; + } + } + return i; +} + +void OReportPage::removeSdrObject(const uno::Reference< report::XReportComponent >& _xObject) +{ + size_t nPos = getIndexOf(_xObject); + if ( nPos < GetObjCount() ) + { + OObjectBase* pBase = dynamic_cast(GetObj(nPos)); + OSL_ENSURE(pBase,"Why is this not an OObjectBase?"); + if ( pBase ) + pBase->EndListening(); + RemoveObject(nPos); + } +} + +SdrObject* OReportPage::RemoveObject(size_t nObjNum) +{ + SdrObject* pObj = SdrPage::RemoveObject(nObjNum); + if (getSpecialMode()) + { + return pObj; + } + + // this code is evil, but what else shall I do + reportdesign::OSection* pSection = comphelper::getFromUnoTunnel(m_xSection); + uno::Reference< drawing::XShape> xShape(pObj->getUnoShape(),uno::UNO_QUERY); + pSection->notifyElementRemoved(xShape); + if (dynamic_cast< const OUnoObject *>( pObj ) != nullptr) + { + OUnoObject& rUnoObj = dynamic_cast(*pObj); + uno::Reference< container::XChild> xChild(rUnoObj.GetUnoControlModel(),uno::UNO_QUERY); + if ( xChild.is() ) + xChild->setParent(nullptr); + } + return pObj; +} + +void OReportPage::insertObject(const uno::Reference< report::XReportComponent >& _xObject) +{ + OSL_ENSURE(_xObject.is(),"Object is not valid to create a SdrObject!"); + if ( !_xObject.is() ) + return; + size_t nPos = getIndexOf(_xObject); + if ( nPos < GetObjCount() ) + return; // Object already in list + + OObjectBase* pObject = dynamic_cast< OObjectBase* >(SdrObject::getSdrObjectFromXShape( _xObject )); + OSL_ENSURE( pObject, "OReportPage::insertObject: no implementation object found for the given shape/component!" ); + if ( pObject ) + pObject->StartListening(); +} + + +uno::Reference< uno::XInterface > OReportPage::createUnoPage() +{ + return static_cast( new reportdesign::OReportDrawPage(this,m_xSection) ); +} + +void OReportPage::removeTempObject(SdrObject const *_pToRemoveObj) +{ + if (_pToRemoveObj) + { + for (size_t i=0; i( pObj ); + if (getSpecialMode()) + { + m_aTemporaryObjectList.push_back(pObj); + return; + } + + if ( pUnoObj ) + { + pUnoObj->CreateMediator(); + uno::Reference< container::XChild> xChild(pUnoObj->GetUnoControlModel(),uno::UNO_QUERY); + if ( xChild.is() && !xChild->getParent().is() ) + xChild->setParent(m_xSection); + } + + // this code is evil, but what else shall I do + reportdesign::OSection* pSection = comphelper::getFromUnoTunnel(m_xSection); + uno::Reference< drawing::XShape> xShape(pObj->getUnoShape(),uno::UNO_QUERY); + pSection->notifyElementAdded(xShape); + + // now that the shape is inserted into its structures, we can allow the OObjectBase + // to release the reference to it + OObjectBase* pObjectBase = dynamic_cast< OObjectBase* >( pObj ); + OSL_ENSURE( pObjectBase, "OReportPage::NbcInsertObject: what is being inserted here?" ); + if ( pObjectBase ) + pObjectBase->releaseUnoShape(); +} + +} // rptui + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/sdr/UndoActions.cxx b/reportdesign/source/core/sdr/UndoActions.cxx new file mode 100644 index 000000000..78d59e541 --- /dev/null +++ b/reportdesign/source/core/sdr/UndoActions.cxx @@ -0,0 +1,407 @@ +/* -*- 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 +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +namespace rptui +{ + using namespace ::com::sun::star; + using namespace uno; + using namespace lang; + using namespace script; + using namespace beans; + using namespace awt; + using namespace util; + using namespace container; + using namespace report; + +::std::function(OGroupHelper *)> OGroupHelper::getMemberFunction(const Reference< XSection >& _xSection) +{ + ::std::function(OGroupHelper *)> pMemFunSection = ::std::mem_fn(&OGroupHelper::getFooter); + uno::Reference< report::XGroup> xGroup = _xSection->getGroup(); + if ( xGroup->getHeaderOn() && xGroup->getHeader() == _xSection ) + pMemFunSection = ::std::mem_fn(&OGroupHelper::getHeader); + return pMemFunSection; +} + +::std::function(OReportHelper *)> OReportHelper::getMemberFunction(const Reference< XSection >& _xSection) +{ + uno::Reference< report::XReportDefinition> xReportDefinition(_xSection->getReportDefinition()); + ::std::function(OReportHelper *)> pMemFunSection = ::std::mem_fn(&OReportHelper::getReportFooter); + if ( xReportDefinition->getReportHeaderOn() && xReportDefinition->getReportHeader() == _xSection ) + pMemFunSection = ::std::mem_fn(&OReportHelper::getReportHeader); + else if ( xReportDefinition->getPageHeaderOn() && xReportDefinition->getPageHeader() == _xSection ) + pMemFunSection = ::std::mem_fn(&OReportHelper::getPageHeader); + else if ( xReportDefinition->getPageFooterOn() && xReportDefinition->getPageFooter() == _xSection ) + pMemFunSection = ::std::mem_fn(&OReportHelper::getPageFooter); + else if ( xReportDefinition->getDetail() == _xSection ) + pMemFunSection = ::std::mem_fn(&OReportHelper::getDetail); + return pMemFunSection; +} + + +OCommentUndoAction::OCommentUndoAction(SdrModel& _rMod, TranslateId pCommentID) + :SdrUndoAction(_rMod) +{ + m_pController = static_cast< OReportModel& >( _rMod ).getController(); + if (pCommentID) + m_strComment = RptResId(pCommentID); +} +OCommentUndoAction::~OCommentUndoAction() +{ +} + +void OCommentUndoAction::Undo() +{ +} + +void OCommentUndoAction::Redo() +{ +} + +OUndoContainerAction::OUndoContainerAction(SdrModel& _rMod + ,Action _eAction + ,const uno::Reference< container::XIndexContainer >& rContainer + ,const Reference< XInterface > & xElem + ,TranslateId pCommentId) + :OCommentUndoAction(_rMod, pCommentId) + ,m_xElement(xElem) + ,m_xContainer(rContainer) + ,m_eAction( _eAction ) +{ + // normalize + if ( m_eAction == Removed ) + // we now own the element + m_xOwnElement = m_xElement; +} + +OUndoContainerAction::~OUndoContainerAction() +{ + // if we own the object... + Reference< XComponent > xComp( m_xOwnElement, UNO_QUERY ); + if ( !xComp.is() ) + return; + + // and the object does not have a parent + Reference< XChild > xChild( m_xOwnElement, UNO_QUERY ); + if ( !xChild.is() || xChild->getParent().is() ) + return; + + OXUndoEnvironment& rEnv = static_cast< OReportModel& >( rMod ).GetUndoEnv(); + rEnv.RemoveElement( m_xOwnElement ); + +#if OSL_DEBUG_LEVEL > 0 + SvxShape* pShape = comphelper::getFromUnoTunnel( xChild ); + SdrObject* pObject = pShape ? pShape->GetSdrObject() : nullptr; + OSL_ENSURE( pObject == nullptr || (pShape->HasSdrObjectOwnership() && !pObject->IsInserted()), + "OUndoContainerAction::~OUndoContainerAction: inconsistency in the shape/object ownership!" ); +#endif + // -> dispose it + try + { + comphelper::disposeComponent( xComp ); + } + catch ( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION("reportdesign"); + } +} + +void OUndoContainerAction::implReInsert( ) +{ + if ( m_xContainer.is() ) + { + // insert the element + m_xContainer->insertByIndex( m_xContainer->getCount(),uno::Any(m_xElement) ); + } + // we don't own the object anymore + m_xOwnElement = nullptr; +} + + +void OUndoContainerAction::implReRemove( ) +{ + OXUndoEnvironment& rEnv = static_cast< OReportModel& >( rMod ).GetUndoEnv(); + try + { + OXUndoEnvironment::OUndoEnvLock aLock(rEnv); + if ( m_xContainer.is() ) + { + const sal_Int32 nCount = m_xContainer->getCount(); + for (sal_Int32 i = 0; i < nCount; ++i) + { + uno::Reference< uno::XInterface> xObj(m_xContainer->getByIndex(i),uno::UNO_QUERY); + if ( xObj == m_xElement ) + { + m_xContainer->removeByIndex( i ); + break; + } + } + } + } + catch(uno::Exception&){} + // from now on, we own this object + m_xOwnElement = m_xElement; +} + + +void OUndoContainerAction::Undo() +{ + if ( !m_xElement.is() ) + return; + + // prevents that an undo action will be created for elementInserted + try + { + switch ( m_eAction ) + { + case Inserted: + implReRemove(); + break; + + case Removed: + implReInsert(); + break; + default: + OSL_FAIL("Illegal case value"); + break; + } + } + catch( const Exception& ) + { + TOOLS_WARN_EXCEPTION( "reportdesign", "OUndoContainerAction::Undo" ); + } +} + + +void OUndoContainerAction::Redo() +{ + if ( !m_xElement.is() ) + return; + + try + { + switch ( m_eAction ) + { + case Inserted: + implReInsert(); + break; + + case Removed: + implReRemove(); + break; + default: + OSL_FAIL("Illegal case value"); + break; + } + } + catch( const Exception& ) + { + TOOLS_WARN_EXCEPTION( "reportdesign", "OUndoContainerAction::Redo" ); + } +} + +OUndoGroupSectionAction::OUndoGroupSectionAction( + SdrModel& _rMod, Action _eAction, + ::std::function(OGroupHelper*)> _pMemberFunction, + const uno::Reference& _xGroup, const Reference& xElem, + TranslateId pCommentId) + : OUndoContainerAction(_rMod, _eAction, nullptr, xElem, pCommentId) + , m_aGroupHelper(_xGroup) + , m_pMemberFunction(std::move(_pMemberFunction)) +{ +} + +void OUndoGroupSectionAction::implReInsert( ) +{ + OXUndoEnvironment& rEnv = static_cast< OReportModel& >( rMod ).GetUndoEnv(); + try + { + OXUndoEnvironment::OUndoEnvLock aLock(rEnv); + uno::Reference< report::XSection> xSection = m_pMemberFunction(&m_aGroupHelper); + if ( xSection.is() ) + xSection->add(uno::Reference< drawing::XShape>(m_xElement,uno::UNO_QUERY)); + } + catch(uno::Exception&){} + + // we don't own the object anymore + m_xOwnElement = nullptr; +} + + +void OUndoGroupSectionAction::implReRemove( ) +{ + OXUndoEnvironment& rEnv = static_cast< OReportModel& >( rMod ).GetUndoEnv(); + try + { + OXUndoEnvironment::OUndoEnvLock aLock(rEnv); + uno::Reference< report::XSection> xSection = m_pMemberFunction(&m_aGroupHelper); + if ( xSection.is() ) + xSection->remove(uno::Reference< drawing::XShape>(m_xElement,uno::UNO_QUERY)); + } + catch(uno::Exception&){} + + // from now on, we own this object + m_xOwnElement = m_xElement; +} + +OUndoReportSectionAction::OUndoReportSectionAction( + SdrModel& _rMod, Action _eAction, + ::std::function(OReportHelper*)> _pMemberFunction, + const uno::Reference& _xReport, const Reference& xElem, + TranslateId pCommentId) + : OUndoContainerAction(_rMod, _eAction, nullptr, xElem, pCommentId) + , m_aReportHelper(_xReport) + , m_pMemberFunction(std::move(_pMemberFunction)) +{ +} + +void OUndoReportSectionAction::implReInsert( ) +{ + OXUndoEnvironment& rEnv = static_cast< OReportModel& >( rMod ).GetUndoEnv(); + try + { + OXUndoEnvironment::OUndoEnvLock aLock(rEnv); + uno::Reference< report::XSection> xSection = m_pMemberFunction(&m_aReportHelper); + if ( xSection.is() ) + { + uno::Reference< drawing::XShape> xShape(m_xElement,uno::UNO_QUERY_THROW); + awt::Point aPos = xShape->getPosition(); + awt::Size aSize = xShape->getSize(); + xSection->add(xShape); + xShape->setPosition( aPos ); + xShape->setSize( aSize ); + } + } + catch(uno::Exception&){} + // we don't own the object anymore + m_xOwnElement = nullptr; +} + + +void OUndoReportSectionAction::implReRemove( ) +{ + OXUndoEnvironment& rEnv = static_cast< OReportModel& >( rMod ).GetUndoEnv(); + try + { + OXUndoEnvironment::OUndoEnvLock aLock(rEnv); + uno::Reference< report::XSection> xSection = m_pMemberFunction(&m_aReportHelper); + if ( xSection.is() ) + xSection->remove(uno::Reference< drawing::XShape>(m_xElement,uno::UNO_QUERY)); + } + catch(uno::Exception&){} + // from now on, we own this object + m_xOwnElement = m_xElement; +} + +ORptUndoPropertyAction::ORptUndoPropertyAction(SdrModel& rNewMod, const PropertyChangeEvent& evt) + :OCommentUndoAction(rNewMod,{}) + ,m_xObj(evt.Source, UNO_QUERY) + ,m_aPropertyName(evt.PropertyName) + ,m_aNewValue(evt.NewValue) + ,m_aOldValue(evt.OldValue) +{ +} + +void ORptUndoPropertyAction::Undo() +{ + setProperty(true); +} + + +void ORptUndoPropertyAction::Redo() +{ + setProperty(false); +} + +Reference< XPropertySet> ORptUndoPropertyAction::getObject() +{ + return m_xObj; +} + +void ORptUndoPropertyAction::setProperty(bool _bOld) +{ + Reference< XPropertySet> xObj = getObject(); + + if (xObj.is() ) + { + try + { + xObj->setPropertyValue( m_aPropertyName, _bOld ? m_aOldValue : m_aNewValue ); + } + catch( const Exception& ) + { + TOOLS_WARN_EXCEPTION( "reportdesign", "ORptUndoPropertyAction::Redo" ); + } + } +} + +OUString ORptUndoPropertyAction::GetComment() const +{ + OUString aStr( RptResId(RID_STR_UNDO_PROPERTY) ); + + return aStr.replaceFirst("#", m_aPropertyName); +} + +OUndoPropertyGroupSectionAction::OUndoPropertyGroupSectionAction( + SdrModel& _rMod, const PropertyChangeEvent& evt, + ::std::function(OGroupHelper*)> _pMemberFunction, + const uno::Reference& _xGroup) + : ORptUndoPropertyAction(_rMod, evt) + , m_aGroupHelper(_xGroup) + , m_pMemberFunction(std::move(_pMemberFunction)) +{ +} + +Reference< XPropertySet> OUndoPropertyGroupSectionAction::getObject() +{ + return m_pMemberFunction(&m_aGroupHelper); +} + +OUndoPropertyReportSectionAction::OUndoPropertyReportSectionAction( + SdrModel& _rMod, const PropertyChangeEvent& evt, + ::std::function(OReportHelper*)> _pMemberFunction, + const uno::Reference& _xReport) + : ORptUndoPropertyAction(_rMod, evt) + , m_aReportHelper(_xReport) + , m_pMemberFunction(std::move(_pMemberFunction)) +{ +} + +Reference< XPropertySet> OUndoPropertyReportSectionAction::getObject() +{ + return m_pMemberFunction(&m_aReportHelper); +} + +} // rptui + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/sdr/UndoEnv.cxx b/reportdesign/source/core/sdr/UndoEnv.cxx new file mode 100644 index 000000000..2585d4a20 --- /dev/null +++ b/reportdesign/source/core/sdr/UndoEnv.cxx @@ -0,0 +1,619 @@ +/* -*- 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 +#include +#include "formatnormalizer.hxx" +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +namespace rptui +{ + using namespace ::com::sun::star; + using namespace uno; + using namespace lang; + using namespace script; + using namespace beans; + using namespace awt; + using namespace util; + using namespace container; + using namespace report; + +namespace { + +struct PropertyInfo +{ + bool bIsReadonlyOrTransient; + + explicit PropertyInfo( const bool i_bIsTransientOrReadOnly ) + :bIsReadonlyOrTransient( i_bIsTransientOrReadOnly ) + { + } +}; + +} + +typedef std::unordered_map< OUString, PropertyInfo > PropertiesInfo; + +namespace { + +struct ObjectInfo +{ + PropertiesInfo aProperties; + Reference< XPropertySet > xPropertyIntrospection; + + ObjectInfo() + { + } +}; + +} + +typedef ::std::map< Reference< XPropertySet >, ObjectInfo > PropertySetInfoCache; + + +class OXUndoEnvironmentImpl +{ +public: + OReportModel& m_rModel; + PropertySetInfoCache m_aPropertySetCache; + FormatNormalizer m_aFormatNormalizer; + ConditionUpdater m_aConditionUpdater; + ::osl::Mutex m_aMutex; + ::std::vector< uno::Reference< container::XChild> > m_aSections; + Reference< XIntrospection > m_xIntrospection; + oslInterlockedCount m_nLocks; + bool m_bReadOnly; + bool m_bIsUndo; + + explicit OXUndoEnvironmentImpl(OReportModel& _rModel); + OXUndoEnvironmentImpl(const OXUndoEnvironmentImpl&) = delete; + OXUndoEnvironmentImpl& operator=(const OXUndoEnvironmentImpl&) = delete; +}; + +OXUndoEnvironmentImpl::OXUndoEnvironmentImpl(OReportModel& _rModel) : m_rModel(_rModel) + ,m_aFormatNormalizer( _rModel ) + ,m_nLocks(0) + ,m_bReadOnly(false) + ,m_bIsUndo(false) +{ +} + + +OXUndoEnvironment::OXUndoEnvironment(OReportModel& _rModel) + :m_pImpl(new OXUndoEnvironmentImpl(_rModel) ) +{ + StartListening(m_pImpl->m_rModel); +} + + +OXUndoEnvironment::~OXUndoEnvironment() +{ +} + +void OXUndoEnvironment::Lock() +{ + OSL_ENSURE(m_refCount,"Illegal call to dead object!"); + osl_atomic_increment( &m_pImpl->m_nLocks ); +} +void OXUndoEnvironment::UnLock() +{ + OSL_ENSURE(m_refCount,"Illegal call to dead object!"); + + osl_atomic_decrement( &m_pImpl->m_nLocks ); +} +bool OXUndoEnvironment::IsLocked() const { return m_pImpl->m_nLocks != 0; } + +void OXUndoEnvironment::RemoveSection(OReportPage const * _pPage) +{ + if ( _pPage ) + { + Reference< XInterface > xSection(_pPage->getSection()); + if ( xSection.is() ) + RemoveElement( xSection ); + } +} + +void OXUndoEnvironment::Clear(const Accessor& /*_r*/) +{ + OUndoEnvLock aLock(*this); + + m_pImpl->m_aPropertySetCache.clear(); + + sal_uInt16 nCount = m_pImpl->m_rModel.GetPageCount(); + sal_uInt16 i; + for (i = 0; i < nCount; i++) + { + OReportPage* pPage = dynamic_cast( m_pImpl->m_rModel.GetPage(i) ); + RemoveSection(pPage); + } + + nCount = m_pImpl->m_rModel.GetMasterPageCount(); + for (i = 0; i < nCount; i++) + { + OReportPage* pPage = dynamic_cast( m_pImpl->m_rModel.GetMasterPage(i) ); + RemoveSection(pPage); + } + + m_pImpl->m_aSections.clear(); + + if (IsListening(m_pImpl->m_rModel)) + EndListening(m_pImpl->m_rModel); +} + + +void OXUndoEnvironment::ModeChanged() +{ + m_pImpl->m_bReadOnly = !m_pImpl->m_bReadOnly; + + if (!m_pImpl->m_bReadOnly) + StartListening(m_pImpl->m_rModel); + else + EndListening(m_pImpl->m_rModel); +} + + +void OXUndoEnvironment::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) +{ + if (rHint.GetId() == SfxHintId::ModeChanged ) + ModeChanged(); +} + +// XEventListener + +void SAL_CALL OXUndoEnvironment::disposing(const EventObject& e) +{ + // check if it's an object we have cached information about + Reference< XPropertySet > xSourceSet(e.Source, UNO_QUERY); + if ( xSourceSet.is() ) + { + uno::Reference< report::XSection> xSection(xSourceSet,uno::UNO_QUERY); + if ( xSection.is() ) + RemoveSection(xSection); + else + RemoveElement(xSourceSet); + } +} + +// XPropertyChangeListener + +void SAL_CALL OXUndoEnvironment::propertyChange( const PropertyChangeEvent& _rEvent ) +{ + + ::osl::ClearableMutexGuard aGuard( m_pImpl->m_aMutex ); + + if ( IsLocked() ) + return; + + Reference< XPropertySet > xSet( _rEvent.Source, UNO_QUERY ); + if (!xSet.is()) + return; + + dbaui::DBSubComponentController* pController = m_pImpl->m_rModel.getController(); + if ( !pController ) + return; + + // no Undo for transient and readonly props. + // let's see if we know something about the set + PropertySetInfoCache::iterator objectPos = m_pImpl->m_aPropertySetCache.find(xSet); + if (objectPos == m_pImpl->m_aPropertySetCache.end()) + { + objectPos = m_pImpl->m_aPropertySetCache.emplace( xSet, ObjectInfo() ).first; + DBG_ASSERT(objectPos != m_pImpl->m_aPropertySetCache.end(), "OXUndoEnvironment::propertyChange : just inserted it... why it's not there?"); + } + if ( objectPos == m_pImpl->m_aPropertySetCache.end() ) + return; + + // now we have access to the cached info about the set + // let's see what we know about the property + ObjectInfo& rObjectInfo = objectPos->second; + PropertiesInfo::const_iterator aPropertyPos = rObjectInfo.aProperties.find( _rEvent.PropertyName ); + if ( aPropertyPos == rObjectInfo.aProperties.end() ) + { // nothing 'til now... have to change this... + // the attributes + Reference< XPropertySetInfo > xPSI( xSet->getPropertySetInfo(), UNO_SET_THROW ); + sal_Int32 nPropertyAttributes = 0; + try + { + if ( xPSI->hasPropertyByName( _rEvent.PropertyName ) ) + { + nPropertyAttributes = xPSI->getPropertyByName( _rEvent.PropertyName ).Attributes; + } + else + { + // it's perfectly valid for a component to notify a change in a property which it doesn't have - as long + // as it has an attribute with this name + if ( !rObjectInfo.xPropertyIntrospection.is() ) + { + if ( !m_pImpl->m_xIntrospection.is() ) + { + m_pImpl->m_xIntrospection = theIntrospection::get( m_pImpl->m_rModel.getController()->getORB() ); + } + Reference< XIntrospectionAccess > xIntrospection( + m_pImpl->m_xIntrospection->inspect( Any( _rEvent.Source ) ), + UNO_SET_THROW + ); + rObjectInfo.xPropertyIntrospection.set( xIntrospection->queryAdapter( cppu::UnoType::get() ), UNO_QUERY_THROW ); + } + if ( rObjectInfo.xPropertyIntrospection.is() ) + { + xPSI.set( rObjectInfo.xPropertyIntrospection->getPropertySetInfo(), UNO_SET_THROW ); + nPropertyAttributes = xPSI->getPropertyByName( _rEvent.PropertyName ).Attributes; + } + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION("reportdesign"); + } + const bool bTransReadOnly = + ( ( nPropertyAttributes & PropertyAttribute::READONLY ) != 0 ) + || ( ( nPropertyAttributes & PropertyAttribute::TRANSIENT ) != 0 ); + + // insert the new entry + aPropertyPos = rObjectInfo.aProperties.emplace( + _rEvent.PropertyName, + PropertyInfo( bTransReadOnly ) + ).first; + DBG_ASSERT(aPropertyPos != rObjectInfo.aProperties.end(), "OXUndoEnvironment::propertyChange : just inserted it ... why it's not there ?"); + } + + implSetModified(); + + // now we have access to the cached info about the property affected + // and are able to decide whether or not we need an undo action + + // no UNDO for transient/readonly properties + if ( aPropertyPos->second.bIsReadonlyOrTransient ) + return; + + // give components with sub responsibilities a chance + m_pImpl->m_aFormatNormalizer.notifyPropertyChange( _rEvent ); + m_pImpl->m_aConditionUpdater.notifyPropertyChange( _rEvent ); + + aGuard.clear(); + // TODO: this is a potential race condition: two threads here could in theory + // add their undo actions out-of-order + + SolarMutexGuard aSolarGuard; + std::unique_ptr pUndo; + try + { + uno::Reference< report::XSection> xSection( xSet, uno::UNO_QUERY ); + if ( xSection.is() ) + { + uno::Reference< report::XGroup> xGroup = xSection->getGroup(); + if ( xGroup.is() ) + pUndo.reset(new OUndoPropertyGroupSectionAction( m_pImpl->m_rModel, _rEvent, OGroupHelper::getMemberFunction( xSection ), xGroup )); + else + pUndo.reset(new OUndoPropertyReportSectionAction( m_pImpl->m_rModel, _rEvent, OReportHelper::getMemberFunction( xSection ), xSection->getReportDefinition() )); + } + } + catch(const Exception&) + { + DBG_UNHANDLED_EXCEPTION("reportdesign"); + } + + if ( pUndo == nullptr ) + pUndo.reset(new ORptUndoPropertyAction( m_pImpl->m_rModel, _rEvent )); + + m_pImpl->m_rModel.GetSdrUndoManager()->AddUndoAction( std::move(pUndo) ); + pController->InvalidateAll(); +} + +::std::vector< uno::Reference< container::XChild> >::const_iterator OXUndoEnvironment::getSection(const Reference& _xContainer) const +{ + ::std::vector< uno::Reference< container::XChild> >::const_iterator aFind = m_pImpl->m_aSections.end(); + if ( _xContainer.is() ) + { + aFind = ::std::find(m_pImpl->m_aSections.begin(),m_pImpl->m_aSections.end(),_xContainer); + + if ( aFind == m_pImpl->m_aSections.end() ) + { + Reference xParent(_xContainer->getParent(),uno::UNO_QUERY); + aFind = getSection(xParent); + } + } + return aFind; +} +// XContainerListener + +void SAL_CALL OXUndoEnvironment::elementInserted(const ContainerEvent& evt) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_pImpl->m_aMutex ); + + // new listener object + Reference< uno::XInterface > xIface( evt.Element, UNO_QUERY ); + if ( !IsLocked() ) + { + Reference< report::XReportComponent > xReportComponent( xIface, UNO_QUERY ); + if ( xReportComponent.is() ) + { + Reference< report::XSection > xContainer(evt.Source,uno::UNO_QUERY); + + ::std::vector< uno::Reference< container::XChild> >::const_iterator aFind = getSection(xContainer); + + if ( aFind != m_pImpl->m_aSections.end() ) + { + OUndoEnvLock aLock(*this); + try + { + OReportPage* pPage = m_pImpl->m_rModel.getPage(uno::Reference< report::XSection>(*aFind,uno::UNO_QUERY)); + OSL_ENSURE(pPage,"No page could be found for section!"); + if ( pPage ) + pPage->insertObject(xReportComponent); + } + catch(uno::Exception&) + { + DBG_UNHANDLED_EXCEPTION("reportdesign"); + } + + } + } + else + { + uno::Reference< report::XFunctions> xContainer(evt.Source,uno::UNO_QUERY); + if ( xContainer.is() ) + { + m_pImpl->m_rModel.GetSdrUndoManager()->AddUndoAction( + std::make_unique( m_pImpl->m_rModel, rptui::Inserted, xContainer.get(), + xIface, RID_STR_UNDO_ADDFUNCTION ) ); + } + } + } + + AddElement(xIface); + + implSetModified(); +} + + +void OXUndoEnvironment::implSetModified() +{ + m_pImpl->m_rModel.SetModified( true ); +} + + +void SAL_CALL OXUndoEnvironment::elementReplaced(const ContainerEvent& evt) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_pImpl->m_aMutex ); + + Reference< XInterface > xIface(evt.ReplacedElement,uno::UNO_QUERY); + OSL_ENSURE(xIface.is(), "OXUndoEnvironment::elementReplaced: invalid container notification!"); + RemoveElement(xIface); + + xIface.set(evt.Element,uno::UNO_QUERY); + AddElement(xIface); + + implSetModified(); +} + + +void SAL_CALL OXUndoEnvironment::elementRemoved(const ContainerEvent& evt) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_pImpl->m_aMutex ); + + Reference< uno::XInterface > xIface( evt.Element, UNO_QUERY ); + if ( !IsLocked() ) + { + Reference< report::XSection > xContainer(evt.Source,uno::UNO_QUERY); + ::std::vector< uno::Reference< container::XChild> >::const_iterator aFind = getSection(xContainer); + + Reference< report::XReportComponent > xReportComponent( xIface, UNO_QUERY ); + if ( aFind != m_pImpl->m_aSections.end() && xReportComponent.is() ) + { + OXUndoEnvironment::OUndoEnvLock aLock(*this); + try + { + OReportPage* pPage = m_pImpl->m_rModel.getPage(uno::Reference< report::XSection >( *aFind, uno::UNO_QUERY_THROW ) ); + OSL_ENSURE( pPage, "OXUndoEnvironment::elementRemoved: no page for the section!" ); + if ( pPage ) + pPage->removeSdrObject(xReportComponent); + } + catch(const uno::Exception&) + { + DBG_UNHANDLED_EXCEPTION("reportdesign"); + } + } + else + { + uno::Reference< report::XFunctions> xFunctions(evt.Source,uno::UNO_QUERY); + if ( xFunctions.is() ) + { + m_pImpl->m_rModel.GetSdrUndoManager()->AddUndoAction( std::make_unique( + m_pImpl->m_rModel, rptui::Removed, xFunctions.get(), xIface, RID_STR_UNDO_ADDFUNCTION ) ); + } + } + } + + if ( xIface.is() ) + RemoveElement(xIface); + + implSetModified(); +} + + +void SAL_CALL OXUndoEnvironment::modified( const EventObject& /*aEvent*/ ) +{ + implSetModified(); +} + + +void OXUndoEnvironment::AddSection(const Reference< report::XSection > & _xSection) +{ + OUndoEnvLock aLock(*this); + try + { + uno::Reference xChild = _xSection; + m_pImpl->m_aSections.push_back(xChild); + Reference< XInterface > xInt(_xSection); + AddElement(xInt); + } + catch(const uno::Exception&) + { + DBG_UNHANDLED_EXCEPTION("reportdesign"); + } +} + + +void OXUndoEnvironment::RemoveSection(const Reference< report::XSection > & _xSection) +{ + OUndoEnvLock aLock(*this); + try + { + uno::Reference xChild(_xSection); + m_pImpl->m_aSections.erase(::std::remove(m_pImpl->m_aSections.begin(),m_pImpl->m_aSections.end(), + xChild), m_pImpl->m_aSections.end()); + Reference< XInterface > xInt(_xSection); + RemoveElement(xInt); + } + catch(uno::Exception&){} +} + + +void OXUndoEnvironment::switchListening( const Reference< XIndexAccess >& _rxContainer, bool _bStartListening ) +{ + OSL_PRECOND( _rxContainer.is(), "OXUndoEnvironment::switchListening: invalid container!" ); + if ( !_rxContainer.is() ) + return; + + try + { + // also handle all children of this element + Reference< XInterface > xInterface; + sal_Int32 nCount = _rxContainer->getCount(); + for(sal_Int32 i = 0;i != nCount;++i) + { + xInterface.set(_rxContainer->getByIndex( i ),uno::UNO_QUERY); + if ( _bStartListening ) + AddElement( xInterface ); + else + RemoveElement( xInterface ); + } + + // be notified of any changes in the container elements + Reference< XContainer > xSimpleContainer( _rxContainer, UNO_QUERY ); + if ( xSimpleContainer.is() ) + { + if ( _bStartListening ) + xSimpleContainer->addContainerListener( this ); + else + xSimpleContainer->removeContainerListener( this ); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION("reportdesign"); + } +} + + +void OXUndoEnvironment::switchListening( const Reference< XInterface >& _rxObject, bool _bStartListening ) +{ + OSL_PRECOND( _rxObject.is(), "OXUndoEnvironment::switchListening: how should I listen at a NULL object?" ); + + try + { + if ( !m_pImpl->m_bReadOnly ) + { + Reference< XPropertySet > xProps( _rxObject, UNO_QUERY ); + if ( xProps.is() ) + { + if ( _bStartListening ) + xProps->addPropertyChangeListener( OUString(), this ); + else + xProps->removePropertyChangeListener( OUString(), this ); + } + } + + Reference< XModifyBroadcaster > xBroadcaster( _rxObject, UNO_QUERY ); + if ( xBroadcaster.is() ) + { + if ( _bStartListening ) + xBroadcaster->addModifyListener( this ); + else + xBroadcaster->removeModifyListener( this ); + } + } + catch( const Exception& ) + { + } +} + + +void OXUndoEnvironment::AddElement(const Reference< XInterface >& _rxElement ) +{ + if ( !IsLocked() ) + m_pImpl->m_aFormatNormalizer.notifyElementInserted( _rxElement ); + + // if it's a container, start listening at all elements + Reference< XIndexAccess > xContainer( _rxElement, UNO_QUERY ); + if ( xContainer.is() ) + switchListening( xContainer, true ); + + switchListening( _rxElement, true ); +} + + +void OXUndoEnvironment::RemoveElement(const Reference< XInterface >& _rxElement) +{ + uno::Reference xProp(_rxElement,uno::UNO_QUERY); + if (!m_pImpl->m_aPropertySetCache.empty()) + m_pImpl->m_aPropertySetCache.erase(xProp); + switchListening( _rxElement, false ); + + Reference< XIndexAccess > xContainer( _rxElement, UNO_QUERY ); + if ( xContainer.is() ) + switchListening( xContainer, false ); +} + +void OXUndoEnvironment::SetUndoMode(bool _bUndo) +{ + m_pImpl->m_bIsUndo = _bUndo; +} + +bool OXUndoEnvironment::IsUndoMode() const +{ + return m_pImpl->m_bIsUndo; +} + +} // rptui + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/sdr/formatnormalizer.cxx b/reportdesign/source/core/sdr/formatnormalizer.cxx new file mode 100644 index 000000000..ae576bc40 --- /dev/null +++ b/reportdesign/source/core/sdr/formatnormalizer.cxx @@ -0,0 +1,258 @@ +/* -*- 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 "formatnormalizer.hxx" +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + + +namespace rptui +{ + + + using ::com::sun::star::uno::Reference; + using ::com::sun::star::report::XFormattedField; + using ::com::sun::star::uno::UNO_QUERY; + using ::com::sun::star::sdb::XSingleSelectQueryComposer; + using ::com::sun::star::sdbcx::XColumnsSupplier; + using ::com::sun::star::container::XIndexAccess; + using ::com::sun::star::beans::XPropertySet; + using ::com::sun::star::uno::UNO_QUERY_THROW; + using ::com::sun::star::uno::Exception; + using ::com::sun::star::sdb::XParametersSupplier; + using ::com::sun::star::sdbc::SQLException; + using ::com::sun::star::util::XNumberFormatsSupplier; + using ::com::sun::star::util::XNumberFormatTypes; + + + //= FormatNormalizer + + + FormatNormalizer::FormatNormalizer( const OReportModel& _rModel ) + :m_rModel( _rModel ) + ,m_bFieldListDirty( true ) + { + } + + + FormatNormalizer::~FormatNormalizer() + { + } + + + void FormatNormalizer::notifyPropertyChange( const css::beans::PropertyChangeEvent& _rEvent ) + { + if ( !impl_lateInit() ) + return; + + if ( ( _rEvent.Source == m_xReportDefinition ) && m_xReportDefinition.is() ) + { + impl_onDefinitionPropertyChange( _rEvent.PropertyName ); + return; + } + + Reference< XFormattedField > xFormatted( _rEvent.Source, UNO_QUERY ); + if ( xFormatted.is() ) + impl_onFormattedProperttyChange( xFormatted, _rEvent.PropertyName ); + } + + + void FormatNormalizer::notifyElementInserted( const css::uno::Reference< css::uno::XInterface >& _rxElement ) + { + if ( !impl_lateInit() ) + return; + + Reference< XFormattedField > xFormatted( _rxElement, UNO_QUERY ); + if ( !xFormatted.is() ) + return; + + impl_adjustFormatToDataFieldType_nothrow( xFormatted ); + } + + + bool FormatNormalizer::impl_lateInit() + { + if ( m_xReportDefinition.is() ) + return true; + + m_xReportDefinition = m_rModel.getReportDefinition(); + return m_xReportDefinition.is(); + } + + + void FormatNormalizer::impl_onDefinitionPropertyChange( std::u16string_view _rChangedPropName ) + { + if ( _rChangedPropName != u"Command" && _rChangedPropName != u"CommandType" && _rChangedPropName != u"EscapeProcessing" ) + // nothing we're interested in + return; + m_bFieldListDirty = true; + } + + + void FormatNormalizer::impl_onFormattedProperttyChange( const Reference< XFormattedField >& _rxFormatted, std::u16string_view _rChangedPropName ) + { + if ( _rChangedPropName != u"DataField" ) + // nothing we're interested in + return; + + impl_adjustFormatToDataFieldType_nothrow( _rxFormatted ); + } + + + namespace + { + void lcl_collectFields_throw( const Reference< XIndexAccess >& _rxColumns, FormatNormalizer::FieldList& _inout_rFields ) + { + try + { + sal_Int32 nCount( _rxColumns->getCount() ); + _inout_rFields.reserve( _inout_rFields.size() + static_cast(nCount) ); + + Reference< XPropertySet > xColumn; + FormatNormalizer::Field aField; + + for ( sal_Int32 i=0; igetByIndex( i ), UNO_QUERY_THROW ); + OSL_VERIFY( xColumn->getPropertyValue("Name") >>= aField.sName ); + OSL_VERIFY( xColumn->getPropertyValue("Type") >>= aField.nDataType ); + OSL_VERIFY( xColumn->getPropertyValue("Scale") >>= aField.nScale ); + OSL_VERIFY( xColumn->getPropertyValue("IsCurrency") >>= aField.bIsCurrency ); + _inout_rFields.push_back( aField ); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION("reportdesign"); + } + } + } + + + bool FormatNormalizer::impl_ensureUpToDateFieldList_nothrow() + { + if ( !m_bFieldListDirty ) + return true; + m_aFields.resize( 0 ); + + OSL_PRECOND( m_xReportDefinition.is(), "FormatNormalizer::impl_ensureUpToDateFieldList_nothrow: no report definition!" ); + if ( !m_xReportDefinition.is() ) + return false; + + ::dbaui::DBSubComponentController* pController( m_rModel.getController() ); + OSL_ENSURE( pController, "FormatNormalizer::impl_ensureUpToDateFieldList_nothrow: no controller? how can *this* happen?!" ); + if ( !pController ) + return false; + + try + { + ::dbtools::StatementComposer aComposer( pController->getConnection(), m_xReportDefinition->getCommand(), + m_xReportDefinition->getCommandType(), m_xReportDefinition->getEscapeProcessing() ); + + Reference< XSingleSelectQueryComposer > xComposer( aComposer.getComposer() ); + if ( !xComposer.is() ) + return false; + + + Reference< XColumnsSupplier > xSuppCols( xComposer, UNO_QUERY_THROW ); + Reference< XIndexAccess > xColumns( xSuppCols->getColumns(), UNO_QUERY_THROW ); + lcl_collectFields_throw( xColumns, m_aFields ); + + Reference< XParametersSupplier > xSuppParams( xComposer, UNO_QUERY_THROW ); + Reference< XIndexAccess > xParams( xSuppParams->getParameters(), css::uno::UNO_SET_THROW ); + lcl_collectFields_throw( xParams, m_aFields ); + } + catch( const SQLException& ) + { + // silence it. This might happen for instance when the user sets a non-existent table, + // or things like this + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION("reportdesign"); + } + + m_bFieldListDirty = false; + return true; + } + + + void FormatNormalizer::impl_adjustFormatToDataFieldType_nothrow( const Reference< XFormattedField >& _rxFormatted ) + { + if ( !impl_ensureUpToDateFieldList_nothrow() ) + // unable to obtain a recent field list + return; + + try + { + sal_Int32 nFormatKey = _rxFormatted->getFormatKey(); + if ( nFormatKey != 0 ) + // it's not the "standard numeric" format -> not interested in + return; + + OUString sDataField( _rxFormatted->getDataField() ); + static const OUStringLiteral sFieldPrefix( u"field:[" ); + if ( sDataField.indexOf( sFieldPrefix ) != 0 ) + // not bound to a table field + // TODO: we might also do this kind of thing for functions and expressions ... + return; + if ( !sDataField.endsWith("]") ) + { + // last character is not the closing brace + OSL_FAIL( "FormatNormalizer::impl_adjustFormatToDataFieldType_nothrow: suspicious data field value!" ); + return; + } + sDataField = sDataField.copy( sFieldPrefix.getLength(), sDataField.getLength() - sFieldPrefix.getLength() - 1 ); + + FieldList::const_iterator field = std::find_if(m_aFields.begin(), m_aFields.end(), + [&sDataField](const Field& rField) { return rField.sName == sDataField; }); + if ( field == m_aFields.end() ) + // unknown field + return; + + Reference< XNumberFormatsSupplier > xSuppNumFmts( _rxFormatted->getFormatsSupplier(), css::uno::UNO_SET_THROW ); + Reference< XNumberFormatTypes > xNumFmtTypes( xSuppNumFmts->getNumberFormats(), UNO_QUERY_THROW ); + + nFormatKey = ::dbtools::getDefaultNumberFormat( field->nDataType, field->nScale, field->bIsCurrency, xNumFmtTypes, + SvtSysLocale().GetLanguageTag().getLocale() ); + _rxFormatted->setFormatKey( nFormatKey ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION("reportdesign"); + } + } + + +} // namespace rptui + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/sdr/formatnormalizer.hxx b/reportdesign/source/core/sdr/formatnormalizer.hxx new file mode 100644 index 000000000..0ed30df3e --- /dev/null +++ b/reportdesign/source/core/sdr/formatnormalizer.hxx @@ -0,0 +1,86 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_SDR_FORMATNORMALIZER_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_CORE_SDR_FORMATNORMALIZER_HXX + +#include +#include +#include + +#include + + +namespace rptui +{ + + + class OReportModel; + + //= FormatNormalizer + + class FormatNormalizer + { + public: + struct Field + { + OUString sName; + sal_Int32 nDataType; + sal_Int32 nScale; + bool bIsCurrency; + + Field() : sName(), nDataType( 0 ), nScale( 0 ), bIsCurrency( false ) { } + }; + typedef ::std::vector< Field > FieldList; + + private: + const OReportModel& m_rModel; + css::uno::Reference< css::report::XReportDefinition > m_xReportDefinition; + + /// is our field list dirty? + FieldList m_aFields; + bool m_bFieldListDirty; + + public: + explicit FormatNormalizer( const OReportModel& _rModel ); + ~FormatNormalizer(); + FormatNormalizer(const FormatNormalizer&) = delete; + FormatNormalizer& operator=(const FormatNormalizer&) = delete; + + void notifyPropertyChange( const css::beans::PropertyChangeEvent& _rEvent ); + void notifyElementInserted( const css::uno::Reference< css::uno::XInterface >& _rxElement ); + + private: + bool impl_lateInit(); + + void impl_onDefinitionPropertyChange( std::u16string_view _rChangedPropName ); + void impl_onFormattedProperttyChange( const css::uno::Reference< css::report::XFormattedField >& _rxFormatted, std::u16string_view _rChangedPropName ); + + bool impl_ensureUpToDateFieldList_nothrow(); + + void impl_adjustFormatToDataFieldType_nothrow( const css::uno::Reference< css::report::XFormattedField >& _rxFormatted ); + }; + + +} // namespace rptui + + +#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_SDR_FORMATNORMALIZER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3