[Libreoffice-commits] core.git: 2 commits - sc/source sw/inc sw/source
Noel Grandin
noel.grandin at collabora.co.uk
Wed Jan 25 05:33:47 UTC 2017
sc/source/ui/inc/spelldialog.hxx | 4 ++--
sc/source/ui/view/spelldialog.cxx | 4 ++--
sw/inc/unochart.hxx | 8 +++-----
sw/source/core/unocore/unochart.cxx | 19 ++++++++-----------
4 files changed, 15 insertions(+), 20 deletions(-)
New commits:
commit 3cda5ffdda64eff9282450816334d18f7aa015bd
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Wed Jan 25 07:32:34 2017 +0200
use tools::SvRef in ScSpellDialogChildWindow
since it is a ref-counted object
Change-Id: I14a2c666a8fe8ab0ccb55f91f7573e7d3c8caf47
diff --git a/sc/source/ui/inc/spelldialog.hxx b/sc/source/ui/inc/spelldialog.hxx
index 6e735b2..af7c7bc 100644
--- a/sc/source/ui/inc/spelldialog.hxx
+++ b/sc/source/ui/inc/spelldialog.hxx
@@ -75,13 +75,13 @@ private:
typedef ::std::unique_ptr< ScConversionEngineBase > ScConvEnginePtr;
typedef ::std::unique_ptr< ScDocument > ScDocumentPtr;
typedef ::std::unique_ptr< ScSelectionState > ScSelectionStatePtr;
- typedef ::std::unique_ptr< ScRangeList > ScRangeListPtr;
ScConvEnginePtr mxEngine;
ScDocumentPtr mxUndoDoc;
ScDocumentPtr mxRedoDoc;
ScSelectionStatePtr mxOldSel; /// For cursor position in selection
- ScRangeListPtr mxOldRangeList; /// Original selection range for comparison.
+ tools::SvRef< ScRangeList >
+ mxOldRangeList; /// Original selection range for comparison.
ScTabViewShell* mpViewShell;
ScViewData* mpViewData;
ScDocShell* mpDocShell;
diff --git a/sc/source/ui/view/spelldialog.cxx b/sc/source/ui/view/spelldialog.cxx
index db43544..0d4dc36 100644
--- a/sc/source/ui/view/spelldialog.cxx
+++ b/sc/source/ui/view/spelldialog.cxx
@@ -146,7 +146,7 @@ void ScSpellDialogChildWindow::Reset()
mxUndoDoc.reset();
mxRedoDoc.reset();
mxOldSel.reset();
- mxOldRangeList.reset();
+ mxOldRangeList.Clear();
mpViewShell = nullptr;
mpViewData = nullptr;
mpDocShell = nullptr;
@@ -180,7 +180,7 @@ void ScSpellDialogChildWindow::Init()
ScMarkData& rMarkData = mpViewData->GetMarkData();
- mxOldRangeList.reset(new ScRangeList);
+ mxOldRangeList = new ScRangeList;
rMarkData.FillRangeListWithMarks(mxOldRangeList.get(), true);
rMarkData.MarkToMulti();
commit 244677ccf72cfbd778e297f2b464df8df56027c6
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Tue Jan 24 16:31:20 2017 +0200
use rtl::Reference in SwChartDataSequence
instead of storing both a raw pointer and an uno::Reference
Change-Id: I828ad411c989f14a9175ab173f1a4fe75fed535f
diff --git a/sw/inc/unochart.hxx b/sw/inc/unochart.hxx
index 24523ce..944c869 100644
--- a/sw/inc/unochart.hxx
+++ b/sw/inc/unochart.hxx
@@ -46,6 +46,7 @@
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/weakref.hxx>
+#include <rtl/ref.hxx>
#include <tools/link.hxx>
#include <vcl/timer.hxx>
@@ -250,15 +251,12 @@ class SwChartDataSequence :
{
::comphelper::OInterfaceContainerHelper2 m_aEvtListeners;
::comphelper::OInterfaceContainerHelper2 m_aModifyListeners;
- css::chart2::data::DataSequenceRole m_aRole;
+ css::chart2::data::DataSequenceRole m_aRole;
OUString m_aRowLabelText;
OUString m_aColLabelText;
- // holds a reference to the data-provider to guarantee its lifetime last as
- // long as the pointer may be used.
- css::uno::Reference< css::chart2::data::XDataProvider > m_xDataProvider;
- SwChartDataProvider * m_pDataProvider;
+ rtl::Reference<SwChartDataProvider> m_xDataProvider;
sw::UnoCursorPointer m_pTableCursor; // cursor spanned over cells to use
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index 11e8fdb..786f12a 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -1889,7 +1889,6 @@ SwChartDataSequence::SwChartDataSequence(
m_aRowLabelText( SW_RES( STR_CHART2_ROW_LABEL_TEXT ) ),
m_aColLabelText( SW_RES( STR_CHART2_COL_LABEL_TEXT ) ),
m_xDataProvider( &rProvider ),
- m_pDataProvider( &rProvider ),
m_pTableCursor( pTableCursor ),
m_pPropSet( aSwMapProvider.GetPropertySet( PROPERTY_MAP_CHART2_DATA_SEQUENCE ) )
{
@@ -1902,8 +1901,8 @@ SwChartDataSequence::SwChartDataSequence(
if (pTable)
{
uno::Reference< chart2::data::XDataSequence > xRef( dynamic_cast< chart2::data::XDataSequence * >(this), uno::UNO_QUERY );
- m_pDataProvider->AddDataSequence( *pTable, xRef );
- m_pDataProvider->addEventListener( dynamic_cast< lang::XEventListener * >(this) );
+ m_xDataProvider->AddDataSequence( *pTable, xRef );
+ m_xDataProvider->addEventListener( dynamic_cast< lang::XEventListener * >(this) );
}
else {
OSL_FAIL( "table missing" );
@@ -1936,8 +1935,7 @@ SwChartDataSequence::SwChartDataSequence( const SwChartDataSequence &rObj ) :
m_aRole( rObj.m_aRole ),
m_aRowLabelText( SW_RES(STR_CHART2_ROW_LABEL_TEXT) ),
m_aColLabelText( SW_RES(STR_CHART2_COL_LABEL_TEXT) ),
- m_xDataProvider( rObj.m_pDataProvider ),
- m_pDataProvider( rObj.m_pDataProvider ),
+ m_xDataProvider( rObj.m_xDataProvider ),
m_pTableCursor( rObj.m_pTableCursor ),
m_pPropSet( rObj.m_pPropSet )
{
@@ -1950,8 +1948,8 @@ SwChartDataSequence::SwChartDataSequence( const SwChartDataSequence &rObj ) :
if (pTable)
{
uno::Reference< chart2::data::XDataSequence > xRef( dynamic_cast< chart2::data::XDataSequence * >(this), uno::UNO_QUERY );
- m_pDataProvider->AddDataSequence( *pTable, xRef );
- m_pDataProvider->addEventListener( dynamic_cast< lang::XEventListener * >(this) );
+ m_xDataProvider->AddDataSequence( *pTable, xRef );
+ m_xDataProvider->addEventListener( dynamic_cast< lang::XEventListener * >(this) );
}
else {
OSL_FAIL( "table missing" );
@@ -2358,9 +2356,8 @@ void SAL_CALL SwChartDataSequence::disposing( const lang::EventObject& rSource )
{
if (m_bDisposed)
throw lang::DisposedException();
- if (rSource.Source == m_xDataProvider)
+ if (rSource.Source == static_cast<cppu::OWeakObject*>(m_xDataProvider.get()))
{
- m_pDataProvider = nullptr;
m_xDataProvider.clear();
}
}
@@ -2378,13 +2375,13 @@ void SAL_CALL SwChartDataSequence::dispose( )
if (bMustDispose)
{
m_bDisposed = true;
- if (m_pDataProvider)
+ if (m_xDataProvider.is())
{
const SwTable* pTable = SwTable::FindTable( GetFrameFormat() );
if (pTable)
{
uno::Reference< chart2::data::XDataSequence > xRef( dynamic_cast< chart2::data::XDataSequence * >(this), uno::UNO_QUERY );
- m_pDataProvider->RemoveDataSequence( *pTable, xRef );
+ m_xDataProvider->RemoveDataSequence( *pTable, xRef );
}
else {
OSL_FAIL( "table missing" );
More information about the Libreoffice-commits
mailing list