remove MetricField use from cui

Change-Id: I10729db9ae465a714657b58cbfa67bed47a6c7f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88726
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2020-02-14 15:31:59 +00:00
parent 1b2fcca411
commit 14cb677a43
4 changed files with 97 additions and 10 deletions

View File

@@ -206,6 +206,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
cui/uiconfig/ui/tsaurldialog \
cui/uiconfig/ui/twolinespage \
cui/uiconfig/ui/wordcompletionpage \
cui/uiconfig/ui/spinbox \
cui/uiconfig/ui/zoomdialog \
))

View File

@@ -31,7 +31,6 @@
#include <tools/fract.hxx>
#include <svx/svxids.hrc>
#include <strings.hrc>
#include <vcl/field.hxx>
#include <vcl/fieldvalues.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
@@ -627,16 +626,20 @@ void SvxGrfCropPage::GraphicHasChanged( bool bFound )
// display original size
const FieldUnit eMetric = GetModuleFieldUnit( GetItemSet() );
ScopedVclPtrInstance< MetricField > aFld(Application::GetDefDialogParent(), WB_HIDE);
SetFieldUnit( *aFld, eMetric );
aFld->SetDecimalDigits(m_xWidthMF->get_digits());
aFld->SetMax( LONG_MAX - 1 );
OUString sTemp;
{
std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "cui/ui/spinbox.ui"));
std::unique_ptr<weld::MetricSpinButton> xFld(xBuilder->weld_metric_spin_button("spin", FieldUnit::CM));
SetFieldUnit( *xFld, eMetric );
xFld->set_digits(m_xWidthMF->get_digits());
xFld->set_max(INT_MAX - 1, FieldUnit::NONE);
aFld->SetValue( aFld->Normalize( aOrigSize.Width() ), eUnit );
OUString sTemp = aFld->GetText();
aFld->SetValue( aFld->Normalize( aOrigSize.Height() ), eUnit );
// multiplication sign (U+00D7)
sTemp += u"\u00D7" + aFld->GetText();
xFld->set_value(xFld->normalize(aOrigSize.Width()), eUnit);
sTemp = xFld->get_text();
xFld->set_value(xFld->normalize(aOrigSize.Height()), eUnit);
// multiplication sign (U+00D7)
sTemp += u"\u00D7" + xFld->get_text();
}
if ( aOrigPixelSize.Width() && aOrigPixelSize.Height() ) {
sal_Int32 ax = sal_Int32(floor(static_cast<float>(aOrigPixelSize.Width()) /

View File

@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="SpinDialog">
<property name="can_focus">False</property>
<property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="SpinBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkSpinButton" id="spin">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="adjustment">adjustment1</property>
<property name="value">1</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-5">ok</action-widget>
</action-widgets>
</object>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">1</property>
<property name="upper">100000</property>
<property name="value">1</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
</interface>

View File

@@ -290,6 +290,7 @@ cui/uiconfig/ui/spellingdialog.ui://GtkLabel[@id='explain'] orphan-label
cui/uiconfig/ui/spellingdialog.ui://GtkLabel[@id='resumeft'] orphan-label
cui/uiconfig/ui/spellingdialog.ui://GtkLabel[@id='nosuggestionsft'] orphan-label
cui/uiconfig/ui/spellingdialog.ui://GtkLabel[@id='alttitleft'] orphan-label
cui/uiconfig/ui/spinbox.ui://GtkSpinButton[@id='spin'] no-labelled-by
cui/uiconfig/ui/storedwebconnectiondialog.ui://GtkLabel[@id='label1'] orphan-label
cui/uiconfig/ui/textanimtabpage.ui://GtkLabel[@id='FT_COUNT'] orphan-label
cui/uiconfig/ui/textanimtabpage.ui://GtkLabel[@id='FT_AMOUNT'] orphan-label