[Libreoffice-commits] core.git: 2 commits - extensions/source extensions/uiconfig include/svx sd/source svx/source svx/uiconfig
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sun Oct 7 17:44:53 UTC 2018
extensions/source/propctrlr/formcomponenthandler.cxx | 6 -
extensions/source/propctrlr/listselectiondlg.cxx | 60 +++++---------
extensions/source/propctrlr/listselectiondlg.hxx | 22 +----
extensions/uiconfig/spropctrlr/ui/listselectdialog.ui | 50 +++++++++++-
include/svx/fontworkgallery.hxx | 20 ----
sd/source/ui/dlg/RemoteDialogClientBox.hxx | 1
svx/source/tbxctrls/fontworkgallery.cxx | 18 +---
svx/source/toolbars/fontworkbar.cxx | 8 -
svx/uiconfig/ui/fontworkspacingdialog.ui | 73 +++++++++---------
9 files changed, 132 insertions(+), 126 deletions(-)
New commits:
commit cf5a2fbbdaace0cbf0e7cbb39e280ec900a82b08
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Oct 6 21:23:13 2018 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Oct 7 19:44:44 2018 +0200
weld FontworkCharacterSpacingDialog
Change-Id: I847c705ae486f9c83877ff3092ebf904e9332e63
Reviewed-on: https://gerrit.libreoffice.org/61483
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/svx/fontworkgallery.hxx b/include/svx/fontworkgallery.hxx
index 58ff23d34698..610b0ad96452 100644
--- a/include/svx/fontworkgallery.hxx
+++ b/include/svx/fontworkgallery.hxx
@@ -22,40 +22,28 @@
#define INCLUDED_SVX_FONTWORKGALLERY_HXX
#include <svx/svxdllapi.h>
-
-#include <vcl/fixed.hxx>
-#include <vcl/button.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/field.hxx>
-#include <vcl/weld.hxx>
-
#include <svtools/valueset.hxx>
-
#include <sfx2/tbxctrl.hxx>
-
+#include <vcl/weld.hxx>
#include <vector>
class FmFormModel;
class SdrView;
-namespace vcl { class Window; }
class SdrTextObj;
class SdrObject;
class SdrModel;
-
class SfxBindings;
-
namespace svx
{
-class SAL_WARN_UNUSED FontworkCharacterSpacingDialog : public ModalDialog
+class SAL_WARN_UNUSED FontworkCharacterSpacingDialog : public weld::GenericDialogController
{
- VclPtr<MetricField> m_pMtrScale;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrScale;
public:
- FontworkCharacterSpacingDialog( vcl::Window* pParent, sal_Int32 nScale );
+ FontworkCharacterSpacingDialog(weld::Window* pParent, sal_Int32 nScale);
virtual ~FontworkCharacterSpacingDialog() override;
- virtual void dispose() override;
sal_Int32 getScale() const;
};
diff --git a/sd/source/ui/dlg/RemoteDialogClientBox.hxx b/sd/source/ui/dlg/RemoteDialogClientBox.hxx
index c839165a79cc..6ab8522d65f3 100644
--- a/sd/source/ui/dlg/RemoteDialogClientBox.hxx
+++ b/sd/source/ui/dlg/RemoteDialogClientBox.hxx
@@ -24,7 +24,6 @@
#include <vcl/scrbar.hxx>
#include <vcl/fixed.hxx>
#include <vcl/button.hxx>
-#include <vcl/dialog.hxx>
#include <vcl/field.hxx>
#include <svtools/extensionlistbox.hxx>
diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx
index 65243aad0fc2..700a0c852bc8 100644
--- a/svx/source/tbxctrls/fontworkgallery.cxx
+++ b/svx/source/tbxctrls/fontworkgallery.cxx
@@ -624,28 +624,20 @@ com_sun_star_comp_svx_FontworkCharacterSpacingControl_get_implementation(
return cppu::acquire(new FontworkCharacterSpacingControl(xContext));
}
-
-FontworkCharacterSpacingDialog::FontworkCharacterSpacingDialog( vcl::Window* pParent, sal_Int32 nScale )
-: ModalDialog( pParent, "FontworkSpacingDialog" , "svx/ui/fontworkspacingdialog.ui" )
+FontworkCharacterSpacingDialog::FontworkCharacterSpacingDialog(weld::Window* pParent, sal_Int32 nScale)
+ : GenericDialogController(pParent, "svx/ui/fontworkspacingdialog.ui", "FontworkSpacingDialog")
+ , m_xMtrScale(m_xBuilder->weld_metric_spin_button("entry", FUNIT_PERCENT))
{
- get(m_pMtrScale, "entry");
- m_pMtrScale->SetValue( nScale );
+ m_xMtrScale->set_value(nScale, FUNIT_PERCENT);
}
FontworkCharacterSpacingDialog::~FontworkCharacterSpacingDialog()
{
- disposeOnce();
-}
-
-void FontworkCharacterSpacingDialog::dispose()
-{
- m_pMtrScale.clear();
- ModalDialog::dispose();
}
sal_Int32 FontworkCharacterSpacingDialog::getScale() const
{
- return static_cast<sal_Int32>(m_pMtrScale->GetValue());
+ return static_cast<sal_Int32>(m_xMtrScale->get_value(FUNIT_PERCENT));
}
}
diff --git a/svx/source/toolbars/fontworkbar.cxx b/svx/source/toolbars/fontworkbar.cxx
index f5283818191b..90b05316fdc0 100644
--- a/svx/source/toolbars/fontworkbar.cxx
+++ b/svx/source/toolbars/fontworkbar.cxx
@@ -471,11 +471,11 @@ void FontworkBar::execute( SdrView* pSdrView, SfxRequest const & rReq, SfxBindin
if( rReq.GetArgs() && ( rReq.GetArgs()->GetItemState( SID_FONTWORK_CHARACTER_SPACING ) == SfxItemState::SET ) )
{
sal_Int32 nCharSpacing = rReq.GetArgs()->GetItem<SfxInt32Item>(SID_FONTWORK_CHARACTER_SPACING)->GetValue();
- ScopedVclPtrInstance< FontworkCharacterSpacingDialog > aDlg( nullptr, nCharSpacing );
- sal_uInt16 nRet = aDlg->Execute();
- if( nRet != 0 )
+ FontworkCharacterSpacingDialog aDlg(rReq.GetFrameWeld(), nCharSpacing);
+ sal_uInt16 nRet = aDlg.run();
+ if (nRet != RET_CANCEL)
{
- SfxInt32Item aItem( SID_FONTWORK_CHARACTER_SPACING, aDlg->getScale() );
+ SfxInt32Item aItem(SID_FONTWORK_CHARACTER_SPACING, aDlg.getScale());
SfxPoolItem* aItems[] = { &aItem, nullptr };
rBindings.Execute( SID_FONTWORK_CHARACTER_SPACING, const_cast<const SfxPoolItem**>(aItems) );
}
diff --git a/svx/uiconfig/ui/fontworkspacingdialog.ui b/svx/uiconfig/ui/fontworkspacingdialog.ui
index d9a2817193de..f3315831a723 100644
--- a/svx/uiconfig/ui/fontworkspacingdialog.ui
+++ b/svx/uiconfig/ui/fontworkspacingdialog.ui
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
<interface domain="svx">
- <!-- interface-requires gtk+ 3.0 -->
+ <requires lib="gtk+" version="3.0"/>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">500</property>
<property name="value">100</property>
@@ -12,42 +13,51 @@
<property name="border_width">6</property>
<property name="title" translatable="yes" context="fontworkspacingdialog|FontworkSpacingDialog">Fontwork Character Spacing</property>
<property name="resizable">False</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>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
- <child>
- <object class="GtkBox" id="box1">
- <property name="visible">True</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
- <property name="valign">start</property>
- <property name="hexpand">True</property>
- <property name="spacing">12</property>
+ <property name="layout_style">end</property>
<child>
- <object class="GtkLabel" id="label2">
+ <object class="GtkButton" id="ok">
+ <property name="label">gtk-ok</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="fontworkspacingdialog|label2">_Value:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">entry:0%</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>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
+ <property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="entry:0%">
+ <object class="GtkButton" id="cancel">
+ <property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="adjustment">adjustment1</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
+ <property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
@@ -55,42 +65,40 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
</packing>
</child>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area1">
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="layout_style">end</property>
+ <property name="valign">start</property>
+ <property name="hexpand">True</property>
+ <property name="spacing">12</property>
<child>
- <object class="GtkButton" id="ok">
- <property name="label">gtk-ok</property>
+ <object class="GtkLabel" id="label2">
<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>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="fontworkspacingdialog|label2">_Value:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">entry</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="cancel">
- <property name="label">gtk-cancel</property>
+ <object class="GtkSpinButton" id="entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
+ <property name="adjustment">adjustment1</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
@@ -98,8 +106,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">1</property>
+ <property name="position">0</property>
</packing>
</child>
</object>
commit 52f3046842ccb2a81e8eef6c744330567512e55b
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Oct 6 21:13:17 2018 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Oct 7 19:44:31 2018 +0200
weld ListSelectionDialog
Change-Id: Id2aaec88bd864167e0815ddb675c27b10331247f
Reviewed-on: https://gerrit.libreoffice.org/61482
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index 5baaa7b5bbdd..f5b565884e1f 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -2520,18 +2520,16 @@ namespace pcr
}
}
-
bool FormComponentPropertyHandler::impl_dialogListSelection_nothrow( const OUString& _rProperty, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
{
OSL_PRECOND( m_pInfoService.get(), "FormComponentPropertyHandler::impl_dialogListSelection_nothrow: no property meta data!" );
OUString sPropertyUIName( m_pInfoService->getPropertyTranslation( m_pInfoService->getPropertyId( _rProperty ) ) );
- ScopedVclPtrInstance< ListSelectionDialog > aDialog( impl_getDefaultDialogParent_nothrow(), m_xComponent, _rProperty, sPropertyUIName );
+ ListSelectionDialog aDialog(impl_getDefaultDialogFrame_nothrow(), m_xComponent, _rProperty, sPropertyUIName);
_rClearBeforeDialog.clear();
- return ( RET_OK == aDialog->Execute() );
+ return ( RET_OK == aDialog.execute() );
}
-
bool FormComponentPropertyHandler::impl_dialogFilterOrSort_nothrow( bool _bFilter, OUString& _out_rSelectedClause, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const
{
OSL_PRECOND( Reference< XRowSet >( m_xComponent, UNO_QUERY ).is(),
diff --git a/extensions/source/propctrlr/listselectiondlg.cxx b/extensions/source/propctrlr/listselectiondlg.cxx
index a3f1d79d8b56..0e8becb48f9d 100644
--- a/extensions/source/propctrlr/listselectiondlg.cxx
+++ b/extensions/source/propctrlr/listselectiondlg.cxx
@@ -29,39 +29,31 @@ namespace pcr
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
- ListSelectionDialog::ListSelectionDialog(vcl::Window* _pParent, const Reference< XPropertySet >& _rxListBox,
+ ListSelectionDialog::ListSelectionDialog(weld::Window* pParent, const Reference< XPropertySet >& _rxListBox,
const OUString& _rPropertyName, const OUString& _rPropertyUIName)
- : ModalDialog( _pParent, "ListSelectDialog", "modules/spropctrlr/ui/listselectdialog.ui" )
- ,m_xListBox ( _rxListBox )
- ,m_sPropertyName( _rPropertyName )
+ : GenericDialogController(pParent, "modules/spropctrlr/ui/listselectdialog.ui", "ListSelectDialog")
+ , m_xListBox ( _rxListBox )
+ , m_sPropertyName( _rPropertyName )
+ , m_xFrame(m_xBuilder->weld_frame("frame"))
+ , m_xEntries(m_xBuilder->weld_tree_view("treeview"))
{
OSL_PRECOND( m_xListBox.is(), "ListSelectionDialog::ListSelectionDialog: invalid list box!" );
- get(m_pEntries, "treeview");
- Size aSize(LogicToPixel(Size(85, 97), MapMode(MapUnit::MapAppFont)));
- m_pEntries->set_width_request(aSize.Width());
- m_pEntries->set_height_request(aSize.Height());
+ m_xEntries->set_size_request(m_xEntries->get_approximate_digit_width() * 40, m_xEntries->get_height_rows(9));
- SetText(_rPropertyUIName);
- get<VclFrame>("frame")->set_label(_rPropertyUIName);
+ m_xDialog->set_title(_rPropertyUIName);
+ m_xFrame->set_label(_rPropertyUIName);
initialize( );
}
ListSelectionDialog::~ListSelectionDialog()
{
- disposeOnce();
}
- void ListSelectionDialog::dispose()
+ short ListSelectionDialog::execute()
{
- m_pEntries.clear();
- ModalDialog::dispose();
- }
-
- short ListSelectionDialog::Execute()
- {
- short nResult = ModalDialog::Execute();
+ short nResult = m_xDialog->run();
if ( RET_OK == nResult )
commitSelection();
@@ -75,14 +67,12 @@ namespace pcr
if ( !m_xListBox.is() )
return;
- m_pEntries->SetStyle( GetStyle() | WB_SIMPLEMODE );
-
try
{
// initialize the multi-selection flag
bool bMultiSelection = false;
OSL_VERIFY( m_xListBox->getPropertyValue( PROPERTY_MULTISELECTION ) >>= bMultiSelection );
- m_pEntries->EnableMultiSelection( bMultiSelection );
+ m_xEntries->set_selection_mode(bMultiSelection);
// fill the list box with all entries
Sequence< OUString > aListEntries;
@@ -100,7 +90,6 @@ namespace pcr
}
}
-
void ListSelectionDialog::commitSelection()
{
if ( !m_xListBox.is() )
@@ -119,29 +108,28 @@ namespace pcr
}
}
-
void ListSelectionDialog::fillEntryList( const Sequence< OUString >& _rListEntries )
{
- m_pEntries->Clear();
- for ( auto const & entry : _rListEntries )
- m_pEntries->InsertEntry( entry );
+ m_xEntries->freeze();
+ m_xEntries->clear();
+ for (auto const & entry : _rListEntries)
+ m_xEntries->append_text(entry);
+ m_xEntries->thaw();
}
-
void ListSelectionDialog::collectSelection( std::vector< sal_Int16 >& /* [out] */ _rSelection )
{
- const sal_Int32 nSelectedCount = m_pEntries->GetSelectedEntryCount( );
- _rSelection.resize( nSelectedCount );
- for ( sal_Int32 selected = 0; selected < nSelectedCount; ++selected )
- _rSelection[selected] = static_cast< sal_Int16 >( m_pEntries->GetSelectedEntryPos( selected ) );
+ auto aSelection = m_xEntries->get_selected_rows();
+ _rSelection.resize(aSelection.size());
+ for (auto row : aSelection)
+ _rSelection.push_back(row);
}
-
void ListSelectionDialog::selectEntries( const Sequence< sal_Int16 >& /* [in ] */ _rSelection )
{
- m_pEntries->SetNoSelection();
- for ( auto const & selection : _rSelection )
- m_pEntries->SelectEntryPos( selection );
+ m_xEntries->unselect_all();
+ for (auto const & selection : _rSelection)
+ m_xEntries->select(selection);
}
diff --git a/extensions/source/propctrlr/listselectiondlg.hxx b/extensions/source/propctrlr/listselectiondlg.hxx
index 1d2d9b08b0cb..e8b493132998 100644
--- a/extensions/source/propctrlr/listselectiondlg.hxx
+++ b/extensions/source/propctrlr/listselectiondlg.hxx
@@ -20,35 +20,30 @@
#ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_LISTSELECTIONDLG_HXX
#define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_LISTSELECTIONDLG_HXX
-#include <vcl/dialog.hxx>
-#include <vcl/layout.hxx>
-#include <vcl/lstbox.hxx>
+#include <vcl/weld.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
namespace pcr
{
- class ListSelectionDialog : public ModalDialog
+ class ListSelectionDialog : public weld::GenericDialogController
{
private:
- VclPtr<ListBox> m_pEntries;
-
- css::uno::Reference< css::beans::XPropertySet >
- m_xListBox;
- OUString m_sPropertyName;
+ css::uno::Reference<css::beans::XPropertySet> m_xListBox;
+ OUString m_sPropertyName;
+ std::unique_ptr<weld::Frame> m_xFrame;
+ std::unique_ptr<weld::TreeView> m_xEntries;
public:
ListSelectionDialog(
- vcl::Window* _pParent,
+ weld::Window* _pParent,
const css::uno::Reference< css::beans::XPropertySet >& _rxListBox,
const OUString& _rPropertyName,
const OUString& _rPropertyUIName
);
virtual ~ListSelectionDialog() override;
- virtual void dispose() override;
- // Dialog overridables
- virtual short Execute() override;
+ short execute();
private:
void initialize( );
@@ -60,7 +55,6 @@ namespace pcr
void collectSelection( std::vector< sal_Int16 >& /* [out] */ _rSelection );
};
-
} // namespacepcr
diff --git a/extensions/uiconfig/spropctrlr/ui/listselectdialog.ui b/extensions/uiconfig/spropctrlr/ui/listselectdialog.ui
index 28683b62addd..19a3740fca47 100644
--- a/extensions/uiconfig/spropctrlr/ui/listselectdialog.ui
+++ b/extensions/uiconfig/spropctrlr/ui/listselectdialog.ui
@@ -1,11 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="pcr">
<requires lib="gtk+" version="3.18"/>
+ <object class="GtkListStore" id="liststore2">
+ <columns>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkDialog" id="ListSelectDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
+ <property name="modal">True</property>
+ <property name="default_width">0</property>
+ <property name="default_height">0</property>
<property name="type_hint">normal</property>
+ <child>
+ <placeholder/>
+ </child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
@@ -85,11 +99,37 @@
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
- <object class="GtkTreeView" id="treeview:border">
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection2"/>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="model">liststore2</property>
+ <property name="headers_visible">False</property>
+ <property name="headers_clickable">False</property>
+ <property name="search_column">0</property>
+ <property name="show_expanders">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection2"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn2">
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext2"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
</child>
</object>
</child>
More information about the Libreoffice-commits
mailing list