From 4f344f025a2fe0b8f2359aaf74a91f209e196923 Mon Sep 17 00:00:00 2001 From: Kshitij Pathania Date: Sun, 10 Dec 2017 22:28:48 +0530 Subject: tdf#111747 Enabled position protection immediately after protection is checked MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I10409fe9e6eb7b932496346224952a7c4012cb38 Reviewed-on: https://gerrit.libreoffice.org/46192 Tested-by: Jenkins Reviewed-by: Tamás Zolnai --- cui/source/inc/swpossizetabpage.hxx | 2 +- cui/source/tabpages/swpossizetabpage.cxx | 13 +++++++++++++ cui/source/tabpages/transfrm.cxx | 25 +++++++++++++++++++++++-- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/cui/source/inc/swpossizetabpage.hxx b/cui/source/inc/swpossizetabpage.hxx index cbcb39274673..0f8924a9d7fd 100644 --- a/cui/source/inc/swpossizetabpage.hxx +++ b/cui/source/inc/swpossizetabpage.hxx @@ -93,7 +93,7 @@ class SvxSwPosSizeTabPage : public SfxTabPage bool m_bPositioningDisabled; bool m_bIsMultiSelection; bool m_bIsInRightToLeft; - + TriState m_nProtectSizeState; DECL_LINK(RangeModifyHdl, Control&, void); DECL_LINK(RangeModifyClickHdl, Button*, void); diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx index 16126a4ea367..5b35baf2ecf0 100644 --- a/cui/source/tabpages/swpossizetabpage.cxx +++ b/cui/source/tabpages/swpossizetabpage.cxx @@ -525,6 +525,7 @@ SvxSwPosSizeTabPage::SvxSwPosSizeTabPage(vcl::Window* pParent, const SfxItemSet& , m_bPositioningDisabled(false) , m_bIsMultiSelection(false) , m_bIsInRightToLeft(false) + , m_nProtectSizeState(TRISTATE_FALSE) { get(m_pWidthMF, "width"); get(m_pHeightMF, "height"); @@ -1087,7 +1088,13 @@ void SvxSwPosSizeTabPage::Reset( const SfxItemSet* rSet) DeactivateRC SvxSwPosSizeTabPage::DeactivatePage( SfxItemSet* _pSet ) { if( _pSet ) + { + _pSet->Put(SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_POS ), + m_pPositionCB->GetState() == TRISTATE_TRUE )); + _pSet->Put(SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_SIZE ), + m_pSizeCB->GetState() == TRISTATE_TRUE )); FillItemSet( _pSet ); + } return DeactivateRC::LeavePage; } @@ -1393,6 +1400,12 @@ IMPL_LINK( SvxSwPosSizeTabPage, ModifyHdl, Edit&, rEdit, void ) IMPL_LINK_NOARG(SvxSwPosSizeTabPage, ProtectHdl, Button*, void) { + if( m_pSizeCB->IsEnabled() ) + { + m_nProtectSizeState = m_pSizeCB->GetState(); + } + + m_pSizeCB->SetState( m_pPositionCB->GetState() == TRISTATE_TRUE ? TRISTATE_TRUE : m_nProtectSizeState ); m_pSizeCB->Enable(m_pPositionCB->IsEnabled() && !m_pPositionCB->IsChecked()); } diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx index 245e823ba6c3..7ce63c79aa0d 100644 --- a/cui/source/tabpages/transfrm.cxx +++ b/cui/source/tabpages/transfrm.cxx @@ -327,8 +327,14 @@ VclPtr SvxAngleTabPage::Create( vcl::Window* pWindow, const SfxItemS } -void SvxAngleTabPage::ActivatePage(const SfxItemSet& /*rSet*/) +void SvxAngleTabPage::ActivatePage(const SfxItemSet& rSet) { + SfxBoolItem const * bPosProtect = nullptr; + if(SfxItemState::SET == rSet.GetItemState( GetWhich(SID_ATTR_TRANSFORM_PROTECT_POS ) , false, reinterpret_cast(&bPosProtect) )) + { + m_pFlPosition->Enable(!bPosProtect->GetValue()); + m_pFlAngle->Enable(!bPosProtect->GetValue()); + } } @@ -698,6 +704,18 @@ void SvxSlantTabPage::ActivatePage( const SfxItemSet& rSet ) const ::tools::Rectangle aTempRect(pRectItem->GetValue()); maRange = basegfx::B2DRange(aTempRect.Left(), aTempRect.Top(), aTempRect.Right(), aTempRect.Bottom()); } + + SfxBoolItem const * bPosProtect = nullptr; + if(SfxItemState::SET == rSet.GetItemState( GetWhich(SID_ATTR_TRANSFORM_PROTECT_POS ) , false, reinterpret_cast(&bPosProtect) )) + { + m_pFlAngle->Enable(!bPosProtect->GetValue()); + } + SfxBoolItem const * bSizeProtect = nullptr; + if(SfxItemState::SET == rSet.GetItemState( GetWhich(SID_ATTR_TRANSFORM_PROTECT_SIZE ) , false, reinterpret_cast(&bSizeProtect) )) + { + m_pFlAngle->Enable(!bSizeProtect->GetValue()); + } + } @@ -1168,7 +1186,10 @@ DeactivateRC SvxPositionSizeTabPage::DeactivatePage( SfxItemSet* _pSet ) basegfx::fround(fX), basegfx::fround(fY), basegfx::fround(fX + maRange.getWidth()), basegfx::fround(fY + maRange.getHeight())); _pSet->Put(SfxRectangleItem(SID_ATTR_TRANSFORM_INTERN, aOutRectangle)); - + _pSet->Put(SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_POS ), + m_pTsbPosProtect->GetState() == TRISTATE_TRUE )); + _pSet->Put(SfxBoolItem( GetWhich( SID_ATTR_TRANSFORM_PROTECT_SIZE ), + m_pTsbSizeProtect->GetState() == TRISTATE_TRUE )); FillItemSet(_pSet); } -- cgit v1.2.3