diff options
Diffstat (limited to 'reportdesign/source/core/api')
18 files changed, 0 insertions, 8128 deletions
diff --git a/reportdesign/source/core/api/FixedLine.cxx b/reportdesign/source/core/api/FixedLine.cxx deleted file mode 100644 index 2cd1c8eb6..000000000 --- a/reportdesign/source/core/api/FixedLine.cxx +++ /dev/null @@ -1,583 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_reportdesign.hxx" -#include "FixedLine.hxx" -#include <com/sun/star/beans/PropertyAttribute.hpp> -#include "corestrings.hrc" -#include "core_resource.hrc" -#include "core_resource.hxx" -#include <comphelper/sequence.hxx> -#include <tools/debug.hxx> -#include <comphelper/property.hxx> -#include "Tools.hxx" -#include "FormatCondition.hxx" -#include <com/sun/star/beans/XPropertyState.hpp> -#include <com/sun/star/text/ParagraphVertAlign.hpp> -#include <boost/bind.hpp> -#include "ReportHelperImpl.hxx" - -#define MIN_WIDTH 80 -#define MIN_HEIGHT 20 -// ============================================================================= -namespace reportdesign -{ -// ============================================================================= - using namespace com::sun::star; - using namespace comphelper; -uno::Sequence< ::rtl::OUString > lcl_getLineOptionals() -{ - ::rtl::OUString pProps[] = { - PROPERTY_DATAFIELD - ,PROPERTY_DEFAULTCONTROL - ,PROPERTY_CONTROLBORDER - ,PROPERTY_CONTROLBORDERCOLOR - ,PROPERTY_CHARCOLOR - ,PROPERTY_CHAREMPHASIS - ,PROPERTY_CHARFONTCHARSET - ,PROPERTY_CHARFONTFAMILY - ,PROPERTY_CHARFONTNAME - ,PROPERTY_CHARFONTPITCH - ,PROPERTY_CHARFONTSTYLENAME - ,PROPERTY_CHARHEIGHT - ,PROPERTY_CHARPOSTURE - ,PROPERTY_CHARRELIEF - ,PROPERTY_FONTDESCRIPTOR - ,PROPERTY_FONTDESCRIPTORASIAN - ,PROPERTY_FONTDESCRIPTORCOMPLEX - ,PROPERTY_CONTROLTEXTEMPHASISMARK - ,PROPERTY_CHARROTATION - ,PROPERTY_CHARSCALEWIDTH - ,PROPERTY_CHARSTRIKEOUT - ,PROPERTY_CHARUNDERLINECOLOR - ,PROPERTY_CHARUNDERLINE - ,PROPERTY_CHARWEIGHT - ,PROPERTY_CHARWORDMODE - ,PROPERTY_CONTROLBACKGROUND - ,PROPERTY_CONTROLBACKGROUNDTRANSPARENT - ,PROPERTY_CHARFLASH - ,PROPERTY_CHARAUTOKERNING - ,PROPERTY_CHARESCAPEMENTHEIGHT - ,PROPERTY_CHARLOCALE - ,PROPERTY_CHARESCAPEMENT - ,PROPERTY_CHARCASEMAP - ,PROPERTY_CHARCOMBINEISON - ,PROPERTY_CHARCOMBINEPREFIX - ,PROPERTY_CHARCOMBINESUFFIX - ,PROPERTY_CHARHIDDEN - ,PROPERTY_CHARSHADOWED - ,PROPERTY_CHARCONTOURED - ,PROPERTY_HYPERLINKURL - ,PROPERTY_HYPERLINKTARGET - ,PROPERTY_HYPERLINKNAME - ,PROPERTY_VISITEDCHARSTYLENAME - ,PROPERTY_UNVISITEDCHARSTYLENAME - ,PROPERTY_CHARKERNING - ,PROPERTY_PRINTREPEATEDVALUES - ,PROPERTY_CONDITIONALPRINTEXPRESSION - ,PROPERTY_PRINTWHENGROUPCHANGE - ,PROPERTY_MASTERFIELDS - ,PROPERTY_DETAILFIELDS - ,PROPERTY_PARAADJUST - - , PROPERTY_CHAREMPHASISASIAN - , PROPERTY_CHARFONTNAMEASIAN - , PROPERTY_CHARFONTSTYLENAMEASIAN - , PROPERTY_CHARFONTFAMILYASIAN - , PROPERTY_CHARFONTCHARSETASIAN - , PROPERTY_CHARFONTPITCHASIAN - , PROPERTY_CHARHEIGHTASIAN - , PROPERTY_CHARUNDERLINEASIAN - , PROPERTY_CHARWEIGHTASIAN - , PROPERTY_CHARPOSTUREASIAN - , PROPERTY_CHARWORDMODEASIAN - , PROPERTY_CHARROTATIONASIAN - , PROPERTY_CHARSCALEWIDTHASIAN - , PROPERTY_CHARLOCALEASIAN - , PROPERTY_CHAREMPHASISCOMPLEX - , PROPERTY_CHARFONTNAMECOMPLEX - , PROPERTY_CHARFONTSTYLENAMECOMPLEX - , PROPERTY_CHARFONTFAMILYCOMPLEX - , PROPERTY_CHARFONTCHARSETCOMPLEX - , PROPERTY_CHARFONTPITCHCOMPLEX - , PROPERTY_CHARHEIGHTCOMPLEX - , PROPERTY_CHARUNDERLINECOMPLEX - , PROPERTY_CHARWEIGHTCOMPLEX - , PROPERTY_CHARPOSTURECOMPLEX - , PROPERTY_CHARWORDMODECOMPLEX - , PROPERTY_CHARROTATIONCOMPLEX - , PROPERTY_CHARSCALEWIDTHCOMPLEX - , PROPERTY_CHARLOCALECOMPLEX - - - }; - return uno::Sequence< ::rtl::OUString >(pProps,SAL_N_ELEMENTS(pProps)); -} -DBG_NAME(rpt_OFixedLine) -// ----------------------------------------------------------------------------- -OFixedLine::OFixedLine(uno::Reference< uno::XComponentContext > const & _xContext) -:FixedLineBase(m_aMutex) -,FixedLinePropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getLineOptionals()) -,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) -,m_nOrientation(1) -,m_LineColor(0) -,m_LineTransparence(0) -,m_LineWidth(0) -{ - DBG_CTOR(rpt_OFixedLine,NULL); - m_aProps.aComponent.m_sName = RPT_RESSTRING(RID_STR_FIXEDLINE,m_aProps.aComponent.m_xContext->getServiceManager()); - 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,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getLineOptionals()) -,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) -,m_nOrientation(_nOrientation) -,m_LineColor(0) -,m_LineTransparence(0) -,m_LineWidth(0) -{ - DBG_CTOR(rpt_OFixedLine,NULL); - m_aProps.aComponent.m_sName = RPT_RESSTRING(RID_STR_FIXEDLINE,m_aProps.aComponent.m_xContext->getServiceManager()); - m_aProps.aComponent.m_xFactory = _xFactory; - osl_incrementInterlockedCount( &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&) - { - OSL_FAIL("OFixedLine::OFixedLine: Exception caught!"); - } - osl_decrementInterlockedCount( &m_refCount ); -} -// ----------------------------------------------------------------------------- -OFixedLine::~OFixedLine() -{ - DBG_DTOR(rpt_OFixedLine,NULL); -} -// ----------------------------------------------------------------------------- -IMPLEMENT_FORWARD_REFCOUNT( OFixedLine, FixedLineBase ) -// -------------------------------------------------------------------------------- -uno::Any SAL_CALL OFixedLine::queryInterface( const uno::Type& _rType ) throw (uno::RuntimeException) -{ - 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() throw(uno::RuntimeException) -{ - FixedLinePropertySet::dispose(); - cppu::WeakComponentImplHelperBase::dispose(); -} -// ----------------------------------------------------------------------------- -::rtl::OUString OFixedLine::getImplementationName_Static( ) throw(uno::RuntimeException) -{ - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.OFixedLine")); -} - -//-------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OFixedLine::getImplementationName( ) throw(uno::RuntimeException) -{ - return getImplementationName_Static(); -} -//-------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > OFixedLine::getSupportedServiceNames_Static( ) throw(uno::RuntimeException) -{ - uno::Sequence< ::rtl::OUString > aServices(1); - aServices.getArray()[0] = SERVICE_FIXEDLINE; - - return aServices; -} -//------------------------------------------------------------------------------ -uno::Reference< uno::XInterface > OFixedLine::create(uno::Reference< uno::XComponentContext > const & xContext) -{ - return *(new OFixedLine(xContext)); -} - -//-------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > SAL_CALL OFixedLine::getSupportedServiceNames( ) throw(uno::RuntimeException) -{ - return getSupportedServiceNames_Static(); -} -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL OFixedLine::supportsService(const ::rtl::OUString& ServiceName) throw( uno::RuntimeException ) -{ - return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_Static()); -} -// ----------------------------------------------------------------------------- -// XReportComponent -REPORTCOMPONENT_IMPL3(OFixedLine,m_aProps.aComponent) -REPORTCOMPONENT_NOMASTERDETAIL(OFixedLine) -// ----------------------------------------------------------------------------- -::sal_Int16 SAL_CALL OFixedLine::getControlBorder( ) throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedLine::setControlBorder( ::sal_Int16 /*_border*/ ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); -} -// ----------------------------------------------------------------------------- -::sal_Int32 SAL_CALL OFixedLine::getControlBorderColor() throw (beans::UnknownPropertyException,uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedLine::setControlBorderColor( ::sal_Int32 /*_bordercolor*/ ) throw (beans::UnknownPropertyException,lang::IllegalArgumentException,uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); -} -// ----------------------------------------------------------------------------- -uno::Reference< beans::XPropertySetInfo > SAL_CALL OFixedLine::getPropertySetInfo( ) throw(uno::RuntimeException) -{ - return FixedLinePropertySet::getPropertySetInfo(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedLine::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) -{ - FixedLinePropertySet::setPropertyValue( aPropertyName, aValue ); -} -// ----------------------------------------------------------------------------- -uno::Any SAL_CALL OFixedLine::getPropertyValue( const ::rtl::OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - return FixedLinePropertySet::getPropertyValue( PropertyName); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedLine::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - FixedLinePropertySet::addPropertyChangeListener( aPropertyName, xListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedLine::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - FixedLinePropertySet::removePropertyChangeListener( aPropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedLine::addVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - FixedLinePropertySet::addVetoableChangeListener( PropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedLine::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - FixedLinePropertySet::removeVetoableChangeListener( PropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -// XReportControlModel -::rtl::OUString SAL_CALL OFixedLine::getDataField() throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedLine::setDataField( const ::rtl::OUString& /*_datafield*/ ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); -} -// ----------------------------------------------------------------------------- -::sal_Int32 SAL_CALL OFixedLine::getControlBackground() throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedLine::setControlBackground( ::sal_Int32 /*_backgroundcolor*/ ) throw (uno::RuntimeException,beans::UnknownPropertyException) -{ - throw beans::UnknownPropertyException(); -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OFixedLine::getControlBackgroundTransparent() throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedLine::setControlBackgroundTransparent( ::sal_Bool /*_controlbackgroundtransparent*/ ) throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OFixedLine::getPrintWhenGroupChange() throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedLine::setPrintWhenGroupChange( ::sal_Bool /*_printwhengroupchange*/ ) throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OFixedLine::getConditionalPrintExpression() throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedLine::setConditionalPrintExpression( const ::rtl::OUString& /*_conditionalprintexpression*/ ) throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); -} -// ----------------------------------------------------------------------------- -// XCloneable -uno::Reference< util::XCloneable > SAL_CALL OFixedLine::createClone( ) throw (uno::RuntimeException) -{ - 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.get(); -} -// ----------------------------------------------------------------------------- - -// XFixedLine -// ----------------------------------------------------------------------------- -::sal_Int32 SAL_CALL OFixedLine::getOrientation() throw (beans::UnknownPropertyException,uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_nOrientation; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedLine::setOrientation( ::sal_Int32 _orientation ) throw (beans::UnknownPropertyException,uno::RuntimeException) -{ - set(PROPERTY_ORIENTATION,_orientation,m_nOrientation); -} -// ----------------------------------------------------------------------------- -drawing::LineStyle SAL_CALL OFixedLine::getLineStyle() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_LineStyle; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedLine::setLineStyle( drawing::LineStyle _linestyle ) throw (uno::RuntimeException) -{ - set(PROPERTY_LINESTYLE,_linestyle,m_LineStyle); -} -// ----------------------------------------------------------------------------- -drawing::LineDash SAL_CALL OFixedLine::getLineDash() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_LineDash; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedLine::setLineDash( const drawing::LineDash& _linedash ) throw (uno::RuntimeException) -{ - set(PROPERTY_LINEDASH,_linedash,m_LineDash); -} -// ----------------------------------------------------------------------------- -::sal_Int32 SAL_CALL OFixedLine::getLineColor() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_LineColor; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedLine::setLineColor( ::sal_Int32 _linecolor ) throw (uno::RuntimeException) -{ - set(PROPERTY_LINECOLOR,_linecolor,m_LineColor); -} -// ----------------------------------------------------------------------------- -::sal_Int16 SAL_CALL OFixedLine::getLineTransparence() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_LineTransparence; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedLine::setLineTransparence( ::sal_Int16 _linetransparence ) throw (uno::RuntimeException) -{ - set(PROPERTY_LINETRANSPARENCE,_linetransparence,m_LineTransparence); -} -// ----------------------------------------------------------------------------- -::sal_Int32 SAL_CALL OFixedLine::getLineWidth() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_LineWidth; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedLine::setLineWidth( ::sal_Int32 _linewidth ) throw (uno::RuntimeException) -{ - set(PROPERTY_LINEWIDTH,_linewidth,m_LineWidth); -} -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -// XChild -uno::Reference< uno::XInterface > SAL_CALL OFixedLine::getParent( ) throw (uno::RuntimeException) -{ - return OShapeHelper::getParent(this); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedLine::setParent( const uno::Reference< uno::XInterface >& Parent ) throw (lang::NoSupportException, uno::RuntimeException) -{ - OShapeHelper::setParent(Parent,this); -} -// ----------------------------------------------------------------------------- -uno::Reference< report::XFormatCondition > SAL_CALL OFixedLine::createFormatCondition( ) throw (uno::Exception, uno::RuntimeException) -{ - return new OFormatCondition(m_aProps.aComponent.m_xContext); -} -// ----------------------------------------------------------------------------- -// XContainer -void SAL_CALL OFixedLine::addContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException) -{ - m_aProps.addContainerListener(xListener); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedLine::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException) -{ - m_aProps.removeContainerListener(xListener); -} -// ----------------------------------------------------------------------------- -// XElementAccess -uno::Type SAL_CALL OFixedLine::getElementType( ) throw (uno::RuntimeException) -{ - return ::getCppuType(static_cast< uno::Reference<report::XFormatCondition>*>(NULL)); -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OFixedLine::hasElements( ) throw (uno::RuntimeException) -{ - return m_aProps.hasElements(); -} -// ----------------------------------------------------------------------------- -// XIndexContainer -void SAL_CALL OFixedLine::insertByIndex( ::sal_Int32 Index, const uno::Any& Element ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - m_aProps.insertByIndex(Index,Element); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedLine::removeByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - m_aProps.removeByIndex(Index); -} -// ----------------------------------------------------------------------------- -// XIndexReplace -void SAL_CALL OFixedLine::replaceByIndex( ::sal_Int32 Index, const uno::Any& Element ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - m_aProps.replaceByIndex(Index,Element); -} -// ----------------------------------------------------------------------------- -// XIndexAccess -::sal_Int32 SAL_CALL OFixedLine::getCount( ) throw (uno::RuntimeException) -{ - return m_aProps.getCount(); -} -// ----------------------------------------------------------------------------- -uno::Any SAL_CALL OFixedLine::getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - return m_aProps.getByIndex( Index ); -} -// ----------------------------------------------------------------------------- -// XShape -awt::Point SAL_CALL OFixedLine::getPosition( ) throw (uno::RuntimeException) -{ - return OShapeHelper::getPosition(this); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedLine::setPosition( const awt::Point& aPosition ) throw (uno::RuntimeException) -{ - OShapeHelper::setPosition(aPosition,this); -} -// ----------------------------------------------------------------------------- -awt::Size SAL_CALL OFixedLine::getSize( ) throw (uno::RuntimeException) -{ - return OShapeHelper::getSize(this); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedLine::setSize( const awt::Size& aSize ) throw (beans::PropertyVetoException, uno::RuntimeException) -{ - if ( (aSize.Width < MIN_WIDTH && m_nOrientation == 1) || (aSize.Height < MIN_HEIGHT && m_nOrientation == 0) ) - throw beans::PropertyVetoException(); - OShapeHelper::setSize(aSize,this); -} -// ----------------------------------------------------------------------------- -// XShapeDescriptor -::rtl::OUString SAL_CALL OFixedLine::getShapeType( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - if ( m_aProps.aComponent.m_xShape.is() ) - return m_aProps.aComponent.m_xShape->getShapeType(); - return ::rtl::OUString(); -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OFixedLine::getHyperLinkURL() throw (uno::RuntimeException, beans::UnknownPropertyException) -{ - throw beans::UnknownPropertyException(); -} -void SAL_CALL OFixedLine::setHyperLinkURL(const ::rtl::OUString & /*the_value*/) throw (uno::RuntimeException, beans::UnknownPropertyException) -{ - throw beans::UnknownPropertyException(); -} -::rtl::OUString SAL_CALL OFixedLine::getHyperLinkTarget() throw (uno::RuntimeException, beans::UnknownPropertyException) -{ - throw beans::UnknownPropertyException(); -} -void SAL_CALL OFixedLine::setHyperLinkTarget(const ::rtl::OUString & /*the_value*/) throw (uno::RuntimeException, beans::UnknownPropertyException) -{ - throw beans::UnknownPropertyException(); -} -::rtl::OUString SAL_CALL OFixedLine::getHyperLinkName() throw (uno::RuntimeException, beans::UnknownPropertyException) -{ - throw beans::UnknownPropertyException(); -} -void SAL_CALL OFixedLine::setHyperLinkName(const ::rtl::OUString & /*the_value*/) throw (uno::RuntimeException, beans::UnknownPropertyException) -{ - throw beans::UnknownPropertyException(); -} - -NO_REPORTCONTROLFORMAT_IMPL(OFixedLine) - -::sal_Bool SAL_CALL OFixedLine::getPrintRepeatedValues() throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); -} -void SAL_CALL OFixedLine::setPrintRepeatedValues( ::sal_Bool /*_printrepeatedvalues*/ ) throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - 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 deleted file mode 100644 index ef46c2db4..000000000 --- a/reportdesign/source/core/api/FixedText.cxx +++ /dev/null @@ -1,344 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_reportdesign.hxx" -#include "FixedText.hxx" -#include <com/sun/star/beans/PropertyAttribute.hpp> -#include "corestrings.hrc" -#include <com/sun/star/beans/XPropertyState.hpp> -#include "core_resource.hrc" -#include "core_resource.hxx" -#include <comphelper/sequence.hxx> -#include "Tools.hxx" -#include <tools/debug.hxx> -#include <comphelper/property.hxx> -#include "FormatCondition.hxx" -#include <com/sun/star/text/ParagraphVertAlign.hpp> -#include "ReportHelperImpl.hxx" -// ============================================================================= -namespace reportdesign -{ -// ============================================================================= - using namespace com::sun::star; - using namespace comphelper; -uno::Sequence< ::rtl::OUString > lcl_getFixedTextOptionals() -{ - ::rtl::OUString pProps[] = { PROPERTY_DATAFIELD,PROPERTY_MASTERFIELDS,PROPERTY_DETAILFIELDS }; - return uno::Sequence< ::rtl::OUString >(pProps,SAL_N_ELEMENTS(pProps)); -} -DBG_NAME( rpt_OFixedText ) -// ----------------------------------------------------------------------------- -OFixedText::OFixedText(uno::Reference< uno::XComponentContext > const & _xContext) -:FixedTextBase(m_aMutex) -,FixedTextPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getFixedTextOptionals()) -,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) -{ - DBG_CTOR( rpt_OFixedText,NULL); - m_aProps.aComponent.m_sName = RPT_RESSTRING(RID_STR_FIXEDTEXT,m_aProps.aComponent.m_xContext->getServiceManager()); - 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,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getFixedTextOptionals()) -,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) -{ - DBG_CTOR( rpt_OFixedText,NULL); - m_aProps.aComponent.m_sName = RPT_RESSTRING(RID_STR_FIXEDTEXT,m_aProps.aComponent.m_xContext->getServiceManager()); - m_aProps.aComponent.m_nBorder = 0; // no border - m_aProps.aComponent.m_xFactory = _xFactory; - osl_incrementInterlockedCount( &m_refCount ); - { - m_aProps.aComponent.setShape(_xShape,this,m_refCount); - } - osl_decrementInterlockedCount( &m_refCount ); -} -// ----------------------------------------------------------------------------- -OFixedText::~OFixedText() -{ - DBG_DTOR( rpt_OFixedText,NULL); -} -// ----------------------------------------------------------------------------- -IMPLEMENT_FORWARD_REFCOUNT( OFixedText, FixedTextBase ) -// -------------------------------------------------------------------------------- -uno::Any SAL_CALL OFixedText::queryInterface( const uno::Type& _rType ) throw (uno::RuntimeException) -{ - 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() throw(uno::RuntimeException) -{ - FixedTextPropertySet::dispose(); - cppu::WeakComponentImplHelperBase::dispose(); - uno::Reference< report::XFixedText> xHoldAlive = this; -} -// ----------------------------------------------------------------------------- -::rtl::OUString OFixedText::getImplementationName_Static( ) throw(uno::RuntimeException) -{ - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.OFixedText")); -} - -//-------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OFixedText::getImplementationName( ) throw(uno::RuntimeException) -{ - return getImplementationName_Static(); -} -//-------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > OFixedText::getSupportedServiceNames_Static( ) throw(uno::RuntimeException) -{ - uno::Sequence< ::rtl::OUString > aServices(1); - aServices.getArray()[0] = SERVICE_FIXEDTEXT; - - return aServices; -} -//------------------------------------------------------------------------------ -uno::Reference< uno::XInterface > OFixedText::create(uno::Reference< uno::XComponentContext > const & xContext) -{ - return *(new OFixedText(xContext)); -} - -//-------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > SAL_CALL OFixedText::getSupportedServiceNames( ) throw(uno::RuntimeException) -{ - return getSupportedServiceNames_Static(); -} -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL OFixedText::supportsService(const ::rtl::OUString& ServiceName) throw( uno::RuntimeException ) -{ - return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_Static()); -} -// ----------------------------------------------------------------------------- -// 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( ) throw(uno::RuntimeException) -{ - return FixedTextPropertySet::getPropertySetInfo(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedText::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) -{ - FixedTextPropertySet::setPropertyValue( aPropertyName, aValue ); -} -// ----------------------------------------------------------------------------- -uno::Any SAL_CALL OFixedText::getPropertyValue( const ::rtl::OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - return FixedTextPropertySet::getPropertyValue( PropertyName); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedText::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - FixedTextPropertySet::addPropertyChangeListener( aPropertyName, xListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedText::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - FixedTextPropertySet::removePropertyChangeListener( aPropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedText::addVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - FixedTextPropertySet::addVetoableChangeListener( PropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedText::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - FixedTextPropertySet::removeVetoableChangeListener( PropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -// XReportControlModel -::rtl::OUString SAL_CALL OFixedText::getDataField() throw ( beans::UnknownPropertyException, uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedText::setDataField( const ::rtl::OUString& /*_datafield*/ ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); -} -// ----------------------------------------------------------------------------- - -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OFixedText::getPrintWhenGroupChange() throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aProps.bPrintWhenGroupChange; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedText::setPrintWhenGroupChange( ::sal_Bool _printwhengroupchange ) throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - set(PROPERTY_PRINTWHENGROUPCHANGE,_printwhengroupchange,m_aProps.bPrintWhenGroupChange); -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OFixedText::getConditionalPrintExpression() throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aProps.aConditionalPrintExpression; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedText::setConditionalPrintExpression( const ::rtl::OUString& _conditionalprintexpression ) throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - set(PROPERTY_CONDITIONALPRINTEXPRESSION,_conditionalprintexpression,m_aProps.aConditionalPrintExpression); -} -// ----------------------------------------------------------------------------- - -// XCloneable -uno::Reference< util::XCloneable > SAL_CALL OFixedText::createClone( ) throw (uno::RuntimeException) -{ - 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.get(); -} -// ----------------------------------------------------------------------------- - -// XFixedText -::rtl::OUString SAL_CALL OFixedText::getLabel() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_sLabel; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedText::setLabel( const ::rtl::OUString& _label ) throw (uno::RuntimeException) -{ - set(PROPERTY_LABEL,_label,m_sLabel); -} -// ----------------------------------------------------------------------------- -// XChild -uno::Reference< uno::XInterface > SAL_CALL OFixedText::getParent( ) throw (uno::RuntimeException) -{ - return OShapeHelper::getParent(this); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedText::setParent( const uno::Reference< uno::XInterface >& Parent ) throw (lang::NoSupportException, uno::RuntimeException) -{ - OShapeHelper::setParent(Parent,this); -} -// ----------------------------------------------------------------------------- -uno::Reference< report::XFormatCondition > SAL_CALL OFixedText::createFormatCondition( ) throw (uno::Exception, uno::RuntimeException) -{ - return new OFormatCondition(m_aProps.aComponent.m_xContext); -} -// ----------------------------------------------------------------------------- -// XContainer -void SAL_CALL OFixedText::addContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException) -{ - m_aProps.addContainerListener(xListener); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedText::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException) -{ - m_aProps.removeContainerListener(xListener); -} -// ----------------------------------------------------------------------------- -// XElementAccess -uno::Type SAL_CALL OFixedText::getElementType( ) throw (uno::RuntimeException) -{ - return ::getCppuType(static_cast< uno::Reference<report::XFormatCondition>*>(NULL)); -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OFixedText::hasElements( ) throw (uno::RuntimeException) -{ - return m_aProps.hasElements(); -} -// ----------------------------------------------------------------------------- -// XIndexContainer -void SAL_CALL OFixedText::insertByIndex( ::sal_Int32 Index, const uno::Any& Element ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - m_aProps.insertByIndex(Index,Element); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedText::removeByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - m_aProps.removeByIndex(Index); -} -// ----------------------------------------------------------------------------- -// XIndexReplace -void SAL_CALL OFixedText::replaceByIndex( ::sal_Int32 Index, const uno::Any& Element ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - m_aProps.replaceByIndex(Index,Element); -} -// ----------------------------------------------------------------------------- -// XIndexAccess -::sal_Int32 SAL_CALL OFixedText::getCount( ) throw (uno::RuntimeException) -{ - return m_aProps.getCount(); -} -// ----------------------------------------------------------------------------- -uno::Any SAL_CALL OFixedText::getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - return m_aProps.getByIndex( Index ); -} -// ----------------------------------------------------------------------------- -// XShape -awt::Point SAL_CALL OFixedText::getPosition( ) throw (uno::RuntimeException) -{ - return OShapeHelper::getPosition(this); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedText::setPosition( const awt::Point& aPosition ) throw (uno::RuntimeException) -{ - OShapeHelper::setPosition(aPosition,this); -} -// ----------------------------------------------------------------------------- -awt::Size SAL_CALL OFixedText::getSize( ) throw (uno::RuntimeException) -{ - return OShapeHelper::getSize(this); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFixedText::setSize( const awt::Size& aSize ) throw (beans::PropertyVetoException, uno::RuntimeException) -{ - OShapeHelper::setSize(aSize,this); -} -// ----------------------------------------------------------------------------- - -// XShapeDescriptor -::rtl::OUString SAL_CALL OFixedText::getShapeType( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - if ( m_aProps.aComponent.m_xShape.is() ) - return m_aProps.aComponent.m_xShape->getShapeType(); - return ::rtl::OUString(); -} -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -// ============================================================================= -} // 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 deleted file mode 100644 index fcdba509a..000000000 --- a/reportdesign/source/core/api/FormatCondition.cxx +++ /dev/null @@ -1,168 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_reportdesign.hxx" -#include "FormatCondition.hxx" -#include <com/sun/star/beans/PropertyAttribute.hpp> -#include "corestrings.hrc" -#include <tools/debug.hxx> -#include <connectivity/dbtools.hxx> -#include <comphelper/sequence.hxx> -#include <comphelper/property.hxx> -#include "Tools.hxx" -#include <com/sun/star/text/ParagraphVertAlign.hpp> -#include "ReportHelperImpl.hxx" -#include "corestrings.hrc" -// ============================================================================= -namespace reportdesign -{ -// ============================================================================= - using namespace com::sun::star; - using namespace comphelper; -//------------------------------------------------------------------------------ -uno::Reference< uno::XInterface > OFormatCondition::create(uno::Reference< uno::XComponentContext > const & xContext) -{ - return *(new OFormatCondition(xContext)); -} - -DBG_NAME( rpt_OFormatCondition ) -// ----------------------------------------------------------------------------- -OFormatCondition::OFormatCondition(uno::Reference< uno::XComponentContext > const & _xContext) -:FormatConditionBase(m_aMutex) -,FormatConditionPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< ::rtl::OUString >()) -,m_bEnabled(sal_True) -{ - DBG_CTOR( rpt_OFormatCondition,NULL); -} -// ----------------------------------------------------------------------------- -OFormatCondition::~OFormatCondition() -{ - DBG_DTOR( rpt_OFormatCondition,NULL); -} -// ----------------------------------------------------------------------------- -IMPLEMENT_FORWARD_XINTERFACE2(OFormatCondition,FormatConditionBase,FormatConditionPropertySet) -// ----------------------------------------------------------------------------- -void SAL_CALL OFormatCondition::dispose() throw(uno::RuntimeException) -{ - FormatConditionPropertySet::dispose(); - cppu::WeakComponentImplHelperBase::dispose(); -} -// ----------------------------------------------------------------------------- -::rtl::OUString OFormatCondition::getImplementationName_Static( ) throw(uno::RuntimeException) -{ - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.OFormatCondition")); -} - -//-------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OFormatCondition::getImplementationName( ) throw(uno::RuntimeException) -{ - return getImplementationName_Static(); -} -//-------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > OFormatCondition::getSupportedServiceNames_Static( ) throw(uno::RuntimeException) -{ - uno::Sequence< ::rtl::OUString > aServices(1); - aServices.getArray()[0] = SERVICE_FORMATCONDITION; - - return aServices; -} -//-------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > SAL_CALL OFormatCondition::getSupportedServiceNames( ) throw(uno::RuntimeException) -{ - return getSupportedServiceNames_Static(); -} -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL OFormatCondition::supportsService(const ::rtl::OUString& ServiceName) throw( uno::RuntimeException ) -{ - return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_Static()); -} -// ----------------------------------------------------------------------------- -uno::Reference< beans::XPropertySetInfo > SAL_CALL OFormatCondition::getPropertySetInfo( ) throw(uno::RuntimeException) -{ - return FormatConditionPropertySet::getPropertySetInfo(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFormatCondition::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) -{ - FormatConditionPropertySet::setPropertyValue( aPropertyName, aValue ); -} -// ----------------------------------------------------------------------------- -uno::Any SAL_CALL OFormatCondition::getPropertyValue( const ::rtl::OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - return FormatConditionPropertySet::getPropertyValue( PropertyName); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFormatCondition::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - FormatConditionPropertySet::addPropertyChangeListener( aPropertyName, xListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFormatCondition::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - FormatConditionPropertySet::removePropertyChangeListener( aPropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFormatCondition::addVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - FormatConditionPropertySet::addVetoableChangeListener( PropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFormatCondition::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - FormatConditionPropertySet::removeVetoableChangeListener( PropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -// XFormatCondition -::sal_Bool SAL_CALL OFormatCondition::getEnabled() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_bEnabled; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFormatCondition::setEnabled( ::sal_Bool _enabled ) throw (uno::RuntimeException) -{ - set(PROPERTY_ENABLED,_enabled,m_bEnabled); -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OFormatCondition::getFormula() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_sFormula; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFormatCondition::setFormula( const ::rtl::OUString& _formula ) throw (uno::RuntimeException) -{ - 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 deleted file mode 100644 index 07200ae22..000000000 --- a/reportdesign/source/core/api/FormattedField.cxx +++ /dev/null @@ -1,386 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_reportdesign.hxx" -#include "FormattedField.hxx" -#include <com/sun/star/beans/PropertyAttribute.hpp> -#include <com/sun/star/beans/XPropertyState.hpp> -#include "corestrings.hrc" -#include "core_resource.hrc" -#include "core_resource.hxx" -#include <comphelper/sequence.hxx> -#include <tools/debug.hxx> -#include <connectivity/dbtools.hxx> -#include <comphelper/property.hxx> -#include "Tools.hxx" -#include "FormatCondition.hxx" -#include <com/sun/star/text/ParagraphVertAlign.hpp> -#include "ReportHelperImpl.hxx" -// ============================================================================= -namespace reportdesign -{ -// ============================================================================= - using namespace com::sun::star; - using namespace comphelper; -//------------------------------------------------------------------------------ -uno::Reference< uno::XInterface > OFormattedField::create(uno::Reference< uno::XComponentContext > const & xContext) -{ - return *(new OFormattedField(xContext)); -} - -uno::Sequence< ::rtl::OUString > lcl_getFormattedFieldOptionals() -{ - ::rtl::OUString pProps[] = { PROPERTY_MASTERFIELDS,PROPERTY_DETAILFIELDS }; - return uno::Sequence< ::rtl::OUString >(pProps,SAL_N_ELEMENTS(pProps)); -} -DBG_NAME( rpt_OFormattedField ) -// ----------------------------------------------------------------------------- -OFormattedField::OFormattedField(uno::Reference< uno::XComponentContext > const & _xContext) -:FormattedFieldBase(m_aMutex) -,FormattedFieldPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getFormattedFieldOptionals()) -,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) -,m_nFormatKey(0) -{ - DBG_CTOR( rpt_OFormattedField,NULL); - m_aProps.aComponent.m_sName = RPT_RESSTRING(RID_STR_FORMATTEDFIELD,m_aProps.aComponent.m_xContext->getServiceManager()); -} -// ----------------------------------------------------------------------------- -OFormattedField::OFormattedField(uno::Reference< uno::XComponentContext > const & _xContext - ,const uno::Reference< lang::XMultiServiceFactory>& _xFactory - ,uno::Reference< drawing::XShape >& _xShape) -:FormattedFieldBase(m_aMutex) -,FormattedFieldPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getFormattedFieldOptionals()) -,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) -,m_nFormatKey(0) -{ - DBG_CTOR( rpt_OFormattedField,NULL); - m_aProps.aComponent.m_sName = RPT_RESSTRING(RID_STR_FORMATTEDFIELD,m_aProps.aComponent.m_xContext->getServiceManager()); - m_aProps.aComponent.m_xFactory = _xFactory; - osl_incrementInterlockedCount( &m_refCount ); - { - m_aProps.aComponent.setShape(_xShape,this,m_refCount); - } - osl_decrementInterlockedCount( &m_refCount ); -} -// ----------------------------------------------------------------------------- -OFormattedField::~OFormattedField() -{ - DBG_DTOR( rpt_OFormattedField,NULL); -} -// ----------------------------------------------------------------------------- -IMPLEMENT_FORWARD_REFCOUNT( OFormattedField, FormattedFieldBase ) -// -------------------------------------------------------------------------------- -uno::Any SAL_CALL OFormattedField::queryInterface( const uno::Type& _rType ) throw (uno::RuntimeException) -{ - 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() throw(uno::RuntimeException) -{ - FormattedFieldPropertySet::dispose(); - cppu::WeakComponentImplHelperBase::dispose(); - m_xFormatsSupplier.clear(); - m_xFunction.clear(); -} -// ----------------------------------------------------------------------------- -::rtl::OUString OFormattedField::getImplementationName_Static( ) throw(uno::RuntimeException) -{ - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.OFormattedField")); -} - -//-------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OFormattedField::getImplementationName( ) throw(uno::RuntimeException) -{ - return getImplementationName_Static(); -} -//-------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > OFormattedField::getSupportedServiceNames_Static( ) throw(uno::RuntimeException) -{ - uno::Sequence< ::rtl::OUString > aServices(2); - aServices.getArray()[0] = SERVICE_FORMATTEDFIELD; - aServices.getArray()[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFormattedFieldModel")); - - return aServices; -} -//-------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > SAL_CALL OFormattedField::getSupportedServiceNames( ) throw(uno::RuntimeException) -{ - return getSupportedServiceNames_Static(); -} -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL OFormattedField::supportsService(const ::rtl::OUString& ServiceName) throw( uno::RuntimeException ) -{ - return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_Static()); -} -// ----------------------------------------------------------------------------- -// 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( ) throw(uno::RuntimeException) -{ - return FormattedFieldPropertySet::getPropertySetInfo(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFormattedField::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) -{ - // 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 ::rtl::OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - return FormattedFieldPropertySet::getPropertyValue( PropertyName); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFormattedField::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - FormattedFieldPropertySet::addPropertyChangeListener( aPropertyName, xListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFormattedField::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - FormattedFieldPropertySet::removePropertyChangeListener( aPropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFormattedField::addVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - FormattedFieldPropertySet::addVetoableChangeListener( PropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFormattedField::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - FormattedFieldPropertySet::removeVetoableChangeListener( PropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -// XReportControlModel -::rtl::OUString SAL_CALL OFormattedField::getDataField() throw ( beans::UnknownPropertyException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aProps.aDataField; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFormattedField::setDataField( const ::rtl::OUString& _datafield ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException) -{ - set(PROPERTY_DATAFIELD,_datafield,m_aProps.aDataField); -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OFormattedField::getPrintWhenGroupChange() throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aProps.bPrintWhenGroupChange; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFormattedField::setPrintWhenGroupChange( ::sal_Bool _printwhengroupchange ) throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - set(PROPERTY_PRINTWHENGROUPCHANGE,_printwhengroupchange,m_aProps.bPrintWhenGroupChange); -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OFormattedField::getConditionalPrintExpression() throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aProps.aConditionalPrintExpression; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFormattedField::setConditionalPrintExpression( const ::rtl::OUString& _conditionalprintexpression ) throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - set(PROPERTY_CONDITIONALPRINTEXPRESSION,_conditionalprintexpression,m_aProps.aConditionalPrintExpression); -} - -// ----------------------------------------------------------------------------- - -// XCloneable -uno::Reference< util::XCloneable > SAL_CALL OFormattedField::createClone( ) throw (uno::RuntimeException) -{ - uno::Reference< report::XReportComponent> xSource = this; - uno::Reference< report::XFormattedField> xSet(cloneObject(xSource,m_aProps.aComponent.m_xFactory,SERVICE_FORMATTEDFIELD),uno::UNO_QUERY_THROW); - - if ( xSet.is() ) - { - ::std::vector< uno::Reference< report::XFormatCondition> >::iterator aIter = m_aProps.m_aFormatConditions.begin(); - ::std::vector< uno::Reference< report::XFormatCondition> >::iterator aEnd = m_aProps.m_aFormatConditions.end(); - for (sal_Int32 i = 0; aIter != aEnd; ++aIter,++i) - { - uno::Reference< report::XFormatCondition > xCond = xSet->createFormatCondition(); - ::comphelper::copyProperties(aIter->get(),xCond.get()); - xSet->insertByIndex(i,uno::makeAny(xCond)); - } - } - return xSet.get(); -} -// ----------------------------------------------------------------------------- -// XFormattedField -// ----------------------------------------------------------------------------- -::sal_Int32 SAL_CALL OFormattedField::getFormatKey() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_nFormatKey; -} - -void SAL_CALL OFormattedField::setFormatKey(::sal_Int32 _formatkey) throw (uno::RuntimeException) -{ - set(PROPERTY_FORMATKEY,_formatkey,m_nFormatKey); -} -// ----------------------------------------------------------------------------- -uno::Reference< util::XNumberFormatsSupplier > SAL_CALL OFormattedField::getFormatsSupplier() throw (uno::RuntimeException) -{ - ::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(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumberFormatsSupplier"))),uno::UNO_QUERY); - } - } - return m_xFormatsSupplier; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFormattedField::setFormatsSupplier( const uno::Reference< util::XNumberFormatsSupplier >& _formatssupplier ) throw (uno::RuntimeException) -{ - set(PROPERTY_FORMATSSUPPLIER,_formatssupplier,m_xFormatsSupplier); -} -// ----------------------------------------------------------------------------- -// XChild -uno::Reference< uno::XInterface > SAL_CALL OFormattedField::getParent( ) throw (uno::RuntimeException) -{ - return OShapeHelper::getParent(this); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFormattedField::setParent( const uno::Reference< uno::XInterface >& Parent ) throw (lang::NoSupportException, uno::RuntimeException) -{ - OShapeHelper::setParent(Parent,this); -} -// ----------------------------------------------------------------------------- -uno::Reference< report::XFormatCondition > SAL_CALL OFormattedField::createFormatCondition( ) throw (uno::Exception, uno::RuntimeException) -{ - return new OFormatCondition(m_aProps.aComponent.m_xContext); -} -// ----------------------------------------------------------------------------- -// XContainer -void SAL_CALL OFormattedField::addContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException) -{ - m_aProps.addContainerListener(xListener); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFormattedField::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException) -{ - m_aProps.removeContainerListener(xListener); -} -// ----------------------------------------------------------------------------- -// XElementAccess -uno::Type SAL_CALL OFormattedField::getElementType( ) throw (uno::RuntimeException) -{ - return ::getCppuType(static_cast< uno::Reference<report::XFormatCondition>*>(NULL)); -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OFormattedField::hasElements( ) throw (uno::RuntimeException) -{ - return m_aProps.hasElements(); -} -// ----------------------------------------------------------------------------- -// XIndexContainer -void SAL_CALL OFormattedField::insertByIndex( ::sal_Int32 Index, const uno::Any& Element ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - m_aProps.insertByIndex(Index,Element); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFormattedField::removeByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - m_aProps.removeByIndex(Index); -} -// ----------------------------------------------------------------------------- -// XIndexReplace -void SAL_CALL OFormattedField::replaceByIndex( ::sal_Int32 Index, const uno::Any& Element ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - m_aProps.replaceByIndex(Index,Element); -} -// ----------------------------------------------------------------------------- -// XIndexAccess -::sal_Int32 SAL_CALL OFormattedField::getCount( ) throw (uno::RuntimeException) -{ - return m_aProps.getCount(); -} -// ----------------------------------------------------------------------------- -uno::Any SAL_CALL OFormattedField::getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - return m_aProps.getByIndex( Index ); -} -// ----------------------------------------------------------------------------- -// XShape -awt::Point SAL_CALL OFormattedField::getPosition( ) throw (uno::RuntimeException) -{ - return OShapeHelper::getPosition(this); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFormattedField::setPosition( const awt::Point& aPosition ) throw (uno::RuntimeException) -{ - OShapeHelper::setPosition(aPosition,this); -} -// ----------------------------------------------------------------------------- -awt::Size SAL_CALL OFormattedField::getSize( ) throw (uno::RuntimeException) -{ - return OShapeHelper::getSize(this); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFormattedField::setSize( const awt::Size& aSize ) throw (beans::PropertyVetoException, uno::RuntimeException) -{ - OShapeHelper::setSize(aSize,this); -} -// ----------------------------------------------------------------------------- - -// XShapeDescriptor -::rtl::OUString SAL_CALL OFormattedField::getShapeType( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - if ( m_aProps.aComponent.m_xShape.is() ) - return m_aProps.aComponent.m_xShape->getShapeType(); - return ::rtl::OUString(); -} -// ----------------------------------------------------------------------------- -// ============================================================================= -} // 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 deleted file mode 100644 index 3eb66b325..000000000 --- a/reportdesign/source/core/api/Function.cxx +++ /dev/null @@ -1,224 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_reportdesign.hxx" -#include "Function.hxx" -#include <com/sun/star/beans/PropertyAttribute.hpp> -#include "corestrings.hrc" -#include <tools/debug.hxx> -#include <connectivity/dbtools.hxx> -#include <comphelper/sequence.hxx> -#include <comphelper/property.hxx> -#include "Tools.hxx" -#include "corestrings.hrc" -// ============================================================================= -namespace reportdesign -{ -// ============================================================================= - using namespace com::sun::star; - using namespace comphelper; -//------------------------------------------------------------------------------ -uno::Reference< uno::XInterface > OFunction::create(uno::Reference< uno::XComponentContext > const & xContext) -{ - return *(new OFunction(xContext)); -} - -DBG_NAME( rpt_OFunction ) -// ----------------------------------------------------------------------------- -OFunction::OFunction(uno::Reference< uno::XComponentContext > const & _xContext) -:FunctionBase(m_aMutex) -,FunctionPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< ::rtl::OUString >()) -,m_xContext(_xContext) -,m_bPreEvaluated(sal_False) -,m_bDeepTraversing(sal_False) -{ - m_sInitialFormula.IsPresent = sal_False; - DBG_CTOR( rpt_OFunction,NULL); -} -// ----------------------------------------------------------------------------- -OFunction::~OFunction() -{ - DBG_DTOR( rpt_OFunction,NULL); -} -// ----------------------------------------------------------------------------- -IMPLEMENT_FORWARD_XINTERFACE2(OFunction,FunctionBase,FunctionPropertySet) -// ----------------------------------------------------------------------------- -void SAL_CALL OFunction::dispose() throw(uno::RuntimeException) -{ - FunctionPropertySet::dispose(); - cppu::WeakComponentImplHelperBase::dispose(); -} -// ----------------------------------------------------------------------------- -::rtl::OUString OFunction::getImplementationName_Static( ) throw(uno::RuntimeException) -{ - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.OFunction")); -} - -//-------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OFunction::getImplementationName( ) throw(uno::RuntimeException) -{ - return getImplementationName_Static(); -} -//-------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > OFunction::getSupportedServiceNames_Static( ) throw(uno::RuntimeException) -{ - uno::Sequence< ::rtl::OUString > aServices(1); - aServices.getArray()[0] = SERVICE_FUNCTION; - - return aServices; -} -//-------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > SAL_CALL OFunction::getSupportedServiceNames( ) throw(uno::RuntimeException) -{ - return getSupportedServiceNames_Static(); -} -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL OFunction::supportsService(const ::rtl::OUString& ServiceName) throw( uno::RuntimeException ) -{ - return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_Static()); -} -// ----------------------------------------------------------------------------- -uno::Reference< beans::XPropertySetInfo > SAL_CALL OFunction::getPropertySetInfo( ) throw(uno::RuntimeException) -{ - return FunctionPropertySet::getPropertySetInfo(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFunction::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) -{ - FunctionPropertySet::setPropertyValue( aPropertyName, aValue ); -} -// ----------------------------------------------------------------------------- -uno::Any SAL_CALL OFunction::getPropertyValue( const ::rtl::OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - return FunctionPropertySet::getPropertyValue( PropertyName); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFunction::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - FunctionPropertySet::addPropertyChangeListener( aPropertyName, xListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFunction::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - FunctionPropertySet::removePropertyChangeListener( aPropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFunction::addVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - FunctionPropertySet::addVetoableChangeListener( PropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFunction::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - FunctionPropertySet::removeVetoableChangeListener( PropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -// report::XFunction: -::sal_Bool SAL_CALL OFunction::getPreEvaluated() throw (uno::RuntimeException) -{ - osl::MutexGuard g(m_aMutex); - return m_bPreEvaluated; -} -// ----------------------------------------------------------------------------- - -void SAL_CALL OFunction::setPreEvaluated(::sal_Bool the_value) throw (uno::RuntimeException) -{ - set(PROPERTY_PREEVALUATED,the_value,m_bPreEvaluated); -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OFunction::getDeepTraversing() throw (uno::RuntimeException) -{ - osl::MutexGuard g(m_aMutex); - return m_bDeepTraversing; -} -// ----------------------------------------------------------------------------- - -void SAL_CALL OFunction::setDeepTraversing(::sal_Bool the_value) throw (uno::RuntimeException) -{ - set(PROPERTY_DEEPTRAVERSING,the_value,m_bDeepTraversing); -} -// ----------------------------------------------------------------------------- - -::rtl::OUString SAL_CALL OFunction::getName() throw (uno::RuntimeException) -{ - osl::MutexGuard g(m_aMutex); - return m_sName; -} -// ----------------------------------------------------------------------------- - -void SAL_CALL OFunction::setName(const ::rtl::OUString & the_value) throw (uno::RuntimeException) -{ - set(PROPERTY_NAME,the_value,m_sName); -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OFunction::getFormula() throw (uno::RuntimeException) -{ - osl::MutexGuard g(m_aMutex); - return m_sFormula; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFunction::setFormula(const ::rtl::OUString & the_value) throw (uno::RuntimeException) -{ - set(PROPERTY_FORMULA,the_value,m_sFormula); -} -// ----------------------------------------------------------------------------- -beans::Optional< ::rtl::OUString> SAL_CALL OFunction::getInitialFormula() throw (uno::RuntimeException) -{ - osl::MutexGuard g(m_aMutex); - return m_sInitialFormula; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFunction::setInitialFormula(const beans::Optional< ::rtl::OUString> & the_value) throw (uno::RuntimeException) -{ - set(PROPERTY_INITIALFORMULA,the_value,m_sInitialFormula); -} -// ----------------------------------------------------------------------------- -// XChild -uno::Reference< uno::XInterface > SAL_CALL OFunction::getParent( ) throw (uno::RuntimeException) -{ - osl::MutexGuard g(m_aMutex); - return m_xParent; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFunction::setParent( const uno::Reference< uno::XInterface >& Parent ) throw (lang::NoSupportException, uno::RuntimeException) -{ - osl::MutexGuard g(m_aMutex); - if ( Parent.is() ) - { - uno::Reference< report::XFunctions> xFunctions(Parent,uno::UNO_QUERY_THROW); - m_xParent = xFunctions; - } - else - m_xParent = uno::WeakReference< report::XFunctions >(); -} -// ----------------------------------------------------------------------------- - -// ============================================================================= -} // 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 deleted file mode 100644 index 9707736db..000000000 --- a/reportdesign/source/core/api/Functions.cxx +++ /dev/null @@ -1,206 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_reportdesign.hxx" -#include "Functions.hxx" -#include "Function.hxx" -#include <tools/debug.hxx> -#include "core_resource.hxx" -#include "core_resource.hrc" -#include <comphelper/property.hxx> -#include <boost/bind.hpp> -#include <algorithm> -// ============================================================================= -namespace reportdesign -{ -// ============================================================================= - using namespace com::sun::star; -DBG_NAME( rpt_OFunctions ) -// ----------------------------------------------------------------------------- -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) -{ - DBG_CTOR( rpt_OFunctions,NULL); -} -//-------------------------------------------------------------------------- -// TODO: VirtualFunctionFinder: This is virtual function! -// -OFunctions::~OFunctions() -{ - DBG_DTOR( rpt_OFunctions,NULL); -} -//-------------------------------------------------------------------------- -void SAL_CALL OFunctions::dispose() throw(uno::RuntimeException) -{ - cppu::WeakComponentImplHelperBase::dispose(); -} -// ----------------------------------------------------------------------------- -// TODO: VirtualFunctionFinder: This is virtual function! -// -void SAL_CALL OFunctions::disposing() -{ - ::std::for_each(m_aFunctions.begin(),m_aFunctions.end(),::boost::mem_fn(&com::sun::star::report::XFunction::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( ) throw (uno::RuntimeException) -{ - return new OFunction(m_xContext); -} -// ----------------------------------------------------------------------------- -// XIndexContainer -void SAL_CALL OFunctions::insertByIndex( ::sal_Int32 Index, const uno::Any& aElement ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - { - ::osl::MutexGuard aGuard(m_aMutex); - sal_Bool bAdd = (Index == static_cast<sal_Int32>(m_aFunctions.size())); - if ( !bAdd ) - checkIndex(Index); - uno::Reference< report::XFunction > xFunction(aElement,uno::UNO_QUERY); - if ( !xFunction.is() ) - throw lang::IllegalArgumentException(RPT_RESSTRING(RID_STR_ARGUMENT_IS_NULL,m_xContext->getServiceManager()),*this,2); - - if ( bAdd ) - m_aFunctions.push_back(xFunction); - else - { - TFunctions::iterator aPos = m_aFunctions.begin(); - ::std::advance(aPos,Index); - m_aFunctions.insert(aPos, xFunction); - } - xFunction->setParent(*this); - } - // notify our container listeners - container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::makeAny(Index), aElement, uno::Any()); - m_aContainerListeners.notifyEach(&container::XContainerListener::elementInserted,aEvent); -} - -// ----------------------------------------------------------------------------- -void SAL_CALL OFunctions::removeByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - 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(NULL); - } - container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::makeAny(Index), uno::makeAny(xFunction), uno::Any()); - m_aContainerListeners.notifyEach(&container::XContainerListener::elementRemoved,aEvent); -} -// ----------------------------------------------------------------------------- -// XIndexReplace -void SAL_CALL OFunctions::replaceByIndex( ::sal_Int32 Index, const uno::Any& Element ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - 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(RPT_RESSTRING(RID_STR_ARGUMENT_IS_NULL,m_xContext->getServiceManager()),*this,2); - TFunctions::iterator aPos = m_aFunctions.begin(); - ::std::advance(aPos,Index); - aOldElement <<= *aPos; - *aPos = xFunction; - } - - container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::makeAny(Index), Element, aOldElement); - m_aContainerListeners.notifyEach(&container::XContainerListener::elementReplaced,aEvent); -} -// ----------------------------------------------------------------------------- -// XIndexAccess -::sal_Int32 SAL_CALL OFunctions::getCount( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aFunctions.size(); -} -// ----------------------------------------------------------------------------- -uno::Any SAL_CALL OFunctions::getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - checkIndex(Index); - TFunctions::iterator aPos = m_aFunctions.begin(); - ::std::advance(aPos,Index); - return uno::makeAny(*aPos); -} -// ----------------------------------------------------------------------------- -// XElementAccess -uno::Type SAL_CALL OFunctions::getElementType( ) throw (uno::RuntimeException) -{ - return ::getCppuType(static_cast< uno::Reference<report::XFunction>*>(NULL)); -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OFunctions::hasElements( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return !m_aFunctions.empty(); -} -// ----------------------------------------------------------------------------- -// XChild -uno::Reference< uno::XInterface > SAL_CALL OFunctions::getParent( ) throw (uno::RuntimeException) -{ - return m_xParent; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFunctions::setParent( const uno::Reference< uno::XInterface >& /*Parent*/ ) throw (lang::NoSupportException, uno::RuntimeException) -{ - throw lang::NoSupportException(); -} -// ----------------------------------------------------------------------------- -// XContainer -void SAL_CALL OFunctions::addContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException) -{ - m_aContainerListeners.addInterface(xListener); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OFunctions::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException) -{ - m_aContainerListeners.removeInterface(xListener); -} -// ----------------------------------------------------------------------------- -void OFunctions::checkIndex(sal_Int32 _nIndex) -{ - if ( _nIndex < 0 || static_cast<sal_Int32>(m_aFunctions.size()) <= _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 deleted file mode 100644 index e3a8a39d6..000000000 --- a/reportdesign/source/core/api/Group.cxx +++ /dev/null @@ -1,349 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_reportdesign.hxx" -#include "Group.hxx" -#include "Section.hxx" -#include <com/sun/star/beans/PropertyAttribute.hpp> -#include <com/sun/star/report/GroupOn.hpp> -#include <com/sun/star/report/KeepTogether.hpp> -#include "corestrings.hrc" -#include "core_resource.hrc" -#include "core_resource.hxx" -#include "Tools.hxx" -#include <tools/debug.hxx> -#include <comphelper/property.hxx> -#include "Functions.hxx" - -// ============================================================================= -namespace reportdesign -{ -// ============================================================================= - using namespace com::sun::star; - using namespace comphelper; -DBG_NAME( rpt_OGroup ) -// ----------------------------------------------------------------------------- -OGroup::OGroup(const uno::Reference< report::XGroups >& _xParent - ,const uno::Reference< uno::XComponentContext >& _xContext) -:GroupBase(m_aMutex) -,GroupPropertySet(_xContext,static_cast< GroupPropertySet::Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< ::rtl::OUString >()) -,m_xContext(_xContext) -,m_xParent(_xParent) -{ - DBG_CTOR( rpt_OGroup,NULL); - osl_incrementInterlockedCount(&m_refCount); - { - m_xFunctions = new OFunctions(this,m_xContext); - } - osl_decrementInterlockedCount( &m_refCount ); -} -//-------------------------------------------------------------------------- -// TODO: VirtualFunctionFinder: This is virtual function! -// -OGroup::~OGroup() -{ - DBG_DTOR( rpt_OGroup,NULL); -} -//-------------------------------------------------------------------------- -void OGroup::copyGroup(const uno::Reference< report::XGroup >& _xSource) -{ - ::comphelper::copyProperties(_xSource.get(),static_cast<GroupPropertySet*>(this)); - - if ( _xSource->getHeaderOn() ) - { - setHeaderOn(sal_True); - OSection::lcl_copySection(_xSource->getHeader(),m_xHeader); - } - - if ( _xSource->getFooterOn() ) - { - setFooterOn(sal_True); - OSection::lcl_copySection(_xSource->getFooter(),m_xFooter); - } -} -//-------------------------------------------------------------------------- -IMPLEMENT_FORWARD_XINTERFACE2(OGroup,GroupBase,GroupPropertySet) -//-------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OGroup::getImplementationName( ) throw(uno::RuntimeException) -{ - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.Group")); -} -//------------------------------------------------------------------------------ -uno::Sequence< ::rtl::OUString> OGroup::getSupportedServiceNames_Static(void) throw( uno::RuntimeException ) -{ - uno::Sequence< ::rtl::OUString> aSupported(1); - aSupported.getArray()[0] = SERVICE_GROUP; - return aSupported; -} -//------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString> SAL_CALL OGroup::getSupportedServiceNames() throw(uno::RuntimeException) -{ - return getSupportedServiceNames_Static(); -} -// ----------------------------------------------------------------------------- -sal_Bool SAL_CALL OGroup::supportsService( const ::rtl::OUString& _rServiceName ) throw(uno::RuntimeException) -{ - return ::comphelper::existsValue(_rServiceName,getSupportedServiceNames_Static()); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OGroup::dispose() throw(uno::RuntimeException) -{ - 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() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aProps.m_eSortAscending; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OGroup::setSortAscending( ::sal_Bool _sortascending ) throw (uno::RuntimeException) -{ - set(PROPERTY_SORTASCENDING,_sortascending,m_aProps.m_eSortAscending); -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OGroup::getHeaderOn() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_xHeader.is(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OGroup::setHeaderOn( ::sal_Bool _headeron ) throw (uno::RuntimeException) -{ - if ( _headeron != m_xHeader.is() ) - { - ::rtl::OUString sName(RPT_RESSTRING(RID_STR_GROUP_HEADER,m_xContext->getServiceManager())); - setSection(PROPERTY_HEADERON,_headeron,sName,m_xHeader); - } -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OGroup::getFooterOn() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_xFooter.is(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OGroup::setFooterOn( ::sal_Bool _footeron ) throw (uno::RuntimeException) -{ - if ( _footeron != m_xFooter.is() ) - { - ::rtl::OUString sName(RPT_RESSTRING(RID_STR_GROUP_FOOTER,m_xContext->getServiceManager())); - setSection(PROPERTY_FOOTERON,_footeron,sName,m_xFooter); - } -} -// ----------------------------------------------------------------------------- -uno::Reference< report::XSection > SAL_CALL OGroup::getHeader() throw (container::NoSuchElementException, uno::RuntimeException) -{ - 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() throw (container::NoSuchElementException, uno::RuntimeException) -{ - 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() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aProps.m_nGroupOn; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OGroup::setGroupOn( ::sal_Int16 _groupon ) throw (lang::IllegalArgumentException, uno::RuntimeException) -{ - if ( _groupon < report::GroupOn::DEFAULT || _groupon > report::GroupOn::INTERVAL ) - throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com::sun::star::report::GroupOn")) - ,*this - ,1 - ,m_xContext); - set(PROPERTY_GROUPON,_groupon,m_aProps.m_nGroupOn); -} -// ----------------------------------------------------------------------------- -::sal_Int32 SAL_CALL OGroup::getGroupInterval() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aProps.m_nGroupInterval; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OGroup::setGroupInterval( ::sal_Int32 _groupinterval ) throw (uno::RuntimeException) -{ - set(PROPERTY_GROUPINTERVAL,_groupinterval,m_aProps.m_nGroupInterval); -} -// ----------------------------------------------------------------------------- -::sal_Int16 SAL_CALL OGroup::getKeepTogether() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aProps.m_nKeepTogether; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OGroup::setKeepTogether( ::sal_Int16 _keeptogether ) throw (lang::IllegalArgumentException, uno::RuntimeException) -{ - if ( _keeptogether < report::KeepTogether::NO || _keeptogether > report::KeepTogether::WITH_FIRST_DETAIL ) - throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com::sun::star::report::KeepTogether")) - ,*this - ,1 - ,m_xContext); - set(PROPERTY_KEEPTOGETHER,_keeptogether,m_aProps.m_nKeepTogether); -} -// ----------------------------------------------------------------------------- -uno::Reference< report::XGroups > SAL_CALL OGroup::getGroups() throw (uno::RuntimeException) -{ - return m_xParent; -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OGroup::getExpression() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aProps.m_sExpression; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OGroup::setExpression( const ::rtl::OUString& _expression ) throw (uno::RuntimeException) -{ - set(PROPERTY_EXPRESSION,_expression,m_aProps.m_sExpression); -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OGroup::getStartNewColumn() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aProps.m_bStartNewColumn; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OGroup::setStartNewColumn( ::sal_Bool _startnewcolumn ) throw (uno::RuntimeException) -{ - set(PROPERTY_STARTNEWCOLUMN,_startnewcolumn,m_aProps.m_bStartNewColumn); -} -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OGroup::getResetPageNumber() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aProps.m_bResetPageNumber; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OGroup::setResetPageNumber( ::sal_Bool _resetpagenumber ) throw (uno::RuntimeException) -{ - set(PROPERTY_RESETPAGENUMBER,_resetpagenumber,m_aProps.m_bResetPageNumber); -} -// ----------------------------------------------------------------------------- -// XChild -uno::Reference< uno::XInterface > SAL_CALL OGroup::getParent( ) throw (uno::RuntimeException) -{ - return m_xParent; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OGroup::setParent( const uno::Reference< uno::XInterface >& /*Parent*/ ) throw (lang::NoSupportException, uno::RuntimeException) -{ - throw lang::NoSupportException(); -} -// ----------------------------------------------------------------------------- -uno::Reference< beans::XPropertySetInfo > SAL_CALL OGroup::getPropertySetInfo( ) throw(uno::RuntimeException) -{ - return GroupPropertySet::getPropertySetInfo(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OGroup::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) -{ - GroupPropertySet::setPropertyValue( aPropertyName, aValue ); -} -// ----------------------------------------------------------------------------- -uno::Any SAL_CALL OGroup::getPropertyValue( const ::rtl::OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - return GroupPropertySet::getPropertyValue( PropertyName); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OGroup::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - GroupPropertySet::addPropertyChangeListener( aPropertyName, xListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OGroup::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - GroupPropertySet::removePropertyChangeListener( aPropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OGroup::addVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - GroupPropertySet::addVetoableChangeListener( PropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OGroup::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - GroupPropertySet::removeVetoableChangeListener( PropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void OGroup::setSection( const ::rtl::OUString& _sProperty - ,const sal_Bool& _bOn - ,const ::rtl::OUString& _sName - ,uno::Reference< report::XSection>& _member) -{ - BoundListeners l; - { - ::osl::MutexGuard aGuard(m_aMutex); - prepareSet(_sProperty, uno::makeAny(_member), uno::makeAny(_bOn), &l); - lcl_createSectionIfNeeded(_bOn ,this,_member); - if ( _member.is() ) - _member->setName(_sName); - } - l.notify(); -} -// ----------------------------------------------------------------------------- -uno::Reference< report::XFunctions > SAL_CALL OGroup::getFunctions() throw (uno::RuntimeException) -{ - 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 deleted file mode 100644 index 9a1753bc0..000000000 --- a/reportdesign/source/core/api/Groups.cxx +++ /dev/null @@ -1,219 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_reportdesign.hxx" -#include "Groups.hxx" -#include "Group.hxx" -#include <tools/debug.hxx> -#include "core_resource.hxx" -#include "core_resource.hrc" -#include <boost/bind.hpp> -#include <algorithm> -// ============================================================================= -namespace reportdesign -{ -// ============================================================================= - using namespace com::sun::star; -DBG_NAME( rpt_OGroups ) -// ----------------------------------------------------------------------------- -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) -{ - DBG_CTOR( rpt_OGroups,NULL); -} -//-------------------------------------------------------------------------- -// TODO: VirtualFunctionFinder: This is virtual function! -// -OGroups::~OGroups() -{ - DBG_DTOR( rpt_OGroups,NULL); -} -//-------------------------------------------------------------------------- -void OGroups::copyGroups(const uno::Reference< report::XGroups >& _xSource) -{ - sal_Int32 nCount = _xSource->getCount(); - for (sal_Int32 i = 0; i != nCount; ++i) - { - OGroup* pGroup = new OGroup(this,m_xContext); - m_aGroups.push_back(pGroup); - uno::Reference<report::XGroup> xGroup(_xSource->getByIndex(i),uno::UNO_QUERY); - pGroup->copyGroup(xGroup); - } -} -// ----------------------------------------------------------------------------- -void SAL_CALL OGroups::dispose() throw(uno::RuntimeException) -{ - cppu::WeakComponentImplHelperBase::dispose(); -} -// ----------------------------------------------------------------------------- -// TODO: VirtualFunctionFinder: This is virtual function! -// -void SAL_CALL OGroups::disposing() -{ - ::std::for_each(m_aGroups.begin(),m_aGroups.end(),::boost::mem_fn(&com::sun::star::report::XGroup::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() throw (uno::RuntimeException) -{ - return m_xParent; -} -// ----------------------------------------------------------------------------- -uno::Reference< report::XGroup > SAL_CALL OGroups::createGroup( ) throw (uno::RuntimeException) -{ - return new OGroup(this,m_xContext); -} -// ----------------------------------------------------------------------------- -// XIndexContainer -void SAL_CALL OGroups::insertByIndex( ::sal_Int32 Index, const uno::Any& aElement ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - { - ::osl::MutexGuard aGuard(m_aMutex); - sal_Bool bAdd = (Index == static_cast<sal_Int32>(m_aGroups.size())); - if ( !bAdd ) - checkIndex(Index); - uno::Reference< report::XGroup > xGroup(aElement,uno::UNO_QUERY); - if ( !xGroup.is() ) - throw lang::IllegalArgumentException(RPT_RESSTRING(RID_STR_ARGUMENT_IS_NULL,m_xContext->getServiceManager()),*this,2); - - if ( bAdd ) - m_aGroups.push_back(xGroup); - else - { - TGroups::iterator aPos = m_aGroups.begin(); - ::std::advance(aPos,Index); - m_aGroups.insert(aPos, xGroup); - } - } - // notify our container listeners - container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::makeAny(Index), aElement, uno::Any()); - m_aContainerListeners.notifyEach(&container::XContainerListener::elementInserted,aEvent); -} - -// ----------------------------------------------------------------------------- -void SAL_CALL OGroups::removeByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - uno::Reference< report::XGroup > xGroup; - { - ::osl::MutexGuard aGuard(m_aMutex); - checkIndex(Index); - TGroups::iterator aPos = m_aGroups.begin(); - ::std::advance(aPos,Index); - xGroup = *aPos; - m_aGroups.erase(aPos); - } - container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::makeAny(Index), uno::makeAny(xGroup), uno::Any()); - m_aContainerListeners.notifyEach(&container::XContainerListener::elementRemoved,aEvent); -} -// ----------------------------------------------------------------------------- -// XIndexReplace -void SAL_CALL OGroups::replaceByIndex( ::sal_Int32 Index, const uno::Any& Element ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - 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(RPT_RESSTRING(RID_STR_ARGUMENT_IS_NULL,m_xContext->getServiceManager()),*this,2); - TGroups::iterator aPos = m_aGroups.begin(); - ::std::advance(aPos,Index); - aOldElement <<= *aPos; - *aPos = xGroup; - } - - container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::makeAny(Index), Element, aOldElement); - m_aContainerListeners.notifyEach(&container::XContainerListener::elementReplaced,aEvent); -} -// ----------------------------------------------------------------------------- -// XIndexAccess -::sal_Int32 SAL_CALL OGroups::getCount( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aGroups.size(); -} -// ----------------------------------------------------------------------------- -uno::Any SAL_CALL OGroups::getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - checkIndex(Index); - TGroups::iterator aPos = m_aGroups.begin(); - ::std::advance(aPos,Index); - return uno::makeAny(*aPos); -} -// ----------------------------------------------------------------------------- -// XElementAccess -uno::Type SAL_CALL OGroups::getElementType( ) throw (uno::RuntimeException) -{ - return ::getCppuType(static_cast< uno::Reference<report::XGroup>*>(NULL)); -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OGroups::hasElements( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return !m_aGroups.empty(); -} -// ----------------------------------------------------------------------------- -// XChild -uno::Reference< uno::XInterface > SAL_CALL OGroups::getParent( ) throw (uno::RuntimeException) -{ - return m_xParent; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OGroups::setParent( const uno::Reference< uno::XInterface >& /*Parent*/ ) throw (lang::NoSupportException, uno::RuntimeException) -{ - throw lang::NoSupportException(); -} -// ----------------------------------------------------------------------------- -// XContainer -void SAL_CALL OGroups::addContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException) -{ - m_aContainerListeners.addInterface(xListener); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OGroups::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException) -{ - m_aContainerListeners.removeInterface(xListener); -} -// ----------------------------------------------------------------------------- -void OGroups::checkIndex(sal_Int32 _nIndex) -{ - if ( _nIndex < 0 || static_cast<sal_Int32>(m_aGroups.size()) <= _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 deleted file mode 100644 index 99eb0b539..000000000 --- a/reportdesign/source/core/api/ImageControl.cxx +++ /dev/null @@ -1,503 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_reportdesign.hxx" -#include "ImageControl.hxx" -#include <com/sun/star/beans/PropertyAttribute.hpp> -#include <com/sun/star/beans/XPropertyState.hpp> -#include "corestrings.hrc" -#include "core_resource.hrc" -#include "core_resource.hxx" -#include <comphelper/sequence.hxx> -#include "Tools.hxx" -#include <tools/debug.hxx> -#include <comphelper/property.hxx> -#include "FormatCondition.hxx" -#include <com/sun/star/awt/ImageScaleMode.hpp> -#include <com/sun/star/text/ParagraphVertAlign.hpp> -#include "ReportHelperImpl.hxx" -// ============================================================================= -namespace reportdesign -{ -// ============================================================================= - using namespace com::sun::star; - using namespace comphelper; -uno::Sequence< ::rtl::OUString > lcl_getImageOptionals() -{ - ::rtl::OUString pProps[] = { - PROPERTY_CHARCOLOR - ,PROPERTY_CHAREMPHASIS - ,PROPERTY_CHARFONTCHARSET - ,PROPERTY_CHARFONTFAMILY - ,PROPERTY_CHARFONTNAME - ,PROPERTY_CHARFONTPITCH - ,PROPERTY_CHARFONTSTYLENAME - ,PROPERTY_CHARHEIGHT - ,PROPERTY_CHARPOSTURE - ,PROPERTY_CHARRELIEF - ,PROPERTY_FONTDESCRIPTOR - ,PROPERTY_FONTDESCRIPTORASIAN - ,PROPERTY_FONTDESCRIPTORCOMPLEX - ,PROPERTY_CONTROLTEXTEMPHASISMARK - ,PROPERTY_CHARROTATION - ,PROPERTY_CHARSCALEWIDTH - ,PROPERTY_CHARSTRIKEOUT - ,PROPERTY_CHARUNDERLINECOLOR - ,PROPERTY_CHARUNDERLINE - ,PROPERTY_CHARWEIGHT - ,PROPERTY_CHARWORDMODE - ,PROPERTY_CHARFLASH - ,PROPERTY_CHARAUTOKERNING - ,PROPERTY_CHARESCAPEMENTHEIGHT - ,PROPERTY_CHARLOCALE - ,PROPERTY_CHARESCAPEMENT - ,PROPERTY_CHARCASEMAP - ,PROPERTY_CHARCOMBINEISON - ,PROPERTY_CHARCOMBINEPREFIX - ,PROPERTY_CHARCOMBINESUFFIX - ,PROPERTY_CHARHIDDEN - ,PROPERTY_CHARSHADOWED - ,PROPERTY_CHARCONTOURED - ,PROPERTY_VISITEDCHARSTYLENAME - ,PROPERTY_UNVISITEDCHARSTYLENAME - ,PROPERTY_CHARKERNING - ,PROPERTY_MASTERFIELDS - ,PROPERTY_DETAILFIELDS - ,PROPERTY_PARAADJUST - , PROPERTY_CHAREMPHASISASIAN - , PROPERTY_CHARFONTNAMEASIAN - , PROPERTY_CHARFONTSTYLENAMEASIAN - , PROPERTY_CHARFONTFAMILYASIAN - , PROPERTY_CHARFONTCHARSETASIAN - , PROPERTY_CHARFONTPITCHASIAN - , PROPERTY_CHARHEIGHTASIAN - , PROPERTY_CHARUNDERLINEASIAN - , PROPERTY_CHARWEIGHTASIAN - , PROPERTY_CHARPOSTUREASIAN - , PROPERTY_CHARWORDMODEASIAN - , PROPERTY_CHARROTATIONASIAN - , PROPERTY_CHARSCALEWIDTHASIAN - , PROPERTY_CHARLOCALEASIAN - , PROPERTY_CHAREMPHASISCOMPLEX - , PROPERTY_CHARFONTNAMECOMPLEX - , PROPERTY_CHARFONTSTYLENAMECOMPLEX - , PROPERTY_CHARFONTFAMILYCOMPLEX - , PROPERTY_CHARFONTCHARSETCOMPLEX - , PROPERTY_CHARFONTPITCHCOMPLEX - , PROPERTY_CHARHEIGHTCOMPLEX - , PROPERTY_CHARUNDERLINECOMPLEX - , PROPERTY_CHARWEIGHTCOMPLEX - , PROPERTY_CHARPOSTURECOMPLEX - , PROPERTY_CHARWORDMODECOMPLEX - , PROPERTY_CHARROTATIONCOMPLEX - , PROPERTY_CHARSCALEWIDTHCOMPLEX - , PROPERTY_CHARLOCALECOMPLEX - - }; - return uno::Sequence< ::rtl::OUString >(pProps,SAL_N_ELEMENTS(pProps)); -} - -DBG_NAME( rpt_OImageControl ) -// ----------------------------------------------------------------------------- -OImageControl::OImageControl(uno::Reference< uno::XComponentContext > const & _xContext) -:ImageControlBase(m_aMutex) -,ImageControlPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getImageOptionals()) -,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) -,m_nScaleMode(awt::ImageScaleMode::None) -,m_bPreserveIRI(sal_True) -{ - DBG_CTOR( rpt_OImageControl,NULL); - m_aProps.aComponent.m_sName = RPT_RESSTRING(RID_STR_IMAGECONTROL,m_aProps.aComponent.m_xContext->getServiceManager()); -} -// ----------------------------------------------------------------------------- -OImageControl::OImageControl(uno::Reference< uno::XComponentContext > const & _xContext - ,const uno::Reference< lang::XMultiServiceFactory>& _xFactory - ,uno::Reference< drawing::XShape >& _xShape) -:ImageControlBase(m_aMutex) -,ImageControlPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getImageOptionals()) -,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) -,m_nScaleMode(awt::ImageScaleMode::None) -,m_bPreserveIRI(sal_True) -{ - DBG_CTOR( rpt_OImageControl,NULL); - m_aProps.aComponent.m_sName = RPT_RESSTRING(RID_STR_IMAGECONTROL,m_aProps.aComponent.m_xContext->getServiceManager()); - m_aProps.aComponent.m_xFactory = _xFactory; - osl_incrementInterlockedCount( &m_refCount ); - { - m_aProps.aComponent.setShape(_xShape,this,m_refCount); - } - osl_decrementInterlockedCount( &m_refCount ); -} -// ----------------------------------------------------------------------------- -OImageControl::~OImageControl() -{ - DBG_DTOR( rpt_OImageControl,NULL); -} -// ----------------------------------------------------------------------------- -//IMPLEMENT_FORWARD_XINTERFACE2(OImageControl,ImageControlBase,ImageControlPropertySet) -IMPLEMENT_FORWARD_REFCOUNT( OImageControl, ImageControlBase ) -// -------------------------------------------------------------------------------- -uno::Any SAL_CALL OImageControl::queryInterface( const uno::Type& _rType ) throw (uno::RuntimeException) -{ - 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() throw(uno::RuntimeException) -{ - ImageControlPropertySet::dispose(); - cppu::WeakComponentImplHelperBase::dispose(); -} -// ----------------------------------------------------------------------------- -::rtl::OUString OImageControl::getImplementationName_Static( ) throw(uno::RuntimeException) -{ - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.OImageControl")); -} - -//-------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OImageControl::getImplementationName( ) throw(uno::RuntimeException) -{ - return getImplementationName_Static(); -} -//-------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > OImageControl::getSupportedServiceNames_Static( ) throw(uno::RuntimeException) -{ - uno::Sequence< ::rtl::OUString > aServices(1); - aServices.getArray()[0] = SERVICE_IMAGECONTROL; - - return aServices; -} -//------------------------------------------------------------------------------ -uno::Reference< uno::XInterface > OImageControl::create(uno::Reference< uno::XComponentContext > const & xContext) -{ - return *(new OImageControl(xContext)); -} - -//-------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > SAL_CALL OImageControl::getSupportedServiceNames( ) throw(uno::RuntimeException) -{ - return getSupportedServiceNames_Static(); -} -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL OImageControl::supportsService(const ::rtl::OUString& ServiceName) throw( uno::RuntimeException ) -{ - return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_Static()); -} -// ----------------------------------------------------------------------------- -// XReportComponent -REPORTCOMPONENT_IMPL(OImageControl,m_aProps.aComponent) -REPORTCOMPONENT_IMPL2(OImageControl,m_aProps.aComponent) -REPORTCOMPONENT_NOMASTERDETAIL(OImageControl) -NO_REPORTCONTROLFORMAT_IMPL(OImageControl) -::rtl::OUString SAL_CALL OImageControl::getHyperLinkURL() throw (uno::RuntimeException, beans::UnknownPropertyException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aProps.aFormatProperties.sHyperLinkURL; -} -void SAL_CALL OImageControl::setHyperLinkURL(const ::rtl::OUString & the_value) throw (uno::RuntimeException, beans::UnknownPropertyException) -{ - set(PROPERTY_HYPERLINKURL,the_value,m_aProps.aFormatProperties.sHyperLinkURL); -} -::rtl::OUString SAL_CALL OImageControl::getHyperLinkTarget() throw (uno::RuntimeException, beans::UnknownPropertyException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aProps.aFormatProperties.sHyperLinkTarget; -} -void SAL_CALL OImageControl::setHyperLinkTarget(const ::rtl::OUString & the_value) throw (uno::RuntimeException, beans::UnknownPropertyException) -{ - set(PROPERTY_HYPERLINKTARGET,the_value,m_aProps.aFormatProperties.sHyperLinkTarget); -} -::rtl::OUString SAL_CALL OImageControl::getHyperLinkName() throw (uno::RuntimeException, beans::UnknownPropertyException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aProps.aFormatProperties.sHyperLinkName; -} -void SAL_CALL OImageControl::setHyperLinkName(const ::rtl::OUString & the_value) throw (uno::RuntimeException, beans::UnknownPropertyException) -{ - set(PROPERTY_HYPERLINKNAME,the_value,m_aProps.aFormatProperties.sHyperLinkName); -} - -// ----------------------------------------------------------------------------- -::sal_Int32 SAL_CALL OImageControl::getControlBackground() throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aProps.aFormatProperties.m_bBackgroundTransparent ? COL_TRANSPARENT : m_aProps.aFormatProperties.nBackgroundColor; -} - -void SAL_CALL OImageControl::setControlBackground( ::sal_Int32 _backgroundcolor ) throw (uno::RuntimeException, beans::UnknownPropertyException) -{ - sal_Bool bTransparent = _backgroundcolor == static_cast<sal_Int32>(COL_TRANSPARENT); - setControlBackgroundTransparent(bTransparent); - if ( !bTransparent ) - set(PROPERTY_CONTROLBACKGROUND,_backgroundcolor,m_aProps.aFormatProperties.nBackgroundColor); -} - -::sal_Bool SAL_CALL OImageControl::getControlBackgroundTransparent() throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aProps.aFormatProperties.m_bBackgroundTransparent; -} - -void SAL_CALL OImageControl::setControlBackgroundTransparent( ::sal_Bool _controlbackgroundtransparent ) throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - set(PROPERTY_CONTROLBACKGROUNDTRANSPARENT,_controlbackgroundtransparent,m_aProps.aFormatProperties.m_bBackgroundTransparent); - if ( _controlbackgroundtransparent ) - set(PROPERTY_CONTROLBACKGROUND,static_cast<sal_Int32>(COL_TRANSPARENT),m_aProps.aFormatProperties.nBackgroundColor); -} - -// ----------------------------------------------------------------------------- -uno::Reference< beans::XPropertySetInfo > SAL_CALL OImageControl::getPropertySetInfo( ) throw(uno::RuntimeException) -{ - return ImageControlPropertySet::getPropertySetInfo(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OImageControl::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) -{ - ImageControlPropertySet::setPropertyValue( aPropertyName, aValue ); -} -// ----------------------------------------------------------------------------- -uno::Any SAL_CALL OImageControl::getPropertyValue( const ::rtl::OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - return ImageControlPropertySet::getPropertyValue( PropertyName); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OImageControl::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - ImageControlPropertySet::addPropertyChangeListener( aPropertyName, xListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OImageControl::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - ImageControlPropertySet::removePropertyChangeListener( aPropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OImageControl::addVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - ImageControlPropertySet::addVetoableChangeListener( PropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OImageControl::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - ImageControlPropertySet::removeVetoableChangeListener( PropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -// XReportControlModel -::rtl::OUString SAL_CALL OImageControl::getDataField() throw ( beans::UnknownPropertyException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aProps.aDataField; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OImageControl::setDataField( const ::rtl::OUString& _datafield ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException) -{ - set(PROPERTY_DATAFIELD,_datafield,m_aProps.aDataField); -} -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OImageControl::getPrintWhenGroupChange() throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aProps.bPrintWhenGroupChange; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OImageControl::setPrintWhenGroupChange( ::sal_Bool _printwhengroupchange ) throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - set(PROPERTY_PRINTWHENGROUPCHANGE,_printwhengroupchange,m_aProps.bPrintWhenGroupChange); -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OImageControl::getConditionalPrintExpression() throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aProps.aConditionalPrintExpression; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OImageControl::setConditionalPrintExpression( const ::rtl::OUString& _conditionalprintexpression ) throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - set(PROPERTY_CONDITIONALPRINTEXPRESSION,_conditionalprintexpression,m_aProps.aConditionalPrintExpression); -} - -// ----------------------------------------------------------------------------- - -// XCloneable -uno::Reference< util::XCloneable > SAL_CALL OImageControl::createClone( ) throw (uno::RuntimeException) -{ - 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.get(); -} -// ----------------------------------------------------------------------------- - -// XImageControl -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OImageControl::getImageURL() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aImageURL; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OImageControl::setImageURL( const ::rtl::OUString& _imageurl ) throw (uno::RuntimeException) -{ - set(PROPERTY_IMAGEURL,_imageurl,m_aImageURL); -} -// ----------------------------------------------------------------------------- -uno::Reference< awt::XImageProducer > SAL_CALL OImageControl::getImageProducer( ) throw (uno::RuntimeException) -{ - return uno::Reference< awt::XImageProducer >(); -} -// ----------------------------------------------------------------------------- -// XChild -uno::Reference< uno::XInterface > SAL_CALL OImageControl::getParent( ) throw (uno::RuntimeException) -{ - return OShapeHelper::getParent(this); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OImageControl::setParent( const uno::Reference< uno::XInterface >& Parent ) throw (lang::NoSupportException, uno::RuntimeException) -{ - OShapeHelper::setParent(Parent,this); -} -uno::Reference< report::XFormatCondition > SAL_CALL OImageControl::createFormatCondition( ) throw (uno::Exception, uno::RuntimeException) -{ - return new OFormatCondition(m_aProps.aComponent.m_xContext); -} -// ----------------------------------------------------------------------------- -// XContainer -void SAL_CALL OImageControl::addContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException) -{ - m_aProps.addContainerListener(xListener); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OImageControl::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException) -{ - m_aProps.removeContainerListener(xListener); -} -// ----------------------------------------------------------------------------- -// XElementAccess -uno::Type SAL_CALL OImageControl::getElementType( ) throw (uno::RuntimeException) -{ - return ::getCppuType(static_cast< uno::Reference<report::XFormatCondition>*>(NULL)); -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OImageControl::hasElements( ) throw (uno::RuntimeException) -{ - return m_aProps.hasElements(); -} -// ----------------------------------------------------------------------------- -// XIndexContainer -void SAL_CALL OImageControl::insertByIndex( ::sal_Int32 Index, const uno::Any& Element ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - m_aProps.insertByIndex(Index,Element); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OImageControl::removeByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - m_aProps.removeByIndex(Index); -} -// ----------------------------------------------------------------------------- -// XIndexReplace -void SAL_CALL OImageControl::replaceByIndex( ::sal_Int32 Index, const uno::Any& Element ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - m_aProps.replaceByIndex(Index,Element); -} -// ----------------------------------------------------------------------------- -// XIndexAccess -::sal_Int32 SAL_CALL OImageControl::getCount( ) throw (uno::RuntimeException) -{ - return m_aProps.getCount(); -} -// ----------------------------------------------------------------------------- -uno::Any SAL_CALL OImageControl::getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - return m_aProps.getByIndex( Index ); -} -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -// XShape -awt::Point SAL_CALL OImageControl::getPosition( ) throw (uno::RuntimeException) -{ - return OShapeHelper::getPosition(this); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OImageControl::setPosition( const awt::Point& aPosition ) throw (uno::RuntimeException) -{ - OShapeHelper::setPosition(aPosition,this); -} -// ----------------------------------------------------------------------------- -awt::Size SAL_CALL OImageControl::getSize( ) throw (uno::RuntimeException) -{ - return OShapeHelper::getSize(this); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OImageControl::setSize( const awt::Size& aSize ) throw (beans::PropertyVetoException, uno::RuntimeException) -{ - OShapeHelper::setSize(aSize,this); -} -// ----------------------------------------------------------------------------- - -// XShapeDescriptor -::rtl::OUString SAL_CALL OImageControl::getShapeType( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - if ( m_aProps.aComponent.m_xShape.is() ) - return m_aProps.aComponent.m_xShape->getShapeType(); - return ::rtl::OUString(); -} -// ----------------------------------------------------------------------------- -::sal_Int16 SAL_CALL OImageControl::getScaleMode() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_nScaleMode; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OImageControl::setScaleMode( ::sal_Int16 _scalemode ) throw (lang::IllegalArgumentException, uno::RuntimeException) -{ - if ( _scalemode < awt::ImageScaleMode::None ||_scalemode > awt::ImageScaleMode::Anisotropic ) - throw lang::IllegalArgumentException(); - set(PROPERTY_SCALEMODE,_scalemode,m_nScaleMode); -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OImageControl::getPreserveIRI() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_bPreserveIRI; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OImageControl::setPreserveIRI( ::sal_Bool _preserveiri ) throw (uno::RuntimeException) -{ - 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 deleted file mode 100644 index ca7f2c13e..000000000 --- a/reportdesign/source/core/api/ReportComponent.cxx +++ /dev/null @@ -1,153 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_reportdesign.hxx" -#include "ReportComponent.hxx" - -#include "corestrings.hrc" -#include <vcl/svapp.hxx> -#include <vcl/outdev.hxx> -#include <toolkit/helper/vclunohelper.hxx> -#include <tools/debug.hxx> -#include <com/sun/star/awt/FontWeight.hpp> -#include <com/sun/star/awt/FontWidth.hpp> -#include "ReportControlModel.hxx" -#include <com/sun/star/reflection/XProxyFactory.hpp> -#include <com/sun/star/text/ParagraphVertAlign.hpp> -#include <com/sun/star/style/ParagraphAdjust.hpp> -#include <com/sun/star/i18n/ScriptType.hpp> -#include <editeng/unolingu.hxx> -#include <unotools/syslocale.hxx> -#include <unotools/lingucfg.hxx> -#include <i18npool/mslangid.hxx> - -// ============================================================================= -namespace reportdesign -{ -// ============================================================================= - using namespace com::sun::star; - using namespace comphelper; - -void lcl_getDefaultFonts( Font& rLatinFont, Font& rCJKFont, 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().GetUILanguage(); - switch( eUiLanguage ) - { - case LANGUAGE_KOREAN: - case LANGUAGE_KOREAN_JOHAB: - eLatin = eUiLanguage; - break; - } - - rLatinFont = OutputDevice::GetDefaultFont( DEFAULTFONT_LATIN_PRESENTATION, eLatin, DEFAULTFONT_FLAGS_ONLYONE ); - rCJKFont = OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_PRESENTATION, _eCJK, DEFAULTFONT_FLAGS_ONLYONE ); - rCTLFont = OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_PRESENTATION, _eCTL, DEFAULTFONT_FLAGS_ONLYONE ) ; -} -OFormatProperties::OFormatProperties() - :nAlign(style::ParagraphAdjust_LEFT) - ,nFontEmphasisMark(0) - ,nFontRelief(0) - ,nTextColor(0) - ,nTextLineColor(0) - ,nCharUnderlineColor(0xFFFFFFFF) - ,nBackgroundColor(COL_TRANSPARENT) - ,aVerticalAlignment( style::VerticalAlignment_TOP ) - ,nCharEscapement(0) - ,nCharCaseMap(0) - ,nCharKerning(0) - ,nCharEscapementHeight(100) - ,m_bBackgroundTransparent(sal_True) - ,bCharFlash(sal_False) - ,bCharAutoKerning(sal_False) - ,bCharCombineIsOn(sal_False) - ,bCharHidden(sal_False) - ,bCharShadowed(sal_False) - ,bCharContoured(sal_False) -{ - try - { - SvtLinguConfig aLinguConfig; - using namespace ::com::sun::star::i18n::ScriptType; - - aLinguConfig.GetProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultLocale"))) >>= aCharLocale; - LanguageType eCurLang = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aCharLocale), LATIN); - aLinguConfig.GetProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultLocale_CJK"))) >>= aCharLocaleAsian; - LanguageType eCurLangCJK = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aCharLocaleAsian), ASIAN); - aLinguConfig.GetProperty(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultLocale_CTL"))) >>= aCharLocaleComplex; - LanguageType eCurLangCTL = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aCharLocaleComplex), COMPLEX); - - 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_incrementInterlockedCount( &_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_decrementInterlockedCount( &_rRefCount ); -} -// ----------------------------------------------------------------------------- -OReportComponentProperties::~OReportComponentProperties() -{ - if ( m_xProxy.is() ) - { - m_xProxy->setDelegator( NULL ); - 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 deleted file mode 100644 index f3f1011de..000000000 --- a/reportdesign/source/core/api/ReportControlModel.cxx +++ /dev/null @@ -1,160 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_reportdesign.hxx" -#include "ReportControlModel.hxx" -#include <com/sun/star/beans/XMultiPropertySet.hpp> -#include <com/sun/star/beans/XPropertyState.hpp> -namespace reportdesign -{ -using namespace com::sun::star; -using namespace comphelper; - -bool operator==( const ::com::sun::star::awt::FontDescriptor& _lhs, const ::com::sun::star::awt::FontDescriptor& _rhs ) -{ - return ( _lhs.Name == _rhs.Name ) - && ( _lhs.Height == _rhs.Height ) - && ( _lhs.Width == _rhs.Width ) - && ( _lhs.StyleName == _rhs.StyleName ) - && ( _lhs.Family == _rhs.Family ) - && ( _lhs.CharSet == _rhs.CharSet ) - && ( _lhs.Pitch == _rhs.Pitch ) - && ( _lhs.CharacterWidth == _rhs.CharacterWidth ) - && ( _lhs.Weight == _rhs.Weight ) - && ( _lhs.Slant == _rhs.Slant ) - && ( _lhs.Underline == _rhs.Underline ) - && ( _lhs.Strikeout == _rhs.Strikeout ) - && ( _lhs.Orientation == _rhs.Orientation ) - && ( _lhs.Kerning == _rhs.Kerning ) - && ( _lhs.WordLineMode == _rhs.WordLineMode ) - && ( _lhs.Type == _rhs.Type ); -} - -// ----------------------------------------------------------------------------- -// XContainer -void OReportControlModel::addContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException) -{ - aContainerListeners.addInterface(xListener); -} -// ----------------------------------------------------------------------------- -void OReportControlModel::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException) -{ - aContainerListeners.removeInterface(xListener); -} -// ----------------------------------------------------------------------------- -::sal_Bool OReportControlModel::hasElements( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_rMutex); - return !m_aFormatConditions.empty(); -} -// ----------------------------------------------------------------------------- -// XIndexContainer -void OReportControlModel::insertByIndex( ::sal_Int32 Index, const uno::Any& Element ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - uno::Reference<report::XFormatCondition> xElement(Element,uno::UNO_QUERY); - if ( !xElement.is() ) - throw lang::IllegalArgumentException(); - - uno::Reference< container::XContainer > xBroadcaster; - { - ::osl::MutexGuard aGuard(m_rMutex); - xBroadcaster = m_pOwner; - if ( Index > static_cast<sal_Int32>(m_aFormatConditions.size()) ) - throw lang::IndexOutOfBoundsException(); - - m_aFormatConditions.insert(m_aFormatConditions.begin() + Index,xElement); - } - - // notify our container listeners - container::ContainerEvent aEvent(xBroadcaster, uno::makeAny(Index), Element, uno::Any()); - aContainerListeners.notifyEach(&container::XContainerListener::elementInserted,aEvent); -} -// ----------------------------------------------------------------------------- -void OReportControlModel::removeByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - uno::Any Element; - uno::Reference< container::XContainer > xBroadcaster; - { - ::osl::MutexGuard aGuard(m_rMutex); - xBroadcaster = m_pOwner; - checkIndex(Index); - Element <<= m_aFormatConditions[Index]; - m_aFormatConditions.erase(m_aFormatConditions.begin() + Index); - } - container::ContainerEvent aEvent(xBroadcaster, uno::makeAny(Index), Element, uno::Any()); - aContainerListeners.notifyEach(&container::XContainerListener::elementRemoved,aEvent); -} -// ----------------------------------------------------------------------------- -// XIndexReplace -void OReportControlModel::replaceByIndex( ::sal_Int32 Index, const uno::Any& Element ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - uno::Reference<report::XFormatCondition> xElement(Element,uno::UNO_QUERY); - if ( !xElement.is() ) - throw lang::IllegalArgumentException(); - uno::Reference< container::XContainer > xBroadcaster; - { - ::osl::MutexGuard aGuard(m_rMutex); - xBroadcaster = m_pOwner; - checkIndex(Index); - m_aFormatConditions[Index] = xElement; - } - container::ContainerEvent aEvent(xBroadcaster, uno::makeAny(Index), Element, uno::Any()); - aContainerListeners.notifyEach(&container::XContainerListener::elementReplaced,aEvent); -} -// ----------------------------------------------------------------------------- -// XIndexAccess -::sal_Int32 OReportControlModel::getCount( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_rMutex); - return m_aFormatConditions.size(); -} -// ----------------------------------------------------------------------------- -uno::Any OReportControlModel::getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - 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 || static_cast<sal_Int32>(m_aFormatConditions.size()) <= _nIndex ) - throw lang::IndexOutOfBoundsException(); -} -// ----------------------------------------------------------------------------- -bool OReportControlModel::isInterfaceForbidden(const uno::Type& _rType) -{ - return (_rType == ::getCppuType((const uno::Reference< beans::XPropertyState>* )0) || _rType == ::getCppuType((const uno::Reference< beans::XMultiPropertySet>* )0)); -} -// ----------------------------------------------------------------------------- -} // reportdesign - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx deleted file mode 100644 index 5ebf76f4f..000000000 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ /dev/null @@ -1,2921 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_reportdesign.hxx" -#include "ReportDefinition.hxx" - -#include "FixedLine.hxx" -#include "FixedText.hxx" -#include "FormattedField.hxx" -#include "Functions.hxx" -#include "Groups.hxx" -#include "ImageControl.hxx" -#include "ReportComponent.hxx" -#include "ReportHelperImpl.hxx" -#include "RptDef.hxx" -#include "RptModel.hxx" -#include "Section.hxx" -#include "Shape.hxx" -#include "Tools.hxx" -#include "UndoEnv.hxx" -#include "core_resource.hrc" -#include "core_resource.hxx" -#include "corestrings.hrc" - -/** === begin UNO includes === **/ -#include <com/sun/star/beans/PropertyAttribute.hpp> -#include <com/sun/star/beans/XMultiPropertyStates.hpp> -#include <com/sun/star/chart2/data/DatabaseDataProvider.hpp> -#include <com/sun/star/document/EventObject.hpp> -#include <com/sun/star/document/XEventListener.hpp> -#include <com/sun/star/document/XExporter.hpp> -#include <com/sun/star/document/XFilter.hpp> -#include <com/sun/star/document/XImporter.hpp> -#include <com/sun/star/embed/Aspects.hpp> -#include <com/sun/star/embed/ElementModes.hpp> -#include <com/sun/star/embed/EmbedMapUnits.hpp> -#include <com/sun/star/embed/EntryInitModes.hpp> -#include <com/sun/star/embed/XEmbedPersist.hpp> -#include <com/sun/star/embed/XTransactedObject.hpp> -#include <com/sun/star/frame/FrameSearchFlag.hpp> -#include <com/sun/star/frame/XComponentLoader.hpp> -#include <com/sun/star/io/XActiveDataSource.hpp> -#include <com/sun/star/io/XSeekable.hpp> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <com/sun/star/report/GroupKeepTogether.hpp> -#include <com/sun/star/report/ReportPrintOption.hpp> -#include <com/sun/star/report/XFunction.hpp> -#include <com/sun/star/sdb/CommandType.hpp> -#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp> -#include <com/sun/star/style/GraphicLocation.hpp> -#include <com/sun/star/style/NumberingType.hpp> -#include <com/sun/star/style/PageStyleLayout.hpp> -#include <com/sun/star/style/XStyle.hpp> -#include <com/sun/star/table/BorderLine.hpp> -#include <com/sun/star/table/ShadowFormat.hpp> -#include <com/sun/star/task/ErrorCodeIOException.hpp> -#include <com/sun/star/task/XStatusIndicator.hpp> -#include <com/sun/star/task/XStatusIndicatorFactory.hpp> -#include <com/sun/star/ui/XUIConfigurationStorage.hpp> -#include <com/sun/star/xml/AttributeData.hpp> -#include <com/sun/star/xml/sax/XDocumentHandler.hpp> -/** === end UNO includes === **/ - -#include <comphelper/broadcasthelper.hxx> -#include <comphelper/documentconstants.hxx> -#include <comphelper/genericpropertyset.hxx> -#include <comphelper/mediadescriptor.hxx> -#include <comphelper/mimeconfighelper.hxx> -#include <comphelper/namecontainer.hxx> -#include <comphelper/namedvaluecollection.hxx> -#include <comphelper/numberedcollection.hxx> -#include <comphelper/proparrhlp.hxx> -#include <comphelper/property.hxx> -#include <comphelper/propertysetinfo.hxx> -#include <comphelper/propertystatecontainer.hxx> -#include <comphelper/seqstream.hxx> -#include <comphelper/sequence.hxx> -#include <comphelper/storagehelper.hxx> -#include <comphelper/uno3.hxx> -#include <connectivity/CommonTools.hxx> -#include <connectivity/dbconversion.hxx> -#include <connectivity/dbtools.hxx> -#include <cppuhelper/exc_hlp.hxx> -#include <cppuhelper/interfacecontainer.h> -#include <dbaccess/dbaundomanager.hxx> -#include <editeng/paperinf.hxx> -#include <framework/titlehelper.hxx> -#include <osl/thread.hxx> -#include <svl/itempool.hxx> -#include <svl/undo.hxx> -#include <svx/svdlayer.hxx> -#include <svx/unofill.hxx> -#include <svx/xmleohlp.hxx> -#include <svx/xmlgrhlp.hxx> -#include <tools/debug.hxx> -#include <tools/diagnose_ex.h> -#include <unotools/moduleoptions.hxx> -#include <unotools/saveopt.hxx> -#include <unotools/streamwrap.hxx> -#include <vcl/svapp.hxx> -#include <vcl/virdev.hxx> - -#include <boost/bind.hpp> -#include <boost/mem_fn.hpp> -#include <boost/utility.hpp> - -#define MAP_LEN(x) x, sizeof(x) - 1 -#define MAP_CHAR_LEN(x) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(x)) -// page styles -#define SC_UNO_PAGE_GRAPHICFILT "BackGraphicFilter" -#define SC_UNO_PAGE_LEFTBORDER "LeftBorder" -#define SC_UNO_PAGE_RIGHTBORDER "RightBorder" -#define SC_UNO_PAGE_BOTTBORDER "BottomBorder" -#define SC_UNO_PAGE_TOPBORDER "TopBorder" -#define SC_UNO_PAGE_LEFTBRDDIST "LeftBorderDistance" -#define SC_UNO_PAGE_RIGHTBRDDIST "RightBorderDistance" -#define SC_UNO_PAGE_BOTTBRDDIST "BottomBorderDistance" -#define SC_UNO_PAGE_TOPBRDDIST "TopBorderDistance" -#define SC_UNO_PAGE_BORDERDIST "BorderDistance" -#define SC_UNO_PAGE_SHADOWFORM "ShadowFormat" -#define SC_UNO_PAGE_PAPERTRAY "PrinterPaperTray" -#define SC_UNO_PAGE_SCALEVAL "PageScale" -#define SC_UNO_PAGE_SCALETOPAG "ScaleToPages" -#define SC_UNO_PAGE_SCALETOX "ScaleToPagesX" -#define SC_UNO_PAGE_SCALETOY "ScaleToPagesY" -#define SC_UNO_PAGE_FIRSTPAGE "FirstPageNumber" -#define SC_UNO_PAGE_LEFTHDRCONT "LeftPageHeaderContent" -#define SC_UNO_PAGE_LEFTFTRCONT "LeftPageFooterContent" -#define SC_UNO_PAGE_RIGHTHDRCON "RightPageHeaderContent" -#define SC_UNO_PAGE_RIGHTFTRCON "RightPageFooterContent" -#define SC_UNO_PAGE_PRINTFORMUL "PrintFormulas" -#define SC_UNO_PAGE_PRINTZERO "PrintZeroValues" -#define SC_UNO_PAGE_HDRBACKCOL "HeaderBackColor" -#define SC_UNO_PAGE_HDRBACKTRAN "HeaderBackTransparent" -#define SC_UNO_PAGE_HDRGRFFILT "HeaderBackGraphicFilter" -#define SC_UNO_PAGE_HDRGRFLOC "HeaderBackGraphicLocation" -#define SC_UNO_PAGE_HDRGRFURL "HeaderBackGraphicURL" -#define SC_UNO_PAGE_HDRLEFTBOR "HeaderLeftBorder" -#define SC_UNO_PAGE_HDRRIGHTBOR "HeaderRightBorder" -#define SC_UNO_PAGE_HDRBOTTBOR "HeaderBottomBorder" -#define SC_UNO_PAGE_HDRTOPBOR "HeaderTopBorder" -#define SC_UNO_PAGE_HDRLEFTBDIS "HeaderLeftBorderDistance" -#define SC_UNO_PAGE_HDRRIGHTBDIS "HeaderRightBorderDistance" -#define SC_UNO_PAGE_HDRBOTTBDIS "HeaderBottomBorderDistance" -#define SC_UNO_PAGE_HDRTOPBDIS "HeaderTopBorderDistance" -#define SC_UNO_PAGE_HDRBRDDIST "HeaderBorderDistance" -#define SC_UNO_PAGE_HDRSHADOW "HeaderShadowFormat" -#define SC_UNO_PAGE_HDRLEFTMAR "HeaderLeftMargin" -#define SC_UNO_PAGE_HDRRIGHTMAR "HeaderRightMargin" -#define SC_UNO_PAGE_HDRBODYDIST "HeaderBodyDistance" -#define SC_UNO_PAGE_HDRHEIGHT "HeaderHeight" -#define SC_UNO_PAGE_HDRON "HeaderIsOn" -#define SC_UNO_PAGE_HDRDYNAMIC "HeaderIsDynamicHeight" -#define SC_UNO_PAGE_HDRSHARED "HeaderIsShared" -#define SC_UNO_PAGE_FTRBACKCOL "FooterBackColor" -#define SC_UNO_PAGE_FTRBACKTRAN "FooterBackTransparent" -#define SC_UNO_PAGE_FTRGRFFILT "FooterBackGraphicFilter" -#define SC_UNO_PAGE_FTRGRFLOC "FooterBackGraphicLocation" -#define SC_UNO_PAGE_FTRGRFURL "FooterBackGraphicURL" -#define SC_UNO_PAGE_FTRLEFTBOR "FooterLeftBorder" -#define SC_UNO_PAGE_FTRRIGHTBOR "FooterRightBorder" -#define SC_UNO_PAGE_FTRBOTTBOR "FooterBottomBorder" -#define SC_UNO_PAGE_FTRTOPBOR "FooterTopBorder" -#define SC_UNO_PAGE_FTRLEFTBDIS "FooterLeftBorderDistance" -#define SC_UNO_PAGE_FTRRIGHTBDIS "FooterRightBorderDistance" -#define SC_UNO_PAGE_FTRBOTTBDIS "FooterBottomBorderDistance" -#define SC_UNO_PAGE_FTRTOPBDIS "FooterTopBorderDistance" -#define SC_UNO_PAGE_FTRBRDDIST "FooterBorderDistance" -#define SC_UNO_PAGE_FTRSHADOW "FooterShadowFormat" -#define SC_UNO_PAGE_FTRLEFTMAR "FooterLeftMargin" -#define SC_UNO_PAGE_FTRRIGHTMAR "FooterRightMargin" -#define SC_UNO_PAGE_FTRBODYDIST "FooterBodyDistance" -#define SC_UNO_PAGE_FTRHEIGHT "FooterHeight" -#define SC_UNO_PAGE_FTRON "FooterIsOn" -#define SC_UNO_PAGE_FTRDYNAMIC "FooterIsDynamicHeight" -#define SC_UNO_PAGE_FTRSHARED "FooterIsShared" - -// ============================================================================= -namespace reportdesign -{ -// ============================================================================= - using namespace com::sun::star; - using namespace comphelper; - using namespace rptui; -// ----------------------------------------------------------------------------- -// local functions -// ----------------------------------------------------------------------------- -void lcl_setModelReadOnly(const uno::Reference< embed::XStorage >& _xStorage,::boost::shared_ptr<rptui::OReportModel>& _rModel) -{ - uno::Reference<beans::XPropertySet> xProp(_xStorage,uno::UNO_QUERY); - sal_Int32 nOpenMode = embed::ElementModes::READ; - if ( xProp.is() ) - xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OpenMode"))) >>= nOpenMode; - - _rModel->SetReadOnly((nOpenMode & embed::ElementModes::WRITE) != embed::ElementModes::WRITE); -} -void lcl_stripLoadArguments( ::comphelper::MediaDescriptor& _rDescriptor, uno::Sequence< beans::PropertyValue >& _rArgs ) -{ - _rDescriptor.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StatusIndicator" ) ) ); - _rDescriptor.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" ) ) ); - _rDescriptor.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) ) ); - _rDescriptor >> _rArgs; -} -// ----------------------------------------------------------------------------- -void lcl_extractAndStartStatusIndicator( const ::comphelper::MediaDescriptor& _rDescriptor, uno::Reference< task::XStatusIndicator >& _rxStatusIndicator, - uno::Sequence< uno::Any >& _rCallArgs ) -{ - try - { - _rxStatusIndicator = _rDescriptor.getUnpackedValueOrDefault( _rDescriptor.PROP_STATUSINDICATOR(), _rxStatusIndicator ); - if ( _rxStatusIndicator.is() ) - { - _rxStatusIndicator->start( ::rtl::OUString(), (sal_Int32)1000000 ); - - sal_Int32 nLength = _rCallArgs.getLength(); - _rCallArgs.realloc( nLength + 1 ); - _rCallArgs[ nLength ] <<= _rxStatusIndicator; - } - } - catch( const uno::Exception& ) - { - OSL_FAIL( "lcl_extractAndStartStatusIndicator: caught an exception!" ); - } -} -// ----------------------------------------------------------------------------- -typedef ::comphelper::OPropertyStateContainer OStyle_PBASE; -class OStyle; -typedef ::comphelper::OPropertyArrayUsageHelper < OStyle - > OStyle_PABASE; -typedef ::cppu::WeakImplHelper2< style::XStyle, beans::XMultiPropertyStates> TStyleBASE; - -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; - ~OStyle(){} -public: - OStyle(); - - - DECLARE_XINTERFACE( ) - - // XPropertySet - com::sun::star::uno::Reference<com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(com::sun::star::uno::RuntimeException); - ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; - - // XStyle - ::sal_Bool SAL_CALL isUserDefined( ) throw (uno::RuntimeException); - ::sal_Bool SAL_CALL isInUse( ) throw (uno::RuntimeException); - ::rtl::OUString SAL_CALL getParentStyle( ) throw (uno::RuntimeException); - void SAL_CALL setParentStyle( const ::rtl::OUString& aParentStyle ) throw (container::NoSuchElementException, uno::RuntimeException); - // XNamed - ::rtl::OUString SAL_CALL getName( ) throw (uno::RuntimeException); - void SAL_CALL setName( const ::rtl::OUString& aName ) throw (uno::RuntimeException); - - // XMultiPropertyState - uno::Sequence< beans::PropertyState > SAL_CALL getPropertyStates( const uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, uno::RuntimeException) - { - return OStyle_PBASE::getPropertyStates(aPropertyNames); - } - void SAL_CALL setAllPropertiesToDefault( ) throw (uno::RuntimeException); - void SAL_CALL setPropertiesToDefault( const uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, uno::RuntimeException); - uno::Sequence< uno::Any > SAL_CALL getPropertyDefaults( const uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException); -}; -// ----------------------------------------------------------------------------- -OStyle::OStyle() -:OStyle_PBASE(m_aBHelper) -,m_aSize(21000,29700) -{ - const ::Size aDefaultSize = SvxPaperInfo::GetDefaultPaperSize( MAP_100TH_MM ); - m_aSize.Height = aDefaultSize.Height(); - m_aSize.Width = aDefaultSize.Width(); - - const style::GraphicLocation eGraphicLocation = style::GraphicLocation_NONE; - const sal_Bool bFalse = sal_False; - const sal_Bool bTrue = sal_True; - const sal_Int32 nMargin = 2000; - //const sal_Int32 nColor = COL_WHITE; - const sal_Int32 nTransparent = COL_TRANSPARENT; - const sal_Int32 nZero = 0; - const sal_Int16 n16Zero = 0; - const sal_Int16 nNummeringType = style::NumberingType::ARABIC; - const ::rtl::OUString sName(RTL_CONSTASCII_USTRINGPARAM("Default")); - const ::rtl::OUString sEmpty; - const table::BorderLine eBorderLine(0,0,0,0); - const table::ShadowFormat eShadowFormat(table::ShadowLocation_NONE,0,0,0); - const style::PageStyleLayout ePageStyleLayout = style::PageStyleLayout_ALL; - const sal_Int32 nBound = beans::PropertyAttribute::BOUND; - const sal_Int32 nMayBeVoid = beans::PropertyAttribute::MAYBEVOID; - - sal_Int32 i = 0; - registerPropertyNoMember( PROPERTY_NAME, ++i,nBound,::getCppuType( static_cast< ::rtl::OUString *>(NULL) ), &sName ); - - registerPropertyNoMember(PROPERTY_BACKCOLOR, ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nTransparent); - - registerPropertyNoMember(PROPERTY_BACKGRAPHICLOCATION, ++i,nBound,::getCppuType((const style::GraphicLocation*)0) ,&eGraphicLocation); - registerPropertyNoMember(PROPERTY_BACKTRANSPARENT, ++i,nBound,::getBooleanCppuType() ,&bTrue); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_BORDERDIST), ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_BOTTBORDER), ++i,nBound,::getCppuType((const table::BorderLine*)0) ,&eBorderLine); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_BOTTBRDDIST), ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero); - registerPropertyNoMember(PROPERTY_BOTTOMMARGIN, ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nMargin); - registerPropertyNoMember(MAP_CHAR_LEN("DisplayName"), ++i,nBound,::getCppuType((rtl::OUString*)0) ,&sEmpty); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBACKCOL), ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nTransparent); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFFILT), ++i,nBound,::getCppuType((const ::rtl::OUString*)0) ,&sEmpty); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFLOC), ++i,nBound,::getCppuType((const style::GraphicLocation*)0) ,&eGraphicLocation); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRGRFURL), ++i,nBound,::getCppuType((const ::rtl::OUString*)0) ,&sEmpty); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBACKTRAN), ++i,nBound,::getBooleanCppuType() ,&bTrue); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBODYDIST), ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBRDDIST), ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBOTTBOR), ++i,nBound,::getCppuType((const table::BorderLine*)0) ,&eBorderLine); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRBOTTBDIS), ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRHEIGHT), ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRDYNAMIC), ++i,nBound,::getBooleanCppuType() ,&bFalse); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRON), ++i,nBound,::getBooleanCppuType() ,&bFalse); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRSHARED), ++i,nBound,::getBooleanCppuType() ,&bFalse); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTBOR), ++i,nBound,::getCppuType((const table::BorderLine*)0) ,&eBorderLine); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTBDIS), ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRLEFTMAR), ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTBOR), ++i,nBound,::getCppuType((const table::BorderLine*)0) ,&eBorderLine); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTBDIS),++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRRIGHTMAR), ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRSHADOW), ++i,nBound,::getCppuType((const table::ShadowFormat*)0) ,&eShadowFormat); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRTOPBOR), ++i,nBound,::getCppuType((const table::BorderLine*)0) ,&eBorderLine); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_FTRTOPBDIS), ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero); - // - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBACKCOL), ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nTransparent); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFFILT), ++i,nBound|nMayBeVoid,::getCppuType((const ::rtl::OUString*)0) ,&sEmpty); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFLOC), ++i,nBound|nMayBeVoid,::getCppuType((const style::GraphicLocation*)0) ,&eGraphicLocation); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRGRFURL), ++i,nBound|nMayBeVoid,::getCppuType((const ::rtl::OUString*)0) ,&sEmpty); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBACKTRAN), ++i,nBound|nMayBeVoid,::getBooleanCppuType() ,&bTrue); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBODYDIST), ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBRDDIST), ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBOTTBOR), ++i,nBound|nMayBeVoid,::getCppuType((const table::BorderLine*)0) ,&eBorderLine); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRBOTTBDIS), ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRHEIGHT), ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRDYNAMIC), ++i,nBound|nMayBeVoid,::getBooleanCppuType() ,&bFalse); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRON), ++i,nBound|nMayBeVoid,::getBooleanCppuType() ,&bFalse); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRSHARED), ++i,nBound|nMayBeVoid,::getBooleanCppuType() ,&bFalse); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTBOR), ++i,nBound|nMayBeVoid,::getCppuType((const table::BorderLine*)0) ,&eBorderLine); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTBDIS), ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRLEFTMAR), ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTBOR), ++i,nBound|nMayBeVoid,::getCppuType((const table::BorderLine*)0) ,&eBorderLine); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTBDIS),++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRRIGHTMAR), ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRSHADOW), ++i,nBound|nMayBeVoid,::getCppuType((const table::ShadowFormat*)0) ,&eShadowFormat); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRTOPBOR), ++i,nBound|nMayBeVoid,::getCppuType((const table::BorderLine*)0) ,&eBorderLine); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_HDRTOPBDIS), ++i,nBound|nMayBeVoid,::getCppuType((const sal_Int32*)0) ,&nZero); - // - registerProperty(PROPERTY_HEIGHT, ++i,nBound,&m_aSize.Height, ::getCppuType((const sal_Int32*)0) ); - registerPropertyNoMember(PROPERTY_ISLANDSCAPE, ++i,nBound, ::getBooleanCppuType() ,&bFalse); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_LEFTBORDER), ++i,nBound, ::getCppuType((const table::BorderLine*)0) ,&eBorderLine); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_LEFTBRDDIST), ++i,nBound, ::getCppuType((const sal_Int32*)0) ,&nZero); - registerPropertyNoMember(PROPERTY_LEFTMARGIN, ++i,beans::PropertyAttribute::BOUND, ::getCppuType((const sal_Int32*)0) ,&nMargin); - registerPropertyNoMember(PROPERTY_NUMBERINGTYPE, ++i,nBound,::getCppuType((const sal_Int16*)0) ,&nNummeringType); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_SCALEVAL), ++i,nBound,::getCppuType((const sal_Int16*)0) ,&n16Zero); - registerPropertyNoMember(PROPERTY_PAGESTYLELAYOUT, ++i,nBound,::getCppuType((const style::PageStyleLayout*)0) ,&ePageStyleLayout); - const ::rtl::OUString sPaperTray(RTL_CONSTASCII_USTRINGPARAM("[From printer settings]")); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_PAPERTRAY), ++i,nBound,::getCppuType((const ::rtl::OUString*)0) ,&sPaperTray); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTBORDER), ++i,nBound,::getCppuType((const table::BorderLine*)0) ,&eBorderLine); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_RIGHTBRDDIST),++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero); - registerPropertyNoMember(PROPERTY_RIGHTMARGIN, ++i,beans::PropertyAttribute::BOUND,::getCppuType((const sal_Int32*)0) ,&nMargin); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_SCALETOPAG), ++i,nBound,::getCppuType((const sal_Int16*)0) ,&n16Zero); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_SCALETOX), ++i,nBound,::getCppuType((const sal_Int16*)0) ,&n16Zero); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_SCALETOY), ++i,nBound,::getCppuType((const sal_Int16*)0) ,&n16Zero); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_SHADOWFORM), ++i,nBound,::getCppuType((const table::ShadowFormat*)0) ,&eShadowFormat); - registerProperty(PROPERTY_PAPERSIZE, ++i,beans::PropertyAttribute::BOUND,&m_aSize,::getCppuType((const awt::Size*)0) ); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_TOPBORDER), ++i,nBound,::getCppuType((const table::BorderLine*)0) ,&eBorderLine); - registerPropertyNoMember(MAP_CHAR_LEN(SC_UNO_PAGE_TOPBRDDIST), ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nZero); - registerPropertyNoMember(PROPERTY_TOPMARGIN, ++i,nBound,::getCppuType((const sal_Int32*)0) ,&nMargin); - uno::Reference< container::XNameContainer> xAttribs = ::comphelper::NameContainer_createInstance(::getCppuType(static_cast< xml::AttributeData* >(NULL))); - registerPropertyNoMember(MAP_CHAR_LEN("UserDefinedAttributes"), ++i,nBound,::getCppuType((uno::Reference<container::XNameContainer>*)0) ,&xAttribs); - registerProperty(PROPERTY_WIDTH, ++i,nBound,&m_aSize.Width,::getCppuType((const sal_Int32*)0) ); - registerPropertyNoMember(MAP_CHAR_LEN("PrinterName"), ++i,nBound,::getCppuType((const ::rtl::OUString*)0),&sEmpty); - uno::Sequence<sal_Int8> aSe; - registerPropertyNoMember(MAP_CHAR_LEN("PrinterSetup"), ++i,nBound,::getCppuType((const uno::Sequence<sal_Int8>*)0),&aSe); - - -} -// ----------------------------------------------------------------------------- -IMPLEMENT_FORWARD_XINTERFACE2(OStyle,TStyleBASE,OStyle_PBASE) -// ----------------------------------------------------------------------------- -uno::Reference< beans::XPropertySetInfo> SAL_CALL OStyle::getPropertySetInfo() throw(uno::RuntimeException) -{ - return createPropertySetInfo( getInfoHelper() ); -} -// ----------------------------------------------------------------------------- -void OStyle::getPropertyDefaultByHandle( sal_Int32 /*_nHandle*/, uno::Any& /*_rDefault*/ ) const -{ -} -//------------------------------------------------------------------------- -::cppu::IPropertyArrayHelper& OStyle::getInfoHelper() -{ - return *const_cast<OStyle*>(this)->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( ) throw (uno::RuntimeException) -{ - return sal_False; -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OStyle::isInUse( ) throw (uno::RuntimeException) -{ - return sal_True; -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OStyle::getParentStyle( ) throw (uno::RuntimeException) -{ - return ::rtl::OUString(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OStyle::setParentStyle( const ::rtl::OUString& /*aParentStyle*/ ) throw (container::NoSuchElementException, uno::RuntimeException) -{ -} -// ----------------------------------------------------------------------------- -// XNamed -::rtl::OUString SAL_CALL OStyle::getName( ) throw (uno::RuntimeException) -{ - ::rtl::OUString sName; - getPropertyValue(PROPERTY_NAME) >>= sName; - return sName; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OStyle::setName( const ::rtl::OUString& aName ) throw (uno::RuntimeException) -{ - setPropertyValue(PROPERTY_NAME,uno::makeAny(aName)); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OStyle::setAllPropertiesToDefault( ) throw (uno::RuntimeException) -{ -} -// ----------------------------------------------------------------------------- -void SAL_CALL OStyle::setPropertiesToDefault( const uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - const ::rtl::OUString* pIter = aPropertyNames.getConstArray(); - const ::rtl::OUString* pEnd = pIter + aPropertyNames.getLength(); - for(;pIter != pEnd;++pIter) - setPropertyToDefault(*pIter); -} -// ----------------------------------------------------------------------------- -uno::Sequence< uno::Any > SAL_CALL OStyle::getPropertyDefaults( const uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - uno::Sequence< uno::Any > aRet(aPropertyNames.getLength()); - const ::rtl::OUString* pIter = aPropertyNames.getConstArray(); - const ::rtl::OUString* pEnd = pIter + aPropertyNames.getLength(); - for(sal_Int32 i = 0;pIter != pEnd;++pIter,++i) - aRet[i] = getPropertyDefault(*pIter); - return aRet; -} -namespace -{ - class FactoryLoader : public ::osl::Thread - { - ::rtl::OUString m_sMimeType; - uno::Reference< uno::XComponentContext > m_xContext; - public: - FactoryLoader(const ::rtl::OUString& _sMimeType,uno::Reference< uno::XComponentContext > const & _xContext) - :m_sMimeType(_sMimeType) - ,m_xContext(_xContext) - {} - - protected: - virtual ~FactoryLoader(){} - - /// Working method which should be overridden. - virtual void SAL_CALL run(); - virtual void SAL_CALL onTerminated(); - }; - - void SAL_CALL FactoryLoader::run() - { - try - { - uno::Reference<frame::XComponentLoader> xFrameLoad( m_xContext->getServiceManager()->createInstanceWithContext( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) - ,m_xContext) - ,uno::UNO_QUERY); - ::rtl::OUString sTarget(RTL_CONSTASCII_USTRINGPARAM("_blank")); - sal_Int32 nFrameSearchFlag = frame::FrameSearchFlag::TASKS | frame::FrameSearchFlag::CREATE; - uno::Reference< frame::XFrame> xFrame = uno::Reference< frame::XFrame>(xFrameLoad,uno::UNO_QUERY)->findFrame(sTarget,nFrameSearchFlag); - xFrameLoad.set( xFrame,uno::UNO_QUERY); - - if ( xFrameLoad.is() ) - { - uno::Sequence < beans::PropertyValue > aArgs( 3); - sal_Int32 nLen = 0; - aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AsTemplate")); - aArgs[nLen++].Value <<= sal_False; - - aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly")); - aArgs[nLen++].Value <<= sal_True; - - aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Hidden")); - aArgs[nLen++].Value <<= sal_True; - - uno::Reference< lang::XMultiServiceFactory > xFac(m_xContext->getServiceManager(),uno::UNO_QUERY); - ::comphelper::MimeConfigurationHelper aHelper(xFac); - SvtModuleOptions aModuleOptions; - uno::Reference< frame::XModel > xModel(xFrameLoad->loadComponentFromURL( - aModuleOptions.GetFactoryEmptyDocumentURL( aModuleOptions.ClassifyFactoryByServiceName( aHelper.GetDocServiceNameFromMediaType(m_sMimeType) )), - ::rtl::OUString(), // empty frame name - 0, - aArgs - ),uno::UNO_QUERY); - ::comphelper::disposeComponent(xModel); - } - } - catch(uno::Exception& ex) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - void SAL_CALL FactoryLoader::onTerminated() - { - delete this; - } -} -// ----------------------------------------------------------------------------- -struct OReportDefinitionImpl -{ - uno::WeakReference< uno::XInterface > m_xParent; - ::cppu::OInterfaceContainerHelper m_aStorageChangeListeners; - ::cppu::OInterfaceContainerHelper m_aCloseListener; - ::cppu::OInterfaceContainerHelper m_aModifyListeners; - ::cppu::OInterfaceContainerHelper 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::XUIConfigurationManager> 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; - - ::boost::shared_ptr< ::comphelper::EmbeddedObjectContainer> - m_pObjectContainer; - ::boost::shared_ptr<rptui::OReportModel> m_pReportModel; - ::rtl::Reference< ::dbaui::UndoManager > m_pUndoManager; - ::rtl::OUString m_sCaption; - ::rtl::OUString m_sCommand; - ::rtl::OUString m_sFilter; - ::rtl::OUString m_sMimeType; - ::rtl::OUString m_sIdentifier; - ::rtl::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; - sal_Bool m_bControllersLocked; - sal_Bool m_bModified; - sal_Bool m_bEscapeProcessing; - sal_Bool m_bSetModifiedEnabled; - - OReportDefinitionImpl(::osl::Mutex& _aMutex) - :m_aStorageChangeListeners(_aMutex) - ,m_aCloseListener(_aMutex) - ,m_aModifyListeners(_aMutex) - ,m_aDocEventListeners(_aMutex) - ,m_sMimeType(MIMETYPE_OASIS_OPENDOCUMENT_TEXT) - ,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(sal_False) - ,m_bModified(sal_False) - ,m_bEscapeProcessing(sal_True) - ,m_bSetModifiedEnabled( sal_True ) - {} - - OReportDefinitionImpl(::osl::Mutex& _aMutex,const OReportDefinitionImpl& _aCopy) - :m_aStorageChangeListeners(_aMutex) - ,m_aCloseListener(_aMutex) - ,m_aModifyListeners(_aMutex) - ,m_aDocEventListeners(_aMutex) - ,m_sMimeType(_aCopy.m_sMimeType) - ,m_sIdentifier(_aCopy.m_sIdentifier) - ,m_nGroupKeepTogether(_aCopy.m_nGroupKeepTogether) - ,m_nPageHeaderOption(_aCopy.m_nPageHeaderOption) - ,m_nPageFooterOption(_aCopy.m_nPageFooterOption) - ,m_nCommandType(_aCopy.m_nCommandType) - ,m_bControllersLocked(_aCopy.m_bControllersLocked) - ,m_bModified(_aCopy.m_bModified) - ,m_bEscapeProcessing(_aCopy.m_bEscapeProcessing) - {} - ~OReportDefinitionImpl(); -}; -OReportDefinitionImpl::~OReportDefinitionImpl() -{ -} - -DBG_NAME( rpt_OReportDefinition ) -// ----------------------------------------------------------------------------- -OReportDefinition::OReportDefinition(uno::Reference< uno::XComponentContext > const & _xContext) -: ReportDefinitionBase(m_aMutex) -,ReportDefinitionPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< ::rtl::OUString >()) -,m_aProps(new OReportComponentProperties(_xContext)) -,m_pImpl(new OReportDefinitionImpl(m_aMutex)) -{ - DBG_CTOR( rpt_OReportDefinition,NULL); - m_aProps->m_sName = RPT_RESSTRING(RID_STR_REPORT,m_aProps->m_xContext->getServiceManager()); - osl_incrementInterlockedCount(&m_refCount); - { - init(); - m_pImpl->m_xGroups = new OGroups(this,m_aProps->m_xContext); - m_pImpl->m_xDetail = new OSection(this,m_aProps->m_xContext); - m_pImpl->m_xDetail->setName(RPT_RESSTRING(RID_STR_DETAIL,m_aProps->m_xContext->getServiceManager())); - } - osl_decrementInterlockedCount( &m_refCount ); -} -// ----------------------------------------------------------------------------- -OReportDefinition::OReportDefinition(uno::Reference< uno::XComponentContext > const & _xContext - ,const uno::Reference< lang::XMultiServiceFactory>& _xFactory - ,uno::Reference< drawing::XShape >& _xShape) -: ReportDefinitionBase(m_aMutex) -,ReportDefinitionPropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< ::rtl::OUString >()) -,m_aProps(new OReportComponentProperties(_xContext)) -,m_pImpl(new OReportDefinitionImpl(m_aMutex)) -{ - m_aProps->m_sName = RPT_RESSTRING(RID_STR_REPORT,m_aProps->m_xContext->getServiceManager()); - m_aProps->m_xFactory = _xFactory; - osl_incrementInterlockedCount(&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 = new OSection(this,m_aProps->m_xContext); - m_pImpl->m_xDetail->setName(RPT_RESSTRING(RID_STR_DETAIL,m_aProps->m_xContext->getServiceManager())); - } - osl_decrementInterlockedCount( &m_refCount ); -} -// ----------------------------------------------------------------------------- -OReportDefinition::OReportDefinition(const OReportDefinition& _rCopy) -: cppu::BaseMutex() -,ReportDefinitionBase(m_aMutex) -,ReportDefinitionPropertySet(_rCopy.m_aProps->m_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< ::rtl::OUString >()) -,comphelper::IEmbeddedHelper() -,m_aProps(new OReportComponentProperties(*_rCopy.m_aProps)) -,m_pImpl(new OReportDefinitionImpl(m_aMutex,*_rCopy.m_pImpl)) -{ - DBG_CTOR( rpt_OReportDefinition,NULL); - osl_incrementInterlockedCount(&m_refCount); - { - init(); - OGroups* pGroups = new OGroups(this,m_aProps->m_xContext); - m_pImpl->m_xGroups = pGroups; - pGroups->copyGroups(_rCopy.m_pImpl->m_xGroups); - m_pImpl->m_xDetail = new OSection(this,m_aProps->m_xContext); - OSection::lcl_copySection(_rCopy.m_pImpl->m_xDetail,m_pImpl->m_xDetail); - - setPageHeaderOn(_rCopy.m_pImpl->m_xPageHeader.is()); - setPageFooterOn(_rCopy.m_pImpl->m_xPageFooter.is()); - setReportHeaderOn(_rCopy.m_pImpl->m_xReportHeader.is()); - setReportFooterOn(_rCopy.m_pImpl->m_xReportFooter.is()); - OSection::lcl_copySection(_rCopy.m_pImpl->m_xPageHeader,m_pImpl->m_xPageHeader); - OSection::lcl_copySection(_rCopy.m_pImpl->m_xPageFooter,m_pImpl->m_xPageFooter); - OSection::lcl_copySection(_rCopy.m_pImpl->m_xReportHeader,m_pImpl->m_xReportHeader); - OSection::lcl_copySection(_rCopy.m_pImpl->m_xReportFooter,m_pImpl->m_xReportFooter); - } - osl_decrementInterlockedCount( &m_refCount ); -} -// ----------------------------------------------------------------------------- -OReportDefinition::~OReportDefinition() -{ - DBG_DTOR( rpt_OReportDefinition,NULL); - if ( !ReportDefinitionBase::rBHelper.bInDispose && !ReportDefinitionBase::rBHelper.bDisposed ) - { - acquire(); - dispose(); - } -} -// ----------------------------------------------------------------------------- -IMPLEMENT_FORWARD_REFCOUNT( OReportDefinition, ReportDefinitionBase ) -void OReportDefinition::init() -{ - try - { - static bool s_bFirstTime = sal_True; - if ( s_bFirstTime ) - { - s_bFirstTime = false; - const uno::Sequence< ::rtl::OUString > aMimeTypes = getAvailableMimeTypes(); - const ::rtl::OUString* pIter = aMimeTypes.getConstArray(); - const ::rtl::OUString* pEnd = pIter + aMimeTypes.getLength(); - for ( ; pIter != pEnd; ++pIter ) - { - FactoryLoader* pCreatorThread = new FactoryLoader(*pIter,m_aProps->m_xContext); - pCreatorThread->createSuspended(); - pCreatorThread->setPriority(osl_Thread_PriorityBelowNormal); - pCreatorThread->resume(); - } - } - - m_pImpl->m_pReportModel.reset(new OReportModel(this)); - m_pImpl->m_pReportModel->GetItemPool().FreezeIdRanges(); - m_pImpl->m_pReportModel->SetScaleUnit( MAP_100TH_MM ); - SdrLayerAdmin& rAdmin = m_pImpl->m_pReportModel->GetLayerAdmin(); - rAdmin.NewStandardLayer(RPT_LAYER_FRONT); - rAdmin.NewLayer(UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "back" ) ), RPT_LAYER_BACK ); - rAdmin.NewLayer( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "HiddenLayer" ) ), RPT_LAYER_HIDDEN ); - - m_pImpl->m_pUndoManager = new ::dbaui::UndoManager( *this, m_aMutex ); - m_pImpl->m_pReportModel->SetSdrUndoManager( &m_pImpl->m_pUndoManager->GetSfxUndoManager() ); - - m_pImpl->m_xFunctions = new OFunctions(this,m_aProps->m_xContext); - if ( !m_pImpl->m_xStorage.is() ) - m_pImpl->m_xStorage = ::comphelper::OStorageHelper::GetTemporaryStorage(); - - uno::Reference<beans::XPropertySet> xStorProps(m_pImpl->m_xStorage,uno::UNO_QUERY); - if ( xStorProps.is()) - { - ::rtl::OUString sMediaType; - xStorProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType"))) >>= sMediaType; - if ( !sMediaType.getLength() ) - xStorProps->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")),uno::makeAny(MIMETYPE_OASIS_OPENDOCUMENT_REPORT)); - } - m_pImpl->m_pObjectContainer.reset( new comphelper::EmbeddedObjectContainer(m_pImpl->m_xStorage , static_cast<cppu::OWeakObject*>(this) ) ); - } - catch ( const uno::Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::dispose() throw(uno::RuntimeException) -{ - ReportDefinitionPropertySet::dispose(); - cppu::WeakComponentImplHelperBase::dispose(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::disposing() -{ - notifyEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("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_aDocEventListeners.disposeAndClear( aDisposeEvent ); - m_pImpl->m_aStorageChangeListeners.disposeAndClear( aDisposeEvent ); - - // SYNCHRONIZED ---> - SolarMutexGuard aSolarGuard; - ::osl::ResettableMutexGuard 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 -} - -// ----------------------------------------------------------------------------- -::rtl::OUString OReportDefinition::getImplementationName_Static( ) throw(uno::RuntimeException) -{ - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.OReportDefinition")); -} - -//-------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OReportDefinition::getImplementationName( ) throw(uno::RuntimeException) -{ - return getImplementationName_Static(); -} -//-------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > OReportDefinition::getSupportedServiceNames_Static( ) throw(uno::RuntimeException) -{ - uno::Sequence< ::rtl::OUString > aServices(1); - aServices.getArray()[0] = SERVICE_REPORTDEFINITION; - - return aServices; -} -// -------------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > SAL_CALL OReportDefinition::getSupportedServiceNames( ) throw(uno::RuntimeException) -{ - // first collect the services which are supported by our aggregate - uno::Sequence< ::rtl::OUString > aSupported; - if ( m_aProps->m_xServiceInfo.is() ) - aSupported = m_aProps->m_xServiceInfo->getSupportedServiceNames(); - - // append our own service, if necessary - if ( 0 == ::comphelper::findValue( aSupported, SERVICE_REPORTDEFINITION, sal_True ).getLength() ) - { - sal_Int32 nLen = aSupported.getLength(); - aSupported.realloc( nLen + 1 ); - aSupported[ nLen ] = SERVICE_REPORTDEFINITION; - } - - // outta here - return aSupported; -} - -// -------------------------------------------------------------------------------- -sal_Bool SAL_CALL OReportDefinition::supportsService( const ::rtl::OUString& _rServiceName ) throw(uno::RuntimeException) -{ - return ::comphelper::findValue( getSupportedServiceNames(), _rServiceName, sal_True ).getLength() != 0; -} - -// -------------------------------------------------------------------------------- -uno::Any SAL_CALL OReportDefinition::queryInterface( const uno::Type& _rType ) throw (uno::RuntimeException) -{ - 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( ) throw (uno::RuntimeException) -{ - 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 -::rtl::OUString SAL_CALL OReportDefinition::getCaption() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_pImpl->m_sCaption; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::setCaption( const ::rtl::OUString& _caption ) throw (uno::RuntimeException) -{ - set(PROPERTY_CAPTION,_caption,m_pImpl->m_sCaption); -} -// ----------------------------------------------------------------------------- -::sal_Int16 SAL_CALL OReportDefinition::getGroupKeepTogether() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_pImpl->m_nGroupKeepTogether; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::setGroupKeepTogether( ::sal_Int16 _groupkeeptogether ) throw (uno::RuntimeException) -{ - if ( _groupkeeptogether < report::GroupKeepTogether::PER_PAGE || _groupkeeptogether > report::GroupKeepTogether::PER_COLUMN ) - throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com::sun::star::report::GroupKeepTogether")) - ,*this - ,1 - ,m_aProps->m_xContext); - set(PROPERTY_GROUPKEEPTOGETHER,_groupkeeptogether,m_pImpl->m_nGroupKeepTogether); -} -// ----------------------------------------------------------------------------- -::sal_Int16 SAL_CALL OReportDefinition::getPageHeaderOption() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_pImpl->m_nPageHeaderOption; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::setPageHeaderOption( ::sal_Int16 _pageheaderoption ) throw (uno::RuntimeException) -{ - if ( _pageheaderoption < report::ReportPrintOption::ALL_PAGES || _pageheaderoption > report::ReportPrintOption::NOT_WITH_REPORT_HEADER_FOOTER ) - throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com::sun::star::report::ReportPrintOption")) - ,*this - ,1 - ,m_aProps->m_xContext); - set(PROPERTY_PAGEHEADEROPTION,_pageheaderoption,m_pImpl->m_nPageHeaderOption); -} -// ----------------------------------------------------------------------------- -::sal_Int16 SAL_CALL OReportDefinition::getPageFooterOption() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_pImpl->m_nPageFooterOption; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::setPageFooterOption( ::sal_Int16 _pagefooteroption ) throw (uno::RuntimeException) -{ - if ( _pagefooteroption < report::ReportPrintOption::ALL_PAGES || _pagefooteroption > report::ReportPrintOption::NOT_WITH_REPORT_HEADER_FOOTER ) - throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com::sun::star::report::ReportPrintOption")) - ,*this - ,1 - ,m_aProps->m_xContext); - set(PROPERTY_PAGEFOOTEROPTION,_pagefooteroption,m_pImpl->m_nPageFooterOption); -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OReportDefinition::getCommand() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_pImpl->m_sCommand; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::setCommand( const ::rtl::OUString& _command ) throw (uno::RuntimeException) -{ - set(PROPERTY_COMMAND,_command,m_pImpl->m_sCommand); -} -// ----------------------------------------------------------------------------- -::sal_Int32 SAL_CALL OReportDefinition::getCommandType() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_pImpl->m_nCommandType; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::setCommandType( ::sal_Int32 _commandtype ) throw (uno::RuntimeException) -{ - if ( _commandtype < sdb::CommandType::TABLE || _commandtype > sdb::CommandType::COMMAND ) - throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com::sun::star::sdb::CommandType")) - ,*this - ,1 - ,m_aProps->m_xContext); - set(PROPERTY_COMMANDTYPE,_commandtype,m_pImpl->m_nCommandType); -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OReportDefinition::getFilter() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_pImpl->m_sFilter; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::setFilter( const ::rtl::OUString& _filter ) throw (uno::RuntimeException) -{ - set(PROPERTY_FILTER,_filter,m_pImpl->m_sFilter); -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OReportDefinition::getEscapeProcessing() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_pImpl->m_bEscapeProcessing; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::setEscapeProcessing( ::sal_Bool _escapeprocessing ) throw (uno::RuntimeException) -{ - set(PROPERTY_ESCAPEPROCESSING,_escapeprocessing,m_pImpl->m_bEscapeProcessing); -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OReportDefinition::getReportHeaderOn() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_pImpl->m_xReportHeader.is(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::setReportHeaderOn( ::sal_Bool _reportheaderon ) throw (uno::RuntimeException) -{ - if ( _reportheaderon != m_pImpl->m_xReportHeader.is() ) - { - setSection(PROPERTY_REPORTHEADERON,_reportheaderon,RPT_RESSTRING(RID_STR_REPORT_HEADER,m_aProps->m_xContext->getServiceManager()),m_pImpl->m_xReportHeader); - } -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OReportDefinition::getReportFooterOn() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_pImpl->m_xReportFooter.is(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::setReportFooterOn( ::sal_Bool _reportfooteron ) throw (uno::RuntimeException) -{ - if ( _reportfooteron != m_pImpl->m_xReportFooter.is() ) - { - setSection(PROPERTY_REPORTFOOTERON,_reportfooteron,RPT_RESSTRING(RID_STR_REPORT_FOOTER,m_aProps->m_xContext->getServiceManager()),m_pImpl->m_xReportFooter); - } -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OReportDefinition::getPageHeaderOn() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_pImpl->m_xPageHeader.is(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::setPageHeaderOn( ::sal_Bool _pageheaderon ) throw (uno::RuntimeException) -{ - if ( _pageheaderon != m_pImpl->m_xPageHeader.is() ) - { - setSection(PROPERTY_PAGEHEADERON,_pageheaderon,RPT_RESSTRING(RID_STR_PAGE_HEADER,m_aProps->m_xContext->getServiceManager()),m_pImpl->m_xPageHeader); - } -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OReportDefinition::getPageFooterOn() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_pImpl->m_xPageFooter.is(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::setPageFooterOn( ::sal_Bool _pagefooteron ) throw (uno::RuntimeException) -{ - if ( _pagefooteron != m_pImpl->m_xPageFooter.is() ) - { - setSection(PROPERTY_PAGEFOOTERON,_pagefooteron,RPT_RESSTRING(RID_STR_PAGE_FOOTER,m_aProps->m_xContext->getServiceManager()),m_pImpl->m_xPageFooter); - } -} -// ----------------------------------------------------------------------------- -uno::Reference< report::XGroups > SAL_CALL OReportDefinition::getGroups() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_pImpl->m_xGroups; -} -// ----------------------------------------------------------------------------- -uno::Reference< report::XSection > SAL_CALL OReportDefinition::getReportHeader() throw (container::NoSuchElementException, uno::RuntimeException) -{ - ::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() throw (container::NoSuchElementException, uno::RuntimeException) -{ - ::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() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_pImpl->m_xDetail; -} -// ----------------------------------------------------------------------------- -uno::Reference< report::XSection > SAL_CALL OReportDefinition::getPageFooter() throw (container::NoSuchElementException, uno::RuntimeException) -{ - ::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() throw (container::NoSuchElementException, uno::RuntimeException) -{ - ::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( ) throw (lang::DisposedException, uno::Exception, uno::RuntimeException) -{ - ::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( ) throw(uno::RuntimeException) -{ - return ReportDefinitionPropertySet::getPropertySetInfo(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) -{ - ReportDefinitionPropertySet::setPropertyValue( aPropertyName, aValue ); -} -// ----------------------------------------------------------------------------- -uno::Any SAL_CALL OReportDefinition::getPropertyValue( const ::rtl::OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - return ReportDefinitionPropertySet::getPropertyValue( PropertyName); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - ReportDefinitionPropertySet::addPropertyChangeListener( aPropertyName, xListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - ReportDefinitionPropertySet::removePropertyChangeListener( aPropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::addVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - ReportDefinitionPropertySet::addVetoableChangeListener( PropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - ReportDefinitionPropertySet::removeVetoableChangeListener( PropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -// XChild -uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::getParent( ) throw (uno::RuntimeException) -{ - ::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 ) throw (lang::NoSupportException, uno::RuntimeException) -{ - ::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( ) throw (uno::RuntimeException) -{ - 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.get(); -} -// ----------------------------------------------------------------------------- -void OReportDefinition::setSection( const ::rtl::OUString& _sProperty - ,const sal_Bool& _bOn - ,const ::rtl::OUString& _sName - ,uno::Reference< report::XSection>& _member) -{ - BoundListeners l; - { - ::osl::MutexGuard aGuard(m_aMutex); - prepareSet(_sProperty, uno::makeAny(_member), uno::makeAny(_bOn), &l); - lcl_createSectionIfNeeded(_bOn ,this,_member,_sProperty == PROPERTY_PAGEHEADERON || _sProperty == PROPERTY_PAGEFOOTERON); - if ( _member.is() ) - _member->setName(_sName); - } - l.notify(); -} -// ----------------------------------------------------------------------------- -// XCloseBroadcaster -void SAL_CALL OReportDefinition::addCloseListener( const uno::Reference< util::XCloseListener >& _xListener ) throw (uno::RuntimeException) -{ - ::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 ) throw (uno::RuntimeException) -{ - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - m_pImpl->m_aCloseListener.removeInterface(_xListener); -} -// ----------------------------------------------------------------------------- -// XCloseable -void SAL_CALL OReportDefinition::close( ::sal_Bool _bDeliverOwnership ) throw (util::CloseVetoException, uno::RuntimeException) -{ - 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<util::XCloseListener>( - ::boost::bind(&util::XCloseListener::queryClosing,_1,boost::cref(aEvt),boost::cref(_bDeliverOwnership))); - aGuard.reset(); - - - ::std::vector< uno::Reference< frame::XController> > aCopy = m_pImpl->m_aControllers; - ::std::vector< uno::Reference< frame::XController> >::iterator aIter = aCopy.begin(); - ::std::vector< uno::Reference< frame::XController> >::iterator aEnd = aCopy.end(); - for (;aIter != aEnd ; ++aIter) - { - if ( aIter->is() ) - { - try - { - uno::Reference< util::XCloseable> xFrame( (*aIter)->getFrame(), uno::UNO_QUERY ); - if ( xFrame.is() ) - xFrame->close( _bDeliverOwnership ); - } - catch( const util::CloseVetoException& ) { throw; } - catch( const uno::Exception& ) - { - OSL_FAIL( "ODatabaseDocument::impl_closeControllerFrames: caught an unexpected exception!" ); - } - } - } - - aGuard.clear(); - m_pImpl->m_aCloseListener.notifyEach(&util::XCloseListener::notifyClosing,aEvt); - aGuard.reset(); - - dispose(); -} -// ----------------------------------------------------------------------------- -// XModel -::sal_Bool SAL_CALL OReportDefinition::attachResource( const ::rtl::OUString& /*_rURL*/, const uno::Sequence< beans::PropertyValue >& _aArguments ) throw (uno::RuntimeException) -{ - // 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 ); - ::comphelper::MediaDescriptor aDescriptor( _aArguments ); - - m_pImpl->m_pUndoManager->GetSfxUndoManager().EnableUndo( false ); - try - { - fillArgs(aDescriptor); - m_pImpl->m_pReportModel->SetModified(sal_False); - } - catch ( ... ) - { - m_pImpl->m_pUndoManager->GetSfxUndoManager().EnableUndo( true ); - throw; - } - m_pImpl->m_pUndoManager->GetSfxUndoManager().EnableUndo( true ); - return sal_True; -} -// ----------------------------------------------------------------------------- -void OReportDefinition::fillArgs(::comphelper::MediaDescriptor& _aDescriptor) -{ - uno::Sequence<beans::PropertyValue> aComponentData; - aComponentData = _aDescriptor.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ComponentData")),aComponentData); - if ( aComponentData.getLength() && (!m_pImpl->m_xActiveConnection.is() || !m_pImpl->m_xNumberFormatsSupplier.is()) ) - { - ::comphelper::SequenceAsHashMap aComponentDataMap( aComponentData ); - m_pImpl->m_xActiveConnection = aComponentDataMap.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("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( - m_aProps->m_xContext->getServiceManager()->createInstanceWithContext( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.NumberFormatsSupplier")) ,m_aProps->m_xContext), - uno::UNO_QUERY_THROW - ); - } - lcl_stripLoadArguments( _aDescriptor, m_pImpl->m_aArgs ); - ::rtl::OUString sCaption; - sCaption = _aDescriptor.getUnpackedValueOrDefault(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DocumentTitle")),sCaption); - setCaption(sCaption); -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OReportDefinition::getURL( ) throw (uno::RuntimeException) -{ - return ::rtl::OUString(); -} -// ----------------------------------------------------------------------------- -uno::Sequence< beans::PropertyValue > SAL_CALL OReportDefinition::getArgs( ) throw (uno::RuntimeException) -{ - ::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 ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - m_pImpl->m_aControllers.push_back(_xController); - sal_Int32 nCount; - if ( _xController.is() && m_pImpl->m_xViewData.is() && ( nCount = m_pImpl->m_xViewData->getCount()) != 0) - { - _xController->restoreViewData(m_pImpl->m_xViewData->getByIndex(nCount - 1)); - } -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::disconnectController( const uno::Reference< frame::XController >& _xController ) throw (uno::RuntimeException) -{ - ::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( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - m_pImpl->m_bControllersLocked = sal_True; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::unlockControllers( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - m_pImpl->m_bControllersLocked = sal_False; -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OReportDefinition::hasControllersLocked( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - return m_pImpl->m_bControllersLocked; -} -// ----------------------------------------------------------------------------- -uno::Reference< frame::XController > SAL_CALL OReportDefinition::getCurrentController( ) throw (uno::RuntimeException) -{ - ::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 ) throw (container::NoSuchElementException, uno::RuntimeException) -{ - ::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( ) throw (uno::RuntimeException) -{ - 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; - - ::comphelper::MediaDescriptor aDescriptor( _aMediaDescriptor ); - fillArgs(aDescriptor); - aDescriptor.createItemIfMissing(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Storage")),uno::makeAny(_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 = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Storage")); - aPropVal.Value <<= _xStorageToLoadFrom; - aDelegatorArguments[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(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.OReportFilter")),aDelegatorArguments,m_aProps->m_xContext), - uno::UNO_QUERY_THROW ); - - uno::Reference< document::XImporter> xImporter(xFilter,uno::UNO_QUERY_THROW); - uno::Reference<XComponent> xComponent(static_cast<OWeakObject*>(this),uno::UNO_QUERY); - xImporter->setTargetDocument(xComponent); - - ::comphelper::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 ) throw (lang::IllegalArgumentException, frame::DoubleInitializationException, io::IOException, uno::Exception, uno::RuntimeException) -{ - ::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 ) throw (lang::IllegalArgumentException, io::IOException, uno::Exception, uno::RuntimeException) -{ - if ( !_xStorageToSaveTo.is() ) - throw lang::IllegalArgumentException(RPT_RESSTRING(RID_STR_ARGUMENT_IS_NULL,m_aProps->m_xContext->getServiceManager()),*this,1); - - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - // create XStatusIndicator - uno::Reference<task::XStatusIndicator> xStatusIndicator; - uno::Sequence< uno::Any > aDelegatorArguments; - ::comphelper::MediaDescriptor aDescriptor( _aMediaDescriptor ); - lcl_extractAndStartStatusIndicator( aDescriptor, xStatusIndicator, aDelegatorArguments ); - - // properties - uno::Sequence < beans::PropertyValue > aProps; - - // export sub streams for package, else full stream into a file - sal_Bool bWarn = sal_False, bErr = sal_False; - ::rtl::OUString sWarnFile, sErrFile; - - uno::Reference< beans::XPropertySet> xProp(_xStorageToSaveTo,uno::UNO_QUERY); - if ( xProp.is() ) - { - static const ::rtl::OUString sPropName(RTL_CONSTASCII_USTRINGPARAM("MediaType")); - ::rtl::OUString sOldMediaType; - xProp->getPropertyValue(sPropName) >>= sOldMediaType; - if ( !xProp->getPropertyValue(sPropName).hasValue() || !sOldMediaType.getLength() || MIMETYPE_OASIS_OPENDOCUMENT_REPORT != sOldMediaType ) - xProp->setPropertyValue( sPropName, uno::makeAny(MIMETYPE_OASIS_OPENDOCUMENT_REPORT) ); - } - - /** property map for export info set */ - comphelper::PropertyMapEntry aExportInfoMap[] = - { - { MAP_LEN( "UsePrettyPrinting" ), 0, &::getCppuType((sal_Bool*)0), beans::PropertyAttribute::MAYBEVOID, 0 }, - { MAP_LEN( "StreamName") , 0,&::getCppuType( (::rtl::OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, - { MAP_LEN( "StreamRelPath") , 0,&::getCppuType( (::rtl::OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, - { MAP_LEN( "BaseURI") , 0,&::getCppuType( (::rtl::OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, - { NULL, 0, 0, NULL, 0, 0 } - }; - uno::Reference< beans::XPropertySet > xInfoSet( comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aExportInfoMap ) ) ); - - SvtSaveOptions aSaveOpt; - xInfoSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UsePrettyPrinting")), uno::makeAny(aSaveOpt.IsPrettyPrinting())); - if ( aSaveOpt.IsSaveRelFSys() ) - { - const ::rtl::OUString sVal( aDescriptor.getUnpackedValueOrDefault(aDescriptor.PROP_DOCUMENTBASEURL(),::rtl::OUString()) ); - xInfoSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BaseURI")), uno::makeAny(sVal)); - } - const ::rtl::OUString sHierarchicalDocumentName( aDescriptor.getUnpackedValueOrDefault(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HierarchicalDocumentName")),::rtl::OUString()) ); - xInfoSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamRelPath")), uno::makeAny(sHierarchicalDocumentName)); - - - sal_Int32 nArgsLen = aDelegatorArguments.getLength(); - aDelegatorArguments.realloc(nArgsLen+1); - aDelegatorArguments[nArgsLen++] <<= xInfoSet; - - uno::Reference< document::XEmbeddedObjectResolver > xObjectResolver; - uno::Reference< document::XGraphicObjectResolver > xGrfResolver; - SvXMLGraphicHelper* pGraphicHelper = SvXMLGraphicHelper::Create(_xStorageToSaveTo,GRAPHICHELPER_MODE_WRITE); - xGrfResolver = pGraphicHelper; - pGraphicHelper->release(); - SvXMLEmbeddedObjectHelper* pEmbeddedObjectHelper = SvXMLEmbeddedObjectHelper::Create( _xStorageToSaveTo,*this, EMBEDDEDOBJECTHELPER_MODE_WRITE ); - xObjectResolver = pEmbeddedObjectHelper; - pEmbeddedObjectHelper->release(); - - aDelegatorArguments.realloc(nArgsLen+2); - aDelegatorArguments[nArgsLen++] <<= xGrfResolver; - aDelegatorArguments[nArgsLen++] <<= xObjectResolver; - - uno::Reference<XComponent> xCom(static_cast<OWeakObject*>(this),uno::UNO_QUERY); - if( !bErr ) - { - xInfoSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamName")), uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("settings.xml")))); - if( !WriteThroughComponent( - xCom, "settings.xml", - "com.sun.star.comp.report.XMLSettingsExporter", - aDelegatorArguments, aProps, sal_True,_xStorageToSaveTo ) ) - { - if( !bWarn ) - { - bWarn = sal_True; - sWarnFile = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("settings.xml")); - } - } - } - - if( !bErr ) - { - xInfoSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamName")), uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("meta.xml")))); - if( !WriteThroughComponent( - xCom, "meta.xml", - "com.sun.star.comp.report.XMLMetaExporter", - aDelegatorArguments, aProps, sal_True,_xStorageToSaveTo ) ) - { - if( !bWarn ) - { - bWarn = sal_True; - sWarnFile = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("meta.xml")); - } - } - } - - if( !bErr ) - { - xInfoSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamName")), uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("styles.xml")))); - if( !WriteThroughComponent( - xCom, "styles.xml", - "com.sun.star.comp.report.XMLStylesExporter", - aDelegatorArguments, aProps, sal_True,_xStorageToSaveTo ) ) - { - if( !bWarn ) - { - bWarn = sal_True; - sWarnFile = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("styles.xml")); - } - } - } - - if ( !bErr ) - { - xInfoSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamName")), uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("content.xml")))); - if( !WriteThroughComponent( - xCom, "content.xml", - "com.sun.star.comp.report.ExportFilter", - aDelegatorArguments, aProps, sal_True,_xStorageToSaveTo ) ) - { - bErr = sal_True; - sErrFile = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("content.xml")); - } - } - - 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() ) - { - ::rtl::OUString sObject1(RTL_CONSTASCII_USTRINGPARAM("report")); - ::rtl::OUString sPng(RTL_CONSTASCII_USTRINGPARAM("image/png")); - - uno::Sequence<sal_Int8> aSeq; - aImage >>= aSeq; - uno::Reference<io::XInputStream> xStream = new ::comphelper::SequenceInputStream( aSeq ); - m_pImpl->m_pObjectContainer->InsertGraphicStreamDirectly(xStream,sObject1,sPng); - } - - if ( !bErr ) - { - sal_Bool bPersist = sal_False; - if ( _xStorageToSaveTo == m_pImpl->m_xStorage ) - bPersist = m_pImpl->m_pObjectContainer->StoreChildren(sal_True,sal_False); - else - bPersist = m_pImpl->m_pObjectContainer->StoreAsChildren(sal_True,sal_True,_xStorageToSaveTo); - - if( bPersist ) - m_pImpl->m_pObjectContainer->SetPersistentEntries(m_pImpl->m_xStorage); - try - { - uno::Reference<embed::XTransactedObject> xTransact(_xStorageToSaveTo,uno::UNO_QUERY); - if ( xTransact.is() ) - xTransact->commit(); - } - catch(uno::Exception) - { - OSL_FAIL("Exception Caught: Could not commit report storage!"); - throw io::IOException(); - } - - if ( _xStorageToSaveTo == m_pImpl->m_xStorage ) - setModified(sal_False); - } - if ( xStatusIndicator.is() ) - xStatusIndicator->end(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::switchToStorage( const uno::Reference< embed::XStorage >& _xStorage ) throw (lang::IllegalArgumentException, io::IOException, uno::Exception, uno::RuntimeException) -{ - if ( !_xStorage.is() ) - throw lang::IllegalArgumentException(RPT_RESSTRING(RID_STR_ARGUMENT_IS_NULL,m_aProps->m_xContext->getServiceManager()),*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<document::XStorageChangeListener>( - ::boost::bind(&document::XStorageChangeListener::notifyStorageChange,_1,boost::cref(static_cast<OWeakObject*>(this)),boost::cref(_xStorage))); -} -// ----------------------------------------------------------------------------- -uno::Reference< embed::XStorage > SAL_CALL OReportDefinition::getDocumentStorage( ) throw (io::IOException, uno::Exception, uno::RuntimeException) -{ - ::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 ) throw (uno::RuntimeException) -{ - ::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 ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - m_pImpl->m_aStorageChangeListeners.removeInterface(xListener); -} -// ----------------------------------------------------------------------------- -sal_Bool OReportDefinition::WriteThroughComponent( - const uno::Reference<lang::XComponent> & xComponent, - const sal_Char* pStreamName, - const sal_Char* pServiceName, - const uno::Sequence<uno::Any> & rArguments, - const uno::Sequence<beans::PropertyValue> & rMediaDesc, - sal_Bool bPlainStream - ,const uno::Reference<embed::XStorage>& _xStorageToSaveTo) -{ - OSL_ENSURE( NULL != pStreamName, "Need stream name!" ); - OSL_ENSURE( NULL != pServiceName, "Need service name!" ); - try - { - uno::Reference<embed::XStorage> xMyStorage = _xStorageToSaveTo; - // open stream - ::rtl::OUString sStreamName = ::rtl::OUString::createFromAscii( pStreamName ); - uno::Reference<io::XStream> xStream = xMyStorage->openStreamElement( sStreamName,embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE ); - if ( !xStream.is() ) - return sal_False; - uno::Reference<io::XOutputStream> xOutputStream = xStream->getOutputStream(); - OSL_ENSURE(xOutputStream.is(), "Can't create output stream in package!"); - if ( ! xOutputStream.is() ) - return sal_False; - - uno::Reference<beans::XPropertySet> xStreamProp(xOutputStream,uno::UNO_QUERY); - OSL_ENSURE(xStreamProp.is(),"No valid preoperty set for the output stream!"); - - uno::Reference<io::XSeekable> xSeek(xStreamProp,uno::UNO_QUERY); - if ( xSeek.is() ) - { - OSL_TRACE("Length of stream %i",(int)xSeek->getPosition()); - xSeek->seek(0); - } - - ::rtl::OUString aPropName(RTL_CONSTASCII_USTRINGPARAM("MediaType")); - ::rtl::OUString aMime( RTL_CONSTASCII_USTRINGPARAM("text/xml") ); - uno::Any aAny; - aAny <<= aMime; - xStreamProp->setPropertyValue( aPropName, aAny ); - - if( bPlainStream ) - { - aAny <<= sal_False; - xStreamProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Compressed") ), aAny ); - } - else - { - xStreamProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Encrypted") ), uno::makeAny(sal_True) ); - } - - - // set buffer and create outputstream - - // write the stuff - sal_Bool bRet = WriteThroughComponent( - xOutputStream, xComponent, - pServiceName, rArguments, rMediaDesc ); - // finally, commit stream. - return bRet; - } - catch(const uno::Exception& e) - { - (void)e; // helper to know what e contains - throw; - } -} -// ----------------------------------------------------------------------------- -sal_Bool OReportDefinition::WriteThroughComponent( - const uno::Reference<io::XOutputStream> & xOutputStream, - const uno::Reference<lang::XComponent> & xComponent, - const sal_Char* pServiceName, - const uno::Sequence<uno::Any> & rArguments, - const uno::Sequence<beans::PropertyValue> & rMediaDesc) -{ - OSL_ENSURE( xOutputStream.is(), "I really need an output stream!" ); - OSL_ENSURE( xComponent.is(), "Need component!" ); - OSL_ENSURE( NULL != pServiceName, "Need component name!" ); - - // get component - uno::Reference< io::XActiveDataSource > xSaxWriter( - m_aProps->m_xContext->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer")),m_aProps->m_xContext), - uno::UNO_QUERY ); - OSL_ENSURE( xSaxWriter.is(), "can't instantiate XML com.sun.star.xml.sax.Writer" ); - if(!xSaxWriter.is()) - return sal_False; - - // connect XML writer to output stream - xSaxWriter->setOutputStream( xOutputStream ); - - // prepare arguments (prepend doc handler to given arguments) - uno::Reference<xml::sax::XDocumentHandler> xDocHandler( xSaxWriter,uno::UNO_QUERY); - uno::Sequence<uno::Any> aArgs( 1 + rArguments.getLength() ); - aArgs[0] <<= xDocHandler; - for(sal_Int32 i = 0; i < rArguments.getLength(); i++) - aArgs[i+1] = rArguments[i]; - - // get filter component - uno::Reference< document::XExporter > xExporter( - m_aProps->m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( - ::rtl::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 sal_False; - - // connect model and filter - xExporter->setSourceDocument( xComponent ); - - // filter! - uno::Reference<document::XFilter> xFilter( xExporter, uno::UNO_QUERY ); - return xFilter->filter( rMediaDesc ); -} -// ----------------------------------------------------------------------------- -// XLoadable -void SAL_CALL OReportDefinition::initNew( ) throw (frame::DoubleInitializationException, io::IOException, uno::Exception, uno::RuntimeException) -{ - setPageHeaderOn( sal_True ); - setPageFooterOn( sal_True ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::load( const uno::Sequence< beans::PropertyValue >& _rArguments ) throw (frame::DoubleInitializationException, io::IOException, uno::Exception, uno::RuntimeException) -{ - ::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 an URL, or a stream - uno::Reference< io::XInputStream > xStream; - ::rtl::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 <<= aStorageSource; - else if ( sURL.getLength() ) - aStorageSource <<= sURL; - else - throw lang::IllegalArgumentException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No input source (URL or InputStream) found." ) ), - // TODO: resource - *this, - 1 - ); - - uno::Reference< lang::XSingleServiceFactory > xStorageFactory( - m_aProps->m_xContext->getServiceManager()->createInstanceWithContext( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.StorageFactory" ) ), - m_aProps->m_xContext ), - uno::UNO_QUERY_THROW - ); - - // 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" ) ) - { - sal_Bool bReadOnly = sal_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(2); - aStorageCreationArgs[0] = aStorageSource; - aStorageCreationArgs[1] <<= nOpenModes[i]; - - try - { - xDocumentStorage.set( xStorageFactory->createInstanceWithArguments( aStorageCreationArgs ), uno::UNO_QUERY_THROW ); - } - catch( const uno::Exception& ) - { - if ( i == nLastOpenMode ) - throw lang::WrappedTargetException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "An error occurred while creating the document storage." ) ), - // TODO: resource - *this, - ::cppu::getCaughtException() - ); - } - } - - if ( !xDocumentStorage.is() ) - { - throw uno::RuntimeException(); - } - - 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 ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException) -{ - ::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( sal_True ); - m_pImpl->m_nAspect = _nAspect; -} -// ----------------------------------------------------------------------------- -awt::Size SAL_CALL OReportDefinition::getVisualAreaSize( ::sal_Int64 /*_nAspect*/ ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - return m_pImpl->m_aVisualAreaSize; -} -// ----------------------------------------------------------------------------- -embed::VisualRepresentation SAL_CALL OReportDefinition::getPreferredVisualRepresentation( ::sal_Int64 /*_nAspect*/ ) throw (lang::IllegalArgumentException, embed::WrongStateException, uno::Exception, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - embed::VisualRepresentation aResult; - ::rtl::OUString sImageName(RTL_CONSTASCII_USTRINGPARAM("report")); - ::rtl::OUString sMimeType; - uno::Reference<io::XInputStream> xStream = m_pImpl->m_pObjectContainer->GetGraphicStream(sImageName,&sMimeType); - if ( xStream.is() ) - { - uno::Sequence<sal_Int8> aSeq; - xStream->readBytes(aSeq,xStream->available()); - xStream->closeInput(); - aResult.Data <<= aSeq; - aResult.Flavor.MimeType = sMimeType; - aResult.Flavor.DataType = ::getCppuType( &aSeq ); - } - - return aResult; -} -// ----------------------------------------------------------------------------- -::sal_Int32 SAL_CALL OReportDefinition::getMapUnit( ::sal_Int64 /*nAspect*/ ) throw (uno::Exception, uno::RuntimeException) -{ - return embed::EmbedMapUnits::ONE_100TH_MM; -} -// ----------------------------------------------------------------------------- -// XModifiable -::sal_Bool SAL_CALL OReportDefinition::disableSetModified( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed ); - - const sal_Bool bWasEnabled = m_pImpl->m_bSetModifiedEnabled; - m_pImpl->m_bSetModifiedEnabled = sal_False; - return bWasEnabled; -} - -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OReportDefinition::enableSetModified( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed ); - - const sal_Bool bWasEnabled = m_pImpl->m_bSetModifiedEnabled; - m_pImpl->m_bSetModifiedEnabled = sal_True; - return bWasEnabled; -} - -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OReportDefinition::isSetModifiedEnabled( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed ); - - return m_pImpl->m_bSetModifiedEnabled; -} - -// ----------------------------------------------------------------------------- -// XModifiable -::sal_Bool SAL_CALL OReportDefinition::isModified( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - return m_pImpl->m_bModified; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::setModified( ::sal_Bool _bModified ) throw (beans::PropertyVetoException, uno::RuntimeException) -{ - ::osl::ResettableMutexGuard 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 != _bModified ) - { - m_pImpl->m_bModified = _bModified; - if ( m_pImpl->m_pReportModel->IsChanged() != _bModified ) - m_pImpl->m_pReportModel->SetChanged(_bModified); - - lang::EventObject aEvent(*this); - aGuard.clear(); - m_pImpl->m_aModifyListeners.notifyEach(&util::XModifyListener::modified,aEvent); - notifyEvent(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OnModifyChanged"))); - } -} -// ----------------------------------------------------------------------------- -// XModifyBroadcaster -void SAL_CALL OReportDefinition::addModifyListener( const uno::Reference< util::XModifyListener >& _xListener ) throw (uno::RuntimeException) -{ - ::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 ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - m_pImpl->m_aModifyListeners.removeInterface(_xListener); -} -// ----------------------------------------------------------------------------- -void OReportDefinition::notifyEvent(const ::rtl::OUString& _sEventName) -{ - try - { - ::osl::ResettableMutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - document::EventObject aEvt(*this, _sEventName); - aGuard.clear(); - m_pImpl->m_aDocEventListeners.notifyEach(&document::XEventListener::notifyEvent,aEvt); - } - catch(uno::Exception&) - { - } -} -// ----------------------------------------------------------------------------- -// document::XEventBroadcaster -void SAL_CALL OReportDefinition::addEventListener(const uno::Reference< document::XEventListener >& _xListener ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - if ( _xListener.is() ) - m_pImpl->m_aDocEventListeners.addInterface(_xListener); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::removeEventListener( const uno::Reference< document::XEventListener >& _xListener ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - m_pImpl->m_aDocEventListeners.removeInterface(_xListener); -} -// ----------------------------------------------------------------------------- -// document::XEventListener -void SAL_CALL OReportDefinition::notifyEvent( const document::EventObject& aEvent ) throw (uno::RuntimeException) -{ - // used only to forward external events (e.g. for doc creation) from the frame loader - // to the global event broadcaster and all other interested doc event listener. - notifyEvent(aEvent.EventName); -} -// ----------------------------------------------------------------------------- -// document::XViewDataSupplier -uno::Reference< container::XIndexAccess > SAL_CALL OReportDefinition::getViewData( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - if ( !m_pImpl->m_xViewData.is() ) - { - m_pImpl->m_xViewData.set(m_aProps->m_xContext->getServiceManager()->createInstanceWithContext( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.IndexedPropertyValues")),m_aProps->m_xContext ),uno::UNO_QUERY); - uno::Reference< container::XIndexContainer > xContainer(m_pImpl->m_xViewData,uno::UNO_QUERY); - ::std::vector< uno::Reference< frame::XController> >::iterator aIter = m_pImpl->m_aControllers.begin(); - ::std::vector< uno::Reference< frame::XController> >::iterator aEnd = m_pImpl->m_aControllers.end(); - for (;aIter != aEnd ; ++aIter) - { - if ( aIter->is() ) - { - try - { - xContainer->insertByIndex(xContainer->getCount(),(*aIter)->getViewData()); - } - catch(uno::Exception&) - { - } - } - } - - } - return m_pImpl->m_xViewData; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::setViewData( const uno::Reference< container::XIndexAccess >& Data ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - m_pImpl->m_xViewData = Data; -} -// ----------------------------------------------------------------------------- -uno::Reference< report::XFunctions > SAL_CALL OReportDefinition::getFunctions() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - return m_pImpl->m_xFunctions; -} -// ----------------------------------------------------------------------------- -uno::Reference< ui::XUIConfigurationManager > SAL_CALL OReportDefinition::getUIConfigurationManager( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - - if ( !m_pImpl->m_xUIConfigurationManager.is() ) - { - m_pImpl->m_xUIConfigurationManager.set(m_aProps->m_xContext->getServiceManager()->createInstanceWithContext(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.UIConfigurationManager")),m_aProps->m_xContext), - uno::UNO_QUERY); - - uno::Reference< ui::XUIConfigurationStorage > xUIConfigStorage( m_pImpl->m_xUIConfigurationManager, uno::UNO_QUERY ); - if ( xUIConfigStorage.is() ) - { - uno::Reference< embed::XStorage > xConfigStorage; - // initialize ui configuration manager with document substorage - xUIConfigStorage->setStorage( xConfigStorage ); - } - } - - return m_pImpl->m_xUIConfigurationManager; -} -// ----------------------------------------------------------------------------- -uno::Reference< embed::XStorage > SAL_CALL OReportDefinition::getDocumentSubStorage( const ::rtl::OUString& aStorageName, sal_Int32 nMode ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - return m_pImpl->m_xStorage->openStorageElement(aStorageName, nMode); -} -// ----------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > SAL_CALL OReportDefinition::getDocumentSubStoragesNames( ) throw (io::IOException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - uno::Reference<container::XNameAccess> xNameAccess(m_pImpl->m_xStorage,uno::UNO_QUERY); - return xNameAccess.is() ? xNameAccess->getElementNames() : uno::Sequence< ::rtl::OUString >(); -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OReportDefinition::getMimeType() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - return m_pImpl->m_sMimeType; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::setMimeType( const ::rtl::OUString& _mimetype ) throw (lang::IllegalArgumentException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - uno::Sequence< ::rtl::OUString > aList = getAvailableMimeTypes(); - const ::rtl::OUString* pEnd = aList.getConstArray()+aList.getLength(); - if ( ::std::find(aList.getConstArray(),pEnd,_mimetype) == pEnd ) - throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("getAvailableMimeTypes()")) - ,*this - ,1 - ,m_aProps->m_xContext); - set(PROPERTY_MIMETYPE,_mimetype,m_pImpl->m_sMimeType); -} -// ----------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > SAL_CALL OReportDefinition::getAvailableMimeTypes( ) throw (lang::DisposedException, uno::Exception, uno::RuntimeException) -{ - uno::Sequence< ::rtl::OUString > s_aList(2); - s_aList[0] = MIMETYPE_OASIS_OPENDOCUMENT_TEXT; - s_aList[1] = MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET; - return s_aList; -} -// ----------------------------------------------------------------------------- -// com::sun::star::XUnoTunnel -sal_Int64 SAL_CALL OReportDefinition::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw(uno::RuntimeException) -{ - sal_Int64 nRet = 0; - if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) - nRet = reinterpret_cast<sal_Int64>(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( ) throw (uno::RuntimeException) -{ - return OReportDefinition::getUnoTunnelImplementationId(); -} -//-------------------------------------------------------------------------- -uno::Sequence< sal_Int8 > OReportDefinition::getUnoTunnelImplementationId() -{ - static ::cppu::OImplementationId * pId = 0; - if (! pId) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if (! pId) - { - static ::cppu::OImplementationId aId; - pId = &aId; - } - } - return pId->getImplementationId(); -} -// ----------------------------------------------------------------------------- -uno::Reference< uno::XComponentContext > OReportDefinition::getContext() -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - return m_aProps->m_xContext; -} -// ----------------------------------------------------------------------------- -::boost::shared_ptr<rptui::OReportModel> OReportDefinition::getSdrModel() const -{ - return m_pImpl->m_pReportModel; -} -// ----------------------------------------------------------------------------- -::boost::shared_ptr<rptui::OReportModel> OReportDefinition::getSdrModel(const uno::Reference< report::XReportDefinition >& _xReportDefinition) -{ - ::boost::shared_ptr<rptui::OReportModel> pReportModel; - uno::Reference< lang::XUnoTunnel > xUT( _xReportDefinition, uno::UNO_QUERY ); - if( xUT.is() ) - pReportModel = reinterpret_cast<OReportDefinition*>(sal::static_int_cast<sal_uIntPtr>(xUT->getSomething( OReportDefinition::getUnoTunnelImplementationId())))->getSdrModel(); - return pReportModel; -} -// ----------------------------------------------------------------------------- -uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::createInstanceWithArguments( const ::rtl::OUString& aServiceSpecifier, const uno::Sequence< uno::Any >& _aArgs) - throw( uno::Exception, uno::RuntimeException ) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - - uno::Reference< uno::XInterface > xRet; - if ( aServiceSpecifier.indexOf( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver"))) == 0 ) - { - uno::Reference< embed::XStorage > xStorage; - const uno::Any* pIter = _aArgs.getConstArray(); - const uno::Any* pEnd = pIter + _aArgs.getLength(); - for(;pIter != pEnd ;++pIter) - { - beans::NamedValue aValue; - *pIter >>= aValue; - if( aValue.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Storage" ) ) ) - aValue.Value >>= xStorage; - } - m_pImpl->m_pObjectContainer->SwitchPersistence(xStorage); - xRet = static_cast< ::cppu::OWeakObject* >(SvXMLEmbeddedObjectHelper::Create( xStorage,*this, EMBEDDEDOBJECTHELPER_MODE_READ )); - } - return xRet; -} -// ----------------------------------------------------------------------------- -uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw(uno::Exception, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - uno::Reference< drawing::XShape > xShape; - if ( aServiceSpecifier.indexOf( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.")) ) == 0 ) - { - if ( aServiceSpecifier == SERVICE_SHAPE ) - xShape.set(SvxUnoDrawMSFactory::createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("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( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ControlShape")) ),uno::UNO_QUERY_THROW); - else - xShape.set(SvxUnoDrawMSFactory::createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.OLE2Shape")) ),uno::UNO_QUERY_THROW); - } - else if ( aServiceSpecifier.indexOf( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.")) ) == 0 ) - { - xShape.set(m_aProps->m_xContext->getServiceManager()->createInstanceWithContext(aServiceSpecifier,m_aProps->m_xContext),uno::UNO_QUERY); - } - else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.style.PageStyle") ) == 0 || - aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.style.FrameStyle") ) == 0 || - aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.style.GraphicStyle") ) == 0 - ) - { - uno::Reference< style::XStyle> xStyle = new OStyle(); - xStyle->setName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Default"))); - uno::Reference<beans::XPropertySet> xProp(xStyle,uno::UNO_QUERY); - ::rtl::OUString sTray; - xProp->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PrinterPaperTray")))>>= sTray; - - return xStyle.get(); - } - else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.Settings") ) == 0 ) - { - uno::Reference<beans::XPropertySet> xProp = new OStyle(); - - return xProp.get(); - } - else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Defaults") ) == 0 ) - { - uno::Reference<beans::XPropertySet> xProp = new OStyle(); - return xProp.get(); - } - else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GradientTable") ) == 0 ) - { - 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.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.HatchTable") ) == 0 ) - { - 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.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.BitmapTable") ) == 0 ) - { - 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.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TransparencyGradientTable") ) == 0 ) - { - 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.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DashTable") ) == 0 ) - { - 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( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("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.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver")) == 0 ) - return static_cast< ::cppu::OWeakObject* >(SvXMLEmbeddedObjectHelper::Create( m_pImpl->m_xStorage,*this, EMBEDDEDOBJECTHELPER_MODE_READ )); - else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ExportEmbeddedObjectResolver")) == 0 ) - return static_cast< ::cppu::OWeakObject* >(SvXMLEmbeddedObjectHelper::Create( m_pImpl->m_xStorage,*this, EMBEDDEDOBJECTHELPER_MODE_WRITE )); - else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ImportGraphicObjectResolver")) == 0 ) - { - SvXMLGraphicHelper* pGraphicHelper = SvXMLGraphicHelper::Create(m_pImpl->m_xStorage,GRAPHICHELPER_MODE_WRITE); - uno::Reference< uno::XInterface> xRet(static_cast< ::cppu::OWeakObject* >(pGraphicHelper)); - pGraphicHelper->release(); - return xRet; - } - else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ExportGraphicObjectResolver")) == 0 ) - { - SvXMLGraphicHelper* pGraphicHelper = SvXMLGraphicHelper::Create(m_pImpl->m_xStorage,GRAPHICHELPER_MODE_WRITE); - uno::Reference< uno::XInterface> xRet(static_cast< ::cppu::OWeakObject* >(pGraphicHelper)); - pGraphicHelper->release(); - return xRet; - } - else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.chart2.data.DataProvider")) == 0 ) - { - uno::Reference<chart2::data::XDatabaseDataProvider> xDataProvider(chart2::data::DatabaseDataProvider::createWithConnection( m_aProps->m_xContext, m_pImpl->m_xActiveConnection )); - xDataProvider->setRowLimit(10); - uno::Reference< container::XChild > xChild(xDataProvider,uno::UNO_QUERY); - if ( xChild.is() ) - xChild->setParent(*this); - return uno::Reference< uno::XInterface >(xDataProvider,uno::UNO_QUERY); - } - else if ( aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.xml.NamespaceMap")) == 0 ) - { - if ( !m_pImpl->m_xXMLNamespaceMap.is() ) - m_pImpl->m_xXMLNamespaceMap = comphelper::NameContainer_createInstance( ::getCppuType( (const ::rtl::OUString*) 0 ) ).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< ::rtl::OUString > SAL_CALL OReportDefinition::getAvailableServiceNames(void) throw( uno::RuntimeException ) -{ - static const ::rtl::OUString aSvxComponentServiceNameList[] = - { - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FixedText")), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.DatabaseImageControl")), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.PageStyle")), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.GraphicStyle")), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.FrameStyle")), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Defaults")), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver")), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ExportEmbeddedObjectResolver")), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportGraphicObjectResolver")), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ExportGraphicObjectResolver")), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.data.DataProvider")), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.NamespaceMap")), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.Settings")), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GradientTable")), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.HatchTable")), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.BitmapTable")), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.TransparencyGradientTable")), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DashTable")), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.MarkerTable")) - }; - - static const sal_uInt16 nSvxComponentServiceNameListCount = SAL_N_ELEMENTS(aSvxComponentServiceNameList); - - uno::Sequence< ::rtl::OUString > aSeq( nSvxComponentServiceNameListCount ); - ::rtl::OUString* pStrings = aSeq.getArray(); - for( sal_uInt16 nIdx = 0; nIdx < nSvxComponentServiceNameListCount; nIdx++ ) - pStrings[nIdx] = aSvxComponentServiceNameList[nIdx]; - - uno::Sequence< ::rtl::OUString > aParentSeq( SvxUnoDrawMSFactory::getAvailableServiceNames() ); - return concatServiceNames( aParentSeq, aSeq ); -} -// ----------------------------------------------------------------------------- -// XShape -awt::Point SAL_CALL OReportDefinition::getPosition( ) throw (uno::RuntimeException) -{ - ::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 ) throw (uno::RuntimeException) -{ - ::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( ) throw (uno::RuntimeException) -{ - ::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 ) throw (beans::PropertyVetoException, uno::RuntimeException) -{ - ::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 -::rtl::OUString SAL_CALL OReportDefinition::getShapeType( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - if ( m_aProps->m_xShape.is() ) - return m_aProps->m_xShape->getShapeType(); - return ::rtl::OUString(); -} -// ----------------------------------------------------------------------------- -typedef ::cppu::WeakImplHelper2< container::XNameContainer, - container::XIndexAccess - > TStylesBASE; -class OStylesHelper : public ::cppu::BaseMutex, public TStylesBASE -{ - typedef ::std::map< ::rtl::OUString, uno::Any , ::comphelper::UStringMixLess> TStyleElements; - TStyleElements m_aElements; - ::std::vector<TStyleElements::iterator> m_aElementsPos; - uno::Type m_aType; - - OStylesHelper(const OStylesHelper&); - void operator =(const OStylesHelper&); -protected: - virtual ~OStylesHelper(){} -public: - OStylesHelper(const uno::Type _aType = ::getCppuType(static_cast< uno::Reference< container::XElementAccess >* >(NULL))); - - // XNameContainer - virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::ElementExistException,lang::WrappedTargetException, uno::RuntimeException); - virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw(container::NoSuchElementException, lang::WrappedTargetException,uno::RuntimeException); - - // XNameReplace - virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::NoSuchElementException,lang::WrappedTargetException, uno::RuntimeException); - - // container::XElementAccess - virtual uno::Type SAL_CALL getElementType( ) throw(uno::RuntimeException); - virtual sal_Bool SAL_CALL hasElements( ) throw(uno::RuntimeException); - // container::XIndexAccess - virtual sal_Int32 SAL_CALL getCount( ) throw(uno::RuntimeException); - virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException); - - // container::XNameAccess - virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException); - virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(uno::RuntimeException); - virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(uno::RuntimeException); -}; - -OStylesHelper::OStylesHelper(const uno::Type _aType) -: cppu::BaseMutex() -,m_aType(_aType) -{ -} -// -----------------------------------------------------------------------------; -// container::XElementAccess -uno::Type SAL_CALL OStylesHelper::getElementType( ) throw(uno::RuntimeException) -{ - return m_aType; -} -// ----------------------------------------------------------------------------- -sal_Bool SAL_CALL OStylesHelper::hasElements( ) throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return !m_aElementsPos.empty(); -} -// ----------------------------------------------------------------------------- -// container::XIndexAccess -sal_Int32 SAL_CALL OStylesHelper::getCount( ) throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aElementsPos.size(); -} -// ----------------------------------------------------------------------------- -uno::Any SAL_CALL OStylesHelper::getByIndex( sal_Int32 Index ) throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - if ( Index < 0 || Index >= static_cast<sal_Int32>(m_aElementsPos.size()) ) - throw lang::IndexOutOfBoundsException(); - return uno::makeAny(m_aElementsPos[Index]->second); -} -// ----------------------------------------------------------------------------- -// container::XNameAccess -uno::Any SAL_CALL OStylesHelper::getByName( const ::rtl::OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - TStyleElements::iterator aFind = m_aElements.find(aName); - if ( aFind == m_aElements.end() ) - throw container::NoSuchElementException(); - return uno::makeAny(aFind->second); -} -// ----------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > SAL_CALL OStylesHelper::getElementNames( ) throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - uno::Sequence< ::rtl::OUString > aNameList(m_aElementsPos.size()); - - ::rtl::OUString* pStringArray = aNameList.getArray(); - ::std::vector<TStyleElements::iterator>::const_iterator aEnd = m_aElementsPos.end(); - for(::std::vector<TStyleElements::iterator>::const_iterator aIter = m_aElementsPos.begin(); aIter != aEnd;++aIter,++pStringArray) - *pStringArray = (*aIter)->first; - - return aNameList; -} -// ----------------------------------------------------------------------------- -sal_Bool SAL_CALL OStylesHelper::hasByName( const ::rtl::OUString& aName ) throw(uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aElements.find(aName) != m_aElements.end(); -} -// ----------------------------------------------------------------------------- -// XNameContainer -void SAL_CALL OStylesHelper::insertByName( const ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::ElementExistException,lang::WrappedTargetException, uno::RuntimeException) -{ - ::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.insert(TStyleElements::value_type(aName,aElement)).first); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OStylesHelper::removeByName( const ::rtl::OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException,uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - TStyleElements::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 ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::NoSuchElementException,lang::WrappedTargetException, uno::RuntimeException) -{ - ::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( ) throw (uno::RuntimeException) -{ - ::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(::getCppuType(static_cast< uno::Reference<style::XStyle>* >(NULL))); - xStyles->insertByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PageStyles")),uno::makeAny(xPageStyles)); - uno::Reference< style::XStyle> xPageStyle(createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.PageStyle"))),uno::UNO_QUERY); - xPageStyles->insertByName(xPageStyle->getName(),uno::makeAny(xPageStyle)); - - uno::Reference< container::XNameContainer> xFrameStyles = new OStylesHelper(::getCppuType(static_cast< uno::Reference<style::XStyle>* >(NULL))); - xStyles->insertByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameStyles")),uno::makeAny(xFrameStyles)); - uno::Reference< style::XStyle> xFrameStyle(createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.FrameStyle"))),uno::UNO_QUERY); - xFrameStyles->insertByName(xFrameStyle->getName(),uno::makeAny(xFrameStyle)); - - uno::Reference< container::XNameContainer> xGraphicStyles = new OStylesHelper(::getCppuType(static_cast< uno::Reference<style::XStyle>* >(NULL))); - xStyles->insertByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("graphics")),uno::makeAny(xGraphicStyles)); - uno::Reference< style::XStyle> xGraphicStyle(createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.GraphicStyle"))),uno::UNO_QUERY); - xGraphicStyles->insertByName(xGraphicStyle->getName(),uno::makeAny(xGraphicStyle)); - } - return m_pImpl->m_xStyles; -} -::rtl::OUString SAL_CALL OReportDefinition::getIdentifier( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - return m_pImpl->m_sIdentifier; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::setIdentifier( const ::rtl::OUString& Identifier ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - m_pImpl->m_sIdentifier = Identifier; -} -// ----------------------------------------------------------------------------- -// XNumberFormatsSupplier -uno::Reference< beans::XPropertySet > SAL_CALL OReportDefinition::getNumberFormatSettings( ) throw (uno::RuntimeException) -{ - ::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( ) throw (uno::RuntimeException) -{ - ::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( m_aProps->m_xContext->getServiceManager()->createInstanceWithContext( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler")) ,m_aProps->m_xContext),uno::UNO_QUERY); - return xRet; -} -// ----------------------------------------------------------------------------- -uno::Reference< sdbc::XConnection > SAL_CALL OReportDefinition::getActiveConnection() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_pImpl->m_xActiveConnection; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::setActiveConnection( const uno::Reference< sdbc::XConnection >& _activeconnection ) throw (lang::IllegalArgumentException, uno::RuntimeException) -{ - if ( !_activeconnection.is() ) - throw lang::IllegalArgumentException(); - set(PROPERTY_ACTIVECONNECTION,_activeconnection,m_pImpl->m_xActiveConnection); -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OReportDefinition::getDataSourceName() throw (uno::RuntimeException) -{ - osl::MutexGuard g(m_aMutex); - return m_pImpl->m_sDataSourceName; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportDefinition::setDataSourceName(const ::rtl::OUString& the_value) throw (uno::RuntimeException) -{ - set(PROPERTY_DATASOURCENAME,the_value,m_pImpl->m_sDataSourceName); -} -// ----------------------------------------------------------------------------- -bool OReportDefinition::isEnableSetModified() const -{ - return true; -} -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::XUntitledNumbers > xDesktop(m_aProps->m_xContext->getServiceManager()->createInstanceWithContext( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop")) ,m_aProps->m_xContext),uno::UNO_QUERY_THROW); - uno::Reference< frame::XModel > xThis (static_cast< frame::XModel* >(this), uno::UNO_QUERY_THROW); - - ::framework::TitleHelper* pHelper = new ::framework::TitleHelper(uno::Reference< lang::XMultiServiceFactory >(m_aProps->m_xContext->getServiceManager(),uno::UNO_QUERY)); - m_pImpl->m_xTitleHelper = uno::Reference< frame::XTitle >(static_cast< ::cppu::OWeakObject* >(pHelper), uno::UNO_QUERY_THROW); - pHelper->setOwner (xThis ); - pHelper->connectWithUntitledNumbers (xDesktop); - } - - 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 ()) - { - uno::Reference< frame::XModel > xThis (static_cast< frame::XModel* >(this), uno::UNO_QUERY_THROW); - ::comphelper::NumberedCollection* pHelper = new ::comphelper::NumberedCollection(); - m_pImpl->m_xNumberedControllers = uno::Reference< frame::XUntitledNumbers >(static_cast< ::cppu::OWeakObject* >(pHelper), uno::UNO_QUERY_THROW); - - pHelper->setOwner (xThis); - pHelper->setUntitledPrefix (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" : "))); - } - - return m_pImpl->m_xNumberedControllers; -} -// ----------------------------------------------------------------------------- -// css.frame.XTitle -::rtl::OUString SAL_CALL OReportDefinition::getTitle() - throw (uno::RuntimeException) -{ - // 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 ::rtl::OUString& sTitle ) - throw (uno::RuntimeException) -{ - // 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 ) - throw (uno::RuntimeException) -{ - // 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 ) - throw (uno::RuntimeException) -{ - // 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 ) - throw (lang::IllegalArgumentException, - uno::RuntimeException ) -{ - // 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 ) - throw (lang::IllegalArgumentException, - uno::RuntimeException ) -{ - // 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 ) - throw (lang::IllegalArgumentException, - uno::RuntimeException ) -{ - // object already disposed? - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - - impl_getUntitledHelper_throw()->releaseNumberForComponent (xComponent); -} -// ----------------------------------------------------------------------------- -// css.frame.XUntitledNumbers -::rtl::OUString SAL_CALL OReportDefinition::getUntitledPrefix() - throw (uno::RuntimeException) -{ - // 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( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); - if ( !m_pImpl->m_xDocumentProperties.is() ) - { - uno::Reference< lang::XInitialization > xDocProps( - m_aProps->m_xContext->getServiceManager()->createInstanceWithContext( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.DocumentProperties")) ,m_aProps->m_xContext), - uno::UNO_QUERY_THROW); - m_pImpl->m_xDocumentProperties.set(xDocProps, uno::UNO_QUERY_THROW); - } - return m_pImpl->m_xDocumentProperties; -} -// ----------------------------------------------------------------------------- -uno::Reference< uno::XComponentContext > OReportDefinition::getContext() const -{ - return m_aProps->m_xContext; -} -// ----------------------------------------------------------------------------- -uno::Any SAL_CALL OReportDefinition::getTransferData( const datatransfer::DataFlavor& aFlavor ) throw (datatransfer::UnsupportedFlavorException, io::IOException, uno::RuntimeException) -{ - uno::Any aResult; - if( isDataFlavorSupported( aFlavor ) ) - { - try - { - aResult <<= getPreferredVisualRepresentation(0).Data; - } - catch( uno::Exception & ex ) - { - DBG_UNHANDLED_EXCEPTION(); - (void)ex; - } - } - else - { - throw datatransfer::UnsupportedFlavorException(aFlavor.MimeType, static_cast< ::cppu::OWeakObject* >( this )); - } - - return aResult; -} -// ----------------------------------------------------------------------------- -uno::Sequence< datatransfer::DataFlavor > SAL_CALL OReportDefinition::getTransferDataFlavors( ) throw (uno::RuntimeException) -{ - uno::Sequence< datatransfer::DataFlavor > aRet(1); - - aRet[0] = datatransfer::DataFlavor( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("image/png")), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PNG")), - ::getCppuType( (const uno::Sequence< sal_Int8 >*) NULL ) ); - - return aRet; -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OReportDefinition::isDataFlavorSupported( const datatransfer::DataFlavor& aFlavor ) throw (uno::RuntimeException) -{ - return aFlavor.MimeType.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("image/png"))); -} - -// ----------------------------------------------------------------------------- -uno::Reference< document::XUndoManager > SAL_CALL OReportDefinition::getUndoManager( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - return m_pImpl->m_pUndoManager.get(); -} - - -// ============================================================================= -}// 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 deleted file mode 100644 index 9877d3158..000000000 --- a/reportdesign/source/core/api/ReportEngineJFree.cxx +++ /dev/null @@ -1,428 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_reportdesign.hxx" -#include <com/sun/star/beans/PropertyValue.hpp> -#include "ReportEngineJFree.hxx" -#include <comphelper/enumhelper.hxx> -#include <comphelper/documentconstants.hxx> -#include <comphelper/storagehelper.hxx> -#include <connectivity/dbtools.hxx> -#include <comphelper/sequence.hxx> -#include <comphelper/mimeconfighelper.hxx> -#include <comphelper/property.hxx> -#include <com/sun/star/beans/PropertyAttribute.hpp> -#include <com/sun/star/beans/NamedValue.hpp> -#include <com/sun/star/frame/XComponentLoader.hpp> -#include <com/sun/star/frame/FrameSearchFlag.hpp> -#include <com/sun/star/embed/XTransactedObject.hpp> -#include <com/sun/star/sdb/XCompletedExecution.hpp> -#include <com/sun/star/sdb/XSingleSelectQueryAnalyzer.hpp> -#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp> -#include <com/sun/star/sdb/CommandType.hpp> - -#include <com/sun/star/task/XInteractionHandler.hpp> -#include <com/sun/star/task/XJob.hpp> - -#include <tools/debug.hxx> -#include <tools/urlobj.hxx> -#include <unotools/useroptions.hxx> -#include <unotools/tempfile.hxx> -#include <unotools/sharedunocomponent.hxx> - -#include "Tools.hxx" -#include "corestrings.hrc" -#include "core_resource.hrc" -#include "core_resource.hxx" - -#include <connectivity/CommonTools.hxx> -#include <rtl/ustrbuf.hxx> -#include <sfx2/docfilt.hxx> -// ============================================================================= -namespace reportdesign -{ -// ============================================================================= - using namespace com::sun::star; - using namespace comphelper; - -DBG_NAME( rpt_OReportEngineJFree ) -// ----------------------------------------------------------------------------- -OReportEngineJFree::OReportEngineJFree( const uno::Reference< uno::XComponentContext >& context) -:ReportEngineBase(m_aMutex) -,ReportEnginePropertySet(context,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),uno::Sequence< ::rtl::OUString >()) -,m_xContext(context) -,m_nMaxRows(0) -{ - DBG_CTOR( rpt_OReportEngineJFree,NULL); -} -// ----------------------------------------------------------------------------- -// TODO: VirtualFunctionFinder: This is virtual function! -// -OReportEngineJFree::~OReportEngineJFree() -{ - DBG_DTOR( rpt_OReportEngineJFree,NULL); -} -//-------------------------------------------------------------------------- -IMPLEMENT_FORWARD_XINTERFACE2(OReportEngineJFree,ReportEngineBase,ReportEnginePropertySet) -// ----------------------------------------------------------------------------- -void SAL_CALL OReportEngineJFree::dispose() throw(uno::RuntimeException) -{ - ReportEnginePropertySet::dispose(); - cppu::WeakComponentImplHelperBase::dispose(); - m_xActiveConnection.clear(); -} -// ----------------------------------------------------------------------------- -::rtl::OUString OReportEngineJFree::getImplementationName_Static( ) throw(uno::RuntimeException) -{ - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.OReportEngineJFree")); -} - -//-------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OReportEngineJFree::getImplementationName( ) throw(uno::RuntimeException) -{ - return getImplementationName_Static(); -} -//-------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > OReportEngineJFree::getSupportedServiceNames_Static( ) throw(uno::RuntimeException) -{ - uno::Sequence< ::rtl::OUString > aServices(1); - aServices.getArray()[0] = SERVICE_REPORTENGINE; - - return aServices; -} -//------------------------------------------------------------------------------ -uno::Reference< uno::XInterface > OReportEngineJFree::create(uno::Reference< uno::XComponentContext > const & xContext) -{ - return *(new OReportEngineJFree(xContext)); -} - -//-------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > SAL_CALL OReportEngineJFree::getSupportedServiceNames( ) throw(uno::RuntimeException) -{ - return getSupportedServiceNames_Static(); -} -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL OReportEngineJFree::supportsService(const ::rtl::OUString& ServiceName) throw( uno::RuntimeException ) -{ - return ::comphelper::existsValue(ServiceName,getSupportedServiceNames_Static()); -} -// ----------------------------------------------------------------------------- -// XReportEngine - // Attributes -uno::Reference< report::XReportDefinition > SAL_CALL OReportEngineJFree::getReportDefinition() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_xReport; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportEngineJFree::setReportDefinition( const uno::Reference< report::XReportDefinition >& _report ) throw (lang::IllegalArgumentException, uno::RuntimeException) -{ - if ( !_report.is() ) - throw lang::IllegalArgumentException(); - BoundListeners l; - { - ::osl::MutexGuard aGuard(m_aMutex); - if ( m_xReport != _report ) - { - prepareSet(PROPERTY_REPORTDEFINITION, uno::makeAny(m_xReport), uno::makeAny(_report), &l); - m_xReport = _report; - } - } - l.notify(); -} -// ----------------------------------------------------------------------------- -uno::Reference< task::XStatusIndicator > SAL_CALL OReportEngineJFree::getStatusIndicator() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_StatusIndicator; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportEngineJFree::setStatusIndicator( const uno::Reference< task::XStatusIndicator >& _statusindicator ) throw (uno::RuntimeException) -{ - set(PROPERTY_STATUSINDICATOR,_statusindicator,m_StatusIndicator); -} -// ----------------------------------------------------------------------------- -::rtl::OUString OReportEngineJFree::getNewOutputName() -{ - ::rtl::OUString sOutputName; - { - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportEngineBase::rBHelper.bDisposed); - if ( !m_xReport.is() || !m_xActiveConnection.is() ) - throw lang::IllegalArgumentException(); - - static const ::rtl::OUString s_sMediaType(RTL_CONSTASCII_USTRINGPARAM("MediaType")); - try - { - const uno::Reference< lang::XMultiServiceFactory > xFactory(m_xContext->getServiceManager(),uno::UNO_QUERY_THROW); - MimeConfigurationHelper aConfighelper(xFactory); - const ::rtl::OUString sMimeType = m_xReport->getMimeType(); - const SfxFilter* pFilter = SfxFilter::GetDefaultFilter( aConfighelper.GetDocServiceNameFromMediaType(sMimeType) ); - String sExt; - if ( pFilter ) - { - sExt = pFilter->GetDefaultExtension(); - sExt.EraseLeadingChars( '*' ); - } - else - sExt = String::CreateFromAscii(".rpt"); - - uno::Reference< embed::XStorage > xTemp = OStorageHelper::GetTemporaryStorage(/*sFileTemp,embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE,*/uno::Reference< lang::XMultiServiceFactory >(m_xContext->getServiceManager(),uno::UNO_QUERY)); - 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::makeAny(sMimeType)); - } - m_xReport->storeToStorage(xTemp,aEmpty); // store to temp file because it may contain information which isn't in the database yet. - - uno::Sequence< beans::NamedValue > aConvertedProperties(8); - sal_Int32 nPos = 0; - aConvertedProperties[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InputStorage")); - aConvertedProperties[nPos++].Value <<= xTemp; - aConvertedProperties[nPos].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OutputStorage")); - - ::rtl::OUString sFileURL; - String sName = m_xReport->getCaption(); - if ( !sName.Len() ) - sName = m_xReport->getName(); - { - ::utl::TempFile aTestFile(sName,sal_False,&sExt); - if ( !aTestFile.IsValid() ) - { - sName = RPT_RESSTRING(RID_STR_REPORT,m_xContext->getServiceManager()); - ::utl::TempFile aFile(sName,sal_False,&sExt); - sFileURL = aFile.GetURL(); - } - else - sFileURL = aTestFile.GetURL(); - } - - uno::Reference< embed::XStorage > xOut = OStorageHelper::GetStorageFromURL(sFileURL,embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE,uno::Reference< lang::XMultiServiceFactory >(m_xContext->getServiceManager(),uno::UNO_QUERY)); - utl::DisposableComponent aOut(xOut); - xStorageProp.set(xOut,uno::UNO_QUERY); - if ( xStorageProp.is() ) - { - xStorageProp->setPropertyValue( s_sMediaType, uno::makeAny(sMimeType)); - } - - aConvertedProperties[nPos++].Value <<= xOut; - - aConvertedProperties[nPos].Name = PROPERTY_REPORTDEFINITION; - aConvertedProperties[nPos++].Value <<= m_xReport; - - aConvertedProperties[nPos].Name = PROPERTY_ACTIVECONNECTION; - aConvertedProperties[nPos++].Value <<= m_xActiveConnection; - - aConvertedProperties[nPos].Name = PROPERTY_MAXROWS; - aConvertedProperties[nPos++].Value <<= m_nMaxRows; - - // some meta data - SvtUserOptions aUserOpts; - ::rtl::OUStringBuffer sAuthor(aUserOpts.GetFirstName()); - sAuthor.appendAscii(" "); - sAuthor.append(aUserOpts.GetLastName()); - static const ::rtl::OUString s_sAuthor(RTL_CONSTASCII_USTRINGPARAM("Author")); - aConvertedProperties[nPos].Name = s_sAuthor; - aConvertedProperties[nPos++].Value <<= sAuthor.makeStringAndClear(); - - static const ::rtl::OUString s_sTitle(RTL_CONSTASCII_USTRINGPARAM("Title")); - aConvertedProperties[nPos].Name = s_sTitle; - aConvertedProperties[nPos++].Value <<= m_xReport->getCaption(); - - // create job factory and initialize - const ::rtl::OUString sReportEngineServiceName = ::dbtools::getDefaultReportEngineServiceName(xFactory); - uno::Reference<task::XJob> xJob(m_xContext->getServiceManager()->createInstanceWithContext(sReportEngineServiceName,m_xContext),uno::UNO_QUERY_THROW); - if ( m_xReport->getCommand().getLength() ) - { - xJob->execute(aConvertedProperties); - if ( xStorageProp.is() ) - { - sOutputName = sFileURL; - } - } - - uno::Reference<embed::XTransactedObject> xTransact(xOut,uno::UNO_QUERY); - if ( sOutputName.getLength() && xTransact.is() ) - xTransact->commit(); - - if ( !sOutputName.getLength() ) - throw lang::IllegalArgumentException(); - } - catch(const uno::Exception& e) - { - (void)e; // helper to know what e contains - throw; - } - } - return sOutputName; -} -// ----------------------------------------------------------------------------- -// Methods -uno::Reference< frame::XModel > SAL_CALL OReportEngineJFree::createDocumentModel( ) throw (lang::DisposedException, lang::IllegalArgumentException, uno::Exception, uno::RuntimeException) -{ - return createDocumentAlive(NULL,true); -} -// ----------------------------------------------------------------------------- -uno::Reference< frame::XModel > SAL_CALL OReportEngineJFree::createDocumentAlive( const uno::Reference< frame::XFrame >& _frame ) throw (lang::DisposedException, lang::IllegalArgumentException, uno::Exception, uno::RuntimeException) -{ - return createDocumentAlive(_frame,false); -} -// ----------------------------------------------------------------------------- -uno::Reference< frame::XModel > SAL_CALL OReportEngineJFree::createDocumentAlive( const uno::Reference< frame::XFrame >& _frame,bool _bHidden ) throw (lang::DisposedException, lang::IllegalArgumentException, uno::Exception, uno::RuntimeException) -{ - uno::Reference< frame::XModel > xModel; - ::rtl::OUString sOutputName = getNewOutputName(); // starts implicite the report generator - if ( sOutputName.getLength() ) - { - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportEngineBase::rBHelper.bDisposed); - uno::Reference<frame::XComponentLoader> xFrameLoad(_frame,uno::UNO_QUERY); - if ( !xFrameLoad.is() ) - { - // if there is no frame given, find the right - xFrameLoad.set( m_xContext->getServiceManager()->createInstanceWithContext( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) - ,m_xContext) - ,uno::UNO_QUERY); - ::rtl::OUString sTarget(RTL_CONSTASCII_USTRINGPARAM("_blank")); - sal_Int32 nFrameSearchFlag = frame::FrameSearchFlag::TASKS | frame::FrameSearchFlag::CREATE; - uno::Reference< frame::XFrame> xFrame = uno::Reference< frame::XFrame>(xFrameLoad,uno::UNO_QUERY)->findFrame(sTarget,nFrameSearchFlag); - xFrameLoad.set( xFrame,uno::UNO_QUERY); - } - - if ( xFrameLoad.is() ) - { - uno::Sequence < beans::PropertyValue > aArgs( _bHidden ? 3 : 2 ); - sal_Int32 nLen = 0; - aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AsTemplate")); - aArgs[nLen++].Value <<= sal_False; - - aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ReadOnly")); - aArgs[nLen++].Value <<= sal_True; - - if ( _bHidden ) - { - aArgs[nLen].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Hidden")); - aArgs[nLen++].Value <<= sal_True; - } - - uno::Reference< lang::XMultiServiceFactory > xFac(m_xContext->getServiceManager(),uno::UNO_QUERY); - xModel.set( xFrameLoad->loadComponentFromURL( - sOutputName, - ::rtl::OUString(), // empty frame name - 0, - aArgs - ),uno::UNO_QUERY); - } - } - return xModel; -} -// ----------------------------------------------------------------------------- -util::URL SAL_CALL OReportEngineJFree::createDocument( ) throw (lang::DisposedException, lang::IllegalArgumentException, uno::Exception, uno::RuntimeException) -{ - 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( ) throw (lang::DisposedException, uno::Exception, uno::RuntimeException) -{ - { - ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportEngineBase::rBHelper.bDisposed); - } -} -// ----------------------------------------------------------------------------- -uno::Reference< beans::XPropertySetInfo > SAL_CALL OReportEngineJFree::getPropertySetInfo( ) throw(uno::RuntimeException) -{ - return ReportEnginePropertySet::getPropertySetInfo(); -} -// ------------------------------------------------------------------------- -void SAL_CALL OReportEngineJFree::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) -{ - ReportEnginePropertySet::setPropertyValue( aPropertyName, aValue ); -} -// ----------------------------------------------------------------------------- -uno::Any SAL_CALL OReportEngineJFree::getPropertyValue( const ::rtl::OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - return ReportEnginePropertySet::getPropertyValue( PropertyName); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportEngineJFree::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - ReportEnginePropertySet::addPropertyChangeListener( aPropertyName, xListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportEngineJFree::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - ReportEnginePropertySet::removePropertyChangeListener( aPropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportEngineJFree::addVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - ReportEnginePropertySet::addVetoableChangeListener( PropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportEngineJFree::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - ReportEnginePropertySet::removeVetoableChangeListener( PropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -uno::Reference< sdbc::XConnection > SAL_CALL OReportEngineJFree::getActiveConnection() throw (uno::RuntimeException) -{ - return m_xActiveConnection; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportEngineJFree::setActiveConnection( const uno::Reference< sdbc::XConnection >& _activeconnection ) throw (lang::IllegalArgumentException, uno::RuntimeException) -{ - if ( !_activeconnection.is() ) - throw lang::IllegalArgumentException(); - set(PROPERTY_ACTIVECONNECTION,_activeconnection,m_xActiveConnection); -} -// ----------------------------------------------------------------------------- -::sal_Int32 SAL_CALL OReportEngineJFree::getMaxRows() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_nMaxRows; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OReportEngineJFree::setMaxRows( ::sal_Int32 _MaxRows ) throw (uno::RuntimeException) -{ - 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 deleted file mode 100644 index 2c085fd1f..000000000 --- a/reportdesign/source/core/api/ReportVisitor.cxx +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_reportdesign.hxx" -#include "ReportVisitor.hxx" -namespace reportdesign -{ -using namespace com::sun::star; - -OReportVisitor::OReportVisitor(ITraverseReport* _pTraverseReport) - :m_pTraverseReport(_pTraverseReport) -{ - OSL_ENSURE(m_pTraverseReport,"ReportDefintion must be not NULL!"); -} -// ----------------------------------------------------------------------------- -void OReportVisitor::start(const uno::Reference< report::XReportDefinition>& _xReportDefinition) -{ - OSL_ENSURE(_xReportDefinition.is(),"ReportDefinition is NULL!"); - if ( !_xReportDefinition.is() ) - return; - - m_pTraverseReport->traverseReport(_xReportDefinition); - m_pTraverseReport->traverseReportFunctions(_xReportDefinition->getFunctions()); - if ( _xReportDefinition->getPageHeaderOn() ) - m_pTraverseReport->traversePageHeader(_xReportDefinition->getPageHeader()); - if ( _xReportDefinition->getReportHeaderOn() ) - m_pTraverseReport->traverseReportHeader(_xReportDefinition->getReportHeader()); - - uno::Reference< report::XGroups > xGroups = _xReportDefinition->getGroups(); - m_pTraverseReport->traverseGroups(xGroups); - const sal_Int32 nCount = xGroups->getCount(); - sal_Int32 i = 0; - for (;i<nCount ; ++i) - { - uno::Reference< report::XGroup > xGroup(xGroups->getByIndex(i),uno::UNO_QUERY); - m_pTraverseReport->traverseGroup(xGroup); - m_pTraverseReport->traverseGroupFunctions(xGroup->getFunctions()); - if ( xGroup->getHeaderOn() ) - m_pTraverseReport->traverseGroupHeader(xGroup->getHeader()); - } - - m_pTraverseReport->traverseDetail(_xReportDefinition->getDetail()); - - for (i = 0;i<nCount ; ++i) - { - uno::Reference< report::XGroup > xGroup(xGroups->getByIndex(i),uno::UNO_QUERY); - if ( xGroup->getFooterOn() ) - m_pTraverseReport->traverseGroupFooter(xGroup->getFooter()); - } - - if ( _xReportDefinition->getPageFooterOn() ) - m_pTraverseReport->traversePageFooter(_xReportDefinition->getPageFooter()); - if ( _xReportDefinition->getReportFooterOn() ) - m_pTraverseReport->traverseReportFooter(_xReportDefinition->getReportFooter()); -} -// ----------------------------------------------------------------------------- -void OReportVisitor::start(const uno::Reference< report::XGroup>& _xGroup) -{ - OSL_ENSURE(_xGroup.is(),"Group is NULL!"); - if ( !_xGroup.is() ) - return; - m_pTraverseReport->traverseGroup(_xGroup); - m_pTraverseReport->traverseGroupFunctions(_xGroup->getFunctions()); - if ( _xGroup->getHeaderOn() ) - m_pTraverseReport->traverseGroupHeader(_xGroup->getHeader()); - if ( _xGroup->getFooterOn() ) - m_pTraverseReport->traverseGroupFooter(_xGroup->getFooter()); -} -// ============================================================================= -} // namespace reportdesign -// ============================================================================= - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/core/api/Section.cxx b/reportdesign/source/core/api/Section.cxx deleted file mode 100644 index 75c6af2ae..000000000 --- a/reportdesign/source/core/api/Section.cxx +++ /dev/null @@ -1,699 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_reportdesign.hxx" -#include "Section.hxx" -#include <comphelper/enumhelper.hxx> -#include <connectivity/dbtools.hxx> -#include <com/sun/star/report/XReportComponent.hpp> -#include <com/sun/star/report/ForceNewPage.hpp> -#include <com/sun/star/beans/PropertyAttribute.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include "corestrings.hrc" -#include "core_resource.hxx" -#include "core_resource.hrc" -#include <tools/debug.hxx> -#include "Tools.hxx" -#include "RptModel.hxx" -#include "RptPage.hxx" -#include "ReportDefinition.hxx" -#include "Shape.hxx" -#include <svx/unoshape.hxx> -#include "RptObject.hxx" -#include "ReportDrawPage.hxx" -#include <comphelper/property.hxx> -// ============================================================================= -namespace reportdesign -{ -// ============================================================================= - using namespace com::sun::star; - using namespace comphelper; -DBG_NAME( rpt_OSection ) -// ----------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString> lcl_getGroupAbsent() -{ - ::rtl::OUString pProps[] = { - PROPERTY_CANGROW - ,PROPERTY_CANSHRINK - }; - - return uno::Sequence< ::rtl::OUString >(pProps,SAL_N_ELEMENTS(pProps)); -} - -// ----------------------------------------------------------------------------- -OSection::OSection( const uno::Reference< report::XGroup >& _xParent - ,const uno::Reference< uno::XComponentContext >& context - ,bool /*_bPageSection*/) -:SectionBase(m_aMutex) -,SectionPropertySet(context,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getGroupAbsent()) -,m_aContainerListeners(m_aMutex) -,m_xContext(context) -,m_xGroup(_xParent) -,m_nHeight(3000) -,m_nBackgroundColor(COL_TRANSPARENT) -,m_nForceNewPage(report::ForceNewPage::NONE) -,m_nNewRowOrCol(report::ForceNewPage::NONE) -,m_bKeepTogether(sal_False) -,m_bCanGrow(sal_False) -,m_bCanShrink(sal_False) -,m_bRepeatSection(sal_False) -,m_bVisible(sal_True) -,m_bBacktransparent(sal_True) -,m_bInRemoveNotify(false) -,m_bInInsertNotify(false) -{ - DBG_CTOR( rpt_OSection,NULL); - init(); -} -// ----------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString> lcl_getAbsent(bool _bPageSection) -{ - if ( _bPageSection ) - { - ::rtl::OUString pProps[] = { - PROPERTY_FORCENEWPAGE - ,PROPERTY_NEWROWORCOL - ,PROPERTY_KEEPTOGETHER - ,PROPERTY_CANGROW - ,PROPERTY_CANSHRINK - ,PROPERTY_REPEATSECTION - }; - return uno::Sequence< ::rtl::OUString >(pProps,SAL_N_ELEMENTS(pProps)); - } - - ::rtl::OUString pProps[] = { - PROPERTY_CANGROW - ,PROPERTY_CANSHRINK - ,PROPERTY_REPEATSECTION - }; - - return uno::Sequence< ::rtl::OUString >(pProps,SAL_N_ELEMENTS(pProps)); -} -// ----------------------------------------------------------------------------- -OSection::OSection(const uno::Reference< report::XReportDefinition >& _xParent - ,const uno::Reference< uno::XComponentContext >& context - ,bool _bPageSection) -:SectionBase(m_aMutex) -,SectionPropertySet(context,SectionPropertySet::IMPLEMENTS_PROPERTY_SET,lcl_getAbsent(_bPageSection)) -,m_aContainerListeners(m_aMutex) -,m_xContext(context) -,m_xReportDefinition(_xParent) -,m_nHeight(3000) -,m_nBackgroundColor(COL_TRANSPARENT) -,m_nForceNewPage(report::ForceNewPage::NONE) -,m_nNewRowOrCol(report::ForceNewPage::NONE) -,m_bKeepTogether(sal_False) -,m_bCanGrow(sal_False) -,m_bCanShrink(sal_False) -,m_bRepeatSection(sal_False) -,m_bVisible(sal_True) -,m_bBacktransparent(sal_True) -,m_bInRemoveNotify(false) -,m_bInInsertNotify(false) -{ - DBG_CTOR( rpt_OSection,NULL); - init(); -} -//-------------------------------------------------------------------------- -// TODO: VirtualFunctionFinder: This is virtual function! -// -OSection::~OSection() -{ - DBG_DTOR( rpt_OSection,NULL); - if ( m_xProxy.is() ) - m_xProxy->setDelegator( NULL ); -} -//-------------------------------------------------------------------------- -//IMPLEMENT_FORWARD_XINTERFACE2(OSection,SectionBase,SectionPropertySet) -IMPLEMENT_FORWARD_REFCOUNT( OSection, SectionBase ) -// -------------------------------------------------------------------------------- -uno::Any SAL_CALL OSection::queryInterface( const uno::Type& _rType ) throw (uno::RuntimeException) -{ - uno::Any aReturn = SectionBase::queryInterface(_rType); - if ( !aReturn.hasValue() ) - aReturn = SectionPropertySet::queryInterface(_rType); - - if ( !aReturn.hasValue() && OReportControlModel::isInterfaceForbidden(_rType) ) - return aReturn; - - return aReturn.hasValue() ? aReturn : (m_xProxy.is() ? m_xProxy->queryAggregation(_rType) : aReturn); -} - -// ----------------------------------------------------------------------------- -void SAL_CALL OSection::dispose() throw(uno::RuntimeException) -{ - OSL_ENSURE(!rBHelper.bDisposed,"Already disposed!"); - SectionPropertySet::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 ); - m_xContext.clear(); -} -//-------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OSection::getImplementationName( ) throw(uno::RuntimeException) -{ - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.Section")); -} -//------------------------------------------------------------------------------ -uno::Sequence< ::rtl::OUString> OSection::getSupportedServiceNames_Static(void) throw( uno::RuntimeException ) -{ - uno::Sequence< ::rtl::OUString> aSupported(1); - aSupported.getArray()[0] = SERVICE_SECTION; - return aSupported; -} -//------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString> SAL_CALL OSection::getSupportedServiceNames() throw(uno::RuntimeException) -{ - return getSupportedServiceNames_Static(); -} -// ----------------------------------------------------------------------------- -sal_Bool SAL_CALL OSection::supportsService( const ::rtl::OUString& _rServiceName ) throw(uno::RuntimeException) -{ - return ::comphelper::existsValue(_rServiceName,getSupportedServiceNames_Static()); -} -// ----------------------------------------------------------------------------- -void OSection::init() -{ - uno::Reference< report::XReportDefinition> xReport = getReportDefinition(); - ::boost::shared_ptr<rptui::OReportModel> pModel = OReportDefinition::getSdrModel(xReport); - OSL_ENSURE(pModel,"No odel set at the report definition!"); - if ( pModel ) - { -// DO NOT TOUCH THIS BLOCKS, WE HAVE A COMPILER PROBLEM UNDER SOLARIS X86 - osl_incrementInterlockedCount( &m_refCount ); - { - uno::Reference<report::XSection> xTemp = this; - { - { - m_xProxy.set(pModel->createNewPage(xTemp)->getUnoPage(),uno::UNO_QUERY); - } - { - ::comphelper::query_aggregation(m_xProxy,m_xDrawPage); - } - - // set ourself as delegator - { - if ( m_xProxy.is() ) - { - m_xProxy->setDelegator( xTemp ); - } - } - } - xTemp.clear(); - } -// DO NOT TOUCH THIS BLOCKS, WE HAVE A COMPILER PROBLEM UNDER SOLARIS X86 - osl_decrementInterlockedCount( &m_refCount ); - } -} -// ----------------------------------------------------------------------------- -// XSection -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OSection::getVisible() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_bVisible; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OSection::setVisible( ::sal_Bool _visible ) throw (uno::RuntimeException) -{ - set(PROPERTY_VISIBLE,_visible,m_bVisible); -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OSection::getName() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_sName; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OSection::setName( const ::rtl::OUString& _name ) throw (uno::RuntimeException) -{ - set(PROPERTY_NAME,_name,m_sName); -} -// ----------------------------------------------------------------------------- -::sal_uInt32 SAL_CALL OSection::getHeight() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_nHeight; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OSection::setHeight( ::sal_uInt32 _height ) throw (uno::RuntimeException) -{ - set(PROPERTY_HEIGHT,_height,m_nHeight); -} -// ----------------------------------------------------------------------------- -::sal_Int32 SAL_CALL OSection::getBackColor() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_bBacktransparent ? COL_TRANSPARENT : m_nBackgroundColor; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OSection::setBackColor( ::sal_Int32 _backgroundcolor ) throw (uno::RuntimeException) -{ - sal_Bool bTransparent = _backgroundcolor == static_cast<sal_Int32>(COL_TRANSPARENT); - setBackTransparent(bTransparent); - if ( !bTransparent ) - set(PROPERTY_BACKCOLOR,_backgroundcolor,m_nBackgroundColor); -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OSection::getBackTransparent() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_bBacktransparent; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OSection::setBackTransparent( ::sal_Bool _backtransparent ) throw (uno::RuntimeException) -{ - set(PROPERTY_BACKTRANSPARENT,_backtransparent,m_bBacktransparent); - if ( _backtransparent ) - set(PROPERTY_BACKCOLOR,static_cast<sal_Int32>(COL_TRANSPARENT),m_nBackgroundColor); -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OSection::getConditionalPrintExpression() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_sConditionalPrintExpression; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OSection::setConditionalPrintExpression( const ::rtl::OUString& _conditionalprintexpression ) throw (uno::RuntimeException) -{ - 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() throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - - checkNotPageHeaderFooter(); - return m_nForceNewPage; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OSection::setForceNewPage( ::sal_Int16 _forcenewpage ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException) -{ - if ( _forcenewpage < report::ForceNewPage::NONE || _forcenewpage > report::ForceNewPage::BEFORE_AFTER_SECTION ) - throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com::sun::star::report::ForceNewPage")) - ,*this - ,1 - ,m_xContext); - checkNotPageHeaderFooter(); - set(PROPERTY_FORCENEWPAGE,_forcenewpage,m_nForceNewPage); -} -// ----------------------------------------------------------------------------- -::sal_Int16 SAL_CALL OSection::getNewRowOrCol() throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - checkNotPageHeaderFooter(); - return m_nNewRowOrCol; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OSection::setNewRowOrCol( ::sal_Int16 _newroworcol ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException) -{ - if ( _newroworcol < report::ForceNewPage::NONE || _newroworcol > report::ForceNewPage::BEFORE_AFTER_SECTION ) - throwIllegallArgumentException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com::sun::star::report::ForceNewPage")) - ,*this - ,1 - ,m_xContext); - checkNotPageHeaderFooter(); - - set(PROPERTY_NEWROWORCOL,_newroworcol,m_nNewRowOrCol); -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OSection::getKeepTogether() throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - checkNotPageHeaderFooter(); - return m_bKeepTogether; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OSection::setKeepTogether( ::sal_Bool _keeptogether ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException) -{ - { - ::osl::MutexGuard aGuard(m_aMutex); - checkNotPageHeaderFooter(); - } - - set(PROPERTY_KEEPTOGETHER,_keeptogether,m_bKeepTogether); -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OSection::getCanGrow() throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment -} -// ----------------------------------------------------------------------------- -void SAL_CALL OSection::setCanGrow( ::sal_Bool /*_cangrow*/ ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OSection::getCanShrink() throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment -} -// ----------------------------------------------------------------------------- -void SAL_CALL OSection::setCanShrink( ::sal_Bool /*_canshrink*/ ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); ///TODO: unsupported at the moment -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OSection::getRepeatSection() throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - ::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 ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException) -{ - { - ::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() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_xGroup; -} -// ----------------------------------------------------------------------------- -uno::Reference< report::XReportDefinition > SAL_CALL OSection::getReportDefinition() throw (uno::RuntimeException) -{ - ::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; -} -// ----------------------------------------------------------------------------- -const ::std::vector< ::rtl::OUString >& lcl_getControlModelMap() -{ - static ::std::vector< ::rtl::OUString > s_sControlModels; - if ( s_sControlModels.empty() ) - { - s_sControlModels.push_back( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FixedText")) ); - s_sControlModels.push_back( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FixedLine")) ); - s_sControlModels.push_back( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ImageControl")) ); - s_sControlModels.push_back( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FormattedField")) ); - s_sControlModels.push_back( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Shape")) ); - } - return s_sControlModels; - -} -// ----------------------------------------------------------------------------- -uno::Reference< report::XReportComponent > SAL_CALL OSection::createReportComponent( const ::rtl::OUString& _sReportComponentSpecifier ) throw (uno::Exception, lang::IllegalArgumentException,uno::RuntimeException) -{ - ::osl::ResettableMutexGuard aGuard(m_aMutex); - const ::std::vector< ::rtl::OUString >& aRet = lcl_getControlModelMap(); - ::std::vector< ::rtl::OUString >::const_iterator aFind = ::std::find(aRet.begin(),aRet.end(),_sReportComponentSpecifier); - if ( aFind == aRet.end() ) - throw lang::IllegalArgumentException(); - - uno::Reference< report::XReportComponent > xRet; - uno::Reference< lang::XMultiServiceFactory> xFac(getReportDefinition(),uno::UNO_QUERY_THROW); - switch( aFind - aRet.begin() ) - { - case 0: - xRet.set(xFac->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FixedText"))),uno::UNO_QUERY); - break; - case 1: - xRet.set(xFac->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel"))),uno::UNO_QUERY); - break; - case 2: - xRet.set(xFac->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.DatabaseImageControl"))),uno::UNO_QUERY); - break; - case 3: - xRet.set(xFac->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FormattedField"))),uno::UNO_QUERY); - break; - case 4: - xRet.set(xFac->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ControlShape"))),uno::UNO_QUERY); - break; - default: - break; - } - return xRet; -} -// ----------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > SAL_CALL OSection::getAvailableReportComponentNames( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - - const ::std::vector< ::rtl::OUString >& aRet = lcl_getControlModelMap(); - const ::rtl::OUString* pRet = aRet.empty() ? 0 : &aRet[0]; - return uno::Sequence< ::rtl::OUString >(pRet, aRet.size()); -} -// ----------------------------------------------------------------------------- -// XChild -uno::Reference< uno::XInterface > SAL_CALL OSection::getParent( ) throw (uno::RuntimeException) -{ - 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, uno::RuntimeException) -{ - throw lang::NoSupportException(); -} -// ----------------------------------------------------------------------------- -// XContainer -void SAL_CALL OSection::addContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException) -{ - m_aContainerListeners.addInterface(xListener); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OSection::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException) -{ - m_aContainerListeners.removeInterface(xListener); -} -// ----------------------------------------------------------------------------- -// XElementAccess -uno::Type SAL_CALL OSection::getElementType( ) throw (uno::RuntimeException) -{ - return ::getCppuType(static_cast< uno::Reference<report::XReportComponent>*>(NULL)); -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OSection::hasElements( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_xDrawPage.is() ? m_xDrawPage->hasElements() : sal_False; -} -// ----------------------------------------------------------------------------- -// XIndexAccess -::sal_Int32 SAL_CALL OSection::getCount( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_xDrawPage.is() ? m_xDrawPage->getCount() : 0; -} -// ----------------------------------------------------------------------------- -uno::Any SAL_CALL OSection::getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_xDrawPage->getByIndex(Index); -} -// ----------------------------------------------------------------------------- -// XEnumerationAccess -uno::Reference< container::XEnumeration > SAL_CALL OSection::createEnumeration( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return new ::comphelper::OEnumerationByIndex(static_cast<XIndexAccess*>(this)); -} -// ----------------------------------------------------------------------------- -uno::Reference< beans::XPropertySetInfo > SAL_CALL OSection::getPropertySetInfo( ) throw(uno::RuntimeException) -{ - return SectionPropertySet::getPropertySetInfo(); -} -// ------------------------------------------------------------------------- -void SAL_CALL OSection::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) -{ - SectionPropertySet::setPropertyValue( aPropertyName, aValue ); -} -// ----------------------------------------------------------------------------- -uno::Any SAL_CALL OSection::getPropertyValue( const ::rtl::OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - return SectionPropertySet::getPropertyValue( PropertyName); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OSection::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - SectionPropertySet::addPropertyChangeListener( aPropertyName, xListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OSection::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - SectionPropertySet::removePropertyChangeListener( aPropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OSection::addVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - SectionPropertySet::addVetoableChangeListener( PropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OSection::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - SectionPropertySet::removeVetoableChangeListener( PropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void OSection::lcl_copySection(const uno::Reference< report::XSection>& _xSource,uno::Reference< report::XSection>& _xDest) -{ - if ( _xSource.is() ) - { - ::comphelper::copyProperties(_xSource.get(),_xDest.get()); - sal_Int32 nCount = _xSource->getCount(); - for(sal_Int32 i = 0;i != nCount;++i) - { - uno::Reference<util::XCloneable> xClone(_xSource->getByIndex(i),uno::UNO_QUERY); - OSL_ENSURE(xClone.is(),"No XCloneable interface found!"); - if ( xClone.is() ) - { - uno::Reference< drawing::XShape> xShape(xClone->createClone(),uno::UNO_QUERY); - _xDest->add(xShape); - } - } - } -} -// ----------------------------------------------------------------------------- -void SAL_CALL OSection::add( const uno::Reference< drawing::XShape >& xShape ) throw (uno::RuntimeException) -{ - { - ::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 ) throw (uno::RuntimeException) -{ - { - ::osl::MutexGuard aGuard(m_aMutex); - m_bInRemoveNotify = true; - OSL_ENSURE(m_xDrawPage.is(),"No DrawPage!"); - m_xDrawPage->remove(xShape); - m_bInRemoveNotify = false; - } - notifyElementRemoved(xShape); -} -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -// com::sun::star::lang::XUnoTunnel -//------------------------------------------------------------------ -sal_Int64 OSection::getSomething( const uno::Sequence< sal_Int8 > & rId ) throw (uno::RuntimeException) -{ - if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) - return reinterpret_cast<sal_Int64>(this); - uno::Reference< lang::XUnoTunnel> xTunnel; - ::comphelper::query_aggregation(m_xProxy,xTunnel); - return xTunnel->getSomething(rId); -} - -// ----------------------------------------------------------------------------- -OSection* OSection::getImplementation( const uno::Reference< uno::XInterface >& _rxComponent ) -{ - OSection* pContent( NULL ); - - uno::Reference< lang::XUnoTunnel > xUnoTunnel( _rxComponent, uno::UNO_QUERY ); - if ( xUnoTunnel.is() ) - pContent = reinterpret_cast< OSection* >( xUnoTunnel->getSomething( getUnoTunnelImplementationId() ) ); - - return pContent; -} -//------------------------------------------------------------------------ -uno::Sequence< sal_Int8 > OSection::getUnoTunnelImplementationId() -{ - static ::cppu::OImplementationId * pId = 0; - if (! pId) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if (! pId) - { - static ::cppu::OImplementationId aId; - pId = &aId; - } - } - return pId->getImplementationId(); -} -// ----------------------------------------------------------------------------- -void OSection::notifyElementAdded(const uno::Reference< drawing::XShape >& xShape ) -{ - if ( !m_bInInsertNotify ) - { - container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::Any(), uno::makeAny(xShape), uno::Any()); - m_aContainerListeners.notifyEach(&container::XContainerListener::elementInserted,aEvent); - } -} -// ----------------------------------------------------------------------------- -void OSection::notifyElementRemoved(const uno::Reference< drawing::XShape >& xShape) -{ - if ( !m_bInRemoveNotify ) - { - // notify our container listeners - container::ContainerEvent aEvent(static_cast<container::XContainer*>(this), uno::Any(), uno::makeAny(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 deleted file mode 100644 index 64bddc657..000000000 --- a/reportdesign/source/core/api/Shape.cxx +++ /dev/null @@ -1,519 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_reportdesign.hxx" -#include "Shape.hxx" - -#include <com/sun/star/beans/NamedValue.hpp> -#include <com/sun/star/beans/PropertyAttribute.hpp> -#include <com/sun/star/beans/XPropertyState.hpp> -#include <com/sun/star/text/ParagraphVertAlign.hpp> -#include <comphelper/property.hxx> -#include <comphelper/sequence.hxx> -#include <tools/debug.hxx> -#include <tools/diagnose_ex.h> -#include <boost/bind.hpp> -#include <svx/unoshape.hxx> - -#include "corestrings.hrc" -#include "core_resource.hrc" -#include "core_resource.hxx" -#include "Tools.hxx" -#include "RptObject.hxx" -#include "FormatCondition.hxx" -#include "ReportHelperImpl.hxx" -// ============================================================================= -namespace reportdesign -{ -// ============================================================================= - using namespace com::sun::star; - using namespace comphelper; -uno::Sequence< ::rtl::OUString > lcl_getShapeOptionals() -{ - ::rtl::OUString pProps[] = { - PROPERTY_DATAFIELD - ,PROPERTY_CONTROLBACKGROUND - ,PROPERTY_CONTROLBACKGROUNDTRANSPARENT - }; - return uno::Sequence< ::rtl::OUString >(pProps,SAL_N_ELEMENTS(pProps)); -} - -DBG_NAME( rpt_OShape ) -// ----------------------------------------------------------------------------- -OShape::OShape(uno::Reference< uno::XComponentContext > const & _xContext) -:ShapeBase(m_aMutex) -,ShapePropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getShapeOptionals()) -,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) -,m_nZOrder(0) -,m_bOpaque(sal_False) -{ - DBG_CTOR( rpt_OShape,NULL); - m_aProps.aComponent.m_sName = RPT_RESSTRING(RID_STR_SHAPE,m_aProps.aComponent.m_xContext->getServiceManager()); -} -// ----------------------------------------------------------------------------- -OShape::OShape(uno::Reference< uno::XComponentContext > const & _xContext - ,const uno::Reference< lang::XMultiServiceFactory>& _xFactory - ,uno::Reference< drawing::XShape >& _xShape - ,const ::rtl::OUString& _sServiceName) -:ShapeBase(m_aMutex) -,ShapePropertySet(_xContext,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getShapeOptionals()) -,m_aProps(m_aMutex,static_cast< container::XContainer*>( this ),_xContext) -,m_nZOrder(0) -,m_bOpaque(sal_False) -,m_sServiceName(_sServiceName) -{ - DBG_CTOR( rpt_OShape,NULL); - m_aProps.aComponent.m_sName = RPT_RESSTRING(RID_STR_SHAPE,m_aProps.aComponent.m_xContext->getServiceManager()); - m_aProps.aComponent.m_xFactory = _xFactory; - osl_incrementInterlockedCount( &m_refCount ); - { - uno::Reference<beans::XPropertySet> xProp(_xShape,uno::UNO_QUERY); - if ( xProp.is() ) - { - xProp->getPropertyValue(PROPERTY_ZORDER) >>= m_nZOrder; - xProp.clear(); - } - m_aProps.aComponent.setShape(_xShape,this,m_refCount); - } - osl_decrementInterlockedCount( &m_refCount ); -} -// ----------------------------------------------------------------------------- -OShape::~OShape() -{ - DBG_DTOR( rpt_OShape,NULL); -} -// ----------------------------------------------------------------------------- -//IMPLEMENT_FORWARD_XINTERFACE2(OShape,ShapeBase,ShapePropertySet) -IMPLEMENT_FORWARD_REFCOUNT( OShape, ShapeBase ) -// -------------------------------------------------------------------------------- -uno::Any SAL_CALL OShape::queryInterface( const uno::Type& _rType ) throw (uno::RuntimeException) -{ - 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() throw(uno::RuntimeException) -{ - ShapePropertySet::dispose(); - cppu::WeakComponentImplHelperBase::dispose(); -} -// ----------------------------------------------------------------------------- -::rtl::OUString OShape::getImplementationName_Static( ) throw(uno::RuntimeException) -{ - return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.report.Shape")); -} - -//-------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OShape::getImplementationName( ) throw(uno::RuntimeException) -{ - return getImplementationName_Static(); -} -//-------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > OShape::getSupportedServiceNames_Static( ) throw(uno::RuntimeException) -{ - uno::Sequence< ::rtl::OUString > aServices(1); - aServices.getArray()[0] = SERVICE_SHAPE; - - return aServices; -} -//------------------------------------------------------------------------------ -uno::Reference< uno::XInterface > OShape::create(uno::Reference< uno::XComponentContext > const & xContext) -{ - return *(new OShape(xContext)); -} - -//-------------------------------------------------------------------------- -uno::Sequence< ::rtl::OUString > SAL_CALL OShape::getSupportedServiceNames( ) throw(uno::RuntimeException) -{ - return getSupportedServiceNames_Static(); -} -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL OShape::supportsService(const ::rtl::OUString& ServiceName) throw( uno::RuntimeException ) -{ - - return m_sServiceName == ServiceName || ::comphelper::existsValue(ServiceName,getSupportedServiceNames_Static()); -} -// ----------------------------------------------------------------------------- -// 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, uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OShape::setControlBackground( ::sal_Int32 /*_backgroundcolor*/ ) throw (uno::RuntimeException,beans::UnknownPropertyException) -{ - throw beans::UnknownPropertyException(); -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OShape::getControlBackgroundTransparent() throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OShape::setControlBackgroundTransparent( ::sal_Bool /*_controlbackgroundtransparent*/ ) throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); -} -// ----------------------------------------------------------------------------- -uno::Reference< beans::XPropertySetInfo > SAL_CALL OShape::getPropertySetInfo( ) throw(uno::RuntimeException) -{ - - //return ShapePropertySet::getPropertySetInfo(); - return cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() ); -} -// ----------------------------------------------------------------------------- -cppu::IPropertyArrayHelper& OShape::getInfoHelper() -{ - if ( !m_pAggHelper.get() ) - { - uno::Sequence<beans::Property> aAggSeq; - if ( m_aProps.aComponent.m_xProperty.is() ) - aAggSeq = m_aProps.aComponent.m_xProperty->getPropertySetInfo()->getProperties(); - m_pAggHelper.reset(new OPropertyArrayAggregationHelper(ShapePropertySet::getPropertySetInfo()->getProperties(),aAggSeq)); - } - return *(m_pAggHelper.get()); -} - -// ----------------------------------------------------------------------------- -void SAL_CALL OShape::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) -{ - getInfoHelper(); - if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY ) - m_aProps.aComponent.m_xProperty->setPropertyValue( aPropertyName,aValue); - // can be in both - if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::DELEGATOR_PROPERTY ) - ShapePropertySet::setPropertyValue( aPropertyName, aValue ); -} -// ----------------------------------------------------------------------------- -uno::Any SAL_CALL OShape::getPropertyValue( const ::rtl::OUString& PropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - getInfoHelper(); - if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY ) - return m_aProps.aComponent.m_xProperty->getPropertyValue( PropertyName); - // can be in both - if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::DELEGATOR_PROPERTY ) - return ShapePropertySet::getPropertyValue( PropertyName); - return uno::Any(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OShape::addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - getInfoHelper(); - if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY || !aPropertyName.getLength() ) - m_aProps.aComponent.m_xProperty->addPropertyChangeListener( aPropertyName, xListener); - // can be in both - if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::DELEGATOR_PROPERTY || !aPropertyName.getLength() ) - ShapePropertySet::addPropertyChangeListener( aPropertyName, xListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OShape::removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - getInfoHelper(); - if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY || !aPropertyName.getLength() ) - m_aProps.aComponent.m_xProperty->removePropertyChangeListener( aPropertyName, aListener ); - // can be in both - if( m_pAggHelper->classifyProperty(aPropertyName) == OPropertyArrayAggregationHelper::DELEGATOR_PROPERTY || !aPropertyName.getLength() ) - ShapePropertySet::removePropertyChangeListener( aPropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OShape::addVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - getInfoHelper(); - if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY || !PropertyName.getLength() ) - m_aProps.aComponent.m_xProperty->addVetoableChangeListener( PropertyName, aListener ); - // can be in both - if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::DELEGATOR_PROPERTY || !PropertyName.getLength() ) - ShapePropertySet::addVetoableChangeListener( PropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OShape::removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - getInfoHelper(); - if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::AGGREGATE_PROPERTY || !PropertyName.getLength() ) - m_aProps.aComponent.m_xProperty->removeVetoableChangeListener( PropertyName, aListener ); - // can be in both - if( m_pAggHelper->classifyProperty(PropertyName) == OPropertyArrayAggregationHelper::DELEGATOR_PROPERTY || !PropertyName.getLength() ) - ShapePropertySet::removeVetoableChangeListener( PropertyName, aListener ); -} -// ----------------------------------------------------------------------------- -// XReportControlModel -::rtl::OUString SAL_CALL OShape::getDataField() throw ( beans::UnknownPropertyException, uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OShape::setDataField( const ::rtl::OUString& /*_datafield*/ ) throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException) -{ - throw beans::UnknownPropertyException(); -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OShape::getPrintWhenGroupChange() throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aProps.bPrintWhenGroupChange; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OShape::setPrintWhenGroupChange( ::sal_Bool _printwhengroupchange ) throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - set(PROPERTY_PRINTWHENGROUPCHANGE,_printwhengroupchange,m_aProps.bPrintWhenGroupChange); -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OShape::getConditionalPrintExpression() throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_aProps.aConditionalPrintExpression; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OShape::setConditionalPrintExpression( const ::rtl::OUString& _conditionalprintexpression ) throw (beans::UnknownPropertyException, uno::RuntimeException) -{ - set(PROPERTY_CONDITIONALPRINTEXPRESSION,_conditionalprintexpression,m_aProps.aConditionalPrintExpression); -} -// ----------------------------------------------------------------------------- - -// XCloneable -uno::Reference< util::XCloneable > SAL_CALL OShape::createClone( ) throw (uno::RuntimeException) -{ - uno::Reference< report::XReportComponent> xSource = this; - uno::Reference< report::XReportComponent> xSet; - try - { - SvxShape* pShape = SvxShape::getImplementation( xSource ); - if ( pShape ) - { - SdrObject* pObject = pShape->GetSdrObject(); - if ( pObject ) - { - SdrObject* pClone = pObject->Clone(); - if ( pClone ) - { - xSet.set(pClone->getUnoShape(),uno::UNO_QUERY_THROW ); - } - } - } - } - catch(const uno::Exception&) - { - DBG_UNHANDLED_EXCEPTION(); - } - return xSet.get(); -} -// ----------------------------------------------------------------------------- -// XChild -uno::Reference< uno::XInterface > SAL_CALL OShape::getParent( ) throw (uno::RuntimeException) -{ - return OShapeHelper::getParent(this); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OShape::setParent( const uno::Reference< uno::XInterface >& Parent ) throw (lang::NoSupportException, uno::RuntimeException) -{ - ::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( ) throw (uno::Exception, uno::RuntimeException) -{ - return new OFormatCondition(m_aProps.aComponent.m_xContext); -} -// ----------------------------------------------------------------------------- -// XContainer -void SAL_CALL OShape::addContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException) -{ - m_aProps.addContainerListener(xListener); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OShape::removeContainerListener( const uno::Reference< container::XContainerListener >& xListener ) throw (uno::RuntimeException) -{ - m_aProps.removeContainerListener(xListener); -} -// ----------------------------------------------------------------------------- -// XElementAccess -uno::Type SAL_CALL OShape::getElementType( ) throw (uno::RuntimeException) -{ - return ::getCppuType(static_cast< uno::Reference<report::XFormatCondition>*>(NULL)); -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OShape::hasElements( ) throw (uno::RuntimeException) -{ - return m_aProps.hasElements(); -} -// ----------------------------------------------------------------------------- -// XIndexContainer -void SAL_CALL OShape::insertByIndex( ::sal_Int32 Index, const uno::Any& Element ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - m_aProps.insertByIndex(Index,Element); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OShape::removeByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - m_aProps.removeByIndex(Index); -} -// ----------------------------------------------------------------------------- -// XIndexReplace -void SAL_CALL OShape::replaceByIndex( ::sal_Int32 Index, const uno::Any& Element ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - m_aProps.replaceByIndex(Index,Element); -} -// ----------------------------------------------------------------------------- -// XIndexAccess -::sal_Int32 SAL_CALL OShape::getCount( ) throw (uno::RuntimeException) -{ - return m_aProps.getCount(); -} -// ----------------------------------------------------------------------------- -uno::Any SAL_CALL OShape::getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -{ - return m_aProps.getByIndex( Index ); -} -// ----------------------------------------------------------------------------- -// XShape -awt::Point SAL_CALL OShape::getPosition( ) throw (uno::RuntimeException) -{ - return OShapeHelper::getPosition(this); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OShape::setPosition( const awt::Point& aPosition ) throw (uno::RuntimeException) -{ - OShapeHelper::setPosition(aPosition,this); -} -// ----------------------------------------------------------------------------- -awt::Size SAL_CALL OShape::getSize( ) throw (uno::RuntimeException) -{ - return OShapeHelper::getSize(this); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OShape::setSize( const awt::Size& aSize ) throw (beans::PropertyVetoException, uno::RuntimeException) -{ - OShapeHelper::setSize(aSize,this); -} -// ----------------------------------------------------------------------------- - -// XShapeDescriptor -::rtl::OUString SAL_CALL OShape::getShapeType( ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - if ( m_aProps.aComponent.m_xShape.is() ) - return m_aProps.aComponent.m_xShape->getShapeType(); - return ::rtl::OUString(); -} -// ----------------------------------------------------------------------------- -::sal_Int32 SAL_CALL OShape::getZOrder() throw (uno::RuntimeException) -{ - ::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 ) throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - m_aProps.aComponent.m_xProperty->setPropertyValue(PROPERTY_ZORDER,uno::makeAny(_zorder)); - set(PROPERTY_ZORDER,_zorder,m_nZOrder); -} -// ----------------------------------------------------------------------------- -::sal_Bool SAL_CALL OShape::getOpaque() throw (::com::sun::star::uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_bOpaque; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OShape::setOpaque( ::sal_Bool _opaque ) throw (::com::sun::star::uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - set(PROPERTY_OPAQUE,_opaque,m_bOpaque); -} -// ----------------------------------------------------------------------------- -drawing::HomogenMatrix3 SAL_CALL OShape::getTransformation() throw (uno::RuntimeException) -{ - ::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 ) throw (uno::RuntimeException) -{ - m_aProps.aComponent.m_xProperty->setPropertyValue(PROPERTY_TRANSFORMATION,uno::makeAny(_transformation)); - set(PROPERTY_TRANSFORMATION,_transformation,m_Transformation); -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OShape::getCustomShapeEngine() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - m_aProps.aComponent.m_xProperty->getPropertyValue(PROPERTY_CUSTOMSHAPEENGINE) >>= m_CustomShapeEngine; - - return m_CustomShapeEngine; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OShape::setCustomShapeEngine( const ::rtl::OUString& _customshapeengine ) throw (uno::RuntimeException) -{ - m_aProps.aComponent.m_xProperty->setPropertyValue(PROPERTY_CUSTOMSHAPEENGINE,uno::makeAny(_customshapeengine)); - set(PROPERTY_CUSTOMSHAPEENGINE,_customshapeengine,m_CustomShapeEngine); -} -// ----------------------------------------------------------------------------- -::rtl::OUString SAL_CALL OShape::getCustomShapeData() throw (uno::RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - m_aProps.aComponent.m_xProperty->getPropertyValue(PROPERTY_CUSTOMSHAPEDATA) >>= m_CustomShapeData; - return m_CustomShapeData; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OShape::setCustomShapeData( const ::rtl::OUString& _customshapedata ) throw (uno::RuntimeException) -{ - m_aProps.aComponent.m_xProperty->setPropertyValue(PROPERTY_CUSTOMSHAPEDATA,uno::makeAny(_customshapedata)); - set(PROPERTY_CUSTOMSHAPEDATA,_customshapedata,m_CustomShapeData); -} -// ----------------------------------------------------------------------------- -uno::Sequence< beans::PropertyValue > SAL_CALL OShape::getCustomShapeGeometry() throw (uno::RuntimeException) -{ - ::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 ) throw (uno::RuntimeException) -{ - m_aProps.aComponent.m_xProperty->setPropertyValue(PROPERTY_CUSTOMSHAPEGEOMETRY,uno::makeAny(_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 deleted file mode 100644 index 6a405ae83..000000000 --- a/reportdesign/source/core/api/Tools.cxx +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_reportdesign.hxx" -#include "Tools.hxx" -#include "core_resource.hrc" -#include "core_resource.hxx" -#include <comphelper/property.hxx> - -// ============================================================================= -namespace reportdesign -{ -// ============================================================================= -using namespace com::sun::star; - -uno::Reference< report::XSection> lcl_getSection(const uno::Reference< uno::XInterface>& _xReportComponent) -{ - uno::Reference< container::XChild> xChild(_xReportComponent,uno::UNO_QUERY); - uno::Reference< report::XSection> xRet(_xReportComponent,uno::UNO_QUERY); - while( !xRet.is() && xChild.is() ) - { - uno::Reference< uno::XInterface> xTemp = xChild->getParent(); - xChild.set(xTemp,uno::UNO_QUERY); - xRet.set(xTemp,uno::UNO_QUERY); - } - return xRet; -} -// ----------------------------------------------------------------------------- -void throwIllegallArgumentException( const ::rtl::OUString& _sTypeName - ,const uno::Reference< uno::XInterface >& ExceptionContext_ - ,const ::sal_Int16& ArgumentPosition_ - ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context_ - ) -{ - ::rtl::OUString sErrorMessage(RPT_RESSTRING(RID_STR_ERROR_WRONG_ARGUMENT,Context_->getServiceManager())); - 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 ::rtl::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.get(),xClone.get()); - return xClone.get(); -} -// ----------------------------------------------------------------------------- - -// ============================================================================= -} // 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 deleted file mode 100644 index 3274e2861..000000000 --- a/reportdesign/source/core/api/services.cxx +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "precompiled_reportdesign.hxx" -#include "sal/types.h" -#include <cppuhelper/factory.hxx> -#include <osl/diagnose.h> -#include <cppuhelper/implementationentry.hxx> -#include "ReportDefinition.hxx" -#include "FormattedField.hxx" -#include "FixedText.hxx" -#include "ImageControl.hxx" -#include "FormatCondition.hxx" -#include "ReportEngineJFree.hxx" -#include "Function.hxx" -#include "Shape.hxx" -#include "FixedLine.hxx" - -/********************************************************************************************/ - -using namespace ::reportdesign; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; - -//*************************************************************************************** -// -// registry functions -namespace -{ - -cppu::ImplementationEntry entries[] = { - { &OReportDefinition::create, &OReportDefinition::getImplementationName_Static, &OReportDefinition::getSupportedServiceNames_Static, - &cppu::createSingleComponentFactory, 0, 0 }, - { &OFormattedField::create, &OFormattedField::getImplementationName_Static, &OFormattedField::getSupportedServiceNames_Static, - &cppu::createSingleComponentFactory, 0, 0 }, - { &OFixedText::create, &OFixedText::getImplementationName_Static, &OFixedText::getSupportedServiceNames_Static, - &cppu::createSingleComponentFactory, 0, 0 }, - { &OImageControl::create, &OImageControl::getImplementationName_Static, &OImageControl::getSupportedServiceNames_Static, - &cppu::createSingleComponentFactory, 0, 0 }, - { &OFormatCondition::create, &OFormatCondition::getImplementationName_Static, &OFormatCondition::getSupportedServiceNames_Static, - &cppu::createSingleComponentFactory, 0, 0 }, - { &OReportEngineJFree::create, &OReportEngineJFree::getImplementationName_Static, &OReportEngineJFree::getSupportedServiceNames_Static, - &cppu::createSingleComponentFactory, 0, 0 }, - { &OFunction::create, &OFunction::getImplementationName_Static, &OFunction::getSupportedServiceNames_Static, - &cppu::createSingleComponentFactory, 0, 0 }, - { &OShape::create, &OShape::getImplementationName_Static, &OShape::getSupportedServiceNames_Static, - &cppu::createSingleComponentFactory, 0, 0 }, - { &OFixedLine::create, &OFixedLine::getImplementationName_Static, &OFixedLine::getSupportedServiceNames_Static, - &cppu::createSingleComponentFactory, 0, 0 }, - { 0, 0, 0, 0, 0, 0 } -}; -} - -extern "C" -{ -SAL_DLLPUBLIC_EXPORT void * SAL_CALL 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: */ |