Prefix one more member of ScDocument: pShell

Change-Id: I72f2556f54e1ea4b397f9b21b1d767ae597e6e43
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 498ea76..e08378e 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -319,7 +319,7 @@ private:
    SfxUndoManager*     mpUndoManager;
    ScFieldEditEngine*  mpEditEngine;                   // uses pEditPool from xPoolHelper
    ScNoteEditEngine*   mpNoteEngine;                   // uses pEditPool from xPoolHelper
    SfxObjectShell*     pShell;
    SfxObjectShell*     mpShell;
    VclPtr<SfxPrinter>    pPrinter;
    VclPtr<VirtualDevice> pVirtualDevice_100th_mm;
    ScDrawLayer*        pDrawLayer;                     // SdrModel
@@ -931,7 +931,7 @@ public:
    bool            SetDdeLinkResultMatrix( size_t nDdePos, const ScMatrixRef& pResults );

    SfxBindings*                    GetViewBindings();
    SfxObjectShell*                 GetDocumentShell() const    { return pShell; }
    SfxObjectShell*                 GetDocumentShell() const    { return mpShell; }
    SC_DLLPUBLIC ScDrawLayer*       GetDrawLayer() { return pDrawLayer;  }
    SC_DLLPUBLIC const ScDrawLayer* GetDrawLayer() const { return pDrawLayer;  }
    SfxBroadcaster*                 GetDrawBroadcaster();       // to avoid header
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 78cc2a1..c54564d 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -138,7 +138,7 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) :
        mpUndoManager( nullptr ),
        mpEditEngine( nullptr ),
        mpNoteEngine( nullptr ),
        pShell( pDocShell ),
        mpShell( pDocShell ),
        pPrinter( nullptr ),
        pVirtualDevice_100th_mm( nullptr ),
        pDrawLayer( nullptr ),
@@ -266,7 +266,7 @@ const sfx2::LinkManager* ScDocument::GetLinkManager() const
sc::DocumentLinkManager& ScDocument::GetDocLinkManager()
{
    if (!mpDocLinkMgr)
        mpDocLinkMgr.reset(new sc::DocumentLinkManager(pShell));
        mpDocLinkMgr.reset(new sc::DocumentLinkManager(mpShell));
    return *mpDocLinkMgr;
}

@@ -297,7 +297,7 @@ sal_uInt32 ScDocument::GetDocumentID() const
    const ScDocument* pThis = this;
    sal_uInt32 nCrc = rtl_crc32( 0, &pThis, sizeof(ScDocument*) );
    // the this pointer only might not be sufficient
    nCrc = rtl_crc32( nCrc, &pShell, sizeof(SfxObjectShell*) );
    nCrc = rtl_crc32( nCrc, &mpShell, sizeof(SfxObjectShell*) );
    return nCrc;
}

@@ -328,16 +328,16 @@ IMPL_LINK_NOARG(ScDocument, TrackTimeHdl, Timer *, void)
    {
        aTrackIdle.Start();            // try again later
    }
    else if (pShell)                    // execute
    else if (mpShell)                    // execute
    {
        TrackFormulas();
        pShell->Broadcast( SfxHint( SfxHintId::ScDataChanged ) );
        mpShell->Broadcast( SfxHint( SfxHintId::ScDataChanged ) );

            //  modified...

        if (!pShell->IsModified())
        if (!mpShell->IsModified())
        {
            pShell->SetModified();
            mpShell->SetModified();
            SfxBindings* pBindings = GetViewBindings();
            if (pBindings)
            {
@@ -977,16 +977,16 @@ sal_uLong ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
                                            // 3 => NameBox
                                            // 4 => both

    if (pSrcDoc->pShell->GetMedium())
    if (pSrcDoc->mpShell->GetMedium())
    {
        pSrcDoc->maFileURL = pSrcDoc->pShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
        pSrcDoc->maFileURL = pSrcDoc->mpShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
        // for unsaved files use the title name and adjust during save of file
        if (pSrcDoc->maFileURL.isEmpty())
            pSrcDoc->maFileURL = pSrcDoc->pShell->GetName();
            pSrcDoc->maFileURL = pSrcDoc->mpShell->GetName();
    }
    else
    {
        pSrcDoc->maFileURL = pSrcDoc->pShell->GetName();
        pSrcDoc->maFileURL = pSrcDoc->mpShell->GetName();
    }

    bool bValid = true;
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index df46daa..5fb5c8d 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -581,7 +581,7 @@ bool ScDocument::LinkExternalTab( SCTAB& rTab, const OUString& aDocTab,
    SetLink( rTab, ScLinkMode::VALUE, aFileName, aFilterName, aOptions, aTabName, nRefreshDelay );
    if ( !bWasThere ) // Add link only once per source document
    {
        ScTableLink* pLink = new ScTableLink( pShell, aFileName, aFilterName, aOptions, nRefreshDelay );
        ScTableLink* pLink = new ScTableLink( mpShell, aFileName, aFilterName, aOptions, nRefreshDelay );
        pLink->SetInCreate( true );
        OUString aFilName = aFilterName;
        GetLinkManager()->InsertFileLink( *pLink, OBJECT_CLIENT_FILE, aFileName, &aFilName );
@@ -1847,7 +1847,7 @@ bool ScDocument::IsDocProtected() const
bool ScDocument::IsDocEditable() const
{
    // Import into read-only document is possible
    return !IsDocProtected() && ( bImportingXML || mbChangeReadOnlyEnabled || !pShell || !pShell->IsReadOnly() );
    return !IsDocProtected() && ( bImportingXML || mbChangeReadOnlyEnabled || !mpShell || !mpShell->IsReadOnly() );
}

bool ScDocument::IsTabProtected( SCTAB nTab ) const
diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx
index 5a673f3..d355241 100644
--- a/sc/source/core/data/documen5.cxx
+++ b/sc/source/core/data/documen5.cxx
@@ -107,7 +107,7 @@ static void lcl_SetChartParameters( const uno::Reference< chart2::data::XDataRec

void ScDocument::UpdateAllCharts()
{
    if ( !pDrawLayer || !pShell )
    if ( !pDrawLayer || !mpShell )
        return;

    if (pChartCollection->empty())
@@ -159,7 +159,7 @@ void ScDocument::UpdateAllCharts()
                                    // connect
                                    xReceiver->attachDataProvider( xDataProvider );
                                    uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier(
                                            pShell->GetModel(), uno::UNO_QUERY );
                                            mpShell->GetModel(), uno::UNO_QUERY );
                                    xReceiver->attachNumberFormatsSupplier( xNumberFormatsSupplier );

                                    lcl_SetChartParameters( xReceiver, sRangeStr, chart::ChartDataRowSource_COLUMNS,
@@ -393,13 +393,13 @@ void ScDocument::UpdateChartArea( const OUString& rChartName,
                        aNewRanges = rNewList;
                    }

                    if ( bInternalData && pShell )
                    if ( bInternalData && mpShell )
                    {
                        // Calc -> DataProvider
                        uno::Reference< chart2::data::XDataProvider > xDataProvider = new ScChart2DataProvider( this );
                        xReceiver->attachDataProvider( xDataProvider );
                        uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier(
                                pShell->GetModel(), uno::UNO_QUERY );
                                mpShell->GetModel(), uno::UNO_QUERY );
                        xReceiver->attachNumberFormatsSupplier( xNumberFormatsSupplier );
                    }

diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 8f1908d..437f2c1 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -690,9 +690,9 @@ bool ScDocument::IdleCalcTextWidth()            // true = try next again

void ScDocument::RepaintRange( const ScRange& rRange )
{
    if ( bIsVisible && pShell )
    if ( bIsVisible && mpShell )
    {
        ScModelObj* pModel = ScModelObj::getImplementation( pShell->GetModel() );
        ScModelObj* pModel = ScModelObj::getImplementation( mpShell->GetModel() );
        if ( pModel )
            pModel->RepaintRange( rRange );     // locked repaints are checked there
    }
@@ -700,9 +700,9 @@ void ScDocument::RepaintRange( const ScRange& rRange )

void ScDocument::RepaintRange( const ScRangeList& rRange )
{
    if ( bIsVisible && pShell )
    if ( bIsVisible && mpShell )
    {
        ScModelObj* pModel = ScModelObj::getImplementation( pShell->GetModel() );
        ScModelObj* pModel = ScModelObj::getImplementation( mpShell->GetModel() );
        if ( pModel )
            pModel->RepaintRange( rRange );     // locked repaints are checked there
    }
@@ -848,12 +848,12 @@ void ScDocument::UpdateExternalRefLinks(vcl::Window* pWin)
    if (bAny)
    {
        TrackFormulas();
        pShell->Broadcast( SfxHint(SfxHintId::ScDataChanged) );
        mpShell->Broadcast( SfxHint(SfxHintId::ScDataChanged) );

        // #i101960# set document modified, as in TrackTimeHdl for DDE links
        if (!pShell->IsModified())
        if (!mpShell->IsModified())
        {
            pShell->SetModified();
            mpShell->SetModified();
            SfxBindings* pBindings = GetViewBindings();
            if (pBindings)
            {
@@ -1165,17 +1165,17 @@ SfxBindings* ScDocument::GetViewBindings()
{
    //  used to invalidate slots after changes to this document

    if ( !pShell )
    if ( !mpShell )
        return nullptr;        // no ObjShell -> no view

    //  first check current view
    SfxViewFrame* pViewFrame = SfxViewFrame::Current();
    if ( pViewFrame && pViewFrame->GetObjectShell() != pShell )     // wrong document?
    if ( pViewFrame && pViewFrame->GetObjectShell() != mpShell )     // wrong document?
        pViewFrame = nullptr;

    //  otherwise use first view for this doc
    if ( !pViewFrame )
        pViewFrame = SfxViewFrame::GetFirst( pShell );
        pViewFrame = SfxViewFrame::GetFirst( mpShell );

    if (pViewFrame)
        return &pViewFrame->GetBindings();
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index 5610f96..51be5a4 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -108,14 +108,14 @@ void ScDocument::TransferDrawPage(ScDocument* pSrcDoc, SCTAB nSrcPos, SCTAB nDes

void ScDocument::InitDrawLayer( SfxObjectShell* pDocShell )
{
    if (pDocShell && !pShell)
        pShell = pDocShell;
    if (pDocShell && !mpShell)
        mpShell = pDocShell;

    if (!pDrawLayer)
    {
        OUString aName;
        if ( pShell && !pShell->IsLoading() )       // don't call GetTitle while loading
            aName = pShell->GetTitle();
        if ( mpShell && !mpShell->IsLoading() )       // don't call GetTitle while loading
            aName = mpShell->GetTitle();
        pDrawLayer = new ScDrawLayer( this, aName );

        sfx2::LinkManager* pMgr = GetDocLinkManager().getLinkManager(bAutoCalc);
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 239a766..019ee46 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2001,8 +2001,8 @@ void ScDocument::InitUndo( const ScDocument* pSrcDoc, SCTAB nTab1, SCTAB nTab2,
    // Undo document shares its pooled resources with the source document.
    SharePooledResources(pSrcDoc);

    if (pSrcDoc->pShell->GetMedium())
        maFileURL = pSrcDoc->pShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
    if (pSrcDoc->mpShell->GetMedium())
        maFileURL = pSrcDoc->mpShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::ToIUri);

    if ( nTab2 >= static_cast<SCTAB>(maTabs.size()))
        maTabs.resize(nTab2 + 1, nullptr);
@@ -2182,16 +2182,16 @@ void ScDocument::CopyToClip(const ScClipParam& rClipParam,
        pClipDoc = ScModule::GetClipDoc();
    }

    if (pShell->GetMedium())
    if (mpShell->GetMedium())
    {
        pClipDoc->maFileURL = pShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
        pClipDoc->maFileURL = mpShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
        // for unsaved files use the title name and adjust during save of file
        if (pClipDoc->maFileURL.isEmpty())
            pClipDoc->maFileURL = pShell->GetName();
            pClipDoc->maFileURL = mpShell->GetName();
    }
    else
    {
        pClipDoc->maFileURL = pShell->GetName();
        pClipDoc->maFileURL = mpShell->GetName();
    }

    //init maTabNames
@@ -2282,16 +2282,16 @@ void ScDocument::CopyTabToClip(SCCOL nCol1, SCROW nRow1,
            pClipDoc = ScModule::GetClipDoc();
        }

        if (pShell->GetMedium())
        if (mpShell->GetMedium())
        {
            pClipDoc->maFileURL = pShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
            pClipDoc->maFileURL = mpShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
            // for unsaved files use the title name and adjust during save of file
            if (pClipDoc->maFileURL.isEmpty())
                pClipDoc->maFileURL = pShell->GetName();
                pClipDoc->maFileURL = mpShell->GetName();
        }
        else
        {
            pClipDoc->maFileURL = pShell->GetName();
            pClipDoc->maFileURL = mpShell->GetName();
        }

        //init maTabNames
@@ -5266,7 +5266,7 @@ bool ScDocument::IsBlockEditable( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
                                        bool* pOnlyNotBecauseOfMatrix /* = NULL */ ) const
{
    // import into read-only document is possible
    if (!bImportingXML && !mbChangeReadOnlyEnabled && pShell && pShell->IsReadOnly())
    if (!bImportingXML && !mbChangeReadOnlyEnabled && mpShell && mpShell->IsReadOnly())
    {
        if ( pOnlyNotBecauseOfMatrix )
            *pOnlyNotBecauseOfMatrix = false;
@@ -5288,7 +5288,7 @@ bool ScDocument::IsSelectionEditable( const ScMarkData& rMark,
            bool* pOnlyNotBecauseOfMatrix /* = NULL */ ) const
{
    // import into read-only document is possible
    if ( !bImportingXML && !mbChangeReadOnlyEnabled && pShell && pShell->IsReadOnly() )
    if ( !bImportingXML && !mbChangeReadOnlyEnabled && mpShell && mpShell->IsReadOnly() )
    {
        if ( pOnlyNotBecauseOfMatrix )
            *pOnlyNotBecauseOfMatrix = false;
@@ -6401,13 +6401,13 @@ void ScDocument::EnableUserInteraction( bool bVal )

bool ScDocument::IsInVBAMode() const
{
    if (!pShell)
    if (!mpShell)
        return false;

    try
    {
        uno::Reference<script::vba::XVBACompatibility> xVBA(
            pShell->GetBasicContainer(), uno::UNO_QUERY);
            mpShell->GetBasicContainer(), uno::UNO_QUERY);

        return xVBA.is() && xVBA->getVBACompatibilityMode();
    }