From 8a34ff14f18da0df261ae8f1ca3f23de157706a1 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Wed, 23 Nov 2016 08:16:17 +0300 Subject: [PATCH] tdf#41542 globally allow padding without borders: UI This is the final fix for tdf#41542 - enabling the UI to adjust the padding without requiring an enabled border line. Because almost every document edited by LO5.3 will gain the setting ALLOW_PADDING_WITHOUT_BORDERS = false, it cannot be kept as a preventative compatibility setting. Otherwise any document edited in 5.3 would act differently from any other document - not being allowed to modify borderless padding for frames, even in 5.4+. That would be a very confusing corner-case that is best avoided, so removing all compatibility code (which currently has no use). So, if an AllowPaddingWithoutBorders=false compatibility situation is ever required in the future, do not resurrect the name ALLOW_PADDING_WITHOUT_BORDRES. Additionally, code will also be needed to send the compatibility setting for each type of border (page, paragraph, character, header, frames, image). See commit f013d4a1f4073cda735befd6e446bee35f3db65c as an example of how to implement that for frames. This commit means there is a lot of dead code now (m_bBorderDist and mbAllowPaddingWithoutBorders are always true). LO5.7 seems like a good target to clean that up - to allow time to easily fix any regressions. Change-Id: I2d2091fa34f8b178a59347b35a81c944c9b24ed7 Reviewed-on: https://gerrit.libreoffice.org/31105 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna --- cui/source/tabpages/border.cxx | 7 +------ include/svx/svxids.hrc | 2 +- sw/inc/IDocumentSettingAccess.hxx | 1 - sw/source/core/doc/DocumentSettingManager.cxx | 5 ----- sw/source/core/inc/DocumentSettingManager.hxx | 1 - sw/source/core/layout/frmtool.cxx | 3 +-- sw/source/filter/ww8/ww8par.cxx | 1 - sw/source/uibase/shells/frmsh.cxx | 4 ---- sw/source/uibase/uno/SwXDocumentSettings.cxx | 13 ------------- writerfilter/source/filter/WriterFilter.cxx | 1 - 10 files changed, 3 insertions(+), 35 deletions(-) diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index f989a7ce7af6..d67df7f7c588 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -102,7 +102,7 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore mbTLBREnabled( false ), mbBLTREnabled( false ), mbUseMarginItem( false ), - mbAllowPaddingWithoutBorders( false ), + mbAllowPaddingWithoutBorders( true ), mbSync(true), mbRemoveAdjacentCellBorders( false ), bIsCalcDoc( false ) @@ -181,11 +181,6 @@ 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 ); diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc index 8a7f7c5fc4c5..6f6aaa563e3a 100644 --- a/include/svx/svxids.hrc +++ b/include/svx/svxids.hrc @@ -964,7 +964,7 @@ #define FN_SVX_SET_NUMBER ( SID_SVX_START + 1136 ) #define FN_SVX_SET_BULLET ( SID_SVX_START + 1137 ) #define FN_SVX_SET_OUTLINE ( SID_SVX_START + 1138 ) -#define SID_ALLOW_PADDING_WITHOUT_BORDERS ( SID_SVX_START + 1139 ) + #define SID_ATTR_BORDER_STYLES ( SID_SVX_START + 1140 ) #define SID_ATTR_BORDER_DEFAULT_WIDTH ( SID_SVX_START + 1141 ) // 1142 is used by editeng (SID_ATTR_CHAR_GRABBAG) diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx index 2827567d89f1..f16ae42f30dc 100644 --- a/sw/inc/IDocumentSettingAccess.hxx +++ b/sw/inc/IDocumentSettingAccess.hxx @@ -39,7 +39,6 @@ enum class DocumentSettingId ADD_FLY_OFFSETS, ADD_VERTICAL_FLY_OFFSETS, - ALLOW_PADDING_WITHOUT_BORDERS, OLD_NUMBERING, ADD_EXT_LEADING, diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx index 78201b61016a..5cf29c0a4e8a 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -55,7 +55,6 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc) mbAddFlyOffsets(false), mbAddVerticalFlyOffsets(false), - mbAllowPaddingWithoutBorders( false ), mbUseHiResolutionVirtualDevice(true), mbMathBaselineAlignment(false), // default for *old* documents is 'off' mbStylesNoDefault(false), @@ -147,7 +146,6 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const case DocumentSettingId::TAB_COMPAT: return mbTabCompat; //(n8Dummy1 & DUMMY_TAB_COMPAT); case DocumentSettingId::ADD_FLY_OFFSETS: return mbAddFlyOffsets; //(n8Dummy2 & DUMMY_ADD_FLY_OFFSETS); case DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS: return mbAddVerticalFlyOffsets; - case DocumentSettingId::ALLOW_PADDING_WITHOUT_BORDERS: return mbAllowPaddingWithoutBorders; case DocumentSettingId::ADD_EXT_LEADING: return mbAddExternalLeading; //(n8Dummy2 & DUMMY_ADD_EXTERNAL_LEADING); case DocumentSettingId::USE_VIRTUAL_DEVICE: return mbUseVirtualDevice; //(n8Dummy1 & DUMMY_USE_VIRTUAL_DEVICE); case DocumentSettingId::USE_HIRES_VIRTUAL_DEVICE: return mbUseHiResolutionVirtualDevice; //(n8Dummy2 & DUMMY_USE_HIRES_VIR_DEV); @@ -223,9 +221,6 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo case DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS: mbAddVerticalFlyOffsets = value; break; - case DocumentSettingId::ALLOW_PADDING_WITHOUT_BORDERS: - mbAllowPaddingWithoutBorders = value; - break; case DocumentSettingId::ADD_EXT_LEADING: mbAddExternalLeading = value; break; diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx index 6927f83db287..ba52cbfacd83 100644 --- a/sw/source/core/inc/DocumentSettingManager.hxx +++ b/sw/source/core/inc/DocumentSettingManager.hxx @@ -109,7 +109,6 @@ class DocumentSettingManager : bool mbUseVirtualDevice : 1; bool mbAddFlyOffsets : 1; bool mbAddVerticalFlyOffsets : 1; - bool mbAllowPaddingWithoutBorders : 1; // tdf#41542 bool mbAddExternalLeading : 1; bool mbUseHiResolutionVirtualDevice : 1; bool mbOldLineSpacing : 1; // #i11859# diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 6c470530adf8..ae891013136b 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -1829,8 +1829,7 @@ SwBorderAttrs::SwBorderAttrs(const SwModify *pMod, const SwFrame *pConstructor) m_bCachedJoinedWithPrev = false; m_bCachedJoinedWithNext = false; - bool bAllowPaddingWithoutBorders = true; - m_bBorderDist = bool(pConstructor->GetType() & SwFrameType::Cell) || bAllowPaddingWithoutBorders; + m_bBorderDist = true; } SwBorderAttrs::~SwBorderAttrs() diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 10094cf44931..4bc3a346f6cf 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1959,7 +1959,6 @@ void SwWW8ImplReader::ImportDop() m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::TAB_OVER_MARGIN, true); m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::SURROUND_TEXT_WRAP_SMALL, true); m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::PROP_LINE_SPACING_SHRINKS_FIRST_LINE, true); - m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::ALLOW_PADDING_WITHOUT_BORDERS, true); // COMPATIBILITY FLAGS END diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index 1fe81f86709a..66fd5a567e31 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -405,7 +405,6 @@ void SwFrameShell::Execute(SfxRequest &rReq) SID_COLOR_TABLE, SID_PATTERN_LIST, // [10179 SID_HTML_MODE, SID_HTML_MODE, // [10414 - SID_ALLOW_PADDING_WITHOUT_BORDERS, SID_ALLOW_PADDING_WITHOUT_BORDERS, // [11139 FN_GET_PRINT_AREA, FN_GET_PRINT_AREA, // [21032 FN_SURROUND, FN_HORI_ORIENT, // [21303 FN_SET_FRM_NAME, FN_KEEP_ASPECT_RATIO, // [21306 @@ -457,9 +456,6 @@ void SwFrameShell::Execute(SfxRequest &rReq) const uno::Reference < embed::XEmbeddedObject > xObj( rSh.GetOleRef() ); aSet.Put( SfxBoolItem( FN_OLE_IS_MATH, xObj.is() && SotExchange::IsMath( xObj->getClassID() ) ) ); - aSet.Put( SfxBoolItem( SID_ALLOW_PADDING_WITHOUT_BORDERS, - rSh.GetDoc()->getIDocumentSettingAccess().get(DocumentSettingId::ALLOW_PADDING_WITHOUT_BORDERS) ) ); - OString sDefPage; if(pArgs && pArgs->GetItemState(FN_FORMAT_FRAME_DLG, false, &pItem) == SfxItemState::SET) sDefPage = OUStringToOString(static_cast(pItem)->GetValue(), RTL_TEXTENCODING_UTF8); diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index 3d6cebefe5f8..22a82a3743cf 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -90,7 +90,6 @@ enum SwDocumentSettingsPropertyHandles HANDLE_IS_LABEL_DOC, HANDLE_IS_ADD_FLY_OFFSET, HANDLE_IS_ADD_VERTICAL_FLY_OFFSET, - HANDLE_ALLOW_PADDING_WITHOUT_BORDERS, HANDLE_IS_ADD_EXTERNAL_LEADING, HANDLE_OLD_NUMBERING, HANDLE_OUTLINELEVEL_YIELDS_NUMBERING, @@ -167,7 +166,6 @@ static MasterPropertySetInfo * lcl_createSettingsInfo() { OUString("IsLabelDocument"), HANDLE_IS_LABEL_DOC, cppu::UnoType::get(), 0}, { OUString("AddFrameOffsets"), HANDLE_IS_ADD_FLY_OFFSET, cppu::UnoType::get(), 0}, { OUString("AddVerticalFrameOffsets"), HANDLE_IS_ADD_VERTICAL_FLY_OFFSET, cppu::UnoType::get(), 0}, - { OUString("AllowPaddingWithoutBorders"), HANDLE_ALLOW_PADDING_WITHOUT_BORDERS, cppu::UnoType::get(), 0}, { OUString("AddExternalLeading"), HANDLE_IS_ADD_EXTERNAL_LEADING, cppu::UnoType::get(), 0}, { OUString("UseOldNumbering"), HANDLE_OLD_NUMBERING, cppu::UnoType::get(), 0}, { OUString("OutlineLevelYieldsNumbering"), HANDLE_OUTLINELEVEL_YIELDS_NUMBERING, cppu::UnoType::get(), 0}, @@ -569,12 +567,6 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS, bTmp); } break; - case HANDLE_ALLOW_PADDING_WITHOUT_BORDERS: - { - bool bTmp = *o3tl::doAccess(rValue); - mpDoc->getIDocumentSettingAccess().set(DocumentSettingId::ALLOW_PADDING_WITHOUT_BORDERS, bTmp); - } - break; case HANDLE_IS_ADD_EXTERNAL_LEADING: { bool bTmp = *o3tl::doAccess(rValue); @@ -1063,11 +1055,6 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS); } break; - case HANDLE_ALLOW_PADDING_WITHOUT_BORDERS: - { - rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::ALLOW_PADDING_WITHOUT_BORDERS); - } - break; case HANDLE_IS_ADD_EXTERNAL_LEADING: { rValue <<= mpDoc->getIDocumentSettingAccess().get(DocumentSettingId::ADD_EXT_LEADING); diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx index 6ff2f7a73788..3826b09085a3 100644 --- a/writerfilter/source/filter/WriterFilter.cxx +++ b/writerfilter/source/filter/WriterFilter.cxx @@ -298,7 +298,6 @@ void WriterFilter::setTargetDocument(const uno::Reference< lang::XComponent >& x xSettings->setPropertyValue("TabOverMargin", uno::makeAny(true)); xSettings->setPropertyValue("TreatSingleColumnBreakAsPageBreak", uno::makeAny(true)); xSettings->setPropertyValue("PropLineSpacingShrinksFirstLine", uno::makeAny(true)); - xSettings->setPropertyValue("AllowPaddingWithoutBorders", uno::makeAny(true)); } void WriterFilter::setSourceDocument(const uno::Reference< lang::XComponent >& xDoc) throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)