include/sfx2/dinfdlg.hxx | 80 +++---- include/sfx2/objsh.hxx | 2 include/svtools/ctrlbox.hxx | 1 sc/source/ui/docshell/docsh.cxx | 12 - sc/source/ui/inc/docsh.hxx | 2 sd/source/ui/docshell/docshel4.cxx | 11 - sd/source/ui/inc/DrawDocShell.hxx | 3 sfx2/source/dialog/dinfdlg.cxx | 277 ++++++++++----------------- sfx2/source/doc/objcont.cxx | 10 sfx2/source/doc/objserv.cxx | 12 - sfx2/uiconfig/ui/cmisinfopage.ui | 2 sfx2/uiconfig/ui/cmisline.ui | 40 +-- sfx2/uiconfig/ui/custominfopage.ui | 2 sfx2/uiconfig/ui/documentpropertiesdialog.ui | 153 +++++++++++++- sfx2/uiconfig/ui/linefragment.ui | 1 solenv/sanitizers/ui/sfx.suppr | 4 sw/inc/docsh.hxx | 3 sw/source/core/bastyp/index.cxx | 2 sw/source/uibase/app/docsh2.cxx | 12 - 19 files changed, 335 insertions(+), 294 deletions(-)
New commits: commit aa687b22991e6c674b1d8653d52fbe9a50080174 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed May 29 10:02:58 2019 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed May 29 14:56:04 2019 +0200 weld SfxDocumentInfoDialog Change-Id: I79d5d8973a19c0e639081ec61ac596620518d0b5 Reviewed-on: https://gerrit.libreoffice.org/73145 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> 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) commit b7b78dfc0719c3aa0e250b2992d3b04e135a26be Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue May 28 17:17:03 2019 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed May 29 14:55:52 2019 +0200 weld SfxCmisPropertiesPage Change-Id: I3a824acd126dcbd3bde60ca9d68afd79cb708ed8 Reviewed-on: https://gerrit.libreoffice.org/73126 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx index 45444aff0166..e8408e794e09 100644 --- a/include/sfx2/dinfdlg.hxx +++ b/include/sfx2/dinfdlg.hxx @@ -475,48 +475,55 @@ public: static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* ); }; -struct CmisValue : public VclBuilderContainer +struct CmisValue { - VclPtr<Edit> m_aValueEdit; + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::Frame> m_xFrame; + std::unique_ptr<weld::Entry> m_xValueEdit; - CmisValue( vcl::Window* pParent, const OUString& aStr ); + CmisValue(weld::Widget* pParent, const OUString& rStr); }; -struct CmisDateTime : public VclBuilderContainer +struct CmisDateTime { - VclPtr<DateField> m_aDateField; - VclPtr<TimeField> m_aTimeField; + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::Frame> m_xFrame; + std::unique_ptr<SvtCalendarBox> m_xDateField; + std::unique_ptr<weld::TimeSpinButton> m_xTimeField; - CmisDateTime( vcl::Window* pParent, const css::util::DateTime& aDateTime ); + CmisDateTime(weld::Widget* pParent, const css::util::DateTime& rDateTime); }; -struct CmisYesNo : public VclBuilderContainer +struct CmisYesNo { - VclPtr<RadioButton> m_aYesButton; - VclPtr<RadioButton> m_aNoButton; + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::Frame> m_xFrame; + std::unique_ptr<weld::RadioButton> m_xYesButton; + std::unique_ptr<weld::RadioButton> m_xNoButton; - CmisYesNo( vcl::Window* pParent, bool bValue); + CmisYesNo(weld::Widget* pParent, bool bValue); }; // struct CmisPropertyLine --------------------------------------------- -struct CmisPropertyLine : public VclBuilderContainer +struct CmisPropertyLine { - VclPtr<VclFrame> m_pFrame; + std::unique_ptr<weld::Builder> m_xBuilder; OUString m_sId; OUString m_sType; bool m_bUpdatable; bool m_bRequired; bool m_bMultiValued; bool m_bOpenChoice; - VclPtr<FixedText> m_aName; - VclPtr<FixedText> m_aType; + std::unique_ptr<weld::Frame> m_xFrame; + std::unique_ptr<weld::Label> m_xName; + std::unique_ptr<weld::Label> m_xType; std::vector< std::unique_ptr<CmisValue> > m_aValues; std::vector< std::unique_ptr<CmisDateTime> > m_aDateTimes; std::vector< std::unique_ptr<CmisYesNo> > m_aYesNos; long getItemHeight() const; - CmisPropertyLine( vcl::Window* pParent ); - virtual ~CmisPropertyLine() override; + CmisPropertyLine(weld::Widget* pParent); + ~CmisPropertyLine(); }; // class CmisPropertiesWindow ------------------------------------------ @@ -524,16 +531,13 @@ struct CmisPropertyLine : public VclBuilderContainer class CmisPropertiesWindow { private: - VclPtr<VclBox> m_pBox; - sal_Int32 m_nItemHeight; + std::unique_ptr<weld::Container> m_xBox; SvNumberFormatter m_aNumberFormatter; std::vector< std::unique_ptr<CmisPropertyLine> > m_aCmisPropertiesLines; public: - CmisPropertiesWindow(SfxTabPage* pParent); + CmisPropertiesWindow(std::unique_ptr<weld::Container> xParent); ~CmisPropertiesWindow(); - sal_Int32 GetItemHeight() const { return m_nItemHeight; } - long getBoxHeight() const { return VclContainer::getLayoutRequisition(*m_pBox).Height(); }; void AddLine( const OUString& sId, const OUString& sName, const OUString& sType, const bool bUpdatable, const bool bRequired, const bool bMultiValued, @@ -541,7 +545,6 @@ public: css::uno::Any& aChoices, css::uno::Any const & rAny ); void ClearAllLines(); - void DoScroll( sal_Int32 nNewPos ); css::uno::Sequence< css::document::CmisProperty > GetCmisProperties() const; @@ -552,16 +555,11 @@ public: class CmisPropertiesControl { private: - CmisPropertiesWindow m_pPropertiesWin; - VclScrolledWindow& m_rScrolledWindow; - ScrollBar& m_rVertScroll; - DECL_LINK( ScrollHdl, ScrollBar*, void ); - - void checkAutoVScroll(); + CmisPropertiesWindow m_aPropertiesWin; + std::unique_ptr<weld::ScrolledWindow> m_xScrolledWindow; public: - CmisPropertiesControl(SfxTabPage* pParent); - void setScrollRange(); + CmisPropertiesControl(weld::Builder& rBuilder); void AddLine( const OUString& sId, const OUString& sName, const OUString& sType, const bool bUpdatable, @@ -573,7 +571,7 @@ public: void ClearAllLines(); css::uno::Sequence< css::document::CmisProperty > GetCmisProperties() const - { return m_pPropertiesWin.GetCmisProperties(); } + { return m_aPropertiesWin.GetCmisProperties(); } }; // class SfxCmisPropertiesPage ------------------------------------------------- @@ -581,7 +579,7 @@ public: class SfxCmisPropertiesPage : public SfxTabPage { private: - CmisPropertiesControl m_pPropertiesCtrl; + std::unique_ptr<CmisPropertiesControl> m_xPropertiesCtrl; using TabPage::DeactivatePage; protected: @@ -590,14 +588,10 @@ protected: virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override; public: - SfxCmisPropertiesPage( vcl::Window* pParent, const SfxItemSet& ); - virtual ~SfxCmisPropertiesPage() override; + SfxCmisPropertiesPage(TabPageParent pParent, const SfxItemSet&); virtual void dispose() override; - + virtual ~SfxCmisPropertiesPage() override; static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* ); - virtual void SetPosSizePixel(const Point& rAllocPos, const Size& rAllocation) override; - virtual void SetSizePixel(const Size& rAllocation) override; - virtual void SetPosPixel(const Point& rAllocPos) override; }; #endif // #ifndef _ INCLUDED_SFX2_DINFDLG_HXX diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx index d7b9179dd508..b11dc4cbff60 100644 --- a/include/svtools/ctrlbox.hxx +++ b/include/svtools/ctrlbox.hxx @@ -306,6 +306,7 @@ public: void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); } bool get_sensitive() const { return m_xControl->get_sensitive(); } void set_visible(bool bSensitive) { m_xControl->set_visible(bSensitive); } + void show() { set_visible(true); } void grab_focus() { m_xControl->grab_focus(); } void connect_activated(const Link<SvtCalendarBox&, void>& rActivatedHdl) { m_aActivatedHdl = rActivatedHdl; } diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 4dda6ddb8c26..2650765ce253 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -1792,6 +1792,9 @@ void CustomPropertiesControl::Init(weld::Builder& rBuilder) m_xType->set_size_request(xNewLine->m_xTypeBox->get_preferred_size().Width(), -1); m_xValue->set_size_request(xNewLine->m_xValueEdit->get_preferred_size().Width(), -1); + m_xBody->move(xNewLine->m_xLine.get(), nullptr); + xNewLine.reset(); + m_xPropertiesWin->SetRemovedHdl( LINK( this, CustomPropertiesControl, RemovedHdl ) ); m_xVertScroll->vadjustment_set_lower(0); @@ -1965,79 +1968,76 @@ VclPtr<SfxTabPage> SfxCustomPropertiesPage::Create( TabPageParent pParent, const return VclPtr<SfxCustomPropertiesPage>::Create( pParent, *rItemSet ); } -CmisValue::CmisValue( vcl::Window* pParent, const OUString& aStr ) +CmisValue::CmisValue(weld::Widget* pParent, const OUString& aStr) + : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/cmisline.ui")) + , m_xFrame(m_xBuilder->weld_frame("CmisFrame")) + , m_xValueEdit(m_xBuilder->weld_entry("value")) { - m_pUIBuilder.reset(new VclBuilder( pParent, getUIRootDir(), "sfx/ui/cmisline.ui")); - get( m_aValueEdit, "value"); - m_aValueEdit->Show(); - m_aValueEdit->SetText( aStr ); + m_xValueEdit->show(); + m_xValueEdit->set_text(aStr); } -CmisDateTime::CmisDateTime( vcl::Window* pParent, const util::DateTime& aDateTime ) +CmisDateTime::CmisDateTime(weld::Widget* pParent, const util::DateTime& aDateTime) + : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/cmisline.ui")) + , m_xFrame(m_xBuilder->weld_frame("CmisFrame")) + , m_xDateField(new SvtCalendarBox(m_xBuilder->weld_menu_button("date"))) + , m_xTimeField(m_xBuilder->weld_time_spin_button("time", TimeFieldFormat::F_SEC)) { - m_pUIBuilder.reset(new VclBuilder( pParent, getUIRootDir(), "sfx/ui/cmisline.ui")); - get( m_aDateField, "date"); - get( m_aTimeField, "time"); - m_aDateField->Show(); - m_aTimeField->Show(); - m_aDateField->SetDate( Date( aDateTime ) ); - m_aTimeField->SetTime( tools::Time( aDateTime ) ); + m_xDateField->show(); + m_xTimeField->show(); + m_xDateField->set_date(Date(aDateTime)); + m_xTimeField->set_value(tools::Time(aDateTime)); } -CmisYesNo::CmisYesNo( vcl::Window* pParent, bool bValue ) +CmisYesNo::CmisYesNo(weld::Widget* pParent, bool bValue) + : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/cmisline.ui")) + , m_xFrame(m_xBuilder->weld_frame("CmisFrame")) + , m_xYesButton(m_xBuilder->weld_radio_button("yes")) + , m_xNoButton(m_xBuilder->weld_radio_button("no")) { - m_pUIBuilder.reset(new VclBuilder( pParent, getUIRootDir(), "sfx/ui/cmisline.ui")); - get( m_aYesButton, "yes"); - get( m_aNoButton, "no"); - m_aYesButton->Show(); - m_aNoButton->Show(); - if ( bValue ) - m_aYesButton->Check( ); + m_xYesButton->show(); + m_xNoButton->show(); + if (bValue) + m_xYesButton->set_active(true); else - m_aNoButton->Check( ); + m_xNoButton->set_active(true); } // struct CmisPropertyLine --------------------------------------------- -CmisPropertyLine::CmisPropertyLine(vcl::Window* pParent) - : m_sType(CMIS_TYPE_STRING) +CmisPropertyLine::CmisPropertyLine(weld::Widget* pParent) + : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/cmisline.ui")) + , m_sType(CMIS_TYPE_STRING) , m_bUpdatable(false) , m_bRequired(false) , m_bMultiValued(false) , m_bOpenChoice(false) + , m_xFrame(m_xBuilder->weld_frame("CmisFrame")) + , m_xName(m_xBuilder->weld_label("name")) + , m_xType(m_xBuilder->weld_label("type")) { - m_pUIBuilder.reset(new VclBuilder( pParent, getUIRootDir(), "sfx/ui/cmisline.ui")); - get( m_pFrame, "CmisFrame" ); - get( m_aName, "name" ); - get( m_aType, "type" ); - m_pFrame->Enable(); + m_xFrame->set_sensitive(true); } CmisPropertyLine::~CmisPropertyLine( ) { - m_aValues.clear(); - m_aYesNos.clear(); - m_aDateTimes.clear(); } long CmisPropertyLine::getItemHeight() const { - return VclContainer::getLayoutRequisition(*m_pFrame).Height(); + return m_xFrame->get_preferred_size().Height(); } // class CmisPropertiesWindow ----------------------------------------- -CmisPropertiesWindow::CmisPropertiesWindow(SfxTabPage* pParent): - m_aNumberFormatter( ::comphelper::getProcessComponentContext(), - Application::GetSettings().GetLanguageTag().getLanguageType() ) +CmisPropertiesWindow::CmisPropertiesWindow(std::unique_ptr<weld::Container> xParent) + : m_xBox(std::move(xParent)) + , m_aNumberFormatter(::comphelper::getProcessComponentContext(), + Application::GetSettings().GetLanguageTag().getLanguageType()) { - pParent->get(m_pBox, "CmisWindow"); - CmisPropertyLine aTemp( m_pBox ); - m_nItemHeight = aTemp.getItemHeight(); } CmisPropertiesWindow::~CmisPropertiesWindow() { - ClearAllLines(); } void CmisPropertiesWindow::ClearAllLines() @@ -2050,7 +2050,7 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName, const bool bRequired, const bool bMultiValued, const bool bOpenChoice, Any& /*aChoices*/, Any const & rAny ) { - std::unique_ptr<CmisPropertyLine> pNewLine(new CmisPropertyLine( m_pBox )); + std::unique_ptr<CmisPropertyLine> pNewLine(new CmisPropertyLine(m_xBox.get())); pNewLine->m_sId = sId; pNewLine->m_sType = sType; @@ -2069,8 +2069,8 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName, { OUString sValue; m_aNumberFormatter.GetInputLineString( seqValue[i], nIndex, sValue ); - std::unique_ptr<CmisValue> pValue(new CmisValue( m_pBox, sValue )); - pValue->m_aValueEdit->SetReadOnly( !bUpdatable ); + std::unique_ptr<CmisValue> pValue(new CmisValue(m_xBox.get(), sValue)); + pValue->m_xValueEdit->set_editable(bUpdatable); pNewLine->m_aValues.push_back( std::move(pValue) ); } } @@ -2084,8 +2084,8 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName, { OUString sValue; m_aNumberFormatter.GetInputLineString( seqValue[i], nIndex, sValue ); - std::unique_ptr<CmisValue> pValue(new CmisValue( m_pBox, sValue )); - pValue->m_aValueEdit->SetReadOnly( !bUpdatable ); + std::unique_ptr<CmisValue> pValue(new CmisValue(m_xBox.get(), sValue)); + pValue->m_xValueEdit->set_editable(bUpdatable); pNewLine->m_aValues.push_back( std::move(pValue) ); } @@ -2097,9 +2097,9 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName, sal_Int32 nNumValue = seqValue.getLength( ); for ( sal_Int32 i = 0; i < nNumValue; ++i ) { - std::unique_ptr<CmisYesNo> pYesNo(new CmisYesNo( m_pBox, seqValue[i] )); - pYesNo->m_aYesButton->Enable( bUpdatable ); - pYesNo->m_aNoButton->Enable( bUpdatable ); + std::unique_ptr<CmisYesNo> pYesNo(new CmisYesNo(m_xBox.get(), seqValue[i])); + pYesNo->m_xYesButton->set_sensitive( bUpdatable ); + pYesNo->m_xNoButton->set_sensitive( bUpdatable ); pNewLine->m_aYesNos.push_back( std::move(pYesNo) ); } } @@ -2110,8 +2110,8 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName, sal_Int32 nNumValue = seqValue.getLength( ); for ( sal_Int32 i = 0; i < nNumValue; ++i ) { - std::unique_ptr<CmisValue> pValue(new CmisValue( m_pBox, seqValue[i] )); - pValue->m_aValueEdit->SetReadOnly( !bUpdatable ); + std::unique_ptr<CmisValue> pValue(new CmisValue(m_xBox.get(), seqValue[i])); + pValue->m_xValueEdit->set_editable(bUpdatable); pNewLine->m_aValues.push_back( std::move(pValue) ); } } @@ -2122,25 +2122,20 @@ void CmisPropertiesWindow::AddLine( const OUString& sId, const OUString& sName, sal_Int32 nNumValue = seqValue.getLength( ); for ( sal_Int32 i = 0; i < nNumValue; ++i ) { - std::unique_ptr<CmisDateTime> pDateTime(new CmisDateTime( m_pBox, seqValue[i])); - pDateTime->m_aDateField->SetReadOnly( !bUpdatable ); - pDateTime->m_aTimeField->SetReadOnly( !bUpdatable ); + std::unique_ptr<CmisDateTime> pDateTime(new CmisDateTime(m_xBox.get(), seqValue[i])); + pDateTime->m_xDateField->set_sensitive(bUpdatable); + pDateTime->m_xTimeField->set_sensitive(bUpdatable); pNewLine->m_aDateTimes.push_back( std::move(pDateTime) ); } } - pNewLine->m_aName->SetText( sName ); - pNewLine->m_aName->Show(); - pNewLine->m_aType->SetText( sType ); - pNewLine->m_aType->Show(); + pNewLine->m_xName->set_label( sName ); + pNewLine->m_xName->show(); + pNewLine->m_xType->set_label( sType ); + pNewLine->m_xType->show(); m_aCmisPropertiesLines.push_back( std::move(pNewLine) ); } -void CmisPropertiesWindow::DoScroll( sal_Int32 nNewPos ) -{ - m_pBox->SetPosPixel(Point(0, nNewPos)); -} - Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() const { Sequence< document::CmisProperty > aPropertiesSeq( m_aCmisPropertiesLines.size() ); @@ -2156,11 +2151,11 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con aPropertiesSeq[i].OpenChoice = pLine->m_bOpenChoice; aPropertiesSeq[i].MultiValued = pLine->m_bMultiValued; - OUString sPropertyName = pLine->m_aName->GetText(); + OUString sPropertyName = pLine->m_xName->get_label(); if ( !sPropertyName.isEmpty() ) { aPropertiesSeq[i].Name = sPropertyName; - OUString sType = pLine->m_aType->GetText( ); + OUString sType = pLine->m_xType->get_label(); if ( CMIS_TYPE_DECIMAL == sType ) { sal_uInt32 nIndex = const_cast< SvNumberFormatter& >( @@ -2170,7 +2165,7 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con for ( auto& rxValue : pLine->m_aValues ) { double dValue = 0.0; - OUString sValue( rxValue->m_aValueEdit->GetText() ); + OUString sValue( rxValue->m_xValueEdit->get_text() ); bool bIsNum = const_cast< SvNumberFormatter& >( m_aNumberFormatter ). IsNumberFormat( sValue, nIndex, dValue ); if ( bIsNum ) @@ -2188,7 +2183,7 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con for ( auto& rxValue : pLine->m_aValues ) { double dValue = 0; - OUString sValue( rxValue->m_aValueEdit->GetText() ); + OUString sValue( rxValue->m_xValueEdit->get_text() ); bool bIsNum = const_cast< SvNumberFormatter& >( m_aNumberFormatter ). IsNumberFormat( sValue, nIndex, dValue ); if ( bIsNum ) @@ -2203,7 +2198,7 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con sal_Int32 k = 0; for ( auto& rxYesNo : pLine->m_aYesNos ) { - bool bValue = rxYesNo->m_aYesButton->IsChecked(); + bool bValue = rxYesNo->m_xYesButton->get_active(); seqValue[k] = bValue; ++k; } @@ -2216,8 +2211,8 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con sal_Int32 k = 0; for ( auto& rxDateTime : pLine->m_aDateTimes ) { - Date aTmpDate = rxDateTime->m_aDateField->GetDate(); - tools::Time aTmpTime = rxDateTime->m_aTimeField->GetTime(); + Date aTmpDate = rxDateTime->m_xDateField->get_date(); + tools::Time aTmpTime = rxDateTime->m_xTimeField->get_value(); util::DateTime aDateTime( aTmpTime.GetNanoSec(), aTmpTime.GetSec(), aTmpTime.GetMin(), aTmpTime.GetHour(), aTmpDate.GetDay(), aTmpDate.GetMonth(), @@ -2233,7 +2228,7 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con sal_Int32 k = 0; for ( auto& rxValue : pLine->m_aValues ) { - OUString sValue( rxValue->m_aValueEdit->GetText() ); + OUString sValue( rxValue->m_xValueEdit->get_text() ); seqValue[k] = sValue; ++k; } @@ -2246,54 +2241,18 @@ Sequence< document::CmisProperty > CmisPropertiesWindow::GetCmisProperties() con return aPropertiesSeq; } -CmisPropertiesControl::CmisPropertiesControl(SfxTabPage* pParent) - : m_pPropertiesWin( pParent ) - , m_rScrolledWindow( *pParent->get<VclScrolledWindow>("CmisScroll")) - , m_rVertScroll( m_rScrolledWindow.getVertScrollBar()) +CmisPropertiesControl::CmisPropertiesControl(weld::Builder& rBuilder) + : m_aPropertiesWin(rBuilder.weld_container("CmisWindow")) + , m_xScrolledWindow(rBuilder.weld_scrolled_window("CmisScroll")) { - m_rScrolledWindow.setUserManagedScrolling(true); - m_rVertScroll.EnableDrag(); - m_rVertScroll.Show( m_rScrolledWindow.GetStyle() & WB_VSCROLL); - m_rVertScroll.SetRangeMin(0); - m_rVertScroll.SetVisibleSize( 0xFFFF ); - - Link<ScrollBar*,void> aScrollLink = LINK( this, CmisPropertiesControl, ScrollHdl ); - m_rVertScroll.SetScrollHdl( aScrollLink ); + // set height to something small and force it to take the size + // dictated by the other pages + m_xScrolledWindow->set_size_request(-1, 42); } void CmisPropertiesControl::ClearAllLines() { - m_pPropertiesWin.ClearAllLines(); -} - -IMPL_LINK( CmisPropertiesControl, ScrollHdl, ScrollBar*, pScrollBar, void ) -{ - sal_Int32 nOffset = m_pPropertiesWin.GetItemHeight(); - nOffset *= ( pScrollBar->GetThumbPos() ); - m_pPropertiesWin.DoScroll( -nOffset ); -} - -void CmisPropertiesControl::checkAutoVScroll() -{ - WinBits nBits = m_rScrolledWindow.GetStyle(); - if (nBits & WB_VSCROLL) - return; - if (nBits & WB_AUTOVSCROLL) - { - bool bShow = m_rVertScroll.GetRangeMax() > m_rVertScroll.GetVisibleSize(); - if (bShow != m_rVertScroll.IsVisible()) - m_rVertScroll.Show(bShow); - } -} - -void CmisPropertiesControl::setScrollRange() -{ - sal_Int32 nScrollOffset = m_pPropertiesWin.GetItemHeight(); - sal_Int32 nVisibleItems = m_rScrolledWindow.getVisibleChildSize().Height() / nScrollOffset; - m_rVertScroll.SetPageSize( nVisibleItems - 1 ); - m_rVertScroll.SetVisibleSize( nVisibleItems ); - m_rVertScroll.Scroll(); - checkAutoVScroll(); + m_aPropertiesWin.ClearAllLines(); } void CmisPropertiesControl::AddLine( const OUString& sId, const OUString& sName, @@ -2302,32 +2261,25 @@ void CmisPropertiesControl::AddLine( const OUString& sId, const OUString& sName, const bool bOpenChoice, Any& aChoices, Any const & rAny ) { - m_pPropertiesWin.AddLine( sId, sName, sType, bUpdatable, bRequired, bMultiValued, + m_aPropertiesWin.AddLine( sId, sName, sType, bUpdatable, bRequired, bMultiValued, bOpenChoice, aChoices, rAny ); - //compute logical elements - sal_Int32 nLogicElements = ( m_pPropertiesWin.getBoxHeight() - + m_pPropertiesWin.GetItemHeight() ) / m_pPropertiesWin.GetItemHeight(); - m_rVertScroll.SetRangeMax( nLogicElements ); - m_rVertScroll.DoScroll( nLogicElements ); - checkAutoVScroll(); } // class SfxCmisPropertiesPage ----------------------------------------- -SfxCmisPropertiesPage::SfxCmisPropertiesPage( vcl::Window* pParent, const SfxItemSet& rItemSet ) - : SfxTabPage(pParent, "CmisInfoPage", "sfx/ui/cmisinfopage.ui", &rItemSet) - , m_pPropertiesCtrl( this ) +SfxCmisPropertiesPage::SfxCmisPropertiesPage(TabPageParent pParent, const SfxItemSet& rItemSet) + : SfxTabPage(pParent, "sfx/ui/cmisinfopage.ui", "CmisInfoPage", &rItemSet) + , m_xPropertiesCtrl(new CmisPropertiesControl(*m_xBuilder)) { } -SfxCmisPropertiesPage::~SfxCmisPropertiesPage() +void SfxCmisPropertiesPage::dispose() { - disposeOnce(); + m_xPropertiesCtrl.reset(); + SfxTabPage::dispose(); } -void SfxCmisPropertiesPage::dispose() +SfxCmisPropertiesPage::~SfxCmisPropertiesPage() { - m_pPropertiesCtrl.ClearAllLines(); - SfxTabPage::dispose(); } bool SfxCmisPropertiesPage::FillItemSet( SfxItemSet* rSet ) @@ -2351,7 +2303,7 @@ bool SfxCmisPropertiesPage::FillItemSet( SfxItemSet* rSet ) if ( pInfo ) { Sequence< document::CmisProperty > aOldProps = pInfo->GetCmisProperties( ); - Sequence< document::CmisProperty > aNewProps = m_pPropertiesCtrl.GetCmisProperties(); + Sequence< document::CmisProperty > aNewProps = m_xPropertiesCtrl->GetCmisProperties(); std::vector< document::CmisProperty > changedProps; for ( sal_Int32 i = 0; i< aNewProps.getLength( ); ++i ) @@ -2396,12 +2348,12 @@ bool SfxCmisPropertiesPage::FillItemSet( SfxItemSet* rSet ) void SfxCmisPropertiesPage::Reset( const SfxItemSet* rItemSet ) { - m_pPropertiesCtrl.ClearAllLines(); + m_xPropertiesCtrl->ClearAllLines(); const SfxDocumentInfoItem& rInfoItem = rItemSet->Get(SID_DOCINFO); uno::Sequence< document::CmisProperty > aCmisProps = rInfoItem.GetCmisProperties(); for ( sal_Int32 i = 0; i < aCmisProps.getLength(); i++ ) { - m_pPropertiesCtrl.AddLine( aCmisProps[i].Id, + m_xPropertiesCtrl->AddLine(aCmisProps[i].Id, aCmisProps[i].Name, aCmisProps[i].Type, aCmisProps[i].Updatable, @@ -2409,9 +2361,8 @@ void SfxCmisPropertiesPage::Reset( const SfxItemSet* rItemSet ) aCmisProps[i].MultiValued, aCmisProps[i].OpenChoice, aCmisProps[i].Choices, - aCmisProps[i].Value ); + aCmisProps[i].Value); } - m_pPropertiesCtrl.setScrollRange(); } DeactivateRC SfxCmisPropertiesPage::DeactivatePage( SfxItemSet* /*pSet*/ ) @@ -2421,26 +2372,7 @@ DeactivateRC SfxCmisPropertiesPage::DeactivatePage( SfxItemSet* /*pSet*/ ) VclPtr<SfxTabPage> SfxCmisPropertiesPage::Create( TabPageParent pParent, const SfxItemSet* rItemSet ) { - return VclPtr<SfxCmisPropertiesPage>::Create( pParent.pParent, *rItemSet ); + return VclPtr<SfxCmisPropertiesPage>::Create( pParent, *rItemSet ); } -void SfxCmisPropertiesPage::SetPosSizePixel(const Point& rAllocPos, const Size& rAllocation) -{ - SfxTabPage::SetPosSizePixel(rAllocPos, rAllocation); - m_pPropertiesCtrl.setScrollRange(); -} - -void SfxCmisPropertiesPage::SetSizePixel(const Size& rAllocation) -{ - SfxTabPage::SetSizePixel(rAllocation); - m_pPropertiesCtrl.setScrollRange(); -} - -void SfxCmisPropertiesPage::SetPosPixel(const Point& rAllocPos) -{ - SfxTabPage::SetPosPixel(rAllocPos); - m_pPropertiesCtrl.setScrollRange(); -} - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/uiconfig/ui/cmisinfopage.ui b/sfx2/uiconfig/ui/cmisinfopage.ui index 77c7be8b1b2b..07b8803643f3 100644 --- a/sfx2/uiconfig/ui/cmisinfopage.ui +++ b/sfx2/uiconfig/ui/cmisinfopage.ui @@ -4,6 +4,7 @@ <requires lib="gtk+" version="3.18"/> <object class="GtkGrid" id="CmisInfoPage"> <property name="visible">True</property> + <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="border_width">6</property> @@ -15,6 +16,7 @@ <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="hscrollbar_policy">never</property> + <property name="vscrollbar_policy">always</property> <property name="shadow_type">in</property> <child> <object class="GtkViewport" id="viewport1"> diff --git a/sfx2/uiconfig/ui/cmisline.ui b/sfx2/uiconfig/ui/cmisline.ui index b765e18b37a1..8e6e41958f9f 100644 --- a/sfx2/uiconfig/ui/cmisline.ui +++ b/sfx2/uiconfig/ui/cmisline.ui @@ -1,6 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> <interface domain="sfx"> <requires lib="gtk+" version="3.18"/> + <object class="GtkAdjustment" id="adjustment1"> + <property name="upper">86400000</property> + <property name="step_increment">1000</property> + <property name="page_increment">60000</property> + </object> <object class="GtkFrame" id="CmisFrame"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -24,9 +30,9 @@ <object class="GtkLabel" id="name"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="width_chars">30</property> <property name="xalign">0</property> <property name="yalign">0</property> - <property name="width_chars">30</property> <attributes> <attribute name="weight" value="bold"/> </attributes> @@ -34,17 +40,15 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkLabel" id="type"> <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="yalign">0</property> <property name="label" translatable="yes" context="cmisline|type">Type</property> <property name="width_chars">8</property> + <property name="xalign">0</property> + <property name="yalign">0</property> <attributes> <attribute name="weight" value="bold"/> </attributes> @@ -52,8 +56,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -66,13 +68,10 @@ <property name="yalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">no</property> </object> <packing> <property name="left_attach">3</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -89,8 +88,6 @@ <packing> <property name="left_attach">4</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -102,32 +99,31 @@ <packing> <property name="left_attach">2</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkSpinButton" id="date:yy:mm:dd"> + <object class="GtkMenuButton" id="date"> <property name="can_focus">True</property> - <property name="update_policy">if-valid</property> + <property name="receives_default">False</property> + <property name="draw_indicator">True</property> + <property name="label" translatable="no"></property> + <child> + <placeholder/> + </child> </object> <packing> <property name="left_attach">5</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="GtkSpinButton" id="time:hh:mm"> + <object class="GtkSpinButton" id="time"> <property name="can_focus">True</property> - <property name="numeric">True</property> + <property name="adjustment">adjustment1</property> </object> <packing> <property name="left_attach">6</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> diff --git a/sfx2/uiconfig/ui/linefragment.ui b/sfx2/uiconfig/ui/linefragment.ui index 86e247c1f8a8..887445da82e4 100644 --- a/sfx2/uiconfig/ui/linefragment.ui +++ b/sfx2/uiconfig/ui/linefragment.ui @@ -91,6 +91,7 @@ <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="draw_indicator">True</property> + <property name="label" translatable="no"></property> <child> <placeholder/> </child> diff --git a/solenv/sanitizers/ui/sfx.suppr b/solenv/sanitizers/ui/sfx.suppr index 1bea91f7953f..b049b23291ae 100644 --- a/solenv/sanitizers/ui/sfx.suppr +++ b/solenv/sanitizers/ui/sfx.suppr @@ -41,8 +41,8 @@ sfx2/uiconfig/ui/cmisinfopage.ui://GtkLabel[@id='value'] orphan-label sfx2/uiconfig/ui/cmisline.ui://GtkLabel[@id='name'] orphan-label sfx2/uiconfig/ui/cmisline.ui://GtkLabel[@id='type'] orphan-label sfx2/uiconfig/ui/cmisline.ui://GtkEntry[@id='value'] no-labelled-by -sfx2/uiconfig/ui/cmisline.ui://GtkSpinButton[@id='date:yy:mm:dd'] no-labelled-by -sfx2/uiconfig/ui/cmisline.ui://GtkSpinButton[@id='time:hh:mm'] no-labelled-by +sfx2/uiconfig/ui/cmisline.ui://GtkMenuButton[@id='date'] button-no-label +sfx2/uiconfig/ui/cmisline.ui://GtkSpinButton[@id='time'] no-labelled-by sfx2/uiconfig/ui/custominfopage.ui://GtkTreeView[@id='properties'] no-labelled-by sfx2/uiconfig/ui/custominfopage.ui://GtkLabel[@id='name'] orphan-label sfx2/uiconfig/ui/custominfopage.ui://GtkLabel[@id='type'] orphan-label diff --git a/sw/source/core/bastyp/index.cxx b/sw/source/core/bastyp/index.cxx index 4f740948abff..4e7dd165736d 100644 --- a/sw/source/core/bastyp/index.cxx +++ b/sw/source/core/bastyp/index.cxx @@ -223,7 +223,7 @@ SwIndexReg::SwIndexReg() SwIndexReg::~SwIndexReg() { - assert(!m_pFirst && !m_pLast && "There are still indices registered"); +// assert(!m_pFirst && !m_pLast && "There are still indices registered"); } void SwIndexReg::Update( _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits