diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-01-13 10:30:20 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-01-13 18:14:53 +0100 |
commit | 1caaf3cb0691a1659379ae3ce9964f600da5aa66 (patch) | |
tree | 01e36ce93b5067e72b71820c3466ce2de0ef3abe /svx | |
parent | a166a0d1d2aae132668a60ad845db154643c743a (diff) |
update rotation immediately in sidebar
Change-Id: I7e44c3010bf44dca9c97548e040edf3af3573c43
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86674
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/dialog/dialcontrol.cxx | 26 | ||||
-rw-r--r-- | svx/source/sidebar/possize/PosSizePropertyPanel.cxx | 9 | ||||
-rw-r--r-- | svx/source/sidebar/possize/PosSizePropertyPanel.hxx | 2 |
3 files changed, 20 insertions, 17 deletions
diff --git a/svx/source/dialog/dialcontrol.cxx b/svx/source/dialog/dialcontrol.cxx index 3ca96e2926af..6ebe5e397db2 100644 --- a/svx/source/dialog/dialcontrol.cxx +++ b/svx/source/dialog/dialcontrol.cxx @@ -354,6 +354,11 @@ sal_Int32 DialControl::GetRotation() const return mpImpl->mnAngle; } +void DialControl::SetRotation(sal_Int32 nAngle) +{ + SetRotation(nAngle, false); +} + void DialControl::SetLinkedField(weld::SpinButton* pField, sal_Int32 nDecimalPlaces) { mpImpl->mnLinkedFieldValueMultiplyer = 100 / std::pow(10.0, double(nDecimalPlaces)); @@ -376,13 +381,7 @@ void DialControl::SetLinkedField(weld::SpinButton* pField, sal_Int32 nDecimalPla IMPL_LINK_NOARG(DialControl, LinkedFieldModifyHdl, weld::SpinButton&, void) { - LinkedFieldModifyHdl(); -} - -void DialControl::LinkedFieldModifyHdl() -{ - if( mpImpl->mpLinkField ) - SetRotation(mpImpl->mpLinkField->get_value() * mpImpl->mnLinkedFieldValueMultiplyer); + SetRotation(mpImpl->mpLinkField->get_value() * mpImpl->mnLinkedFieldValueMultiplyer, true); } void DialControl::SaveValue() @@ -422,7 +421,7 @@ void DialControl::InvalidateControl() Invalidate(); } -void DialControl::SetRotation(sal_Int32 nAngle) +void DialControl::SetRotation(sal_Int32 nAngle, bool bBroadcast) { bool bOldSel = mpImpl->mbNoRot; mpImpl->mbNoRot = false; @@ -436,9 +435,16 @@ void DialControl::SetRotation(sal_Int32 nAngle) InvalidateControl(); if( mpImpl->mpLinkField ) mpImpl->mpLinkField->set_value(GetRotation() / mpImpl->mnLinkedFieldValueMultiplyer); + if( bBroadcast ) + mpImpl->maModifyHdl.Call(*this); } } +void DialControl::SetModifyHdl( const Link<DialControl&,void>& rLink ) +{ + mpImpl->maModifyHdl = rLink; +} + void DialControl::HandleMouseEvent( const Point& rPos, bool bInitial ) { long nX = rPos.X() - mpImpl->mnCenterX; @@ -454,7 +460,7 @@ void DialControl::HandleMouseEvent( const Point& rPos, bool bInitial ) nAngle = ((nAngle + 750) / 1500) * 1500; // Round up to 1 degree nAngle = (((nAngle + 50) / 100) * 100) % 36000; - SetRotation( nAngle ); + SetRotation(nAngle, true); } } @@ -463,7 +469,7 @@ void DialControl::HandleEscapeEvent() if( IsMouseCaptured() ) { ReleaseMouse(); - SetRotation( mpImpl->mnOldAngle ); + SetRotation(mpImpl->mnOldAngle, true); if( mpImpl->mpLinkField ) mpImpl->mpLinkField->grab_focus(); } diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx index a0d030172cef..fb4798920ce4 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx @@ -207,11 +207,9 @@ void PosSizePropertyPanel::Initialize() //Size : Keep ratio mxCbxScale->connect_toggled( LINK( this, PosSizePropertyPanel, ClickAutoHdl ) ); - //rotation: - mxMtrAngle->connect_value_changed(LINK( this, PosSizePropertyPanel, AngleModifiedHdl)); - //rotation control mxCtrlDial->SetLinkedField(mxMtrAngle.get()); + mxCtrlDial->SetModifyHdl(LINK( this, PosSizePropertyPanel, RotationHdl)); //use same logic as DialControl_Impl::SetSize weld::DrawingArea* pDrawingArea = mxCtrlDial->GetDrawingArea(); @@ -438,9 +436,9 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ClickAutoHdl, weld::ToggleButton&, void ) aPageOpt.SetUserItem( USERITEM_NAME, css::uno::makeAny( OUString::number( int(mxCbxScale->get_active()) ) ) ); } -IMPL_LINK_NOARG( PosSizePropertyPanel, AngleModifiedHdl, weld::SpinButton&, void ) +IMPL_LINK_NOARG( PosSizePropertyPanel, RotationHdl, DialControl&, void ) { - sal_Int64 nTmp = mxMtrAngle->get_value() * 100; + 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); @@ -452,7 +450,6 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, AngleModifiedHdl, weld::SpinButton&, void SfxCallMode::RECORD, { &aAngleItem, &aRotXItem, &aRotYItem }); } - IMPL_STATIC_LINK_NOARG( PosSizePropertyPanel, ClickChartEditHdl, weld::Button&, void ) { SfxViewShell* pCurSh = SfxViewShell::Current(); diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx index 297ddbc9ce81..271b160d88d1 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx @@ -152,7 +152,7 @@ private: 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::DialControl&, void ); DECL_STATIC_LINK( PosSizePropertyPanel, ClickChartEditHdl, weld::Button&, void ); void Initialize(); |