fpicker/source/win32/folderpicker/MtaFop.cxx | 6 reportdesign/inc/UndoEnv.hxx | 2 reportdesign/source/core/api/ReportDefinition.cxx | 6 reportdesign/source/core/api/Section.cxx | 147 ++++++++++++---------- reportdesign/source/core/inc/Section.hxx | 46 +++++- reportdesign/source/core/inc/Tools.hxx | 2 6 files changed, 126 insertions(+), 83 deletions(-)
New commits: commit 0abceaaf623cb358b45c106b9f2af87a931ff9a6 Author: Michael Stahl <[email protected]> Date: Thu Aug 9 23:52:35 2012 +0200 refactor reportdesign::OSection construction Indended to solve a problem that turned out to be imaginary. Change-Id: I185887f6e45869102ac600717a0bb7564ebdb7e5 diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index 1e8433b..e67d75c 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -661,7 +661,7 @@ OReportDefinition::OReportDefinition(uno::Reference< uno::XComponentContext > co { init(); m_pImpl->m_xGroups = new OGroups(this,m_aProps->m_xContext); - m_pImpl->m_xDetail = new OSection(this,m_aProps->m_xContext); + m_pImpl->m_xDetail = OSection::createOSection(this,m_aProps->m_xContext); m_pImpl->m_xDetail->setName(RPT_RESSTRING(RID_STR_DETAIL,m_aProps->m_xContext->getServiceManager())); } osl_decrementInterlockedCount( &m_refCount ); @@ -682,7 +682,7 @@ OReportDefinition::OReportDefinition(uno::Reference< uno::XComponentContext > co m_aProps->setShape(_xShape,this,m_refCount); init(); m_pImpl->m_xGroups = new OGroups(this,m_aProps->m_xContext); - m_pImpl->m_xDetail = new OSection(this,m_aProps->m_xContext); + m_pImpl->m_xDetail = OSection::createOSection(this,m_aProps->m_xContext); m_pImpl->m_xDetail->setName(RPT_RESSTRING(RID_STR_DETAIL,m_aProps->m_xContext->getServiceManager())); } osl_decrementInterlockedCount( &m_refCount ); @@ -703,7 +703,7 @@ OReportDefinition::OReportDefinition(const OReportDefinition& _rCopy) OGroups* pGroups = new OGroups(this,m_aProps->m_xContext); m_pImpl->m_xGroups = pGroups; pGroups->copyGroups(_rCopy.m_pImpl->m_xGroups); - m_pImpl->m_xDetail = new OSection(this,m_aProps->m_xContext); + m_pImpl->m_xDetail = OSection::createOSection(this,m_aProps->m_xContext); OSection::lcl_copySection(_rCopy.m_pImpl->m_xDetail,m_pImpl->m_xDetail); setPageHeaderOn(_rCopy.m_pImpl->m_xPageHeader.is()); diff --git a/reportdesign/source/core/api/Section.cxx b/reportdesign/source/core/api/Section.cxx index 8142bef..0bde01b 100644 --- a/reportdesign/source/core/api/Section.cxx +++ b/reportdesign/source/core/api/Section.cxx @@ -52,6 +52,7 @@ namespace reportdesign using namespace com::sun::star; using namespace comphelper; DBG_NAME( rpt_OSection ) + // ----------------------------------------------------------------------------- uno::Sequence< ::rtl::OUString> lcl_getGroupAbsent() { @@ -64,31 +65,6 @@ uno::Sequence< ::rtl::OUString> lcl_getGroupAbsent() } // ----------------------------------------------------------------------------- -OSection::OSection( const uno::Reference< report::XGroup >& _xParent - ,const uno::Reference< uno::XComponentContext >& context - ,bool /*_bPageSection*/) -:SectionBase(m_aMutex) -,SectionPropertySet(context,static_cast< Implements >(IMPLEMENTS_PROPERTY_SET),lcl_getGroupAbsent()) -,m_aContainerListeners(m_aMutex) -,m_xContext(context) -,m_xGroup(_xParent) -,m_nHeight(3000) -,m_nBackgroundColor(COL_TRANSPARENT) -,m_nForceNewPage(report::ForceNewPage::NONE) -,m_nNewRowOrCol(report::ForceNewPage::NONE) -,m_bKeepTogether(sal_False) -,m_bCanGrow(sal_False) -,m_bCanShrink(sal_False) -,m_bRepeatSection(sal_False) -,m_bVisible(sal_True) -,m_bBacktransparent(sal_True) -,m_bInRemoveNotify(false) -,m_bInInsertNotify(false) -{ - DBG_CTOR( rpt_OSection,NULL); - init(); -} -// ----------------------------------------------------------------------------- uno::Sequence< ::rtl::OUString> lcl_getAbsent(bool _bPageSection) { if ( _bPageSection ) @@ -112,15 +88,40 @@ uno::Sequence< ::rtl::OUString> lcl_getAbsent(bool _bPageSection) return uno::Sequence< ::rtl::OUString >(pProps,sizeof(pProps)/sizeof(pProps[0])); } + +uno::Reference<report::XSection> OSection::createOSection( + const uno::Reference< report::XReportDefinition >& xParentDef, + const uno::Reference< uno::XComponentContext >& context, + bool const bPageSection) +{ + OSection *const pNew = + new OSection(xParentDef, 0, context, lcl_getAbsent(bPageSection)); + pNew->init(); + return pNew; +} + +uno::Reference<report::XSection> OSection::createOSection( + const uno::Reference< report::XGroup >& xParentGroup, + const uno::Reference< uno::XComponentContext >& context, + bool const) +{ + OSection *const pNew = + new OSection(0, xParentGroup, context, lcl_getGroupAbsent()); + pNew->init(); + return pNew; +} + // ----------------------------------------------------------------------------- -OSection::OSection(const uno::Reference< report::XReportDefinition >& _xParent +OSection::OSection(const uno::Reference< report::XReportDefinition >& xParentDef + ,const uno::Reference< report::XGroup >& xParentGroup ,const uno::Reference< uno::XComponentContext >& context - ,bool _bPageSection) + ,uno::Sequence< ::rtl::OUString> const& rStrings) :SectionBase(m_aMutex) -,SectionPropertySet(context,SectionPropertySet::IMPLEMENTS_PROPERTY_SET,lcl_getAbsent(_bPageSection)) +,SectionPropertySet(context,SectionPropertySet::IMPLEMENTS_PROPERTY_SET,rStrings) ,m_aContainerListeners(m_aMutex) ,m_xContext(context) -,m_xReportDefinition(_xParent) +,m_xGroup(xParentGroup) +,m_xReportDefinition(xParentDef) ,m_nHeight(3000) ,m_nBackgroundColor(COL_TRANSPARENT) ,m_nForceNewPage(report::ForceNewPage::NONE) @@ -135,7 +136,6 @@ OSection::OSection(const uno::Reference< report::XReportDefinition >& _xParent ,m_bInInsertNotify(false) { DBG_CTOR( rpt_OSection,NULL); - init(); } //-------------------------------------------------------------------------- // TODO: VirtualFunctionFinder: This is virtual function! diff --git a/reportdesign/source/core/inc/Section.hxx b/reportdesign/source/core/inc/Section.hxx index 23deea5..c117126 100644 --- a/reportdesign/source/core/inc/Section.hxx +++ b/reportdesign/source/core/inc/Section.hxx @@ -115,9 +115,17 @@ namespace reportdesign public: typedef ::comphelper::ImplementationReference< OSection ,::com::sun::star::report::XSection,::com::sun::star::uno::XWeak > TSection; - OSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& _xParent + private: + OSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& xParentDef + ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& xParentGroup + ,const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& context, + ::com::sun::star::uno::Sequence< ::rtl::OUString> const&); + public: + static ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection> + createOSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& _xParent ,const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& context,bool _bPageSection=false); - OSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& _xParent + static ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection> + createOSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& _xParent ,const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& context,bool _bPageSection=false); DECLARE_XINTERFACE( ) diff --git a/reportdesign/source/core/inc/Tools.hxx b/reportdesign/source/core/inc/Tools.hxx index 1be4ad8..f9a00b6 100644 --- a/reportdesign/source/core/inc/Tools.hxx +++ b/reportdesign/source/core/inc/Tools.hxx @@ -47,7 +47,7 @@ namespace reportdesign template <class T> void lcl_createSectionIfNeeded(sal_Bool _bOn,const T& _xParent,::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection/*in/out*/,bool _bPageSection = false) { if ( _bOn && !_xSection.is() ) - _xSection = new OSection(_xParent,_xParent->getContext(),_bPageSection); + _xSection = OSection::createOSection(_xParent,_xParent->getContext(),_bPageSection); else if ( !_bOn ) ::comphelper::disposeComponent(_xSection); } commit 8ec791316c1d90b25e85c94ad105e9cc62e568e2 Author: Michael Stahl <[email protected]> Date: Thu Aug 9 22:18:42 2012 +0200 fdo#53154: fix report design wizard crash: As described by Stephan in the bug report, the XAggregation usage in OSection of SvxFmDrawPage is broken; replace it by explicit forwarding of the XDrawPage, XShapeGrouper, XFormsSupplier2 methods; it seems to fix the crash here. Also get rid of horrid refcount manipulation etc. while at it. Change-Id: Ib08830d2092bd2026db5b57c1c2e165b946889b3 diff --git a/reportdesign/inc/UndoEnv.hxx b/reportdesign/inc/UndoEnv.hxx index 3996fb8..2923b91 100644 --- a/reportdesign/inc/UndoEnv.hxx +++ b/reportdesign/inc/UndoEnv.hxx @@ -23,6 +23,8 @@ #include <com/sun/star/beans/PropertyChangeEvent.hpp> #include <com/sun/star/container/XContainerListener.hpp> #include <com/sun/star/report/XReportDefinition.hpp> + +#include <cppuhelper/compbase3.hxx> #include <memory> #include <svl/lstner.hxx> diff --git a/reportdesign/source/core/api/Section.cxx b/reportdesign/source/core/api/Section.cxx index dd054af..8142bef 100644 --- a/reportdesign/source/core/api/Section.cxx +++ b/reportdesign/source/core/api/Section.cxx @@ -143,8 +143,6 @@ OSection::OSection(const uno::Reference< report::XReportDefinition >& _xParent OSection::~OSection() { DBG_DTOR( rpt_OSection,NULL); - if ( m_xProxy.is() ) - m_xProxy->setDelegator( NULL ); } //-------------------------------------------------------------------------- //IMPLEMENT_FORWARD_XINTERFACE2(OSection,SectionBase,SectionPropertySet) @@ -159,7 +157,7 @@ uno::Any SAL_CALL OSection::queryInterface( const uno::Type& _rType ) throw (uno if ( !aReturn.hasValue() && OReportControlModel::isInterfaceForbidden(_rType) ) return aReturn; - return aReturn.hasValue() ? aReturn : (m_xProxy.is() ? m_xProxy->queryAggregation(_rType) : aReturn); + return aReturn; } // ----------------------------------------------------------------------------- @@ -206,33 +204,18 @@ void OSection::init() { uno::Reference< report::XReportDefinition> xReport = getReportDefinition(); ::boost::shared_ptr<rptui::OReportModel> pModel = OReportDefinition::getSdrModel(xReport); - OSL_ENSURE(pModel,"No odel set at the report definition!"); + assert(pModel); //"No model set at the report definition!" if ( pModel ) { -// DO NOT TOUCH THIS BLOCKS, WE HAVE A COMPILER PROBLEM UNDER SOLARIS X86 - osl_incrementInterlockedCount( &m_refCount ); - { - uno::Reference<report::XSection> xTemp = this; - { - { - m_xProxy.set(pModel->createNewPage(xTemp)->getUnoPage(),uno::UNO_QUERY); - } - { - ::comphelper::query_aggregation(m_xProxy,m_xDrawPage); - } - - // set ourself as delegator - { - if ( m_xProxy.is() ) - { - m_xProxy->setDelegator( xTemp ); - } - } - } - xTemp.clear(); - } -// DO NOT TOUCH THIS BLOCKS, WE HAVE A COMPILER PROBLEM UNDER SOLARIS X86 - osl_decrementInterlockedCount( &m_refCount ); + uno::Reference<report::XSection> const xSection(this); + m_xDrawPage.set(pModel->createNewPage(xSection)->getUnoPage(), + uno::UNO_QUERY_THROW); + m_xDrawPage_ShapeGrouper.set(m_xDrawPage, uno::UNO_QUERY_THROW); + // apparently we may also get OReportDrawPage which doesn't support this + m_xDrawPage_FormSupplier.set(m_xDrawPage, uno::UNO_QUERY); + // createNewPage _should_ have stored away 2 uno::References to this, + // so our ref count cannot be 1 here, so this isn't destroyed here + assert(m_refCount > 1); } } // ----------------------------------------------------------------------------- @@ -546,14 +529,14 @@ uno::Type SAL_CALL OSection::getElementType( ) throw (uno::RuntimeException) uno::Any SAL_CALL OSection::getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - return m_xDrawPage->getByIndex(Index); + return m_xDrawPage.is() ? m_xDrawPage->getByIndex(Index) : uno::Any(); } // ----------------------------------------------------------------------------- // XEnumerationAccess uno::Reference< container::XEnumeration > SAL_CALL OSection::createEnumeration( ) throw (uno::RuntimeException) { ::osl::MutexGuard aGuard(m_aMutex); - return new ::comphelper::OEnumerationByIndex(static_cast<XIndexAccess*>(this)); + return new ::comphelper::OEnumerationByIndex(static_cast<XSection*>(this)); } // ----------------------------------------------------------------------------- uno::Reference< beans::XPropertySetInfo > SAL_CALL OSection::getPropertySetInfo( ) throw(uno::RuntimeException) @@ -633,7 +616,45 @@ void SAL_CALL OSection::remove( const uno::Reference< drawing::XShape >& xShape } notifyElementRemoved(xShape); } -// ----------------------------------------------------------------------------- + +// XShapeGrouper +uno::Reference< drawing::XShapeGroup > SAL_CALL +OSection::group(uno::Reference< drawing::XShapes > const& xShapes) + throw (uno::RuntimeException) +{ + // no lock because m_xDrawPage_ShapeGrouper is const + return (m_xDrawPage_ShapeGrouper.is()) + ? m_xDrawPage_ShapeGrouper->group(xShapes) + : 0; +} +void SAL_CALL +OSection::ungroup(uno::Reference<drawing::XShapeGroup> const& xGroup) + throw (uno::RuntimeException) +{ + // no lock because m_xDrawPage_ShapeGrouper is const + if (m_xDrawPage_ShapeGrouper.is()) { + m_xDrawPage_ShapeGrouper->ungroup(xGroup); + } +} + +// XFormsSupplier +uno::Reference<container::XNameContainer> SAL_CALL OSection::getForms() + throw (uno::RuntimeException) +{ + // no lock because m_xDrawPage_FormSupplier is const + return (m_xDrawPage_FormSupplier.is()) + ? m_xDrawPage_FormSupplier->getForms() + : 0; +} +// XFormsSupplier2 +sal_Bool SAL_CALL OSection::hasForms() throw (uno::RuntimeException) +{ + // no lock because m_xDrawPage_FormSupplier is const + return (m_xDrawPage_FormSupplier.is()) + ? m_xDrawPage_FormSupplier->hasForms() + : 0; +} + // ----------------------------------------------------------------------------- // com::sun::star::lang::XUnoTunnel //------------------------------------------------------------------ @@ -641,9 +662,7 @@ sal_Int64 OSection::getSomething( const uno::Sequence< sal_Int8 > & rId ) throw { if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) ) return reinterpret_cast<sal_Int64>(this); - uno::Reference< lang::XUnoTunnel> xTunnel; - ::comphelper::query_aggregation(m_xProxy,xTunnel); - return xTunnel->getSomething(rId); + return (m_xDrawPage_Tunnel.is()) ? m_xDrawPage_Tunnel->getSomething(rId) : 0; } // ----------------------------------------------------------------------------- diff --git a/reportdesign/source/core/inc/Section.hxx b/reportdesign/source/core/inc/Section.hxx index 0d5d5e9..23deea5 100644 --- a/reportdesign/source/core/inc/Section.hxx +++ b/reportdesign/source/core/inc/Section.hxx @@ -20,14 +20,16 @@ #define REPORTDESIGN_API_SECTION_HXX #include <com/sun/star/report/XSection.hpp> -#include <cppuhelper/compbase3.hxx> +#include <cppuhelper/compbase6.hxx> #include <comphelper/broadcasthelper.hxx> #include <comphelper/uno3.hxx> #include <comphelper/types.hxx> #include <cppuhelper/propertysetmixin.hxx> #include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/drawing/XDrawPage.hpp> +#include <com/sun/star/drawing/XShapeGrouper.hpp> #include <com/sun/star/drawing/XShapes.hpp> -#include <com/sun/star/uno/XAggregation.hpp> +#include <com/sun/star/form/XFormsSupplier2.hpp> #include <comphelper/stl_types.hxx> #include <comphelper/implementationreference.hxx> #include <com/sun/star/lang/XUnoTunnel.hpp> @@ -35,9 +37,16 @@ namespace reportdesign { - typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::report::XSection - , ::com::sun::star::lang::XServiceInfo - , ::com::sun::star::lang::XUnoTunnel> SectionBase; + typedef ::cppu::WeakComponentImplHelper6 + < ::com::sun::star::report::XSection + , ::com::sun::star::lang::XServiceInfo + , ::com::sun::star::lang::XUnoTunnel + // SvxDrawPage forward + , ::com::sun::star::drawing::XDrawPage + , ::com::sun::star::drawing::XShapeGrouper + // SvxFmDrawPage forward + , ::com::sun::star::form::XFormsSupplier2 + > SectionBase; typedef ::cppu::PropertySetMixin<com::sun::star::report::XSection> SectionPropertySet; class OSection : public comphelper::OMutexAndBroadcastHelper, @@ -46,8 +55,10 @@ namespace reportdesign { ::cppu::OInterfaceContainerHelper m_aContainerListeners; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > m_xDrawPage; - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > m_xProxy; + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > m_xDrawPage; + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGrouper > m_xDrawPage_ShapeGrouper; + ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormsSupplier2 > m_xDrawPage_FormSupplier; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > m_xDrawPage_Tunnel; ::com::sun::star::uno::WeakReference< ::com::sun::star::report::XGroup > m_xGroup; ::com::sun::star::uno::WeakReference< ::com::sun::star::report::XReportDefinition > m_xReportDefinition; ::rtl::OUString m_sName; @@ -168,6 +179,15 @@ namespace reportdesign // XShapes virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw (::com::sun::star::uno::RuntimeException); + // XShapeGrouper + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup > SAL_CALL group( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL ungroup( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup >& aGroup ) throw (::com::sun::star::uno::RuntimeException); + + // XFormsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL getForms() throw (::com::sun::star::uno::RuntimeException); + // XFormsSupplier2 + virtual sal_Bool SAL_CALL hasForms() throw (::com::sun::star::uno::RuntimeException); + // XIndexAccess virtual ::sal_Int32 SAL_CALL getCount( ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); commit bbc1742dc862a9aa774dffc8cb2771ecb3164bd3 Author: Michael Stahl <[email protected]> Date: Thu Aug 9 14:55:16 2012 +0200 fpicker: remove bizarre #pragma message "SendMessageW wrapper..." Change-Id: I04ae269d4712b8fcfc7e882c9f53edd91317d02c diff --git a/fpicker/source/win32/folderpicker/MtaFop.cxx b/fpicker/source/win32/folderpicker/MtaFop.cxx index c7a8ca2..9806c72 100644 --- a/fpicker/source/win32/folderpicker/MtaFop.cxx +++ b/fpicker/source/win32/folderpicker/MtaFop.cxx @@ -495,12 +495,6 @@ void SAL_CALL CMtaFolderPicker::setSelection( const rtl::OUString& aDirectory ) { OSL_ASSERT( IsWindow( m_hwnd ) ); -#ifdef _MSC_VER -#pragma message( "#######################################" ) -#pragma message( "SendMessageW wrapper has to be extended" ) -#pragma message( "#######################################" ) -#endif - SendMessageW( m_hwnd, BFFM_SETSELECTIONW, _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
