diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-05-29 10:02:58 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-05-29 14:56:04 +0200 |
commit | aa687b22991e6c674b1d8653d52fbe9a50080174 (patch) | |
tree | 9e048b07ba05362a99ea79cc79065afc4f45c734 | |
parent | b7b78dfc0719c3aa0e250b2992d3b04e135a26be (diff) |
weld SfxDocumentInfoDialog
Change-Id: I79d5d8973a19c0e639081ec61ac596620518d0b5
Reviewed-on: https://gerrit.libreoffice.org/73145
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/sfx2/dinfdlg.hxx | 8 | ||||
-rw-r--r-- | include/sfx2/objsh.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/inc/docsh.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshel4.cxx | 11 | ||||
-rw-r--r-- | sd/source/ui/inc/DrawDocShell.hxx | 3 | ||||
-rw-r--r-- | sfx2/source/dialog/dinfdlg.cxx | 39 | ||||
-rw-r--r-- | sfx2/source/doc/objcont.cxx | 10 | ||||
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 12 | ||||
-rw-r--r-- | sfx2/uiconfig/ui/custominfopage.ui | 2 | ||||
-rw-r--r-- | sfx2/uiconfig/ui/documentpropertiesdialog.ui | 153 | ||||
-rw-r--r-- | sw/inc/docsh.hxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/app/docsh2.cxx | 12 |
13 files changed, 192 insertions, 77 deletions
diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx index e8408e794e09..744be743c7d5 100644 --- a/include/sfx2/dinfdlg.hxx +++ b/include/sfx2/dinfdlg.hxx @@ -242,15 +242,13 @@ public: // class SfxDocumentInfoDialog ------------------------------------------- -class SFX2_DLLPUBLIC SfxDocumentInfoDialog : public SfxTabDialog +class SFX2_DLLPUBLIC SfxDocumentInfoDialog : public SfxTabDialogController { -private: - sal_uInt16 m_nDocInfoId; protected: - virtual void PageCreated( sal_uInt16 nId, SfxTabPage& rPage ) override; + virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override; public: - SfxDocumentInfoDialog( vcl::Window* pParent, const SfxItemSet& ); + SfxDocumentInfoDialog(weld::Window* pParent, const SfxItemSet&); void AddFontTabPage(); }; diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index d16eb2e1c95b..eaa93afd72da 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -358,7 +358,7 @@ public: void SignScriptingContent(weld::Window* pDialogParent); DECL_LINK(SignDocumentHandler, Button*, void); - virtual VclPtr<SfxDocumentInfoDialog> CreateDocumentInfoDialog( const SfxItemSet& ); + virtual std::unique_ptr<SfxDocumentInfoDialog> CreateDocumentInfoDialog(weld::Window* pParent, const SfxItemSet& rItemSet); ErrCode CallBasic( const OUString& rMacro, const OUString& rBasicName, SbxArray* pArgs, SbxValue* pRet = nullptr ); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index ba0b52a120b7..06d96c331c30 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -2912,9 +2912,9 @@ void ScDocShell::GetDocStat( ScDocStat& rDocStat ) static_cast<sal_uInt16>(ScPrintFunc( this, pPrinter, i ).GetTotalPages()) ); } -VclPtr<SfxDocumentInfoDialog> ScDocShell::CreateDocumentInfoDialog( const SfxItemSet &rSet ) +std::unique_ptr<SfxDocumentInfoDialog> ScDocShell::CreateDocumentInfoDialog(weld::Window* pParent, const SfxItemSet &rSet) { - VclPtr<SfxDocumentInfoDialog> pDlg = VclPtr<SfxDocumentInfoDialog>::Create( nullptr, rSet ); + std::unique_ptr<SfxDocumentInfoDialog> xDlg = std::make_unique<SfxDocumentInfoDialog>(pParent, rSet); ScDocShell* pDocSh = dynamic_cast< ScDocShell *>( SfxObjectShell::Current() ); // Only for statistics, if this Doc is shown; not from the Doc Manager @@ -2923,12 +2923,10 @@ VclPtr<SfxDocumentInfoDialog> ScDocShell::CreateDocumentInfoDialog( const SfxIte ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); ::CreateTabPage ScDocStatPageCreate = pFact->GetTabPageCreatorFunc(SID_SC_TP_STAT); OSL_ENSURE(ScDocStatPageCreate, "Tabpage create fail!"); - pDlg->AddFontTabPage(); - pDlg->AddTabPage( 42, - ScResId( STR_DOC_STAT ), - ScDocStatPageCreate); + xDlg->AddFontTabPage(); + xDlg->AddTabPage("calcstats", ScResId(STR_DOC_STAT), ScDocStatPageCreate); } - return pDlg; + return xDlg; } vcl::Window* ScDocShell::GetActiveDialogParent() diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 2d8525fd7e41..1a339d3d9552 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -213,7 +213,7 @@ public: void SetVisAreaOrSize( const tools::Rectangle& rVisArea ); - virtual VclPtr<SfxDocumentInfoDialog> CreateDocumentInfoDialog( const SfxItemSet &rSet ) override; + virtual std::unique_ptr<SfxDocumentInfoDialog> CreateDocumentInfoDialog(weld::Window* pParent, const SfxItemSet &rSet) override; void GetDocStat( ScDocStat& rDocStat ); diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index d86d94985adb..d9b9ff6e8e42 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -956,16 +956,15 @@ void DrawDocShell::OpenBookmark( const OUString& rBookmarkURL ) ( mpViewShell ? mpViewShell->GetViewFrame() : SfxViewFrame::Current() )->GetBindings().Execute( SID_OPENHYPERLINK, ppArgs ); } -VclPtr<SfxDocumentInfoDialog> DrawDocShell::CreateDocumentInfoDialog( const SfxItemSet &rSet ) +std::unique_ptr<SfxDocumentInfoDialog> DrawDocShell::CreateDocumentInfoDialog(weld::Window* pParent, const SfxItemSet &rSet) { - VclPtr<SfxDocumentInfoDialog> pDlg = VclPtr<SfxDocumentInfoDialog>::Create( nullptr, rSet ); - DrawDocShell* pDocSh = dynamic_cast< DrawDocShell *>( SfxObjectShell::Current() ); - + std::unique_ptr<SfxDocumentInfoDialog> xDlg = std::make_unique<SfxDocumentInfoDialog>(pParent, rSet); + DrawDocShell* pDocSh = dynamic_cast<DrawDocShell*>(SfxObjectShell::Current()); if( pDocSh == this ) { - pDlg->AddFontTabPage(); + xDlg->AddFontTabPage(); } - return pDlg; + return xDlg; } void DrawDocShell::setEditMode(DrawViewShell* pDrawViewShell, bool isMasterPage) diff --git a/sd/source/ui/inc/DrawDocShell.hxx b/sd/source/ui/inc/DrawDocShell.hxx index 88435a6e4d57..bc064d07dc45 100644 --- a/sd/source/ui/inc/DrawDocShell.hxx +++ b/sd/source/ui/inc/DrawDocShell.hxx @@ -98,7 +98,8 @@ public: virtual SfxStyleSheetBasePool* GetStyleSheetPool() override; virtual void FillClass(SvGlobalName* pClassName, SotClipboardFormatId* pFormat, OUString* pAppName, OUString* pFullTypeName, OUString* pShortTypeName, sal_Int32 nFileFormat, bool bTemplate = false ) const override; virtual void SetModified( bool = true ) override; - virtual VclPtr<SfxDocumentInfoDialog> CreateDocumentInfoDialog( const SfxItemSet &rSet ) override; + virtual std::unique_ptr<SfxDocumentInfoDialog> CreateDocumentInfoDialog(weld::Window* pParent, + const SfxItemSet &rSet) override; using SfxObjectShell::GetVisArea; using SfxShell::GetViewShell; diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 2650765ce253..02afc0af8452 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -87,8 +87,6 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::ui::dialogs; using namespace ::com::sun::star::uno; -const sal_uInt16 FONT_PAGE_ID = 99; - struct CustomProperty { OUString m_sName; @@ -1089,11 +1087,9 @@ void SfxDocumentPage::Reset( const SfxItemSet* rSet ) m_xUseThumbnailSaveCB->save_state(); } -SfxDocumentInfoDialog::SfxDocumentInfoDialog( vcl::Window* pParent, - const SfxItemSet& rItemSet ) - : SfxTabDialog(pParent, "DocumentPropertiesDialog", - "sfx/ui/documentpropertiesdialog.ui", &rItemSet) - , m_nDocInfoId(0) +SfxDocumentInfoDialog::SfxDocumentInfoDialog(weld::Window* pParent, const SfxItemSet& rItemSet) + : SfxTabDialogController(pParent, "sfx/ui/documentpropertiesdialog.ui", + "DocumentPropertiesDialog", &rItemSet) { const SfxDocumentInfoItem& rInfoItem = rItemSet.Get( SID_DOCINFO ); @@ -1104,7 +1100,7 @@ SfxDocumentInfoDialog::SfxDocumentInfoDialog( vcl::Window* pParent, // Determine the Titles const SfxPoolItem* pItem = nullptr; - OUString aTitle( GetText() ); + OUString aTitle(m_xDialog->get_title()); if ( SfxItemState::SET != rItemSet.GetItemState( SID_EXPLORER_PROPS_START, false, &pItem ) ) { @@ -1131,27 +1127,26 @@ SfxDocumentInfoDialog::SfxDocumentInfoDialog( vcl::Window* pParent, "SfxDocumentInfoDialog:<SfxStringItem> expected" ); aTitle = aTitle.replaceFirst("%1", static_cast<const SfxStringItem*>(pItem)->GetValue()); } - SetText( aTitle ); + m_xDialog->set_title(aTitle); // Property Pages - m_nDocInfoId = AddTabPage("general", SfxDocumentPage::Create); - AddTabPage("description", SfxDocumentDescPage::Create); - AddTabPage("customprops", SfxCustomPropertiesPage::Create); - AddTabPage("cmisprops", SfxCmisPropertiesPage::Create); - AddTabPage("security", SfxSecurityPage::Create); + AddTabPage("general", SfxDocumentPage::Create, nullptr); + AddTabPage("description", SfxDocumentDescPage::Create, nullptr); + AddTabPage("customprops", SfxCustomPropertiesPage::Create, nullptr); + AddTabPage("cmisprops", SfxCmisPropertiesPage::Create, nullptr); + AddTabPage("security", SfxSecurityPage::Create, nullptr); } -void SfxDocumentInfoDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) +void SfxDocumentInfoDialog::PageCreated(const OString& rId, SfxTabPage &rPage) { - if ( m_nDocInfoId == nId ) + if (rId == "general") static_cast<SfxDocumentPage&>(rPage).EnableUseUserData(); } void SfxDocumentInfoDialog::AddFontTabPage() { - AddTabPage(FONT_PAGE_ID, SfxResId(STR_FONT_TABPAGE), SfxDocumentFontsPage::Create); - SetPageName(FONT_PAGE_ID , "font"); + AddTabPage("font", SfxResId(STR_FONT_TABPAGE), SfxDocumentFontsPage::Create); } // class CustomPropertiesYesNoButton ------------------------------------- @@ -1263,6 +1258,8 @@ namespace { for (size_t i = 0; i < SAL_N_ELEMENTS(SFX_CB_PROPERTY_STRINGARRAY); ++i) rNameBox.append_text(SfxResId(SFX_CB_PROPERTY_STRINGARRAY[i])); + Size aSize(rNameBox.get_preferred_size()); + rNameBox.set_size_request(aSize.Width(), aSize.Height()); } void fillTypeBox(weld::ComboBox& rTypeBox) @@ -1273,6 +1270,8 @@ namespace rTypeBox.append(sId, SfxResId(SFX_LB_PROPERTY_STRINGARRAY[i].first)); } rTypeBox.set_active(0); + Size aSize(rTypeBox.get_preferred_size()); + rTypeBox.set_size_request(aSize.Width(), aSize.Height()); } } @@ -1781,7 +1780,7 @@ void CustomPropertiesControl::Init(weld::Builder& rBuilder) std::unique_ptr<CustomPropertyLine> xNewLine(new CustomPropertyLine(m_xPropertiesWin.get(), m_xBody.get())); Size aLineSize(xNewLine->m_xLine->get_preferred_size()); m_xPropertiesWin->SetLineHeight(aLineSize.Height() + 6); - m_xBody->set_size_request(aLineSize.Width(), -1); + m_xBody->set_size_request(aLineSize.Width() + 6, -1); auto nHeight = aLineSize.Height() * 8; m_xVertScroll->set_size_request(-1, nHeight + 6); @@ -1808,6 +1807,8 @@ void CustomPropertiesControl::Init(weld::Builder& rBuilder) IMPL_LINK(CustomPropertiesControl, ResizeHdl, const Size&, rSize, void) { int nHeight = rSize.Height() - 6; + if (nHeight == m_xPropertiesWin->GetHeight()) + return; m_xPropertiesWin->SetHeight(nHeight); sal_Int32 nScrollOffset = m_xPropertiesWin->GetLineHeight(); sal_Int32 nVisibleEntries = nHeight / nScrollOffset; diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 709d03d4ae8e..938a1c0771c7 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -282,16 +282,12 @@ void SfxObjectShell::UpdateTime_Impl( } } - -VclPtr<SfxDocumentInfoDialog> SfxObjectShell::CreateDocumentInfoDialog -( - const SfxItemSet& rSet -) +std::unique_ptr<SfxDocumentInfoDialog> SfxObjectShell::CreateDocumentInfoDialog(weld::Window* pParent, + const SfxItemSet& rSet) { - return VclPtr<SfxDocumentInfoDialog>::Create(nullptr, rSet); + return std::make_unique<SfxDocumentInfoDialog>(pParent, rSet); } - std::set<Color> SfxObjectShell::GetDocColors() { std::set<Color> empty; diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 2063f40aa090..8df1c3e0fecf 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -500,16 +500,13 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // creating dialog is done via virtual method; application will // add its own statistics page - VclAbstractDialog::AsyncContext aCtx; std::shared_ptr<SfxRequest> pReq = std::make_shared<SfxRequest>(rReq); - VclPtr<SfxDocumentInfoDialog> pDlg(CreateDocumentInfoDialog(aSet)); - - aCtx.mxOwner = pDlg; - aCtx.maEndDialogFn = [this, pDlg, xCmisDoc, pReq](sal_Int32 nResult) + std::shared_ptr<SfxDocumentInfoDialog> xDlg(CreateDocumentInfoDialog(rReq.GetFrameWeld(), aSet)); + SfxTabDialogController::runAsync(xDlg, [this, xDlg, xCmisDoc, pReq](sal_Int32 nResult) { if (RET_OK == nResult) { - const SfxDocumentInfoItem* pDocInfoItem = SfxItemSet::GetItem<SfxDocumentInfoItem>(pDlg->GetOutputItemSet(), SID_DOCINFO, false); + const SfxDocumentInfoItem* pDocInfoItem = SfxItemSet::GetItem<SfxDocumentInfoItem>(xDlg->GetOutputItemSet(), SID_DOCINFO, false); if ( pDocInfoItem ) { // user has done some changes to DocumentInfo @@ -537,9 +534,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) else // nothing done; no recording pReq->Ignore(); - }; + }); - pDlg->StartExecuteAsync(aCtx); rReq.Ignore(); } diff --git a/sfx2/uiconfig/ui/custominfopage.ui b/sfx2/uiconfig/ui/custominfopage.ui index 304b33a216f8..86e520a12095 100644 --- a/sfx2/uiconfig/ui/custominfopage.ui +++ b/sfx2/uiconfig/ui/custominfopage.ui @@ -96,6 +96,8 @@ <object class="GtkBox" id="properties"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="vexpand">False</property> <property name="border_width">3</property> <property name="orientation">vertical</property> <property name="spacing">6</property> diff --git a/sfx2/uiconfig/ui/documentpropertiesdialog.ui b/sfx2/uiconfig/ui/documentpropertiesdialog.ui index 7ddd6010714a..ca692270b94b 100644 --- a/sfx2/uiconfig/ui/documentpropertiesdialog.ui +++ b/sfx2/uiconfig/ui/documentpropertiesdialog.ui @@ -1,12 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sfx"> <requires lib="gtk+" version="3.18"/> <object class="GtkDialog" id="DocumentPropertiesDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="documentpropertiesdialog|DocumentPropertiesDialog">Properties of “%1”</property> + <property name="modal">True</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> + <child> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="can_focus">False</property> @@ -17,12 +23,10 @@ <property name="can_focus">False</property> <property name="layout_style">end</property> <child> - <object class="GtkButton" id="ok"> - <property name="label">gtk-ok</property> + <object class="GtkButton" id="reset"> + <property name="label">gtk-revert-to-saved</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> @@ -33,10 +37,12 @@ </packing> </child> <child> - <object class="GtkButton" id="cancel"> - <property name="label">gtk-cancel</property> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> @@ -47,8 +53,8 @@ </packing> </child> <child> - <object class="GtkButton" id="help"> - <property name="label">gtk-help</property> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -58,12 +64,11 @@ <property name="expand">False</property> <property name="fill">True</property> <property name="position">2</property> - <property name="secondary">True</property> </packing> </child> <child> - <object class="GtkButton" id="reset"> - <property name="label">gtk-revert-to-saved</property> + <object class="GtkButton" id="help"> + <property name="label">gtk-help</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -73,6 +78,7 @@ <property name="expand">False</property> <property name="fill">True</property> <property name="position">3</property> + <property name="secondary">True</property> </packing> </child> </object> @@ -87,7 +93,6 @@ <object class="GtkNotebook" id="tabcontrol"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="scrollable">True</property> <property name="enable_popup">True</property> <child> <object class="GtkGrid"> @@ -96,6 +101,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> </child> <child type="tab"> @@ -115,6 +144,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="position">1</property> @@ -138,6 +191,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="position">2</property> @@ -161,6 +238,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="position">3</property> @@ -184,6 +285,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="position">4</property> @@ -210,10 +335,10 @@ </object> </child> <action-widgets> + <action-widget response="101">reset</action-widget> <action-widget response="-5">ok</action-widget> <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> - <action-widget response="101">reset</action-widget> </action-widgets> </object> </interface> diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index ea856f80d9c4..291b20455c17 100644 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -117,7 +117,8 @@ class SW_DLLPUBLIC SwDocShell override; /// Make DocInfo known to the Doc. - SAL_DLLPRIVATE virtual VclPtr<SfxDocumentInfoDialog> CreateDocumentInfoDialog(const SfxItemSet &) override; + SAL_DLLPRIVATE virtual std::unique_ptr<SfxDocumentInfoDialog> CreateDocumentInfoDialog(weld::Window* pParent, + const SfxItemSet &rSet) override; /// OLE-stuff SAL_DLLPRIVATE virtual void Draw( OutputDevice*, const JobSetup&, sal_uInt16 nAspect) override; diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 2139a02a5240..771972fb63d5 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -147,11 +147,9 @@ using namespace ::com::sun::star; using namespace ::sfx2; // create DocInfo (virtual) -VclPtr<SfxDocumentInfoDialog> SwDocShell::CreateDocumentInfoDialog(const SfxItemSet &rSet) +std::unique_ptr<SfxDocumentInfoDialog> SwDocShell::CreateDocumentInfoDialog(weld::Window* pParent, const SfxItemSet &rSet) { - SfxViewShell* pViewShell = GetView() ? GetView() : SfxViewShell::Current(); - vcl::Window* pWindow = pViewShell ? &pViewShell->GetViewFrame()->GetWindow() : nullptr; - VclPtr<SfxDocumentInfoDialog> pDlg = VclPtr<SfxDocumentInfoDialog>::Create(pWindow, rSet); + std::unique_ptr<SfxDocumentInfoDialog> xDlg = std::make_unique<SfxDocumentInfoDialog>(pParent, rSet); //only with statistics, when this document is being shown, not //from within the Doc-Manager SwDocShell* pDocSh = static_cast<SwDocShell*>( SfxObjectShell::Current()); @@ -162,11 +160,11 @@ VclPtr<SfxDocumentInfoDialog> SwDocShell::CreateDocumentInfoDialog(const SfxItem if ( pVSh && dynamic_cast< const SwSrcView *>( pVSh ) == nullptr ) { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - pDlg->AddFontTabPage(); - pDlg->AddTabPage(RID_SW_TP_DOC_STAT, SwResId(STR_DOC_STAT), pFact->GetTabPageCreatorFunc(RID_SW_TP_DOC_STAT)); + xDlg->AddFontTabPage(); + xDlg->AddTabPage("writerstats", SwResId(STR_DOC_STAT), pFact->GetTabPageCreatorFunc(RID_SW_TP_DOC_STAT)); } } - return pDlg; + return xDlg; } void SwDocShell::ToggleLayoutMode(SwView* pView) |