[Libreoffice-commits] core.git: sw/inc sw/qa sw/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Sun Oct 4 13:03:33 UTC 2020
sw/inc/drawdoc.hxx | 8 ++++----
sw/inc/swabstdlg.hxx | 2 +-
sw/inc/textboxhelper.hxx | 2 +-
sw/qa/extras/uiwriter/uiwriter.cxx | 2 +-
sw/source/core/doc/DocumentDrawModelManager.cxx | 2 +-
sw/source/core/doc/textboxhelper.cxx | 4 ++--
sw/source/core/draw/drawdoc.cxx | 20 +++++++++-----------
sw/source/ui/dialog/swdlgfact.cxx | 4 ++--
sw/source/ui/dialog/swdlgfact.hxx | 2 +-
sw/source/ui/fldui/DateFormFieldDialog.cxx | 4 ++--
sw/source/uibase/inc/DateFormFieldDialog.hxx | 2 +-
sw/source/uibase/shells/textsh1.cxx | 2 +-
12 files changed, 26 insertions(+), 28 deletions(-)
New commits:
commit f5198863fc115eb72853ed76dfef037001784b61
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Oct 2 20:00:24 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Oct 4 15:02:54 2020 +0200
SwDrawModel ctor always dereferences its SwDoc* arg
DateFormFieldDialog ctor too
SwTextBoxHelper::getCount too
Change-Id: I0d6e41b671af8c7d47ca3cd1f3e62a162ae06aca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103875
Tested-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/inc/drawdoc.hxx b/sw/inc/drawdoc.hxx
index de45437efbc2..75882a1bbd63 100644
--- a/sw/inc/drawdoc.hxx
+++ b/sw/inc/drawdoc.hxx
@@ -26,14 +26,14 @@ class SwDoc;
class SwDrawModel final : public FmFormModel
{
private:
- SwDoc* m_pDoc;
+ SwDoc& m_rDoc;
public:
- SwDrawModel( SwDoc* pDoc );
+ SwDrawModel(SwDoc& rDoc);
virtual ~SwDrawModel() override;
- const SwDoc& GetDoc() const { return *m_pDoc; }
- SwDoc& GetDoc() { return *m_pDoc; }
+ const SwDoc& GetDoc() const { return m_rDoc; }
+ SwDoc& GetDoc() { return m_rDoc; }
/// Put needed items for XPropertyList entries from the DrawModel.
void PutAreaListItems(SfxItemSet& rSet) const;
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index 82540628fb06..c29b98214281 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -397,7 +397,7 @@ public:
SwField* pField, bool bPrevButton, bool bNextButton) = 0;
virtual VclPtr<VclAbstractDialog> CreateDropDownFormFieldDialog(weld::Widget* pParent, sw::mark::IFieldmark* pDropDownField) = 0;
- virtual VclPtr<VclAbstractDialog> CreateDateFormFieldDialog(weld::Widget* pParent, sw::mark::IDateFieldmark* pDateField, SwDoc* pDoc) = 0;
+ virtual VclPtr<VclAbstractDialog> CreateDateFormFieldDialog(weld::Widget* pParent, sw::mark::IDateFieldmark* pDateField, SwDoc& rDoc) = 0;
virtual VclPtr<SfxAbstractTabDialog> CreateSwEnvDlg(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert) = 0;
diff --git a/sw/inc/textboxhelper.hxx b/sw/inc/textboxhelper.hxx
index b0e017fd010c..5d58305406c2 100644
--- a/sw/inc/textboxhelper.hxx
+++ b/sw/inc/textboxhelper.hxx
@@ -96,7 +96,7 @@ public:
static bool isTextBox(const SwFrameFormat* pFormat, sal_uInt16 nType);
/// Count number of shapes in the document, excluding TextBoxes.
- static sal_Int32 getCount(const SwDoc* pDoc);
+ static sal_Int32 getCount(const SwDoc& rDoc);
/// Count number of shapes on the page, excluding TextBoxes.
static sal_Int32 getCount(SdrPage const* pPage);
/// Get a shape by index, excluding TextBoxes.
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 9cef3b791324..6df15abeb888 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -1558,7 +1558,7 @@ void SwUiWriterTest::testFdo82191()
pWrtShell->Paste(&aClipboard);
// This was one: the textbox of the shape wasn't copied.
- CPPUNIT_ASSERT_EQUAL(sal_Int32(2), SwTextBoxHelper::getCount(pDoc));
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), SwTextBoxHelper::getCount(*pDoc));
}
void SwUiWriterTest::testCommentedWord()
diff --git a/sw/source/core/doc/DocumentDrawModelManager.cxx b/sw/source/core/doc/DocumentDrawModelManager.cxx
index 57ecf006d278..947a7825ea27 100644
--- a/sw/source/core/doc/DocumentDrawModelManager.cxx
+++ b/sw/source/core/doc/DocumentDrawModelManager.cxx
@@ -77,7 +77,7 @@ void DocumentDrawModelManager::InitDrawModel()
SAL_INFO( "sw.doc", "before create DrawDocument" );
// The document owns the SwDrawModel. We always have two layers and one page.
- mpDrawModel.reset( new SwDrawModel( &m_rDoc ) );
+ mpDrawModel.reset(new SwDrawModel(m_rDoc));
mpDrawModel->EnableUndo( m_rDoc.GetIDocumentUndoRedo().DoesUndo() );
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index b7543049efac..0f095c7ab71c 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -223,10 +223,10 @@ sal_Int32 SwTextBoxHelper::getCount(SdrPage const* pPage)
return nRet;
}
-sal_Int32 SwTextBoxHelper::getCount(const SwDoc* pDoc)
+sal_Int32 SwTextBoxHelper::getCount(const SwDoc& rDoc)
{
sal_Int32 nRet = 0;
- const SwFrameFormats& rSpzFrameFormats = *pDoc->GetSpzFrameFormats();
+ const SwFrameFormats& rSpzFrameFormats = *rDoc.GetSpzFrameFormats();
for (const auto pFormat : rSpzFrameFormats)
{
if (isTextBox(pFormat, RES_FLYFRMFMT))
diff --git a/sw/source/core/draw/drawdoc.cxx b/sw/source/core/draw/drawdoc.cxx
index 7fa2bd715970..401c9cf9c980 100644
--- a/sw/source/core/draw/drawdoc.cxx
+++ b/sw/source/core/draw/drawdoc.cxx
@@ -31,21 +31,19 @@
using namespace com::sun::star;
// Constructor
-SwDrawModel::SwDrawModel(SwDoc *const pDoc)
-: FmFormModel(
- &pDoc->GetAttrPool(),
- pDoc->GetDocShell())
- , m_pDoc( pDoc )
+SwDrawModel::SwDrawModel(SwDoc& rDoc)
+ : FmFormModel(&rDoc.GetAttrPool(), rDoc.GetDocShell())
+ , m_rDoc(rDoc)
{
SetScaleUnit( MapUnit::MapTwip );
SetSwapGraphics();
// use common InitDrawModelAndDocShell which will set the associations as needed,
// including SvxColorTableItem with WhichID SID_COLOR_TABLE
- InitDrawModelAndDocShell(m_pDoc->GetDocShell(), this);
+ InitDrawModelAndDocShell(m_rDoc.GetDocShell(), this);
// copy all the default values to the SdrModel
- SfxItemPool* pSdrPool = m_pDoc->GetAttrPool().GetSecondaryPool();
+ SfxItemPool* pSdrPool = m_rDoc.GetAttrPool().GetSecondaryPool();
if( pSdrPool )
{
const sal_uInt16 aWhichRanges[] =
@@ -55,7 +53,7 @@ SwDrawModel::SwDrawModel(SwDoc *const pDoc)
0
};
- SfxItemPool& rDocPool = m_pDoc->GetAttrPool();
+ SfxItemPool& rDocPool = m_rDoc.GetAttrPool();
sal_uInt16 nEdtWhich, nSlotId;
const SfxPoolItem* pItem;
for( const sal_uInt16* pRangeArr = aWhichRanges;
@@ -74,9 +72,9 @@ SwDrawModel::SwDrawModel(SwDoc *const pDoc)
}
}
- SetForbiddenCharsTable(m_pDoc->GetDocumentSettingManager().getForbiddenCharacterTable());
+ SetForbiddenCharsTable(m_rDoc.GetDocumentSettingManager().getForbiddenCharacterTable());
// Implementation for asian compression
- SetCharCompressType( m_pDoc->GetDocumentSettingManager().getCharacterCompressionType() );
+ SetCharCompressType( m_rDoc.GetDocumentSettingManager().getCharacterCompressionType() );
}
// Destructor
@@ -104,7 +102,7 @@ SdrPage* SwDrawModel::AllocPage(bool bMasterPage)
uno::Reference<embed::XStorage> SwDrawModel::GetDocumentStorage() const
{
- return m_pDoc->GetDocStorage();
+ return m_rDoc.GetDocStorage();
}
uno::Reference< uno::XInterface > SwDrawModel::createUnoModel()
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index bd767d220019..4f1b7e3316d0 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -887,9 +887,9 @@ VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateDropDownFormFieldD
return VclPtr<AbstractDropDownFormFieldDialog_Impl>::Create(std::make_unique<sw::DropDownFormFieldDialog>(pParent, pDropDownField));
}
-VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateDateFormFieldDialog(weld::Widget *pParent, sw::mark::IDateFieldmark* pDateField, SwDoc* pDoc)
+VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateDateFormFieldDialog(weld::Widget *pParent, sw::mark::IDateFieldmark* pDateField, SwDoc& rDoc)
{
- return VclPtr<AbstractDateFormFieldDialog_Impl>::Create(std::make_unique<sw::DateFormFieldDialog>(pParent, pDateField, pDoc));
+ return VclPtr<AbstractDateFormFieldDialog_Impl>::Create(std::make_unique<sw::DateFormFieldDialog>(pParent, pDateField, rDoc));
}
VclPtr<SfxAbstractTabDialog> SwAbstractDialogFactory_Impl::CreateSwEnvDlg(weld::Window* pParent, const SfxItemSet& rSet,
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index bd285ff22fa7..4d334f9d61cf 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -674,7 +674,7 @@ public:
virtual VclPtr<AbstractDropDownFieldDialog> CreateDropDownFieldDialog(weld::Widget* pParent, SwWrtShell &rSh,
SwField* pField, bool bPrevButton, bool bNextButton) override;
virtual VclPtr<VclAbstractDialog> CreateDropDownFormFieldDialog(weld::Widget* pParent, sw::mark::IFieldmark* pDropDownField) override;
- virtual VclPtr<VclAbstractDialog> CreateDateFormFieldDialog(weld::Widget* pParent, sw::mark::IDateFieldmark* pDateField, SwDoc* pDoc) override;
+ virtual VclPtr<VclAbstractDialog> CreateDateFormFieldDialog(weld::Widget* pParent, sw::mark::IDateFieldmark* pDateField, SwDoc& rDoc) override;
virtual VclPtr<SfxAbstractTabDialog> CreateSwEnvDlg(weld::Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, bool bInsert) override;
virtual VclPtr<AbstractSwLabDlg> CreateSwLabDlg(weld::Window* pParent, const SfxItemSet& rSet,
diff --git a/sw/source/ui/fldui/DateFormFieldDialog.cxx b/sw/source/ui/fldui/DateFormFieldDialog.cxx
index 3739e17ef5b3..25197845fef2 100644
--- a/sw/source/ui/fldui/DateFormFieldDialog.cxx
+++ b/sw/source/ui/fldui/DateFormFieldDialog.cxx
@@ -17,11 +17,11 @@
namespace sw
{
DateFormFieldDialog::DateFormFieldDialog(weld::Widget* pParent,
- sw::mark::IDateFieldmark* pDateField, SwDoc* pDoc)
+ sw::mark::IDateFieldmark* pDateField, SwDoc& rDoc)
: GenericDialogController(pParent, "modules/swriter/ui/dateformfielddialog.ui",
"DateFormFieldDialog")
, m_pDateField(pDateField)
- , m_pNumberFormatter(pDoc->GetNumberFormatter())
+ , m_pNumberFormatter(rDoc.GetNumberFormatter())
, m_xFormatLB(new SwNumFormatTreeView(m_xBuilder->weld_tree_view("date_formats_treeview")))
{
m_xFormatLB->SetFormatType(SvNumFormatType::DATE);
diff --git a/sw/source/uibase/inc/DateFormFieldDialog.hxx b/sw/source/uibase/inc/DateFormFieldDialog.hxx
index fd157af9be34..f56626aac2a9 100644
--- a/sw/source/uibase/inc/DateFormFieldDialog.hxx
+++ b/sw/source/uibase/inc/DateFormFieldDialog.hxx
@@ -35,7 +35,7 @@ private:
void InitControls();
public:
- DateFormFieldDialog(weld::Widget* pParent, sw::mark::IDateFieldmark* pDateField, SwDoc* pDoc);
+ DateFormFieldDialog(weld::Widget* pParent, sw::mark::IDateFieldmark* pDateField, SwDoc& rDoc);
virtual ~DateFormFieldDialog() override;
virtual short run() override
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 09a0017e3ec3..8944d9c8e5bc 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -1430,7 +1430,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
{
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
sw::mark::DateFieldmark& rDateField = dynamic_cast<sw::mark::DateFieldmark&>(*pFieldBM);
- ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateDateFormFieldDialog(rWrtSh.GetView().GetFrameWeld(), &rDateField, GetView().GetDocShell()->GetDoc()));
+ ScopedVclPtr<VclAbstractDialog> pDlg(pFact->CreateDateFormFieldDialog(rWrtSh.GetView().GetFrameWeld(), &rDateField, *GetView().GetDocShell()->GetDoc()));
if (pDlg->Execute() == RET_OK)
{
rDateField.Invalidate();
More information about the Libreoffice-commits
mailing list