chart2/inc/ChartModel.hxx | 5 - chart2/source/controller/accessibility/AccessibleBase.cxx | 32 ++++------ chart2/source/controller/inc/AccessibleBase.hxx | 13 ---- chart2/source/controller/main/ControllerCommandDispatch.cxx | 35 +++++------- chart2/source/controller/main/ControllerCommandDispatch.hxx | 4 - chart2/source/model/main/ChartModel.cxx | 35 +++++------- lotuswordpro/source/filter/xfilter/xfsaxattrlist.cxx | 20 +++--- lotuswordpro/source/filter/xfilter/xfsaxattrlist.hxx | 11 +-- 8 files changed, 66 insertions(+), 89 deletions(-)
New commits: commit b1211e965aa7883b0c3fc157f6c56b48c8bb0462 Author: Noel Grandin <[email protected]> Date: Mon Jan 23 16:09:10 2017 +0200 use rtl::Reference in XFSaxAttrList instead of storing both a raw pointer and an uno::Reference Change-Id: I227ac624b03a172e10840c4d1e2c4ca0362b33a4 diff --git a/lotuswordpro/source/filter/xfilter/xfsaxattrlist.cxx b/lotuswordpro/source/filter/xfilter/xfsaxattrlist.cxx index 6415f3c..ffd3628 100644 --- a/lotuswordpro/source/filter/xfilter/xfsaxattrlist.cxx +++ b/lotuswordpro/source/filter/xfilter/xfsaxattrlist.cxx @@ -62,24 +62,26 @@ XFSaxAttrList::XFSaxAttrList() { - m_pSvAttrList = new SvXMLAttributeList(); - m_xAttrList.set(m_pSvAttrList); + m_xSvAttrList = new SvXMLAttributeList(); } XFSaxAttrList::~XFSaxAttrList() { - //pls don't delete m_pSvAttrList,because when m_xAttrList release,the object will be automatic deleted. -// if( m_pSvAttrList ) -// delete m_pSvAttrList; } -void XFSaxAttrList::AddAttribute(const OUString& name, const OUString& value) +void XFSaxAttrList::AddAttribute(const OUString& name, const OUString& value) { - m_pSvAttrList->AddAttribute(name,value); + m_xSvAttrList->AddAttribute(name,value); } -void XFSaxAttrList::Clear() +void XFSaxAttrList::Clear() { - m_pSvAttrList->Clear(); + m_xSvAttrList->Clear(); } + +css::uno::Reference<css::xml::sax::XAttributeList> XFSaxAttrList::GetAttributeList() const +{ + return m_xSvAttrList.get(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/xfilter/xfsaxattrlist.hxx b/lotuswordpro/source/filter/xfilter/xfsaxattrlist.hxx index 23e1ebe..1cbc37c 100644 --- a/lotuswordpro/source/filter/xfilter/xfsaxattrlist.hxx +++ b/lotuswordpro/source/filter/xfilter/xfsaxattrlist.hxx @@ -61,6 +61,7 @@ #define INCLUDED_LOTUSWORDPRO_SOURCE_FILTER_XFILTER_XFSAXATTRLIST_HXX #include "ixfattrlist.hxx" +#include <rtl/ref.hxx> #include <xmloff/attrlist.hxx> #include <com/sun/star/xml/sax/XDocumentHandler.hpp> @@ -77,20 +78,14 @@ public: virtual void Clear() override; - const css::uno::Reference<css::xml::sax::XAttributeList>& GetAttributeList() const; + css::uno::Reference<css::xml::sax::XAttributeList> GetAttributeList() const; friend class XFSaxStream; private: - SvXMLAttributeList *m_pSvAttrList; - css::uno::Reference<css::xml::sax::XAttributeList> m_xAttrList; + rtl::Reference<SvXMLAttributeList> m_xSvAttrList; }; -inline const css::uno::Reference<css::xml::sax::XAttributeList>& XFSaxAttrList::GetAttributeList() const -{ - return m_xAttrList; -} - #endif //XFSAXATTRLIST_INC /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit bd281dc6e1f3cd5e4785baeeb908a3eca25a7481 Author: Noel Grandin <[email protected]> Date: Mon Jan 23 14:15:34 2017 +0200 use rtl::Reference in AccessibleBase instead of storing both a raw pointer and an uno::Reference Change-Id: I583de7a25893baa65363aa6d3199564f63f4fa60 diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx index 9d40cc5..64fef56 100644 --- a/chart2/source/controller/accessibility/AccessibleBase.cxx +++ b/chart2/source/controller/accessibility/AccessibleBase.cxx @@ -80,19 +80,18 @@ AccessibleBase::AccessibleBase( m_bMayHaveChildren( bMayHaveChildren ), m_bChildrenInitialized( false ), m_nEventNotifierId(0), - m_pStateSetHelper( new ::utl::AccessibleStateSetHelper() ), - m_aStateSet( m_pStateSetHelper ), + m_xStateSetHelper( new ::utl::AccessibleStateSetHelper() ), m_aAccInfo( rAccInfo ), m_bAlwaysTransparent( bAlwaysTransparent ), m_bStateSetInitialized( false ) { // initialize some states - OSL_ASSERT( m_pStateSetHelper ); - m_pStateSetHelper->AddState( AccessibleStateType::ENABLED ); - m_pStateSetHelper->AddState( AccessibleStateType::SHOWING ); - m_pStateSetHelper->AddState( AccessibleStateType::VISIBLE ); - m_pStateSetHelper->AddState( AccessibleStateType::SELECTABLE ); - m_pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE ); + OSL_ASSERT( m_xStateSetHelper.is() ); + m_xStateSetHelper->AddState( AccessibleStateType::ENABLED ); + m_xStateSetHelper->AddState( AccessibleStateType::SHOWING ); + m_xStateSetHelper->AddState( AccessibleStateType::VISIBLE ); + m_xStateSetHelper->AddState( AccessibleStateType::SELECTABLE ); + m_xStateSetHelper->AddState( AccessibleStateType::FOCUSABLE ); } AccessibleBase::~AccessibleBase() @@ -192,16 +191,16 @@ void AccessibleBase::AddState( sal_Int16 aState ) throw (RuntimeException) { CheckDisposeState(); - OSL_ASSERT( m_pStateSetHelper ); - m_pStateSetHelper->AddState( aState ); + OSL_ASSERT( m_xStateSetHelper.is() ); + m_xStateSetHelper->AddState( aState ); } void AccessibleBase::RemoveState( sal_Int16 aState ) throw (RuntimeException) { CheckDisposeState(); - OSL_ASSERT( m_pStateSetHelper ); - m_pStateSetHelper->RemoveState( aState ); + OSL_ASSERT( m_xStateSetHelper.is() ); + m_xStateSetHelper->RemoveState( aState ); } bool AccessibleBase::UpdateChildren() @@ -453,16 +452,11 @@ void SAL_CALL AccessibleBase::disposing() // reset pointers m_aAccInfo.m_pParent = nullptr; - // invalidate implementation for helper, but keep UNO reference to still - // allow a tool to query the DEFUNC state. - // Note: The object will be deleted when the last reference is released - m_pStateSetHelper = nullptr; - // attach new empty state set helper to member reference ::utl::AccessibleStateSetHelper * pHelper = new ::utl::AccessibleStateSetHelper(); pHelper->AddState( AccessibleStateType::DEFUNC ); // release old helper and attach new one - m_aStateSet.set( pHelper ); + m_xStateSetHelper = pHelper; m_bIsDisposed = true; @@ -607,7 +601,7 @@ Reference< XAccessibleStateSet > SAL_CALL AccessibleBase::getAccessibleStateSet( m_bStateSetInitialized = true; } - return m_aStateSet; + return m_xStateSetHelper.get(); } lang::Locale SAL_CALL AccessibleBase::getLocale() diff --git a/chart2/source/controller/inc/AccessibleBase.hxx b/chart2/source/controller/inc/AccessibleBase.hxx index d822c39..07416ae 100644 --- a/chart2/source/controller/inc/AccessibleBase.hxx +++ b/chart2/source/controller/inc/AccessibleBase.hxx @@ -35,6 +35,7 @@ #include <cppuhelper/compbase.hxx> #include <cppuhelper/interfacecontainer.hxx> #include <unotools/accessiblestatesethelper.hxx> +#include <rtl/ref.hxx> #include <map> #include <memory> @@ -339,17 +340,7 @@ private: Note: This member must come before m_aStateSet! */ - ::utl::AccessibleStateSetHelper * m_pStateSetHelper; - /** this is returned in getAccessibleStateSet(). - - The implementation is an ::utl::AccessibleStateSetHelper. To access - implementation methods use m_pStateSetHelper. - - Note: Keeping this reference ensures, that the helper object is only - destroyed after this object has been disposed(). - */ - css::uno::Reference< css::accessibility::XAccessibleStateSet > - m_aStateSet; + rtl::Reference<::utl::AccessibleStateSetHelper> m_xStateSetHelper; AccessibleElementInfo m_aAccInfo; const bool m_bAlwaysTransparent; commit 33319078e965d4597db9c7ce72ab910f3e0d4e7d Author: Noel Grandin <[email protected]> Date: Mon Jan 23 14:11:15 2017 +0200 use rtl::Reference in ControllerCommandDispatch rather than storing both a raw pointer and an uno::Reference Change-Id: I46496da508689d82211940da765d53378f72fd7a diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx b/chart2/source/controller/main/ControllerCommandDispatch.cxx index 3f32b4d..4175eb8 100644 --- a/chart2/source/controller/main/ControllerCommandDispatch.cxx +++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx @@ -462,8 +462,7 @@ ControllerCommandDispatch::ControllerCommandDispatch( const Reference< uno::XComponentContext > & xContext, ChartController* pController, CommandDispatchContainer* pContainer ) : impl::ControllerCommandDispatch_Base( xContext ), - m_pChartController( pController ), - m_xController( Reference< frame::XController >( pController ) ), + m_xChartController( pController ), m_xSelectionSupplier( Reference< view::XSelectionSupplier >( pController ) ), m_xDispatch( Reference< frame::XDispatch >( pController ) ), m_apModelState( new impl::ModelState() ), @@ -478,9 +477,9 @@ ControllerCommandDispatch::~ControllerCommandDispatch() void ControllerCommandDispatch::initialize() { - if( m_xController.is()) + if( m_xChartController.is()) { - Reference< frame::XModel > xModel( m_xController->getModel()); + Reference< frame::XModel > xModel( m_xChartController->getModel()); Reference< util::XModifyBroadcaster > xModifyBroadcaster( xModel, uno::UNO_QUERY ); OSL_ASSERT( xModifyBroadcaster.is()); if( xModifyBroadcaster.is()) @@ -494,7 +493,7 @@ void ControllerCommandDispatch::initialize() m_apModelState->update( xModel ); if( m_apControllerState.get() && xModel.is()) - m_apControllerState->update( m_xController, xModel ); + m_apControllerState->update( m_xChartController.get(), xModel ); updateCommandAvailability(); } @@ -525,12 +524,12 @@ void ControllerCommandDispatch::updateCommandAvailability() // @todo: determine correctly bool bHasSuitableClipboardContent = true; - bool bShapeContext = m_pChartController && m_pChartController->isShapeContext(); + bool bShapeContext = m_xChartController.is() && m_xChartController->isShapeContext(); bool bEnableDataTableDialog = false; - if ( m_xController.is() ) + if ( m_xChartController.is() ) { - Reference< beans::XPropertySet > xProps( m_xController->getModel(), uno::UNO_QUERY ); + Reference< beans::XPropertySet > xProps( m_xChartController->getModel(), uno::UNO_QUERY ); if ( xProps.is() ) { try @@ -722,7 +721,7 @@ void ControllerCommandDispatch::fireStatusEvent( if( rURL.isEmpty() || bIsChartSelectorURL ) { uno::Any aArg; - aArg <<= m_xController; + aArg <<= Reference< frame::XController >(m_xChartController.get()); fireStatusEventForURL( ".uno:ChartElementSelector", aArg, true, xSingleListener ); } @@ -737,7 +736,7 @@ void ControllerCommandDispatch::fireStatusEvent( // @todo: remove if Issue 68864 is fixed if( rURL.isEmpty() || rURL == ".uno:StatusBarVisible" ) { - bool bIsStatusBarVisible( lcl_isStatusBarVisible( m_xController )); + bool bIsStatusBarVisible( lcl_isStatusBarVisible( m_xChartController.get() )); fireStatusEventForURL( ".uno:StatusBarVisible", uno::makeAny( bIsStatusBarVisible ), true, xSingleListener ); } } @@ -756,7 +755,7 @@ void SAL_CALL ControllerCommandDispatch::dispatch( /// is called when this is disposed void SAL_CALL ControllerCommandDispatch::disposing() { - m_xController.clear(); + m_xChartController.clear(); m_xDispatch.clear(); m_xSelectionSupplier.clear(); } @@ -765,7 +764,7 @@ void SAL_CALL ControllerCommandDispatch::disposing() void SAL_CALL ControllerCommandDispatch::disposing( const lang::EventObject& /* Source */ ) throw (uno::RuntimeException, std::exception) { - m_xController.clear(); + m_xChartController.clear(); m_xDispatch.clear(); m_xSelectionSupplier.clear(); } @@ -777,16 +776,16 @@ void SAL_CALL ControllerCommandDispatch::modified( const lang::EventObject& aEve bool bUpdateCommandAvailability = false; // Update the "ModelState" Struct. - if( m_apModelState.get() && m_xController.is()) + if( m_apModelState.get() && m_xChartController.is()) { - m_apModelState->update( m_xController->getModel()); + m_apModelState->update( m_xChartController->getModel()); bUpdateCommandAvailability = true; } // Update the "ControllerState" Struct. - if( m_apControllerState.get() && m_xController.is()) + if( m_apControllerState.get() && m_xChartController.is()) { - m_apControllerState->update( m_xController, m_xController->getModel()); + m_apControllerState->update( m_xChartController.get(), m_xChartController->getModel()); bUpdateCommandAvailability = true; } @@ -801,9 +800,9 @@ void SAL_CALL ControllerCommandDispatch::selectionChanged( const lang::EventObje throw (uno::RuntimeException, std::exception) { // Update the "ControllerState" Struct. - if( m_apControllerState.get() && m_xController.is()) + if( m_apControllerState.get() && m_xChartController.is()) { - m_apControllerState->update( m_xController, m_xController->getModel()); + m_apControllerState->update( m_xChartController.get(), m_xChartController->getModel()); updateCommandAvailability(); } diff --git a/chart2/source/controller/main/ControllerCommandDispatch.hxx b/chart2/source/controller/main/ControllerCommandDispatch.hxx index 0c7fcfd..8afbc61 100644 --- a/chart2/source/controller/main/ControllerCommandDispatch.hxx +++ b/chart2/source/controller/main/ControllerCommandDispatch.hxx @@ -24,6 +24,7 @@ #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> #include <cppuhelper/implbase.hxx> +#include <rtl/ref.hxx> #include <memory> @@ -104,8 +105,7 @@ private: bool isShapeControllerCommandAvailable( const OUString& rCommand ); - ChartController* m_pChartController; - css::uno::Reference< css::frame::XController > m_xController; + rtl::Reference<ChartController> m_xChartController; css::uno::Reference< css::view::XSelectionSupplier > m_xSelectionSupplier; css::uno::Reference< css::frame::XDispatch > m_xDispatch; commit 8d611dcc31ee851ddd0a3f96f1fe202ee7bb9eb2 Author: Noel Grandin <[email protected]> Date: Mon Jan 23 13:54:16 2017 +0200 use rtl::Reference in ChartModel instead of storing both a raw pointer and an uno::Reference Change-Id: I86846c2c756255eb5627a4b1e5144c41865db895 diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx index 4cbdbfd..0a08891 100644 --- a/chart2/inc/ChartModel.hxx +++ b/chart2/inc/ChartModel.hxx @@ -122,8 +122,7 @@ private: bool mbTimeBased; - css::uno::Reference< css::uno::XInterface > xChartView; // for the ref count - ChartView* mpChartView; + rtl::Reference<ChartView> mxChartView; OUString m_aResource; css::uno::Sequence< css::beans::PropertyValue > m_aMediaDescriptor; @@ -572,7 +571,7 @@ public: css::uno::Reference< css::util::XNumberFormatsSupplier > const & getNumberFormatsSupplier(); - const css::uno::Reference< css::uno::XInterface >& getChartView() { return xChartView;} + css::uno::Reference< css::uno::XInterface > getChartView() const; bool isTimeBased() const { return mbTimeBased;} void setTimeBased(bool bTimeBased); diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 72e6151..6571772 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -95,7 +95,6 @@ ChartModel::ChartModel(uno::Reference<uno::XComponentContext > const & xContext) , m_nInLoad(0) , m_bUpdateNotificationsPending(false) , mbTimeBased(false) - , mpChartView(nullptr) , m_pUndoManager( nullptr ) , m_aControllers( m_aModelMutex ) , m_nControllerLockCount(0) @@ -136,7 +135,6 @@ ChartModel::ChartModel( const ChartModel & rOther ) , m_nInLoad(0) , m_bUpdateNotificationsPending(false) , mbTimeBased(rOther.mbTimeBased) - , mpChartView(nullptr) , m_aResource( rOther.m_aResource ) , m_aMediaDescriptor( rOther.m_aMediaDescriptor ) , m_aControllers( m_aModelMutex ) @@ -205,6 +203,11 @@ void SAL_CALL ChartModel::initialize( const Sequence< Any >& /*rArguments*/ ) //support argument "DocumentRecoverySupport"? } +css::uno::Reference< css::uno::XInterface > ChartModel::getChartView() const +{ + return static_cast< ::cppu::OWeakObject* >( mxChartView.get() ); +} + // private methods OUString ChartModel::impl_g_getLocation() @@ -1220,12 +1223,11 @@ Reference< uno::XInterface > SAL_CALL ChartModel::createInstance( const OUString case SERVICE_TRANSP_GRADIENT_TABLE: case SERVICE_MARKER_TABLE: { - if(!mpChartView) + if(!mxChartView.is()) { - mpChartView = new ChartView( m_xContext, *this); - xChartView = static_cast< ::cppu::OWeakObject* >( mpChartView ); + mxChartView = new ChartView( m_xContext, *this); } - return mpChartView->createInstance( rServiceSpecifier ); + return mxChartView->createInstance( rServiceSpecifier ); } break; case SERVICE_NAMESPACE_MAP: @@ -1234,13 +1236,12 @@ Reference< uno::XInterface > SAL_CALL ChartModel::createInstance( const OUString } else if(rServiceSpecifier == CHART_VIEW_SERVICE_NAME) { - if(!mpChartView) + if(!mxChartView.is()) { - mpChartView = new ChartView( m_xContext, *this); - xChartView = static_cast< ::cppu::OWeakObject* >( mpChartView ); + mxChartView = new ChartView( m_xContext, *this); } - return static_cast< ::cppu::OWeakObject* >( mpChartView ); + return static_cast< ::cppu::OWeakObject* >( mxChartView.get() ); } else { @@ -1424,17 +1425,13 @@ void ChartModel::setWindow( const sal_uInt64 nWindowPtr ) void ChartModel::update() throw (uno::RuntimeException, std::exception) { - if(!mpChartView) - { - mpChartView = new ChartView( m_xContext, *this); - xChartView = static_cast< ::cppu::OWeakObject* >( mpChartView ); - } - if(mpChartView) + if(!mxChartView.is()) { - mpChartView->setViewDirty(); - mpChartView->update(); - mpChartView->updateOpenGLWindow(); + mxChartView = new ChartView( m_xContext, *this); } + mxChartView->setViewDirty(); + mxChartView->update(); + mxChartView->updateOpenGLWindow(); } } // namespace chart _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
