[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - sw/source

Michael Stahl mstahl at redhat.com
Wed May 4 11:47:55 UTC 2016


 sw/source/ui/fldui/flddb.cxx   |    8 ++++----
 sw/source/ui/fldui/flddb.hxx   |    2 +-
 sw/source/ui/fldui/flddinf.cxx |   12 +++++++-----
 sw/source/ui/fldui/flddinf.hxx |    2 +-
 sw/source/ui/fldui/flddok.cxx  |    8 ++++----
 sw/source/ui/fldui/flddok.hxx  |    2 +-
 sw/source/ui/fldui/fldfunc.cxx |    8 ++++----
 sw/source/ui/fldui/fldfunc.hxx |    2 +-
 sw/source/ui/fldui/fldpage.cxx |    5 +++--
 sw/source/ui/fldui/fldpage.hxx |    2 +-
 sw/source/ui/fldui/fldref.cxx  |    8 ++++----
 sw/source/ui/fldui/fldref.hxx  |    2 +-
 sw/source/ui/fldui/fldtdlg.cxx |    4 ++--
 sw/source/ui/fldui/fldvar.cxx  |    8 ++++----
 sw/source/ui/fldui/fldvar.hxx  |    2 +-
 15 files changed, 39 insertions(+), 36 deletions(-)

New commits:
commit 7c4fe800c2b4f5150ff7193a45710304bcdf25f0
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Apr 29 16:36:25 2016 +0200

    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 at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx
index 45fe095..f3ddc96 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 6fcf77e..dc63561 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 58ea657..b47988f 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 a15fcbc..f90394c 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 00d91dc..d73b257 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 d103b8f..1c3245c 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 aa8c6e9..6069b48 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 7effcb4..8615879 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 afd645a..618310d 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 68580af..fa186d4 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 66a5a42..b5d72b5 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 f06f114..7f15903 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 abb00aa..72cfc89 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 08e9733..0d4637a 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 853edf3..dbc4c39 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;


More information about the Libreoffice-commits mailing list