summaryrefslogtreecommitdiff
path: root/reportdesign
diff options
context:
space:
mode:
authorHans-Joachim Lankenau <hjs@openoffice.org>2009-03-23 14:21:21 +0000
committerHans-Joachim Lankenau <hjs@openoffice.org>2009-03-23 14:21:21 +0000
commitbded2ca0f8e6b81c39100123c1792b3683e6cb3d (patch)
treea831bb70222babbbc916e4698110679bc5110390 /reportdesign
parent11667e5b56b768f52b22ecf2f28deaab5cd24fb1 (diff)
CWS-TOOLING: integrate CWS dba31k_DEV300
2009-03-17 11:26:36 +0100 oj r269582 : #i100219# clean up refcount handling
Diffstat (limited to 'reportdesign')
-rw-r--r--reportdesign/inc/ReportDefinition.hxx2
-rw-r--r--reportdesign/inc/RptModel.hxx2
-rw-r--r--reportdesign/source/core/api/FixedText.cxx3
-rw-r--r--reportdesign/source/core/api/FormattedField.cxx8
-rw-r--r--reportdesign/source/core/api/ImageControl.cxx4
-rw-r--r--reportdesign/source/core/api/ReportComponent.cxx22
-rw-r--r--reportdesign/source/core/api/ReportControlModel.cxx3
-rw-r--r--reportdesign/source/core/api/ReportDefinition.cxx89
-rw-r--r--reportdesign/source/core/api/Shape.cxx4
-rw-r--r--reportdesign/source/core/inc/ReportComponent.hxx2
-rw-r--r--reportdesign/source/core/inc/ReportControlModel.hxx2
-rw-r--r--reportdesign/source/core/sdr/ReportDrawPage.cxx17
-rw-r--r--reportdesign/source/core/sdr/RptModel.cxx54
13 files changed, 82 insertions, 130 deletions
diff --git a/reportdesign/inc/ReportDefinition.hxx b/reportdesign/inc/ReportDefinition.hxx
index d1f7bb1d9..05fe56947 100644
--- a/reportdesign/inc/ReportDefinition.hxx
+++ b/reportdesign/inc/ReportDefinition.hxx
@@ -365,6 +365,8 @@ namespace reportdesign
virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > getInteractionHandler() const;
virtual bool isEnableSetModified() const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getContext() const;
+
private:
/** loads the report definition from the given storage
diff --git a/reportdesign/inc/RptModel.hxx b/reportdesign/inc/RptModel.hxx
index b031a8ea0..9df615e0c 100644
--- a/reportdesign/inc/RptModel.hxx
+++ b/reportdesign/inc/RptModel.hxx
@@ -98,6 +98,8 @@ public:
/// returns the XReportDefinition which the OReportModel belongs to
::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >
getReportDefinition() const;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createShape(const ::rtl::OUString& aServiceSpecifier,::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& _rShape,sal_Int32 nOrientation = -1);
};
}
#endif
diff --git a/reportdesign/source/core/api/FixedText.cxx b/reportdesign/source/core/api/FixedText.cxx
index ae46cd3a4..8c0d2d4b5 100644
--- a/reportdesign/source/core/api/FixedText.cxx
+++ b/reportdesign/source/core/api/FixedText.cxx
@@ -110,9 +110,6 @@ void SAL_CALL OFixedText::dispose() throw(uno::RuntimeException)
FixedTextPropertySet::dispose();
cppu::WeakComponentImplHelperBase::dispose();
uno::Reference< report::XFixedText> xHoldAlive = this;
- {
- m_aProps.dispose(m_refCount);
- }
}
// -----------------------------------------------------------------------------
::rtl::OUString OFixedText::getImplementationName_Static( ) throw(uno::RuntimeException)
diff --git a/reportdesign/source/core/api/FormattedField.cxx b/reportdesign/source/core/api/FormattedField.cxx
index e7fb743b3..9a3ce6919 100644
--- a/reportdesign/source/core/api/FormattedField.cxx
+++ b/reportdesign/source/core/api/FormattedField.cxx
@@ -116,12 +116,8 @@ void SAL_CALL OFormattedField::dispose() throw(uno::RuntimeException)
{
FormattedFieldPropertySet::dispose();
cppu::WeakComponentImplHelperBase::dispose();
- uno::Reference< report::XFormattedField> xHoldAlive = this;
- {
- m_xFormatsSupplier.clear();
- m_xFunction.clear();
- m_aProps.dispose(m_refCount);
- }
+ m_xFormatsSupplier.clear();
+ m_xFunction.clear();
}
// -----------------------------------------------------------------------------
::rtl::OUString OFormattedField::getImplementationName_Static( ) throw(uno::RuntimeException)
diff --git a/reportdesign/source/core/api/ImageControl.cxx b/reportdesign/source/core/api/ImageControl.cxx
index 4d432f340..a60d031cf 100644
--- a/reportdesign/source/core/api/ImageControl.cxx
+++ b/reportdesign/source/core/api/ImageControl.cxx
@@ -182,10 +182,6 @@ void SAL_CALL OImageControl::dispose() throw(uno::RuntimeException)
{
ImageControlPropertySet::dispose();
cppu::WeakComponentImplHelperBase::dispose();
- uno::Reference< report::XImageControl> xHoldAlive = this;
- {
- m_aProps.dispose(m_refCount);
- }
}
// -----------------------------------------------------------------------------
::rtl::OUString OImageControl::getImplementationName_Static( ) throw(uno::RuntimeException)
diff --git a/reportdesign/source/core/api/ReportComponent.cxx b/reportdesign/source/core/api/ReportComponent.cxx
index f17dbc9e6..8ac8717f2 100644
--- a/reportdesign/source/core/api/ReportComponent.cxx
+++ b/reportdesign/source/core/api/ReportComponent.cxx
@@ -41,7 +41,7 @@
#include "ReportControlModel.hxx"
#include <com/sun/star/reflection/XProxyFactory.hpp>
#include <com/sun/star/text/ParagraphVertAlign.hpp>
-#include <svx/unoshape.hxx>
+// #include <svx/unoshape.hxx>
#include <svx/unolingu.hxx>
#include <svtools/syslocale.hxx>
#include <svtools/lingucfg.hxx>
@@ -122,10 +122,6 @@ void OReportComponentProperties::setShape(uno::Reference< drawing::XShape >& _xS
{
osl_incrementInterlockedCount( &_rRefCount );
{
- // decrement the count from ReportDrawPage.cxx aArgs[0] <<= SvxDrawPage::_CreateShape( pObj );
- SvxShape* pShape = SvxShape::getImplementation( _xShape );
- if ( pShape )
- pShape->release();
m_xProxy.set(_xShape,uno::UNO_QUERY);
::comphelper::query_aggregation(m_xProxy,m_xShape);
::comphelper::query_aggregation(m_xProxy,m_xProperty);
@@ -138,21 +134,7 @@ void OReportComponentProperties::setShape(uno::Reference< drawing::XShape >& _xS
if ( m_xProxy.is() )
m_xProxy->setDelegator( _xTunnel );
}
- // do not decrement the refcount again, this will be done from the any ReportDrawPage.cxx aArgs[0] <<= SvxDrawPage::_CreateShape( pObj ); , otherwise it will delete the object
- //osl_decrementInterlockedCount( &_rRefCount );
-}
-// -----------------------------------------------------------------------------
-void OReportComponentProperties::dispose(oslInterlockedCount& _rRefCount)
-{
- if ( m_xProxy.is() )
- osl_decrementInterlockedCount( &_rRefCount );
- //m_xShape.clear();
- //m_xTypeProvider.clear();
- //m_xUnoTunnel.clear();
- //m_xServiceInfo.clear();
- //m_xProperty.clear();
- m_xContext.clear();
- m_xFactory.clear();
+ osl_decrementInterlockedCount( &_rRefCount );
}
// -----------------------------------------------------------------------------
OReportComponentProperties::~OReportComponentProperties()
diff --git a/reportdesign/source/core/api/ReportControlModel.cxx b/reportdesign/source/core/api/ReportControlModel.cxx
index 2482f8e3e..1d1e92375 100644
--- a/reportdesign/source/core/api/ReportControlModel.cxx
+++ b/reportdesign/source/core/api/ReportControlModel.cxx
@@ -152,13 +152,12 @@ void OReportControlModel::checkIndex(sal_Int32 _nIndex)
throw lang::IndexOutOfBoundsException();
}
// -----------------------------------------------------------------------------
-void OReportControlModel::dispose(oslInterlockedCount& _rRefCount)
+void OReportControlModel::dispose()
{
m_aFormatConditions.clear();
lang::EventObject aDisposeEvent( m_pOwner );
aContainerListeners.disposeAndClear( aDisposeEvent );
m_aFormatConditions.clear();
- aComponent.dispose(_rRefCount);
}
// -----------------------------------------------------------------------------
bool OReportControlModel::isInterfaceForbidden(const uno::Type& _rType)
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index 580fb3d93..a199dac8e 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -705,7 +705,6 @@ void SAL_CALL OReportDefinition::dispose() throw(uno::RuntimeException)
{
ReportDefinitionPropertySet::dispose();
cppu::WeakComponentImplHelperBase::dispose();
- m_aProps->dispose(m_refCount);
}
// -----------------------------------------------------------------------------
void SAL_CALL OReportDefinition::disposing()
@@ -2069,68 +2068,19 @@ uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::createInstanceWith
::osl::MutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed);
-
- uno::Reference< drawing::XShape > xShape;
- uno::Reference< embed::XStorage > xStorage;
- sal_Int32 nOrientation = 1;
- const uno::Any* pIter = _aArgs.getConstArray();
- const uno::Any* pEnd = pIter + _aArgs.getLength();
- for(;pIter != pEnd ;++pIter)
- {
- beans::NamedValue aValue;
- *pIter >>= aValue;
- if ( aValue.Name == PROPERTY_SHAPE )
- xShape.set(aValue.Value,uno::UNO_QUERY);
- else if ( aValue.Name == PROPERTY_ORIENTATION )
- aValue.Value >>= nOrientation;
- else if( aValue.Name.equalsAscii( "Storage" ) )
- aValue.Value >>= xStorage;
- }
-
uno::Reference< uno::XInterface > xRet;
- if ( xShape.is() )
+ if ( aServiceSpecifier.indexOf( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver"))) == 0 )
{
- if ( aServiceSpecifier == SERVICE_FORMATTEDFIELD )
- {
- uno::Reference<report::XFormattedField> xProp = new OFormattedField(m_aProps->m_xContext,this,xShape);
- xRet = xProp;
- if ( xShape.is() )
- throw uno::Exception();
- xProp->setPropertyValue( PROPERTY_FORMATSSUPPLIER, uno::makeAny(uno::Reference< util::XNumberFormatsSupplier >(*this,uno::UNO_QUERY)) );
- }
- else if ( aServiceSpecifier == SERVICE_FIXEDTEXT)
- {
- xRet = static_cast<cppu::OWeakObject*>(new OFixedText(m_aProps->m_xContext,this,xShape));
- if ( xShape.is() )
- throw uno::Exception();
- }
- else if ( aServiceSpecifier == SERVICE_FIXEDLINE)
- {
- xRet = static_cast<cppu::OWeakObject*>(new OFixedLine(m_aProps->m_xContext,this,xShape,nOrientation));
- if ( xShape.is() )
- throw uno::Exception();
- }
- else if ( aServiceSpecifier == SERVICE_IMAGECONTROL )
- {
- xRet = static_cast<cppu::OWeakObject*>(new OImageControl(m_aProps->m_xContext,this,xShape));
- if ( xShape.is() )
- throw uno::Exception();
- }
- else if ( aServiceSpecifier == SERVICE_REPORTDEFINITION )
- {
- xRet = static_cast<cppu::OWeakObject*>(new OReportDefinition(m_aProps->m_xContext,this,xShape));
- if ( xShape.is() )
- throw uno::Exception();
- }
- else if ( xShape.is() )
+ uno::Reference< embed::XStorage > xStorage;
+ const uno::Any* pIter = _aArgs.getConstArray();
+ const uno::Any* pEnd = pIter + _aArgs.getLength();
+ for(;pIter != pEnd ;++pIter)
{
- xRet = static_cast<cppu::OWeakObject*>(new OShape(m_aProps->m_xContext,this,xShape,aServiceSpecifier));
- if ( xShape.is() )
- throw uno::Exception();
- }
- }
- else if ( aServiceSpecifier.indexOf( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver"))) == 0 )
- {
+ beans::NamedValue aValue;
+ *pIter >>= aValue;
+ if( aValue.Name.equalsAscii( "Storage" ) )
+ aValue.Value >>= xStorage;
+ } // for(;pIter != pEnd ;++pIter)
m_pImpl->m_pObjectContainer->SwitchPersistence(xStorage);
xRet = static_cast< ::cppu::OWeakObject* >(SvXMLEmbeddedObjectHelper::Create( xStorage,*this, EMBEDDEDOBJECTHELPER_MODE_READ ));
}
@@ -2256,19 +2206,7 @@ uno::Reference< uno::XInterface > SAL_CALL OReportDefinition::createInstance( co
else
xShape.set(SvxUnoDrawMSFactory::createInstance( aServiceSpecifier ),uno::UNO_QUERY_THROW);
-
- uno::Reference< uno::XInterface > xReturn;
- {
- uno::Sequence< uno::Any > aArgs(1);
- {
- beans::NamedValue aValue;
- aValue.Name = PROPERTY_SHAPE;
- aValue.Value <<= xShape; xShape.clear(); // keep exactly *one* reference!
- aArgs[0] <<= aValue;
- }
- xReturn = createInstanceWithArguments(aServiceSpecifier,aArgs);
- }
- return xReturn;
+ return m_pImpl->m_pReportModel->createShape(aServiceSpecifier,xShape);
}
//-----------------------------------------------------------------------------
uno::Sequence< ::rtl::OUString > SAL_CALL OReportDefinition::getAvailableServiceNames(void) throw( uno::RuntimeException )
@@ -2770,6 +2708,11 @@ uno::Reference< document::XDocumentProperties > SAL_CALL OReportDefinition::getD
}
return m_pImpl->m_xDocumentProperties;
}
+// -----------------------------------------------------------------------------
+uno::Reference< uno::XComponentContext > OReportDefinition::getContext() const
+{
+ return m_aProps->m_xContext;
+}
// =============================================================================
}// namespace reportdesign
// =============================================================================
diff --git a/reportdesign/source/core/api/Shape.cxx b/reportdesign/source/core/api/Shape.cxx
index 15a43705b..787841430 100644
--- a/reportdesign/source/core/api/Shape.cxx
+++ b/reportdesign/source/core/api/Shape.cxx
@@ -126,10 +126,6 @@ void SAL_CALL OShape::dispose() throw(uno::RuntimeException)
{
ShapePropertySet::dispose();
cppu::WeakComponentImplHelperBase::dispose();
- uno::Reference< report::XShape> xHoldAlive = this;
- {
- m_aProps.dispose(m_refCount);
- }
}
// -----------------------------------------------------------------------------
::rtl::OUString OShape::getImplementationName_Static( ) throw(uno::RuntimeException)
diff --git a/reportdesign/source/core/inc/ReportComponent.hxx b/reportdesign/source/core/inc/ReportComponent.hxx
index a38fde655..19c2aaa1c 100644
--- a/reportdesign/source/core/inc/ReportComponent.hxx
+++ b/reportdesign/source/core/inc/ReportComponent.hxx
@@ -85,8 +85,6 @@ namespace reportdesign
void setShape(::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& _xShape
,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xTunnel
,oslInterlockedCount& _rRefCount);
-
- void dispose(oslInterlockedCount& _rRefCount);
};
}
#endif // RPT_REPORTCOMPONENT_HXX
diff --git a/reportdesign/source/core/inc/ReportControlModel.hxx b/reportdesign/source/core/inc/ReportControlModel.hxx
index 8fa90a897..7aecc8c29 100644
--- a/reportdesign/source/core/inc/ReportControlModel.hxx
+++ b/reportdesign/source/core/inc/ReportControlModel.hxx
@@ -115,7 +115,7 @@ namespace reportdesign
,bPrintWhenGroupChange(sal_False)
{}
- void dispose(oslInterlockedCount& _rRefCount);
+ void dispose();
// XContainer
void addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
diff --git a/reportdesign/source/core/sdr/ReportDrawPage.cxx b/reportdesign/source/core/sdr/ReportDrawPage.cxx
index 57f34e063..5c930ce35 100644
--- a/reportdesign/source/core/sdr/ReportDrawPage.cxx
+++ b/reportdesign/source/core/sdr/ReportDrawPage.cxx
@@ -30,6 +30,7 @@
#include "ReportDrawPage.hxx"
#include "RptObject.hxx"
+#include "RptModel.hxx"
#include "RptDef.hxx"
#include "corestrings.hrc"
#include <comphelper/mimeconfighelper.hxx>
@@ -143,20 +144,8 @@ uno::Reference< drawing::XShape > OReportDrawPage::_CreateShape( SdrObject *pOb
try
{
- uno::Sequence< uno::Any > aArgs(bChangeOrientation ? 2 : 1);
- {
- beans::NamedValue aValue;
- aValue.Name = PROPERTY_SHAPE;
- aValue.Value <<= xShape; xShape.clear(); // keep exactly *one* reference!
- aArgs[0] <<= aValue;
- if ( bChangeOrientation )
- {
- aValue.Name = PROPERTY_ORIENTATION;
- aValue.Value <<= sal_Int32(0);
- aArgs[1] <<= aValue;
- }
- }
- xRet.set( xFactory->createInstanceWithArguments( sServiceName, aArgs ), uno::UNO_QUERY_THROW );
+ OReportModel* pRptModel = static_cast<OReportModel*>(pObj->GetModel());
+ xRet.set( pRptModel->createShape(sServiceName,xShape,bChangeOrientation ? 0 : -1), uno::UNO_QUERY_THROW );
}
catch( const uno::Exception& )
{
diff --git a/reportdesign/source/core/sdr/RptModel.cxx b/reportdesign/source/core/sdr/RptModel.cxx
index 58e56b514..f1c04c795 100644
--- a/reportdesign/source/core/sdr/RptModel.cxx
+++ b/reportdesign/source/core/sdr/RptModel.cxx
@@ -48,10 +48,15 @@
#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);
@@ -179,6 +184,53 @@ 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
//==================================================================