Kaydet (Commit) 08127638 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld XMLFilterSettingsDialog

Change-Id: Ia027fa0b5e99651988f2447bf29f6f5653dd0c48
Reviewed-on: https://gerrit.libreoffice.org/70139
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 33c1389a
......@@ -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);
......
......@@ -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"/>
......
......@@ -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")
......
......@@ -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;
......
......@@ -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>
......
......@@ -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
......
......@@ -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>
......
......@@ -18,7 +18,7 @@
*/
#include <rtl/ustrbuf.hxx>
#include <vcl/svapp.hxx>
#include <strings.hrc>
#include "xmlfiltertabpagebasic.hxx"
#include "xmlfiltersettingsdialog.hxx"
......
......@@ -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"
......
......@@ -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>
......
<?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>
......
......@@ -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(); }
......
......@@ -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;
......
......@@ -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;
......
......@@ -507,7 +507,6 @@ custom_widgets = [
'SvxLanguageComboBox',
'SvxLightCtl3D',
'SvxNoSpaceEdit',
'SvxPathControl',
'SvxRelativeField',
'SvxTextEncodingBox',
'SvxTextEncodingBox',
......
......@@ -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())
......
......@@ -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);
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment