some places where ScDocument* is never passed a nullptr

and so some nullptr checks can be removed

Change-Id: I7dedc2c6d054d9749db9766eaa3a5681842b2b69
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103239
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2020-09-23 22:25:34 +02:00
parent df7abb6981
commit 428d17a2ed
41 changed files with 282 additions and 259 deletions
+16 -5
View File
@@ -1,4 +1,5 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#*************************************************************************
#
# This file is part of the LibreOffice project.
#
@@ -6,14 +7,11 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#*************************************************************************
$(eval $(call gb_CppunitTest_CppunitTest,sc_core))
$(eval $(call gb_CppunitTest_use_externals,sc_core, \
boost_headers \
))
$(eval $(call gb_CppunitTest_use_sdk_api,sc_core))
$(eval $(call gb_CppunitTest_use_external,sc_core,boost_headers))
$(eval $(call gb_CppunitTest_use_common_precompiled_header,sc_core))
@@ -27,6 +25,8 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_core, \
sal \
salhelper \
sc \
test \
unotest \
))
$(eval $(call gb_CppunitTest_set_include,sc_core,\
@@ -34,4 +34,15 @@ $(eval $(call gb_CppunitTest_set_include,sc_core,\
$$(INCLUDE) \
))
$(eval $(call gb_CppunitTest_use_sdk_api,sc_core))
$(eval $(call gb_CppunitTest_use_ure,sc_core))
$(eval $(call gb_CppunitTest_use_vcl,sc_core))
$(eval $(call gb_CppunitTest_use_components,sc_core,\
$(sc_unoapi_common_components) \
))
$(eval $(call gb_CppunitTest_use_configuration,sc_core))
# vim: set noet sw=4 ts=4:
+1 -1
View File
@@ -38,7 +38,7 @@ class ScChartHelper
public:
static sal_uInt16 DoUpdateAllCharts( ScDocument* pDoc );
static void AdjustRangesOfChartsOnDestinationPage( const ScDocument& rSrcDoc, ScDocument& rDestDoc, const SCTAB nSrcTab, const SCTAB nDestTab );
static void UpdateChartsOnDestinationPage( ScDocument* pDestDoc, const SCTAB nDestTab );
static void UpdateChartsOnDestinationPage( ScDocument& rDestDoc, const SCTAB nDestTab );
static css::uno::Reference< css::chart2::XChartDocument > GetChartFromSdrObject( const SdrObject* pObject );
static void GetChartRanges( const css::uno::Reference< css::chart2::XChartDocument >& xChartDoc,
std::vector< OUString >& rRanges );
+7 -7
View File
@@ -44,7 +44,7 @@ public:
class SAL_DLLPRIVATE ExternalRefListener final : public ScExternalRefManager::LinkListener
{
public:
ExternalRefListener(ScChartListener& rParent, ScDocument* pDoc);
ExternalRefListener(ScChartListener& rParent, ScDocument& rDoc);
virtual ~ExternalRefListener() override;
virtual void notify(sal_uInt16 nFileId, ScExternalRefManager::LinkUpdateType eType) override;
void addFileId(sal_uInt16 nFileId);
@@ -56,7 +56,7 @@ public:
ScChartListener& mrParent;
std::unordered_set<sal_uInt16> maFileIds;
ScDocument* mpDoc;
ScDocument& mrDoc;
};
private:
@@ -66,16 +66,16 @@ private:
OUString maName;
std::unique_ptr<ScChartUnoData> pUnoData;
ScDocument* mpDoc;
ScDocument& mrDoc;
bool bUsed:1; // for ScChartListenerCollection::FreeUnused
bool bDirty:1;
ScChartListener& operator=( const ScChartListener& ) = delete;
public:
ScChartListener( const OUString& rName, ScDocument* pDoc,
ScChartListener( const OUString& rName, ScDocument& rDoc,
const ScRangeListRef& rRangeListRef );
ScChartListener( const OUString& rName, ScDocument* pDoc,
ScChartListener( const OUString& rName, ScDocument& rDoc,
std::unique_ptr<::std::vector<ScTokenRef>> pTokens );
ScChartListener( const ScChartListener& ) = delete;
virtual ~ScChartListener() override;
@@ -138,7 +138,7 @@ private:
StringSetType maNonOleObjectNames;
Idle aIdle;
ScDocument* pDoc;
ScDocument& rDoc;
DECL_LINK(TimerHdl, Timer *, void);
@@ -147,7 +147,7 @@ private:
void Init();
public:
ScChartListenerCollection( ScDocument* pDoc );
ScChartListenerCollection( ScDocument& rDoc );
ScChartListenerCollection( const ScChartListenerCollection& );
~ScChartListenerCollection();
+2 -2
View File
@@ -100,11 +100,11 @@ public:
class SC_DLLPUBLIC ExternalDataMapper
{
//ScDocument* mpDoc;
//ScDocument& mrDoc;
std::vector<ExternalDataSource> maDataSources;
public:
ExternalDataMapper(ScDocument* pDoc);
ExternalDataMapper(ScDocument& rDoc);
~ExternalDataMapper();
+3 -3
View File
@@ -213,7 +213,7 @@ public:
SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
SCCOL nDx, SCROW nDy, SCTAB nDz);
void ExtendDataArea(const ScDocument* pDoc);
void ExtendDataArea(const ScDocument& rDoc);
void CalcSaveFilteredCount(SCSIZE nNonFilteredRowCount);
void GetFilterSelCount(SCSIZE& nSelected, SCSIZE& nTotal);
@@ -303,13 +303,13 @@ public:
private:
Link<Timer *, void> aRefreshHandler;
ScDocument* pDoc;
ScDocument& rDoc;
sal_uInt16 nEntryIndex; ///< counter for unique indices
NamedDBs maNamedDBs;
AnonDBs maAnonDBs;
public:
ScDBCollection(ScDocument* pDocument);
ScDBCollection(ScDocument& rDocument);
ScDBCollection(const ScDBCollection& r);
NamedDBs& getNamedDBs() { return maNamedDBs;}
+32 -30
View File
@@ -1019,7 +1019,7 @@ public:
void DecInDdeLinkUpdate() { if ( nInDdeLinkUpdate ) --nInDdeLinkUpdate; }
bool IsInDdeLinkUpdate() const { return nInDdeLinkUpdate != 0; }
SC_DLLPUBLIC void CopyDdeLinks( ScDocument* pDestDoc ) const;
SC_DLLPUBLIC void CopyDdeLinks( ScDocument& rDestDoc ) const;
/** Tries to find a DDE link with the specified connection data.
@param rnDdePos (out-param) Returns the index of the DDE link (does not include other links from link manager).
@@ -1653,7 +1653,7 @@ public:
void ClosingClipboardSource();
void MixDocument( const ScRange& rRange, ScPasteFunc nFunction, bool bSkipEmpty,
ScDocument* pSrcDoc );
ScDocument& rSrcDoc );
void FillTab( const ScRange& rSrcArea, const ScMarkData& rMark,
InsertDeleteFlags nFlags, ScPasteFunc nFunction,
@@ -1668,7 +1668,7 @@ public:
bool bColInfo = false, bool bRowInfo = false );
void AddUndoTab( SCTAB nTab1, SCTAB nTab2,
bool bColInfo = false, bool bRowInfo = false );
SC_DLLPUBLIC void InitUndoSelected( const ScDocument* pSrcDoc, const ScMarkData& rTabSelection,
SC_DLLPUBLIC void InitUndoSelected( const ScDocument& rSrcDoc, const ScMarkData& rTabSelection,
bool bColInfo = false, bool bRowInfo = false );
// don't use anymore:
@@ -2043,7 +2043,7 @@ public:
void UpdStlShtPtrsFrmNms();
void StylesToNames();
SC_DLLPUBLIC void CopyStdStylesFrom( const ScDocument* pSrcDoc );
SC_DLLPUBLIC void CopyStdStylesFrom( const ScDocument& rSrcDoc );
static sal_uInt16 GetSrcVersion() { return nSrcVer; }
@@ -2556,17 +2556,17 @@ private:
class NumFmtMergeHandler
{
public:
explicit NumFmtMergeHandler(ScDocument* pDoc, const ScDocument* pSrcDoc);
explicit NumFmtMergeHandler(ScDocument& rDoc, const ScDocument& rSrcDoc);
~NumFmtMergeHandler();
private:
ScDocument* mpDoc;
ScDocument& mrDoc;
};
ScTable* FetchTable( SCTAB nTab );
const ScTable* FetchTable( SCTAB nTab ) const;
void MergeNumberFormatter(const ScDocument* pSrcDoc);
void MergeNumberFormatter(const ScDocument& rSrcDoc);
void ImplCreateOptions(); // Suggestion: switch to on-demand?
void ImplDeleteOptions();
@@ -2619,24 +2619,25 @@ typedef std::unique_ptr<ScDocument, o3tl::default_delete<ScDocument>> ScDocument
*/
struct ScMutationDisable
{
ScMutationDisable(ScDocument* pDocument, ScMutationGuardFlags nFlags)
#ifndef NDEBUG
ScMutationDisable(ScDocument& rDocument, ScMutationGuardFlags nFlags)
: mnFlagRestore(rDocument.mnMutationGuardFlags)
, mrDocument(rDocument)
{
#ifndef NDEBUG
mpDocument = pDocument;
mnFlagRestore = pDocument->mnMutationGuardFlags;
assert((mnFlagRestore & nFlags) == 0);
mpDocument->mnMutationGuardFlags |= static_cast<size_t>(nFlags);
#else
(void)pDocument; (void)nFlags;
#endif
mrDocument.mnMutationGuardFlags |= static_cast<size_t>(nFlags);
}
#ifndef NDEBUG
~ScMutationDisable()
{
mpDocument->mnMutationGuardFlags = mnFlagRestore;
mrDocument.mnMutationGuardFlags = mnFlagRestore;
}
size_t mnFlagRestore;
ScDocument* mpDocument;
ScDocument& mrDocument;
#else
ScMutationDisable(ScDocument& rDocument, ScMutationGuardFlags nFlags)
{
(void)rDocument; (void)nFlags;
}
#endif
};
@@ -2651,25 +2652,26 @@ struct ScMutationDisable
*/
struct ScMutationGuard
{
ScMutationGuard(ScDocument* pDocument, ScMutationGuardFlags nFlags)
#ifndef NDEBUG
ScMutationGuard(ScDocument& rDocument, ScMutationGuardFlags nFlags)
: mnFlags(static_cast<size_t>(nFlags))
, mrDocument(rDocument)
{
#ifndef NDEBUG
mpDocument = pDocument;
mnFlags = static_cast<size_t>(nFlags);
assert((mpDocument->mnMutationGuardFlags & mnFlags) == 0);
#else
(void)pDocument; (void)nFlags;
#endif
assert((mrDocument.mnMutationGuardFlags & mnFlags) == 0);
}
#ifndef NDEBUG
~ScMutationGuard()
{
assert((mpDocument->mnMutationGuardFlags & mnFlags) == 0);
assert((mrDocument.mnMutationGuardFlags & mnFlags) == 0);
}
size_t mnFlags;
ScDocument* mpDocument;
ScDocument& mrDocument;
#else
ScMutationGuard(ScDocument& rDocument, ScMutationGuardFlags nFlags)
{
(void)rDocument; (void)nFlags;
}
#endif
};
class ScDocShellRecalcGuard
+6 -6
View File
@@ -92,14 +92,14 @@ public:
void SetRelName( bool bVal ) { Flags.bRelName = bVal; }
bool IsRelName() const { return Flags.bRelName; }
bool Valid(const ScDocument* pDoc) const;
bool ColValid(const ScDocument* pDoc) const;
bool RowValid(const ScDocument* pDoc) const;
bool Valid(const ScDocument& rDoc) const;
bool ColValid(const ScDocument& rDoc) const;
bool RowValid(const ScDocument& rDoc) const;
bool TabValid() const;
/** In external references nTab is -1 if the external document was not
loaded but the sheet was cached, or >=0 if the external document was
loaded. */
bool ValidExternal(const ScDocument* pDoc) const;
bool ValidExternal(const ScDocument& rDoc) const;
ScAddress toAbs( ScSheetLimits& rLimits, const ScAddress& rPos ) const;
ScAddress toAbs( const ScDocument& rDoc, const ScAddress& rPos ) const;
@@ -147,12 +147,12 @@ struct ScComplexRefData
/// InitFlags and set range, relative to rPos if rRef1 and rRef2 say so.
void InitFromRefAddresses( const ScDocument& rDoc, const ScRefAddress& rRef1, const ScRefAddress& rRef2, const ScAddress& rPos );
bool Valid(const ScDocument* pDoc) const;
bool Valid(const ScDocument& rDoc) const;
/** In external references nTab is -1 for the start tab and -1 for the end
tab if one sheet and the external document was not loaded but sheet was
cached, or >=0 also if more than one sheets. */
bool ValidExternal(const ScDocument* pDoc) const;
bool ValidExternal(const ScDocument& rDoc) const;
/** Whether this references entire columns, A:A */
bool IsEntireCol() const
+1 -1
View File
@@ -201,7 +201,7 @@ private:
public:
ScValidationDataList() {}
ScValidationDataList(const ScValidationDataList& rList);
ScValidationDataList(ScDocument* pNewDoc, const ScValidationDataList& rList);
ScValidationDataList(ScDocument& rNewDoc, const ScValidationDataList& rList);
typedef ScValidationDataListDataType::iterator iterator;
typedef ScValidationDataListDataType::const_iterator const_iterator;
+1 -1
View File
@@ -113,7 +113,7 @@ ScUndoCut* ScParallelismTest::cutToClip(ScDocShell& rDocSh, const ScRange& rRang
if (bCreateUndo)
{
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
pUndoDoc->InitUndoSelected( pSrcDoc, aMark );
pUndoDoc->InitUndoSelected( *pSrcDoc, aMark );
// all sheets - CopyToDocument skips those that don't exist in pUndoDoc
ScRange aCopyRange = rRange;
aCopyRange.aStart.SetTab(0);
+22 -10
View File
@@ -7,13 +7,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <cppunit/TestAssert.h>
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/plugin/TestPlugIn.h>
#include <test/bootstrapfixture.hxx>
#include <address.hxx>
#include <chartlis.hxx>
#include <scdll.hxx>
namespace {
@@ -23,8 +21,17 @@ const ScRange RANGE_2(20, 10, 0, 29, 10, 0);
const ScRange RANGE_INTERSECTING_1_AND_2(10, 10, 0, 29, 10, 0);
class ChartListenerCollectionTest : public CppUnit::TestFixture {
class ChartListenerCollectionTest : public test::BootstrapFixture {
public:
virtual void setUp() override
{
BootstrapFixture::setUp();
ScDLL::Init();
}
private:
void ListenerGetsNotifiedWhenItsRangeIsSetDirty();
void ListenerGetsNotifiedTwiceWhenRegisteredTwoTimes();
void ListenerDoesNotGetNotifiedWhenListeningStops();
@@ -56,7 +63,8 @@ struct MockedHiddenRangeListener : public ScChartHiddenRangeListener {
void ChartListenerCollectionTest::ListenerGetsNotifiedWhenItsRangeIsSetDirty() {
MockedHiddenRangeListener listener;
ScChartListenerCollection sut(nullptr);
ScDocument aDoc;
ScChartListenerCollection sut(aDoc);
sut.StartListeningHiddenRange(RANGE_1, &listener);
sut.SetRangeDirty(RANGE_INTERSECTING_1_AND_2);
@@ -66,7 +74,8 @@ void ChartListenerCollectionTest::ListenerGetsNotifiedWhenItsRangeIsSetDirty() {
void ChartListenerCollectionTest::ListenerGetsNotifiedTwiceWhenRegisteredTwoTimes() {
MockedHiddenRangeListener listener;
ScChartListenerCollection sut(nullptr);
ScDocument aDoc;
ScChartListenerCollection sut(aDoc);
sut.StartListeningHiddenRange(RANGE_1, &listener);
sut.StartListeningHiddenRange(RANGE_2, &listener);
@@ -77,7 +86,8 @@ void ChartListenerCollectionTest::ListenerGetsNotifiedTwiceWhenRegisteredTwoTime
void ChartListenerCollectionTest::ListenerDoesNotGetNotifiedWhenListeningStops() {
MockedHiddenRangeListener listener;
ScChartListenerCollection sut(nullptr);
ScDocument aDoc;
ScChartListenerCollection sut(aDoc);
sut.StartListeningHiddenRange(RANGE_1, &listener);
sut.EndListeningHiddenRange(&listener);
@@ -89,7 +99,8 @@ void ChartListenerCollectionTest::ListenerDoesNotGetNotifiedWhenListeningStops()
void ChartListenerCollectionTest::ListenerStopsListeningForAllRanges() {
MockedHiddenRangeListener listener;
ScChartListenerCollection sut(nullptr);
ScDocument aDoc;
ScChartListenerCollection sut(aDoc);
sut.StartListeningHiddenRange(RANGE_1, &listener);
sut.StartListeningHiddenRange(RANGE_2, &listener);
@@ -102,8 +113,9 @@ void ChartListenerCollectionTest::ListenerStopsListeningForAllRanges() {
void ChartListenerCollectionTest::ListenersStopListeningIndependently() {
MockedHiddenRangeListener listener1;
MockedHiddenRangeListener listener2;
ScDocument aDoc;
ScChartListenerCollection sut(nullptr);
ScChartListenerCollection sut(aDoc);
sut.StartListeningHiddenRange(RANGE_1, &listener1);
sut.StartListeningHiddenRange(RANGE_2, &listener2);
+4 -4
View File
@@ -3972,7 +3972,7 @@ void Test::testCutPasteGroupRefUndo()
ScRange aPasteRange(1,4,0, 1,6,0);
aMark.SetMarkArea(aPasteRange);
ScDocument* pPasteUndoDoc = new ScDocument(SCDOCMODE_UNDO);
pPasteUndoDoc->InitUndoSelected( m_pDoc, aMark);
pPasteUndoDoc->InitUndoSelected( *m_pDoc, aMark);
std::unique_ptr<ScUndoPaste> pUndoPaste( createUndoPaste( getDocShell(), aPasteRange, ScDocumentUniquePtr(pPasteUndoDoc)));
m_pDoc->CopyFromClip( aPasteRange, aMark, InsertDeleteFlags::ALL, pPasteUndoDoc, &aClipDoc);
@@ -6328,7 +6328,7 @@ void Test::testMixData()
// Paste A1:B1 to A2:B2 and perform addition.
pasteFromClip(m_pDoc, ScRange(0,1,0,1,1,0), &aClipDoc);
m_pDoc->MixDocument(ScRange(0,1,0,1,1,0), ScPasteFunc::ADD, false, &aMixDoc);
m_pDoc->MixDocument(ScRange(0,1,0,1,1,0), ScPasteFunc::ADD, false, aMixDoc);
CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(0,1,0)); // A2
CPPUNIT_ASSERT_EQUAL(2.0, m_pDoc->GetValue(1,1,0)); // B2
@@ -6354,7 +6354,7 @@ void Test::testMixData()
CPPUNIT_ASSERT_EQUAL(m_pDoc->GetValue(ScAddress(1,1,0)), aMixDoc.GetValue(ScAddress(1,1,0)));
pasteFromClip(m_pDoc, ScRange(1,0,0,1,1,0), &aClipDoc);
m_pDoc->MixDocument(ScRange(1,0,0,1,1,0), ScPasteFunc::SUB, false, &aMixDoc);
m_pDoc->MixDocument(ScRange(1,0,0,1,1,0), ScPasteFunc::SUB, false, aMixDoc);
CPPUNIT_ASSERT_EQUAL( -3.0, m_pDoc->GetValue(ScAddress(1,0,0))); // 12 - 15
CPPUNIT_ASSERT_EQUAL(-16.0, m_pDoc->GetValue(ScAddress(1,1,0))); // 0 - 16
@@ -6737,7 +6737,7 @@ ScUndoCut* Test::cutToClip(ScDocShell& rDocSh, const ScRange& rRange, ScDocument
if (bCreateUndo)
{
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
pUndoDoc->InitUndoSelected( pSrcDoc, aMark );
pUndoDoc->InitUndoSelected( *pSrcDoc, aMark );
// all sheets - CopyToDocument skips those that don't exist in pUndoDoc
ScRange aCopyRange = rRange;
aCopyRange.aStart.SetTab(0);
+1 -1
View File
@@ -1619,7 +1619,7 @@ void Test::testSharedFormulaUpdateOnDBChange()
ScDBDocFunc aFunc(getDocShell());
// Change the range referenced by MyRange to A1:A4.
ScDBCollection aNewDBs(m_pDoc);
ScDBCollection aNewDBs(*m_pDoc);
std::unique_ptr<ScDBData> pNewData(new ScDBData("MyRange", 0, 0, 0, 0, 3));
bInserted = aNewDBs.getNamedDBs().insert(std::move(pNewData));
CPPUNIT_ASSERT_MESSAGE("Failed to insert a new database range.", bInserted);
+6 -6
View File
@@ -193,14 +193,14 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) :
mxPoolHelper = new ScPoolHelper( this );
pBASM.reset( new ScBroadcastAreaSlotMachine( this ) );
pChartListenerCollection.reset( new ScChartListenerCollection( this ) );
pChartListenerCollection.reset( new ScChartListenerCollection( *this ) );
pRefreshTimerControl.reset( new ScRefreshTimerControl );
}
else
{
pChartListenerCollection = nullptr;
}
pDBCollection.reset( new ScDBCollection(this) );
pDBCollection.reset( new ScDBCollection(*this) );
pSelectionAttr = nullptr;
apTemporaryChartLock.reset( new ScTemporaryChartLock(this) );
xColNameRanges = new ScRangePairList;
@@ -407,7 +407,7 @@ void ScDocument::InitClipPtrs( ScDocument* pSourceDoc )
{
OSL_ENSURE(bIsClip, "InitClipPtrs and not bIsClip");
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
pValidationList.reset();
@@ -419,7 +419,7 @@ void ScDocument::InitClipPtrs( ScDocument* pSourceDoc )
// TODO: Copy Templates?
const ScValidationDataList* pSourceValid = pSourceDoc->pValidationList.get();
if ( pSourceValid )
pValidationList.reset(new ScValidationDataList(this, *pSourceValid));
pValidationList.reset(new ScValidationDataList(*this, *pSourceValid));
// store Links in Stream
pClipData.reset();
@@ -468,7 +468,7 @@ ScNoteEditEngine& ScDocument::GetNoteEngine()
{
if ( !mpNoteEngine )
{
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
mpNoteEngine.reset( new ScNoteEditEngine( GetEnginePool(), GetEditPool() ) );
mpNoteEngine->SetUpdateMode( false );
mpNoteEngine->EnableUndo( false );
@@ -958,7 +958,7 @@ sal_uLong ScDocument::TransferTab( ScDocument& rSrcDoc, SCTAB nSrcPos,
}
{
NumFmtMergeHandler aNumFmtMergeHdl(this, &rSrcDoc);
NumFmtMergeHandler aNumFmtMergeHdl(*this, rSrcDoc);
sc::CopyToDocContext aCxt(*this);
nDestPos = std::min(nDestPos, static_cast<SCTAB>(GetTableCount() - 1));
+2 -2
View File
@@ -1026,7 +1026,7 @@ void ScDocument::UpdateReference(
UpdateRefAreaLinks( eUpdateRefMode, aRange, nDx, nDy, nDz );
if ( pValidationList )
{
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
pValidationList->UpdateReference(rCxt);
}
if ( pDetOpList )
@@ -1528,7 +1528,7 @@ void ScDocument::GetFilterEntries(
if (!pDBData)
return;
pDBData->ExtendDataArea(this);
pDBData->ExtendDataArea(*this);
SCTAB nAreaTab;
SCCOL nStartCol;
SCROW nStartRow;
+2 -2
View File
@@ -720,7 +720,7 @@ sal_uLong ScDocument::AddValidationEntry( const ScValidationData& rNew )
if (!pValidationList)
{
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
pValidationList.reset(new ScValidationDataList);
}
@@ -740,7 +740,7 @@ sal_uLong ScDocument::AddValidationEntry( const ScValidationData& rNew )
sal_uLong nNewKey = nMax + 1;
std::unique_ptr<ScValidationData> pInsert(rNew.Clone(this));
pInsert->SetKey( nNewKey );
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
pValidationList->InsertNew( std::move(pInsert) );
return nNewKey;
}
+3 -3
View File
@@ -260,7 +260,7 @@ void ScDocument::PutInFormulaTree( ScFormulaCell* pCell )
OSL_ENSURE( pCell, "PutInFormulaTree: pCell Null" );
RemoveFromFormulaTree( pCell );
// append
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
if ( pEOFormulaTree )
pEOFormulaTree->SetNext( pCell );
else
@@ -273,7 +273,7 @@ void ScDocument::PutInFormulaTree( ScFormulaCell* pCell )
void ScDocument::RemoveFromFormulaTree( ScFormulaCell* pCell )
{
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
OSL_ENSURE( pCell, "RemoveFromFormulaTree: pCell Null" );
ScFormulaCell* pPrev = pCell->GetPrevious();
assert(pPrev != pCell); // pointing to itself?!?
@@ -330,7 +330,7 @@ void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bProgressBar, bool bSet
if ( IsCalculatingFormulaTree() )
return ;
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
mpFormulaGroupCxt.reset();
bCalculatingFormulaTree = true;
+9 -9
View File
@@ -285,11 +285,11 @@ void ScDocument::ModifyStyleSheet( SfxStyleSheetBase& rStyleSheet,
}
}
void ScDocument::CopyStdStylesFrom( const ScDocument* pSrcDoc )
void ScDocument::CopyStdStylesFrom( const ScDocument& rSrcDoc )
{
// number format exchange list has to be handled here, too
NumFmtMergeHandler aNumFmtMergeHdl(this, pSrcDoc);
mxPoolHelper->GetStylePool()->CopyStdStylesFrom( pSrcDoc->mxPoolHelper->GetStylePool() );
NumFmtMergeHandler aNumFmtMergeHdl(*this, rSrcDoc);
mxPoolHelper->GetStylePool()->CopyStdStylesFrom( rSrcDoc.mxPoolHelper->GetStylePool() );
}
void ScDocument::InvalidateTextWidth( const OUString& rStyleName )
@@ -766,7 +766,7 @@ void ScDocument::LoadDdeLinks(SvStream& rStream)
for (sal_uInt16 i=0; i<nCount; ++i)
{
ScDdeLink* pLink = new ScDdeLink( this, rStream, aHdr );
ScDdeLink* pLink = new ScDdeLink( *this, rStream, aHdr );
pMgr->InsertDDELink(pLink, pLink->GetAppl(), pLink->GetTopic(), pLink->GetItem());
}
}
@@ -861,14 +861,14 @@ void ScDocument::UpdateExternalRefLinks(weld::Window* pWin)
}
}
void ScDocument::CopyDdeLinks( ScDocument* pDestDoc ) const
void ScDocument::CopyDdeLinks( ScDocument& rDestDoc ) const
{
if (bIsClip) // Create from Stream
{
if (pClipData)
{
pClipData->Seek(0);
pDestDoc->LoadDdeLinks(*pClipData);
rDestDoc.LoadDdeLinks(*pClipData);
}
return;
@@ -878,7 +878,7 @@ void ScDocument::CopyDdeLinks( ScDocument* pDestDoc ) const
if (!pMgr)
return;
sfx2::LinkManager* pDestMgr = pDestDoc->GetDocLinkManager().getLinkManager(pDestDoc->bAutoCalc);
sfx2::LinkManager* pDestMgr = rDestDoc.GetDocLinkManager().getLinkManager(rDestDoc.bAutoCalc);
if (!pDestMgr)
return;
@@ -888,7 +888,7 @@ void ScDocument::CopyDdeLinks( ScDocument* pDestDoc ) const
const sfx2::SvBaseLink* pBase = rLink.get();
if (const ScDdeLink* p = dynamic_cast<const ScDdeLink*>(pBase))
{
ScDdeLink* pNew = new ScDdeLink(pDestDoc, *p);
ScDdeLink* pNew = new ScDdeLink(rDestDoc, *p);
pDestMgr->InsertDDELink(
pNew, pNew->GetAppl(), pNew->GetTopic(), pNew->GetItem());
}
@@ -1006,7 +1006,7 @@ bool ScDocument::CreateDdeLink( const OUString& rAppl, const OUString& rTopic, c
if( !pDdeLink )
{
// create a new DDE link, but without TryUpdate
pDdeLink = new ScDdeLink( this, rAppl, rTopic, rItem, nMode );
pDdeLink = new ScDdeLink( *this, rAppl, rTopic, rItem, nMode );
pMgr->InsertDDELink(pDdeLink, rAppl, rTopic, rItem);
}
+5 -5
View File
@@ -90,21 +90,21 @@ void ScDocument::TransferDrawPage(const ScDocument& rSrcDoc, SCTAB nSrcPos, SCTA
// make sure the data references of charts are adapted
// (this must be after InsertObject!)
ScChartHelper::AdjustRangesOfChartsOnDestinationPage( rSrcDoc, *this, nSrcPos, nDestPos );
ScChartHelper::UpdateChartsOnDestinationPage(this, nDestPos);
ScChartHelper::UpdateChartsOnDestinationPage(*this, nDestPos);
}
void ScDocument::InitDrawLayer( SfxObjectShell* pDocShell )
{
if (pDocShell && !mpShell)
{
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
mpShell = pDocShell;
}
if (mpDrawLayer)
return;
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
OUString aName;
if ( mpShell && !mpShell->IsLoading() ) // don't call GetTitle while loading
aName = mpShell->GetTitle();
@@ -216,7 +216,7 @@ IMPL_LINK( ScDocument, GetUserDefinedColor, sal_uInt16, nColorIndex, Color* )
xColorList = mpDrawLayer->GetColorList();
else
{
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
if (!pColorList.is())
pColorList = XColorList::CreateStdColorList();
xColorList = pColorList;
@@ -226,7 +226,7 @@ IMPL_LINK( ScDocument, GetUserDefinedColor, sal_uInt16, nColorIndex, Color* )
void ScDocument::DeleteDrawLayer()
{
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
// remove DrawingLayer's SfxItemPool from Calc's SfxItemPool where
// it is registered as secondary pool
+25 -25
View File
@@ -560,7 +560,7 @@ bool ScDocument::InsertTab(
if (pValidationList)
{
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
pValidationList->UpdateInsertTab(aCxt);
}
@@ -650,7 +650,7 @@ bool ScDocument::InsertTabs( SCTAB nPos, const std::vector<OUString>& rNames,
if (pValidationList)
{
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
pValidationList->UpdateInsertTab(aCxt);
}
@@ -715,7 +715,7 @@ bool ScDocument::DeleteTab( SCTAB nTab )
UpdateRefAreaLinks( URM_INSDEL, aRange, 0,0,-1 );
if (pValidationList)
{
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
pValidationList->UpdateDeleteTab(aCxt);
}
if ( pUnoBroadcaster )
@@ -807,7 +807,7 @@ bool ScDocument::DeleteTabs( SCTAB nTab, SCTAB nSheets )
UpdateRefAreaLinks( URM_INSDEL, aRange, 0,0,-1*nSheets );
if (pValidationList)
{
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
pValidationList->UpdateDeleteTab(aCxt);
}
if ( pUnoBroadcaster )
@@ -1975,14 +1975,14 @@ void ScDocument::DeleteAreaTab( const ScRange& rRange, InsertDeleteFlags nDelFla
nTab, nDelFlag );
}
void ScDocument::InitUndoSelected( const ScDocument* pSrcDoc, const ScMarkData& rTabSelection,
bool bColInfo, bool bRowInfo )
void ScDocument::InitUndoSelected(const ScDocument& rSrcDoc, const ScMarkData& rTabSelection,
bool bColInfo, bool bRowInfo )
{
if (bIsUndo)
{
Clear();
SharePooledResources(pSrcDoc);
SharePooledResources(&rSrcDoc);
for (SCTAB nTab = 0; nTab <= rTabSelection.GetLastSelected(); nTab++)
if ( rTabSelection.GetTableSelect( nTab ) )
@@ -2433,21 +2433,21 @@ void ScDocument::CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClip
copyUsedNamesToClip(pClipDoc->GetRangeName(), pRangeName.get(), aUsedGlobalNames);
}
ScDocument::NumFmtMergeHandler::NumFmtMergeHandler(ScDocument* pDoc, const ScDocument* pSrcDoc) :
mpDoc(pDoc)
ScDocument::NumFmtMergeHandler::NumFmtMergeHandler(ScDocument& rDoc, const ScDocument& rSrcDoc)
: mrDoc(rDoc)
{
mpDoc->MergeNumberFormatter(pSrcDoc);
mrDoc.MergeNumberFormatter(rSrcDoc);
}
ScDocument::NumFmtMergeHandler::~NumFmtMergeHandler()
{
ScMutationGuard aGuard(mpDoc, ScMutationGuardFlags::CORE);
mpDoc->pFormatExchangeList = nullptr;
ScMutationGuard aGuard(mrDoc, ScMutationGuardFlags::CORE);
mrDoc.pFormatExchangeList = nullptr;
}
void ScDocument::PrepareFormulaCalc()
{
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
mpFormulaGroupCxt.reset();
}
@@ -2530,17 +2530,17 @@ ScColumnsRange ScDocument::GetColumnsRange( SCTAB nTab, SCCOL nColBegin, SCCOL n
return maTabs[nTab]->GetColumnsRange(nColBegin, nColEnd);
}
void ScDocument::MergeNumberFormatter(const ScDocument* pSrcDoc)
void ScDocument::MergeNumberFormatter(const ScDocument& rSrcDoc)
{
SvNumberFormatter* pThisFormatter = mxPoolHelper->GetFormTable();
SvNumberFormatter* pOtherFormatter = pSrcDoc->mxPoolHelper->GetFormTable();
SvNumberFormatter* pOtherFormatter = rSrcDoc.mxPoolHelper->GetFormTable();
if (pOtherFormatter && pOtherFormatter != pThisFormatter)
{
SvNumberFormatterIndexTable* pExchangeList =
pThisFormatter->MergeFormatter(*pOtherFormatter);
if (!pExchangeList->empty())
{
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
pFormatExchangeList = pExchangeList;
}
}
@@ -2815,7 +2815,7 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar
sc::AutoCalcSwitch aACSwitch(*this, false); // temporarily turn off auto calc.
NumFmtMergeHandler aNumFmtMergeHdl(this, pClipDoc);
NumFmtMergeHandler aNumFmtMergeHdl(*this, *pClipDoc);
SCCOL nAllCol1 = rDestRange.aStart.Col();
SCROW nAllRow1 = rDestRange.aStart.Row();
@@ -3026,7 +3026,7 @@ void ScDocument::CopyMultiRangeFromClip(
// Right now, we don't allow pasting into filtered rows, so we don't even handle it here.
sc::AutoCalcSwitch aACSwitch(*this, false); // turn of auto calc temporarily.
NumFmtMergeHandler aNumFmtMergeHdl(this, pClipDoc);
NumFmtMergeHandler aNumFmtMergeHdl(*this, *pClipDoc);
ScRange aDestRange;
rMark.GetMarkArea(aDestRange);
@@ -3206,16 +3206,16 @@ bool ScDocument::HasClipFilteredRows()
}
void ScDocument::MixDocument( const ScRange& rRange, ScPasteFunc nFunction, bool bSkipEmpty,
ScDocument* pSrcDoc )
ScDocument& rSrcDoc )
{
SCTAB nTab1 = rRange.aStart.Tab();
SCTAB nTab2 = rRange.aEnd.Tab();
sc::MixDocContext aCxt(*this);
SCTAB nMinSizeBothTabs = static_cast<SCTAB>(std::min(maTabs.size(), pSrcDoc->maTabs.size()));
SCTAB nMinSizeBothTabs = static_cast<SCTAB>(std::min(maTabs.size(), rSrcDoc.maTabs.size()));
for (SCTAB i = nTab1; i <= nTab2 && i < nMinSizeBothTabs; i++)
{
ScTable* pTab = FetchTable(i);
const ScTable* pSrcTab = pSrcDoc->FetchTable(i);
const ScTable* pSrcTab = rSrcDoc.FetchTable(i);
if (!pTab || !pSrcTab)
continue;
@@ -3523,7 +3523,7 @@ svl::SharedString ScDocument::GetSharedString( const ScAddress& rPos ) const
std::shared_ptr<sc::FormulaGroupContext>& ScDocument::GetFormulaGroupContext()
{
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
if (!mpFormulaGroupCxt)
mpFormulaGroupCxt = std::make_shared<sc::FormulaGroupContext>();
@@ -3906,7 +3906,7 @@ void ScDocument::InterpretDirtyCells( const ScRangeList& rRanges )
}
}
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
mpFormulaGroupCxt.reset();
}
@@ -3996,7 +3996,7 @@ void ScDocument::CompileXML()
if ( pValidationList )
{
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
pValidationList->CompileXML();
}
@@ -6378,7 +6378,7 @@ SfxUndoManager* ScDocument::GetUndoManager()
if (!mpUndoManager)
{
// to support enhanced text edit for draw objects, use an SdrUndoManager
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
SdrUndoManager* pUndoManager = new SdrUndoManager;
pUndoManager->SetDocShell(GetDocumentShell());
+3 -3
View File
@@ -199,7 +199,7 @@ std::set<Color> ScDocument::GetDocColors()
void ScDocument::SetCalcConfig( const ScCalcConfig& rConfig )
{
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
maCalcConfig = rConfig;
}
@@ -326,7 +326,7 @@ void ScDocument::CompileHybridFormula()
void ScDocument::SharePooledResources( const ScDocument* pSrcDoc )
{
ScMutationGuard aGuard(this, ScMutationGuardFlags::CORE);
ScMutationGuard aGuard(*this, ScMutationGuardFlags::CORE);
mxPoolHelper = pSrcDoc->mxPoolHelper;
mpCellStringPool = pSrcDoc->mpCellStringPool;
}
@@ -1002,7 +1002,7 @@ bool ScDocument::EnsureFormulaCellResults( const ScRange& rRange, bool bSkipRunn
sc::ExternalDataMapper& ScDocument::GetExternalDataMapper()
{
if (!mpDataMapper)
mpDataMapper.reset(new sc::ExternalDataMapper(this));
mpDataMapper.reset(new sc::ExternalDataMapper(*this));
return *mpDataMapper;
}
+2 -2
View File
@@ -465,7 +465,7 @@ void adjustDBRange(formula::FormulaToken* pToken, ScDocument& rNewDoc, const ScD
ScDBCollection* pNewDBCollection = rNewDoc.GetDBCollection();
if (!pNewDBCollection)
{
rNewDoc.SetDBCollection(std::unique_ptr<ScDBCollection>(new ScDBCollection(&rNewDoc)));
rNewDoc.SetDBCollection(std::unique_ptr<ScDBCollection>(new ScDBCollection(rNewDoc)));
pNewDBCollection = rNewDoc.GetDBCollection();
}
ScDBCollection::NamedDBs& aNewNamedDBs = pNewDBCollection->getNamedDBs();
@@ -4917,7 +4917,7 @@ bool ScFormulaCell::InterpretFormulaGroupThreading(sc::FormulaLogger::GroupScope
assert(!rDocument.IsThreadedGroupCalcInProgress());
rDocument.SetThreadedGroupCalcInProgress(true);
ScMutationDisable aGuard(&rDocument, ScMutationGuardFlags::CORE);
ScMutationDisable aGuard(rDocument, ScMutationGuardFlags::CORE);
// Start nThreadCount new threads
std::shared_ptr<comphelper::ThreadTaskTag> aTag = comphelper::ThreadPool::createThreadTaskTag();
+2 -2
View File
@@ -978,14 +978,14 @@ ScValidationDataList::ScValidationDataList(const ScValidationDataList& rList)
//TODO: faster insert for sorted entries from rList ???
}
ScValidationDataList::ScValidationDataList(ScDocument* pNewDoc,
ScValidationDataList::ScValidationDataList(ScDocument& rNewDoc,
const ScValidationDataList& rList)
{
// for new documents - real copy with new tokens!
for (const auto& rxItem : rList)
{
InsertNew( std::unique_ptr<ScValidationData>(rxItem->Clone(pNewDoc)) );
InsertNew( std::unique_ptr<ScValidationData>(rxItem->Clone(&rNewDoc)) );
}
//TODO: faster insert for sorted entries from rList ???
+4 -4
View File
@@ -36,7 +36,7 @@ class ScDdeLink : public ::sfx2::SvBaseLink, public SvtBroadcaster
private:
static bool bIsInUpdate;
ScDocument* pDoc;
ScDocument& rDoc;
OUString aAppl; // connection/ link data
OUString aTopic;
@@ -49,11 +49,11 @@ static bool bIsInUpdate;
public:
ScDdeLink( ScDocument* pD,
ScDdeLink( ScDocument& rD,
const OUString& rA, const OUString& rT, const OUString& rI,
sal_uInt8 nM );
ScDdeLink( ScDocument* pD, SvStream& rStream, ScMultipleReadHeader& rHdr );
ScDdeLink( ScDocument* pD, const ScDdeLink& rOther );
ScDdeLink( ScDocument& rD, SvStream& rStream, ScMultipleReadHeader& rHdr );
ScDdeLink( ScDocument& rD, const ScDdeLink& rOther );
virtual ~ScDdeLink() override;
void Store( SvStream& rStream, ScMultipleWriteHeader& rHdr ) const;
+4 -6
View File
@@ -145,11 +145,9 @@ void ScChartHelper::AdjustRangesOfChartsOnDestinationPage( const ScDocument& rSr
}
}
void ScChartHelper::UpdateChartsOnDestinationPage( ScDocument* pDestDoc, const SCTAB nDestTab )
void ScChartHelper::UpdateChartsOnDestinationPage( ScDocument& rDestDoc, const SCTAB nDestTab )
{
if( !pDestDoc )
return;
ScDrawLayer* pDrawLayer = pDestDoc->GetDrawLayer();
ScDrawLayer* pDrawLayer = rDestDoc.GetDrawLayer();
if( !pDrawLayer )
return;
@@ -164,7 +162,7 @@ void ScChartHelper::UpdateChartsOnDestinationPage( ScDocument* pDestDoc, const S
if( pObject->GetObjIdentifier() == OBJ_OLE2 && static_cast<SdrOle2Obj*>(pObject)->IsChart() )
{
OUString aChartName = static_cast<SdrOle2Obj*>(pObject)->GetPersistName();
Reference< chart2::XChartDocument > xChartDoc( pDestDoc->GetChartByName( aChartName ) );
Reference< chart2::XChartDocument > xChartDoc( rDestDoc.GetChartByName( aChartName ) );
Reference< util::XModifiable > xModif(xChartDoc, uno::UNO_QUERY_THROW);
xModif->setModified( true);
}
@@ -395,7 +393,7 @@ void ScChartHelper::CreateProtectedChartListenersAndNotify( ScDocument& rDoc, co
{
ScRangeList aRangeList( rRangesVector[ nRangeList++ ] );
ScRangeListRef rRangeList( new ScRangeList( aRangeList ) );
ScChartListener* pChartListener = new ScChartListener( aChartName, &rDoc, rRangeList );
ScChartListener* pChartListener = new ScChartListener( aChartName, rDoc, rRangeList );
pCollection->insert( pChartListener );
pChartListener->StartListeningTo();
}
+42 -42
View File
@@ -49,19 +49,19 @@ public:
};
// ScChartListener
ScChartListener::ExternalRefListener::ExternalRefListener(ScChartListener& rParent, ScDocument* pDoc) :
mrParent(rParent), mpDoc(pDoc)
ScChartListener::ExternalRefListener::ExternalRefListener(ScChartListener& rParent, ScDocument& rDoc) :
mrParent(rParent), mrDoc(rDoc)
{
}
ScChartListener::ExternalRefListener::~ExternalRefListener()
{
if (!mpDoc || mpDoc->IsInDtorClear())
if (mrDoc.IsInDtorClear())
// The document is being destroyed. Do nothing.
return;
// Make sure to remove all pointers to this object.
mpDoc->GetExternalRefManager()->removeLinkListener(this);
mrDoc.GetExternalRefManager()->removeLinkListener(this);
}
void ScChartListener::ExternalRefListener::notify(sal_uInt16 nFileId, ScExternalRefManager::LinkUpdateType eType)
@@ -92,23 +92,23 @@ void ScChartListener::ExternalRefListener::removeFileId(sal_uInt16 nFileId)
maFileIds.erase(nFileId);
}
ScChartListener::ScChartListener( const OUString& rName, ScDocument* pDocP,
ScChartListener::ScChartListener( const OUString& rName, ScDocument& rDocP,
const ScRangeListRef& rRangeList ) :
SvtListener(),
mpTokens(new vector<ScTokenRef>),
maName(rName),
mpDoc( pDocP ),
mrDoc( rDocP ),
bUsed( false ),
bDirty( false )
{
ScRefTokenHelper::getTokensFromRangeList(pDocP, *mpTokens, *rRangeList);
ScRefTokenHelper::getTokensFromRangeList(&rDocP, *mpTokens, *rRangeList);
}
ScChartListener::ScChartListener( const OUString& rName, ScDocument* pDocP, std::unique_ptr<vector<ScTokenRef>> pTokens ) :
ScChartListener::ScChartListener( const OUString& rName, ScDocument& rDocP, std::unique_ptr<vector<ScTokenRef>> pTokens ) :
SvtListener(),
mpTokens(std::move(pTokens)),
maName(rName),
mpDoc( pDocP ),
mrDoc( rDocP ),
bUsed( false ),
bDirty( false )
{
@@ -123,7 +123,7 @@ ScChartListener::~ScChartListener()
if (mpExtRefListener)
{
// Stop listening to all external files.
ScExternalRefManager* pRefMgr = mpDoc->GetExternalRefManager();
ScExternalRefManager* pRefMgr = mrDoc.GetExternalRefManager();
const std::unordered_set<sal_uInt16>& rFileIds = mpExtRefListener->getAllFileIds();
for (const auto& rFileId : rFileIds)
pRefMgr->removeLinkListener(rFileId, mpExtRefListener.get());
@@ -160,11 +160,11 @@ void ScChartListener::Notify( const SfxHint& rHint )
void ScChartListener::Update()
{
if ( mpDoc->IsInInterpreter() )
if ( mrDoc.IsInInterpreter() )
{ // If interpreting do nothing and restart timer so we don't
// interfere with interpreter and don't produce an Err522 or similar.
// This may happen if we are rescheduled via Basic function.
mpDoc->GetChartListenerCollection()->StartTimer();
mrDoc.GetChartListenerCollection()->StartTimer();
return ;
}
if ( pUnoData )
@@ -176,24 +176,24 @@ void ScChartListener::Update()
0, 0, 0, 0 );
pUnoData->GetListener()->chartDataChanged( aEvent );
}
else if ( mpDoc->GetAutoCalc() )
else if ( mrDoc.GetAutoCalc() )
{
bDirty = false;
mpDoc->UpdateChart(GetName());
mrDoc.UpdateChart(GetName());
}
}
ScRangeListRef ScChartListener::GetRangeList() const
{
ScRangeListRef aRLRef(new ScRangeList);
ScRefTokenHelper::getRangeListFromTokens(mpDoc, *aRLRef, *mpTokens, ScAddress());
ScRefTokenHelper::getRangeListFromTokens(&mrDoc, *aRLRef, *mpTokens, ScAddress());
return aRLRef;
}
void ScChartListener::SetRangeList( const ScRangeListRef& rNew )
{
vector<ScTokenRef> aTokens;
ScRefTokenHelper::getTokensFromRangeList(mpDoc, aTokens, *rNew);
ScRefTokenHelper::getTokensFromRangeList(&mrDoc, aTokens, *rNew);
mpTokens->swap(aTokens);
}
@@ -202,8 +202,8 @@ namespace {
class StartEndListening
{
public:
StartEndListening(ScDocument* pDoc, ScChartListener& rParent, bool bStart) :
mpDoc(pDoc), mrParent(rParent), mbStart(bStart) {}
StartEndListening(ScDocument& rDoc, ScChartListener& rParent, bool bStart) :
mrDoc(rDoc), mrParent(rParent), mbStart(bStart) {}
void operator() (const ScTokenRef& pToken)
{
@@ -214,7 +214,7 @@ public:
if (bExternal)
{
sal_uInt16 nFileId = pToken->GetIndex();
ScExternalRefManager* pRefMgr = mpDoc->GetExternalRefManager();
ScExternalRefManager* pRefMgr = mrDoc.GetExternalRefManager();
ScChartListener::ExternalRefListener* pExtRefListener = mrParent.GetExtRefListener();
if (mbStart)
{
@@ -230,7 +230,7 @@ public:
else
{
ScRange aRange;
ScRefTokenHelper::getRangeFromToken(mpDoc, aRange, pToken, ScAddress(), bExternal);
ScRefTokenHelper::getRangeFromToken(&mrDoc, aRange, pToken, ScAddress(), bExternal);
if (mbStart)
startListening(aRange);
else
@@ -241,20 +241,20 @@ private:
void startListening(const ScRange& rRange)
{
if (rRange.aStart == rRange.aEnd)
mpDoc->StartListeningCell(rRange.aStart, &mrParent);
mrDoc.StartListeningCell(rRange.aStart, &mrParent);
else
mpDoc->StartListeningArea(rRange, false, &mrParent);
mrDoc.StartListeningArea(rRange, false, &mrParent);
}
void endListening(const ScRange& rRange)
{
if (rRange.aStart == rRange.aEnd)
mpDoc->EndListeningCell(rRange.aStart, &mrParent);
mrDoc.EndListeningCell(rRange.aStart, &mrParent);
else
mpDoc->EndListeningArea(rRange, false, &mrParent);
mrDoc.EndListeningArea(rRange, false, &mrParent);
}
private:
ScDocument* mpDoc;
ScDocument& mrDoc;
ScChartListener& mrParent;
bool mbStart;
};
@@ -267,7 +267,7 @@ void ScChartListener::StartListeningTo()
// no references to listen to.
return;
for_each(mpTokens->begin(), mpTokens->end(), StartEndListening(mpDoc, *this, true));
for_each(mpTokens->begin(), mpTokens->end(), StartEndListening(mrDoc, *this, true));
}
void ScChartListener::EndListeningTo()
@@ -276,7 +276,7 @@ void ScChartListener::EndListeningTo()
// no references to listen to.
return;
for_each(mpTokens->begin(), mpTokens->end(), StartEndListening(mpDoc, *this, false));
for_each(mpTokens->begin(), mpTokens->end(), StartEndListening(mrDoc, *this, false));
}
void ScChartListener::ChangeListening( const ScRangeListRef& rRangeListRef,
@@ -292,19 +292,19 @@ void ScChartListener::ChangeListening( const ScRangeListRef& rRangeListRef,
void ScChartListener::UpdateChartIntersecting( const ScRange& rRange )
{
ScTokenRef pToken;
ScRefTokenHelper::getTokenFromRange(mpDoc, pToken, rRange);
ScRefTokenHelper::getTokenFromRange(&mrDoc, pToken, rRange);
if (ScRefTokenHelper::intersects(mpDoc, *mpTokens, pToken, ScAddress()))
if (ScRefTokenHelper::intersects(&mrDoc, *mpTokens, pToken, ScAddress()))
{
// force update (chart has to be loaded), don't use ScChartListener::Update
mpDoc->UpdateChart(GetName());
mrDoc.UpdateChart(GetName());
}
}
ScChartListener::ExternalRefListener* ScChartListener::GetExtRefListener()
{
if (!mpExtRefListener)
mpExtRefListener.reset(new ExternalRefListener(*this, mpDoc));
mpExtRefListener.reset(new ExternalRefListener(*this, mrDoc));
return mpExtRefListener.get();
}
@@ -312,7 +312,7 @@ ScChartListener::ExternalRefListener* ScChartListener::GetExtRefListener()
void ScChartListener::SetUpdateQueue()
{
bDirty = true;
mpDoc->GetChartListenerCollection()->StartTimer();
mrDoc.GetChartListenerCollection()->StartTimer();
}
bool ScChartListener::operator==( const ScChartListener& r ) const
@@ -320,7 +320,7 @@ bool ScChartListener::operator==( const ScChartListener& r ) const
bool b1 = (mpTokens && !mpTokens->empty());
bool b2 = (r.mpTokens && !r.mpTokens->empty());
if (mpDoc != r.mpDoc || bUsed != r.bUsed || bDirty != r.bDirty ||
if (&mrDoc != &r.mrDoc || bUsed != r.bUsed || bDirty != r.bDirty ||
GetName() != r.GetName() || b1 != b2)
return false;
@@ -352,9 +352,9 @@ void ScChartListenerCollection::Init()
aIdle.SetDebugName( "sc::ScChartListenerCollection aIdle" );
}
ScChartListenerCollection::ScChartListenerCollection( ScDocument* pDocP ) :
ScChartListenerCollection::ScChartListenerCollection( ScDocument& rDocP ) :
meModifiedDuringUpdate( SC_CLCUPDATE_NONE ),
pDoc( pDocP )
rDoc( rDocP )
{
Init();
}
@@ -362,7 +362,7 @@ ScChartListenerCollection::ScChartListenerCollection( ScDocument* pDocP ) :
ScChartListenerCollection::ScChartListenerCollection(
const ScChartListenerCollection& rColl ) :
meModifiedDuringUpdate( SC_CLCUPDATE_NONE ),
pDoc( rColl.pDoc )
rDoc( rColl.rDoc )
{
Init();
}
@@ -438,7 +438,7 @@ void ScChartListenerCollection::ChangeListening( const OUString& rName,
}
else
{
pCL = new ScChartListener(rName, pDoc, rRangeListRef);
pCL = new ScChartListener(rName, rDoc, rRangeListRef);
insert(pCL);
}
pCL->StartListeningTo();
@@ -518,7 +518,7 @@ void ScChartListenerCollection::UpdateDirtyCharts()
if (meModifiedDuringUpdate == SC_CLCUPDATE_MODIFIED)
break; // iterator is invalid
if (aIdle.IsActive() && !pDoc->IsImportingXML())
if (aIdle.IsActive() && !rDoc.IsImportingXML())
break; // one interfered
}
meModifiedDuringUpdate = SC_CLCUPDATE_NONE;
@@ -554,10 +554,10 @@ void ScChartListenerCollection::SetDiffDirty(
bool b1 = rList1.is();
bool b2 = rList2.is();
if ( b1 != b2 || (b1 && b2 && (*rList1 != *rList2)) )
pDoc->SetChartRangeList( pCL->GetName(), rList1 );
rDoc.SetChartRangeList( pCL->GetName(), rList1 );
}
else
pDoc->SetChartRangeList( pCL->GetName(), pCL->GetRangeList() );
rDoc.SetChartRangeList( pCL->GetName(), pCL->GetRangeList() );
}
bDirty = true;
pCL->SetDirty( true );
@@ -595,7 +595,7 @@ void ScChartListenerCollection::SetRangeDirty( const ScRange& rRange )
void ScChartListenerCollection::UpdateChartsContainingTab( SCTAB nTab )
{
ScRange aRange( 0, 0, nTab, pDoc->MaxCol(), pDoc->MaxRow(), nTab );
ScRange aRange( 0, 0, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab );
for (auto const& it : m_Listeners)
{
it.second->UpdateChartIntersecting(aRange);
@@ -606,7 +606,7 @@ bool ScChartListenerCollection::operator==( const ScChartListenerCollection& r )
{
// Do not use ScStrCollection::operator==() here that uses IsEqual and Compare.
// Use ScChartListener::operator==() instead.
if (pDoc != r.pDoc)
if (&rDoc != &r.rDoc)
return false;
return std::equal(m_Listeners.begin(), m_Listeners.end(), r.m_Listeners.begin(), r.m_Listeners.end(),
+17 -17
View File
@@ -623,17 +623,17 @@ void ScDBData::UpdateReference(const ScDocument* pDoc, UpdateRefMode eUpdateRefM
//TODO: check if something was deleted/inserted with-in the range !!!
}
void ScDBData::ExtendDataArea(const ScDocument* pDoc)
void ScDBData::ExtendDataArea(const ScDocument& rDoc)
{
// Extend the DB area to include data rows immediately below.
SCCOL nOldCol1 = nStartCol, nOldCol2 = nEndCol;
SCROW nOldEndRow = nEndRow;
pDoc->GetDataArea(nTable, nStartCol, nStartRow, nEndCol, nEndRow, false, true);
rDoc.GetDataArea(nTable, nStartCol, nStartRow, nEndCol, nEndRow, false, true);
// nOldEndRow==rDoc.MaxRow() may easily happen when selecting whole columns and
// setting an AutoFilter (i.e. creating an anonymous database-range). We
// certainly don't want to iterate over nearly a million empty cells, but
// keep only an intentionally user selected range.
if (nOldEndRow < pDoc->MaxRow() && nEndRow < nOldEndRow)
if (nOldEndRow < rDoc.MaxRow() && nEndRow < nOldEndRow)
nEndRow = nOldEndRow;
if (nStartCol != nOldCol1 || nEndCol != nOldCol2)
{
@@ -1287,11 +1287,11 @@ ScDBCollection::AnonDBs::AnonDBs(AnonDBs const& r)
}
}
ScDBCollection::ScDBCollection(ScDocument* pDocument) :
pDoc(pDocument), nEntryIndex(1), maNamedDBs(*this, *pDocument) {}
ScDBCollection::ScDBCollection(ScDocument& rDocument) :
rDoc(rDocument), nEntryIndex(1), maNamedDBs(*this, rDocument) {}
ScDBCollection::ScDBCollection(const ScDBCollection& r) :
pDoc(r.pDoc), nEntryIndex(r.nEntryIndex), maNamedDBs(r.maNamedDBs, *this), maAnonDBs(r.maAnonDBs) {}
rDoc(r.rDoc), nEntryIndex(r.nEntryIndex), maNamedDBs(r.maNamedDBs, *this), maAnonDBs(r.maAnonDBs) {}
const ScDBData* ScDBCollection::GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, ScDBDataPortion ePortion) const
{
@@ -1302,7 +1302,7 @@ const ScDBData* ScDBCollection::GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab
return itr->get();
// Check for the sheet-local anonymous db range.
const ScDBData* pNoNameData = pDoc->GetAnonymousDBData(nTab);
const ScDBData* pNoNameData = rDoc.GetAnonymousDBData(nTab);
if (pNoNameData)
if (pNoNameData->IsDBAtCursor(nCol,nRow,nTab,ePortion))
return pNoNameData;
@@ -1326,7 +1326,7 @@ ScDBData* ScDBCollection::GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, ScDB
return itr->get();
// Check for the sheet-local anonymous db range.
ScDBData* pNoNameData = pDoc->GetAnonymousDBData(nTab);
ScDBData* pNoNameData = rDoc.GetAnonymousDBData(nTab);
if (pNoNameData)
if (pNoNameData->IsDBAtCursor(nCol,nRow,nTab,ePortion))
return pNoNameData;
@@ -1351,7 +1351,7 @@ const ScDBData* ScDBCollection::GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1
return itr->get();
// Check for the sheet-local anonymous db range.
ScDBData* pNoNameData = pDoc->GetAnonymousDBData(nTab);
ScDBData* pNoNameData = rDoc.GetAnonymousDBData(nTab);
if (pNoNameData)
if (pNoNameData->IsDBAtArea(nTab, nCol1, nRow1, nCol2, nRow2))
return pNoNameData;
@@ -1362,7 +1362,7 @@ const ScDBData* ScDBCollection::GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1
return pData;
// As a last resort, check for the document global temporary anonymous db range.
pNoNameData = pDoc->GetAnonymousDBData();
pNoNameData = rDoc.GetAnonymousDBData();
if (pNoNameData)
if (pNoNameData->IsDBAtArea(nTab, nCol1, nRow1, nCol2, nRow2))
return pNoNameData;
@@ -1380,7 +1380,7 @@ ScDBData* ScDBCollection::GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCO
return itr->get();
// Check for the sheet-local anonymous db range.
ScDBData* pNoNameData = pDoc->GetAnonymousDBData(nTab);
ScDBData* pNoNameData = rDoc.GetAnonymousDBData(nTab);
if (pNoNameData)
if (pNoNameData->IsDBAtArea(nTab, nCol1, nRow1, nCol2, nRow2))
return pNoNameData;
@@ -1391,7 +1391,7 @@ ScDBData* ScDBCollection::GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCO
return const_cast<ScDBData*>(pData);
// As a last resort, check for the document global temporary anonymous db range.
pNoNameData = pDoc->GetAnonymousDBData();
pNoNameData = rDoc.GetAnonymousDBData();
if (pNoNameData)
if (pNoNameData->IsDBAtArea(nTab, nCol1, nRow1, nCol2, nRow2))
return pNoNameData;
@@ -1439,13 +1439,13 @@ void ScDBCollection::UpdateReference(UpdateRefMode eUpdateRefMode,
SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
SCCOL nDx, SCROW nDy, SCTAB nDz )
{
ScDBData* pData = pDoc->GetAnonymousDBData(nTab1);
ScDBData* pData = rDoc.GetAnonymousDBData(nTab1);
if (pData)
{
if (nTab1 == nTab2 && nDz == 0)
{
pData->UpdateReference(
pDoc, eUpdateRefMode,
&rDoc, eUpdateRefMode,
nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, nDy, nDz);
}
else
@@ -1454,7 +1454,7 @@ void ScDBCollection::UpdateReference(UpdateRefMode eUpdateRefMode,
}
}
UpdateRefFunc func(pDoc, eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, nDy, nDz);
UpdateRefFunc func(&rDoc, eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, nDy, nDz);
for_each(maNamedDBs.begin(), maNamedDBs.end(), func);
for_each(maAnonDBs.begin(), maAnonDBs.end(), func);
}
@@ -1489,7 +1489,7 @@ ScDBData* ScDBCollection::GetDBNearCursor(SCCOL nCol, SCROW nRow, SCTAB nTab )
}
if (pNearData)
return pNearData; // adjacent, if no direct hit
return pDoc->GetAnonymousDBData(nTab); // "unbenannt"/"unnamed" only if nothing else
return rDoc.GetAnonymousDBData(nTab); // "unbenannt"/"unnamed" only if nothing else
}
bool ScDBCollection::empty() const
@@ -1500,7 +1500,7 @@ bool ScDBCollection::empty() const
bool ScDBCollection::operator== (const ScDBCollection& r) const
{
return maNamedDBs == r.maNamedDBs && maAnonDBs == r.maAnonDBs &&
nEntryIndex == r.nEntryIndex && pDoc == r.pDoc && aRefreshHandler == r.aRefreshHandler;
nEntryIndex == r.nEntryIndex && &rDoc == &r.rDoc && aRefreshHandler == r.aRefreshHandler;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+17 -17
View File
@@ -41,10 +41,10 @@
bool ScDdeLink::bIsInUpdate = false;
ScDdeLink::ScDdeLink( ScDocument* pD, const OUString& rA, const OUString& rT, const OUString& rI,
ScDdeLink::ScDdeLink( ScDocument& rD, const OUString& rA, const OUString& rT, const OUString& rI,
sal_uInt8 nM ) :
::sfx2::SvBaseLink(SfxLinkUpdateMode::ALWAYS,SotClipboardFormatId::STRING),
pDoc( pD ),
rDoc( rD ),
aAppl( rA ),
aTopic( rT ),
aItem( rI ),
@@ -61,9 +61,9 @@ ScDdeLink::~ScDdeLink()
// pResult is refcounted
}
ScDdeLink::ScDdeLink( ScDocument* pD, const ScDdeLink& rOther ) :
ScDdeLink::ScDdeLink( ScDocument& rD, const ScDdeLink& rOther ) :
::sfx2::SvBaseLink(SfxLinkUpdateMode::ALWAYS,SotClipboardFormatId::STRING),
pDoc ( pD ),
rDoc ( rD ),
aAppl ( rOther.aAppl ),
aTopic ( rOther.aTopic ),
aItem ( rOther.aItem ),
@@ -75,9 +75,9 @@ ScDdeLink::ScDdeLink( ScDocument* pD, const ScDdeLink& rOther ) :
pResult = rOther.pResult->Clone();
}
ScDdeLink::ScDdeLink( ScDocument* pD, SvStream& rStream, ScMultipleReadHeader& rHdr ) :
ScDdeLink::ScDdeLink( ScDocument& rD, SvStream& rStream, ScMultipleReadHeader& rHdr ) :
::sfx2::SvBaseLink(SfxLinkUpdateMode::ALWAYS,SotClipboardFormatId::STRING),
pDoc( pD ),
rDoc( rD ),
bNeedUpdate( false ),
pResult( nullptr )
{
@@ -159,8 +159,8 @@ sfx2::SvBaseLink::UpdateResult ScDdeLink::DataChanged(
// always newly re-create matrix, so that bIsString doesn't get mixed up
pResult = new ScMatrix(nCols, nRows, 0.0);
SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
svl::SharedStringPool& rPool = pDoc->GetSharedStringPool();
SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
svl::SharedStringPool& rPool = rDoc.GetSharedStringPool();
// nMode determines how the text is interpreted (#44455#/#49783#):
// SC_DDE_DEFAULT - number format from cell template "Standard"
@@ -169,7 +169,7 @@ sfx2::SvBaseLink::UpdateResult ScDdeLink::DataChanged(
sal_uLong nStdFormat = 0;
if ( nMode == SC_DDE_DEFAULT )
{
ScPatternAttr* pDefPattern = pDoc->GetDefPattern(); // contains standard template
ScPatternAttr* pDefPattern = rDoc.GetDefPattern(); // contains standard template
if ( pDefPattern )
nStdFormat = pDefPattern->GetNumberFormat( pFormatter );
}
@@ -201,8 +201,8 @@ sfx2::SvBaseLink::UpdateResult ScDdeLink::DataChanged(
if (HasListeners())
{
Broadcast(ScHint(SfxHintId::ScDataChanged, ScAddress()));
pDoc->TrackFormulas(); // must happen immediately
pDoc->StartTrackTimer();
rDoc.TrackFormulas(); // must happen immediately
rDoc.StartTrackTimer();
// StartTrackTimer asynchronously calls TrackFormulas, Broadcast(FID_DATACHANGED),
// ResetChanged, SetModified and Invalidate(SID_SAVEDOC/SID_DOC_MODIFIED)
@@ -214,7 +214,7 @@ sfx2::SvBaseLink::UpdateResult ScDdeLink::DataChanged(
//TODO: do this asynchronously?
ScLinkRefreshedHint aHint;
aHint.SetDdeLink( aAppl, aTopic, aItem );
pDoc->BroadcastUno( aHint );
rDoc.BroadcastUno( aHint );
}
return SUCCESS;
@@ -225,14 +225,14 @@ void ScDdeLink::ListenersGone()
bool bWas = bIsInUpdate;
bIsInUpdate = true; // Remove() can trigger reschedule??!?
ScDocument* pStackDoc = pDoc; // member pDoc can't be used after removing the link
ScDocument& rStackDoc = rDoc; // member rDoc can't be used after removing the link
sfx2::LinkManager* pLinkMgr = pDoc->GetLinkManager();
sfx2::LinkManager* pLinkMgr = rDoc.GetLinkManager();
pLinkMgr->Remove( this); // deletes this
if ( pLinkMgr->GetLinks().empty() ) // deleted the last one ?
{
SfxBindings* pBindings = pStackDoc->GetViewBindings(); // don't use member pDoc!
SfxBindings* pBindings = rStackDoc.GetViewBindings(); // don't use member rDoc!
if (pBindings)
pBindings->Invalidate( SID_LINKS );
}
@@ -257,9 +257,9 @@ void ScDdeLink::TryUpdate()
else
{
bIsInUpdate = true;
pDoc->IncInDdeLinkUpdate();
rDoc.IncInDdeLinkUpdate();
Update();
pDoc->DecInDdeLinkUpdate();
rDoc.DecInDdeLinkUpdate();
bIsInUpdate = false;
bNeedUpdate = false;
}
+1 -1
View File
@@ -2783,7 +2783,7 @@ void ScInterpreter::ScDde()
if (!pLink)
{
pLink = new ScDdeLink( &mrDoc, aAppl, aTopic, aItem, nMode );
pLink = new ScDdeLink( mrDoc, aAppl, aTopic, aItem, nMode );
mpLinkManager->InsertDDELink( pLink, aAppl, aTopic, aItem );
if ( mpLinkManager->GetLinks().size() == 1 ) // the first one?
{
+14 -14
View File
@@ -127,37 +127,37 @@ bool ScSingleRefData::IsDeleted() const
return IsColDeleted() || IsRowDeleted() || IsTabDeleted();
}
bool ScSingleRefData::Valid(const ScDocument* pDoc) const
bool ScSingleRefData::Valid(const ScDocument& rDoc) const
{
return ColValid(pDoc) && RowValid(pDoc) && TabValid();
return ColValid(rDoc) && RowValid(rDoc) && TabValid();
}
bool ScSingleRefData::ColValid(const ScDocument* pDoc) const
bool ScSingleRefData::ColValid(const ScDocument& rDoc) const
{
if (Flags.bColRel)
{
if (mnCol < -pDoc->MaxCol() || pDoc->MaxCol() < mnCol)
if (mnCol < -rDoc.MaxCol() || rDoc.MaxCol() < mnCol)
return false;
}
else
{
if (mnCol < 0 || pDoc->MaxCol() < mnCol)
if (mnCol < 0 || rDoc.MaxCol() < mnCol)
return false;
}
return true;
}
bool ScSingleRefData::RowValid(const ScDocument* pDoc) const
bool ScSingleRefData::RowValid(const ScDocument& rDoc) const
{
if (Flags.bRowRel)
{
if (mnRow < -pDoc->MaxRow() || pDoc->MaxRow() < mnRow)
if (mnRow < -rDoc.MaxRow() || rDoc.MaxRow() < mnRow)
return false;
}
else
{
if (mnRow < 0 || pDoc->MaxRow() < mnRow)
if (mnRow < 0 || rDoc.MaxRow() < mnRow)
return false;
}
@@ -180,9 +180,9 @@ bool ScSingleRefData::TabValid() const
return true;
}
bool ScSingleRefData::ValidExternal(const ScDocument* pDoc) const
bool ScSingleRefData::ValidExternal(const ScDocument& rDoc) const
{
return ColValid(pDoc) && RowValid(pDoc) && mnTab >= -1;
return ColValid(rDoc) && RowValid(rDoc) && mnTab >= -1;
}
ScAddress ScSingleRefData::toAbs( const ScDocument& rDoc, const ScAddress& rPos ) const
@@ -475,14 +475,14 @@ ScComplexRefData& ScComplexRefData::Extend( ScSheetLimits& rLimits, const ScComp
return Extend( rLimits, rRef.Ref1, rPos).Extend( rLimits, rRef.Ref2, rPos);
}
bool ScComplexRefData::Valid(const ScDocument* pDoc) const
bool ScComplexRefData::Valid(const ScDocument& rDoc) const
{
return Ref1.Valid(pDoc) && Ref2.Valid(pDoc);
return Ref1.Valid(rDoc) && Ref2.Valid(rDoc);
}
bool ScComplexRefData::ValidExternal(const ScDocument* pDoc) const
bool ScComplexRefData::ValidExternal(const ScDocument& rDoc) const
{
return Ref1.ValidExternal(pDoc) && Ref2.ColValid(pDoc) && Ref2.RowValid(pDoc) && Ref1.Tab() <= Ref2.Tab();
return Ref1.ValidExternal(rDoc) && Ref2.ColValid(rDoc) && Ref2.RowValid(rDoc) && Ref1.Tab() <= Ref2.Tab();
}
ScRange ScComplexRefData::toAbs( const ScDocument& rDoc, const ScAddress& rPos ) const
+4 -4
View File
@@ -77,7 +77,7 @@ void ScRefTokenHelper::compileRangeRepresentation(
case svSingleRef:
{
const ScSingleRefData& rRef = *p->GetSingleRef();
if (!rRef.Valid(&rDoc))
if (!rRef.Valid(rDoc))
bFailure = true;
else if (bOnly3DRef && !rRef.IsFlag3D())
bFailure = true;
@@ -86,7 +86,7 @@ void ScRefTokenHelper::compileRangeRepresentation(
case svDoubleRef:
{
const ScComplexRefData& rRef = *p->GetDoubleRef();
if (!rRef.Valid(&rDoc))
if (!rRef.Valid(rDoc))
bFailure = true;
else if (bOnly3DRef && !rRef.Ref1.IsFlag3D())
bFailure = true;
@@ -94,13 +94,13 @@ void ScRefTokenHelper::compileRangeRepresentation(
break;
case svExternalSingleRef:
{
if (!p->GetSingleRef()->ValidExternal(&rDoc))
if (!p->GetSingleRef()->ValidExternal(rDoc))
bFailure = true;
}
break;
case svExternalDoubleRef:
{
if (!p->GetDoubleRef()->ValidExternal(&rDoc))
if (!p->GetDoubleRef()->ValidExternal(rDoc))
bFailure = true;
}
break;
+2 -2
View File
@@ -339,9 +339,9 @@ bool ScRawToken::IsValidReference(const ScDocument& rDoc) const
switch (eType)
{
case svSingleRef:
return aRef.Ref1.Valid(&rDoc);
return aRef.Ref1.Valid(rDoc);
case svDoubleRef:
return aRef.Valid(&rDoc);
return aRef.Valid(rDoc);
case svExternalSingleRef:
case svExternalDoubleRef:
return true;
+1 -1
View File
@@ -4062,7 +4062,7 @@ void XclImpChChart::Convert( const Reference<XChartDocument>& xChartDoc,
rxSeries->FillAllSourceLinks( *xRefTokens );
if( !xRefTokens->empty() )
{
::std::unique_ptr< ScChartListener > xListener( new ScChartListener( rObjName, &rDoc, std::move(xRefTokens) ) );
::std::unique_ptr< ScChartListener > xListener( new ScChartListener( rObjName, rDoc, std::move(xRefTokens) ) );
xListener->SetUsed( true );
xListener->StartListeningTo();
pChartCollection->insert( xListener.release() );
@@ -84,7 +84,7 @@ void ScMyOLEFixer::CreateChartListener(ScDocument& rDoc,
if (pRefTokens->empty())
return;
ScChartListener* pCL(new ScChartListener(rName, &rDoc, std::move(pRefTokens)));
ScChartListener* pCL(new ScChartListener(rName, rDoc, std::move(pRefTokens)));
//for loading binary files e.g.
//if we have the flat filter we need to set the dirty flag thus the visible charts get repainted
+2 -2
View File
@@ -680,7 +680,7 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize)
m_pDoc->GetName( m_aBlock.aStart.Tab(), aTabName );
rDestDoc.RenameTab( 0, aTabName );
rDestDoc.CopyStdStylesFrom( m_pDoc.get() );
rDestDoc.CopyStdStylesFrom(*m_pDoc);
SCCOL nStartX = m_aBlock.aStart.Col();
SCROW nStartY = m_aBlock.aStart.Row();
@@ -738,7 +738,7 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize)
ScRange aMergeRange = aDestRange;
rDestDoc.ExtendMerge( aMergeRange, true );
m_pDoc->CopyDdeLinks( &rDestDoc ); // copy values of DDE Links
m_pDoc->CopyDdeLinks( rDestDoc ); // copy values of DDE Links
// page format (grid etc) and page size (maximum size for ole object)
+2 -2
View File
@@ -177,8 +177,8 @@ const std::vector<std::shared_ptr<sc::DataTransformation>>& ExternalDataSource::
return maDataTransformations;
}
ExternalDataMapper::ExternalDataMapper(ScDocument* /*pDoc*/)
//mpDoc(pDoc)
ExternalDataMapper::ExternalDataMapper(ScDocument& /*rDoc*/)
//mrDoc(rDoc)
{
}
+1 -1
View File
@@ -1008,7 +1008,7 @@ void ScUndoPaste::DoChange(bool bUndo)
}
pRedoDoc.reset( new ScDocument( SCDOCMODE_UNDO ) );
pRedoDoc->InitUndoSelected( &rDoc, aMarkData, bColInfo, bRowInfo );
pRedoDoc->InitUndoSelected( rDoc, aMarkData, bColInfo, bRowInfo );
}
// read "redo" data from the document in the first undo
// all sheets - CopyToDocument skips those that don't exist in pRedoDoc
+1 -1
View File
@@ -1833,7 +1833,7 @@ void ScUndoDataForm::DoChange( const bool bUndo )
bool bRowInfo = ( aBlockRange.aStart.Col()==0 && aBlockRange.aEnd.Col()==rDoc.MaxCol() );
xRedoDoc.reset(new ScDocument(SCDOCMODE_UNDO));
xRedoDoc->InitUndoSelected(&rDoc, *mxMarkData, bColInfo, bRowInfo);
xRedoDoc->InitUndoSelected(rDoc, *mxMarkData, bColInfo, bRowInfo);
}
// read "redo" data from the document in the first undo
// all sheets - CopyToDocument skips those that don't exist in pRedoDoc
+1 -1
View File
@@ -3251,7 +3251,7 @@ void SAL_CALL ScCellRangesBase::addChartDataChangeEventListener( const uno::Refe
// failed to create unique name.
return;
ScChartListener* pListener = new ScChartListener( aName, &rDoc, aRangesRef );
ScChartListener* pListener = new ScChartListener( aName, rDoc, aRangesRef );
pListener->SetUno( aListener, this );
pColl->insert( pListener );
pListener->StartListeningTo();
+1 -1
View File
@@ -237,7 +237,7 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName,
}
ScChartListener* pChartListener =
new ScChartListener( aName, &rDoc, xNewRanges );
new ScChartListener( aName, rDoc, xNewRanges );
rDoc.GetChartListenerCollection()->insert( pChartListener );
pChartListener->StartListeningTo();
+2 -2
View File
@@ -315,7 +315,7 @@ std::shared_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
SCITEM_QUERYDATA>{} );
ScDBData* pDBData = GetDBData(false, SC_DB_MAKE, ScGetDBSelection::RowDown);
pDBData->ExtendDataArea(&rDoc);
pDBData->ExtendDataArea(rDoc);
pDBData->GetQueryParam( aQueryParam );
ScRange aArea;
@@ -340,7 +340,7 @@ std::shared_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
SCITEM_QUERYDATA>{} );
ScDBData* pDBData = GetDBData(false, SC_DB_MAKE, ScGetDBSelection::RowDown);
pDBData->ExtendDataArea(&rDoc);
pDBData->ExtendDataArea(rDoc);
pDBData->GetQueryParam( aQueryParam );
ScRange aArea;
+10 -10
View File
@@ -122,7 +122,7 @@ void ScViewFunc::CutToClip()
if ( bRecord )
{
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
pUndoDoc->InitUndoSelected( &rDoc, rMark );
pUndoDoc->InitUndoSelected( rDoc, rMark );
// all sheets - CopyToDocument skips those that don't exist in pUndoDoc
ScRange aCopyRange = aRange;
aCopyRange.aStart.SetTab(0);
@@ -1250,7 +1250,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
if ( bRecord )
{
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
pUndoDoc->InitUndoSelected( &rDoc, aFilteredMark, bColInfo, bRowInfo );
pUndoDoc->InitUndoSelected( rDoc, aFilteredMark, bColInfo, bRowInfo );
// all sheets - CopyToDocument skips those that don't exist in pUndoDoc
SCTAB nTabCount = rDoc.GetTableCount();
@@ -1336,7 +1336,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
if ( pMixDoc ) // calculate with original data?
{
rDoc.MixDocument( aUserRange, nFunction, bSkipEmpty, pMixDoc.get() );
rDoc.MixDocument( aUserRange, nFunction, bSkipEmpty, *pMixDoc );
}
pMixDoc.reset();
@@ -1549,7 +1549,7 @@ bool ScViewFunc::PasteMultiRangesFromClip(
if (rDoc.IsUndoEnabled())
{
pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO));
pUndoDoc->InitUndoSelected(&rDoc, aMark, false, bRowInfo);
pUndoDoc->InitUndoSelected(rDoc, aMark, false, bRowInfo);
rDoc.CopyToDocument(aMarkedRange, nUndoFlags, false, *pUndoDoc, &aMark);
}
@@ -1559,7 +1559,7 @@ bool ScViewFunc::PasteMultiRangesFromClip(
if ( nFlags & InsertDeleteFlags::CONTENTS )
{
pMixDoc.reset(new ScDocument(SCDOCMODE_UNDO));
pMixDoc->InitUndoSelected(&rDoc, aMark);
pMixDoc->InitUndoSelected(rDoc, aMark);
rDoc.CopyToDocument(aMarkedRange, InsertDeleteFlags::CONTENTS, false, *pMixDoc, &aMark);
}
}
@@ -1578,7 +1578,7 @@ bool ScViewFunc::PasteMultiRangesFromClip(
true, bAsLink, false, bSkipEmpty);
if (pMixDoc)
rDoc.MixDocument(aMarkedRange, nFunction, bSkipEmpty, pMixDoc.get());
rDoc.MixDocument(aMarkedRange, nFunction, bSkipEmpty, *pMixDoc);
AdjustBlockHeight(); // update row heights before pasting objects
@@ -1700,7 +1700,7 @@ bool ScViewFunc::PasteFromClipToMultiRanges(
if (rDoc.IsUndoEnabled())
{
pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO));
pUndoDoc->InitUndoSelected(&rDoc, aMark);
pUndoDoc->InitUndoSelected(rDoc, aMark);
for (size_t i = 0, n = aRanges.size(); i < n; ++i)
{
rDoc.CopyToDocument(
@@ -1714,7 +1714,7 @@ bool ScViewFunc::PasteFromClipToMultiRanges(
if (nFlags & InsertDeleteFlags::CONTENTS)
{
pMixDoc.reset(new ScDocument(SCDOCMODE_UNDO));
pMixDoc->InitUndoSelected(&rDoc, aMark);
pMixDoc->InitUndoSelected(rDoc, aMark);
for (size_t i = 0, n = aRanges.size(); i < n; ++i)
{
rDoc.CopyToDocument(
@@ -1739,7 +1739,7 @@ bool ScViewFunc::PasteFromClipToMultiRanges(
if (pMixDoc)
{
for (size_t i = 0, n = aRanges.size(); i < n; ++i)
rDoc.MixDocument(aRanges[i], nFunction, bSkipEmpty, pMixDoc.get());
rDoc.MixDocument(aRanges[i], nFunction, bSkipEmpty, *pMixDoc);
}
AdjustBlockHeight(); // update row heights before pasting objects
@@ -1978,7 +1978,7 @@ void ScViewFunc::DataFormPutData( SCROW nCurrentRow ,
if ( bRecord )
{
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
pUndoDoc->InitUndoSelected( &rDoc , rMark , bColInfo , bRowInfo );
pUndoDoc->InitUndoSelected( rDoc , rMark , bColInfo , bRowInfo );
rDoc.CopyToDocument( aUserRange , InsertDeleteFlags::VALUE , false, *pUndoDoc );
}
sal_uInt16 nExtFlags = 0;