desktop/source/deployment/gui/dp_gui_dialog2.hxx | 2 extras/source/glade/libreoffice-catalog.xml.in | 3 filter/inc/strings.hrc | 2 filter/source/xsltdialog/xmlfilterdialogcomponent.cxx | 36 - filter/source/xsltdialog/xmlfilterjar.cxx | 1 filter/source/xsltdialog/xmlfiltersettingsdialog.cxx | 402 ++++-------------- filter/source/xsltdialog/xmlfiltersettingsdialog.hxx | 99 +--- filter/source/xsltdialog/xmlfiltertabdialog.cxx | 1 filter/source/xsltdialog/xmlfiltertabpagebasic.cxx | 2 filter/source/xsltdialog/xmlfiltertabpagexslt.cxx | 1 filter/source/xsltdialog/xmlfiltertestdialog.cxx | 2 filter/uiconfig/ui/xmlfiltersettings.ui | 69 ++- include/vcl/waitobj.hxx | 3 include/vcl/weld.hxx | 1 sfx2/source/appl/sfxhelp.cxx | 10 solenv/bin/native-code.py | 1 vcl/source/app/salvtables.cxx | 25 + vcl/source/window/dialog.cxx | 4 vcl/unx/gtk3/gtk3gtkinst.cxx | 5 19 files changed, 253 insertions(+), 416 deletions(-)
New commits: commit 08127638744c66dc5feab5808ef51ce54f9155e1 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Apr 2 12:42:55 2019 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Apr 2 17:11:56 2019 +0200 weld XMLFilterSettingsDialog Change-Id: Ia027fa0b5e99651988f2447bf29f6f5653dd0c48 Reviewed-on: https://gerrit.libreoffice.org/70139 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index 6a1c40083c84..afb375fb16cd 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -93,7 +93,7 @@ public: const char* pResID, bool &bHadWarning ); - void incBusy() { m_aBusy.incBusy(m_xVCLWindow); } + void incBusy() { m_aBusy.incBusy(m_xVCLWindow->GetFrameWeld()); } void decBusy() { m_aBusy.decBusy(); } bool isBusy() const { return m_aBusy.isBusy(); } bool installExtensionWarn(const OUString &rExtensionURL); diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index f89e0d3ddbcd..c80974b9b34d 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -188,9 +188,6 @@ <glade-widget-class title="Extension List With Buttons" name="deploymentgui-ExtBoxWithBtns" generic-name="Extensions List With Buttons" parent="deploymentgui-ExtensionBox" icon-name="widget-gtk-drawingarea"/> - <glade-widget-class title="Path List" name="xsltdlglo-SvxPathControl" - generic-name="Path List" parent="GtkDrawingArea" - icon-name="widget-gtk-drawingarea"/> <glade-widget-class title="Print Preview" name="vcllo-PrintPreviewWindow" generic-name="Print Preview" parent="GtkDrawingArea" icon-name="widget-gtk-drawingarea"/> diff --git a/filter/inc/strings.hrc b/filter/inc/strings.hrc index e864eef12142..406ff9123d32 100644 --- a/filter/inc/strings.hrc +++ b/filter/inc/strings.hrc @@ -22,8 +22,6 @@ #define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String) -#define STR_COLUMN_HEADER_NAME NC_("STR_COLUMN_HEADER_NAME", "Name") -#define STR_COLUMN_HEADER_TYPE NC_("STR_COLUMN_HEADER_TYPE", "Type") #define STR_UNKNOWN_APPLICATION NC_("STR_UNKNOWN_APPLICATION", "Unknown") #define STR_IMPORT_ONLY NC_("STR_IMPORT_ONLY", "import filter") #define STR_IMPORT_EXPORT NC_("STR_IMPORT_EXPORT", "import/export filter") diff --git a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx index 2f35661d014b..730c132ffb3a 100644 --- a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx +++ b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx @@ -106,13 +106,12 @@ private: css::uno::Reference<css::awt::XWindow> mxParent; /// parent window css::uno::Reference< XComponentContext > mxContext; - VclPtr<XMLFilterSettingsDialog> mpDialog; + std::shared_ptr<XMLFilterSettingsDialog> mxDialog; }; -XMLFilterDialogComponent::XMLFilterDialogComponent( const css::uno::Reference< XComponentContext >& rxContext ) : - OComponentHelper( maMutex ), - mxContext( rxContext ), - mpDialog( nullptr ) +XMLFilterDialogComponent::XMLFilterDialogComponent(const css::uno::Reference< XComponentContext >& rxContext) + : OComponentHelper(maMutex) + , mxContext(rxContext) { Reference< XDesktop2 > xDesktop = Desktop::create( rxContext ); Reference< XTerminateListener > xListener( this ); @@ -241,7 +240,8 @@ void SAL_CALL XMLFilterDialogComponent::disposing() { ::SolarMutexGuard aGuard; - mpDialog.disposeAndClear(); + if (mxDialog) + mxDialog->response(RET_CLOSE); } @@ -249,18 +249,17 @@ void SAL_CALL XMLFilterDialogComponent::disposing() void SAL_CALL XMLFilterDialogComponent::queryTermination( const EventObject& /* Event */ ) { ::SolarMutexGuard aGuard; - if (!mpDialog) + if (!mxDialog) return; - mpDialog->ToTop(); + mxDialog->present(); } void SAL_CALL XMLFilterDialogComponent::notifyTermination( const EventObject& /* Event */ ) { { ::SolarMutexGuard aGuard; - if (!mpDialog) - return; - mpDialog->Close(); + if (mxDialog) + mxDialog->response(RET_CLOSE); } // we are going down, so dispose us! @@ -280,27 +279,24 @@ sal_Int16 SAL_CALL XMLFilterDialogComponent::execute() ::SolarMutexGuard aGuard; bool bLaunch = false; - if (!mpDialog) + if (!mxDialog) { Reference< XComponent > xComp( this ); - if (mxParent.is()) - mpDialog = VclPtr<XMLFilterSettingsDialog>::Create(VCLUnoHelper::GetWindow(mxParent), mxContext); - else - mpDialog = VclPtr<XMLFilterSettingsDialog>::Create(nullptr, mxContext, Dialog::InitFlag::NoParent); + mxDialog.reset(new XMLFilterSettingsDialog(Application::GetFrameWeld(mxParent), mxContext)); bLaunch = true; } - mpDialog->UpdateWindow(); + mxDialog->UpdateWindow(); if (!bLaunch) { - mpDialog->ToTop(); + mxDialog->present(); return 0; } - mpDialog->StartExecuteAsync([this](sal_Int32) + weld::DialogController::runAsync(mxDialog, [this](sal_Int32) { - mpDialog.reset(); + mxDialog.reset(); }); return 0; diff --git a/filter/source/xsltdialog/xmlfilterjar.cxx b/filter/source/xsltdialog/xmlfilterjar.cxx index 5ab09745f583..de8b2078107c 100644 --- a/filter/source/xsltdialog/xmlfilterjar.cxx +++ b/filter/source/xsltdialog/xmlfilterjar.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/container/XNamed.hpp> #include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/util/XChangesBatch.hpp> #include <com/sun/star/uno/XComponentContext.hpp> diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index 800cd20802dd..db465480e739 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -20,6 +20,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/frame/Desktop.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/util/XFlushable.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -67,37 +68,37 @@ OUString XsltResId(const char* pId) return Translate::get(pId, Translate::Create("flt")); } -XMLFilterSettingsDialog::XMLFilterSettingsDialog(vcl::Window* pParent, - const css::uno::Reference<css::uno::XComponentContext>& rxContext, - Dialog::InitFlag eFlag) - : ModelessDialog(pParent, "XMLFilterSettingsDialog", "filter/ui/xmlfiltersettings.ui", eFlag) +XMLFilterSettingsDialog::XMLFilterSettingsDialog(weld::Window* pParent, + const css::uno::Reference<css::uno::XComponentContext>& rxContext) + : GenericDialogController(pParent, "filter/ui/xmlfiltersettings.ui", "XMLFilterSettingsDialog") , mxContext( rxContext ) , m_sTemplatePath("$(user)/template/") , m_sDocTypePrefix("doctype:") + , m_xPBNew(m_xBuilder->weld_button("new")) + , m_xPBEdit(m_xBuilder->weld_button("edit")) + , m_xPBTest(m_xBuilder->weld_button("test")) + , m_xPBDelete(m_xBuilder->weld_button("delete")) + , m_xPBSave(m_xBuilder->weld_button("save")) + , m_xPBOpen(m_xBuilder->weld_button("open")) + , m_xPBClose(m_xBuilder->weld_button("close")) + , m_xFilterListBox(m_xBuilder->weld_tree_view("filterlist")) { - get(m_pCtrlFilterList, "filterlist"); - get(m_pPBNew, "new"); - get(m_pPBEdit, "edit"); - get(m_pPBTest, "test"); - get(m_pPBDelete, "delete"); - get(m_pPBSave, "save"); - get(m_pPBOpen, "open"); - get(m_pPBClose, "close"); - - m_pFilterListBox = m_pCtrlFilterList->getListBox(); - m_pFilterListBox->SetSelectHdl( LINK( this, XMLFilterSettingsDialog, SelectionChangedHdl_Impl ) ); - m_pFilterListBox->SetDeselectHdl( LINK( this, XMLFilterSettingsDialog, SelectionChangedHdl_Impl ) ); - m_pFilterListBox->SetDoubleClickHdl( LINK( this, XMLFilterSettingsDialog, DoubleClickHdl_Impl ) ); - m_pFilterListBox->SetAccessibleName(XsltResId(STR_XML_FILTER_LISTBOX)); - m_pFilterListBox->SetHelpId(m_pCtrlFilterList->GetHelpId()); - - m_pPBNew->SetClickHdl(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) ); - m_pPBEdit->SetClickHdl(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) ); - m_pPBTest->SetClickHdl(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) ); - m_pPBDelete->SetClickHdl(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) ); - m_pPBSave->SetClickHdl(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) ); - m_pPBOpen->SetClickHdl(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) ); - m_pPBClose->SetClickHdl(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) ); + m_xFilterListBox->set_selection_mode(SelectionMode::Multiple); + + m_xFilterListBox->set_size_request(m_xFilterListBox->get_approximate_digit_width() * 65, + m_xFilterListBox->get_height_rows(12)); + + m_xFilterListBox->connect_changed( LINK( this, XMLFilterSettingsDialog, SelectionChangedHdl_Impl ) ); + m_xFilterListBox->connect_row_activated( LINK( this, XMLFilterSettingsDialog, DoubleClickHdl_Impl ) ); + m_xFilterListBox->set_accessible_name(XsltResId(STR_XML_FILTER_LISTBOX)); + + m_xPBNew->connect_clicked(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) ); + m_xPBEdit->connect_clicked(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) ); + m_xPBTest->connect_clicked(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) ); + m_xPBDelete->connect_clicked(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) ); + m_xPBSave->connect_clicked(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) ); + m_xPBOpen->connect_clicked(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) ); + m_xPBClose->connect_clicked(LINK( this, XMLFilterSettingsDialog, ClickHdl_Impl ) ); try { @@ -116,92 +117,75 @@ XMLFilterSettingsDialog::XMLFilterSettingsDialog(vcl::Window* pParent, XMLFilterSettingsDialog::~XMLFilterSettingsDialog() { - disposeOnce(); -} - -void XMLFilterSettingsDialog::dispose() -{ - m_pFilterListBox.clear(); - m_pCtrlFilterList.clear(); - m_pPBNew.clear(); - m_pPBEdit.clear(); - m_pPBTest.clear(); - m_pPBDelete.clear(); - m_pPBSave.clear(); - m_pPBOpen.clear(); - m_pPBClose.clear(); - ModelessDialog::dispose(); } -IMPL_LINK(XMLFilterSettingsDialog, ClickHdl_Impl, Button *, pButton, void ) +IMPL_LINK(XMLFilterSettingsDialog, ClickHdl_Impl, weld::Button&, rButton, void) { // tdf#122171 block closing libreoffice until the following dialog is dismissed incBusy(); - if (m_pPBNew == pButton) + if (m_xPBNew.get() == &rButton) { onNew(); } - else if (m_pPBEdit == pButton) + else if (m_xPBEdit.get() == &rButton) { onEdit(); } - else if (m_pPBTest == pButton) + else if (m_xPBTest.get() == &rButton) { onTest(); } - else if (m_pPBDelete == pButton) + else if (m_xPBDelete.get() == &rButton) { onDelete(); } - else if (m_pPBSave == pButton) + else if (m_xPBSave.get() == &rButton) { onSave(); } - else if (m_pPBOpen == pButton) + else if (m_xPBOpen.get() == &rButton) { onOpen(); } - else if (m_pPBClose == pButton) - { - Close(); - } decBusy(); + + if (m_xPBClose.get() == &rButton) + m_xDialog->response(RET_CLOSE); } -IMPL_LINK_NOARG(XMLFilterSettingsDialog, SelectionChangedHdl_Impl, SvTreeListBox*, void) +IMPL_LINK_NOARG(XMLFilterSettingsDialog, SelectionChangedHdl_Impl, weld::TreeView&, void) { updateStates(); } -IMPL_LINK_NOARG(XMLFilterSettingsDialog, DoubleClickHdl_Impl, SvTreeListBox*, bool) +IMPL_LINK_NOARG(XMLFilterSettingsDialog, DoubleClickHdl_Impl, weld::TreeView&, void) { onEdit(); - return false; } void XMLFilterSettingsDialog::UpdateWindow() { - m_pCtrlFilterList->GrabFocus(); + m_xFilterListBox->grab_focus(); disposeFilterList(); - m_pFilterListBox->Clear(); + m_xFilterListBox->clear(); initFilterList(); updateStates(); } void XMLFilterSettingsDialog::updateStates() { - SvTreeListEntry* pSelectedEntry = m_pFilterListBox->FirstSelected(); + std::vector<int> aRows = m_xFilterListBox->get_selected_rows(); - bool bHasSelection = pSelectedEntry != nullptr; + bool bHasSelection = !aRows.empty(); - bool bMultiSelection = bHasSelection && (m_pFilterListBox->NextSelected( pSelectedEntry ) != nullptr ); + bool bMultiSelection = aRows.size() > 1; bool bIsReadonly = false; bool bIsDefault = false; - if(pSelectedEntry) + if (bHasSelection) { - filter_info_impl* pInfo = static_cast<filter_info_impl*>(pSelectedEntry->GetUserData()); + filter_info_impl* pInfo = reinterpret_cast<filter_info_impl*>(m_xFilterListBox->get_id(aRows[0]).toInt64()); bIsReadonly = pInfo->mbReadonly; for( auto nFact : o3tl::enumrange<SvtModuleOptions::EFactory>()) @@ -214,10 +198,10 @@ void XMLFilterSettingsDialog::updateStates() } } } - m_pPBEdit->Enable( bHasSelection && !bMultiSelection && !bIsReadonly); - m_pPBTest->Enable( bHasSelection && !bMultiSelection ); - m_pPBDelete->Enable( bHasSelection && !bMultiSelection && !bIsReadonly && !bIsDefault); - m_pPBSave->Enable( bHasSelection ); + m_xPBEdit->set_sensitive( bHasSelection && !bMultiSelection && !bIsReadonly); + m_xPBTest->set_sensitive( bHasSelection && !bMultiSelection ); + m_xPBDelete->set_sensitive( bHasSelection && !bMultiSelection && !bIsReadonly && !bIsDefault); + m_xPBSave->set_sensitive( bHasSelection ); } /** is called when the user clicks on the "New" button */ @@ -238,7 +222,7 @@ void XMLFilterSettingsDialog::onNew() aTempInfo.maDocumentService = "com.sun.star.text.TextDocument"; // execute XML Filter Dialog - XMLFilterTabDialog aDlg(GetFrameWeld(), mxContext, &aTempInfo); + XMLFilterTabDialog aDlg(m_xDialog.get(), mxContext, &aTempInfo); if (aDlg.run() == RET_OK) { // insert the new filter @@ -249,15 +233,12 @@ void XMLFilterSettingsDialog::onNew() /** is called when the user clicks on the "Edit" Button */ void XMLFilterSettingsDialog::onEdit() { - // get selected filter entry - SvTreeListEntry* pEntry = m_pFilterListBox->FirstSelected(); - if( pEntry ) + // get selected filter info + filter_info_impl* pOldInfo = reinterpret_cast<filter_info_impl*>(m_xFilterListBox->get_selected_id().toInt64()); + if (pOldInfo) { - // get its filter info - filter_info_impl* pOldInfo = static_cast<filter_info_impl*>(pEntry->GetUserData()); - // execute XML Filter Dialog - XMLFilterTabDialog aDlg(GetFrameWeld(), mxContext, pOldInfo); + XMLFilterTabDialog aDlg(m_xDialog.get(), mxContext, pOldInfo); if (aDlg.run() == RET_OK) { filter_info_impl* pNewInfo = aDlg.getNewFilterInfo(); @@ -737,11 +718,11 @@ bool XMLFilterSettingsDialog::insertOrEdit( filter_info_impl* pNewInfo, const fi { if( pOldInfo ) { - m_pFilterListBox->changeEntry( pFilterEntry ); + changeEntry( pFilterEntry ); } else { - m_pFilterListBox->addFilterEntry( pFilterEntry ); + addFilterEntry( pFilterEntry ); maFilterVector.push_back( std::unique_ptr<filter_info_impl>(pFilterEntry) ); } } @@ -753,27 +734,26 @@ bool XMLFilterSettingsDialog::insertOrEdit( filter_info_impl* pNewInfo, const fi void XMLFilterSettingsDialog::onTest() { // get the first selected filter - SvTreeListEntry* pEntry = m_pFilterListBox->FirstSelected(); - if( pEntry ) + filter_info_impl* pInfo = reinterpret_cast<filter_info_impl*>(m_xFilterListBox->get_selected_id().toInt64()); + if (pInfo) { - filter_info_impl* pInfo = static_cast<filter_info_impl*>(pEntry->GetUserData()); - - XMLFilterTestDialog aDlg(GetFrameWeld(), mxContext); + XMLFilterTestDialog aDlg(m_xDialog.get(), mxContext); aDlg.test( *pInfo ); } } void XMLFilterSettingsDialog::onDelete() { - SvTreeListEntry* pEntry = m_pFilterListBox->FirstSelected(); - if( pEntry ) + int nIndex = m_xFilterListBox->get_selected_index(); + if (nIndex == -1) + return; + filter_info_impl* pInfo = reinterpret_cast<filter_info_impl*>(m_xFilterListBox->get_id(nIndex).toInt64()); + if (pInfo) { - filter_info_impl* pInfo = static_cast<filter_info_impl*>(pEntry->GetUserData()); - OUString aMessage(XsltResId(STR_WARN_DELETE)); aMessage = aMessage.replaceFirst( "%s", pInfo->maFilterName ); - std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(m_xDialog.get(), VclMessageType::Warning, VclButtonsType::YesNo, aMessage)); xWarn->set_default_response(RET_YES); @@ -837,7 +817,7 @@ void XMLFilterSettingsDialog::onDelete() xFlushable->flush(); // now remove entry from ui - m_pFilterListBox->RemoveSelection(); + m_xFilterListBox->remove(nIndex); // and delete the filter entry maFilterVector.erase(std::find_if( maFilterVector.begin(), maFilterVector.end(), @@ -861,19 +841,17 @@ void XMLFilterSettingsDialog::onSave() int nFilters = 0; - SvTreeListEntry* pEntry = m_pFilterListBox->FirstSelected(); - while( pEntry ) - { - filter_info_impl* pInfo = static_cast<filter_info_impl*>(pEntry->GetUserData()); - aFilters.push_back( pInfo ); - pEntry = m_pFilterListBox->NextSelected( pEntry ); - nFilters++; - } + m_xFilterListBox->selected_foreach([&](weld::TreeIter& rEntry){ + filter_info_impl* pInfo = reinterpret_cast<filter_info_impl*>(m_xFilterListBox->get_id(rEntry).toInt64()); + aFilters.push_back(pInfo); + ++nFilters; + return false; + }); // Open Fileopen-Dialog ::sfx2::FileDialogHelper aDlg( css::ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION, - FileDialogFlags::NONE, GetFrameWeld()); + FileDialogFlags::NONE, m_xDialog.get()); OUString aExtensions( "*.jar" ); OUString aFilterName(XsltResId(STR_FILTER_PACKAGE)); @@ -904,7 +882,7 @@ void XMLFilterSettingsDialog::onSave() aMsg = aMsg.replaceFirst( sPlaceholder, aURL.GetName() ); } - std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(), VclMessageType::Info, VclButtonsType::Ok, aMsg)); xInfoBox->run(); @@ -918,7 +896,7 @@ void XMLFilterSettingsDialog::onOpen() // Open Fileopen-Dialog ::sfx2::FileDialogHelper aDlg( css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, - FileDialogFlags::NONE, GetFrameWeld()); + FileDialogFlags::NONE, m_xDialog.get()); OUString aExtensions( "*.jar" ); OUString aFilterName(XsltResId(STR_FILTER_PACKAGE)); @@ -968,41 +946,17 @@ void XMLFilterSettingsDialog::onOpen() aMsg = aMsg.replaceFirst( sPlaceholder, OUString::number( nFilters ) ); } - std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(), VclMessageType::Info, VclButtonsType::Ok, aMsg)); xInfoBox->run(); } } -bool XMLFilterSettingsDialog::EventNotify( NotifyEvent& rNEvt ) -{ - // Because of tab control first call the base class. - bool bRet = ModelessDialog::EventNotify(rNEvt); - if ( !bRet ) - { - if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT ) - { - const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); - vcl::KeyCode aKeyCode = pKEvt->GetKeyCode(); - sal_uInt16 nKeyCode = aKeyCode.GetCode(); - bool bMod1 = pKEvt->GetKeyCode().IsMod1(); - - if( nKeyCode == KEY_ESCAPE || (bMod1 && (nKeyCode == KEY_W))) - { - Close(); - return true; - } - } - } - - return bRet; -} - void XMLFilterSettingsDialog::disposeFilterList() { maFilterVector.clear(); - m_pFilterListBox->Clear(); + m_xFilterListBox->clear(); } void XMLFilterSettingsDialog::initFilterList() @@ -1161,7 +1115,7 @@ void XMLFilterSettingsDialog::initFilterList() // add entry to internal container and to ui filter list box maFilterVector.push_back( std::unique_ptr<filter_info_impl>(pTempFilter.get()) ); - m_pFilterListBox->addFilterEntry( pTempFilter.release() ); + addFilterEntry( pTempFilter.release() ); pTempFilter.reset( new filter_info_impl ); @@ -1174,9 +1128,11 @@ void XMLFilterSettingsDialog::initFilterList() } } - SvTreeListEntry* pEntry = m_pFilterListBox->GetEntry( 0 ); - if( pEntry ) - m_pFilterListBox->Select( pEntry ); + if (m_xFilterListBox->n_children()) + { + m_xFilterListBox->columns_autosize(); + m_xFilterListBox->select(0); + } } application_info_impl::application_info_impl( const sal_Char * pDocumentService, const OUString& rUINameRes, const sal_Char * mpXMLImporter, const sal_Char * mpXMLExporter ) @@ -1268,193 +1224,37 @@ OUString getApplicationUIName( const OUString& rServiceName ) } } -SvxPathControl::SvxPathControl(vcl::Window* pParent) - : Window(pParent, WB_HIDE | WB_CLIPCHILDREN | WB_TABSTOP | WB_DIALOGCONTROL | WB_BORDER) - , bHasBeenShown(false) -{ - m_pVBox = VclPtr<VclVBox>::Create(this); - - m_pHeaderBar = VclPtr<HeaderBar>::Create(m_pVBox, WB_BOTTOMBORDER); - m_pHeaderBar->set_height_request(GetTextHeight() + 6); - - m_pFocusCtrl = VclPtr<XMLFilterListBox>::Create(m_pVBox, this); - m_pFocusCtrl->set_fill(true); - m_pFocusCtrl->set_expand(true); - - m_pVBox->set_hexpand(true); - m_pVBox->set_vexpand(true); - m_pVBox->set_expand(true); - m_pVBox->set_fill(true); - m_pVBox->Show(); -} - -#define ITEMID_NAME 1 -#define ITEMID_TYPE 2 - -void SvxPathControl::Resize() -{ - Window::Resize(); - - if (!m_pVBox) - return; - - m_pVBox->SetSizePixel(GetSizePixel()); - - if (!bHasBeenShown) - bHasBeenShown = IsReallyShown(); - - if (!bHasBeenShown) - { - std::vector<long> aWidths; - m_pFocusCtrl->getPreferredDimensions(aWidths); - if (aWidths.empty()) - { - bHasBeenShown = false; - return; - } - long nFirstColumnWidth = aWidths[1]; - m_pHeaderBar->SetItemSize(ITEMID_NAME, nFirstColumnWidth); - m_pHeaderBar->SetItemSize(ITEMID_TYPE, 0xFFFF); - long nTabs[] = {0, nFirstColumnWidth}; - m_pFocusCtrl->SetTabs(SAL_N_ELEMENTS(nTabs), nTabs, MapUnit::MapPixel); - } -} - -Size SvxPathControl::GetOptimalSize() const -{ - Size aDefSize(LogicToPixel(Size(150, 0), MapMode(MapUnit::MapAppFont))); - Size aOptSize(m_pVBox->GetOptimalSize()); - long nRowHeight(GetTextHeight()); - aOptSize.setHeight( nRowHeight * 10 ); - aOptSize.setWidth( std::max(aDefSize.Width(), aOptSize.Width()) ); - return aOptSize; -} - -SvxPathControl::~SvxPathControl() -{ - disposeOnce(); -} - -void SvxPathControl::dispose() -{ - m_pFocusCtrl.disposeAndClear(); - m_pHeaderBar.disposeAndClear(); - m_pVBox.disposeAndClear(); - vcl::Window::dispose(); -} - -VCL_BUILDER_FACTORY(SvxPathControl) - -bool SvxPathControl::EventNotify(NotifyEvent& rNEvt) -{ - bool bRet = Window::EventNotify(rNEvt); - - if ( m_pFocusCtrl && rNEvt.GetWindow() != m_pFocusCtrl && rNEvt.GetType() == MouseNotifyEvent::GETFOCUS ) - m_pFocusCtrl->GrabFocus(); - - return bRet; -} - -XMLFilterListBox::XMLFilterListBox(Window* pParent, SvxPathControl* pPathControl) - : SvTabListBox(pParent, WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP) - , m_pHeaderBar(pPathControl->getHeaderBar()) -{ - Size aBoxSize( pParent->GetOutputSizePixel() ); - - m_pHeaderBar->SetEndDragHdl( LINK( this, XMLFilterListBox, HeaderEndDrag_Impl ) ); - - OUString aStr1(XsltResId(STR_COLUMN_HEADER_NAME)); - OUString aStr2(XsltResId(STR_COLUMN_HEADER_TYPE)); - - long nTabSize = aBoxSize.Width() / 2; - - m_pHeaderBar->InsertItem( ITEMID_NAME, aStr1, nTabSize, HeaderBarItemBits::LEFT ); - m_pHeaderBar->InsertItem( ITEMID_TYPE, aStr2, nTabSize, HeaderBarItemBits::LEFT ); - - static long nTabs[] = {0, nTabSize }; - - SetSelectionMode( SelectionMode::Multiple ); - SetTabs( SAL_N_ELEMENTS(nTabs), nTabs, MapUnit::MapPixel ); - SetScrolledHdl( LINK( this, XMLFilterListBox, TabBoxScrollHdl_Impl ) ); - SetHighlightRange(); - Show(); - m_pHeaderBar->Show(); -} - -XMLFilterListBox::~XMLFilterListBox() -{ - disposeOnce(); -} - -void XMLFilterListBox::dispose() -{ - m_pHeaderBar.clear(); - SvTabListBox::dispose(); -} - -IMPL_LINK_NOARG( XMLFilterListBox, TabBoxScrollHdl_Impl, SvTreeListBox*, void ) -{ - m_pHeaderBar->SetOffset( -GetXOffset() ); -} - -IMPL_LINK( XMLFilterListBox, HeaderEndDrag_Impl, HeaderBar*, pBar, void ) -{ - if ( pBar && !pBar->GetCurItemId() ) - return; - - if ( !m_pHeaderBar->IsItemMode() ) - { - Size aSz; - sal_uInt16 nTabs = m_pHeaderBar->GetItemCount(); - long nTmpSz = 0; - long nWidth = m_pHeaderBar->GetItemSize(ITEMID_NAME); - long nBarWidth = m_pHeaderBar->GetSizePixel().Width(); - - if(nWidth < 30) - m_pHeaderBar->SetItemSize( ITEMID_TYPE, 30); - else if ( ( nBarWidth - nWidth ) < 30 ) - m_pHeaderBar->SetItemSize( ITEMID_TYPE, nBarWidth - 30 ); - - for ( sal_uInt16 i = 1; i <= nTabs; ++i ) - { - long nW = m_pHeaderBar->GetItemSize(i); - aSz.setWidth( nW + nTmpSz ); - nTmpSz += nW; - SetTab( i, PixelToLogic( aSz, MapMode(MapUnit::MapAppFont) ).Width() ); - } - } -} - /** adds a new filter info entry to the ui filter list */ -void XMLFilterListBox::addFilterEntry( const filter_info_impl* pInfo ) +void XMLFilterSettingsDialog::addFilterEntry( const filter_info_impl* pInfo ) { - const OUString aEntryStr( getEntryString( pInfo ) ); - InsertEntryToColumn( aEntryStr, TREELIST_APPEND, 0xffff, const_cast<filter_info_impl *>(pInfo) ); + int nRow = m_xFilterListBox->n_children(); + OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pInfo))); + m_xFilterListBox->append(sId, pInfo->maFilterName); + m_xFilterListBox->set_text(nRow, getEntryString(pInfo), 1); } -void XMLFilterListBox::changeEntry( const filter_info_impl* pInfo ) +void XMLFilterSettingsDialog::changeEntry( const filter_info_impl* pInfo ) { - const sal_uLong nCount = GetEntryCount(); - sal_uLong nPos; - for( nPos = 0; nPos < nCount; nPos++ ) + const int nCount = m_xFilterListBox->n_children(); + for(int nPos = 0; nPos < nCount; ++nPos) { - SvTreeListEntry* pEntry = GetEntry( nPos ); - if( static_cast<filter_info_impl*>(pEntry->GetUserData()) == pInfo ) + filter_info_impl* pEntry = reinterpret_cast<filter_info_impl*>(m_xFilterListBox->get_id(nPos).toInt64()); + if (pEntry == pInfo) { - OUString aEntryText( getEntryString( pInfo ) ); - SetEntryText( aEntryText, pEntry ); + m_xFilterListBox->set_text(nPos, pInfo->maFilterName, 0); + m_xFilterListBox->set_text(nPos, getEntryString(pInfo), 1); break; } } } -OUString XMLFilterListBox::getEntryString( const filter_info_impl* pInfo ) +OUString XMLFilterSettingsDialog::getEntryString( const filter_info_impl* pInfo ) { - OUString aEntryStr( pInfo->maFilterName + "\t"); + OUString aEntryStr; if ( !pInfo->maExportService.isEmpty() ) - aEntryStr += getApplicationUIName( pInfo->maExportService ); + aEntryStr = getApplicationUIName( pInfo->maExportService ); else - aEntryStr += getApplicationUIName( pInfo->maImportService ); + aEntryStr = getApplicationUIName( pInfo->maImportService ); aEntryStr += " - "; if( pInfo->maFlags & 1 ) diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx index 6c1e89c4a9bd..2db86ee394cb 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx @@ -23,78 +23,29 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/container/XHierarchicalName.hpp> #include <com/sun/star/container/XNameContainer.hpp> -#include <vcl/button.hxx> -#include <vcl/dialog.hxx> -#include <vcl/layout.hxx> -#include <vcl/svtabbx.hxx> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <vcl/weld.hxx> #include <vcl/waitobj.hxx> #include <svl/poolitem.hxx> #include <unotools/moduleoptions.hxx> #include "xmlfiltercommon.hxx" -class HeaderBar; -class XMLFilterListBox; - -class SvxPathControl : public vcl::Window -{ -private: - bool bHasBeenShown; - VclPtr<VclVBox> m_pVBox; - VclPtr<HeaderBar> m_pHeaderBar; - VclPtr<XMLFilterListBox> m_pFocusCtrl; -protected: - virtual void Resize() override; - virtual Size GetOptimalSize() const override; -public: - explicit SvxPathControl(vcl::Window* pParent); - HeaderBar* getHeaderBar() { return m_pHeaderBar; } - XMLFilterListBox* getListBox() { return m_pFocusCtrl; } - virtual ~SvxPathControl() override; - virtual void dispose() override; - - virtual bool EventNotify( NotifyEvent& rNEvt ) override; -}; - -class HeaderBar; - -class XMLFilterListBox : public SvTabListBox -{ -private: - VclPtr<HeaderBar> m_pHeaderBar; - - DECL_LINK( TabBoxScrollHdl_Impl, SvTreeListBox*, void ); - DECL_LINK( HeaderEndDrag_Impl, HeaderBar*, void ); - - static OUString getEntryString( const filter_info_impl* pInfo ); - -public: - XMLFilterListBox(Window* pParent, SvxPathControl* pPathControl); - virtual ~XMLFilterListBox() override; - virtual void dispose() override; - - /** adds a new filter info entry to the ui filter list */ - void addFilterEntry( const filter_info_impl* pInfo ); - - void changeEntry( const filter_info_impl* pInfo ); -}; - - -class XMLFilterSettingsDialog : public ModelessDialog +class XMLFilterSettingsDialog : public weld::GenericDialogController { public: - XMLFilterSettingsDialog(vcl::Window* pParent, - const css::uno::Reference< css::uno::XComponentContext >& rxContext, - Dialog::InitFlag eFlag = Dialog::InitFlag::Default); + XMLFilterSettingsDialog(weld::Window* pParent, + const css::uno::Reference< css::uno::XComponentContext >& rxContext); virtual ~XMLFilterSettingsDialog() override; - virtual void dispose() override; - DECL_LINK(ClickHdl_Impl, Button *, void ); - DECL_LINK(SelectionChangedHdl_Impl, SvTreeListBox*, void ); - DECL_LINK(DoubleClickHdl_Impl, SvTreeListBox*, bool ); + DECL_LINK(ClickHdl_Impl, weld::Button&, void ); + DECL_LINK(SelectionChangedHdl_Impl, weld::TreeView&, void); + DECL_LINK(DoubleClickHdl_Impl, weld::TreeView&, void); void UpdateWindow(); + void present() { m_xDialog->present(); } + void onNew(); void onEdit(); void onTest(); @@ -103,14 +54,11 @@ public: void onOpen(); void updateStates(); - - virtual bool EventNotify( NotifyEvent& rNEvt ) override; - private: void initFilterList(); void disposeFilterList(); - void incBusy() { maBusy.incBusy(this); } + void incBusy() { maBusy.incBusy(m_xDialog.get()); } void decBusy() { maBusy.decBusy(); } bool insertOrEdit( filter_info_impl* pNewInfo, const filter_info_impl* pOldInfo = nullptr ); @@ -119,6 +67,13 @@ private: OUString createUniqueTypeName( const OUString& rTypeName ); OUString createUniqueInterfaceName( const OUString& rInterfaceName ); + /** adds a new filter info entry to the ui filter list */ + void addFilterEntry( const filter_info_impl* pInfo ); + + void changeEntry( const filter_info_impl* pInfo ); + + static OUString getEntryString( const filter_info_impl* pInfo ); + private: css::uno::Reference< css::uno::XComponentContext > mxContext; css::uno::Reference< css::container::XNameContainer > mxFilterContainer; @@ -128,20 +83,20 @@ private: std::vector< std::unique_ptr<filter_info_impl> > maFilterVector; TopLevelWindowLocker maBusy; - VclPtr<XMLFilterListBox> m_pFilterListBox; - VclPtr<SvxPathControl> m_pCtrlFilterList; - VclPtr<PushButton> m_pPBNew; - VclPtr<PushButton> m_pPBEdit; - VclPtr<PushButton> m_pPBTest; - VclPtr<PushButton> m_pPBDelete; - VclPtr<PushButton> m_pPBSave; - VclPtr<PushButton> m_pPBOpen; - VclPtr<CloseButton> m_pPBClose; OUString m_sTemplatePath; OUString m_sDocTypePrefix; SvtModuleOptions maModuleOpt; + + std::unique_ptr<weld::Button> m_xPBNew; + std::unique_ptr<weld::Button> m_xPBEdit; + std::unique_ptr<weld::Button> m_xPBTest; + std::unique_ptr<weld::Button> m_xPBDelete; + std::unique_ptr<weld::Button> m_xPBSave; + std::unique_ptr<weld::Button> m_xPBOpen; + std::unique_ptr<weld::Button> m_xPBClose; + std::unique_ptr<weld::TreeView> m_xFilterListBox; }; #endif diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.cxx b/filter/source/xsltdialog/xmlfiltertabdialog.cxx index 3d05f25f15e3..d02b8cbcd2f9 100644 --- a/filter/source/xsltdialog/xmlfiltertabdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertabdialog.cxx @@ -22,6 +22,7 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <comphelper/fileurl.hxx> #include <unotools/resmgr.hxx> +#include <vcl/svapp.hxx> #include <vcl/weld.hxx> #include <osl/file.hxx> diff --git a/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx b/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx index af2b6148d51f..abfa596c4d09 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx +++ b/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx @@ -18,7 +18,7 @@ */ #include <rtl/ustrbuf.hxx> - +#include <vcl/svapp.hxx> #include <strings.hrc> #include "xmlfiltertabpagebasic.hxx" #include "xmlfiltersettingsdialog.hxx" diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx index 5455ba82c738..8bd97ca2823b 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx +++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx @@ -23,6 +23,7 @@ #include <unotools/pathoptions.hxx> #include <osl/file.hxx> #include <svl/urihelper.hxx> +#include <vcl/svapp.hxx> #include "xmlfiltertabpagexslt.hxx" #include "xmlfiltersettingsdialog.hxx" diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx index cff46da8580c..684329f438a8 100644 --- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/system/SystemShellExecute.hpp> #include <com/sun/star/system/SystemShellExecuteFlags.hpp> #include <com/sun/star/task/InteractionHandler.hpp> @@ -41,6 +42,7 @@ #include <sfx2/filedlghelper.hxx> #include <osl/file.hxx> #include <unotools/tempfile.hxx> +#include <tools/debug.hxx> #include <tools/urlobj.hxx> #include <comphelper/processfactory.hxx> diff --git a/filter/uiconfig/ui/xmlfiltersettings.ui b/filter/uiconfig/ui/xmlfiltersettings.ui index 2161e87a12e7..bee858e3211b 100644 --- a/filter/uiconfig/ui/xmlfiltersettings.ui +++ b/filter/uiconfig/ui/xmlfiltersettings.ui @@ -1,14 +1,28 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> +<!-- Generated with glade 3.22.1 --> <interface domain="flt"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> + <object class="GtkTreeStore" id="liststore3"> + <columns> + <!-- column-name text --> + <column type="gchararray"/> + <!-- column-name text2 --> + <column type="gchararray"/> + <!-- column-name id --> + <column type="gchararray"/> + </columns> + </object> <object class="GtkDialog" id="XMLFilterSettingsDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="xmlfiltersettings|XMLFilterSettingsDialog">XML Filter Settings</property> <property name="resizable">False</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> @@ -63,13 +77,51 @@ <property name="can_focus">False</property> <property name="spacing">12</property> <child> - <object class="xsltdlglo-SvxPathControl" id="filterlist"> - <property name="height_request">100</property> + <object class="GtkScrolledWindow"> <property name="visible">True</property> - <property name="can_focus">False</property> - <child internal-child="accessible"> - <object class="AtkObject" id="filterlist-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes" context="xmlfiltersettings|filterlist-atkobject">XML Filter List</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkTreeView" id="filterlist"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="model">liststore3</property> + <property name="search_column">0</property> + <property name="show_expanders">False</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="Macro Library List-selection2"/> + </child> + <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn3"> + <property name="resizable">True</property> + <property name="spacing">6</property> + <property name="title" translatable="yes" context="xmlfiltersettings|header_name">Name</property> + <child> + <object class="GtkCellRendererText" id="cellrenderer1"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> + </child> + <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn4"> + <property name="resizable">True</property> + <property name="spacing">6</property> + <property name="title" translatable="yes" context="xmlfiltersettings|header_type">Type</property> + <child> + <object class="GtkCellRendererText" id="cellrenderer2"/> + <attributes> + <attribute name="text">1</attribute> + </attributes> + </child> + </object> + </child> </object> </child> </object> @@ -84,6 +136,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="orientation">vertical</property> + <property name="spacing">3</property> <property name="homogeneous">True</property> <property name="layout_style">start</property> <child> diff --git a/include/vcl/waitobj.hxx b/include/vcl/waitobj.hxx index 858f49d4ae9b..15f4bdd29738 100644 --- a/include/vcl/waitobj.hxx +++ b/include/vcl/waitobj.hxx @@ -22,6 +22,7 @@ #include <vcl/dllapi.h> #include <vcl/window.hxx> +#include <vcl/weld.hxx> #include <stack> #include <vector> @@ -46,7 +47,7 @@ private: std::stack<std::vector<VclPtr<vcl::Window>>> m_aBusyStack; public: // lock all toplevels, except the argument - void incBusy(const vcl::Window* pIgnore); + void incBusy(const weld::Window* pIgnore); // unlock previous lock void decBusy(); bool isBusy() const { return !m_aBusyStack.empty(); } diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index f258b83c2cd5..83f0809ec906 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -740,6 +740,7 @@ public: virtual void clear() = 0; virtual int get_height_rows(int nRows) const = 0; + virtual void columns_autosize() = 0; virtual void set_column_fixed_widths(const std::vector<int>& rWidths) = 0; virtual int get_column_width(int nCol) const = 0; virtual OUString get_column_title(int nColumn) const = 0; diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 8567731b0b77..c75ada768e88 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -1124,8 +1124,9 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const if(bShowOfflineHelpPopUp) { - aBusy.incBusy(pWindow); - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWindow ? pWindow->GetFrameWeld() : nullptr, "sfx/ui/helpmanual.ui")); + weld::Window* pWeldWindow = pWindow ? pWindow->GetFrameWeld() : nullptr; + aBusy.incBusy(pWeldWindow); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWeldWindow, "sfx/ui/helpmanual.ui")); std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("onlinehelpmanual")); std::unique_ptr<weld::CheckButton> m_xHideOfflineHelpCB(xBuilder->weld_check_button("hidedialog")); LanguageTag aLangTag = Application::GetSettings().GetUILanguageTag(); @@ -1143,8 +1144,9 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const return true; else { - aBusy.incBusy(pWindow); - NoHelpErrorBox aErrBox(pWindow ? pWindow->GetFrameWeld() : nullptr); + weld::Window* pWeldWindow = pWindow ? pWindow->GetFrameWeld() : nullptr; + aBusy.incBusy(pWeldWindow); + NoHelpErrorBox aErrBox(pWeldWindow); aErrBox.run(); aBusy.decBusy(); return false; diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index 46f667532c23..ee920c14c18a 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -507,7 +507,6 @@ custom_widgets = [ 'SvxLanguageComboBox', 'SvxLightCtl3D', 'SvxNoSpaceEdit', - 'SvxPathControl', 'SvxRelativeField', 'SvxTextEncodingBox', 'SvxTextEncodingBox', diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 435a8f6f0556..b07ff29b08b4 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -2278,6 +2278,7 @@ private: int m_nSortColumn; DECL_LINK(SelectHdl, SvTreeListBox*, void); + DECL_LINK(DeSelectHdl, SvTreeListBox*, void); DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool); DECL_LINK(ExpandingHdl, SvTreeListBox*, bool); DECL_LINK(EndDragHdl, HeaderBar*, void); @@ -2296,6 +2297,7 @@ public: { m_xTreeView->SetNodeDefaultImages(); m_xTreeView->SetSelectHdl(LINK(this, SalInstanceTreeView, SelectHdl)); + m_xTreeView->SetDeselectHdl(LINK(this, SalInstanceTreeView, DeSelectHdl)); m_xTreeView->SetDoubleClickHdl(LINK(this, SalInstanceTreeView, DoubleClickHdl)); m_xTreeView->SetExpandingHdl(LINK(this, SalInstanceTreeView, ExpandingHdl)); const long aTabPositions[] = { 0 }; @@ -2320,6 +2322,19 @@ public: m_aRadioButtonData.SetLink(LINK(this, SalInstanceTreeView, ToggleHdl)); } + virtual void columns_autosize() override + { + std::vector<long> aWidths; + m_xTreeView->getPreferredDimensions(aWidths); + if (aWidths.size() > 2) + { + std::vector<int> aColWidths; + for (size_t i = 1; i < aWidths.size() - 1; ++i) + aColWidths.push_back(aWidths[i] - aWidths[i - 1]); + set_column_fixed_widths(aColWidths); + } + } + virtual void set_column_fixed_widths(const std::vector<int>& rWidths) override { std::vector<long> aTabPositions; @@ -3163,6 +3178,7 @@ public: m_xTreeView->SetExpandingHdl(Link<SvTreeListBox*, bool>()); m_xTreeView->SetDoubleClickHdl(Link<SvTreeListBox*, bool>()); m_xTreeView->SetSelectHdl(Link<SvTreeListBox*, void>()); + m_xTreeView->SetDeselectHdl(Link<SvTreeListBox*, void>()); m_xTreeView->SetScrolledHdl(Link<SvTreeListBox*, void>()); } }; @@ -3249,6 +3265,15 @@ IMPL_LINK_NOARG(SalInstanceTreeView, SelectHdl, SvTreeListBox*, void) signal_changed(); } +IMPL_LINK_NOARG(SalInstanceTreeView, DeSelectHdl, SvTreeListBox*, void) +{ + if (notify_events_disabled()) + return; + if (m_xTreeView->GetSelectionMode() == SelectionMode::Single) + return; + signal_changed(); +} + IMPL_LINK_NOARG(SalInstanceTreeView, DoubleClickHdl, SvTreeListBox*, bool) { if (notify_events_disabled()) diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 1aeceee16f95..e34ff81f6148 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -1572,14 +1572,14 @@ void Dialog::Activate() SystemWindow::Activate(); } -void TopLevelWindowLocker::incBusy(const vcl::Window* pIgnore) +void TopLevelWindowLocker::incBusy(const weld::Window* pIgnore) { // lock any toplevel windows from being closed until busy is over std::vector<VclPtr<vcl::Window>> aTopLevels; vcl::Window *pTopWin = Application::GetFirstTopLevelWindow(); while (pTopWin) { - if (pTopWin != pIgnore) + if (pTopWin->GetFrameWeld() != pIgnore) aTopLevels.push_back(pTopWin); pTopWin = Application::GetNextTopLevelWindow(pTopWin); } diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 3a3864398f48..d02fbad31146 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -5953,6 +5953,11 @@ public: m_nRowInsertedSignalId = g_signal_connect(pModel, "row-inserted", G_CALLBACK(signalRowInserted), this); } + virtual void columns_autosize() override + { + gtk_tree_view_columns_autosize(m_pTreeView); + } + virtual void set_column_fixed_widths(const std::vector<int>& rWidths) override { GList* pEntry = g_list_first(m_pColumns); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits