From f013d4a1f4073cda735befd6e446bee35f3db65c Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Sat, 29 Oct 2016 17:26:57 +0300 Subject: tdf#41542 PaddingWithoutBorders: allow UI changes if... If the compatibility option is set, allow the border dialog for frames to be able to adjust the spacing values without enabling the border lines. That means it is only true for .doc and .docx right now. Change-Id: I4004a849f7369c993089d1c7b5d856cbea4f7780 Reviewed-on: https://gerrit.libreoffice.org/28602 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna --- cui/source/inc/border.hxx | 1 + cui/source/tabpages/border.cxx | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'cui/source') diff --git a/cui/source/inc/border.hxx b/cui/source/inc/border.hxx index c32dba59e174..9675b1029a94 100644 --- a/cui/source/inc/border.hxx +++ b/cui/source/inc/border.hxx @@ -111,6 +111,7 @@ private: bool mbTLBREnabled; ///< true = Top-left to bottom-right border enabled. bool mbBLTREnabled; ///< true = Bottom-left to top-right border enabled. bool mbUseMarginItem; + bool mbAllowPaddingWithoutBorders; bool mbSync; bool mbRemoveAdjacentCellBorders; bool bIsCalcDoc; diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index 05c8914abc5c..d74ae35b723a 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -102,6 +102,7 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore mbTLBREnabled( false ), mbBLTREnabled( false ), mbUseMarginItem( false ), + mbAllowPaddingWithoutBorders( false ), mbSync(true), mbRemoveAdjacentCellBorders( false ), bIsCalcDoc( false ) @@ -180,6 +181,11 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore m_pLineWidthMF->SetValue(p->GetValue()); } + if (rCoreAttrs.HasItem(SID_ALLOW_PADDING_WITHOUT_BORDERS, &pItem)) + { + mbAllowPaddingWithoutBorders = static_cast(pItem)->GetValue(); + } + // set metric FieldUnit eFUnit = GetModuleFieldUnit( rCoreAttrs ); @@ -698,10 +704,11 @@ bool SvxBorderTabPage::FillItemSet( SfxItemSet* rCoreAttrs ) if( !m_pLeftMF->GetText().isEmpty() || !m_pRightMF->GetText().isEmpty() || !m_pTopMF->GetText().isEmpty() || !m_pBottomMF->GetText().isEmpty() ) { - if ( ((mbHorEnabled || mbVerEnabled || (nSWMode & SwBorderModes::TABLE)) && - (m_pLeftMF->IsModified()||m_pRightMF->IsModified()|| - m_pTopMF->IsModified()||m_pBottomMF->IsModified()) )|| - m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Top ) != svx::FrameBorderState::Hide + if ( mbAllowPaddingWithoutBorders + || ((mbHorEnabled || mbVerEnabled || (nSWMode & SwBorderModes::TABLE)) && + (m_pLeftMF->IsModified()||m_pRightMF->IsModified()|| + m_pTopMF->IsModified()||m_pBottomMF->IsModified()) ) + || m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Top ) != svx::FrameBorderState::Hide || m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Bottom ) != svx::FrameBorderState::Hide || m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Left ) != svx::FrameBorderState::Hide || m_pFrameSel->GetFrameBorderState( svx::FrameBorderType::Right ) != svx::FrameBorderState::Hide ) @@ -1156,7 +1163,7 @@ IMPL_LINK_NOARG(SvxBorderTabPage, LinesChanged_Impl, LinkParamNone*, void) m_pRightMF->SetFirst(0); m_pTopMF->SetFirst(0); m_pBottomMF->SetFirst(0); - if(!bSpaceModified) + if(!bSpaceModified && !mbAllowPaddingWithoutBorders) { m_pLeftMF->SetValue(0); m_pRightMF->SetValue(0); @@ -1168,7 +1175,7 @@ IMPL_LINK_NOARG(SvxBorderTabPage, LinesChanged_Impl, LinkParamNone*, void) SvxBoxInfoItemValidFlags nValid = SvxBoxInfoItemValidFlags::TOP|SvxBoxInfoItemValidFlags::BOTTOM|SvxBoxInfoItemValidFlags::LEFT|SvxBoxInfoItemValidFlags::RIGHT; // for other objects (paragraph, page, frame, character) the edit is disabled, if there's no border set - if(!(nSWMode & SwBorderModes::TABLE)) + if(!(nSWMode & SwBorderModes::TABLE) && !mbAllowPaddingWithoutBorders) { if(bLineSet) { -- cgit