From 52b29c60801cf75364fd8275a22e812797cb184d Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Thu, 1 Sep 2016 11:19:56 +0300 Subject: tdf#76349 SpacingWithoutBorders: enable .doc RT Microsoft allows spacing in textboxes even if the borders are not shown, but LO does not. Added a compatible setting, used an existing setting to allow the spacing, and changed .doc export not to zero out the spacing if the border was zero-width. Using the compatible setting in the export code is almost redundant, but it does require that the document was LOADED as .doc, and not "save as" from another format. This patch simply allows round-tripping - any user attempt to modify the border settings will enforce normal LO border rules. Change-Id: I60ac036e1bfac381eea15e33c21495ad3800277a Reviewed-on: https://gerrit.libreoffice.org/28601 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna --- sw/source/filter/ww8/wrtw8esh.cxx | 16 ++++++++++++---- sw/source/filter/ww8/ww8par.cxx | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'sw/source/filter') diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 2df3fe2ef0e2..0aa62eb85f57 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -1967,6 +1967,7 @@ sal_Int32 SwBasicEscherEx::WriteFlyFrameAttr(const SwFrameFormat& rFormat, sal_Int32 nLineWidth=0; const SfxPoolItem* pItem; bool bFirstLine = true; + const bool bAllowSpacingWithoutBorders = rFormat.getIDocumentSettingAccess().get(DocumentSettingId::ALLOW_SPACING_WITHOUT_BORDERS); if (SfxItemState::SET == rFormat.GetItemState(RES_BOX, true, &pItem)) { static const o3tl::enumarray aExhperProp = @@ -2034,6 +2035,10 @@ sal_Int32 SwBasicEscherEx::WriteFlyFrameAttr(const SwFrameFormat& rFormat, rPropOpt.AddOpt( aExhperProp[ n ], DrawModelToEmu( static_cast(pItem)->GetDistance( n ) )); } + else if( bAllowSpacingWithoutBorders ) + { + rPropOpt.AddOpt( aExhperProp[ n ], DrawModelToEmu(static_cast(pItem)->GetDistance( n )) ); + } else // MM If there is no line the distance should be set to 0 rPropOpt.AddOpt( aExhperProp[ n ], DrawModelToEmu(0)); @@ -2041,10 +2046,13 @@ sal_Int32 SwBasicEscherEx::WriteFlyFrameAttr(const SwFrameFormat& rFormat, if( bFirstLine ) // no valid line found { rPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 ); - rPropOpt.AddOpt( ESCHER_Prop_dyTextTop, 0 ); - rPropOpt.AddOpt( ESCHER_Prop_dyTextBottom, 0 ); - rPropOpt.AddOpt( ESCHER_Prop_dxTextLeft, 0 ); - rPropOpt.AddOpt( ESCHER_Prop_dxTextRight, 0 ); + if( !bAllowSpacingWithoutBorders ) + { + rPropOpt.AddOpt( ESCHER_Prop_dyTextTop, 0 ); + rPropOpt.AddOpt( ESCHER_Prop_dyTextBottom, 0 ); + rPropOpt.AddOpt( ESCHER_Prop_dxTextLeft, 0 ); + rPropOpt.AddOpt( ESCHER_Prop_dxTextRight, 0 ); + } } const SwAttrSet& rAttrSet = rFormat.GetAttrSet(); if (SfxItemState::SET == rAttrSet.GetItemState(RES_BOX, false, &pItem)) diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 0c95f2227827..f1b7c73ee2e8 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1959,6 +1959,7 @@ 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_SPACING_WITHOUT_BORDERS, true); // COMPATIBILITY FLAGS END -- cgit v1.2.3