summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2016-04-29 16:36:25 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-05-04 11:47:33 +0000
commit7c4fe800c2b4f5150ff7193a45710304bcdf25f0 (patch)
treeea8e990ca08a24bf2cbf9d2a52b67e0c0fca43be
parentfbd90c27e5cfe112f0cf6f1e318fdc51410da237 (diff)
sw: try to survive restoring a field dialog without SfxObjectShell
The SFX will apparently restore the field dialog on startup if it was open on the last shutdown. Since i don't know how to disable this useless "feature", let's fudge things a bit so we don't crash immediately. Change-Id: I2c401440374d055774fdc8fcbd79a1262c42da0b (cherry picked from commit bf47fef3a87d8546f18a36ade4e85f7c6ecf993b) Reviewed-on: https://gerrit.libreoffice.org/24614 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sw/source/ui/fldui/flddb.cxx8
-rw-r--r--sw/source/ui/fldui/flddb.hxx2
-rw-r--r--sw/source/ui/fldui/flddinf.cxx12
-rw-r--r--sw/source/ui/fldui/flddinf.hxx2
-rw-r--r--sw/source/ui/fldui/flddok.cxx8
-rw-r--r--sw/source/ui/fldui/flddok.hxx2
-rw-r--r--sw/source/ui/fldui/fldfunc.cxx8
-rw-r--r--sw/source/ui/fldui/fldfunc.hxx2
-rw-r--r--sw/source/ui/fldui/fldpage.cxx5
-rw-r--r--sw/source/ui/fldui/fldpage.hxx2
-rw-r--r--sw/source/ui/fldui/fldref.cxx8
-rw-r--r--sw/source/ui/fldui/fldref.hxx2
-rw-r--r--sw/source/ui/fldui/fldtdlg.cxx4
-rw-r--r--sw/source/ui/fldui/fldvar.cxx8
-rw-r--r--sw/source/ui/fldui/fldvar.hxx2
15 files changed, 39 insertions, 36 deletions
diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx
index 45fe095adea5..f3ddc962ecbf 100644
--- a/sw/source/ui/fldui/flddb.cxx
+++ b/sw/source/ui/fldui/flddb.cxx
@@ -33,9 +33,9 @@
#define USER_DATA_VERSION_1 "1"
#define USER_DATA_VERSION USER_DATA_VERSION_1
-SwFieldDBPage::SwFieldDBPage(vcl::Window* pParent, const SfxItemSet& rCoreSet)
+SwFieldDBPage::SwFieldDBPage(vcl::Window* pParent, const SfxItemSet *const pCoreSet)
: SwFieldPage(pParent, "FieldDbPage",
- "modules/swriter/ui/flddbpage.ui", rCoreSet)
+ "modules/swriter/ui/flddbpage.ui", pCoreSet)
, m_nOldFormat(0)
, m_nOldSubType(0)
{
@@ -265,9 +265,9 @@ bool SwFieldDBPage::FillItemSet(SfxItemSet* )
}
VclPtr<SfxTabPage> SwFieldDBPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+ const SfxItemSet *const pAttrSet )
{
- return VclPtr<SwFieldDBPage>::Create( pParent, *rAttrSet );
+ return VclPtr<SwFieldDBPage>::Create( pParent, pAttrSet );
}
sal_uInt16 SwFieldDBPage::GetGroup()
diff --git a/sw/source/ui/fldui/flddb.hxx b/sw/source/ui/fldui/flddb.hxx
index 6fcf77ef559e..dc635614b022 100644
--- a/sw/source/ui/fldui/flddb.hxx
+++ b/sw/source/ui/fldui/flddb.hxx
@@ -69,7 +69,7 @@ protected:
virtual sal_uInt16 GetGroup() override;
public:
- SwFieldDBPage(vcl::Window* pParent, const SfxItemSet& rSet);
+ SwFieldDBPage(vcl::Window* pParent, const SfxItemSet* rSet);
virtual ~SwFieldDBPage();
virtual void dispose() override;
diff --git a/sw/source/ui/fldui/flddinf.cxx b/sw/source/ui/fldui/flddinf.cxx
index 58ea65708db5..b47988fc6a1f 100644
--- a/sw/source/ui/fldui/flddinf.cxx
+++ b/sw/source/ui/fldui/flddinf.cxx
@@ -47,9 +47,9 @@
using namespace nsSwDocInfoSubType;
using namespace com::sun::star;
-SwFieldDokInfPage::SwFieldDokInfPage(vcl::Window* pParent, const SfxItemSet& rCoreSet)
+SwFieldDokInfPage::SwFieldDokInfPage(vcl::Window* pParent, const SfxItemSet *const pCoreSet)
: SwFieldPage(pParent, "FieldDocInfoPage",
- "modules/swriter/ui/flddocinfopage.ui", rCoreSet)
+ "modules/swriter/ui/flddocinfopage.ui", pCoreSet)
, pSelEntry(nullptr)
, nOldSel(0)
, nOldFormat(0)
@@ -82,7 +82,9 @@ SwFieldDokInfPage::SwFieldDokInfPage(vcl::Window* pParent, const SfxItemSet& rCo
//enable 'active' language selection
m_pFormatLB->SetShowLanguageControl(true);
- const SfxUnoAnyItem* pItem = rCoreSet.GetItem<SfxUnoAnyItem>(SID_DOCINFO, false);
+ const SfxUnoAnyItem* pItem = (pCoreSet)
+ ? pCoreSet->GetItem<SfxUnoAnyItem>(SID_DOCINFO, false)
+ : nullptr;
if ( pItem )
pItem->GetValue() >>= xCustomPropertySet;
}
@@ -459,9 +461,9 @@ bool SwFieldDokInfPage::FillItemSet(SfxItemSet* )
}
VclPtr<SfxTabPage> SwFieldDokInfPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+ const SfxItemSet *const pAttrSet)
{
- return VclPtr<SwFieldDokInfPage>::Create( pParent, *rAttrSet );
+ return VclPtr<SwFieldDokInfPage>::Create( pParent, pAttrSet );
}
sal_uInt16 SwFieldDokInfPage::GetGroup()
diff --git a/sw/source/ui/fldui/flddinf.hxx b/sw/source/ui/fldui/flddinf.hxx
index a15fcbcdbcb2..f90394cfe47a 100644
--- a/sw/source/ui/fldui/flddinf.hxx
+++ b/sw/source/ui/fldui/flddinf.hxx
@@ -59,7 +59,7 @@ protected:
virtual sal_uInt16 GetGroup() override;
public:
- SwFieldDokInfPage(vcl::Window* pWindow, const SfxItemSet& rSet);
+ SwFieldDokInfPage(vcl::Window* pWindow, const SfxItemSet* pSet);
virtual ~SwFieldDokInfPage();
virtual void dispose() override;
diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx
index 00d91dc60038..d73b2570d1d0 100644
--- a/sw/source/ui/fldui/flddok.cxx
+++ b/sw/source/ui/fldui/flddok.cxx
@@ -34,9 +34,9 @@
#define USER_DATA_VERSION_1 "1"
#define USER_DATA_VERSION USER_DATA_VERSION_1
-SwFieldDokPage::SwFieldDokPage(vcl::Window* pParent, const SfxItemSet& rCoreSet )
+SwFieldDokPage::SwFieldDokPage(vcl::Window* pParent, const SfxItemSet *const pCoreSet)
: SwFieldPage(pParent, "FieldDocumentPage",
- "modules/swriter/ui/flddocumentpage.ui", rCoreSet)
+ "modules/swriter/ui/flddocumentpage.ui", pCoreSet)
, nOldSel(0)
, nOldFormat(0)
{
@@ -648,9 +648,9 @@ bool SwFieldDokPage::FillItemSet(SfxItemSet* )
}
VclPtr<SfxTabPage> SwFieldDokPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+ const SfxItemSet *const pAttrSet)
{
- return VclPtr<SwFieldDokPage>::Create( pParent, *rAttrSet );
+ return VclPtr<SwFieldDokPage>::Create( pParent, pAttrSet );
}
sal_uInt16 SwFieldDokPage::GetGroup()
diff --git a/sw/source/ui/fldui/flddok.hxx b/sw/source/ui/fldui/flddok.hxx
index d103b8f118f1..1c3245c4b6e6 100644
--- a/sw/source/ui/fldui/flddok.hxx
+++ b/sw/source/ui/fldui/flddok.hxx
@@ -61,7 +61,7 @@ protected:
virtual sal_uInt16 GetGroup() override;
public:
- SwFieldDokPage(vcl::Window* pWindow, const SfxItemSet& rSet);
+ SwFieldDokPage(vcl::Window* pWindow, const SfxItemSet * pSet);
virtual ~SwFieldDokPage();
virtual void dispose() override;
diff --git a/sw/source/ui/fldui/fldfunc.cxx b/sw/source/ui/fldui/fldfunc.cxx
index aa8c6e9523b8..6069b4837d2c 100644
--- a/sw/source/ui/fldui/fldfunc.cxx
+++ b/sw/source/ui/fldui/fldfunc.cxx
@@ -37,9 +37,9 @@
using namespace ::com::sun::star;
-SwFieldFuncPage::SwFieldFuncPage(vcl::Window* pParent, const SfxItemSet& rCoreSet)
+SwFieldFuncPage::SwFieldFuncPage(vcl::Window* pParent, const SfxItemSet *const pCoreSet)
: SwFieldPage(pParent, "FieldFuncPage",
- "modules/swriter/ui/fldfuncpage.ui", rCoreSet)
+ "modules/swriter/ui/fldfuncpage.ui", pCoreSet)
, nOldFormat(0)
, bDropDownLBChanged(false)
{
@@ -630,9 +630,9 @@ OUString SwFieldFuncPage::TurnMacroString(const OUString &rMacro)
}
VclPtr<SfxTabPage> SwFieldFuncPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+ const SfxItemSet *const pAttrSet)
{
- return VclPtr<SwFieldFuncPage>::Create( pParent, *rAttrSet );
+ return VclPtr<SwFieldFuncPage>::Create( pParent, pAttrSet );
}
sal_uInt16 SwFieldFuncPage::GetGroup()
diff --git a/sw/source/ui/fldui/fldfunc.hxx b/sw/source/ui/fldui/fldfunc.hxx
index 7effcb4d0929..8615879317db 100644
--- a/sw/source/ui/fldui/fldfunc.hxx
+++ b/sw/source/ui/fldui/fldfunc.hxx
@@ -86,7 +86,7 @@ protected:
virtual sal_uInt16 GetGroup() override;
public:
- SwFieldFuncPage(vcl::Window* pParent, const SfxItemSet& rSet);
+ SwFieldFuncPage(vcl::Window* pParent, const SfxItemSet* pSet);
virtual ~SwFieldFuncPage();
virtual void dispose() override;
diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx
index afd645ac8bcc..618310d810f3 100644
--- a/sw/source/ui/fldui/fldpage.cxx
+++ b/sw/source/ui/fldui/fldpage.cxx
@@ -41,9 +41,10 @@
using namespace ::com::sun::star;
+// note: pAttrSet may be null if the dialog is restored on startup
SwFieldPage::SwFieldPage(vcl::Window *pParent, const OString& rID,
- const OUString& rUIXMLDescription, const SfxItemSet &rAttrSet)
- : SfxTabPage(pParent, rID, rUIXMLDescription, &rAttrSet)
+ const OUString& rUIXMLDescription, const SfxItemSet *const pAttrSet)
+ : SfxTabPage(pParent, rID, rUIXMLDescription, pAttrSet)
, m_pCurField(nullptr)
, m_pWrtShell(nullptr)
, m_nTypeSel(LISTBOX_ENTRY_NOTFOUND)
diff --git a/sw/source/ui/fldui/fldpage.hxx b/sw/source/ui/fldui/fldpage.hxx
index 68580af6d0fc..fa186d4ab582 100644
--- a/sw/source/ui/fldui/fldpage.hxx
+++ b/sw/source/ui/fldui/fldpage.hxx
@@ -81,7 +81,7 @@ protected:
public:
SwFieldPage(vcl::Window *pParent, const OString& rID,
- const OUString& rUIXMLDescription, const SfxItemSet &rAttrSet);
+ const OUString& rUIXMLDescription, const SfxItemSet *pAttrSet);
virtual ~SwFieldPage();
diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index 66a5a42d43bf..b5d72b56e31e 100644
--- a/sw/source/ui/fldui/fldref.cxx
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -47,9 +47,9 @@ static sal_uInt16 nFieldDlgFormatSel = 0;
#define USER_DATA_VERSION_1 "1"
#define USER_DATA_VERSION USER_DATA_VERSION_1
-SwFieldRefPage::SwFieldRefPage(vcl::Window* pParent, const SfxItemSet& rCoreSet )
+SwFieldRefPage::SwFieldRefPage(vcl::Window* pParent, const SfxItemSet *const pCoreSet )
: SwFieldPage(pParent, "FieldRefPage",
- "modules/swriter/ui/fldrefpage.ui", rCoreSet)
+ "modules/swriter/ui/fldrefpage.ui", pCoreSet)
, maOutlineNodes()
, maNumItems()
, mpSavedSelectedTextNode(nullptr)
@@ -958,9 +958,9 @@ bool SwFieldRefPage::FillItemSet(SfxItemSet* )
}
VclPtr<SfxTabPage> SwFieldRefPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+ const SfxItemSet *const pAttrSet)
{
- return VclPtr<SwFieldRefPage>::Create( pParent, *rAttrSet );
+ return VclPtr<SwFieldRefPage>::Create( pParent, pAttrSet );
}
sal_uInt16 SwFieldRefPage::GetGroup()
diff --git a/sw/source/ui/fldui/fldref.hxx b/sw/source/ui/fldui/fldref.hxx
index f06f114d6585..7f159034f198 100644
--- a/sw/source/ui/fldui/fldref.hxx
+++ b/sw/source/ui/fldui/fldref.hxx
@@ -76,7 +76,7 @@ protected:
virtual sal_uInt16 GetGroup() override;
public:
- SwFieldRefPage(vcl::Window* pParent, const SfxItemSet& rSet);
+ SwFieldRefPage(vcl::Window* pParent, const SfxItemSet* pSet);
virtual ~SwFieldRefPage();
virtual void dispose() override;
diff --git a/sw/source/ui/fldui/fldtdlg.cxx b/sw/source/ui/fldui/fldtdlg.cxx
index abb00aaefccb..72cfc891e05b 100644
--- a/sw/source/ui/fldui/fldtdlg.cxx
+++ b/sw/source/ui/fldui/fldtdlg.cxx
@@ -159,9 +159,9 @@ void SwFieldDlg::Initialize(SfxChildWinInfo *pInfo)
SfxItemSet* SwFieldDlg::CreateInputItemSet( sal_uInt16 nID )
{
- if ( nID == m_nDokInf )
+ SwDocShell *const pDocSh(static_cast<SwDocShell*>(SfxObjectShell::Current()));
+ if (nID == m_nDokInf && pDocSh) // might not have a shell if the dialog is restored on startup
{
- SwDocShell* pDocSh = static_cast<SwDocShell*>(SfxObjectShell::Current());
SfxItemSet* pISet = new SfxItemSet( pDocSh->GetPool(), SID_DOCINFO, SID_DOCINFO );
using namespace ::com::sun::star;
uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx
index 08e97332bfa2..0d4637a11eee 100644
--- a/sw/source/ui/fldui/fldvar.cxx
+++ b/sw/source/ui/fldui/fldvar.cxx
@@ -39,9 +39,9 @@
#define USER_DATA_VERSION_1 "1"
#define USER_DATA_VERSION USER_DATA_VERSION_1
-SwFieldVarPage::SwFieldVarPage(vcl::Window* pParent, const SfxItemSet& rCoreSet )
+SwFieldVarPage::SwFieldVarPage(vcl::Window* pParent, const SfxItemSet *const pCoreSet )
: SwFieldPage(pParent, "FieldVarPage",
- "modules/swriter/ui/fldvarpage.ui", rCoreSet)
+ "modules/swriter/ui/fldvarpage.ui", pCoreSet)
, nOldFormat(0)
, bInit(true)
{
@@ -1242,9 +1242,9 @@ bool SwFieldVarPage::FillItemSet(SfxItemSet* )
}
VclPtr<SfxTabPage> SwFieldVarPage::Create( vcl::Window* pParent,
- const SfxItemSet* rAttrSet )
+ const SfxItemSet *const pAttrSet)
{
- return VclPtr<SwFieldVarPage>::Create( pParent, *rAttrSet );
+ return VclPtr<SwFieldVarPage>::Create( pParent, pAttrSet );
}
sal_uInt16 SwFieldVarPage::GetGroup()
diff --git a/sw/source/ui/fldui/fldvar.hxx b/sw/source/ui/fldui/fldvar.hxx
index 853edf348e74..dbc4c3994169 100644
--- a/sw/source/ui/fldui/fldvar.hxx
+++ b/sw/source/ui/fldui/fldvar.hxx
@@ -91,7 +91,7 @@ protected:
virtual sal_uInt16 GetGroup() override;
public:
- SwFieldVarPage(vcl::Window* pParent, const SfxItemSet& rSet);
+ SwFieldVarPage(vcl::Window* pParent, const SfxItemSet* pSet);
virtual ~SwFieldVarPage();
virtual void dispose() override;