summaryrefslogtreecommitdiff
path: root/reportdesign/source/core/sdr
diff options
context:
space:
mode:
Diffstat (limited to 'reportdesign/source/core/sdr')
-rw-r--r--reportdesign/source/core/sdr/ModuleHelper.cxx141
-rw-r--r--reportdesign/source/core/sdr/PropertyForward.cxx205
-rw-r--r--reportdesign/source/core/sdr/ReportDrawPage.cxx156
-rw-r--r--reportdesign/source/core/sdr/ReportUndoFactory.cxx181
-rw-r--r--reportdesign/source/core/sdr/RptModel.cxx233
-rw-r--r--reportdesign/source/core/sdr/RptObject.cxx1264
-rw-r--r--reportdesign/source/core/sdr/RptObjectListener.cxx95
-rw-r--r--reportdesign/source/core/sdr/RptPage.cxx251
-rw-r--r--reportdesign/source/core/sdr/UndoActions.cxx449
-rw-r--r--reportdesign/source/core/sdr/UndoEnv.cxx629
-rw-r--r--reportdesign/source/core/sdr/formatnormalizer.cxx279
-rw-r--r--reportdesign/source/core/sdr/formatnormalizer.hxx94
-rw-r--r--reportdesign/source/core/sdr/makefile.mk52
13 files changed, 4029 insertions, 0 deletions
diff --git a/reportdesign/source/core/sdr/ModuleHelper.cxx b/reportdesign/source/core/sdr/ModuleHelper.cxx
new file mode 100644
index 000000000000..6337a28fcc46
--- /dev/null
+++ b/reportdesign/source/core/sdr/ModuleHelper.cxx
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * 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 "ModuleHelper.hxx"
+#include <comphelper/configurationhelper.hxx>
+#include <comphelper/processfactory.hxx>
+#include <osl/thread.h>
+#include <com/sun/star/util/XMacroExpander.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <rtl/uri.hxx>
+#include <tools/debug.hxx>
+#ifndef _SOLAR_HRC
+#include <svl/solar.hrc>
+#endif
+
+#define EXPAND_PROTOCOL "vnd.sun.star.expand:"
+#define ENTER_MOD_METHOD() \
+ ::osl::MutexGuard aGuard(s_aMutex); \
+ ensureImpl()
+
+//.........................................................................
+namespace rptui
+{
+//.........................................................................
+ using namespace ::com::sun::star;
+//=========================================================================
+//= OModuleImpl
+//=========================================================================
+/** implementation for <type>OModule</type>. not threadsafe, has to be guarded by it's owner
+*/
+class OModuleImpl
+{
+ ResMgr* m_pRessources;
+
+public:
+ /// ctor
+ OModuleImpl();
+ ~OModuleImpl();
+
+ /// get the manager for the ressources of the module
+ ResMgr* getResManager();
+};
+
+DBG_NAME( rpt_OModuleImpl )
+//-------------------------------------------------------------------------
+OModuleImpl::OModuleImpl()
+ :m_pRessources(NULL)
+{
+ DBG_CTOR( rpt_OModuleImpl,NULL);
+
+}
+
+//-------------------------------------------------------------------------
+OModuleImpl::~OModuleImpl()
+{
+ if (m_pRessources)
+ delete m_pRessources;
+
+ DBG_DTOR( rpt_OModuleImpl,NULL);
+}
+
+//-------------------------------------------------------------------------
+ResMgr* OModuleImpl::getResManager()
+{
+ // note that this method is not threadsafe, which counts for the whole class !
+
+ if (!m_pRessources)
+ {
+ // create a manager with a fixed prefix
+ rtl::OString sName = rtl::OString( "rptui" );
+ m_pRessources = ResMgr::CreateResMgr(sName);
+ }
+ return m_pRessources;
+}
+
+//=========================================================================
+//= OModule
+//=========================================================================
+::osl::Mutex OModule::s_aMutex;
+sal_Int32 OModule::s_nClients = 0;
+OModuleImpl* OModule::s_pImpl = NULL;
+//-------------------------------------------------------------------------
+ResMgr* OModule::getResManager()
+{
+ ENTER_MOD_METHOD();
+ return s_pImpl->getResManager();
+}
+
+//-------------------------------------------------------------------------
+void OModule::registerClient()
+{
+ ::osl::MutexGuard aGuard(s_aMutex);
+ ++s_nClients;
+}
+
+//-------------------------------------------------------------------------
+void OModule::revokeClient()
+{
+ ::osl::MutexGuard aGuard(s_aMutex);
+ if (!--s_nClients && s_pImpl)
+ {
+ delete s_pImpl;
+ s_pImpl = NULL;
+ }
+}
+
+//-------------------------------------------------------------------------
+void OModule::ensureImpl()
+{
+ if (s_pImpl)
+ return;
+ s_pImpl = new OModuleImpl();
+}
+
+//.........................................................................
+} // namespace dbaui
+//.........................................................................
diff --git a/reportdesign/source/core/sdr/PropertyForward.cxx b/reportdesign/source/core/sdr/PropertyForward.cxx
new file mode 100644
index 000000000000..dbd6d4da65a2
--- /dev/null
+++ b/reportdesign/source/core/sdr/PropertyForward.cxx
@@ -0,0 +1,205 @@
+/*************************************************************************
+ *
+ * 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 "PropertyForward.hxx"
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <comphelper/property.hxx>
+#include <com/sun/star/sdbcx/XAppend.hpp>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include "corestrings.hrc"
+
+//........................................................................
+namespace rptui
+{
+//........................................................................
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::beans;
+ using namespace reportdesign;
+
+DBG_NAME( rpt_OPropertyMediator )
+OPropertyMediator::OPropertyMediator(const Reference< XPropertySet>& _xSource
+ ,const Reference< XPropertySet>& _xDest
+ ,const TPropertyNamePair& _aNameMap
+ ,sal_Bool _bReverse)
+ : OPropertyForward_Base(m_aMutex)
+ ,m_aNameMap(_aNameMap)
+ ,m_xSource(_xSource)
+ ,m_xDest(_xDest)
+ ,m_bInChange(sal_False)
+{
+ DBG_CTOR( rpt_OPropertyMediator,NULL);
+ osl_incrementInterlockedCount(&m_refCount);
+ OSL_ENSURE(m_xDest.is(),"Dest is NULL!");
+ OSL_ENSURE(m_xSource.is(),"Source is NULL!");
+ if ( m_xDest.is() && m_xSource.is() )
+ {
+ try
+ {
+ m_xDestInfo = m_xDest->getPropertySetInfo();
+ m_xSourceInfo = m_xSource->getPropertySetInfo();
+ if ( _bReverse )
+ {
+ ::comphelper::copyProperties(m_xDest,m_xSource);
+ TPropertyNamePair::iterator aIter = m_aNameMap.begin();
+ TPropertyNamePair::iterator aEnd = m_aNameMap.end();
+ for (; aIter != aEnd; ++aIter)
+ {
+ Property aProp = m_xSourceInfo->getPropertyByName(aIter->first);
+ if (0 == (aProp.Attributes & PropertyAttribute::READONLY))
+ {
+ Any aValue = _xDest->getPropertyValue(aIter->second.first);
+ if ( 0 != (aProp.Attributes & PropertyAttribute::MAYBEVOID) || aValue.hasValue() )
+ _xSource->setPropertyValue(aIter->first,aIter->second.second->operator()(aIter->second.first,aValue));
+ }
+ }
+ }
+ else
+ {
+ ::comphelper::copyProperties(m_xSource,m_xDest);
+ TPropertyNamePair::iterator aIter = m_aNameMap.begin();
+ TPropertyNamePair::iterator aEnd = m_aNameMap.end();
+ for (; aIter != aEnd; ++aIter)
+ _xDest->setPropertyValue(aIter->second.first,aIter->second.second->operator()(aIter->second.first,_xSource->getPropertyValue(aIter->first)));
+ }
+ startListening();
+ }
+ catch(Exception& e)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ (void)e;
+ }
+ } // if ( m_xDest.is() && m_xSource.is() )
+ osl_decrementInterlockedCount(&m_refCount);
+}
+// -----------------------------------------------------------------------------
+OPropertyMediator::~OPropertyMediator()
+{
+ DBG_DTOR( rpt_OPropertyMediator,NULL);
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OPropertyMediator::propertyChange( const PropertyChangeEvent& evt ) throw(RuntimeException)
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ if ( !m_bInChange )
+ {
+ m_bInChange = sal_True;
+ try
+ {
+ sal_Bool bDest = (evt.Source == m_xDest);
+ Reference<XPropertySet> xProp = bDest ? m_xSource : m_xDest;
+ Reference<XPropertySetInfo> xPropInfo = bDest ? m_xSourceInfo : m_xDestInfo;
+ if ( xProp.is() )
+ {
+ if ( xPropInfo.is() )
+ {
+ if ( xPropInfo->hasPropertyByName(evt.PropertyName) )
+ xProp->setPropertyValue(evt.PropertyName,evt.NewValue);
+ else
+ {
+ TPropertyNamePair::iterator aFind = m_aNameMap.find(evt.PropertyName);
+ ::rtl::OUString sPropName;
+ if ( aFind != m_aNameMap.end() )
+ sPropName = aFind->second.first;
+ else
+ {
+ aFind = ::std::find_if(
+ m_aNameMap.begin(),
+ m_aNameMap.end(),
+ ::std::compose1(
+ ::std::bind2nd(::std::equal_to< ::rtl::OUString >(), evt.PropertyName),
+ ::std::compose1(::std::select1st<TPropertyConverter>(),::std::select2nd<TPropertyNamePair::value_type>())
+ )
+ );
+ if ( aFind != m_aNameMap.end() )
+ sPropName = aFind->first;
+ }
+ if ( sPropName.getLength() && xPropInfo->hasPropertyByName(sPropName) )
+ xProp->setPropertyValue(sPropName,aFind->second.second->operator()(sPropName,evt.NewValue));
+ else if ( evt.PropertyName == PROPERTY_CHARFONTNAME
+ || evt.PropertyName == PROPERTY_CHARFONTSTYLENAME
+ || evt.PropertyName == PROPERTY_CHARSTRIKEOUT
+ || evt.PropertyName == PROPERTY_CHARWORDMODE
+ || evt.PropertyName == PROPERTY_CHARROTATION
+ || evt.PropertyName == PROPERTY_CHARSCALEWIDTH
+ || evt.PropertyName == PROPERTY_CHARFONTFAMILY
+ || evt.PropertyName == PROPERTY_CHARFONTCHARSET
+ || evt.PropertyName == PROPERTY_CHARFONTPITCH
+ || evt.PropertyName == PROPERTY_CHARHEIGHT
+ || evt.PropertyName == PROPERTY_CHARUNDERLINE
+ || evt.PropertyName == PROPERTY_CHARWEIGHT
+ || evt.PropertyName == PROPERTY_CHARPOSTURE)
+ {
+ xProp->setPropertyValue(PROPERTY_FONTDESCRIPTOR,m_xSource->getPropertyValue(PROPERTY_FONTDESCRIPTOR));
+ }
+ }
+ }
+ }
+ }
+ catch(Exception&)
+ {
+ OSL_ENSURE(0,"Exception catched!");
+ }
+ m_bInChange = sal_False;
+ }
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OPropertyMediator::disposing( const ::com::sun::star::lang::EventObject& /*_rSource*/ ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard(m_aMutex);
+ disposing();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL OPropertyMediator::disposing()
+{
+ stopListening();
+ m_xSource.clear();
+ m_xSourceInfo.clear();
+ m_xDest.clear();
+ m_xDestInfo.clear();
+}
+// -----------------------------------------------------------------------------
+void OPropertyMediator::stopListening()
+{
+ if ( m_xSource.is() )
+ m_xSource->removePropertyChangeListener(::rtl::OUString(), this);
+ if ( m_xDest.is() )
+ m_xDest->removePropertyChangeListener(::rtl::OUString(), this);
+}
+// -----------------------------------------------------------------------------
+void OPropertyMediator::startListening()
+{
+ if ( m_xSource.is() )
+ m_xSource->addPropertyChangeListener(::rtl::OUString(), this);
+ if ( m_xDest.is() )
+ m_xDest->addPropertyChangeListener(::rtl::OUString(), this);
+}
+// -----------------------------------------------------------------------------
+//........................................................................
+} // namespace dbaccess
+//........................................................................
+
diff --git a/reportdesign/source/core/sdr/ReportDrawPage.cxx b/reportdesign/source/core/sdr/ReportDrawPage.cxx
new file mode 100644
index 000000000000..6ef0f970078f
--- /dev/null
+++ b/reportdesign/source/core/sdr/ReportDrawPage.cxx
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * 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 "ReportDrawPage.hxx"
+#include "RptObject.hxx"
+#include "RptModel.hxx"
+#include "RptDef.hxx"
+#include "corestrings.hrc"
+#include <comphelper/mimeconfighelper.hxx>
+#include <comphelper/classids.hxx>
+#include <comphelper/embeddedobjectcontainer.hxx>
+#include <comphelper/documentconstants.hxx>
+
+#include <svx/svdmodel.hxx>
+#include <com/sun/star/report/XFixedLine.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+
+#include <tools/diagnose_ex.h>
+#include <svx/unoshape.hxx>
+
+namespace reportdesign
+{
+ using namespace ::com::sun::star;
+ using namespace rptui;
+
+OReportDrawPage::OReportDrawPage(SdrPage* _pPage
+ ,const uno::Reference< report::XSection >& _xSection)
+: SvxDrawPage(_pPage)
+,m_xSection(_xSection)
+{
+}
+
+SdrObject* OReportDrawPage::_CreateSdrObject( const uno::Reference< drawing::XShape > & xDescr ) throw ()
+{
+ uno::Reference< report::XReportComponent> xReportComponent(xDescr,uno::UNO_QUERY);
+ if ( xReportComponent.is() )
+ return OObjectBase::createObject(xReportComponent);
+ return SvxDrawPage::_CreateSdrObject( xDescr );
+}
+
+uno::Reference< drawing::XShape > OReportDrawPage::_CreateShape( SdrObject *pObj ) const throw ()
+{
+ OObjectBase* pBaseObj = dynamic_cast<OObjectBase*>(pObj);
+ if ( !pBaseObj )
+ return SvxDrawPage::_CreateShape( pObj );
+
+ uno::Reference< report::XSection> xSection = m_xSection;
+ uno::Reference< lang::XMultiServiceFactory> xFactory;
+ if ( xSection.is() )
+ xFactory.set(xSection->getReportDefinition(),uno::UNO_QUERY);
+ uno::Reference< drawing::XShape > xRet;
+ uno::Reference< drawing::XShape > xShape;
+ if ( xFactory.is() )
+ {
+ bool bChangeOrientation = false;
+ ::rtl::OUString sServiceName = pBaseObj->getServiceName();
+ OSL_ENSURE(sServiceName.getLength(),"No Service Name given!");
+
+ if ( pObj->ISA(OUnoObject) )
+ {
+ OUnoObject* pUnoObj = dynamic_cast<OUnoObject*>(pObj);
+ if ( pUnoObj->GetObjIdentifier() == OBJ_DLG_FIXEDTEXT )
+ {
+ uno::Reference<beans::XPropertySet> xControlModel(pUnoObj->GetUnoControlModel(),uno::UNO_QUERY);
+ if ( xControlModel.is() )
+ xControlModel->setPropertyValue( PROPERTY_MULTILINE,uno::makeAny(sal_True));
+ }
+ else
+ bChangeOrientation = pUnoObj->GetObjIdentifier() == OBJ_DLG_HFIXEDLINE;
+ SvxShapeControl* pShape = new SvxShapeControl( pObj );
+ xShape.set(*pShape,uno::UNO_QUERY);
+ pShape->setShapeKind(pObj->GetObjIdentifier());
+ }
+ else if ( pObj->ISA(OCustomShape) )
+ {
+ SvxCustomShape* pShape = new SvxCustomShape( pObj );
+ uno::Reference < drawing::XEnhancedCustomShapeDefaulter > xShape2 = pShape;
+ xShape.set(xShape2,uno::UNO_QUERY);
+ pShape->setShapeKind(pObj->GetObjIdentifier());
+ }
+ else if ( pObj->ISA(SdrOle2Obj) )
+ {
+ SdrOle2Obj* pOle2Obj = dynamic_cast<SdrOle2Obj*>(pObj);
+ if ( !pOle2Obj->GetObjRef().is() )
+ {
+ sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
+ uno::Reference < embed::XEmbeddedObject > xObj;
+ ::rtl::OUString sName;
+ xObj = pObj->GetModel()->GetPersist()->getEmbeddedObjectContainer().CreateEmbeddedObject(
+ ::comphelper::MimeConfigurationHelper::GetSequenceClassIDRepresentation(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("80243D39-6741-46C5-926E-069164FF87BB"))), sName );
+ OSL_ENSURE(xObj.is(),"Embedded Object could not be created!");
+
+ /**************************************************
+ * Das leere OLE-Objekt bekommt ein neues IPObj
+ **************************************************/
+ pObj->SetEmptyPresObj(FALSE);
+ pOle2Obj->SetOutlinerParaObject(NULL);
+ pOle2Obj->SetObjRef(xObj);
+ pOle2Obj->SetPersistName(sName);
+ pOle2Obj->SetName(sName);
+ pOle2Obj->SetAspect(nAspect);
+ Rectangle aRect = pOle2Obj->GetLogicRect();
+
+ Size aTmp = aRect.GetSize();
+ awt::Size aSz( aTmp.Width(), aTmp.Height() );
+ xObj->setVisualAreaSize( nAspect, aSz );
+ }
+ SvxOle2Shape* pShape = new SvxOle2Shape( pObj );
+ xShape.set(*pShape,uno::UNO_QUERY);
+ pShape->setShapeKind(pObj->GetObjIdentifier());
+ //xShape = new SvxOle2Shape( pOle2Obj );
+ }
+
+ if ( !xShape.is() )
+ xShape.set( SvxDrawPage::_CreateShape( pObj ) );
+
+ try
+ {
+ OReportModel* pRptModel = static_cast<OReportModel*>(pObj->GetModel());
+ xRet.set( pRptModel->createShape(sServiceName,xShape,bChangeOrientation ? 0 : 1), uno::UNO_QUERY_THROW );
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ return xRet;
+}
+
+}
diff --git a/reportdesign/source/core/sdr/ReportUndoFactory.cxx b/reportdesign/source/core/sdr/ReportUndoFactory.cxx
new file mode 100644
index 000000000000..e0e089e651b2
--- /dev/null
+++ b/reportdesign/source/core/sdr/ReportUndoFactory.cxx
@@ -0,0 +1,181 @@
+/*************************************************************************
+ *
+ * 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 "ReportUndoFactory.hxx"
+#include "RptObject.hxx"
+#include "UndoActions.hxx"
+#include "RptResId.hrc"
+
+namespace rptui
+{
+ using namespace ::com::sun::star;
+// -----------------------------------------------------------------------------
+SdrUndoAction* lcl_createUndo(SdrObject& rObject,Action _eAction,USHORT _nCommentId)
+{
+ OObjectBase* pObj = dynamic_cast<OObjectBase*>(&rObject);
+ if ( !pObj )
+ return NULL;
+ uno::Reference< report::XReportComponent> xReportComponent = pObj->getReportComponent();
+ uno::Reference< report::XSection> xSection = pObj->getSection();
+ uno::Reference< report::XGroup> xGroup = xSection->getGroup();
+ SdrUndoAction* pUndo = NULL;
+ if ( xGroup.is() )
+ pUndo = new OUndoGroupSectionAction(*rObject.GetModel(),_eAction,OGroupHelper::getMemberFunction(xSection),xGroup,xReportComponent,_nCommentId);
+ else
+ pUndo = new OUndoReportSectionAction(*rObject.GetModel(),_eAction,OReportHelper::getMemberFunction(xSection),xSection->getReportDefinition(),xReportComponent,_nCommentId);
+ return pUndo;
+}
+// -----------------------------------------------------------------------------
+DBG_NAME( rpt_OReportUndoFactory )
+// -----------------------------------------------------------------------------
+OReportUndoFactory::OReportUndoFactory() : m_pUndoFactory(new SdrUndoFactory)
+{
+ DBG_CTOR( rpt_OReportUndoFactory,NULL);
+}
+// -----------------------------------------------------------------------------
+OReportUndoFactory::~OReportUndoFactory()
+{
+ DBG_DTOR( rpt_OReportUndoFactory,NULL);
+}
+///////////////////////////////////////////////////////////////////////
+// shapes
+SdrUndoAction* OReportUndoFactory::CreateUndoMoveObject( SdrObject& rObject )
+{
+ return m_pUndoFactory->CreateUndoMoveObject( rObject );
+}
+
+SdrUndoAction* OReportUndoFactory::CreateUndoMoveObject( SdrObject& rObject, const Size& rDist )
+{
+ return m_pUndoFactory->CreateUndoMoveObject( rObject, rDist );
+}
+
+SdrUndoAction* OReportUndoFactory::CreateUndoGeoObject( SdrObject& rObject )
+{
+ return m_pUndoFactory->CreateUndoGeoObject( rObject );
+}
+
+SdrUndoAction* OReportUndoFactory::CreateUndoAttrObject( SdrObject& rObject, bool bStyleSheet1, bool bSaveText )
+{
+ return m_pUndoFactory->CreateUndoAttrObject( rObject, bStyleSheet1 ? TRUE : FALSE, bSaveText ? TRUE : FALSE );
+}
+
+SdrUndoAction* OReportUndoFactory::CreateUndoRemoveObject( SdrObject& rObject, bool bOrdNumDirect )
+{
+ return m_pUndoFactory->CreateUndoRemoveObject( rObject, bOrdNumDirect ? TRUE : FALSE );
+}
+
+SdrUndoAction* OReportUndoFactory::CreateUndoInsertObject( SdrObject& rObject, bool /*bOrdNumDirect*/ )
+{
+ return lcl_createUndo(rObject,rptui::Inserted,RID_STR_UNDO_INSERT_CONTROL);
+}
+
+SdrUndoAction* OReportUndoFactory::CreateUndoDeleteObject( SdrObject& rObject, bool /*bOrdNumDirect*/ )
+{
+ return lcl_createUndo(rObject,rptui::Removed,RID_STR_UNDO_DELETE_CONTROL);
+ //return m_pUndoFactory->CreateUndoDeleteObject( rObject, bOrdNumDirect ? TRUE : FALSE );
+}
+
+SdrUndoAction* OReportUndoFactory::CreateUndoNewObject( SdrObject& rObject, bool /*bOrdNumDirect*/ )
+{
+ return lcl_createUndo(rObject,rptui::Inserted,RID_STR_UNDO_INSERT_CONTROL);
+}
+
+SdrUndoAction* OReportUndoFactory::CreateUndoCopyObject( SdrObject& rObject, bool bOrdNumDirect )
+{
+ return m_pUndoFactory->CreateUndoCopyObject( rObject, bOrdNumDirect ? TRUE : FALSE );
+}
+
+SdrUndoAction* OReportUndoFactory::CreateUndoObjectOrdNum( SdrObject& rObject, sal_uInt32 nOldOrdNum1, sal_uInt32 nNewOrdNum1)
+{
+ return m_pUndoFactory->CreateUndoObjectOrdNum( rObject, nOldOrdNum1, nNewOrdNum1 );
+}
+
+SdrUndoAction* OReportUndoFactory::CreateUndoReplaceObject( SdrObject& rOldObject, SdrObject& rNewObject, bool bOrdNumDirect )
+{
+ return m_pUndoFactory->CreateUndoReplaceObject( rOldObject, rNewObject, bOrdNumDirect ? TRUE : FALSE );
+}
+
+SdrUndoAction* OReportUndoFactory::CreateUndoObjectLayerChange( SdrObject& rObject, SdrLayerID aOldLayer, SdrLayerID aNewLayer )
+{
+ return m_pUndoFactory->CreateUndoObjectLayerChange( rObject, aOldLayer, aNewLayer );
+}
+
+SdrUndoAction* OReportUndoFactory::CreateUndoObjectSetText( SdrObject& rNewObj, sal_Int32 nText )
+{
+ return m_pUndoFactory->CreateUndoObjectSetText( rNewObj, nText );
+}
+
+// layer
+SdrUndoAction* OReportUndoFactory::CreateUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel)
+{
+ return m_pUndoFactory->CreateUndoNewLayer( nLayerNum, rNewLayerAdmin, rNewModel );
+}
+
+SdrUndoAction* OReportUndoFactory::CreateUndoDeleteLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel)
+{
+ return m_pUndoFactory->CreateUndoDeleteLayer( nLayerNum, rNewLayerAdmin, rNewModel );
+}
+
+SdrUndoAction* OReportUndoFactory::CreateUndoMoveLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel, sal_uInt16 nNeuPos1)
+{
+ return m_pUndoFactory->CreateUndoMoveLayer( nLayerNum, rNewLayerAdmin, rNewModel, nNeuPos1 );
+}
+
+// page
+SdrUndoAction* OReportUndoFactory::CreateUndoDeletePage(SdrPage& rPage)
+{
+ return m_pUndoFactory->CreateUndoDeletePage( rPage );
+}
+
+SdrUndoAction* OReportUndoFactory::CreateUndoNewPage(SdrPage& rPage)
+{
+ return m_pUndoFactory->CreateUndoNewPage( rPage );
+}
+
+SdrUndoAction* OReportUndoFactory::CreateUndoCopyPage(SdrPage& rPage)
+{
+ return m_pUndoFactory->CreateUndoCopyPage( rPage );
+}
+
+SdrUndoAction* OReportUndoFactory::CreateUndoSetPageNum(SdrPage& rNewPg, sal_uInt16 nOldPageNum1, sal_uInt16 nNewPageNum1)
+{
+ return m_pUndoFactory->CreateUndoSetPageNum( rNewPg, nOldPageNum1, nNewPageNum1 );
+}
+ // master page
+SdrUndoAction* OReportUndoFactory::CreateUndoPageRemoveMasterPage(SdrPage& rChangedPage)
+{
+ return m_pUndoFactory->CreateUndoPageRemoveMasterPage( rChangedPage );
+}
+
+SdrUndoAction* OReportUndoFactory::CreateUndoPageChangeMasterPage(SdrPage& rChangedPage)
+{
+ return m_pUndoFactory->CreateUndoPageChangeMasterPage(rChangedPage);
+}
+
+//==================================================================
+} //rptui
+//==================================================================
+
diff --git a/reportdesign/source/core/sdr/RptModel.cxx b/reportdesign/source/core/sdr/RptModel.cxx
new file mode 100644
index 000000000000..7327456c7940
--- /dev/null
+++ b/reportdesign/source/core/sdr/RptModel.cxx
@@ -0,0 +1,233 @@
+/*************************************************************************
+ *
+ * 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 "RptModel.hxx"
+#include "RptPage.hxx"
+#include <dbaccess/singledoccontroller.hxx>
+#include <tools/debug.hxx>
+#include <unotools/pathoptions.hxx>
+
+#include "UndoActions.hxx"
+#include "UndoEnv.hxx"
+#include "ReportUndoFactory.hxx"
+#include "ReportDefinition.hxx"
+#define ITEMID_COLOR 1
+#define ITEMID_BRUSH 2
+#define ITEMID_FONT 3
+#define ITEMID_FONTHEIGHT 4
+
+#include <svx/tbcontrl.hxx>
+#include "rptui_slotid.hrc"
+#include "RptDef.hxx"
+#include "corestrings.hrc"
+#include "FixedLine.hxx"
+#include "FormattedField.hxx"
+#include "FixedText.hxx"
+#include "ImageControl.hxx"
+#include "Shape.hxx"
+
+namespace rptui
+{
+using namespace reportdesign;
+using namespace com::sun::star;
+DBG_NAME( rpt_OReportModel )
+TYPEINIT1(OReportModel,SdrModel);
+
+//----------------------------------------------------------------------------
+
+OReportModel::OReportModel(::reportdesign::OReportDefinition* _pReportDefinition) :
+ SdrModel(SvtPathOptions().GetPalettePath(),NULL,_pReportDefinition)
+ ,m_pController(NULL)
+ ,m_pReportDefinition(_pReportDefinition)
+{
+ DBG_CTOR( rpt_OReportModel,0);
+ SetAllowShapePropertyChangeListener(true);
+ m_pUndoEnv = new OXUndoEnvironment(*this);
+ m_pUndoEnv->acquire();
+ SetSdrUndoFactory(new OReportUndoFactory);
+
+ // SvxFontNameToolBoxControl::RegisterControl(SID_ATTR_CHAR_FONT);
+ //SvxFontHeightToolBoxControl::RegisterControl(SID_ATTR_CHAR_FONTHEIGHT);
+ //SvxFontColorToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR);
+ //SvxFontColorExtToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR2);
+ //SvxFontColorExtToolBoxControl::RegisterControl(SID_ATTR_CHAR_COLOR_BACKGROUND);
+ //SvxColorToolBoxControl::RegisterControl(SID_BACKGROUND_COLOR);
+}
+
+//----------------------------------------------------------------------------
+OReportModel::~OReportModel()
+{
+ DBG_DTOR( rpt_OReportModel,0);
+ detachController();
+ m_pUndoEnv->release();
+}
+// -----------------------------------------------------------------------------
+void OReportModel::detachController()
+{
+ m_pReportDefinition = NULL;
+ m_pController = NULL;
+ m_pUndoEnv->EndListening( *this );
+ ClearUndoBuffer();
+ m_pUndoEnv->Clear(OXUndoEnvironment::Accessor());
+}
+//----------------------------------------------------------------------------
+SdrPage* OReportModel::AllocPage(FASTBOOL /*bMasterPage*/)
+{
+ DBG_CHKTHIS( rpt_OReportModel, 0);
+ OSL_ENSURE(0,"Who called me!");
+ return NULL;
+}
+
+//----------------------------------------------------------------------------
+
+void OReportModel::SetChanged( sal_Bool bChanged )
+{
+ SdrModel::SetChanged( bChanged );
+ SetModified( bChanged );
+}
+
+//----------------------------------------------------------------------------
+
+Window* OReportModel::GetCurDocViewWin()
+{
+ return 0;
+}
+
+//----------------------------------------------------------------------------
+OXUndoEnvironment& OReportModel::GetUndoEnv()
+{
+ return *m_pUndoEnv;
+}
+//----------------------------------------------------------------------------
+void OReportModel::SetModified(sal_Bool _bModified)
+{
+ if ( m_pController )
+ m_pController->setModified(_bModified);
+}
+// -----------------------------------------------------------------------------
+SdrPage* OReportModel::RemovePage(USHORT nPgNum)
+{
+ OReportPage* pPage = dynamic_cast<OReportPage*>(SdrModel::RemovePage(nPgNum));
+ //if ( pPage )
+ //{
+ // m_pUndoEnv->RemoveSection(pPage);
+ //}
+ return pPage;
+}
+// -----------------------------------------------------------------------------
+OReportPage* OReportModel::createNewPage(const uno::Reference< report::XSection >& _xSection)
+{
+ OReportPage* pPage = new OReportPage( *this ,_xSection);
+ InsertPage(pPage);
+ m_pUndoEnv->AddSection(_xSection);
+ return pPage;
+}
+// -----------------------------------------------------------------------------
+OReportPage* OReportModel::getPage(const uno::Reference< report::XSection >& _xSection)
+{
+ OReportPage* pPage = NULL;
+ USHORT nCount = GetPageCount();
+ for (USHORT i = 0; i < nCount && !pPage ; ++i)
+ {
+ OReportPage* pRptPage = PTR_CAST( OReportPage, GetPage(i) );
+ if ( pRptPage && pRptPage->getSection() == _xSection )
+ pPage = pRptPage;
+ }
+ return pPage;
+}
+// -----------------------------------------------------------------------------
+SvxNumType OReportModel::GetPageNumType() const
+{
+ uno::Reference< report::XReportDefinition > xReportDefinition( getReportDefinition() );
+ if ( xReportDefinition.is() )
+ return (SvxNumType)getStyleProperty<sal_Int16>(xReportDefinition,reportdesign::PROPERTY_NUMBERINGTYPE);
+ return SVX_ARABIC;
+}
+
+// -----------------------------------------------------------------------------
+uno::Reference< report::XReportDefinition > OReportModel::getReportDefinition() const
+{
+ uno::Reference< report::XReportDefinition > xReportDefinition = m_pReportDefinition;
+ OSL_ENSURE( xReportDefinition.is(), "OReportModel::getReportDefinition: invalid model at our controller!" );
+ return xReportDefinition;
+}
+// -----------------------------------------------------------------------------
+uno::Reference< uno::XInterface > OReportModel::createUnoModel()
+{
+ return uno::Reference< uno::XInterface >(getReportDefinition(),uno::UNO_QUERY);
+}
+// -----------------------------------------------------------------------------
+uno::Reference< uno::XInterface > OReportModel::createShape(const ::rtl::OUString& aServiceSpecifier,uno::Reference< drawing::XShape >& _rShape,sal_Int32 nOrientation)
+{
+ uno::Reference< uno::XInterface > xRet;
+ if ( _rShape.is() )
+ {
+ if ( aServiceSpecifier == SERVICE_FORMATTEDFIELD )
+ {
+ uno::Reference<report::XFormattedField> xProp = new OFormattedField(m_pReportDefinition->getContext(),m_pReportDefinition,_rShape);
+ xRet = xProp;
+ if ( _rShape.is() )
+ throw uno::Exception();
+ xProp->setPropertyValue( PROPERTY_FORMATSSUPPLIER, uno::makeAny(uno::Reference< util::XNumberFormatsSupplier >(*m_pReportDefinition,uno::UNO_QUERY)) );
+ }
+ else if ( aServiceSpecifier == SERVICE_FIXEDTEXT)
+ {
+ xRet = static_cast<cppu::OWeakObject*>(new OFixedText(m_pReportDefinition->getContext(),m_pReportDefinition,_rShape));
+ if ( _rShape.is() )
+ throw uno::Exception();
+ }
+ else if ( aServiceSpecifier == SERVICE_FIXEDLINE)
+ {
+ xRet = static_cast<cppu::OWeakObject*>(new OFixedLine(m_pReportDefinition->getContext(),m_pReportDefinition,_rShape,nOrientation));
+ if ( _rShape.is() )
+ throw uno::Exception();
+ }
+ else if ( aServiceSpecifier == SERVICE_IMAGECONTROL )
+ {
+ xRet = static_cast<cppu::OWeakObject*>(new OImageControl(m_pReportDefinition->getContext(),m_pReportDefinition,_rShape));
+ if ( _rShape.is() )
+ throw uno::Exception();
+ }
+ else if ( aServiceSpecifier == SERVICE_REPORTDEFINITION )
+ {
+ xRet = static_cast<cppu::OWeakObject*>(new OReportDefinition(m_pReportDefinition->getContext(),m_pReportDefinition,_rShape));
+ if ( _rShape.is() )
+ throw uno::Exception();
+ }
+ else if ( _rShape.is() )
+ {
+ xRet = static_cast<cppu::OWeakObject*>(new OShape(m_pReportDefinition->getContext(),m_pReportDefinition,_rShape,aServiceSpecifier));
+ if ( _rShape.is() )
+ throw uno::Exception();
+ }
+ }
+ return xRet;
+}
+//==================================================================
+} //rptui
+//==================================================================
diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx
new file mode 100644
index 000000000000..2299fff10f98
--- /dev/null
+++ b/reportdesign/source/core/sdr/RptObject.cxx
@@ -0,0 +1,1264 @@
+/*************************************************************************
+ *
+ * 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 "RptObject.hxx"
+#include <vector>
+#include <algorithm>
+
+#include <RptDef.hxx>
+#include <svx/unoshape.hxx>
+#include "RptModel.hxx"
+#include "RptObjectListener.hxx"
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/convert.hxx>
+#include "RptPage.hxx"
+#include "corestrings.hrc"
+#include <dbaccess/singledoccontroller.hxx>
+#include "ModuleHelper.hxx"
+
+#include <RptResId.hrc>
+#include <svx/xflclit.hxx>
+#include <svx/xlnclit.hxx>
+#include <svx/xlndsit.hxx>
+#include <svx/xlineit0.hxx>
+#include <svx/sderitm.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/xlntrit.hxx>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/awt/XTabControllerModel.hpp>
+#include <com/sun/star/awt/XUnoControlContainer.hpp>
+#include <com/sun/star/awt/XVclContainerPeer.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/awt/TextAlign.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/script/XScriptEventsSupplier.hpp>
+#include <com/sun/star/container/XContainer.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/report/XShape.hpp>
+#include <com/sun/star/report/XFixedLine.hpp>
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+#include <com/sun/star/chart2/data/XDataReceiver.hpp>
+#include <com/sun/star/chart2/data/DatabaseDataProvider.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/style/ParagraphAdjust.hpp>
+#include <com/sun/star/report/XFormattedField.hpp>
+#include <comphelper/genericpropertyset.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/property.hxx>
+#include <tools/diagnose_ex.h>
+#include "PropertyForward.hxx"
+#include <connectivity/dbtools.hxx>
+#include <connectivity/dbconversion.hxx>
+#include "UndoActions.hxx"
+#include "UndoEnv.hxx"
+#include <algorithm>
+#include <functional>
+
+namespace rptui
+{
+
+using namespace ::com::sun::star;
+using namespace uno;
+using namespace beans;
+using namespace reportdesign;
+using namespace container;
+using namespace script;
+using namespace report;
+//----------------------------------------------------------------------------
+sal_uInt16 OObjectBase::getObjectType(const uno::Reference< report::XReportComponent>& _xComponent)
+{
+ uno::Reference< lang::XServiceInfo > xServiceInfo( _xComponent , uno::UNO_QUERY );
+ OSL_ENSURE(xServiceInfo.is(),"Who deletes the XServiceInfo interface!");
+ if ( xServiceInfo.is() )
+ {
+ if ( xServiceInfo->supportsService( SERVICE_FIXEDTEXT ))
+ return OBJ_DLG_FIXEDTEXT;
+ if ( xServiceInfo->supportsService( SERVICE_FIXEDLINE ))
+ {
+ uno::Reference< report::XFixedLine> xFixedLine(_xComponent,uno::UNO_QUERY);
+ return xFixedLine->getOrientation() ? OBJ_DLG_HFIXEDLINE : OBJ_DLG_VFIXEDLINE;
+ }
+ if ( xServiceInfo->supportsService( SERVICE_IMAGECONTROL))
+ return OBJ_DLG_IMAGECONTROL;
+ if ( xServiceInfo->supportsService( SERVICE_FORMATTEDFIELD ))
+ return OBJ_DLG_FORMATTEDFIELD;
+ if ( xServiceInfo->supportsService( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.OLE2Shape")) ) )
+ return OBJ_OLE2;
+ if ( xServiceInfo->supportsService( SERVICE_SHAPE ))
+ return OBJ_CUSTOMSHAPE;
+ if ( xServiceInfo->supportsService( SERVICE_REPORTDEFINITION ) )
+ return OBJ_DLG_SUBREPORT;
+ return OBJ_OLE2;
+ }
+ return 0;
+}
+// -----------------------------------------------------------------------------
+SdrObject* OObjectBase::createObject(const uno::Reference< report::XReportComponent>& _xComponent)
+{
+ SdrObject* pNewObj = NULL;
+ sal_uInt16 nType = OObjectBase::getObjectType(_xComponent);
+ switch( nType )
+ {
+ case OBJ_DLG_FIXEDTEXT:
+ {
+ OUnoObject* pUnoObj = new OUnoObject( _xComponent
+ ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FixedText"))
+ ,OBJ_DLG_FIXEDTEXT);
+ pNewObj = pUnoObj;
+
+ uno::Reference<beans::XPropertySet> xControlModel(pUnoObj->GetUnoControlModel(),uno::UNO_QUERY);
+ if ( xControlModel.is() )
+ xControlModel->setPropertyValue( PROPERTY_MULTILINE,uno::makeAny(sal_True));
+ }
+ break;
+ case OBJ_DLG_IMAGECONTROL:
+ pNewObj = new OUnoObject(_xComponent
+ ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.DatabaseImageControl"))
+ ,OBJ_DLG_IMAGECONTROL);
+ break;
+ case OBJ_DLG_FORMATTEDFIELD:
+ pNewObj = new OUnoObject( _xComponent
+ ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FormattedField"))
+ ,OBJ_DLG_FORMATTEDFIELD);
+ break;
+ case OBJ_DLG_HFIXEDLINE:
+ case OBJ_DLG_VFIXEDLINE:
+ pNewObj = new OUnoObject( _xComponent
+ ,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel"))
+ ,nType);
+ break;
+ case OBJ_CUSTOMSHAPE:
+ pNewObj = OCustomShape::Create( _xComponent );
+ try
+ {
+ sal_Bool bOpaque = sal_False;
+ _xComponent->getPropertyValue(PROPERTY_OPAQUE) >>= bOpaque;
+ pNewObj->SetLayer(bOpaque ? RPT_LAYER_FRONT : RPT_LAYER_BACK);
+ }
+ catch(const uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ break;
+ case OBJ_DLG_SUBREPORT:
+ case OBJ_OLE2:
+ pNewObj = OOle2Obj::Create( _xComponent,nType );
+ break;
+ default:
+ OSL_ENSURE(0,"Unknown object id");
+ break;
+ }
+
+ ensureSdrObjectOwnership( _xComponent );
+
+ return pNewObj;
+}
+// -----------------------------------------------------------------------------
+namespace
+{
+ class ParaAdjust : public AnyConverter
+ {
+ public:
+ virtual ::com::sun::star::uno::Any operator() (const ::rtl::OUString& _sPropertyName,const ::com::sun::star::uno::Any& lhs) const
+ {
+ uno::Any aRet;
+ if ( _sPropertyName.equalsAscii(PROPERTY_PARAADJUST) )
+ {
+ sal_Int16 nTextAlign = 0;
+ lhs >>= nTextAlign;
+ switch(nTextAlign)
+ {
+ case awt::TextAlign::LEFT:
+ nTextAlign = style::ParagraphAdjust_LEFT;
+ break;
+ case awt::TextAlign::CENTER:
+ nTextAlign = style::ParagraphAdjust_CENTER;
+ break;
+ case awt::TextAlign::RIGHT:
+ nTextAlign = style::ParagraphAdjust_RIGHT;
+ break;
+ default:
+ OSL_ENSURE(0,"Illegal text alignment value!");
+ break;
+ } // switch(nTextAlign)
+ aRet <<= (style::ParagraphAdjust)nTextAlign;
+ }
+ else
+ {
+ sal_Int16 nTextAlign = 0;
+ sal_Int16 eParagraphAdjust = 0;
+ lhs >>= eParagraphAdjust;
+ switch(eParagraphAdjust)
+ {
+ case style::ParagraphAdjust_LEFT:
+ case style::ParagraphAdjust_BLOCK:
+ nTextAlign = awt::TextAlign::LEFT;
+ break;
+ case style::ParagraphAdjust_CENTER:
+ nTextAlign = awt::TextAlign::CENTER;
+ break;
+ case style::ParagraphAdjust_RIGHT:
+ nTextAlign = awt::TextAlign::RIGHT;
+ break;
+ default:
+ OSL_ENSURE(0,"Illegal text alignment value!");
+ break;
+ } // switch(eParagraphAdjust)
+ aRet <<= nTextAlign;
+ }
+ return aRet;
+ }
+ };
+}
+// -----------------------------------------------------------------------------
+const TPropertyNamePair& getPropertyNameMap(sal_uInt16 _nObjectId)
+{
+ switch(_nObjectId)
+ {
+ case OBJ_DLG_IMAGECONTROL:
+ {
+ static TPropertyNamePair s_aNameMap;
+ if ( s_aNameMap.empty() )
+ {
+ ::boost::shared_ptr<AnyConverter> aNoConverter(new AnyConverter());
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBACKGROUND,TPropertyConverter(PROPERTY_BACKGROUNDCOLOR,aNoConverter)));
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDER,TPropertyConverter(PROPERTY_BORDER,aNoConverter)));
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDERCOLOR,TPropertyConverter(PROPERTY_BORDERCOLOR,aNoConverter)));
+ //s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_PARAADJUST,PROPERTY_ALIGN));
+ }
+ return s_aNameMap;
+ }
+
+ case OBJ_DLG_FIXEDTEXT:
+ {
+ static TPropertyNamePair s_aNameMap;
+ if ( s_aNameMap.empty() )
+ {
+ ::boost::shared_ptr<AnyConverter> aNoConverter(new AnyConverter());
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARCOLOR,TPropertyConverter(PROPERTY_TEXTCOLOR,aNoConverter)));
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBACKGROUND,TPropertyConverter(PROPERTY_BACKGROUNDCOLOR,aNoConverter)));
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARUNDERLINECOLOR,TPropertyConverter(PROPERTY_TEXTLINECOLOR,aNoConverter)));
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARRELIEF,TPropertyConverter(PROPERTY_FONTRELIEF,aNoConverter)));
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARFONTHEIGHT,TPropertyConverter(PROPERTY_FONTHEIGHT,aNoConverter)));
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARSTRIKEOUT,TPropertyConverter(PROPERTY_FONTSTRIKEOUT,aNoConverter)));
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLTEXTEMPHASISMARK,TPropertyConverter(PROPERTY_FONTEMPHASISMARK,aNoConverter)));
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDER,TPropertyConverter(PROPERTY_BORDER,aNoConverter)));
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDERCOLOR,TPropertyConverter(PROPERTY_BORDERCOLOR,aNoConverter)));
+
+ ::boost::shared_ptr<AnyConverter> aParaAdjust(new ParaAdjust());
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_PARAADJUST,TPropertyConverter(PROPERTY_ALIGN,aParaAdjust)));
+ }
+ return s_aNameMap;
+ }
+ case OBJ_DLG_FORMATTEDFIELD:
+ {
+ static TPropertyNamePair s_aNameMap;
+ if ( s_aNameMap.empty() )
+ {
+ ::boost::shared_ptr<AnyConverter> aNoConverter(new AnyConverter());
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARCOLOR,TPropertyConverter(PROPERTY_TEXTCOLOR,aNoConverter)));
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBACKGROUND,TPropertyConverter(PROPERTY_BACKGROUNDCOLOR,aNoConverter)));
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARUNDERLINECOLOR,TPropertyConverter(PROPERTY_TEXTLINECOLOR,aNoConverter)));
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARRELIEF,TPropertyConverter(PROPERTY_FONTRELIEF,aNoConverter)));
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARFONTHEIGHT,TPropertyConverter(PROPERTY_FONTHEIGHT,aNoConverter)));
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CHARSTRIKEOUT,TPropertyConverter(PROPERTY_FONTSTRIKEOUT,aNoConverter)));
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLTEXTEMPHASISMARK,TPropertyConverter(PROPERTY_FONTEMPHASISMARK,aNoConverter)));
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDER,TPropertyConverter(PROPERTY_BORDER,aNoConverter)));
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_CONTROLBORDERCOLOR,TPropertyConverter(PROPERTY_BORDERCOLOR,aNoConverter)));
+ //s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_PARAADJUST,TPropertyConverter(PROPERTY_ALIGN,aNoConverter)));
+ ::boost::shared_ptr<AnyConverter> aParaAdjust(new ParaAdjust());
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_PARAADJUST,TPropertyConverter(PROPERTY_ALIGN,aParaAdjust)));
+ }
+ return s_aNameMap;
+ }
+
+ case OBJ_CUSTOMSHAPE:
+ {
+ static TPropertyNamePair s_aNameMap;
+ if ( s_aNameMap.empty() )
+ {
+ ::boost::shared_ptr<AnyConverter> aNoConverter(new AnyConverter());
+ s_aNameMap.insert(TPropertyNamePair::value_type(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillColor")),TPropertyConverter(PROPERTY_CONTROLBACKGROUND,aNoConverter)));
+ s_aNameMap.insert(TPropertyNamePair::value_type(PROPERTY_PARAADJUST,TPropertyConverter(PROPERTY_ALIGN,aNoConverter)));
+ }
+ return s_aNameMap;
+ }
+
+ default:
+ break;
+ }
+ static TPropertyNamePair s_aEmptyNameMap;
+ return s_aEmptyNameMap;
+}
+// -----------------------------------------------------------------------------
+
+DBG_NAME( rpt_OObjectBase )
+OObjectBase::OObjectBase(const uno::Reference< report::XReportComponent>& _xComponent)
+:m_bIsListening(sal_False)
+{
+ DBG_CTOR( rpt_OObjectBase,NULL);
+ m_xReportComponent = _xComponent;
+}
+//----------------------------------------------------------------------------
+OObjectBase::OObjectBase(const ::rtl::OUString& _sComponentName)
+:m_sComponentName(_sComponentName)
+,m_bIsListening(sal_False)
+{
+ DBG_CTOR( rpt_OObjectBase,NULL);
+}
+//----------------------------------------------------------------------------
+OObjectBase::~OObjectBase()
+{
+ DBG_DTOR( rpt_OObjectBase,NULL);
+ m_xMediator.reset();
+ if ( isListening() )
+ EndListening();
+ m_xReportComponent.clear();
+}
+// -----------------------------------------------------------------------------
+uno::Reference< report::XSection> OObjectBase::getSection() const
+{
+ uno::Reference< report::XSection> xSection;
+ OReportPage* pPage = dynamic_cast<OReportPage*>(GetImplPage());
+ if ( pPage )
+ xSection = pPage->getSection();
+ return xSection;
+}
+// -----------------------------------------------------------------------------
+uno::Reference< report::XReportComponent> OObjectBase::getReportComponent() const
+{
+ return m_xReportComponent;
+}
+// -----------------------------------------------------------------------------
+uno::Reference< beans::XPropertySet> OObjectBase::getAwtComponent()
+{
+ return uno::Reference< beans::XPropertySet>();
+}
+//----------------------------------------------------------------------------
+void OObjectBase::StartListening()
+{
+ DBG_CHKTHIS( rpt_OObjectBase,NULL);
+ OSL_ENSURE(!isListening(), "OUnoObject::StartListening: already listening!");
+
+ if ( !isListening() && m_xReportComponent.is() )
+ {
+ m_bIsListening = sal_True;
+
+ if ( !m_xPropertyChangeListener.is() )
+ {
+ m_xPropertyChangeListener = new OObjectListener( this );
+ // register listener to all properties
+ m_xReportComponent->addPropertyChangeListener( ::rtl::OUString() , m_xPropertyChangeListener );
+ }
+ }
+}
+//----------------------------------------------------------------------------
+void OObjectBase::EndListening(sal_Bool /*bRemoveListener*/)
+{
+ DBG_CHKTHIS( rpt_OObjectBase,NULL);
+ OSL_ENSURE(!m_xReportComponent.is() || isListening(), "OUnoObject::EndListening: not listening currently!");
+
+ m_bIsListening = sal_False;
+ if ( isListening() && m_xReportComponent.is() )
+ {
+ // XPropertyChangeListener
+ if ( m_xPropertyChangeListener.is() )
+ {
+ // remove listener
+ try
+ {
+ m_xReportComponent->removePropertyChangeListener( ::rtl::OUString() , m_xPropertyChangeListener );
+ }
+ catch(uno::Exception)
+ {
+ OSL_ENSURE(0,"OObjectBase::EndListening: Exception caught!");
+ }
+ }
+ m_xPropertyChangeListener.clear();
+ }
+}
+//----------------------------------------------------------------------------
+void OObjectBase::SetPropsFromRect(const Rectangle& _rRect)
+{
+ DBG_CHKTHIS( rpt_OObjectBase,NULL);
+ // set properties
+ OReportPage* pPage = dynamic_cast<OReportPage*>(GetImplPage());
+ if ( pPage && !_rRect.IsEmpty() )
+ {
+ uno::Reference<report::XSection> xSection = pPage->getSection();
+ if ( xSection.is() && (static_cast<sal_uInt32>(_rRect.getHeight() + _rRect.Top()) > xSection->getHeight()) )
+ xSection->setHeight(_rRect.getHeight() + _rRect.Top());
+
+ // TODO
+ //pModel->GetRefDevice()->Invalidate(INVALIDATE_CHILDREN);
+ }
+}
+//----------------------------------------------------------------------------
+void OObjectBase::_propertyChange( const beans::PropertyChangeEvent& /*evt*/ ) throw( uno::RuntimeException)
+{
+ DBG_CHKTHIS( rpt_OObjectBase,NULL);
+}
+//----------------------------------------------------------------------------
+void OObjectBase::SetObjectItemHelper(const SfxPoolItem& /*rItem*/)
+{
+ // do nothing
+}
+
+//----------------------------------------------------------------------------
+sal_Bool OObjectBase::supportsService( const ::rtl::OUString& _sServiceName ) const
+{
+ DBG_CHKTHIS( rpt_OObjectBase,NULL);
+ sal_Bool bSupports = sal_False;
+
+ Reference< lang::XServiceInfo > xServiceInfo( m_xReportComponent , UNO_QUERY );
+ // TODO: cache xServiceInfo as member?
+ if ( xServiceInfo.is() )
+ bSupports = xServiceInfo->supportsService( _sServiceName );
+
+ return bSupports;
+}
+
+//----------------------------------------------------------------------------
+void OObjectBase::ensureSdrObjectOwnership( const uno::Reference< uno::XInterface >& _rxShape )
+{
+ // UNDO in the report designer is implemented at the level of the XShapes, not
+ // at the level of SdrObjects. That is, if an object is removed from the report
+ // design, then this happens by removing the XShape from the UNO DrawPage, and
+ // putting this XShape (resp. the ReportComponent which wraps it) into an UNDO
+ // action.
+ // Unfortunately, the SvxDrawPage implementation usually deletes SdrObjects
+ // which are removed from it, which is deadly for us. To prevent this,
+ // we give the XShape implementation the ownership of the SdrObject, which
+ // ensures the SvxDrawPage won't delete it.
+ SvxShape* pShape = SvxShape::getImplementation( _rxShape );
+ OSL_ENSURE( pShape, "OObjectBase::ensureSdrObjectOwnership: can't access the SvxShape!" );
+ if ( pShape )
+ {
+ OSL_ENSURE( !pShape->HasSdrObjectOwnership(), "OObjectBase::ensureSdrObjectOwnership: called twice?" );
+ pShape->TakeSdrObjectOwnership();
+ }
+}
+
+//----------------------------------------------------------------------------
+uno::Reference< uno::XInterface > OObjectBase::getUnoShapeOf( SdrObject& _rSdrObject )
+{
+ uno::Reference< uno::XInterface > xShape( _rSdrObject.getWeakUnoShape() );
+ if ( xShape.is() )
+ return xShape;
+
+ xShape = _rSdrObject.SdrObject::getUnoShape();
+ if ( !xShape.is() )
+ return xShape;
+
+ ensureSdrObjectOwnership( xShape );
+
+ m_xKeepShapeAlive = xShape;
+ return xShape;
+}
+
+//----------------------------------------------------------------------------
+TYPEINIT1(OCustomShape, SdrObjCustomShape);
+DBG_NAME( rpt_OCustomShape );
+OCustomShape::OCustomShape(const uno::Reference< report::XReportComponent>& _xComponent
+ )
+ :SdrObjCustomShape()
+ ,OObjectBase(_xComponent)
+{
+ DBG_CTOR( rpt_OCustomShape, NULL);
+ impl_setUnoShape( uno::Reference< uno::XInterface >(_xComponent,uno::UNO_QUERY) );
+ m_bIsListening = sal_True;
+}
+//----------------------------------------------------------------------------
+OCustomShape::OCustomShape(const ::rtl::OUString& _sComponentName)
+ :SdrObjCustomShape()
+ ,OObjectBase(_sComponentName)
+{
+ DBG_CTOR( rpt_OCustomShape, NULL);
+ m_bIsListening = sal_True;
+}
+
+//----------------------------------------------------------------------------
+OCustomShape::~OCustomShape()
+{
+ DBG_DTOR( rpt_OCustomShape, NULL);
+}
+// -----------------------------------------------------------------------------
+UINT16 OCustomShape::GetObjIdentifier() const
+{
+ return UINT16(OBJ_CUSTOMSHAPE);
+}
+//----------------------------------------------------------------------------
+UINT32 OCustomShape::GetObjInventor() const
+{
+ return ReportInventor;
+}
+//----------------------------------------------------------------------------
+SdrPage* OCustomShape::GetImplPage() const
+{
+ return GetPage();
+}
+//----------------------------------------------------------------------------
+void OCustomShape::SetSnapRectImpl(const Rectangle& _rRect)
+{
+ SetSnapRect( _rRect );
+}
+//----------------------------------------------------------------------------
+sal_Int32 OCustomShape::GetStep() const
+{
+ // get step property
+ sal_Int32 nStep = 0;
+ OSL_ENSURE(0,"Who called me!");
+ return nStep;
+}
+//----------------------------------------------------------------------------
+void OCustomShape::NbcMove( const Size& rSize )
+{
+ if ( m_bIsListening )
+ {
+ m_bIsListening = sal_False;
+
+ if ( m_xReportComponent.is() )
+ {
+ OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
+ OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
+ m_xReportComponent->setPositionX(m_xReportComponent->getPositionX() + rSize.A());
+ m_xReportComponent->setPositionY(m_xReportComponent->getPositionY() + rSize.B());
+ }
+
+ // set geometry properties
+ SetPropsFromRect(GetSnapRect());
+
+ m_bIsListening = sal_True;
+ }
+ else
+ SdrObjCustomShape::NbcMove( rSize );
+}
+//----------------------------------------------------------------------------
+void OCustomShape::NbcResize(const Point& rRef, const Fraction& xFract, const Fraction& yFract)
+{
+ SdrObjCustomShape::NbcResize( rRef, xFract, yFract );
+
+ SetPropsFromRect(GetSnapRect());
+}
+//----------------------------------------------------------------------------
+void OCustomShape::NbcSetLogicRect(const Rectangle& rRect)
+{
+ SdrObjCustomShape::NbcSetLogicRect(rRect);
+ SetPropsFromRect(rRect);
+}
+//----------------------------------------------------------------------------
+FASTBOOL OCustomShape::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
+{
+ FASTBOOL bResult = SdrObjCustomShape::EndCreate(rStat, eCmd);
+ if ( bResult )
+ {
+ OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
+ if ( pRptModel )
+ {
+ OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
+ if ( !m_xReportComponent.is() )
+ m_xReportComponent.set(getUnoShape(),uno::UNO_QUERY);
+ }
+ SetPropsFromRect(GetSnapRect());
+ }
+
+ return bResult;
+}
+
+//----------------------------------------------------------------------------
+void OCustomShape::SetObjectItemHelper(const SfxPoolItem& rItem)
+{
+ SetObjectItem(rItem);
+ // TODO
+ //getSectionWindow()->getView()->AdjustMarkHdl();
+}
+
+// -----------------------------------------------------------------------------
+uno::Reference< beans::XPropertySet> OCustomShape::getAwtComponent()
+{
+ return uno::Reference< beans::XPropertySet>(m_xReportComponent,uno::UNO_QUERY);
+}
+
+//----------------------------------------------------------------------------
+uno::Reference< uno::XInterface > OCustomShape::getUnoShape()
+{
+ uno::Reference< uno::XInterface> xShape = OObjectBase::getUnoShapeOf( *this );
+ if ( !m_xReportComponent.is() )
+ {
+ OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
+ OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
+ m_xReportComponent.set(xShape,uno::UNO_QUERY);
+ }
+ return xShape;
+}
+
+//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+TYPEINIT1(OUnoObject, SdrUnoObj);
+DBG_NAME( rpt_OUnoObject );
+//----------------------------------------------------------------------------
+OUnoObject::OUnoObject(const ::rtl::OUString& _sComponentName
+ ,const ::rtl::OUString& rModelName
+ ,sal_uInt16 _nObjectType)
+ :SdrUnoObj(rModelName, sal_True)
+ ,OObjectBase(_sComponentName)
+ ,m_nObjectType(_nObjectType)
+{
+ DBG_CTOR( rpt_OUnoObject, NULL);
+ if ( rModelName.getLength() )
+ impl_initializeModel_nothrow();
+}
+//----------------------------------------------------------------------------
+OUnoObject::OUnoObject(const uno::Reference< report::XReportComponent>& _xComponent
+ ,const ::rtl::OUString& rModelName
+ ,sal_uInt16 _nObjectType)
+ :SdrUnoObj(rModelName, sal_True)
+ ,OObjectBase(_xComponent)
+ ,m_nObjectType(_nObjectType)
+{
+ DBG_CTOR( rpt_OUnoObject, NULL);
+ impl_setUnoShape( uno::Reference< uno::XInterface >( _xComponent, uno::UNO_QUERY ) );
+
+ if ( rModelName.getLength() )
+ impl_initializeModel_nothrow();
+
+ if ( rModelName.getLength() )
+ impl_initializeModel_nothrow();
+}
+//----------------------------------------------------------------------------
+OUnoObject::~OUnoObject()
+{
+ DBG_DTOR( rpt_OUnoObject, NULL);
+}
+// -----------------------------------------------------------------------------
+void OUnoObject::impl_initializeModel_nothrow()
+{
+ try
+ {
+ Reference< XFormattedField > xFormatted( m_xReportComponent, UNO_QUERY );
+ if ( xFormatted.is() )
+ {
+ const Reference< XPropertySet > xModelProps( GetUnoControlModel(), UNO_QUERY_THROW );
+ const ::rtl::OUString sTreatAsNumberProperty = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TreatAsNumber" ) );
+ xModelProps->setPropertyValue( sTreatAsNumberProperty, makeAny( sal_False ) );
+ xModelProps->setPropertyValue( PROPERTY_VERTICALALIGN,m_xReportComponent->getPropertyValue(PROPERTY_VERTICALALIGN));
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+// -----------------------------------------------------------------------------
+void OUnoObject::impl_setReportComponent_nothrow()
+{
+ if ( m_xReportComponent.is() )
+ return;
+
+ OReportModel* pReportModel = static_cast<OReportModel*>(GetModel());
+ OSL_ENSURE( pReportModel, "OUnoObject::impl_setReportComponent_nothrow: no report model!" );
+ if ( !pReportModel )
+ return;
+
+ OXUndoEnvironment::OUndoEnvLock aLock( pReportModel->GetUndoEnv() );
+ m_xReportComponent.set(getUnoShape(),uno::UNO_QUERY);
+
+ impl_initializeModel_nothrow();
+}
+// -----------------------------------------------------------------------------
+UINT16 OUnoObject::GetObjIdentifier() const
+{
+ return UINT16(m_nObjectType);
+}
+//----------------------------------------------------------------------------
+UINT32 OUnoObject::GetObjInventor() const
+{
+ return ReportInventor;
+}
+//----------------------------------------------------------------------------
+SdrPage* OUnoObject::GetImplPage() const
+{
+ DBG_CHKTHIS( rpt_OUnoObject,NULL);
+ return GetPage();
+}
+//----------------------------------------------------------------------------
+void OUnoObject::SetSnapRectImpl(const Rectangle& _rRect)
+{
+ DBG_CHKTHIS( rpt_OUnoObject,NULL);
+ SetSnapRect( _rRect );
+}
+//----------------------------------------------------------------------------
+sal_Int32 OUnoObject::GetStep() const
+{
+ DBG_CHKTHIS( rpt_OUnoObject,NULL);
+ // get step property
+ sal_Int32 nStep = 0;
+ OSL_ENSURE(0,"Who called me!");
+ return nStep;
+}
+
+//----------------------------------------------------------------------------
+void OUnoObject::NbcMove( const Size& rSize )
+{
+ DBG_CHKTHIS( rpt_OUnoObject,NULL);
+
+ if ( m_bIsListening )
+ {
+ // stop listening
+ OObjectBase::EndListening(sal_False);
+
+ bool bPositionFixed = false;
+ Size aUndoSize(0,0);
+ bool bUndoMode = false;
+ if ( m_xReportComponent.is() )
+ {
+ OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
+ if (pRptModel->GetUndoEnv().IsUndoMode())
+ {
+ // if we are locked from outside, then we must not handle wrong moves, we are in UNDO mode
+ bUndoMode = true;
+ }
+ OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
+
+ // LLA: why there exists getPositionX and getPositionY and NOT getPosition() which return a Point?
+ int nNewX = m_xReportComponent->getPositionX() + rSize.A();
+ // can this hinder us to set components outside the area?
+ // if (nNewX < 0)
+ // {
+ // nNewX = 0;
+ // }
+ m_xReportComponent->setPositionX(nNewX);
+ int nNewY = m_xReportComponent->getPositionY() + rSize.B();
+ if (nNewY < 0 && !bUndoMode)
+ {
+ aUndoSize.B() = abs(nNewY);
+ bPositionFixed = true;
+ nNewY = 0;
+ }
+ m_xReportComponent->setPositionY(nNewY);
+ }
+ if (bPositionFixed)
+ {
+ // OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
+ // if ( pRptModel )
+ // {
+ // if (! pRptModel->GetUndoEnv().IsLocked())
+ // {
+ GetModel()->AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*this, aUndoSize));
+ // }
+ // }
+ }
+ // set geometry properties
+ SetPropsFromRect(GetLogicRect());
+
+ // start listening
+ OObjectBase::StartListening();
+ }
+ else
+ SdrUnoObj::NbcMove( rSize );
+}
+
+//----------------------------------------------------------------------------
+
+void OUnoObject::NbcResize(const Point& rRef, const Fraction& xFract, const Fraction& yFract)
+{
+ DBG_CHKTHIS( rpt_OUnoObject,NULL);
+ SdrUnoObj::NbcResize( rRef, xFract, yFract );
+
+ // stop listening
+ OObjectBase::EndListening(sal_False);
+
+ // set geometry properties
+ SetPropsFromRect(GetLogicRect());
+
+ // start listening
+ OObjectBase::StartListening();
+}
+//----------------------------------------------------------------------------
+void OUnoObject::NbcSetLogicRect(const Rectangle& rRect)
+{
+ SdrUnoObj::NbcSetLogicRect(rRect);
+ // stop listening
+ OObjectBase::EndListening(sal_False);
+
+ // set geometry properties
+ SetPropsFromRect(rRect);
+
+ // start listening
+ OObjectBase::StartListening();
+}
+//----------------------------------------------------------------------------
+
+FASTBOOL OUnoObject::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
+{
+ DBG_CHKTHIS( rpt_OUnoObject,NULL);
+ FASTBOOL bResult = SdrUnoObj::EndCreate(rStat, eCmd);
+ if ( bResult )
+ {
+ impl_setReportComponent_nothrow();
+ // set labels
+ if ( m_xReportComponent.is() )
+ {
+ try
+ {
+ if ( supportsService( SERVICE_FIXEDTEXT ) )
+ {
+ m_xReportComponent->setPropertyValue( PROPERTY_LABEL, uno::makeAny(GetDefaultName(this)) );
+ }
+ }
+ catch(const uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ impl_initializeModel_nothrow();
+ }
+ // set geometry properties
+ SetPropsFromRect(GetLogicRect());
+ }
+
+ return bResult;
+}
+//----------------------------------------------------------------------------
+::rtl::OUString OUnoObject::GetDefaultName(const OUnoObject* _pObj)
+{
+ sal_uInt16 nResId = 0;
+ ::rtl::OUString aDefaultName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HERE WE HAVE TO INSERT OUR NAME!"));
+ if ( _pObj->supportsService( SERVICE_FIXEDTEXT ) )
+ {
+ nResId = RID_STR_CLASS_FIXEDTEXT;
+ }
+ else if ( _pObj->supportsService( SERVICE_FIXEDLINE ) )
+ {
+ nResId = RID_STR_CLASS_FIXEDLINE;
+ }
+ else if ( _pObj->supportsService( SERVICE_IMAGECONTROL ) )
+ {
+ nResId = RID_STR_CLASS_IMAGECONTROL;
+ }
+ else if ( _pObj->supportsService( SERVICE_FORMATTEDFIELD ) )
+ {
+ nResId = RID_STR_CLASS_FORMATTEDFIELD;
+ }
+
+ if (nResId)
+ aDefaultName = ::rtl::OUString( String(ModuleRes(nResId)) );
+
+ return aDefaultName;
+}
+
+// -----------------------------------------------------------------------------
+void OUnoObject::_propertyChange( const beans::PropertyChangeEvent& evt ) throw( uno::RuntimeException)
+{
+ DBG_CHKTHIS( rpt_OUnoObject,NULL);
+ OObjectBase::_propertyChange(evt);
+ if (isListening())
+ {
+ if ( evt.PropertyName == PROPERTY_CHARCOLOR )
+ {
+ Reference<XPropertySet> xControlModel(GetUnoControlModel(),uno::UNO_QUERY);
+ if ( xControlModel.is() )
+ {
+ OObjectBase::EndListening(sal_False);
+ try
+ {
+ xControlModel->setPropertyValue(PROPERTY_TEXTCOLOR,evt.NewValue);
+ }
+ catch(uno::Exception&)
+ {
+ }
+ OObjectBase::StartListening();
+ }
+ }
+ else if ( evt.PropertyName == PROPERTY_NAME )
+ {
+ Reference<XPropertySet> xControlModel(GetUnoControlModel(),uno::UNO_QUERY);
+ if ( xControlModel.is() && xControlModel->getPropertySetInfo()->hasPropertyByName(PROPERTY_NAME) )
+ {
+ // get old name
+ ::rtl::OUString aOldName;
+ evt.OldValue >>= aOldName;
+
+ // get new name
+ ::rtl::OUString aNewName;
+ evt.NewValue >>= aNewName;
+
+ if ( !aNewName.equals(aOldName) )
+ {
+ // set old name property
+ OObjectBase::EndListening(sal_False);
+ if ( m_xMediator.is() )
+ m_xMediator.get()->stopListening();
+ try
+ {
+ xControlModel->setPropertyValue( PROPERTY_NAME, evt.NewValue );
+ }
+ catch(uno::Exception&)
+ {
+ }
+ if ( m_xMediator.is() )
+ m_xMediator.get()->startListening();
+ OObjectBase::StartListening();
+ }
+ }
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void OUnoObject::CreateMediator(sal_Bool _bReverse)
+{
+ if ( !m_xMediator.is() )
+ {
+ impl_setReportComponent_nothrow();
+
+ Reference<XPropertySet> xControlModel(GetUnoControlModel(),uno::UNO_QUERY);
+ if ( !m_xMediator.is() && m_xReportComponent.is() && xControlModel.is() )
+ m_xMediator = TMediator::createFromQuery(new OPropertyMediator(m_xReportComponent.get(),xControlModel,getPropertyNameMap(GetObjIdentifier()),_bReverse));
+ OObjectBase::StartListening();
+ }
+}
+// -----------------------------------------------------------------------------
+uno::Reference< beans::XPropertySet> OUnoObject::getAwtComponent()
+{
+ return Reference<XPropertySet>(GetUnoControlModel(),uno::UNO_QUERY);
+}
+
+// -----------------------------------------------------------------------------
+uno::Reference< uno::XInterface > OUnoObject::getUnoShape()
+{
+ return OObjectBase::getUnoShapeOf( *this );
+}
+// -----------------------------------------------------------------------------
+SdrObject* OUnoObject::Clone() const
+{
+ SdrObject* pClone = SdrUnoObj::Clone();
+ if ( pClone )
+ {
+ Reference<XPropertySet> xSource(const_cast<OUnoObject*>(this)->getUnoShape(),uno::UNO_QUERY);
+ Reference<XPropertySet> xDest(pClone->getUnoShape(),uno::UNO_QUERY);
+ if ( xSource.is() && xDest.is() )
+ comphelper::copyProperties(xSource.get(),xDest.get());
+ } // if ( pClone )
+ return pClone;
+}
+//----------------------------------------------------------------------------
+// OOle2Obj
+//----------------------------------------------------------------------------
+TYPEINIT1(OOle2Obj, SdrOle2Obj);
+DBG_NAME( rpt_OOle2Obj );
+OOle2Obj::OOle2Obj(const uno::Reference< report::XReportComponent>& _xComponent,UINT16 _nType)
+ :SdrOle2Obj()
+ ,OObjectBase(_xComponent)
+ ,m_nType(_nType)
+ ,m_bOnlyOnce(true)
+{
+ DBG_CTOR( rpt_OOle2Obj, NULL);
+
+ impl_setUnoShape( uno::Reference< uno::XInterface >( _xComponent, uno::UNO_QUERY ) );
+ m_bIsListening = sal_True;
+}
+//----------------------------------------------------------------------------
+OOle2Obj::OOle2Obj(const ::rtl::OUString& _sComponentName,UINT16 _nType)
+ :SdrOle2Obj()
+ ,OObjectBase(_sComponentName)
+ ,m_nType(_nType)
+ ,m_bOnlyOnce(true)
+{
+ DBG_CTOR( rpt_OOle2Obj, NULL);
+ m_bIsListening = sal_True;
+}
+//----------------------------------------------------------------------------
+OOle2Obj::~OOle2Obj()
+{
+ DBG_DTOR( rpt_OOle2Obj, NULL);
+}
+// -----------------------------------------------------------------------------
+UINT16 OOle2Obj::GetObjIdentifier() const
+{
+ return m_nType;
+}
+//----------------------------------------------------------------------------
+UINT32 OOle2Obj::GetObjInventor() const
+{
+ return ReportInventor;
+}
+//----------------------------------------------------------------------------
+SdrPage* OOle2Obj::GetImplPage() const
+{
+ DBG_CHKTHIS( rpt_OOle2Obj,NULL);
+ return GetPage();
+}
+//----------------------------------------------------------------------------
+void OOle2Obj::SetSnapRectImpl(const Rectangle& _rRect)
+{
+ DBG_CHKTHIS( rpt_OOle2Obj,NULL);
+ SetSnapRect( _rRect );
+}
+//----------------------------------------------------------------------------
+sal_Int32 OOle2Obj::GetStep() const
+{
+ DBG_CHKTHIS( rpt_OOle2Obj,NULL);
+ // get step property
+ sal_Int32 nStep = 0;
+ OSL_ENSURE(0,"Who called me!");
+ return nStep;
+}
+
+//----------------------------------------------------------------------------
+void OOle2Obj::NbcMove( const Size& rSize )
+{
+ DBG_CHKTHIS( rpt_OOle2Obj,NULL);
+
+ if ( m_bIsListening )
+ {
+ // stop listening
+ OObjectBase::EndListening(sal_False);
+
+ if ( m_xReportComponent.is() )
+ {
+ OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
+ OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
+ m_xReportComponent->setPositionX(m_xReportComponent->getPositionX() + rSize.A());
+ m_xReportComponent->setPositionY(m_xReportComponent->getPositionY() + rSize.B());
+ }
+
+ // set geometry properties
+ SetPropsFromRect(GetLogicRect());
+
+ // start listening
+ OObjectBase::StartListening();
+ }
+ else
+ SdrOle2Obj::NbcMove( rSize );
+}
+
+//----------------------------------------------------------------------------
+
+void OOle2Obj::NbcResize(const Point& rRef, const Fraction& xFract, const Fraction& yFract)
+{
+ DBG_CHKTHIS( rpt_OOle2Obj,NULL);
+ SdrOle2Obj::NbcResize( rRef, xFract, yFract );
+
+ // stop listening
+ OObjectBase::EndListening(sal_False);
+
+ // set geometry properties
+ SetPropsFromRect(GetLogicRect());
+
+ // start listening
+ OObjectBase::StartListening();
+}
+//----------------------------------------------------------------------------
+void OOle2Obj::NbcSetLogicRect(const Rectangle& rRect)
+{
+ SdrOle2Obj::NbcSetLogicRect(rRect);
+ // stop listening
+ OObjectBase::EndListening(sal_False);
+
+ // set geometry properties
+ SetPropsFromRect(rRect);
+
+ // start listening
+ OObjectBase::StartListening();
+}
+//----------------------------------------------------------------------------
+
+FASTBOOL OOle2Obj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
+{
+ DBG_CHKTHIS( rpt_OOle2Obj,NULL);
+ FASTBOOL bResult = SdrOle2Obj::EndCreate(rStat, eCmd);
+ if ( bResult )
+ {
+ OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
+ if ( pRptModel )
+ {
+ OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
+ if ( !m_xReportComponent.is() )
+ m_xReportComponent.set(getUnoShape(),uno::UNO_QUERY);
+ }
+ // set geometry properties
+ SetPropsFromRect(GetLogicRect());
+ }
+
+ return bResult;
+}
+
+uno::Reference< beans::XPropertySet> OOle2Obj::getAwtComponent()
+{
+ return uno::Reference< beans::XPropertySet>(m_xReportComponent,uno::UNO_QUERY);
+}
+
+// -----------------------------------------------------------------------------
+uno::Reference< uno::XInterface > OOle2Obj::getUnoShape()
+{
+ uno::Reference< uno::XInterface> xShape = OObjectBase::getUnoShapeOf( *this );
+ if ( !m_xReportComponent.is() )
+ {
+ OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
+ OXUndoEnvironment::OUndoEnvLock aLock(pRptModel->GetUndoEnv());
+ m_xReportComponent.set(xShape,uno::UNO_QUERY);
+ }
+ return xShape;
+}
+// -----------------------------------------------------------------------------
+uno::Reference< chart2::data::XDatabaseDataProvider > lcl_getDataProvider(const uno::Reference < embed::XEmbeddedObject >& _xObj)
+{
+ uno::Reference< chart2::data::XDatabaseDataProvider > xSource;
+ uno::Reference< embed::XComponentSupplier > xCompSupp(_xObj,uno::UNO_QUERY);
+ if( xCompSupp.is())
+ {
+ uno::Reference< chart2::XChartDocument> xChartDoc( xCompSupp->getComponent(), uno::UNO_QUERY );
+ if ( xChartDoc.is() )
+ {
+ xSource.set(xChartDoc->getDataProvider(),uno::UNO_QUERY);
+ }
+ } // if( xCompSupp.is())
+ return xSource;
+}
+// -----------------------------------------------------------------------------
+// Clone() soll eine komplette Kopie des Objektes erzeugen.
+SdrObject* OOle2Obj::Clone() const
+{
+ OOle2Obj* pObj = static_cast<OOle2Obj*>(SdrOle2Obj::Clone());
+ OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
+ svt::EmbeddedObjectRef::TryRunningState( pObj->GetObjRef() );
+ pObj->impl_createDataProvider_nothrow(pRptModel->getReportDefinition().get());
+
+ uno::Reference< chart2::data::XDatabaseDataProvider > xSource( lcl_getDataProvider(GetObjRef()) );
+ uno::Reference< chart2::data::XDatabaseDataProvider > xDest( lcl_getDataProvider(pObj->GetObjRef()) );
+ if ( xSource.is() && xDest.is() )
+ comphelper::copyProperties(xSource.get(),xDest.get());
+
+ pObj->initializeChart(pRptModel->getReportDefinition().get());
+ return pObj;
+}
+// -----------------------------------------------------------------------------
+void OOle2Obj::impl_createDataProvider_nothrow(const uno::Reference< frame::XModel>& _xModel)
+{
+ try
+ {
+ uno::Reference < embed::XEmbeddedObject > xObj = GetObjRef();
+ uno::Reference< chart2::data::XDataReceiver > xReceiver;
+ uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY );
+ if( xCompSupp.is())
+ xReceiver.set( xCompSupp->getComponent(), uno::UNO_QUERY );
+ OSL_ASSERT( xReceiver.is());
+ if( xReceiver.is() )
+ {
+ uno::Reference< lang::XMultiServiceFactory> xFac(_xModel,uno::UNO_QUERY);
+ uno::Reference< chart2::data::XDatabaseDataProvider > xDataProvider( xFac->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.data.DataProvider"))),uno::UNO_QUERY);
+ xReceiver->attachDataProvider( xDataProvider.get() );
+ } // if( xReceiver.is() )
+ }
+ catch(uno::Exception)
+ {
+ }
+}
+// -----------------------------------------------------------------------------
+void OOle2Obj::initializeOle()
+{
+ if ( m_bOnlyOnce )
+ {
+ m_bOnlyOnce = false;
+ uno::Reference < embed::XEmbeddedObject > xObj = GetObjRef();
+ OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
+ pRptModel->GetUndoEnv().AddElement(lcl_getDataProvider(xObj));
+
+ uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY );
+ if( xCompSupp.is() )
+ {
+ uno::Reference< beans::XPropertySet > xChartProps( xCompSupp->getComponent(), uno::UNO_QUERY );
+ if ( xChartProps.is() )
+ xChartProps->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NullDate")),uno::makeAny(util::DateTime(0,0,0,0,1,1,1900)));
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void OOle2Obj::initializeChart( const uno::Reference< frame::XModel>& _xModel)
+{
+ uno::Reference < embed::XEmbeddedObject > xObj = GetObjRef();
+ uno::Reference< chart2::data::XDataReceiver > xReceiver;
+ uno::Reference< embed::XComponentSupplier > xCompSupp( xObj, uno::UNO_QUERY );
+ if( xCompSupp.is())
+ xReceiver.set( xCompSupp->getComponent(), uno::UNO_QUERY );
+ OSL_ASSERT( xReceiver.is());
+ if( xReceiver.is() )
+ {
+ // lock the model to suppress any internal updates
+ uno::Reference< frame::XModel > xChartModel( xReceiver, uno::UNO_QUERY );
+ if( xChartModel.is() )
+ xChartModel->lockControllers();
+
+ if ( !lcl_getDataProvider(xObj).is() )
+ impl_createDataProvider_nothrow(_xModel);
+
+ OReportModel* pRptModel = static_cast<OReportModel*>(GetModel());
+ pRptModel->GetUndoEnv().AddElement(lcl_getDataProvider(xObj));
+
+ uno::Sequence< beans::PropertyValue > aArgs( 4 );
+ aArgs[0] = beans::PropertyValue(
+ ::rtl::OUString::createFromAscii("CellRangeRepresentation"), -1,
+ uno::makeAny( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("all")) ), beans::PropertyState_DIRECT_VALUE );
+ aArgs[1] = beans::PropertyValue(
+ ::rtl::OUString::createFromAscii("HasCategories"), -1,
+ uno::makeAny( sal_True ), beans::PropertyState_DIRECT_VALUE );
+ aArgs[2] = beans::PropertyValue(
+ ::rtl::OUString::createFromAscii("FirstCellAsLabel"), -1,
+ uno::makeAny( sal_True ), beans::PropertyState_DIRECT_VALUE );
+ aArgs[3] = beans::PropertyValue(
+ ::rtl::OUString::createFromAscii("DataRowSource"), -1,
+ uno::makeAny( chart::ChartDataRowSource_COLUMNS ), beans::PropertyState_DIRECT_VALUE );
+ xReceiver->setArguments( aArgs );
+
+ if( xChartModel.is() )
+ xChartModel->unlockControllers();
+ }
+}
+// -----------------------------------------------------------------------------
+uno::Reference< style::XStyle> getUsedStyle(const uno::Reference< report::XReportDefinition>& _xReport)
+{
+ uno::Reference<container::XNameAccess> xStyles = _xReport->getStyleFamilies();
+ uno::Reference<container::XNameAccess> xPageStyles(xStyles->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PageStyles"))),uno::UNO_QUERY);
+
+ uno::Reference< style::XStyle> xReturn;
+ uno::Sequence< ::rtl::OUString> aSeq = xPageStyles->getElementNames();
+ const ::rtl::OUString* pIter = aSeq.getConstArray();
+ const ::rtl::OUString* pEnd = pIter + aSeq.getLength();
+ for(;pIter != pEnd && !xReturn.is() ;++pIter)
+ {
+ uno::Reference< style::XStyle> xStyle(xPageStyles->getByName(*pIter),uno::UNO_QUERY);
+ if ( xStyle->isInUse() )
+ xReturn = xStyle;
+ }
+ return xReturn;
+}
+//----------------------------------------------------------------------------
+//============================================================================
+} // rptui
+//============================================================================
diff --git a/reportdesign/source/core/sdr/RptObjectListener.cxx b/reportdesign/source/core/sdr/RptObjectListener.cxx
new file mode 100644
index 000000000000..64cd9d3dc8a3
--- /dev/null
+++ b/reportdesign/source/core/sdr/RptObjectListener.cxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * 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 "RptObjectListener.hxx"
+#include "RptObject.hxx"
+#include "RptDef.hxx"
+
+namespace rptui
+{
+//============================================================================
+// OObjectListener
+//============================================================================
+
+//----------------------------------------------------------------------------
+DBG_NAME(rpt_OObjectListener)
+OObjectListener::OObjectListener(OObjectBase* _pObject)
+ :m_pObject(_pObject)
+{
+ DBG_CTOR(rpt_OObjectListener,NULL);
+}
+
+//----------------------------------------------------------------------------
+
+OObjectListener::~OObjectListener()
+{
+ DBG_DTOR(rpt_OObjectListener,NULL);
+}
+
+// XEventListener
+//----------------------------------------------------------------------------
+
+void SAL_CALL OObjectListener::disposing( const ::com::sun::star::lang::EventObject& ) throw( ::com::sun::star::uno::RuntimeException)
+{
+ /*
+ // disconnect the listener
+ if (m_pObject)
+ {
+ (m_pObject->m_xPropertyChangeListener).clear();
+ }
+ */
+}
+
+// XPropertyChangeListener
+//----------------------------------------------------------------------------
+
+void SAL_CALL OObjectListener::propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException)
+{
+ m_pObject->_propertyChange( evt );
+}
+
+//----------------------------------------------------------------------------
+
+//============================================================================
+// DlgEdHint
+//============================================================================
+
+TYPEINIT1( DlgEdHint, SfxHint );
+
+//----------------------------------------------------------------------------
+
+DlgEdHint::DlgEdHint( DlgEdHintKind eHint )
+ :eHintKind( eHint )
+{
+}
+
+//----------------------------------------------------------------------------
+DlgEdHint::~DlgEdHint()
+{
+}
+//----------------------------------------------------------------------------
+}
diff --git a/reportdesign/source/core/sdr/RptPage.cxx b/reportdesign/source/core/sdr/RptPage.cxx
new file mode 100644
index 000000000000..29f1109aeb6b
--- /dev/null
+++ b/reportdesign/source/core/sdr/RptPage.cxx
@@ -0,0 +1,251 @@
+/*************************************************************************
+ *
+ * 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 "RptPage.hxx"
+#include "RptModel.hxx"
+#include "Section.hxx"
+#include "RptObject.hxx"
+#include <svx/unoapi.hxx>
+#include <svx/unoshape.hxx>
+#include "ReportDrawPage.hxx"
+
+namespace rptui
+{
+using namespace ::com::sun::star;
+TYPEINIT1( OReportPage, SdrPage );
+
+//----------------------------------------------------------------------------
+DBG_NAME( rpt_OReportPage )
+OReportPage::OReportPage( OReportModel& _rModel
+ ,const uno::Reference< report::XSection >& _xSection
+ ,FASTBOOL bMasterPage )
+ :SdrPage( _rModel, bMasterPage )
+ ,rModel(_rModel)
+ ,m_xSection(_xSection)
+ ,m_bSpecialInsertMode(false)
+{
+ DBG_CTOR( rpt_OReportPage,NULL);
+}
+
+//----------------------------------------------------------------------------
+
+OReportPage::OReportPage( const OReportPage& rPage )
+ :SdrPage( rPage )
+ ,rModel(rPage.rModel)
+ ,m_xSection(rPage.m_xSection)
+ ,m_bSpecialInsertMode(rPage.m_bSpecialInsertMode)
+ ,m_aTemporaryObjectList(rPage.m_aTemporaryObjectList)
+{
+ DBG_CTOR( rpt_OReportPage,NULL);
+}
+
+//----------------------------------------------------------------------------
+
+OReportPage::~OReportPage()
+{
+ DBG_DTOR( rpt_OReportPage,NULL);
+}
+
+//----------------------------------------------------------------------------
+
+SdrPage* OReportPage::Clone() const
+{
+ DBG_CHKTHIS( rpt_OReportPage,NULL);
+ return new OReportPage( *this );
+}
+
+//----------------------------------------------------------------------------
+ULONG OReportPage::getIndexOf(const uno::Reference< report::XReportComponent >& _xObject)
+{
+ DBG_CHKTHIS( rpt_OReportPage,NULL);
+ ULONG nCount = GetObjCount();
+ ULONG i = 0;
+ for (; i < nCount; ++i)
+ {
+ OObjectBase* pObj = dynamic_cast<OObjectBase*>(GetObj(i));
+ OSL_ENSURE(pObj,"Invalid object found!");
+ if ( pObj && pObj->getReportComponent() == _xObject )
+ {
+ break;
+ }
+ } // for (; i < nCount; ++i)
+ return i;
+}
+//----------------------------------------------------------------------------
+void OReportPage::removeSdrObject(const uno::Reference< report::XReportComponent >& _xObject)
+{
+ DBG_CHKTHIS( rpt_OReportPage,NULL);
+ ULONG nPos = getIndexOf(_xObject);
+ if ( nPos < GetObjCount() )
+ {
+ OObjectBase* pBase = dynamic_cast<OObjectBase*>(GetObj(nPos));
+ OSL_ENSURE(pBase,"Why is this not a OObjectBase?");
+ if ( pBase )
+ pBase->EndListening();
+ /*delete */RemoveObject(nPos);
+ }
+}
+// -----------------------------------------------------------------------------
+SdrObject* OReportPage::RemoveObject(ULONG nObjNum)
+{
+ SdrObject* pObj = SdrPage::RemoveObject(nObjNum);
+ if (getSpecialMode())
+ {
+ return pObj;
+ }
+
+ // this code is evil, but what else shall I do
+ reportdesign::OSection* pSection = reportdesign::OSection::getImplementation(m_xSection);
+ uno::Reference< drawing::XShape> xShape(pObj->getUnoShape(),uno::UNO_QUERY);
+ pSection->notifyElementRemoved(xShape);
+ if (pObj->ISA(OUnoObject))
+ {
+ OUnoObject* pUnoObj = dynamic_cast<OUnoObject*>(pObj);
+ uno::Reference< container::XChild> xChild(pUnoObj->GetUnoControlModel(),uno::UNO_QUERY);
+ if ( xChild.is() )
+ xChild->setParent(NULL);
+ }
+ return pObj;
+}
+//----------------------------------------------------------------------------
+//namespace
+//{
+// ::rtl::OUString lcl_getControlName(const uno::Reference< lang::XServiceInfo >& _xServiceInfo)
+// {
+// if ( _xServiceInfo->supportsService( SERVICE_FIXEDTEXT ))
+// return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FixedText"));
+// if ( _xServiceInfo->supportsService( SERVICE_FORMATTEDFIELD ))
+// return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FormattedField"));
+// if ( _xServiceInfo->supportsService( SERVICE_IMAGECONTROL))
+// return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.DatabaseImageControl"));
+//
+// return ::rtl::OUString();
+// }
+//}
+//----------------------------------------------------------------------------
+void OReportPage::insertObject(const uno::Reference< report::XReportComponent >& _xObject)
+{
+ DBG_CHKTHIS( rpt_OReportPage,NULL);
+ OSL_ENSURE(_xObject.is(),"Object is not valid to create a SdrObject!");
+ if ( !_xObject.is() ) // || !m_pView )
+ return;
+ ULONG nPos = getIndexOf(_xObject);
+ if ( nPos < GetObjCount() )
+ return; // Object already in list
+
+ SvxShape* pShape = SvxShape::getImplementation( _xObject );
+ OObjectBase* pObject = pShape ? dynamic_cast< OObjectBase* >( pShape->GetSdrObject() ) : NULL;
+ OSL_ENSURE( pObject, "OReportPage::insertObject: no implementation object found for the given shape/component!" );
+ if ( pObject )
+ pObject->StartListening();
+}
+// -----------------------------------------------------------------------------
+uno::Reference< report::XSection > OReportPage::getSection() const
+{
+ return m_xSection;
+}
+// -----------------------------------------------------------------------------
+uno::Reference< uno::XInterface > OReportPage::createUnoPage()
+{
+ return static_cast<cppu::OWeakObject*>( new reportdesign::OReportDrawPage(this,m_xSection) );
+}
+// -----------------------------------------------------------------------------
+void OReportPage::removeTempObject(SdrObject *_pToRemoveObj)
+{
+ if (_pToRemoveObj)
+ {
+ for (ULONG i=0;i<GetObjCount();i++)
+ {
+ SdrObject *aObj = GetObj(i);
+ if (aObj && aObj == _pToRemoveObj)
+ {
+ SdrObject* pObject = RemoveObject(i);
+ (void)pObject;
+ break;
+ // delete pObject;
+ }
+ }
+ }
+}
+
+void OReportPage::resetSpecialMode()
+{
+ const sal_Bool bChanged = rModel.IsChanged();
+ ::std::vector<SdrObject*>::iterator aIter = m_aTemporaryObjectList.begin();
+ ::std::vector<SdrObject*>::iterator aEnd = m_aTemporaryObjectList.end();
+
+ for (; aIter != aEnd; ++aIter)
+ {
+ removeTempObject(*aIter);
+ }
+ m_aTemporaryObjectList.clear();
+ rModel.SetChanged(bChanged);
+
+ m_bSpecialInsertMode = false;
+}
+// -----------------------------------------------------------------------------
+void OReportPage::NbcInsertObject(SdrObject* pObj, ULONG nPos, const SdrInsertReason* pReason)
+{
+ SdrPage::NbcInsertObject(pObj, nPos, pReason);
+
+ OUnoObject* pUnoObj = dynamic_cast< OUnoObject* >( pObj );
+ if (getSpecialMode())
+ {
+ m_aTemporaryObjectList.push_back(pObj);
+ return;
+ }
+
+ if ( pUnoObj )
+ {
+ pUnoObj->CreateMediator();
+ uno::Reference< container::XChild> xChild(pUnoObj->GetUnoControlModel(),uno::UNO_QUERY);
+ if ( xChild.is() && !xChild->getParent().is() )
+ xChild->setParent(m_xSection);
+ }
+
+ // this code is evil, but what else shall I do
+ reportdesign::OSection* pSection = reportdesign::OSection::getImplementation(m_xSection);
+ uno::Reference< drawing::XShape> xShape(pObj->getUnoShape(),uno::UNO_QUERY);
+ pSection->notifyElementAdded(xShape);
+
+ //// check if we are a shape
+ //uno::Reference<beans::XPropertySet> xProp(xShape,uno::UNO_QUERY);
+ //if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID"))) )
+ //{
+ // // use MimeConfigurationHelper::GetStringClassIDRepresentation(MimeConfigurationHelper::GetSequenceClassID(SO3_SCH_OLE_EMBED_CLASSID_8))
+ // xProp->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID")),uno::makeAny(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("12dcae26-281f-416f-a234-c3086127382e"))));
+ //}
+
+ // now that the shape is inserted into its structures, we can allow the OObjectBase
+ // to release the reference to it
+ OObjectBase* pObjectBase = dynamic_cast< OObjectBase* >( pObj );
+ OSL_ENSURE( pObjectBase, "OReportPage::NbcInsertObject: what is being inserted here?" );
+ if ( pObjectBase )
+ pObjectBase->releaseUnoShape();
+}
+//============================================================================
+} // rptui
+//============================================================================
diff --git a/reportdesign/source/core/sdr/UndoActions.cxx b/reportdesign/source/core/sdr/UndoActions.cxx
new file mode 100644
index 000000000000..d58fe62e974d
--- /dev/null
+++ b/reportdesign/source/core/sdr/UndoActions.cxx
@@ -0,0 +1,449 @@
+/*************************************************************************
+ *
+ * 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 "UndoActions.hxx"
+#include "UndoEnv.hxx"
+#include "formatnormalizer.hxx"
+#include "conditionupdater.hxx"
+#include "corestrings.hrc"
+#include "rptui_slotid.hrc"
+#include "RptDef.hxx"
+#include "ModuleHelper.hxx"
+#include "RptObject.hxx"
+#include "RptPage.hxx"
+#include "RptResId.hrc"
+#include "RptModel.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/script/XEventAttacherManager.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+/** === end UNO includes === **/
+
+#include <connectivity/dbtools.hxx>
+#include <svl/smplhint.hxx>
+#include <tools/diagnose_ex.h>
+#include <comphelper/stl_types.hxx>
+#include <vcl/svapp.hxx>
+#include <dbaccess/singledoccontroller.hxx>
+#include <svx/unoshape.hxx>
+#include <vos/mutex.hxx>
+
+namespace rptui
+{
+ using namespace ::com::sun::star;
+ using namespace uno;
+ using namespace lang;
+ using namespace script;
+ using namespace beans;
+ using namespace awt;
+ using namespace util;
+ using namespace container;
+ using namespace report;
+//----------------------------------------------------------------------------
+::std::mem_fun_t<uno::Reference<report::XSection> , OGroupHelper> OGroupHelper::getMemberFunction(const Reference< XSection >& _xSection)
+{
+ ::std::mem_fun_t<uno::Reference<report::XSection> , OGroupHelper> pMemFunSection = ::std::mem_fun(&OGroupHelper::getFooter);
+ uno::Reference< report::XGroup> xGroup = _xSection->getGroup();
+ if ( xGroup->getHeaderOn() && xGroup->getHeader() == _xSection )
+ pMemFunSection = ::std::mem_fun(&OGroupHelper::getHeader);
+ return pMemFunSection;
+}
+// -----------------------------------------------------------------------------
+::std::mem_fun_t<uno::Reference<report::XSection> , OReportHelper> OReportHelper::getMemberFunction(const Reference< XSection >& _xSection)
+{
+ uno::Reference< report::XReportDefinition> xReportDefinition(_xSection->getReportDefinition());
+ ::std::mem_fun_t<uno::Reference<report::XSection> , OReportHelper> pMemFunSection = ::std::mem_fun(&OReportHelper::getReportFooter);
+ if ( xReportDefinition->getReportHeaderOn() && xReportDefinition->getReportHeader() == _xSection )
+ pMemFunSection = ::std::mem_fun(&OReportHelper::getReportHeader);
+ else if ( xReportDefinition->getPageHeaderOn() && xReportDefinition->getPageHeader() == _xSection )
+ pMemFunSection = ::std::mem_fun(&OReportHelper::getPageHeader);
+ else if ( xReportDefinition->getPageFooterOn() && xReportDefinition->getPageFooter() == _xSection )
+ pMemFunSection = ::std::mem_fun(&OReportHelper::getPageFooter);
+ else if ( xReportDefinition->getDetail() == _xSection )
+ pMemFunSection = ::std::mem_fun(&OReportHelper::getDetail);
+ return pMemFunSection;
+}
+
+//------------------------------------------------------------------------------
+TYPEINIT1( OCommentUndoAction, SdrUndoAction );
+DBG_NAME(rpt_OCommentUndoAction)
+//----------------------------------------------------------------------------
+OCommentUndoAction::OCommentUndoAction(SdrModel& _rMod,USHORT nCommentID)
+ :SdrUndoAction(_rMod)
+{
+ DBG_CTOR(rpt_OCommentUndoAction,NULL);
+ m_pController = static_cast< OReportModel& >( _rMod ).getController();
+ if ( nCommentID )
+ m_strComment = String(ModuleRes(nCommentID));
+}
+OCommentUndoAction::~OCommentUndoAction()
+{
+ DBG_DTOR(rpt_OCommentUndoAction,NULL);
+}
+//----------------------------------------------------------------------------
+void OCommentUndoAction::Undo()
+{
+}
+//----------------------------------------------------------------------------
+void OCommentUndoAction::Redo()
+{
+}
+DBG_NAME( rpt_OUndoContainerAction );
+//------------------------------------------------------------------------------
+OUndoContainerAction::OUndoContainerAction(SdrModel& _rMod
+ ,Action _eAction
+ ,const uno::Reference< container::XIndexContainer > _xContainer
+ ,const Reference< XInterface > & xElem
+ ,USHORT _nCommentId)
+ :OCommentUndoAction(_rMod,_nCommentId)
+ ,m_xElement(xElem)
+ ,m_xContainer(_xContainer)
+ ,m_eAction( _eAction )
+{
+ DBG_CTOR( rpt_OUndoContainerAction,NULL);
+ // normalize
+ if ( m_eAction == Removed )
+ // we now own the element
+ m_xOwnElement = m_xElement;
+}
+//------------------------------------------------------------------------------
+OUndoContainerAction::~OUndoContainerAction()
+{
+ // if we own the object ....
+ Reference< XComponent > xComp( m_xOwnElement, UNO_QUERY );
+ if ( xComp.is() )
+ {
+ // and the object does not have a parent
+ Reference< XChild > xChild( m_xOwnElement, UNO_QUERY );
+ if ( xChild.is() && !xChild->getParent().is() )
+ {
+ OXUndoEnvironment& rEnv = static_cast< OReportModel& >( rMod ).GetUndoEnv();
+ rEnv.RemoveElement( m_xOwnElement );
+
+#if OSL_DEBUG_LEVEL > 0
+ SvxShape* pShape = SvxShape::getImplementation( xChild );
+ SdrObject* pObject = pShape ? pShape->GetSdrObject() : NULL;
+ OSL_ENSURE( pObject ? pShape->HasSdrObjectOwnership() && !pObject->IsInserted() : true ,
+ "OUndoContainerAction::~OUndoContainerAction: inconsistency in the shape/object ownership!" );
+#endif
+ // -> dispose it
+ try
+ {
+ comphelper::disposeComponent( xComp );
+ }
+ catch ( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+ DBG_DTOR( rpt_OUndoContainerAction,NULL);
+}
+//------------------------------------------------------------------------------
+void OUndoContainerAction::implReInsert( ) SAL_THROW( ( Exception ) )
+{
+ if ( m_xContainer.is() )
+ {
+ // insert the element
+ m_xContainer->insertByIndex( m_xContainer->getCount(),uno::makeAny(m_xElement) );
+ }
+ // we don't own the object anymore
+ m_xOwnElement = NULL;
+}
+
+//------------------------------------------------------------------------------
+void OUndoContainerAction::implReRemove( ) SAL_THROW( ( Exception ) )
+{
+ OXUndoEnvironment& rEnv = static_cast< OReportModel& >( rMod ).GetUndoEnv();
+ try
+ {
+ OXUndoEnvironment::OUndoEnvLock aLock(rEnv);
+ if ( m_xContainer.is() )
+ {
+ const sal_Int32 nCount = m_xContainer->getCount();
+ for (sal_Int32 i = 0; i < nCount; ++i)
+ {
+ uno::Reference< uno::XInterface> xObj(m_xContainer->getByIndex(i),uno::UNO_QUERY);
+ if ( xObj == m_xElement )
+ {
+ m_xContainer->removeByIndex( i );
+ break;
+ }
+ }
+ }
+ }
+ catch(uno::Exception&){}
+ // from now on, we own this object
+ m_xOwnElement = m_xElement;
+}
+
+//------------------------------------------------------------------------------
+void OUndoContainerAction::Undo()
+{
+ if ( m_xElement.is() )
+ {
+ // prevents that an undo action will be created for elementInserted
+ try
+ {
+ switch ( m_eAction )
+ {
+ case Inserted:
+ implReRemove();
+ break;
+
+ case Removed:
+ implReInsert();
+ break;
+ default:
+ OSL_ENSURE(0,"Illegal case value");
+ break;
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "OUndoContainerAction::Undo: caught an exception!" );
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+void OUndoContainerAction::Redo()
+{
+ if ( m_xElement.is() )
+ {
+ try
+ {
+ switch ( m_eAction )
+ {
+ case Inserted:
+ implReInsert();
+ break;
+
+ case Removed:
+ implReRemove();
+ break;
+ default:
+ OSL_ENSURE(0,"Illegal case value");
+ break;
+ }
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "OUndoContainerAction::Redo: caught an exception!" );
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+OUndoGroupSectionAction::OUndoGroupSectionAction(SdrModel& _rMod
+ ,Action _eAction
+ ,::std::mem_fun_t< uno::Reference< report::XSection >
+ ,OGroupHelper> _pMemberFunction
+ ,const uno::Reference< report::XGroup >& _xGroup
+ ,const Reference< XInterface > & xElem
+ ,USHORT _nCommentId)
+:OUndoContainerAction(_rMod,_eAction,NULL,xElem,_nCommentId)
+,m_aGroupHelper(_xGroup)
+,m_pMemberFunction(_pMemberFunction)
+{
+}
+//------------------------------------------------------------------------------
+void OUndoGroupSectionAction::implReInsert( ) SAL_THROW( ( Exception ) )
+{
+ OXUndoEnvironment& rEnv = static_cast< OReportModel& >( rMod ).GetUndoEnv();
+ try
+ {
+ OXUndoEnvironment::OUndoEnvLock aLock(rEnv);
+ uno::Reference< report::XSection> xSection = m_pMemberFunction(&m_aGroupHelper);
+ if ( xSection.is() )
+ xSection->add(uno::Reference< drawing::XShape>(m_xElement,uno::UNO_QUERY));
+ }
+ catch(uno::Exception&){}
+
+ // we don't own the object anymore
+ m_xOwnElement = NULL;
+}
+
+//------------------------------------------------------------------------------
+void OUndoGroupSectionAction::implReRemove( ) SAL_THROW( ( Exception ) )
+{
+ OXUndoEnvironment& rEnv = static_cast< OReportModel& >( rMod ).GetUndoEnv();
+ try
+ {
+ OXUndoEnvironment::OUndoEnvLock aLock(rEnv);
+ uno::Reference< report::XSection> xSection = m_pMemberFunction(&m_aGroupHelper);
+ if ( xSection.is() )
+ xSection->remove(uno::Reference< drawing::XShape>(m_xElement,uno::UNO_QUERY));
+ }
+ catch(uno::Exception&){}
+
+ // from now on, we own this object
+ m_xOwnElement = m_xElement;
+}
+//----------------------------------------------------------------------------
+OUndoReportSectionAction::OUndoReportSectionAction(SdrModel& _rMod
+ ,Action _eAction
+ ,::std::mem_fun_t< uno::Reference< report::XSection >
+ ,OReportHelper> _pMemberFunction
+ ,const uno::Reference< report::XReportDefinition >& _xReport
+ ,const Reference< XInterface > & xElem
+ ,USHORT _nCommentId)
+:OUndoContainerAction(_rMod,_eAction,NULL,xElem,_nCommentId)
+,m_aReportHelper(_xReport)
+,m_pMemberFunction(_pMemberFunction)
+{
+}
+//------------------------------------------------------------------------------
+void OUndoReportSectionAction::implReInsert( ) SAL_THROW( ( Exception ) )
+{
+ OXUndoEnvironment& rEnv = static_cast< OReportModel& >( rMod ).GetUndoEnv();
+ try
+ {
+ OXUndoEnvironment::OUndoEnvLock aLock(rEnv);
+ uno::Reference< report::XSection> xSection = m_pMemberFunction(&m_aReportHelper);
+ if ( xSection.is() )
+ {
+ uno::Reference< drawing::XShape> xShape(m_xElement,uno::UNO_QUERY_THROW);
+ awt::Point aPos = xShape->getPosition();
+ awt::Size aSize = xShape->getSize();
+ xSection->add(xShape);
+ xShape->setPosition( aPos );
+ xShape->setSize( aSize );
+ }
+ }
+ catch(uno::Exception&){}
+ // we don't own the object anymore
+ m_xOwnElement = NULL;
+}
+
+//------------------------------------------------------------------------------
+void OUndoReportSectionAction::implReRemove( ) SAL_THROW( ( Exception ) )
+{
+ OXUndoEnvironment& rEnv = static_cast< OReportModel& >( rMod ).GetUndoEnv();
+ try
+ {
+ OXUndoEnvironment::OUndoEnvLock aLock(rEnv);
+ uno::Reference< report::XSection> xSection = m_pMemberFunction(&m_aReportHelper);
+ if ( xSection.is() )
+ xSection->remove(uno::Reference< drawing::XShape>(m_xElement,uno::UNO_QUERY));
+ }
+ catch(uno::Exception&){}
+ // from now on, we own this object
+ m_xOwnElement = m_xElement;
+}
+//------------------------------------------------------------------------------
+ORptUndoPropertyAction::ORptUndoPropertyAction(SdrModel& rNewMod, const PropertyChangeEvent& evt)
+ :OCommentUndoAction(rNewMod,0)
+ ,m_xObj(evt.Source, UNO_QUERY)
+ ,m_aPropertyName(evt.PropertyName)
+ ,m_aNewValue(evt.NewValue)
+ ,m_aOldValue(evt.OldValue)
+{
+}
+//------------------------------------------------------------------------------
+void ORptUndoPropertyAction::Undo()
+{
+ setProperty(sal_True);
+}
+
+//------------------------------------------------------------------------------
+void ORptUndoPropertyAction::Redo()
+{
+ setProperty(sal_False);
+}
+// -----------------------------------------------------------------------------
+Reference< XPropertySet> ORptUndoPropertyAction::getObject()
+{
+ return m_xObj;
+}
+// -----------------------------------------------------------------------------
+void ORptUndoPropertyAction::setProperty(sal_Bool _bOld)
+{
+ Reference< XPropertySet> xObj = getObject();
+
+ if (xObj.is() )
+ {
+ try
+ {
+ xObj->setPropertyValue( m_aPropertyName, _bOld ? m_aOldValue : m_aNewValue );
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "ORptUndoPropertyAction::Redo: caught an exception!" );
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+String ORptUndoPropertyAction::GetComment() const
+{
+ String aStr(ModuleRes(RID_STR_UNDO_PROPERTY));
+
+ aStr.SearchAndReplace( '#', m_aPropertyName );
+ return aStr;
+}
+// -----------------------------------------------------------------------------
+OUndoPropertyGroupSectionAction::OUndoPropertyGroupSectionAction(SdrModel& _rMod
+ ,const PropertyChangeEvent& evt
+ ,::std::mem_fun_t< uno::Reference< report::XSection >
+ ,OGroupHelper> _pMemberFunction
+ ,const uno::Reference< report::XGroup >& _xGroup
+ )
+:ORptUndoPropertyAction(_rMod,evt)
+,m_aGroupHelper(_xGroup)
+,m_pMemberFunction(_pMemberFunction)
+{
+}
+// -----------------------------------------------------------------------------
+Reference< XPropertySet> OUndoPropertyGroupSectionAction::getObject()
+{
+ return m_pMemberFunction(&m_aGroupHelper).get();
+}
+// -----------------------------------------------------------------------------
+OUndoPropertyReportSectionAction::OUndoPropertyReportSectionAction(SdrModel& _rMod
+ ,const PropertyChangeEvent& evt
+ ,::std::mem_fun_t< uno::Reference< report::XSection >
+ ,OReportHelper> _pMemberFunction
+ ,const uno::Reference< report::XReportDefinition >& _xReport
+ )
+:ORptUndoPropertyAction(_rMod,evt)
+,m_aReportHelper(_xReport)
+,m_pMemberFunction(_pMemberFunction)
+{
+}
+// -----------------------------------------------------------------------------
+Reference< XPropertySet> OUndoPropertyReportSectionAction::getObject()
+{
+ return m_pMemberFunction(&m_aReportHelper).get();
+}
+//============================================================================
+} // rptui
+//============================================================================
+
diff --git a/reportdesign/source/core/sdr/UndoEnv.cxx b/reportdesign/source/core/sdr/UndoEnv.cxx
new file mode 100644
index 000000000000..911279ed6f71
--- /dev/null
+++ b/reportdesign/source/core/sdr/UndoEnv.cxx
@@ -0,0 +1,629 @@
+/*************************************************************************
+ *
+ * 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 "UndoActions.hxx"
+#include "UndoEnv.hxx"
+#include "formatnormalizer.hxx"
+#include "conditionupdater.hxx"
+#include "corestrings.hrc"
+#include "rptui_slotid.hrc"
+#include "RptDef.hxx"
+#include "ModuleHelper.hxx"
+#include "RptObject.hxx"
+#include "RptPage.hxx"
+#include "RptResId.hrc"
+#include "RptModel.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/script/XEventAttacherManager.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/util/XModifyBroadcaster.hpp>
+/** === end UNO includes === **/
+
+#include <connectivity/dbtools.hxx>
+#include <svl/smplhint.hxx>
+#include <tools/diagnose_ex.h>
+#include <comphelper/stl_types.hxx>
+#include <vcl/svapp.hxx>
+#include <dbaccess/singledoccontroller.hxx>
+#include <svx/unoshape.hxx>
+#include <vos/mutex.hxx>
+
+namespace rptui
+{
+ using namespace ::com::sun::star;
+ using namespace uno;
+ using namespace lang;
+ using namespace script;
+ using namespace beans;
+ using namespace awt;
+ using namespace util;
+ using namespace container;
+ using namespace report;
+//----------------------------------------------------------------------------
+
+
+DECLARE_STL_USTRINGACCESS_MAP(bool, AllProperties);
+DECLARE_STL_STDKEY_MAP(uno::Reference< beans::XPropertySet >, AllProperties, PropertySetInfoCache);
+
+// -----------------------------------------------------------------------------
+
+class OXUndoEnvironmentImpl
+{
+ OXUndoEnvironmentImpl(OXUndoEnvironmentImpl&);
+ void operator =(OXUndoEnvironmentImpl&);
+public:
+ OReportModel& m_rModel;
+ PropertySetInfoCache m_aPropertySetCache;
+ FormatNormalizer m_aFormatNormalizer;
+ ConditionUpdater m_aConditionUpdater;
+ ::osl::Mutex m_aMutex;
+ ::std::vector< uno::Reference< container::XChild> > m_aSections;
+ oslInterlockedCount m_nLocks;
+ sal_Bool m_bReadOnly;
+ sal_Bool m_bIsUndo;
+
+ OXUndoEnvironmentImpl(OReportModel& _rModel);
+};
+
+OXUndoEnvironmentImpl::OXUndoEnvironmentImpl(OReportModel& _rModel) : m_rModel(_rModel)
+ ,m_aFormatNormalizer( _rModel )
+ ,m_aConditionUpdater()
+ ,m_nLocks(0)
+ ,m_bReadOnly(sal_False)
+ ,m_bIsUndo(sal_False)
+{
+}
+
+//------------------------------------------------------------------------------
+DBG_NAME( rpt_OXUndoEnvironment );
+//------------------------------------------------------------------------------
+OXUndoEnvironment::OXUndoEnvironment(OReportModel& _rModel)
+ :m_pImpl(new OXUndoEnvironmentImpl(_rModel) )
+{
+ DBG_CTOR( rpt_OXUndoEnvironment,NULL);
+ StartListening(m_pImpl->m_rModel);
+}
+
+//------------------------------------------------------------------------------
+OXUndoEnvironment::~OXUndoEnvironment()
+{
+ DBG_DTOR( rpt_OXUndoEnvironment,NULL);
+}
+// -----------------------------------------------------------------------------
+void OXUndoEnvironment::Lock()
+{
+ OSL_ENSURE(m_refCount,"Illegal call to dead object!");
+ osl_incrementInterlockedCount( &m_pImpl->m_nLocks );
+}
+void OXUndoEnvironment::UnLock()
+{
+ OSL_ENSURE(m_refCount,"Illegal call to dead object!");
+
+ osl_decrementInterlockedCount( &m_pImpl->m_nLocks );
+}
+sal_Bool OXUndoEnvironment::IsLocked() const { return m_pImpl->m_nLocks != 0; }
+// -----------------------------------------------------------------------------
+void OXUndoEnvironment::RemoveSection(OReportPage* _pPage)
+{
+ if ( _pPage )
+ {
+ Reference< XInterface > xSection(_pPage->getSection());
+ if ( xSection.is() )
+ RemoveElement( xSection );
+ }
+}
+//------------------------------------------------------------------------------
+void OXUndoEnvironment::Clear(const Accessor& /*_r*/)
+{
+ OUndoEnvLock aLock(*this);
+
+#if OSL_DEBUG_LEVEL > 0
+ // TODO: LLA->OJ please describe what you are doing in this code fragment.
+ PropertySetInfoCache::iterator aIter = m_pImpl->m_aPropertySetCache.begin();
+ PropertySetInfoCache::iterator aEnd = m_pImpl->m_aPropertySetCache.end();
+ int ndbg_len = m_pImpl->m_aPropertySetCache.size();
+ ndbg_len = ndbg_len;
+ for (int idbg_ = 0; aIter != aEnd; ++aIter,++idbg_)
+ {
+ uno::Reference<beans::XPropertySet> xProp(aIter->first,uno::UNO_QUERY);
+ xProp->getPropertySetInfo();
+ int nlen = aIter->second.size();
+ nlen = nlen;
+ }
+#endif
+ m_pImpl->m_aPropertySetCache.clear();
+
+ sal_uInt16 nCount = m_pImpl->m_rModel.GetPageCount();
+ sal_uInt16 i;
+ for (i = 0; i < nCount; i++)
+ {
+ OReportPage* pPage = PTR_CAST( OReportPage, m_pImpl->m_rModel.GetPage(i) );
+ RemoveSection(pPage);
+ }
+
+ nCount = m_pImpl->m_rModel.GetMasterPageCount();
+ for (i = 0; i < nCount; i++)
+ {
+ OReportPage* pPage = PTR_CAST( OReportPage, m_pImpl->m_rModel.GetMasterPage(i) );
+ RemoveSection(pPage);
+ }
+
+ m_pImpl->m_aSections.clear();
+
+ if (IsListening(m_pImpl->m_rModel))
+ EndListening(m_pImpl->m_rModel);
+}
+
+//------------------------------------------------------------------------------
+void OXUndoEnvironment::ModeChanged()
+{
+ m_pImpl->m_bReadOnly = !m_pImpl->m_bReadOnly;
+
+ if (!m_pImpl->m_bReadOnly)
+ StartListening(m_pImpl->m_rModel);
+ else
+ EndListening(m_pImpl->m_rModel);
+}
+
+//------------------------------------------------------------------------------
+void OXUndoEnvironment::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
+{
+ if (rHint.ISA(SfxSimpleHint) && ((SfxSimpleHint&)rHint).GetId() == SFX_HINT_MODECHANGED )
+ ModeChanged();
+}
+// -----------------------------------------------------------------------------
+// XEventListener
+//------------------------------------------------------------------------------
+void SAL_CALL OXUndoEnvironment::disposing(const EventObject& e) throw( RuntimeException )
+{
+ // check if it's an object we have cached informations about
+ Reference< XPropertySet > xSourceSet(e.Source, UNO_QUERY);
+ if ( xSourceSet.is() )
+ {
+ uno::Reference< report::XSection> xSection(xSourceSet,uno::UNO_QUERY);
+ if ( xSection.is() )
+ RemoveSection(xSection);
+ else
+ RemoveElement(xSourceSet);
+ /*if (!m_pImpl->m_aPropertySetCache.empty())
+ m_pImpl->m_aPropertySetCache.erase(xSourceSet);*/
+ }
+}
+
+// XPropertyChangeListener
+//------------------------------------------------------------------------------
+void SAL_CALL OXUndoEnvironment::propertyChange( const PropertyChangeEvent& _rEvent ) throw(uno::RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( m_pImpl->m_aMutex );
+
+ if ( IsLocked() )
+ return;
+
+ Reference< XPropertySet > xSet( _rEvent.Source, UNO_QUERY );
+ if (!xSet.is())
+ return;
+
+ dbaui::OSingleDocumentController* pController = m_pImpl->m_rModel.getController();
+ if ( !pController )
+ return;
+
+ // no Undo for transient and readonly props.
+ // let's see if we know something about the set
+#if OSL_DEBUG_LEVEL > 0
+ int nlen = m_pImpl->m_aPropertySetCache.size();
+ nlen = nlen;
+#endif
+ PropertySetInfoCache::iterator aSetPos = m_pImpl->m_aPropertySetCache.find(xSet);
+ if (aSetPos == m_pImpl->m_aPropertySetCache.end())
+ {
+ AllProperties aNewEntry;
+ aSetPos = m_pImpl->m_aPropertySetCache.insert(PropertySetInfoCache::value_type(xSet,aNewEntry)).first;
+ DBG_ASSERT(aSetPos != m_pImpl->m_aPropertySetCache.end(), "OXUndoEnvironment::propertyChange : just inserted it ... why it's not there ?");
+ }
+ if ( aSetPos == m_pImpl->m_aPropertySetCache.end() )
+ return;
+
+ // now we have access to the cached info about the set
+ // let's see what we know about the property
+ AllProperties& rPropInfos = aSetPos->second;
+ AllPropertiesIterator aPropertyPos = rPropInfos.find( _rEvent.PropertyName );
+ if (aPropertyPos == rPropInfos.end())
+ { // nothing 'til now ... have to change this ....
+ // the attributes
+ INT32 nAttributes = xSet->getPropertySetInfo()->getPropertyByName( _rEvent.PropertyName ).Attributes;
+ bool bTransReadOnly = ((nAttributes & PropertyAttribute::READONLY) != 0) || ((nAttributes & PropertyAttribute::TRANSIENT) != 0);
+
+ // insert the new entry
+ aPropertyPos = rPropInfos.insert( AllProperties::value_type( _rEvent.PropertyName, bTransReadOnly ) ).first;
+ DBG_ASSERT(aPropertyPos != rPropInfos.end(), "OXUndoEnvironment::propertyChange : just inserted it ... why it's not there ?");
+ }
+
+ implSetModified();
+
+ // now we have access to the cached info about the property affected
+ // and are able to decide wether or not we need an undo action
+
+ // no UNDO for transient/readonly properties
+ if ( aPropertyPos->second )
+ return;
+
+ // give components with sub responsibilities a chance
+ m_pImpl->m_aFormatNormalizer.notifyPropertyChange( _rEvent );
+ m_pImpl->m_aConditionUpdater.notifyPropertyChange( _rEvent );
+
+ aGuard.clear();
+ // TODO: this is a potential race condition: two threads here could in theory
+ // add their undo actions out-of-order
+
+ ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
+ ORptUndoPropertyAction* pUndo = NULL;
+ try
+ {
+ uno::Reference< report::XSection> xSection( xSet, uno::UNO_QUERY );
+ if ( xSection.is() )
+ {
+ uno::Reference< report::XGroup> xGroup = xSection->getGroup();
+ if ( xGroup.is() )
+ pUndo = new OUndoPropertyGroupSectionAction( m_pImpl->m_rModel, _rEvent, OGroupHelper::getMemberFunction( xSection ), xGroup );
+ else
+ pUndo = new OUndoPropertyReportSectionAction( m_pImpl->m_rModel, _rEvent, OReportHelper::getMemberFunction( xSection ), xSection->getReportDefinition() );
+ }
+ }
+ catch(const Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ if ( pUndo == NULL )
+ pUndo = new ORptUndoPropertyAction( m_pImpl->m_rModel, _rEvent );
+
+ pController->addUndoActionAndInvalidate(pUndo);
+ pController->InvalidateAll();
+}
+// -----------------------------------------------------------------------------
+::std::vector< uno::Reference< container::XChild> >::const_iterator OXUndoEnvironment::getSection(const Reference<container::XChild>& _xContainer) const
+{
+ ::std::vector< uno::Reference< container::XChild> >::const_iterator aFind = m_pImpl->m_aSections.end();
+ if ( _xContainer.is() )
+ {
+ aFind = ::std::find(m_pImpl->m_aSections.begin(),m_pImpl->m_aSections.end(),_xContainer);
+
+ if ( aFind == m_pImpl->m_aSections.end() )
+ {
+ Reference<container::XChild> xParent(_xContainer->getParent(),uno::UNO_QUERY);
+ aFind = getSection(xParent);
+ }
+ }
+ return aFind;
+}
+// XContainerListener
+//------------------------------------------------------------------------------
+void SAL_CALL OXUndoEnvironment::elementInserted(const ContainerEvent& evt) throw(uno::RuntimeException)
+{
+ ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+
+ // neues Object zum lauschen
+ Reference< uno::XInterface > xIface( evt.Element, UNO_QUERY );
+ if ( !IsLocked() )
+ {
+ Reference< report::XReportComponent > xReportComponent( xIface, UNO_QUERY );
+ if ( xReportComponent.is() )
+ {
+ Reference< report::XSection > xContainer(evt.Source,uno::UNO_QUERY);
+
+ ::std::vector< uno::Reference< container::XChild> >::const_iterator aFind = getSection(xContainer.get());
+
+ if ( aFind != m_pImpl->m_aSections.end() )
+ {
+ OUndoEnvLock aLock(*this);
+ try
+ {
+ OReportPage* pPage = m_pImpl->m_rModel.getPage(uno::Reference< report::XSection>(*aFind,uno::UNO_QUERY));
+ OSL_ENSURE(pPage,"No page could be found for section!");
+ if ( pPage )
+ pPage->insertObject(xReportComponent);
+ }
+ catch(uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ }
+ }
+ else
+ {
+ uno::Reference< report::XFunctions> xContainer(evt.Source,uno::UNO_QUERY);
+ if ( xContainer.is() )
+ {
+ dbaui::OSingleDocumentController* pController = m_pImpl->m_rModel.getController();
+ pController->addUndoActionAndInvalidate(new OUndoContainerAction(m_pImpl->m_rModel
+ ,rptui::Inserted
+ ,xContainer.get()
+ ,xIface
+ ,RID_STR_UNDO_ADDFUNCTION));
+ }
+ }
+ }
+
+ AddElement(xIface);
+
+ implSetModified();
+}
+
+//------------------------------------------------------------------------------
+void OXUndoEnvironment::implSetModified()
+{
+ //if ( !IsLocked() )
+ m_pImpl->m_rModel.SetModified( sal_True );
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OXUndoEnvironment::elementReplaced(const ContainerEvent& evt) throw(uno::RuntimeException)
+{
+ ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+
+ Reference< XInterface > xIface(evt.ReplacedElement,uno::UNO_QUERY);
+ OSL_ENSURE(xIface.is(), "OXUndoEnvironment::elementReplaced: invalid container notification!");
+ RemoveElement(xIface);
+
+ xIface.set(evt.Element,uno::UNO_QUERY);
+ AddElement(xIface);
+
+ implSetModified();
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OXUndoEnvironment::elementRemoved(const ContainerEvent& evt) throw(uno::RuntimeException)
+{
+ ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_pImpl->m_aMutex );
+
+ Reference< uno::XInterface > xIface( evt.Element, UNO_QUERY );
+ if ( !IsLocked() )
+ {
+ Reference< report::XSection > xContainer(evt.Source,uno::UNO_QUERY);
+ ::std::vector< uno::Reference< container::XChild> >::const_iterator aFind = getSection(xContainer.get());
+
+ Reference< report::XReportComponent > xReportComponent( xIface, UNO_QUERY );
+ if ( aFind != m_pImpl->m_aSections.end() && xReportComponent.is() )
+ {
+ OXUndoEnvironment::OUndoEnvLock aLock(*this);
+ try
+ {
+ OReportPage* pPage = m_pImpl->m_rModel.getPage(uno::Reference< report::XSection >( *aFind, uno::UNO_QUERY_THROW ) );
+ OSL_ENSURE( pPage, "OXUndoEnvironment::elementRemoved: no page for the section!" );
+ if ( pPage )
+ pPage->removeSdrObject(xReportComponent);
+ }
+ catch(const uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ else
+ {
+ uno::Reference< report::XFunctions> xFunctions(evt.Source,uno::UNO_QUERY);
+ if ( xFunctions.is() )
+ {
+ dbaui::OSingleDocumentController* pController = m_pImpl->m_rModel.getController();
+ pController->addUndoActionAndInvalidate(new OUndoContainerAction(m_pImpl->m_rModel
+ ,rptui::Removed
+ ,xFunctions.get()
+ ,xIface
+ ,RID_STR_UNDO_ADDFUNCTION));
+ }
+ }
+ }
+
+ if ( xIface.is() )
+ RemoveElement(xIface);
+
+ implSetModified();
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OXUndoEnvironment::modified( const EventObject& /*aEvent*/ ) throw (RuntimeException)
+{
+ implSetModified();
+}
+
+//------------------------------------------------------------------------------
+void OXUndoEnvironment::AddSection(const Reference< report::XSection > & _xSection)
+{
+ OUndoEnvLock aLock(*this);
+ try
+ {
+ uno::Reference<container::XChild> xChild = _xSection.get();
+ uno::Reference<report::XGroup> xGroup(xChild->getParent(),uno::UNO_QUERY);
+ m_pImpl->m_aSections.push_back(xChild);
+ Reference< XInterface > xInt(_xSection);
+ AddElement(xInt);
+ }
+ catch(const uno::Exception&)
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------------------
+void OXUndoEnvironment::RemoveSection(const Reference< report::XSection > & _xSection)
+{
+ OUndoEnvLock aLock(*this);
+ try
+ {
+ uno::Reference<container::XChild> xChild(_xSection.get());
+ m_pImpl->m_aSections.erase(::std::remove(m_pImpl->m_aSections.begin(),m_pImpl->m_aSections.end(),
+ xChild), m_pImpl->m_aSections.end());
+ Reference< XInterface > xInt(_xSection);
+ RemoveElement(xInt);
+ }
+ catch(uno::Exception&){}
+}
+
+//------------------------------------------------------------------------------
+void OXUndoEnvironment::TogglePropertyListening(const Reference< XInterface > & Element)
+{
+ // am Container horchen
+ Reference< XIndexAccess > xContainer(Element, UNO_QUERY);
+ if (xContainer.is())
+ {
+ Reference< XInterface > xInterface;
+ sal_Int32 nCount = xContainer->getCount();
+ for(sal_Int32 i = 0;i != nCount;++i)
+ {
+ xInterface.set(xContainer->getByIndex( i ),uno::UNO_QUERY);
+ TogglePropertyListening(xInterface);
+ }
+ }
+
+ Reference< XPropertySet > xSet(Element, UNO_QUERY);
+ if (xSet.is())
+ {
+ if (!m_pImpl->m_bReadOnly)
+ xSet->addPropertyChangeListener( ::rtl::OUString(), this );
+ else
+ xSet->removePropertyChangeListener( ::rtl::OUString(), this );
+ }
+}
+
+
+//------------------------------------------------------------------------------
+void OXUndoEnvironment::switchListening( const Reference< XIndexAccess >& _rxContainer, bool _bStartListening ) SAL_THROW(())
+{
+ OSL_PRECOND( _rxContainer.is(), "OXUndoEnvironment::switchListening: invalid container!" );
+ if ( !_rxContainer.is() )
+ return;
+
+ try
+ {
+ // also handle all children of this element
+ Reference< XInterface > xInterface;
+ sal_Int32 nCount = _rxContainer->getCount();
+ for(sal_Int32 i = 0;i != nCount;++i)
+ {
+ xInterface.set(_rxContainer->getByIndex( i ),uno::UNO_QUERY);
+ if ( _bStartListening )
+ AddElement( xInterface );
+ else
+ RemoveElement( xInterface );
+ }
+
+ // be notified of any changes in the container elements
+ Reference< XContainer > xSimpleContainer( _rxContainer, UNO_QUERY );
+ // OSL_ENSURE( xSimpleContainer.is(), "OXUndoEnvironment::switchListening: how are we expected to be notified of changes in the container?" );
+ if ( xSimpleContainer.is() )
+ {
+ if ( _bStartListening )
+ xSimpleContainer->addContainerListener( this );
+ else
+ xSimpleContainer->removeContainerListener( this );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+//------------------------------------------------------------------------------
+void OXUndoEnvironment::switchListening( const Reference< XInterface >& _rxObject, bool _bStartListening ) SAL_THROW(())
+{
+ OSL_PRECOND( _rxObject.is(), "OXUndoEnvironment::switchListening: how should I listen at a NULL object?" );
+
+ try
+ {
+ if ( !m_pImpl->m_bReadOnly )
+ {
+ Reference< XPropertySet > xProps( _rxObject, UNO_QUERY );
+ if ( xProps.is() )
+ {
+ if ( _bStartListening )
+ xProps->addPropertyChangeListener( ::rtl::OUString(), this );
+ else
+ xProps->removePropertyChangeListener( ::rtl::OUString(), this );
+ }
+ }
+
+ Reference< XModifyBroadcaster > xBroadcaster( _rxObject, UNO_QUERY );
+ if ( xBroadcaster.is() )
+ {
+ if ( _bStartListening )
+ xBroadcaster->addModifyListener( this );
+ else
+ xBroadcaster->removeModifyListener( this );
+ }
+ }
+ catch( const Exception& )
+ {
+ //OSL_ENSURE( sal_False, "OXUndoEnvironment::switchListening: caught an exception!" );
+ }
+}
+
+//------------------------------------------------------------------------------
+void OXUndoEnvironment::AddElement(const Reference< XInterface >& _rxElement )
+{
+ if ( !IsLocked() )
+ m_pImpl->m_aFormatNormalizer.notifyElementInserted( _rxElement );
+
+ // if it's a container, start listening at all elements
+ Reference< XIndexAccess > xContainer( _rxElement, UNO_QUERY );
+ if ( xContainer.is() )
+ switchListening( xContainer, true );
+
+ switchListening( _rxElement, true );
+}
+
+//------------------------------------------------------------------------------
+void OXUndoEnvironment::RemoveElement(const Reference< XInterface >& _rxElement)
+{
+ uno::Reference<beans::XPropertySet> xProp(_rxElement,uno::UNO_QUERY);
+ if (!m_pImpl->m_aPropertySetCache.empty())
+ m_pImpl->m_aPropertySetCache.erase(xProp);
+ switchListening( _rxElement, false );
+
+ Reference< XIndexAccess > xContainer( _rxElement, UNO_QUERY );
+ if ( xContainer.is() )
+ switchListening( xContainer, false );
+}
+
+void OXUndoEnvironment::SetUndoMode(sal_Bool _bUndo)
+{
+ m_pImpl->m_bIsUndo = _bUndo;
+}
+
+sal_Bool OXUndoEnvironment::IsUndoMode() const
+{
+ return m_pImpl->m_bIsUndo;
+}
+//============================================================================
+} // rptui
+//============================================================================
diff --git a/reportdesign/source/core/sdr/formatnormalizer.cxx b/reportdesign/source/core/sdr/formatnormalizer.cxx
new file mode 100644
index 000000000000..e4817bbe9f44
--- /dev/null
+++ b/reportdesign/source/core/sdr/formatnormalizer.cxx
@@ -0,0 +1,279 @@
+/*************************************************************************
+ *
+ * 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 "formatnormalizer.hxx"
+#include "RptModel.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdb/XParametersSupplier.hpp>
+#include <com/sun/star/util/XNumberFormatTypes.hpp>
+/** === end UNO includes === **/
+
+#include <dbaccess/singledoccontroller.hxx>
+#include <unotools/syslocale.hxx>
+#include <connectivity/statementcomposer.hxx>
+#include <connectivity/dbtools.hxx>
+#include <tools/diagnose_ex.h>
+
+//........................................................................
+namespace rptui
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::report::XReportDefinition;
+ using ::com::sun::star::report::XFormattedField;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::sdb::XSingleSelectQueryComposer;
+ using ::com::sun::star::sdbcx::XColumnsSupplier;
+ using ::com::sun::star::container::XIndexAccess;
+ using ::com::sun::star::beans::XPropertySet;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::sdb::XParametersSupplier;
+ using ::com::sun::star::sdbc::SQLException;
+ using ::com::sun::star::util::XNumberFormatsSupplier;
+ using ::com::sun::star::util::XNumberFormatTypes;
+ using ::com::sun::star::uno::makeAny;
+ /** === end UNO using === **/
+
+ //====================================================================
+ //= FormatNormalizer
+ //====================================================================
+ DBG_NAME(rpt_FormatNormalizer)
+ //--------------------------------------------------------------------
+ FormatNormalizer::FormatNormalizer( const OReportModel& _rModel )
+ :m_rModel( _rModel )
+ ,m_xReportDefinition( )
+ ,m_bFieldListDirty( true )
+ {
+ DBG_CTOR(rpt_FormatNormalizer,NULL);
+ }
+
+ //--------------------------------------------------------------------
+ FormatNormalizer::~FormatNormalizer()
+ {
+ DBG_DTOR(rpt_FormatNormalizer,NULL);
+ }
+
+ //--------------------------------------------------------------------
+ void FormatNormalizer::notifyPropertyChange( const ::com::sun::star::beans::PropertyChangeEvent& _rEvent )
+ {
+ if ( !impl_lateInit() )
+ return;
+
+ if ( ( _rEvent.Source == m_xReportDefinition ) && m_xReportDefinition.is() )
+ {
+ impl_onDefinitionPropertyChange( _rEvent.PropertyName );
+ return;
+ }
+
+ Reference< XFormattedField > xFormatted( _rEvent.Source, UNO_QUERY );
+ if ( xFormatted.is() )
+ impl_onFormattedProperttyChange( xFormatted, _rEvent.PropertyName );
+ }
+
+ //--------------------------------------------------------------------
+ void FormatNormalizer::notifyElementInserted( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement )
+ {
+ if ( !impl_lateInit() )
+ return;
+
+ Reference< XFormattedField > xFormatted( _rxElement, UNO_QUERY );
+ if ( !xFormatted.is() )
+ return;
+
+ impl_adjustFormatToDataFieldType_nothrow( xFormatted );
+ }
+
+ //--------------------------------------------------------------------
+ bool FormatNormalizer::impl_lateInit()
+ {
+ if ( m_xReportDefinition.is() )
+ return true;
+
+ m_xReportDefinition = m_rModel.getReportDefinition();
+ return m_xReportDefinition.is();
+ }
+
+ //--------------------------------------------------------------------
+ void FormatNormalizer::impl_onDefinitionPropertyChange( const ::rtl::OUString& _rChangedPropName )
+ {
+ if ( !_rChangedPropName.equalsAscii( "Command" )
+ && !_rChangedPropName.equalsAscii( "CommandType" )
+ && !_rChangedPropName.equalsAscii( "EscapeProcessing" )
+ )
+ // nothing we're interested in
+ return;
+ m_bFieldListDirty = true;
+ }
+
+ //--------------------------------------------------------------------
+ void FormatNormalizer::impl_onFormattedProperttyChange( const Reference< XFormattedField >& _rxFormatted, const ::rtl::OUString& _rChangedPropName )
+ {
+ if ( !_rChangedPropName.equalsAscii( "DataField" ) )
+ // nothing we're interested in
+ return;
+
+ impl_adjustFormatToDataFieldType_nothrow( _rxFormatted );
+ }
+
+ //--------------------------------------------------------------------
+ namespace
+ {
+ void lcl_collectFields_throw( const Reference< XIndexAccess >& _rxColumns, FormatNormalizer::FieldList& _inout_rFields )
+ {
+ try
+ {
+ sal_Int32 nCount( _rxColumns->getCount() );
+ _inout_rFields.reserve( _inout_rFields.size() + (size_t)nCount );
+
+ Reference< XPropertySet > xColumn;
+ FormatNormalizer::Field aField;
+
+ for ( sal_Int32 i=0; i<nCount; ++i )
+ {
+ xColumn.set( _rxColumns->getByIndex( i ), UNO_QUERY_THROW );
+ OSL_VERIFY( xColumn->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ) ) >>= aField.sName );
+ OSL_VERIFY( xColumn->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Type" ) ) ) >>= aField.nDataType );
+ OSL_VERIFY( xColumn->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Scale" ) ) ) >>= aField.nScale );
+ OSL_VERIFY( xColumn->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsCurrency" ) ) ) >>= aField.bIsCurrency );
+ _inout_rFields.push_back( aField );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+
+ //--------------------------------------------------------------------
+ bool FormatNormalizer::impl_ensureUpToDateFieldList_nothrow()
+ {
+ if ( !m_bFieldListDirty )
+ return true;
+ m_aFields.resize( 0 );
+
+ OSL_PRECOND( m_xReportDefinition.is(), "FormatNormalizer::impl_ensureUpToDateFieldList_nothrow: no report definition!" );
+ if ( !m_xReportDefinition.is() )
+ return false;
+
+ ::dbaui::OSingleDocumentController* pController( m_rModel.getController() );
+ OSL_ENSURE( pController, "FormatNormalizer::impl_ensureUpToDateFieldList_nothrow: no controller? how can *this* happen?!" );
+ if ( !pController )
+ return false;
+
+ try
+ {
+ ::dbtools::StatementComposer aComposer( pController->getConnection(), m_xReportDefinition->getCommand(),
+ m_xReportDefinition->getCommandType(), m_xReportDefinition->getEscapeProcessing() );
+
+ Reference< XSingleSelectQueryComposer > xComposer( aComposer.getComposer() );
+ if ( !xComposer.is() )
+ return false;
+
+
+ Reference< XColumnsSupplier > xSuppCols( xComposer, UNO_QUERY_THROW );
+ Reference< XIndexAccess > xColumns( xSuppCols->getColumns(), UNO_QUERY_THROW );
+ lcl_collectFields_throw( xColumns, m_aFields );
+
+ Reference< XParametersSupplier > xSuppParams( xComposer, UNO_QUERY_THROW );
+ Reference< XIndexAccess > xParams( xSuppParams->getParameters(), UNO_QUERY_THROW );
+ lcl_collectFields_throw( xParams, m_aFields );
+ }
+ catch( const SQLException& )
+ {
+ // silence it. This might happen for instance when the user sets an non-existent table,
+ // or things like this
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ m_bFieldListDirty = false;
+ return true;
+ }
+
+ //--------------------------------------------------------------------
+ void FormatNormalizer::impl_adjustFormatToDataFieldType_nothrow( const Reference< XFormattedField >& _rxFormatted )
+ {
+ if ( !impl_ensureUpToDateFieldList_nothrow() )
+ // unable to obtain a recent field list
+ return;
+
+ try
+ {
+ sal_Int32 nFormatKey = _rxFormatted->getFormatKey();
+ if ( nFormatKey != 0 )
+ // it's not the "standard numeric" format -> not interested in
+ return;
+
+ ::rtl::OUString sDataField( _rxFormatted->getDataField() );
+ const ::rtl::OUString sFieldPrefix( RTL_CONSTASCII_USTRINGPARAM( "field:[" ) );
+ if ( sDataField.indexOf( sFieldPrefix ) != 0 )
+ // not bound to a table field
+ // TODO: we might also do this kind of thing for functions and expressions ...
+ return;
+ if ( sDataField.getStr()[ sDataField.getLength() - 1 ] != ']' )
+ {
+ // last character is not the closing brace
+ OSL_ENSURE( false, "FormatNormalizer::impl_adjustFormatToDataFieldType_nothrow: suspicious data field value!" );
+ return;
+ }
+ sDataField = sDataField.copy( sFieldPrefix.getLength(), sDataField.getLength() - sFieldPrefix.getLength() - 1 );
+
+ FieldList::const_iterator field = m_aFields.begin();
+ for ( ; field != m_aFields.end(); ++field )
+ {
+ if ( field->sName == sDataField )
+ break;
+ }
+ if ( field == m_aFields.end() )
+ // unknown field
+ return;
+
+ Reference< XNumberFormatsSupplier > xSuppNumFmts( _rxFormatted->getFormatsSupplier(), UNO_QUERY_THROW );
+ Reference< XNumberFormatTypes > xNumFmtTypes( xSuppNumFmts->getNumberFormats(), UNO_QUERY_THROW );
+
+ nFormatKey = ::dbtools::getDefaultNumberFormat( field->nDataType, field->nScale, field->bIsCurrency, xNumFmtTypes,
+ SvtSysLocale().GetLocaleData().getLocale() );
+ _rxFormatted->setFormatKey( nFormatKey );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+//........................................................................
+} // namespace rptui
+//........................................................................
diff --git a/reportdesign/source/core/sdr/formatnormalizer.hxx b/reportdesign/source/core/sdr/formatnormalizer.hxx
new file mode 100644
index 000000000000..8577d276d4c8
--- /dev/null
+++ b/reportdesign/source/core/sdr/formatnormalizer.hxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#ifndef REPORTDESIGN_FORMATNORMALIZER_HXX
+#define REPORTDESIGN_FORMATNORMALIZER_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/report/XReportDefinition.hpp>
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+#include <com/sun/star/report/XFormattedField.hpp>
+/** === end UNO includes === **/
+
+#include <boost/noncopyable.hpp>
+
+#include <vector>
+
+//........................................................................
+namespace rptui
+{
+//........................................................................
+
+ class OReportModel;
+ //====================================================================
+ //= FormatNormalizer
+ //====================================================================
+ class FormatNormalizer : public ::boost::noncopyable
+ {
+ public:
+ struct Field
+ {
+ ::rtl::OUString sName;
+ sal_Int32 nDataType;
+ sal_Int32 nScale;
+ sal_Bool bIsCurrency;
+
+ Field() : sName(), nDataType( 0 ), nScale( 0 ), bIsCurrency( 0 ) { }
+ };
+ typedef ::std::vector< Field > FieldList;
+
+ private:
+ const OReportModel& m_rModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition > m_xReportDefinition;
+
+ /// is our field list dirty?
+ FieldList m_aFields;
+ bool m_bFieldListDirty;
+
+ public:
+ FormatNormalizer( const OReportModel& _rModel );
+ ~FormatNormalizer();
+
+ void notifyPropertyChange( const ::com::sun::star::beans::PropertyChangeEvent& _rEvent );
+ void notifyElementInserted( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement );
+
+ private:
+ bool impl_lateInit();
+
+ void impl_onDefinitionPropertyChange( const ::rtl::OUString& _rChangedPropName );
+ void impl_onFormattedProperttyChange( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XFormattedField >& _rxFormatted, const ::rtl::OUString& _rChangedPropName );
+
+ bool impl_ensureUpToDateFieldList_nothrow();
+
+ void impl_adjustFormatToDataFieldType_nothrow( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XFormattedField >& _rxFormatted );
+ };
+
+//........................................................................
+} // namespace rptui
+//........................................................................
+
+#endif // REPORTDESIGN_FORMATNORMALIZER_HXX
diff --git a/reportdesign/source/core/sdr/makefile.mk b/reportdesign/source/core/sdr/makefile.mk
new file mode 100644
index 000000000000..5121b498b68d
--- /dev/null
+++ b/reportdesign/source/core/sdr/makefile.mk
@@ -0,0 +1,52 @@
+#*************************************************************************
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+PRJINC=$(PRJ)$/source
+PRJNAME=reportdesign
+TARGET=core_sdr
+ENABLE_EXCEPTIONS=TRUE
+# --- Settings -----------------------------------------------------
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/dll.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= $(SLO)$/RptModel.obj \
+ $(SLO)$/RptPage.obj \
+ $(SLO)$/UndoActions.obj \
+ $(SLO)$/RptObject.obj \
+ $(SLO)$/RptObjectListener.obj \
+ $(SLO)$/ModuleHelper.obj \
+ $(SLO)$/PropertyForward.obj \
+ $(SLO)$/ReportDrawPage.obj \
+ $(SLO)$/ReportUndoFactory.obj \
+ $(SLO)$/UndoEnv.obj \
+ $(SLO)$/formatnormalizer.obj
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk