sw/inc/doc.hxx                    |    2 +-
 sw/inc/printdata.hxx              |    2 +-
 sw/source/core/doc/doc.cxx        |    4 ++--
 sw/source/core/view/printdata.cxx |    5 ++---
 sw/source/core/view/vprint.cxx    |    2 +-
 sw/source/uibase/uno/unotxdoc.cxx |    4 ++--
 6 files changed, 9 insertions(+), 10 deletions(-)

New commits:
commit ebef58c6d1bc56768d71150da305237cc2384c85
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Sep 28 16:35:42 2020 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Sep 29 12:52:47 2020 +0200

    CreatePostItData never passed a null SwDoc*
    
    Change-Id: Ie3f8ec6ff645b09bbdc897b45cd1de26ddc970bc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103600
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index aff7d10e0ce3..3253ad0c118e 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1678,7 +1678,7 @@ inline void SwDoc::SetOLEPrtNotifyPending( bool bSet )
         mbAllOLENotify = false;
 }
 
-bool sw_GetPostIts( IDocumentFieldsAccess const * pIDFA, SetGetExpFields * 
pSrtLst );
+bool sw_GetPostIts(const IDocumentFieldsAccess& rIDFA, SetGetExpFields * 
pSrtLst);
 
 #endif  //_DOC_HXX
 
diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx
index 1092f977fa47..60778a13eb2c 100644
--- a/sw/inc/printdata.hxx
+++ b/sw/inc/printdata.hxx
@@ -242,7 +242,7 @@ public:
     ~SwRenderData();
 
     bool HasPostItData() const  { return m_pPostItShell != nullptr; }
-    void CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, 
OutputDevice *pOutDev );
+    void CreatePostItData( SwDoc& rDoc, const SwViewOption *pViewOpt, 
OutputDevice *pOutDev );
     void DeletePostItData();
 
     SfxObjectShellLock const& GetTempDocShell() const { return 
m_xTempDocShell;}
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index a1f9ed152a46..b78cbe662ef6 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -512,9 +512,9 @@ sal_uInt16 PostItField_::GetPageNo(
     return 0;
 }
 
-bool sw_GetPostIts(IDocumentFieldsAccess const* pIDFA, SetGetExpFields* 
pSrtLst)
+bool sw_GetPostIts(const IDocumentFieldsAccess& rIDFA, SetGetExpFields* 
pSrtLst)
 {
-    SwFieldType* pFieldType = pIDFA->GetSysFieldType(SwFieldIds::Postit);
+    SwFieldType* pFieldType = rIDFA.GetSysFieldType(SwFieldIds::Postit);
     assert(pFieldType);
 
     std::vector<SwFormatField*> vFields;
diff --git a/sw/source/core/view/printdata.cxx 
b/sw/source/core/view/printdata.cxx
index 4001314a953f..03526c134e56 100644
--- a/sw/source/core/view/printdata.cxx
+++ b/sw/source/core/view/printdata.cxx
@@ -45,11 +45,11 @@ SwRenderData::~SwRenderData()
     OSL_ENSURE( !m_pPostItFields, " should already have been deleted" );
 }
 
-void SwRenderData::CreatePostItData( SwDoc *pDoc, const SwViewOption 
*pViewOpt, OutputDevice *pOutDev )
+void SwRenderData::CreatePostItData( SwDoc& rDoc, const SwViewOption 
*pViewOpt, OutputDevice *pOutDev )
 {
     DeletePostItData();
     m_pPostItFields.reset(new SetGetExpFields);
-    sw_GetPostIts( &pDoc->getIDocumentFieldsAccess(), m_pPostItFields.get() );
+    sw_GetPostIts( rDoc.getIDocumentFieldsAccess(), m_pPostItFields.get() );
 
     //!! Disable spell and grammar checking in the temporary document.
     //!! Otherwise the grammar checker might process it and crash if we later 
on
@@ -74,7 +74,6 @@ void SwRenderData::DeletePostItData()
     }
 }
 
-
 void SwRenderData::SetTempDocShell(SfxObjectShellLock const& xShell)
 {
     m_xTempDocShell = xShell;
diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index fe3820f6c461..dab2c305dfb9 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -450,7 +450,7 @@ bool SwViewShell::PrintOrPDFExport(
 
     // tdf#91680 Reserve space in margin for comments only if there are 
comments
     const bool bHasPostItsToPrintInMargins = ( nPostItMode == 
SwPostItMode::InMargins ) &&
-                                sw_GetPostIts( 
&GetDoc()->getIDocumentFieldsAccess(), nullptr );
+                                sw_GetPostIts( 
GetDoc()->getIDocumentFieldsAccess(), nullptr );
 
     if ( bHasPostItsToPrintInMargins )
     {
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index c42238a864a9..f1220b01564b 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -185,7 +185,7 @@ static std::unique_ptr<SwPrintUIOptions> 
lcl_GetPrintUIOptions(
     const bool bSwSrcView   = nullptr != dynamic_cast< const SwSrcView * 
>(pView);
     const SwView * pSwView = dynamic_cast< const SwView * >(pView);
     const bool bHasSelection    = pSwView && pSwView->HasSelection( false );  
// check for any selection, not just text selection
-    const bool bHasPostIts      = sw_GetPostIts( 
&pDocShell->GetDoc()->getIDocumentFieldsAccess(), nullptr );
+    const bool bHasPostIts      = 
sw_GetPostIts(pDocShell->GetDoc()->getIDocumentFieldsAccess(), nullptr);
 
     // get default values to use in dialog from documents SwPrintData
     const SwPrintData &rPrintData = 
pDocShell->GetDoc()->getIDocumentDeviceAccess().getPrintData();
@@ -2620,7 +2620,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount(
             if (nPostItMode != SwPostItMode::NONE)
             {
                 VclPtr< OutputDevice > pOutDev = lcl_GetOutputDevice( 
*m_pPrintUIOptions );
-                m_pRenderData->CreatePostItData( pDoc, 
pViewShell->GetViewOptions(), pOutDev );
+                m_pRenderData->CreatePostItData(*pDoc, 
pViewShell->GetViewOptions(), pOutDev);
             }
 
             // get set of valid document pages (according to the current 
settings)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to