summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKshitij Pathania <kshitijpathania@gmail.com>2017-12-10 22:28:48 +0530
committerTamás Zolnai <tamas.zolnai@collabora.com>2018-01-19 12:47:51 +0100
commit4f344f025a2fe0b8f2359aaf74a91f209e196923 (patch)
treefd0081a011d5f319412afae4c1456b351c342b8f
parentf2fd69e3c95723eb41ee35c9ff288bef027d2d8b (diff)
tdf#111747 Enabled position protection immediately after protection is checked
Change-Id: I10409fe9e6eb7b932496346224952a7c4012cb38 Reviewed-on: https://gerrit.libreoffice.org/46192 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
-rw-r--r--cui/source/inc/swpossizetabpage.hxx2
-rw-r--r--cui/source/tabpages/swpossizetabpage.cxx13
-rw-r--r--cui/source/tabpages/transfrm.cxx25
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<SfxTabPage> 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<SfxPoolItem const **>(&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<SfxPoolItem const **>(&bPosProtect) ))
+ {
+ m_pFlAngle->Enable(!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());
+ }
+
}
@@ -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);
}