[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - cui/source cui/uiconfig
Caolán McNamara
caolanm at redhat.com
Tue May 29 08:06:46 UTC 2018
cui/source/inc/transfrm.hxx | 24 +++----
cui/source/tabpages/transfrm.cxx | 113 ++++++++++++----------------------
cui/uiconfig/ui/slantcornertabpage.ui | 68 ++++++++++++++------
3 files changed, 101 insertions(+), 104 deletions(-)
New commits:
commit 9f1fb000a50f38e45b68b4cb14cb4f7f9c514f82
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri May 25 16:19:52 2018 +0100
weld SvxSlantTabPage
Change-Id: Ib3b1bf1fa434c63b66f388a1f1815787b642fb88
Reviewed-on: https://gerrit.libreoffice.org/54967
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/cui/source/inc/transfrm.hxx b/cui/source/inc/transfrm.hxx
index 959cd6bd8f4d..7e7aa264f91b 100644
--- a/cui/source/inc/transfrm.hxx
+++ b/cui/source/inc/transfrm.hxx
@@ -227,17 +227,6 @@ class SvxSlantTabPage : public SvxTabPage
static const sal_uInt16 pSlantRanges[];
private:
- VclPtr<VclFrame> m_pFlRadius;
- VclPtr<MetricField> m_pMtrRadius;
- VclPtr<VclFrame> m_pFlAngle;
- VclPtr<MetricField> m_pMtrAngle;
-
- VclPtr<VclFrame> m_aControlGroups[2];
- VclPtr<VclContainer> m_aControlGroupX[2];
- VclPtr<MetricField> m_aControlX[2];
- VclPtr<VclContainer> m_aControlGroupY[2];
- VclPtr<MetricField> m_aControlY[2];
-
const SfxItemSet& rOutAttrs;
const SdrView* pView;
@@ -248,10 +237,19 @@ private:
MapUnit ePoolUnit;
FieldUnit eDlgUnit;
+ std::unique_ptr<weld::Widget> m_xFlRadius;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrRadius;
+ std::unique_ptr<weld::Widget> m_xFlAngle;
+ std::unique_ptr<weld::MetricSpinButton> m_xMtrAngle;
+ std::unique_ptr<weld::Widget> m_aControlGroups[2];
+ std::unique_ptr<weld::Widget> m_aControlGroupX[2];
+ std::unique_ptr<weld::MetricSpinButton> m_aControlX[2];
+ std::unique_ptr<weld::Widget> m_aControlGroupY[2];
+ std::unique_ptr<weld::MetricSpinButton> m_aControlY[2];
+
public:
- SvxSlantTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs );
+ SvxSlantTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs);
virtual ~SvxSlantTabPage() override;
- virtual void dispose() override;
static VclPtr<SfxTabPage> Create( TabPageParent, const SfxItemSet* );
static const sal_uInt16* GetRanges() { return pSlantRanges; }
diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx
index 0e67b85261b9..b37d366f2f0b 100644
--- a/cui/source/tabpages/transfrm.cxx
+++ b/cui/source/tabpages/transfrm.cxx
@@ -320,13 +320,11 @@ void SvxAngleTabPage::Reset(const SfxItemSet* rAttrs)
m_pCtlAngle->SaveValue();
}
-
VclPtr<SfxTabPage> SvxAngleTabPage::Create( TabPageParent pWindow, const SfxItemSet* rSet)
{
return VclPtr<SvxAngleTabPage>::Create(pWindow.pParent, *rSet);
}
-
void SvxAngleTabPage::ActivatePage(const SfxItemSet& rSet)
{
SfxBoolItem const * bPosProtect = nullptr;
@@ -337,7 +335,6 @@ void SvxAngleTabPage::ActivatePage(const SfxItemSet& rSet)
}
}
-
DeactivateRC SvxAngleTabPage::DeactivatePage( SfxItemSet* _pSet )
{
if(_pSet)
@@ -422,25 +419,23 @@ void SvxAngleTabPage::PointChanged(weld::DrawingArea* /*pWindow*/, RectPoint /*e
|* dialog for changing slant and corner radius
|*
\************************************************************************/
-SvxSlantTabPage::SvxSlantTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs)
- : SvxTabPage( pParent,"SlantAndCornerRadius","cui/ui/slantcornertabpage.ui",
- rInAttrs)
+SvxSlantTabPage::SvxSlantTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs)
+ : SvxTabPage(pParent, "cui/ui/slantcornertabpage.ui", "SlantAndCornerRadius", rInAttrs)
, rOutAttrs(rInAttrs)
, pView(nullptr)
, eDlgUnit(FUNIT_NONE)
+ , m_xFlRadius(m_xBuilder->weld_widget("FL_RADIUS"))
+ , m_xMtrRadius(m_xBuilder->weld_metric_spin_button("MTR_FLD_RADIUS", FUNIT_CM))
+ , m_xFlAngle(m_xBuilder->weld_widget("FL_SLANT"))
+ , m_xMtrAngle(m_xBuilder->weld_metric_spin_button("MTR_FLD_ANGLE", FUNIT_DEGREE))
{
- get(m_pFlRadius, "FL_RADIUS");
- get(m_pMtrRadius, "MTR_FLD_RADIUS");
- get(m_pFlAngle, "FL_SLANT");
- get(m_pMtrAngle, "MTR_FLD_ANGLE");
-
for (int i = 0; i < 2; ++i)
{
- get(m_aControlGroups[i], "controlgroups" + OString::number(i+1));
- get(m_aControlGroupX[i], "controlgroupx" + OString::number(i+1));
- get(m_aControlX[i], "controlx" + OString::number(i+1));
- get(m_aControlGroupY[i], "controlgroupy" + OString::number(i+1));
- get(m_aControlY[i], "controly" + OString::number(i+1));
+ m_aControlGroups[i].reset(m_xBuilder->weld_widget("controlgroups" + OString::number(i+1)));
+ m_aControlGroupX[i].reset(m_xBuilder->weld_widget("controlgroupx" + OString::number(i+1)));
+ m_aControlX[i].reset(m_xBuilder->weld_metric_spin_button("controlx" + OString::number(i+1), FUNIT_CM));
+ m_aControlGroupY[i].reset(m_xBuilder->weld_widget("controlgroupy" + OString::number(i+1)));
+ m_aControlY[i].reset(m_xBuilder->weld_metric_spin_button("controly" + OString::number(i+1), FUNIT_CM));
}
// this page needs ExchangeSupport
@@ -448,30 +443,12 @@ SvxSlantTabPage::SvxSlantTabPage(vcl::Window* pParent, const SfxItemSet& rInAttr
// evaluate PoolUnit
SfxItemPool* pPool = rOutAttrs.GetPool();
- DBG_ASSERT( pPool, "no pool (!)" );
+ assert(pPool && "no pool (!)");
ePoolUnit = pPool->GetMetric( SID_ATTR_TRANSFORM_POS_X );
}
SvxSlantTabPage::~SvxSlantTabPage()
{
- disposeOnce();
-}
-
-void SvxSlantTabPage::dispose()
-{
- m_pFlRadius.clear();
- m_pMtrRadius.clear();
- m_pFlAngle.clear();
- m_pMtrAngle.clear();
- for (int i = 0; i < 2; ++i)
- {
- m_aControlGroups[i].clear();
- m_aControlGroupX[i].clear();
- m_aControlX[i].clear();
- m_aControlGroupY[i].clear();
- m_aControlY[i].clear();
- }
- SvxTabPage::dispose();
}
void SvxSlantTabPage::Construct()
@@ -479,7 +456,7 @@ void SvxSlantTabPage::Construct()
// get the range
DBG_ASSERT(pView, "no valid view (!)");
eDlgUnit = GetModuleFieldUnit(GetItemSet());
- SetFieldUnit(*m_pMtrRadius, eDlgUnit, true);
+ SetFieldUnit(*m_xMtrRadius, eDlgUnit, true);
{ // #i75273#
::tools::Rectangle aTempRect(pView->GetAllMarkedRect());
@@ -488,23 +465,22 @@ void SvxSlantTabPage::Construct()
}
}
-
bool SvxSlantTabPage::FillItemSet(SfxItemSet* rAttrs)
{
bool bModified = false;
- if( m_pMtrRadius->IsValueChangedFromSaved() )
+ if (m_xMtrRadius->get_value_changed_from_saved())
{
Fraction aUIScale = pView->GetModel()->GetUIScale();
- long nTmp = long(GetCoreValue( *m_pMtrRadius, ePoolUnit ) * aUIScale);
+ long nTmp = long(GetCoreValue(*m_xMtrRadius, ePoolUnit) * aUIScale);
rAttrs->Put( makeSdrEckenradiusItem( nTmp ) );
bModified = true;
}
- if( m_pMtrAngle->IsValueChangedFromSaved() )
+ if (m_xMtrAngle->get_value_changed_from_saved())
{
- sal_Int32 nValue = static_cast<sal_Int32>(m_pMtrAngle->GetValue());
+ sal_Int32 nValue = static_cast<sal_Int32>(m_xMtrAngle->get_value(FUNIT_NONE));
rAttrs->Put( SfxInt32Item( SID_ATTR_TRANSFORM_SHEAR, nValue ) );
bModified = true;
}
@@ -524,8 +500,8 @@ bool SvxSlantTabPage::FillItemSet(SfxItemSet* rAttrs)
bool bControlPointsChanged = false;
for (int i = 0; i < 2; ++i)
{
- bControlPointsChanged |= (m_aControlX[i]->IsValueChangedFromSaved() ||
- m_aControlY[i]->IsValueChangedFromSaved());
+ bControlPointsChanged |= (m_aControlX[i]->get_value_changed_from_saved() ||
+ m_aControlY[i]->get_value_changed_from_saved());
}
if (!bControlPointsChanged)
@@ -582,7 +558,7 @@ bool SvxSlantTabPage::FillItemSet(SfxItemSet* rAttrs)
for (int i = 0; i < 2; ++i)
{
- if (m_aControlX[i]->IsValueChangedFromSaved() || m_aControlY[i]->IsValueChangedFromSaved())
+ if (m_aControlX[i]->get_value_changed_from_saved() || m_aControlY[i]->get_value_changed_from_saved())
{
Point aNewPosition(GetCoreValue(*m_aControlX[i], ePoolUnit),
GetCoreValue(*m_aControlY[i], ePoolUnit));
@@ -618,8 +594,8 @@ void SvxSlantTabPage::Reset(const SfxItemSet* rAttrs)
// corner radius
if(!pView->IsEdgeRadiusAllowed())
{
- m_pMtrRadius->SetText( "" );
- m_pFlRadius->Disable();
+ m_xMtrRadius->set_text("");
+ m_xFlRadius->set_sensitive(false);
}
else
{
@@ -629,21 +605,21 @@ void SvxSlantTabPage::Reset(const SfxItemSet* rAttrs)
{
const double fUIScale(double(pView->GetModel()->GetUIScale()));
const double fTmp(static_cast<double>(static_cast<const SdrMetricItem*>(pItem)->GetValue()) / fUIScale);
- SetMetricValue(*m_pMtrRadius, basegfx::fround(fTmp), ePoolUnit);
+ SetMetricValue(*m_xMtrRadius, basegfx::fround(fTmp), ePoolUnit);
}
else
{
- m_pMtrRadius->SetText( "" );
+ m_xMtrRadius->set_text("");
}
}
- m_pMtrRadius->SaveValue();
+ m_xMtrRadius->save_value();
// slant: angle
if( !pView->IsShearAllowed() )
{
- m_pMtrAngle->SetText( "" );
- m_pFlAngle->Disable();
+ m_xMtrAngle->set_text( "" );
+ m_xFlAngle->set_sensitive(false);
}
else
{
@@ -651,15 +627,15 @@ void SvxSlantTabPage::Reset(const SfxItemSet* rAttrs)
if( pItem )
{
- m_pMtrAngle->SetValue( static_cast<const SfxInt32Item*>(pItem)->GetValue() );
+ m_xMtrAngle->set_value(static_cast<const SfxInt32Item*>(pItem)->GetValue(), FUNIT_NONE);
}
else
{
- m_pMtrAngle->SetText( "" );
+ m_xMtrAngle->set_text("");
}
}
- m_pMtrAngle->SaveValue();
+ m_xMtrAngle->save_value();
bool bSelectionIsSdrObjCustomShape(false);
@@ -701,7 +677,7 @@ void SvxSlantTabPage::Reset(const SfxItemSet* rAttrs)
Point aInitialPosition;
if (!aShape.GetHandlePosition(i, aInitialPosition))
break;
- m_aControlGroups[i]->Enable();
+ m_aControlGroups[i]->set_sensitive(true);
css::awt::Point aPosition;
aPosition.X = SAL_MAX_INT32/2;
@@ -725,19 +701,13 @@ void SvxSlantTabPage::Reset(const SfxItemSet* rAttrs)
SetMetricValue(*m_aControlY[i], aInitialPosition.Y(), ePoolUnit);
if (aMaxPosition.X() == aMinPosition.X())
- m_aControlGroupX[i]->Disable();
+ m_aControlGroupX[i]->set_sensitive(false);
else
- {
- m_aControlX[i]->SetMin(aMinPosition.X(), FUNIT_MM);
- m_aControlX[i]->SetMax(aMaxPosition.X(), FUNIT_MM);
- }
+ m_aControlX[i]->set_range(aMinPosition.X(), aMaxPosition.X(), FUNIT_MM);
if (aMaxPosition.Y() == aMinPosition.Y())
- m_aControlGroupY[i]->Disable();
+ m_aControlGroupY[i]->set_sensitive(false);
else
- {
- m_aControlY[i]->SetMin(aMinPosition.Y(), FUNIT_MM);
- m_aControlY[i]->SetMax(aMaxPosition.Y(), FUNIT_MM);
- }
+ m_aControlY[i]->set_range(aMinPosition.Y(), aMaxPosition.Y(), FUNIT_MM);
}
//restore geometry
@@ -746,14 +716,14 @@ void SvxSlantTabPage::Reset(const SfxItemSet* rAttrs)
for (int i = 0; i < 2; ++i)
{
- m_aControlX[i]->SaveValue();
- m_aControlY[i]->SaveValue();
+ m_aControlX[i]->save_value();
+ m_aControlY[i]->save_value();
}
}
-VclPtr<SfxTabPage> SvxSlantTabPage::Create( TabPageParent pWindow, const SfxItemSet* rOutAttrs )
+VclPtr<SfxTabPage> SvxSlantTabPage::Create(TabPageParent pParent, const SfxItemSet* rOutAttrs)
{
- return VclPtr<SvxSlantTabPage>::Create( pWindow.pParent, *rOutAttrs );
+ return VclPtr<SvxSlantTabPage>::Create(pParent, *rOutAttrs);
}
void SvxSlantTabPage::ActivatePage( const SfxItemSet& rSet )
@@ -769,17 +739,16 @@ void SvxSlantTabPage::ActivatePage( const SfxItemSet& rSet )
SfxBoolItem const * bPosProtect = nullptr;
if(SfxItemState::SET == rSet.GetItemState( GetWhich(SID_ATTR_TRANSFORM_PROTECT_POS ) , false, reinterpret_cast<SfxPoolItem const **>(&bPosProtect) ))
{
- m_pFlAngle->Enable(!bPosProtect->GetValue());
+ m_xFlAngle->set_sensitive(!bPosProtect->GetValue());
}
SfxBoolItem const * bSizeProtect = nullptr;
if(SfxItemState::SET == rSet.GetItemState( GetWhich(SID_ATTR_TRANSFORM_PROTECT_SIZE ) , false, reinterpret_cast<SfxPoolItem const **>(&bSizeProtect) ))
{
- m_pFlAngle->Enable(!bSizeProtect->GetValue());
+ m_xFlAngle->set_sensitive(!bSizeProtect->GetValue());
}
}
-
DeactivateRC SvxSlantTabPage::DeactivatePage( SfxItemSet* _pSet )
{
if(_pSet)
diff --git a/cui/uiconfig/ui/slantcornertabpage.ui b/cui/uiconfig/ui/slantcornertabpage.ui
index be58ba66c383..061f6ab067c1 100644
--- a/cui/uiconfig/ui/slantcornertabpage.ui
+++ b/cui/uiconfig/ui/slantcornertabpage.ui
@@ -1,7 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
+ <object class="GtkAdjustment" id="adjustment1">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment2">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment3">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment4">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
<object class="GtkAdjustment" id="adjustmentRADIUS">
<property name="upper">500</property>
<property name="step_increment">10</property>
@@ -49,7 +69,7 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="slantcornertabpage|label5">_X:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">controlx1:0.00cm</property>
+ <property name="mnemonic_widget">controlx1</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -59,9 +79,11 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="controlx1:0.00cm">
+ <object class="GtkSpinButton" id="controlx1">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="activates_default">True</property>
+ <property name="adjustment">adjustment1</property>
<property name="digits">2</property>
</object>
<packing>
@@ -87,7 +109,7 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="slantcornertabpage|label6">_Y:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">controly1:0.00cm</property>
+ <property name="mnemonic_widget">controly1</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -97,9 +119,11 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="controly1:0.00cm">
+ <object class="GtkSpinButton" id="controly1">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="activates_default">True</property>
+ <property name="adjustment">adjustment3</property>
<property name="digits">2</property>
</object>
<packing>
@@ -158,7 +182,7 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="slantcornertabpage|FT_RADIUS">_Radius:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">MTR_FLD_RADIUS:0.00cm</property>
+ <property name="mnemonic_widget">MTR_FLD_RADIUS</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -167,9 +191,10 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="MTR_FLD_RADIUS:0.00cm">
+ <object class="GtkSpinButton" id="MTR_FLD_RADIUS">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="activates_default">True</property>
<property name="adjustment">adjustmentRADIUS</property>
<property name="digits">2</property>
</object>
@@ -222,7 +247,7 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="slantcornertabpage|FT_ANGLE">_Angle:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">MTR_FLD_ANGLE:0.00degrees</property>
+ <property name="mnemonic_widget">MTR_FLD_ANGLE</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -231,9 +256,10 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="MTR_FLD_ANGLE:0.00degrees">
+ <object class="GtkSpinButton" id="MTR_FLD_ANGLE">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="activates_default">True</property>
<property name="adjustment">adjustmentSLANT</property>
<property name="digits">2</property>
</object>
@@ -293,7 +319,7 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="slantcornertabpage|label4">_X:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">controlx2:0.00cm</property>
+ <property name="mnemonic_widget">controlx2</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -303,9 +329,11 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="controlx2:0.00cm">
+ <object class="GtkSpinButton" id="controlx2">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="activates_default">True</property>
+ <property name="adjustment">adjustment2</property>
<property name="digits">2</property>
</object>
<packing>
@@ -331,7 +359,7 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="slantcornertabpage|label7">_Y:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">controly2:0.00cm</property>
+ <property name="mnemonic_widget">controly2</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -341,9 +369,11 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="controly2:0.00cm">
+ <object class="GtkSpinButton" id="controly2">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="activates_default">True</property>
+ <property name="adjustment">adjustment4</property>
<property name="digits">2</property>
</object>
<packing>
@@ -392,16 +422,16 @@
</object>
<object class="GtkSizeGroup" id="sizegroup2">
<widgets>
- <widget name="MTR_FLD_RADIUS:0.00cm"/>
- <widget name="MTR_FLD_ANGLE:0.00degrees"/>
+ <widget name="MTR_FLD_RADIUS"/>
+ <widget name="MTR_FLD_ANGLE"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="sizegroup5">
<widgets>
- <widget name="controlx1:0.00cm"/>
- <widget name="controly1:0.00cm"/>
- <widget name="controlx2:0.00cm"/>
- <widget name="controly2:0.00cm"/>
+ <widget name="controlx1"/>
+ <widget name="controly1"/>
+ <widget name="controlx2"/>
+ <widget name="controly2"/>
</widgets>
</object>
</interface>
More information about the Libreoffice-commits
mailing list