summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-12-23 16:05:02 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-12-30 10:39:48 +0100
commitc85fcc6e1994eb8e079aaca85066ab4d67149c15 (patch)
tree97ba148981744d8c7957adc67196a842ce31ac81
parentc3b58a0de7b7dd08695fbc9ad96c573ea1305357 (diff)
weld PosSizePropertyPanel
Change-Id: I32bba3a698a4cc78d4159c6f373b312540478ab0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85764 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--cui/uiconfig/ui/possizetabpage.ui14
-rw-r--r--include/svx/dialcontrol.hxx2
-rw-r--r--include/vcl/customweld.hxx1
-rw-r--r--solenv/sanitizers/ui/svx.suppr11
-rw-r--r--svx/source/dialog/dialcontrol.cxx5
-rw-r--r--svx/source/sidebar/possize/PosSizePropertyPanel.cxx517
-rw-r--r--svx/source/sidebar/possize/PosSizePropertyPanel.hxx64
-rw-r--r--svx/uiconfig/ui/sidebarpossize.ui173
8 files changed, 373 insertions, 414 deletions
diff --git a/cui/uiconfig/ui/possizetabpage.ui b/cui/uiconfig/ui/possizetabpage.ui
index af4555c3499d..56cd1ebf534e 100644
--- a/cui/uiconfig/ui/possizetabpage.ui
+++ b/cui/uiconfig/ui/possizetabpage.ui
@@ -86,6 +86,7 @@
<object class="GtkSpinButton" id="MTR_FLD_POS_X">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="halign">start</property>
<property name="activates_default">True</property>
<property name="adjustment">adjustmentPOS</property>
<property name="digits">2</property>
@@ -99,9 +100,10 @@
<object class="GtkSpinButton" id="MTR_FLD_POS_Y">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="halign">start</property>
<property name="activates_default">True</property>
<property name="adjustment">adjustmentPOS1</property>
- <property name="digits">2</property>
+ <property name="digits">4</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -132,7 +134,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -161,7 +163,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
@@ -249,6 +251,7 @@
<object class="GtkSpinButton" id="MTR_FLD_WIDTH">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="halign">start</property>
<property name="activates_default">True</property>
<property name="adjustment">adjustmentSIZE</property>
<property name="digits">2</property>
@@ -262,6 +265,7 @@
<object class="GtkSpinButton" id="MTR_FLD_HEIGHT">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="halign">start</property>
<property name="activates_default">True</property>
<property name="adjustment">adjustmentSIZE1</property>
<property name="digits">2</property>
@@ -311,7 +315,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -340,7 +344,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
diff --git a/include/svx/dialcontrol.hxx b/include/svx/dialcontrol.hxx
index 00b9bb58aa36..07f95bb04420 100644
--- a/include/svx/dialcontrol.hxx
+++ b/include/svx/dialcontrol.hxx
@@ -179,6 +179,7 @@ public:
const OUString& GetText() const { return mpImpl->maText; }
void SetText(const OUString& rText) { mpImpl->maText = rText; }
+ void Init( const Size& rWinSize );
private:
struct DialControl_Impl
{
@@ -207,7 +208,6 @@ private:
void HandleEscapeEvent();
void Init( const Size& rWinSize, const vcl::Font& rWinFont );
- void Init( const Size& rWinSize );
void InvalidateControl();
diff --git a/include/vcl/customweld.hxx b/include/vcl/customweld.hxx
index dc8fd57afd41..330ab167e37d 100644
--- a/include/vcl/customweld.hxx
+++ b/include/vcl/customweld.hxx
@@ -127,6 +127,7 @@ public:
void set_sensitive(bool bSensitive) { m_xDrawingArea->set_sensitive(bSensitive); }
bool get_sensitive() const { return m_xDrawingArea->get_sensitive(); }
bool get_visible() const { return m_xDrawingArea->get_visible(); }
+ void set_visible(bool bVisible) { m_xDrawingArea->set_visible(bVisible); }
void set_grid_left_attach(int nAttach) { m_xDrawingArea->set_grid_left_attach(nAttach); }
int get_grid_left_attach() const { return m_xDrawingArea->get_grid_left_attach(); }
void set_help_id(const OString& rHelpId) { m_xDrawingArea->set_help_id(rHelpId); }
diff --git a/solenv/sanitizers/ui/svx.suppr b/solenv/sanitizers/ui/svx.suppr
index 3cf402908eb4..b2d33d3c19b6 100644
--- a/solenv/sanitizers/ui/svx.suppr
+++ b/solenv/sanitizers/ui/svx.suppr
@@ -71,15 +71,4 @@ svx/uiconfig/ui/sidebarline.ui://GtkLabel[@id='widthlabel'] orphan-label
svx/uiconfig/ui/sidebarline.ui://GtkLabel[@id='colorlabel'] orphan-label
svx/uiconfig/ui/sidebarline.ui://GtkLabel[@id='translabel'] orphan-label
svx/uiconfig/ui/sidebarline.ui://GtkSpinButton[@id='linetransparency:0%'] missing-label-for
-svx/uiconfig/ui/sidebarpossize.ui://GtkLabel[@id='horizontallabel'] orphan-label
-svx/uiconfig/ui/sidebarpossize.ui://GtkSpinButton[@id='horizontalpos:0in'] missing-label-for
-svx/uiconfig/ui/sidebarpossize.ui://GtkLabel[@id='verticallabel'] orphan-label
-svx/uiconfig/ui/sidebarpossize.ui://GtkSpinButton[@id='verticalpos:0in'] missing-label-for
-svx/uiconfig/ui/sidebarpossize.ui://GtkLabel[@id='widthlabel'] orphan-label
-svx/uiconfig/ui/sidebarpossize.ui://GtkSpinButton[@id='selectwidth:0in'] missing-label-for
-svx/uiconfig/ui/sidebarpossize.ui://GtkLabel[@id='heightlabel'] orphan-label
-svx/uiconfig/ui/sidebarpossize.ui://GtkSpinButton[@id='selectheight:0in'] missing-label-for
-svx/uiconfig/ui/sidebarpossize.ui://GtkLabel[@id='rotationlabel'] orphan-label
-svx/uiconfig/ui/sidebarpossize.ui://svxlo-SidebarDialControl[@id='orientationcontrol'] missing-label-for
-svx/uiconfig/ui/sidebarpossize.ui://GtkLabel[@id='fliplabel'] orphan-label
svx/uiconfig/ui/textcharacterspacingcontrol.ui://GtkSpinButton[@id='kerning:0pt'] no-labelled-by
diff --git a/svx/source/dialog/dialcontrol.cxx b/svx/source/dialog/dialcontrol.cxx
index 83ae8655d8a7..35eae0a707ed 100644
--- a/svx/source/dialog/dialcontrol.cxx
+++ b/svx/source/dialog/dialcontrol.cxx
@@ -492,10 +492,11 @@ void SvxDialControl::SetDrawingArea(weld::DrawingArea* pDrawingArea)
//use same logic as DialControl_Impl::SetSize
int nDim = (std::min<int>(pDrawingArea->get_approximate_digit_width() * 12,
pDrawingArea->get_text_height() * 6) - 1) | 1;
- pDrawingArea->set_size_request(nDim, nDim);
+ Size aSize(nDim, nDim);
+ pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
mpImpl.reset(new DialControl_Impl(pDrawingArea->get_ref_device()));
//set size and use that
- Init(GetOutputSizePixel());
+ Init(aSize);
}
void SvxDialControl::Resize()
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index 0dfc8a5b0c07..7d1982dbdca1 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -63,7 +63,26 @@ PosSizePropertyPanel::PosSizePropertyPanel(
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings,
const css::uno::Reference<css::ui::XSidebar>& rxSidebar)
-: PanelLayout(pParent, "PosSizePropertyPanel", "svx/ui/sidebarpossize.ui", rxFrame),
+: PanelLayout(pParent, "PosSizePropertyPanel", "svx/ui/sidebarpossize.ui", rxFrame, true),
+ mxFtPosX(m_xBuilder->weld_label("horizontallabel")),
+ mxMtrPosX(m_xBuilder->weld_metric_spin_button("horizontalpos", FieldUnit::CM)),
+ mxFtPosY(m_xBuilder->weld_label("verticallabel")),
+ mxMtrPosY(m_xBuilder->weld_metric_spin_button("verticalpos", FieldUnit::CM)),
+ mxFtWidth(m_xBuilder->weld_label("widthlabel")),
+ mxMtrWidth(m_xBuilder->weld_metric_spin_button("selectwidth", FieldUnit::CM)),
+ mxFtHeight(m_xBuilder->weld_label("heightlabel")),
+ mxMtrHeight(m_xBuilder->weld_metric_spin_button("selectheight", FieldUnit::CM)),
+ mxCbxScale(m_xBuilder->weld_check_button("ratio")),
+ mxFtAngle(m_xBuilder->weld_label("rotationlabel")),
+ mxMtrAngle(m_xBuilder->weld_spin_button("rotation")),
+ mxCtrlDial(new SvxDialControl),
+ mxDial(new weld::CustomWeld(*m_xBuilder, "orientationcontrol", *mxCtrlDial)),
+ mxFtFlip(m_xBuilder->weld_label("fliplabel")),
+ mxFlipTbx(m_xBuilder->weld_toolbar("selectrotationtype")),
+ mxFlipDispatch(new ToolbarUnoDispatcher(*mxFlipTbx, rxFrame)),
+ mxArrangeTbx(m_xBuilder->weld_toolbar("arrangetoolbar")),
+ mxArrangeDispatch(new ToolbarUnoDispatcher(*mxArrangeTbx, rxFrame)),
+ mxBtnEditChart(m_xBuilder->weld_button("btnEditChart")),
maRect(),
mpView(nullptr),
mlOldWidth(1),
@@ -94,21 +113,6 @@ PosSizePropertyPanel::PosSizePropertyPanel(
mbAdjustEnabled(false),
mxSidebar(rxSidebar)
{
- get( mpFtPosX, "horizontallabel" );
- get( mpMtrPosX, "horizontalpos" );
- get( mpFtPosY, "verticallabel" );
- get( mpMtrPosY, "verticalpos" );
- get( mpFtWidth, "widthlabel" );
- get( mpMtrWidth, "selectwidth" );
- get( mpFtHeight, "heightlabel" );
- get( mpMtrHeight, "selectheight" );
- get( mpCbxScale, "ratio" );
- get( mpFtAngle, "rotationlabel" );
- get( mpMtrAngle, "rotation" );
- get( mpDial, "orientationcontrol" );
- get( mpFtFlip, "fliplabel" );
- get( mpFlipTbx, "selectrotationtype" );
- get( mpBtnEditChart, "btnEditChart" );
Initialize();
mpBindings->Update( SID_ATTR_METRIC );
@@ -124,21 +128,25 @@ PosSizePropertyPanel::~PosSizePropertyPanel()
void PosSizePropertyPanel::dispose()
{
- mpFtPosX.clear();
- mpMtrPosX.clear();
- mpFtPosY.clear();
- mpMtrPosY.clear();
- mpFtWidth.clear();
- mpMtrWidth.clear();
- mpFtHeight.clear();
- mpMtrHeight.clear();
- mpCbxScale.clear();
- mpFtAngle.clear();
- mpMtrAngle.clear();
- mpDial.clear();
- mpFtFlip.clear();
- mpFlipTbx.clear();
- mpBtnEditChart.clear();
+ mxFtPosX.reset();
+ mxMtrPosX.reset();
+ mxFtPosY.reset();
+ mxMtrPosY.reset();
+ mxFtWidth.reset();
+ mxMtrWidth.reset();
+ mxFtHeight.reset();
+ mxMtrHeight.reset();
+ mxCbxScale.reset();
+ mxFtAngle.reset();
+ mxMtrAngle.reset();
+ mxDial.reset();
+ mxCtrlDial.reset();
+ mxFtFlip.reset();
+ mxFlipDispatch.reset();
+ mxFlipTbx.reset();
+ mxArrangeTbx.reset();
+ mxArrangeDispatch.reset();
+ mxBtnEditChart.reset();
maTransfPosXControl.dispose();
maTransfPosYControl.dispose();
@@ -188,37 +196,31 @@ namespace
void PosSizePropertyPanel::Initialize()
{
//Position : Horizontal / Vertical
- mpMtrPosX->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangePosXHdl ) );
- mpMtrPosY->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangePosYHdl ) );
+ mxMtrPosX->connect_value_changed( LINK( this, PosSizePropertyPanel, ChangePosXHdl ) );
+ mxMtrPosY->connect_value_changed( LINK( this, PosSizePropertyPanel, ChangePosYHdl ) );
//Size : Width / Height
- mpMtrWidth->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangeWidthHdl ) );
- mpMtrHeight->SetModifyHdl( LINK( this, PosSizePropertyPanel, ChangeHeightHdl ) );
+ mxMtrWidth->connect_value_changed( LINK( this, PosSizePropertyPanel, ChangeWidthHdl ) );
+ mxMtrHeight->connect_value_changed( LINK( this, PosSizePropertyPanel, ChangeHeightHdl ) );
//Size : Keep ratio
- mpCbxScale->SetClickHdl( LINK( this, PosSizePropertyPanel, ClickAutoHdl ) );
+ mxCbxScale->connect_toggled( LINK( this, PosSizePropertyPanel, ClickAutoHdl ) );
//rotation:
- mpMtrAngle->SetModifyHdl(LINK( this, PosSizePropertyPanel, AngleModifiedHdl));
- mpMtrAngle->EnableAutocomplete( false );
+ mxMtrAngle->connect_value_changed(LINK( this, PosSizePropertyPanel, AngleModifiedHdl));
//rotation control
- mpDial->SetModifyHdl(LINK( this, PosSizePropertyPanel, RotationHdl));
+ mxCtrlDial->SetLinkedField(mxMtrAngle.get());
- //flip:
- mpFlipTbx->SetSelectHdl( LINK( this, PosSizePropertyPanel, FlipHdl) );
+ //use same logic as DialControl_Impl::SetSize
+ weld::DrawingArea* pDrawingArea = mxCtrlDial->GetDrawingArea();
+ int nDim = (std::min<int>(pDrawingArea->get_approximate_digit_width() * 6,
+ pDrawingArea->get_text_height() * 3) - 1) | 1;
+ Size aSize(nDim, nDim);
+ pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
+ mxCtrlDial->Init(aSize);
- mpBtnEditChart->SetClickHdl( LINK( this, PosSizePropertyPanel, ClickChartEditHdl ) );
-
- mpMtrAngle->InsertValue(0, FieldUnit::CUSTOM);
- mpMtrAngle->InsertValue(4500, FieldUnit::CUSTOM);
- mpMtrAngle->InsertValue(9000, FieldUnit::CUSTOM);
- mpMtrAngle->InsertValue(13500, FieldUnit::CUSTOM);
- mpMtrAngle->InsertValue(18000, FieldUnit::CUSTOM);
- mpMtrAngle->InsertValue(22500, FieldUnit::CUSTOM);
- mpMtrAngle->InsertValue(27000, FieldUnit::CUSTOM);
- mpMtrAngle->InsertValue(31500, FieldUnit::CUSTOM);
- mpMtrAngle->AdaptDropDownLineCountToMaximum();
+ mxBtnEditChart->connect_clicked( LINK( this, PosSizePropertyPanel, ClickChartEditHdl ) );
SfxViewShell* pCurSh = SfxViewShell::Current();
if ( pCurSh )
@@ -324,77 +326,77 @@ void PosSizePropertyPanel::HandleContextChange(
}
// Position
- mpFtPosX->Show(bShowPosition);
- mpMtrPosX->Show(bShowPosition);
- mpFtPosY->Show(bShowPosition);
- mpMtrPosY->Show(bShowPosition);
+ mxFtPosX->set_visible(bShowPosition);
+ mxMtrPosX->set_visible(bShowPosition);
+ mxFtPosY->set_visible(bShowPosition);
+ mxMtrPosY->set_visible(bShowPosition);
// Rotation
- mpFtAngle->Show(bShowAngle);
- mpMtrAngle->Show(bShowAngle);
- mpDial->Show(bShowAngle);
+ mxFtAngle->set_visible(bShowAngle);
+ mxMtrAngle->set_visible(bShowAngle);
+ mxDial->set_visible(bShowAngle);
// Flip
- mpFtFlip->Show(bShowFlip);
- mpFlipTbx->Show(bShowFlip);
+ mxFtFlip->set_visible(bShowFlip);
+ mxFlipTbx->set_visible(bShowFlip);
// Edit Chart
- mpBtnEditChart->Show(bShowEditChart);
+ mxBtnEditChart->set_visible(bShowEditChart);
if (mxSidebar.is())
mxSidebar->requestLayout();
}
-IMPL_LINK_NOARG( PosSizePropertyPanel, ChangeWidthHdl, Edit&, void )
+IMPL_LINK_NOARG( PosSizePropertyPanel, ChangeWidthHdl, weld::MetricSpinButton&, void )
{
- if( mpCbxScale->IsChecked() &&
- mpCbxScale->IsEnabled() )
+ if( mxCbxScale->get_active() &&
+ mxCbxScale->get_sensitive() )
{
- long nHeight = static_cast<long>( (static_cast<double>(mlOldHeight) * static_cast<double>(mpMtrWidth->GetValue())) / static_cast<double>(mlOldWidth) );
- if( nHeight <= mpMtrHeight->GetMax( FieldUnit::NONE ) )
+ long nHeight = static_cast<long>( (static_cast<double>(mlOldHeight) * static_cast<double>(mxMtrWidth->get_value(FieldUnit::NONE))) / static_cast<double>(mlOldWidth) );
+ if( nHeight <= mxMtrHeight->get_max( FieldUnit::NONE ) )
{
- mpMtrHeight->SetUserValue( nHeight, FieldUnit::NONE );
+ mxMtrHeight->set_value( nHeight, FieldUnit::NONE );
}
else
{
- nHeight = static_cast<long>(mpMtrHeight->GetMax( FieldUnit::NONE ));
- mpMtrHeight->SetUserValue( nHeight );
+ nHeight = static_cast<long>(mxMtrHeight->get_max( FieldUnit::NONE ));
+ mxMtrHeight->set_value(nHeight, FieldUnit::NONE);
const long nWidth = static_cast<long>( (static_cast<double>(mlOldWidth) * static_cast<double>(nHeight)) / static_cast<double>(mlOldHeight) );
- mpMtrWidth->SetUserValue( nWidth, FieldUnit::NONE );
+ mxMtrWidth->set_value( nWidth, FieldUnit::NONE );
}
}
executeSize();
}
-IMPL_LINK_NOARG( PosSizePropertyPanel, ChangeHeightHdl, Edit&, void )
+IMPL_LINK_NOARG( PosSizePropertyPanel, ChangeHeightHdl, weld::MetricSpinButton&, void )
{
- if( mpCbxScale->IsChecked() &&
- mpCbxScale->IsEnabled() )
+ if( mxCbxScale->get_active() &&
+ mxCbxScale->get_sensitive() )
{
- long nWidth = static_cast<long>( (static_cast<double>(mlOldWidth) * static_cast<double>(mpMtrHeight->GetValue())) / static_cast<double>(mlOldHeight) );
- if( nWidth <= mpMtrWidth->GetMax( FieldUnit::NONE ) )
+ long nWidth = static_cast<long>( (static_cast<double>(mlOldWidth) * static_cast<double>(mxMtrHeight->get_value(FieldUnit::NONE))) / static_cast<double>(mlOldHeight) );
+ if( nWidth <= mxMtrWidth->get_max( FieldUnit::NONE ) )
{
- mpMtrWidth->SetUserValue( nWidth, FieldUnit::NONE );
+ mxMtrWidth->set_value( nWidth, FieldUnit::NONE );
}
else
{
- nWidth = static_cast<long>(mpMtrWidth->GetMax( FieldUnit::NONE ));
- mpMtrWidth->SetUserValue( nWidth );
+ nWidth = static_cast<long>(mxMtrWidth->get_max( FieldUnit::NONE ));
+ mxMtrWidth->set_value( nWidth, FieldUnit::NONE );
const long nHeight = static_cast<long>( (static_cast<double>(mlOldHeight) * static_cast<double>(nWidth)) / static_cast<double>(mlOldWidth) );
- mpMtrHeight->SetUserValue( nHeight, FieldUnit::NONE );
+ mxMtrHeight->set_value( nHeight, FieldUnit::NONE );
}
}
executeSize();
}
-IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosXHdl, Edit&, void )
+IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosXHdl, weld::MetricSpinButton&, void )
{
- if ( mpMtrPosX->IsValueModified())
+ if ( mxMtrPosX->get_value_changed_from_saved())
{
- long lX = GetCoreValue( *mpMtrPosX, mePoolUnit );
+ long lX = GetCoreValue( *mxMtrPosX, mePoolUnit );
Fraction aUIScale = mpView->GetModel()->GetUIScale();
lX = long( lX * aUIScale );
@@ -406,12 +408,11 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosXHdl, Edit&, void )
}
}
-
-IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosYHdl, Edit&, void )
+IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosYHdl, weld::MetricSpinButton&, void )
{
- if ( mpMtrPosY->IsValueModified() )
+ if ( mxMtrPosY->get_value_changed_from_saved() )
{
- long lY = GetCoreValue( *mpMtrPosY, mePoolUnit );
+ long lY = GetCoreValue( *mxMtrPosY, mePoolUnit );
Fraction aUIScale = mpView->GetModel()->GetUIScale();
lY = long( lY * aUIScale );
@@ -423,53 +424,22 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosYHdl, Edit&, void )
}
}
-
-IMPL_LINK_NOARG( PosSizePropertyPanel, ClickAutoHdl, Button*, void )
+IMPL_LINK_NOARG( PosSizePropertyPanel, ClickAutoHdl, weld::ToggleButton&, void )
{
- if ( mpCbxScale->IsChecked() )
+ if ( mxCbxScale->get_active() )
{
- mlOldWidth = std::max( GetCoreValue( *mpMtrWidth, mePoolUnit ), 1L );
- mlOldHeight = std::max( GetCoreValue( *mpMtrHeight, mePoolUnit ), 1L );
+ mlOldWidth = std::max(GetCoreValue(*mxMtrWidth, mePoolUnit), 1);
+ mlOldHeight = std::max(GetCoreValue(*mxMtrHeight, mePoolUnit), 1);
}
- // mpCbxScale must synchronized with that on Position and Size tabpage on Shape Properties dialog
+ // mxCbxScale must synchronized with that on Position and Size tabpage on Shape Properties dialog
SvtViewOptions aPageOpt(EViewType::TabPage, "cui/ui/possizetabpage/PositionAndSize");
- aPageOpt.SetUserItem( USERITEM_NAME, css::uno::makeAny( OUString::number( int(mpCbxScale->IsChecked()) ) ) );
+ aPageOpt.SetUserItem( USERITEM_NAME, css::uno::makeAny( OUString::number( int(mxCbxScale->get_active()) ) ) );
}
-
-IMPL_LINK_NOARG( PosSizePropertyPanel, AngleModifiedHdl, Edit&, void )
+IMPL_LINK_NOARG( PosSizePropertyPanel, AngleModifiedHdl, weld::SpinButton&, void )
{
- OUString sTmp = mpMtrAngle->GetText();
- if (sTmp.isEmpty())
- return;
- sal_Unicode nChar = sTmp[0];
- if( nChar == '-' )
- {
- if (sTmp.getLength() < 2)
- return;
- nChar = sTmp[1];
- }
-
- if( (nChar < '0') || (nChar > '9') )
- return;
-
- const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() );
-
- // Do not check that the entire string was parsed up to its end, there may
- // be a degree symbol following the number. Note that this also means that
- // the number recognized just stops at any non-matching character.
- /* TODO: we could check for the degree symbol stop if there are no other
- * cases with different symbol characters in any language? */
- rtl_math_ConversionStatus eStatus;
- double fTmp = rLocaleWrapper.stringToDouble( sTmp, false, &eStatus, nullptr);
- if (eStatus != rtl_math_ConversionStatus_Ok)
- return;
-
- while (fTmp < 0)
- fTmp += 360;
-
- sal_Int64 nTmp = fTmp*100;
+ sal_Int64 nTmp = mxMtrAngle->get_value() * 100;
// #i123993# Need to take UIScale into account when executing rotations
const double fUIScale(mpView && mpView->GetModel() ? double(mpView->GetModel()->GetUIScale()) : 1.0);
@@ -482,9 +452,9 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, AngleModifiedHdl, Edit&, void )
}
-IMPL_LINK_NOARG( PosSizePropertyPanel, RotationHdl, DialControl*, void )
+IMPL_LINK_NOARG( PosSizePropertyPanel, RotationHdl, SvxDialControl*, void )
{
- sal_Int32 nTmp = mpDial->GetRotation();
+ sal_Int32 nTmp = mxCtrlDial->GetRotation();
// #i123993# Need to take UIScale into account when executing rotations
const double fUIScale(mpView && mpView->GetModel() ? double(mpView->GetModel()->GetUIScale()) : 1.0);
@@ -496,45 +466,37 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, RotationHdl, DialControl*, void )
SfxCallMode::RECORD, { &aAngleItem, &aRotXItem, &aRotYItem });
}
-
-IMPL_LINK( PosSizePropertyPanel, FlipHdl, ToolBox*, pBox, void )
+IMPL_STATIC_LINK_NOARG( PosSizePropertyPanel, ClickChartEditHdl, weld::Button&, void )
{
- const OUString aCommand(pBox->GetItemCommand(pBox->GetCurItemId()));
-
- if(aCommand == ".uno:FlipHorizontal")
- {
- SfxVoidItem aHoriItem(SID_FLIP_HORIZONTAL);
- GetBindings()->GetDispatcher()->ExecuteList(SID_FLIP_HORIZONTAL,
- SfxCallMode::RECORD, { &aHoriItem });
- }
- else if(aCommand == ".uno:FlipVertical")
+ SfxViewShell* pCurSh = SfxViewShell::Current();
+ if ( pCurSh)
{
- SfxVoidItem aVertItem(SID_FLIP_VERTICAL);
- GetBindings()->GetDispatcher()->ExecuteList(SID_FLIP_VERTICAL,
- SfxCallMode::RECORD, { &aVertItem });
+ pCurSh->DoVerb( -1 );
}
}
-IMPL_STATIC_LINK_NOARG( PosSizePropertyPanel, ClickChartEditHdl, Button*, void )
+namespace
{
- SfxViewShell* pCurSh = SfxViewShell::Current();
- if ( pCurSh)
+ void limitWidth(weld::MetricSpinButton& rMetricSpinButton)
{
- pCurSh->DoVerb( -1 );
+ // space is limited in the sidebar, so limit MetricSpinButtons to a width of 7 digits
+ const int nMaxDigits = 7;
+
+ weld::SpinButton& rSpinButton = rMetricSpinButton.get_widget();
+ rSpinButton.set_width_chars(std::min(rSpinButton.get_width_chars(), nMaxDigits));
}
}
-
void PosSizePropertyPanel::NotifyItemUpdate(
sal_uInt16 nSID,
SfxItemState eState,
const SfxPoolItem* pState)
{
- mpFtAngle->Enable();
- mpMtrAngle->Enable();
- mpDial->Enable();
- mpFtFlip->Enable();
- mpFlipTbx->Enable();
+ mxFtAngle->set_sensitive(true);
+ mxMtrAngle->set_sensitive(true);
+ mxDial->set_sensitive(true);
+ mxFtFlip->set_sensitive(true);
+ mxFlipTbx->set_sensitive(true);
const SfxUInt32Item* pWidthItem;
const SfxUInt32Item* pHeightItem;
@@ -564,14 +526,16 @@ void PosSizePropertyPanel::NotifyItemUpdate(
if(pWidthItem)
{
long lOldWidth1 = long( pWidthItem->GetValue() / maUIScale );
- SetFieldUnit( *mpMtrWidth, meDlgUnit, true );
- SetMetricValue( *mpMtrWidth, lOldWidth1, mePoolUnit );
+ SetFieldUnit( *mxMtrWidth, meDlgUnit, true );
+ SetMetricValue( *mxMtrWidth, lOldWidth1, mePoolUnit );
+ limitWidth(*mxMtrWidth);
mlOldWidth = lOldWidth1;
+ mxMtrWidth->save_value();
break;
}
}
- mpMtrWidth->SetText( "" );
+ mxMtrWidth->set_text( "" );
break;
case SID_ATTR_TRANSFORM_HEIGHT:
@@ -582,14 +546,16 @@ void PosSizePropertyPanel::NotifyItemUpdate(
if(pHeightItem)
{
long nTmp = long( pHeightItem->GetValue() / maUIScale);
- SetFieldUnit( *mpMtrHeight, meDlgUnit, true );
- SetMetricValue( *mpMtrHeight, nTmp, mePoolUnit );
+ SetFieldUnit( *mxMtrHeight, meDlgUnit, true );
+ SetMetricValue( *mxMtrHeight, nTmp, mePoolUnit );
+ limitWidth(*mxMtrHeight);
mlOldHeight = nTmp;
+ mxMtrHeight->save_value();
break;
}
}
- mpMtrHeight->SetText( "");
+ mxMtrHeight->set_text( "");
break;
case SID_ATTR_TRANSFORM_POS_X:
@@ -600,13 +566,15 @@ void PosSizePropertyPanel::NotifyItemUpdate(
if(pItem)
{
long nTmp = long(pItem->GetValue() / maUIScale);
- SetFieldUnit( *mpMtrPosX, meDlgUnit, true );
- SetMetricValue( *mpMtrPosX, nTmp, mePoolUnit );
+ SetFieldUnit( *mxMtrPosX, meDlgUnit, true );
+ SetMetricValue( *mxMtrPosX, nTmp, mePoolUnit );
+ limitWidth(*mxMtrPosX);
+ mxMtrPosX->save_value();
break;
}
}
- mpMtrPosX->SetText( "" );
+ mxMtrPosX->set_text( "" );
break;
case SID_ATTR_TRANSFORM_POS_Y:
@@ -617,13 +585,15 @@ void PosSizePropertyPanel::NotifyItemUpdate(
if(pItem)
{
long nTmp = long(pItem->GetValue() / maUIScale);
- SetFieldUnit( *mpMtrPosY, meDlgUnit, true );
- SetMetricValue( *mpMtrPosY, nTmp, mePoolUnit );
+ SetFieldUnit( *mxMtrPosY, meDlgUnit, true );
+ SetMetricValue( *mxMtrPosY, nTmp, mePoolUnit );
+ limitWidth(*mxMtrPosY);
+ mxMtrPosY->save_value();
break;
}
}
- mpMtrPosY->SetText( "" );
+ mxMtrPosY->set_text( "" );
break;
case SID_ATTR_TRANSFORM_ROT_X:
@@ -718,43 +688,15 @@ void PosSizePropertyPanel::NotifyItemUpdate(
long nTmp = pItem->GetValue();
nTmp = nTmp < 0 ? 36000+nTmp : nTmp;
- mpMtrAngle->SetValue( nTmp );
- mpDial->SetRotation( nTmp );
-
- switch(nTmp)
- {
- case 0:
- mpMtrAngle->SelectEntryPos(0);
- break;
- case 4500:
- mpMtrAngle->SelectEntryPos(1);
- break;
- case 9000:
- mpMtrAngle->SelectEntryPos(2);
- break;
- case 13500:
- mpMtrAngle->SelectEntryPos(3);
- break;
- case 18000:
- mpMtrAngle->SelectEntryPos(4);
- break;
- case 22500:
- mpMtrAngle->SelectEntryPos(5);
- break;
- case 27000:
- mpMtrAngle->SelectEntryPos(6);
- break;
- case 315000:
- mpMtrAngle->SelectEntryPos(7);
- break;
- }
+ mxMtrAngle->set_value(nTmp);
+ mxCtrlDial->SetRotation(nTmp);
break;
}
}
- mpMtrAngle->SetText( "" );
- mpDial->SetRotation( 0 );
+ mxMtrAngle->set_text( "" );
+ mxCtrlDial->SetRotation( 0 );
break;
case SID_ATTR_METRIC:
@@ -784,11 +726,11 @@ void PosSizePropertyPanel::NotifyItemUpdate(
) && OBJ_EDGE == eKind)
|| OBJ_CAPTION == eKind)
{
- mpFtAngle->Disable();
- mpMtrAngle->Disable();
- mpDial->Disable();
- mpFlipTbx->Disable();
- mpFtFlip->Disable();
+ mxFtAngle->set_sensitive(false);
+ mxMtrAngle->set_sensitive(false);
+ mxDial->set_sensitive(false);
+ mxFlipTbx->set_sensitive(false);
+ mxFtFlip->set_sensitive(false);
}
break;
}
@@ -816,11 +758,11 @@ void PosSizePropertyPanel::NotifyItemUpdate(
if(!isNoEdge)
{
- mpFtAngle->Disable();
- mpMtrAngle->Disable();
- mpDial->Disable();
- mpFlipTbx->Disable();
- mpFtFlip->Disable();
+ mxFtAngle->set_sensitive(false);
+ mxMtrAngle->set_sensitive(false);
+ mxDial->set_sensitive(false);
+ mxFlipTbx->set_sensitive(false);
+ mxFtFlip->set_sensitive(false);
}
break;
}
@@ -828,43 +770,41 @@ void PosSizePropertyPanel::NotifyItemUpdate(
if(nCombinedContext == CombinedEnumContext(Application::DrawImpress, Context::TextObject))
{
- mpFlipTbx->Disable();
- mpFtFlip->Disable();
+ mxFlipTbx->set_sensitive(false);
+ mxFtFlip->set_sensitive(false);
}
DisableControls();
- // mpCbxScale must synchronized with that on Position and Size tabpage on Shape Properties dialog
+ // mxCbxScale must synchronized with that on Position and Size tabpage on Shape Properties dialog
SvtViewOptions aPageOpt(EViewType::TabPage, "cui/ui/possizetabpage/PositionAndSize");
OUString sUserData;
css::uno::Any aUserItem = aPageOpt.GetUserItem( USERITEM_NAME );
OUString aTemp;
if ( aUserItem >>= aTemp )
sUserData = aTemp;
- mpCbxScale->Check( static_cast<bool>(sUserData.toInt32()) );
+ mxCbxScale->set_active(static_cast<bool>(sUserData.toInt32()));
}
void PosSizePropertyPanel::executeSize()
{
- if ( !mpMtrWidth->IsValueModified() && !mpMtrHeight->IsValueModified())
+ if ( !mxMtrWidth->get_value_changed_from_saved() && !mxMtrHeight->get_value_changed_from_saved())
return;
Fraction aUIScale = mpView->GetModel()->GetUIScale();
// get Width
- double nWidth = static_cast<double>(mpMtrWidth->GetValue( meDlgUnit ));
- nWidth = MetricField::ConvertDoubleValue( nWidth, mpMtrWidth->GetBaseValue(), mpMtrWidth->GetDecimalDigits(), meDlgUnit, FieldUnit::MM_100TH );
- long lWidth = static_cast<long>(nWidth * static_cast<double>(aUIScale));
+ double nWidth = static_cast<double>(mxMtrWidth->get_value(FieldUnit::MM_100TH));
+ long lWidth = long(nWidth * static_cast<double>(aUIScale));
lWidth = OutputDevice::LogicToLogic( lWidth, MapUnit::Map100thMM, mePoolUnit );
- lWidth = static_cast<long>(mpMtrWidth->Denormalize( lWidth ));
+ lWidth = static_cast<long>(mxMtrWidth->denormalize( lWidth ));
// get Height
- double nHeight = static_cast<double>(mpMtrHeight->GetValue( meDlgUnit ));
- nHeight = MetricField::ConvertDoubleValue( nHeight, mpMtrHeight->GetBaseValue(), mpMtrHeight->GetDecimalDigits(), meDlgUnit, FieldUnit::MM_100TH );
- long lHeight = static_cast<long>(nHeight * static_cast<double>(aUIScale));
+ double nHeight = static_cast<double>(mxMtrHeight->get_value(FieldUnit::MM_100TH));
+ long lHeight = long(nHeight * static_cast<double>(aUIScale));
lHeight = OutputDevice::LogicToLogic( lHeight, MapUnit::Map100thMM, mePoolUnit );
- lHeight = static_cast<long>(mpMtrWidth->Denormalize( lHeight ));
+ lHeight = static_cast<long>(mxMtrHeight->denormalize( lHeight ));
// put Width & Height to itemset
SfxUInt32Item aWidthItem( SID_ATTR_TRANSFORM_WIDTH, static_cast<sal_uInt32>(lWidth));
@@ -881,19 +821,18 @@ void PosSizePropertyPanel::executeSize()
}
else
{
- if ( (mpMtrWidth->IsValueModified()) && (mpMtrHeight->IsValueModified()))
+ if ( (mxMtrWidth->get_value_changed_from_saved()) && (mxMtrHeight->get_value_changed_from_saved()))
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_TRANSFORM,
SfxCallMode::RECORD, { &aWidthItem, &aHeightItem, &aPointItem });
- else if( mpMtrWidth->IsValueModified())
+ else if( mxMtrWidth->get_value_changed_from_saved())
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_TRANSFORM,
SfxCallMode::RECORD, { &aWidthItem, &aPointItem });
- else if ( mpMtrHeight->IsValueModified())
+ else if ( mxMtrHeight->get_value_changed_from_saved())
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_TRANSFORM,
SfxCallMode::RECORD, { &aHeightItem, &aPointItem });
}
}
-
void PosSizePropertyPanel::MetricState( SfxItemState eState, const SfxPoolItem* pState )
{
bool bPosXBlank = false;
@@ -905,30 +844,30 @@ void PosSizePropertyPanel::MetricState( SfxItemState eState, const SfxPoolItem*
// and the Fields using it
meDlgUnit = GetCurrentUnit(eState,pState);
- if (mpMtrPosX->GetText().isEmpty())
+ if (mxMtrPosX->get_text().isEmpty())
bPosXBlank = true;
- SetFieldUnit( *mpMtrPosX, meDlgUnit, true );
+ SetFieldUnit( *mxMtrPosX, meDlgUnit, true );
if(bPosXBlank)
- mpMtrPosX->SetText(OUString());
+ mxMtrPosX->set_text(OUString());
- if (mpMtrPosY->GetText().isEmpty())
+ if (mxMtrPosY->get_text().isEmpty())
bPosYBlank = true;
- SetFieldUnit( *mpMtrPosY, meDlgUnit, true );
+ SetFieldUnit( *mxMtrPosY, meDlgUnit, true );
if(bPosYBlank)
- mpMtrPosY->SetText(OUString());
+ mxMtrPosY->set_text(OUString());
SetPosSizeMinMax();
- if (mpMtrWidth->GetText().isEmpty())
+ if (mxMtrWidth->get_text().isEmpty())
bWidthBlank = true;
- SetFieldUnit( *mpMtrWidth, meDlgUnit, true );
+ SetFieldUnit( *mxMtrWidth, meDlgUnit, true );
if(bWidthBlank)
- mpMtrWidth->SetText(OUString());
+ mxMtrWidth->set_text(OUString());
- if (mpMtrHeight->GetText().isEmpty())
+ if (mxMtrHeight->get_text().isEmpty())
bHeightBlank = true;
- SetFieldUnit( *mpMtrHeight, meDlgUnit, true );
+ SetFieldUnit( *mxMtrHeight, meDlgUnit, true );
if(bHeightBlank)
- mpMtrHeight->SetText(OUString());
+ mxMtrHeight->set_text(OUString());
}
@@ -972,42 +911,36 @@ void PosSizePropertyPanel::DisableControls()
{
// the position is protected("Position protect" option in modal dialog is checked),
// disable all the Position controls in sidebar
- mpFtPosX->Disable();
- mpMtrPosX->Disable();
- mpFtPosY->Disable();
- mpMtrPosY->Disable();
- mpFtAngle->Disable();
- mpMtrAngle->Disable();
- mpDial->Disable();
- mpFtFlip->Disable();
- mpFlipTbx->Disable();
-
- mpFtWidth->Disable();
- mpMtrWidth->Disable();
- mpFtHeight->Disable();
- mpMtrHeight->Disable();
- mpCbxScale->Disable();
+ mxFtPosX->set_sensitive(false);
+ mxMtrPosX->set_sensitive(false);
+ mxFtPosY->set_sensitive(false);
+ mxMtrPosY->set_sensitive(false);
+ mxFtAngle->set_sensitive(false);
+ mxMtrAngle->set_sensitive(false);
+ mxDial->set_sensitive(false);
+ mxFtFlip->set_sensitive(false);
+ mxFlipTbx->set_sensitive(false);
+
+ mxFtWidth->set_sensitive(false);
+ mxMtrWidth->set_sensitive(false);
+ mxFtHeight->set_sensitive(false);
+ mxMtrHeight->set_sensitive(false);
+ mxCbxScale->set_sensitive(false);
}
else
{
- mpFtPosX->Enable();
- mpMtrPosX->Enable();
- mpFtPosY->Enable();
- mpMtrPosY->Enable();
-
- //mpFtAngle->Enable();
- //mpMtrAngle->Enable();
- //mpDial->Enable();
- //mpFtFlip->Enable();
- //mpFlipTbx->Enable();
+ mxFtPosX->set_sensitive(true);
+ mxMtrPosX->set_sensitive(true);
+ mxFtPosY->set_sensitive(true);
+ mxMtrPosY->set_sensitive(true);
if( mbSizeProtected )
{
- mpFtWidth->Disable();
- mpMtrWidth->Disable();
- mpFtHeight->Disable();
- mpMtrHeight->Disable();
- mpCbxScale->Disable();
+ mxFtWidth->set_sensitive(false);
+ mxMtrWidth->set_sensitive(false);
+ mxFtHeight->set_sensitive(false);
+ mxMtrHeight->set_sensitive(false);
+ mxCbxScale->set_sensitive(false);
}
else
{
@@ -1015,36 +948,36 @@ void PosSizePropertyPanel::DisableControls()
{
if( mbAutoWidth )
{
- mpFtWidth->Disable();
- mpMtrWidth->Disable();
- mpCbxScale->Disable();
+ mxFtWidth->set_sensitive(false);
+ mxMtrWidth->set_sensitive(false);
+ mxCbxScale->set_sensitive(false);
}
else
{
- mpFtWidth->Enable();
- mpMtrWidth->Enable();
+ mxFtWidth->set_sensitive(true);
+ mxMtrWidth->set_sensitive(true);
}
if( mbAutoHeight )
{
- mpFtHeight->Disable();
- mpMtrHeight->Disable();
- mpCbxScale->Disable();
+ mxFtHeight->set_sensitive(false);
+ mxMtrHeight->set_sensitive(false);
+ mxCbxScale->set_sensitive(false);
}
else
{
- mpFtHeight->Enable();
- mpMtrHeight->Enable();
+ mxFtHeight->set_sensitive(true);
+ mxMtrHeight->set_sensitive(true);
}
if( !mbAutoWidth && !mbAutoHeight )
- mpCbxScale->Enable();
+ mxCbxScale->set_sensitive(true);
}
else
{
- mpFtWidth->Enable();
- mpMtrWidth->Enable();
- mpFtHeight->Enable();
- mpMtrHeight->Enable();
- mpCbxScale->Enable();
+ mxFtWidth->set_sensitive(true);
+ mxMtrWidth->set_sensitive(true);
+ mxFtHeight->set_sensitive(true);
+ mxMtrHeight->set_sensitive(true);
+ mxCbxScale->set_sensitive(true);
}
}
}
@@ -1067,7 +1000,7 @@ void PosSizePropertyPanel::SetPosSizeMinMax()
TransfrmHelper::ScaleRect( maWorkArea, aUIScale );
TransfrmHelper::ScaleRect( maRect, aUIScale );
- const sal_uInt16 nDigits(mpMtrPosX->GetDecimalDigits());
+ const sal_uInt16 nDigits(mxMtrPosX->get_digits());
TransfrmHelper::ConvertRect( maWorkArea, nDigits, mePoolUnit, meDlgUnit );
TransfrmHelper::ConvertRect( maRect, nDigits, mePoolUnit, meDlgUnit );
@@ -1087,21 +1020,17 @@ void PosSizePropertyPanel::SetPosSizeMinMax()
fTop = std::clamp(fTop, - fMaxLong, fMaxLong);
fBottom = std::clamp(fBottom, -fMaxLong, fMaxLong);
- mpMtrPosX->SetMin(basegfx::fround64(fLeft));
- mpMtrPosX->SetFirst(basegfx::fround64(fLeft));
- mpMtrPosX->SetMax(basegfx::fround64(fRight));
- mpMtrPosX->SetLast(basegfx::fround64(fRight));
- mpMtrPosY->SetMin(basegfx::fround64(fTop));
- mpMtrPosY->SetFirst(basegfx::fround64(fTop));
- mpMtrPosY->SetMax(basegfx::fround64(fBottom));
- mpMtrPosY->SetLast(basegfx::fround64(fBottom));
+ mxMtrPosX->set_range(basegfx::fround64(fLeft), basegfx::fround64(fRight), FieldUnit::NONE);
+ limitWidth(*mxMtrPosX);
+ mxMtrPosY->set_range(basegfx::fround64(fTop), basegfx::fround64(fBottom), FieldUnit::NONE);
+ limitWidth(*mxMtrPosY);
double fMaxWidth = maWorkArea.getWidth() - (maRect.getWidth() - fLeft);
double fMaxHeight = maWorkArea.getHeight() - (maRect.getHeight() - fTop);
- mpMtrWidth->SetMax(basegfx::fround64(fMaxWidth*100));
- mpMtrWidth->SetLast(basegfx::fround64(fMaxWidth*100));
- mpMtrHeight->SetMax(basegfx::fround64(fMaxHeight*100));
- mpMtrHeight->SetLast(basegfx::fround64(fMaxHeight*100));
+ mxMtrWidth->set_max(basegfx::fround64(fMaxWidth*100), FieldUnit::NONE);
+ limitWidth(*mxMtrWidth);
+ mxMtrHeight->set_max(basegfx::fround64(fMaxHeight*100), FieldUnit::NONE);
+ limitWidth(*mxMtrHeight);
}
void PosSizePropertyPanel::UpdateUIScale()
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
index 3bc3f96f4151..2e957b66a648 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
@@ -19,10 +19,10 @@
#ifndef INCLUDED_SVX_SOURCE_SIDEBAR_POSSIZE_POSSIZEPROPERTYPANEL_HXX
#define INCLUDED_SVX_SOURCE_SIDEBAR_POSSIZE_POSSIZEPROPERTYPANEL_HXX
-#include <vcl/ctrl.hxx>
#include <sfx2/sidebar/SidebarPanelBase.hxx>
#include <sfx2/sidebar/ControllerItem.hxx>
#include <sfx2/sidebar/IContextChangeReceiver.hxx>
+#include <sfx2/weldutils.hxx>
#include <svx/rectenum.hxx>
#include <svx/sidebar/PanelLayout.hxx>
#include <svl/poolitem.hxx>
@@ -30,17 +30,13 @@
#include <tools/fract.hxx>
#include <com/sun/star/ui/XSidebar.hpp>
#include <basegfx/range/b2drange.hxx>
+#include <vcl/customweld.hxx>
+#include <vcl/weld.hxx>
class SdrView;
-class FixedText;
-class MetricField;
-class CheckBox;
-class MetricBox;
-class Edit;
-class ToolBox;
namespace svx {
-class DialControl;
+class SvxDialControl;
};
namespace svx { namespace sidebar {
@@ -84,31 +80,36 @@ public:
private:
//Position
- VclPtr<FixedText> mpFtPosX;
- VclPtr<MetricField> mpMtrPosX;
- VclPtr<FixedText> mpFtPosY;
- VclPtr<MetricField> mpMtrPosY;
+ std::unique_ptr<weld::Label> mxFtPosX;
+ std::unique_ptr<weld::MetricSpinButton> mxMtrPosX;
+ std::unique_ptr<weld::Label> mxFtPosY;
+ std::unique_ptr<weld::MetricSpinButton> mxMtrPosY;
// size
- VclPtr<FixedText> mpFtWidth;
- VclPtr<MetricField> mpMtrWidth;
- VclPtr<FixedText> mpFtHeight;
- VclPtr<MetricField> mpMtrHeight;
- VclPtr<CheckBox> mpCbxScale;
+ std::unique_ptr<weld::Label> mxFtWidth;
+ std::unique_ptr<weld::MetricSpinButton> mxMtrWidth;
+ std::unique_ptr<weld::Label> mxFtHeight;
+ std::unique_ptr<weld::MetricSpinButton> mxMtrHeight;
+ std::unique_ptr<weld::CheckButton> mxCbxScale;
//rotation
- VclPtr<FixedText> mpFtAngle;
- VclPtr<MetricBox> mpMtrAngle;
+ std::unique_ptr<weld::Label> mxFtAngle;
+ std::unique_ptr<weld::SpinButton> mxMtrAngle;
//rotation control
- VclPtr<SidebarDialControl> mpDial;
+ std::unique_ptr<svx::SvxDialControl> mxCtrlDial;
+ std::unique_ptr<weld::CustomWeld> mxDial;
//flip
- VclPtr<FixedText> mpFtFlip;
- VclPtr<ToolBox> mpFlipTbx;
+ std::unique_ptr<weld::Label> mxFtFlip;
+ std::unique_ptr<weld::Toolbar> mxFlipTbx;
+ std::unique_ptr<ToolbarUnoDispatcher> mxFlipDispatch;
+
+ std::unique_ptr<weld::Toolbar> mxArrangeTbx;
+ std::unique_ptr<ToolbarUnoDispatcher> mxArrangeDispatch;
//edit charts button for online's mobile view
- VclPtr<PushButton> mpBtnEditChart;
+ std::unique_ptr<weld::Button> mxBtnEditChart;
// Internal variables
basegfx::B2DRange maRect;
@@ -148,15 +149,14 @@ private:
css::uno::Reference<css::ui::XSidebar> mxSidebar;
- DECL_LINK( ChangePosXHdl, Edit&, void );
- DECL_LINK( ChangePosYHdl, Edit&, void );
- DECL_LINK( ChangeWidthHdl, Edit&, void );
- DECL_LINK( ChangeHeightHdl, Edit&, void );
- DECL_LINK( ClickAutoHdl, Button*, void );
- DECL_LINK( AngleModifiedHdl, Edit&, void );
- DECL_LINK( RotationHdl, svx::DialControl*, void );
- DECL_LINK( FlipHdl, ToolBox *, void );
- DECL_STATIC_LINK( PosSizePropertyPanel, ClickChartEditHdl, Button*, void );
+ DECL_LINK( ChangePosXHdl, weld::MetricSpinButton&, void );
+ DECL_LINK( ChangePosYHdl, weld::MetricSpinButton&, void );
+ DECL_LINK( ChangeWidthHdl, weld::MetricSpinButton&, void );
+ DECL_LINK( ChangeHeightHdl, weld::MetricSpinButton&, void );
+ DECL_LINK( ClickAutoHdl, weld::ToggleButton&, void );
+ DECL_LINK( AngleModifiedHdl, weld::SpinButton&, void );
+ DECL_LINK( RotationHdl, svx::SvxDialControl*, void );
+ DECL_STATIC_LINK( PosSizePropertyPanel, ClickChartEditHdl, weld::Button&, void );
void Initialize();
void executeSize();
diff --git a/svx/uiconfig/ui/sidebarpossize.ui b/svx/uiconfig/ui/sidebarpossize.ui
index 8605a49d387e..d88aecdbafce 100644
--- a/svx/uiconfig/ui/sidebarpossize.ui
+++ b/svx/uiconfig/ui/sidebarpossize.ui
@@ -2,18 +2,35 @@
<!-- Generated with glade 3.22.1 -->
<interface domain="svx">
<requires lib="gtk+" version="3.18"/>
- <requires lib="LibreOffice" version="1.0"/>
- <object class="GtkAdjustment" id="adjustment1">
- <property name="lower">-180</property>
- <property name="upper">359.99000000000001</property>
+ <object class="GtkAdjustment" id="adjustmentPOS">
+ <property name="lower">-120</property>
+ <property name="upper">240</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustmentPOS1">
+ <property name="lower">-120</property>
+ <property name="upper">240</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustmentSIZE">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustmentSIZE1">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustmentSpinDegrees">
+ <property name="upper">359</property>
<property name="step_increment">5</property>
- <property name="page_increment">20</property>
</object>
<object class="GtkGrid" id="PosSizePropertyPanel">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="row_homogeneous">True</property>
- <property name="column_homogeneous">True</property>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
@@ -41,6 +58,7 @@
<property name="hexpand">True</property>
<property name="label" translatable="yes" context="sidebarpossize|horizontallabel">Position _X:</property>
<property name="use_underline">True</property>
+ <property name="mnemonic_widget">horizontalpos</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -49,16 +67,15 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="horizontalpos:0in">
+ <object class="GtkSpinButton" id="horizontalpos">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="sidebarpossize|horizontalpos|tooltip_text">Enter the value for the horizontal position.</property>
- <accessibility>
- <relation type="labelled-by" target="horizontallabel"/>
- </accessibility>
+ <property name="adjustment">adjustmentPOS</property>
+ <property name="digits">2</property>
<child internal-child="accessible">
- <object class="AtkObject" id="horizontalpos:0in-atkobject">
+ <object class="AtkObject" id="horizontalpos-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="sidebarpossize|horizontalpos">Horizontal</property>
</object>
</child>
@@ -75,6 +92,7 @@
<property name="hexpand">True</property>
<property name="label" translatable="yes" context="sidebarpossize|verticallabel">Position _Y:</property>
<property name="use_underline">True</property>
+ <property name="mnemonic_widget">verticalpos</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -83,16 +101,14 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="verticalpos:0in">
+ <object class="GtkSpinButton" id="verticalpos">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="sidebarpossize|verticalpos|tooltip_text">Enter the value for the vertical position.</property>
- <accessibility>
- <relation type="labelled-by" target="verticallabel"/>
- </accessibility>
+ <property name="adjustment">adjustmentPOS1</property>
<child internal-child="accessible">
- <object class="AtkObject" id="verticalpos:0in-atkobject">
+ <object class="AtkObject" id="verticalpos-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="sidebarpossize|verticalpos">Vertical</property>
</object>
</child>
@@ -109,6 +125,7 @@
<property name="hexpand">True</property>
<property name="label" translatable="yes" context="sidebarpossize|widthlabel">_Width:</property>
<property name="use_underline">True</property>
+ <property name="mnemonic_widget">selectwidth</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -117,17 +134,16 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="selectwidth:0in">
+ <object class="GtkSpinButton" id="selectwidth">
<property name="width_request">120</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="sidebarpossize|selectwidth|tooltip_text">Enter a width for the selected object.</property>
- <accessibility>
- <relation type="labelled-by" target="widthlabel"/>
- </accessibility>
+ <property name="adjustment">adjustmentSIZE</property>
+ <property name="digits">2</property>
<child internal-child="accessible">
- <object class="AtkObject" id="selectwidth:0in-atkobject">
+ <object class="AtkObject" id="selectwidth-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="sidebarpossize|selectwidth">Width</property>
</object>
</child>
@@ -144,6 +160,7 @@
<property name="hexpand">True</property>
<property name="label" translatable="yes" context="sidebarpossize|heightlabel">H_eight:</property>
<property name="use_underline">True</property>
+ <property name="mnemonic_widget">selectheight</property>
<property name="xalign">0</property>
</object>
<packing>
@@ -152,17 +169,16 @@
</packing>
</child>
<child>
- <object class="GtkSpinButton" id="selectheight:0in">
+ <object class="GtkSpinButton" id="selectheight">
<property name="width_request">120</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="sidebarpossize|selectheight|tooltip_text">Enter a height for the selected object.</property>
- <accessibility>
- <relation type="labelled-by" target="heightlabel"/>
- </accessibility>
+ <property name="adjustment">adjustmentSIZE1</property>
+ <property name="digits">2</property>
<child internal-child="accessible">
- <object class="AtkObject" id="selectheight:0in-atkobject">
+ <object class="AtkObject" id="selectheight-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="sidebarpossize|selectheight">Height</property>
</object>
</child>
@@ -204,6 +220,10 @@
<property name="label" translatable="yes" context="sidebarpossize|rotationlabel">_Rotation:</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
+ <accessibility>
+ <relation type="label-for" target="orientationcontrol"/>
+ <relation type="label-for" target="rotation"/>
+ </accessibility>
</object>
<packing>
<property name="expand">False</property>
@@ -217,18 +237,33 @@
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="spacing">6</property>
- <property name="homogeneous">True</property>
<child>
- <object class="svxlo-SidebarDialControl" id="orientationcontrol">
+ <object class="GtkScrolledWindow" id="preview">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="vexpand">True</property>
- <accessibility>
- <relation type="labelled-by" target="rotationlabel"/>
- </accessibility>
- <child internal-child="accessible">
- <object class="AtkObject" id="orientationcontrol-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes" context="sidebarpossize|orientationcontrol">Rotation</property>
+ <property name="can_focus">True</property>
+ <property name="halign">start</property>
+ <property name="valign">start</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkViewport">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkDrawingArea" id="orientationcontrol">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
+ <property name="tooltip_text" translatable="yes" context="rotationtabpage|CTL_ANGLE|tooltip_text">Rotation Angle</property>
+ <accessibility>
+ <relation type="labelled-by" target="rotationlabel"/>
+ </accessibility>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="orientationcontrol-atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes" context="sidebarpossize|orientationcontrol">Rotation</property>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
</child>
</object>
@@ -246,17 +281,21 @@
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
- <object class="VclComboBoxNumeric" id="rotation:0.00degrees">
+ <object class="GtkSpinButton" id="rotation">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="sidebarpossize|rotation|tooltip_text">Select the angle for rotation.</property>
- <property name="hexpand">True</property>
- <property name="adjustment">adjustment1</property>
+ <property name="halign">start</property>
+ <property name="adjustment">adjustmentSpinDegrees</property>
+ <property name="wrap">True</property>
+ <accessibility>
+ <relation type="labelled-by" target="rotationlabel"/>
+ </accessibility>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">True</property>
+ <property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
@@ -269,14 +308,13 @@
<object class="GtkLabel" id="fliplabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">True</property>
<property name="label" translatable="yes" context="sidebarpossize|fliplabel">_Flip:</property>
<property name="use_underline">True</property>
- <property name="justify">right</property>
+ <property name="mnemonic_widget">selectrotationtype</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
@@ -285,38 +323,36 @@
<object class="GtkToolbar" id="selectrotationtype">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="halign">end</property>
+ <property name="halign">start</property>
+ <property name="toolbar_style">icons</property>
+ <property name="show_arrow">False</property>
+ <property name="icon_size">2</property>
<child>
- <object class="GtkToolButton" id="flipvertical">
+ <object class="GtkToolButton" id=".uno:FlipVertical">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="sidebarpossize|flipvertical|tooltip_text">Flip the selected object vertically.</property>
- <property name="action_name">.uno:FlipVertical</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
+ <property name="homogeneous">False</property>
</packing>
</child>
<child>
- <object class="GtkToolButton" id="fliphorizontal">
+ <object class="GtkToolButton" id=".uno:FlipHorizontal">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="sidebarpossize|fliphorizontal|tooltip_text">Flip the selected object horizontally.</property>
- <property name="action_name">.uno:FlipHorizontal</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
+ <property name="homogeneous">False</property>
</packing>
</child>
- <accessibility>
- <relation type="labelled-by" target="fliplabel"/>
- </accessibility>
</object>
<packing>
<property name="expand">True</property>
@@ -355,68 +391,67 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="sidebarpossize|arrangelabel">_Arrange:</property>
<property name="use_underline">True</property>
+ <property name="mnemonic_widget">arrangetoolbar</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="sfxlo-SidebarToolBox" id="arrangetoolbar">
+ <object class="GtkToolbar" id="arrangetoolbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
<property name="tooltip_text" translatable="yes" context="sidebarpossize|arrangetoolbar">Arrange</property>
- <property name="halign">end</property>
+ <property name="halign">start</property>
+ <property name="toolbar_style">icons</property>
<property name="show_arrow">False</property>
+ <property name="icon_size">2</property>
<child>
- <object class="GtkToolButton" id="bringtofront">
+ <object class="GtkToolButton" id=".uno:BringToFront">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">.uno:BringToFront</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
+ <property name="homogeneous">False</property>
</packing>
</child>
<child>
- <object class="GtkToolButton" id="forward">
+ <object class="GtkToolButton" id=".uno:ObjectForwardOne">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">.uno:ObjectForwardOne</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
+ <property name="homogeneous">False</property>
</packing>
</child>
<child>
- <object class="GtkToolButton" id="backward">
+ <object class="GtkToolButton" id=".uno:ObjectBackOne">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">.uno:ObjectBackOne</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
+ <property name="homogeneous">False</property>
</packing>
</child>
<child>
- <object class="GtkToolButton" id="sendtoback">
+ <object class="GtkToolButton" id=".uno:SendToBack">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="action_name">.uno:SendToBack</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="homogeneous">True</property>
+ <property name="homogeneous">False</property>
</packing>
</child>
</object>