[Libreoffice-commits] core.git: Branch 'feature/cib_contract3753' - 48 commits - configure.ac cui/source filter/source i18npool/source include/oox include/vcl nlpsolver/src oox/source readlicense_oo/license sccomp/source sc/source sfx2/inc solenv/flatpak-manifest.in svl/source sw/inc sw/qa sw/source translations vcl/qt5 vcl/source writerfilter/source xmloff/CppunitTest_xmloff_text.mk xmloff/Module_xmloff.mk xmloff/qa xmloff/source xmlsecurity/inc xmlsecurity/qa xmlsecurity/source xmlsecurity/workben
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Fri Aug 7 16:25:43 UTC 2020
Rebased ref, commits from common ancestor:
commit a0da2a609e087a4b0ea406cb019de2e0a6942301
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Aug 6 14:12:04 2020 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Aug 7 16:42:18 2020 +0200
sw: HACK to disble DrawingML export for rotated text shapes
Change-Id: I7542d0dd000b974ce490b9b81f3d85412e2409f2
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 9a771a5f81b7..70b63e251495 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -444,9 +444,11 @@ DECLARE_OOXMLEXPORT_TEST(testRot90Fliph, "rot90-fliph.docx")
// The problem was that a shape rotation of 90° got turned into 270° after roundtrip.
if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
{
+#if 0
assertXPath(pXmlDoc, "//a:xfrm", "flipH", "1");
// This was 16200000 (270 * 60000).
assertXPath(pXmlDoc, "//a:xfrm", "rot", "5400000");
+#endif
}
}
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 3218ca060469..09ff67d0fb58 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -42,6 +42,7 @@ DECLARE_OOXMLEXPORT_TEST(testAtPageShapeRelOrientation, "rotated_shape.fodt")
if (!pXmlDocument)
return;
+#if 0
assertXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor"
"/wp:positionH/wp:posOffset", "-480060");
assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor"
@@ -60,13 +61,14 @@ DECLARE_OOXMLEXPORT_TEST(testAtPageShapeRelOrientation, "rotated_shape.fodt")
"/wp:positionV/wp:posOffset", "1080135");
assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/w:drawing/wp:anchor"
"/wp:positionV", "relativeFrom", "page");
+#endif
// now test text rotation -> VML writing direction
- assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Fallback/w:pict/v:shape/v:textbox", "style", "mso-layout-flow-alt:bottom-to-top");
+ assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/w:pict/v:shape/v:textbox", "style", "mso-layout-flow-alt:bottom-to-top");
// text wrap -> VML
- assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Fallback/w:pict/v:shape/w10:wrap", "type", "none");
+ assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/w:pict/v:shape/w10:wrap", "type", "none");
// vertical alignment -> VML
- OUString const style = getXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Fallback/w:pict/v:shape", "style");
+ OUString const style = getXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/w:pict/v:shape", "style");
CPPUNIT_ASSERT(style.indexOf("v-text-anchor:middle") != -1);
}
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 7cacc4eb3173..b86c64daeb24 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -16,6 +16,7 @@
#include <editeng/opaqitem.hxx>
#include <editeng/boxitem.hxx>
#include <svx/svdogrp.hxx>
+#include <svx/svdotext.hxx>
#include <oox/token/namespaces.hxx>
#include <textboxhelper.hxx>
#include <fmtanchr.hxx>
@@ -983,6 +984,24 @@ bool DocxSdrExport::Impl::isSupportedDMLShape(const uno::Reference<drawing::XSha
return true;
}
+bool lcl_isRotatedText(SdrObject const& rShape, uno::Reference<drawing::XShape> const& xShape)
+{
+ uno::Reference<beans::XPropertySet> const xProps(xShape, uno::UNO_QUERY);
+ sal_Int32 nRotateAngle = sal_Int32();
+ if (!dynamic_cast<SdrTextObj const*>(&rShape)
+ || !xProps->getPropertySetInfo()->hasPropertyByName("RotateAngle")
+ || !(xProps->getPropertyValue("RotateAngle") >>= nRotateAngle))
+ {
+ return false;
+ }
+ if (nRotateAngle == 9000) // is it enough, or should it be any angle != 0?
+ {
+ SAL_INFO("sw.ww8", "HACK: forcing rotated shape to VML only");
+ return true;
+ }
+ return false;
+}
+
void DocxSdrExport::writeDMLAndVMLDrawing(const SdrObject* sdrObj,
const SwFrameFormat& rFrameFormat, int nAnchorId)
{
@@ -1001,6 +1020,7 @@ void DocxSdrExport::writeDMLAndVMLDrawing(const SdrObject* sdrObj,
// In case we are already inside a DML block, then write the shape only as VML, turn out that's allowed to do.
// A common service created in util to check for VML shapes which are allowed to have textbox in content
if ((msfilter::util::HasTextBoxContent(eShapeType)) && Impl::isSupportedDMLShape(xShape)
+ && !lcl_isRotatedText(*sdrObj, xShape)
&& (!bDMLAndVMLDrawingOpen || lcl_isLockedCanvas(xShape))) // Locked canvas is OK inside DML
{
m_pImpl->getSerializer()->startElementNS(XML_mc, XML_AlternateContent);
commit 708f4e55c9b245b70ea4aa2bb1cbe668e90c015d
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Aug 7 15:50:12 2020 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Aug 7 16:42:18 2020 +0200
oox: VML export: convert ESCHER_Prop_AnchorText to v-text-anchor
Change-Id: I903cac8d7b02138680613b5a1b6dab4b1c448158
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 555796c47a9c..ee93cf32bd27 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -430,6 +430,47 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle&
bAlreadyWritten[ ESCHER_Prop_WrapText ] = true;
break;
+ case ESCHER_Prop_AnchorText: // 135
+ {
+ char const* pValue(nullptr);
+ switch (opt.nPropValue)
+ {
+ case ESCHER_AnchorTop:
+ pValue = "top";
+ break;
+ case ESCHER_AnchorMiddle:
+ pValue = "middle";
+ break;
+ case ESCHER_AnchorBottom:
+ pValue = "bottom";
+ break;
+ case ESCHER_AnchorTopCentered:
+ pValue = "top-center";
+ break;
+ case ESCHER_AnchorMiddleCentered:
+ pValue = "middle-center";
+ break;
+ case ESCHER_AnchorBottomCentered:
+ pValue = "bottom-center";
+ break;
+ case ESCHER_AnchorTopBaseline:
+ pValue = "top-baseline";
+ break;
+ case ESCHER_AnchorBottomBaseline:
+ pValue = "bottom-baseline";
+ break;
+ case ESCHER_AnchorTopCenteredBaseline:
+ pValue = "top-center-baseline";
+ break;
+ case ESCHER_AnchorBottomCenteredBaseline:
+ pValue = "bottom-center-baseline";
+ break;
+ }
+ m_ShapeStyle.append(";v-text-anchor:");
+ m_ShapeStyle.append(pValue);
+ }
+ break;
+
case ESCHER_Prop_txflTextFlow: // 136
{
// at least "bottom-to-top" only has an effect when it's on the v:textbox element, not on v:shape
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 6bc298fa559a..3218ca060469 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -65,7 +65,9 @@ DECLARE_OOXMLEXPORT_TEST(testAtPageShapeRelOrientation, "rotated_shape.fodt")
assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Fallback/w:pict/v:shape/v:textbox", "style", "mso-layout-flow-alt:bottom-to-top");
// text wrap -> VML
assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Fallback/w:pict/v:shape/w10:wrap", "type", "none");
-
+ // vertical alignment -> VML
+ OUString const style = getXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Fallback/w:pict/v:shape", "style");
+ CPPUNIT_ASSERT(style.indexOf("v-text-anchor:middle") != -1);
}
CPPUNIT_PLUGIN_IMPLEMENT();
commit 02e6052dca030200ab5dd49610e4ade92de3e581
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Aug 7 15:45:25 2020 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Aug 7 16:42:18 2020 +0200
oox: VML export: produce bottom-to-top in a better way
Replace code added in 090c61eb93db4302d4565d5f11f7673190835fdb
with something that uses the already generated ESCHER property; this
lets a warning about the unhandled property disappear too.
Change-Id: Ieed83dd8e17e92eea9901124fce5e6da2a17196a
diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx
index 83b5b91c0d41..7c2d3a62da6f 100644
--- a/include/oox/export/vmlexport.hxx
+++ b/include/oox/export/vmlexport.hxx
@@ -99,6 +99,9 @@ class OOX_DLLPUBLIC VMLExport : public EscherEx
/// Remember style, the most important shape attribute ;-)
OStringBuffer m_ShapeStyle;
+ /// style for textbox
+ OStringBuffer m_TextboxStyle;
+
/// Remember the generated shape id.
OString m_sShapeId;
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 6fcc83a66da6..555796c47a9c 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -430,6 +430,28 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle&
bAlreadyWritten[ ESCHER_Prop_WrapText ] = true;
break;
+ case ESCHER_Prop_txflTextFlow: // 136
+ {
+ // at least "bottom-to-top" only has an effect when it's on the v:textbox element, not on v:shape
+ assert(m_TextboxStyle.isEmpty());
+ switch (opt.nPropValue)
+ {
+ case ESCHER_txflHorzN:
+ m_TextboxStyle.append("layout-flow:horizontal");
+ break;
+ case ESCHER_txflTtoBA:
+ m_TextboxStyle.append("layout-flow:vertical");
+ break;
+ case ESCHER_txflBtoT:
+ m_TextboxStyle.append("mso-layout-flow-alt:bottom-to-top");
+ break;
+ default:
+ assert(false); // unimplemented in escher export
+ break;
+ }
+ }
+ break;
+
// coordorigin
case ESCHER_Prop_geoLeft: // 320
case ESCHER_Prop_geoTop: // 321
@@ -1345,6 +1367,8 @@ sal_Int32 VMLExport::StartShape()
// start of the shape
m_pSerializer->startElementNS( XML_v, nShapeElement, XFastAttributeListRef( m_pShapeAttrList ) );
+ OString const textboxStyle(m_TextboxStyle.makeStringAndClear());
+
// now check if we have some editeng text (not associated textbox) and we have a text exporter registered
const SdrTextObj* pTxtObj = dynamic_cast<const SdrTextObj*>( m_pSdrObject );
if (pTxtObj && m_pTextExport && msfilter::util::HasTextBoxContent(m_nShapeType) && !IsWaterMarkShape(m_pSdrObject->GetName()) && !lcl_isTextBox(m_pSdrObject))
@@ -1369,19 +1393,11 @@ sal_Int32 VMLExport::StartShape()
if( pParaObj )
{
- uno::Reference<beans::XPropertySet> xPropertySet(const_cast<SdrObject*>(m_pSdrObject)->getUnoShape(), uno::UNO_QUERY);
sax_fastparser::FastAttributeList* pTextboxAttrList = FastSerializerHelper::createAttrList();
sax_fastparser::XFastAttributeListRef xTextboxAttrList(pTextboxAttrList);
- if (xPropertySet->getPropertySetInfo()->hasPropertyByName("RotateAngle"))
+ if (!textboxStyle.isEmpty())
{
- sal_Int32 nTextRotateAngle = sal_Int32();
- if (xPropertySet->getPropertyValue("RotateAngle") >>= nTextRotateAngle)
- {
- if (nTextRotateAngle == 9000)
- {
- pTextboxAttrList->add(XML_style, "mso-layout-flow-alt:bottom-to-top");
- }
- }
+ pTextboxAttrList->add(XML_style, textboxStyle);
}
// this is reached only in case some text is attached to the shape
commit e094dcc039f2865374b5b60709c4556eb19655b3
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Aug 7 15:26:48 2020 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Aug 7 16:42:18 2020 +0200
filter: MSO export: convert TextWrap property to Escher_Wrap*
There's a paucity of working wrapping modes in Escher unfortunately.
Change-Id: Ibaf99c3249a6492dc129f9c9b5707778038f9a4c
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index f04043e9156a..a2071237deb7 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -66,6 +66,7 @@
#include <com/sun/star/drawing/FlagSequence.hpp>
#include <com/sun/star/drawing/PolygonFlags.hpp>
#include <com/sun/star/text/WritingMode.hpp>
+#include <com/sun/star/text/WrapTextMode.hpp>
#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
@@ -699,6 +700,10 @@ void EscherPropertyContainer::CreateTextProperties(
bool bWordWrap ( false );
bool bAutoGrowSize ( false );
+ uno::Any aTextWrap;
+
+ EscherPropertyValueHelper::GetPropertyValue(aTextWrap, rXPropSet, "TextWrap", true);
+
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, "TextWritingMode", true ) )
aAny >>= eWM;
if ( EscherPropertyValueHelper::GetPropertyValue( aAny, rXPropSet, "TextVerticalAdjust", true ) )
@@ -837,6 +842,21 @@ void EscherPropertyContainer::CreateTextProperties(
nTextAttr |= 0x20002;
}
}
+
+ if (aTextWrap.hasValue())
+ { // explicit text wrap overrides whatever was inferred previously
+ switch (aTextWrap.get<text::WrapTextMode>())
+ {
+ case text::WrapTextMode_THROUGH:
+ eWrapMode = ESCHER_WrapNone;
+ break;
+ // in theory there are 3 more Escher_Wrap, but [MS-ODRAW] says they are useless
+ default:
+ eWrapMode = ESCHER_WrapSquare;
+ break;
+ }
+ }
+
AddOpt( ESCHER_Prop_dxTextLeft, nLeft * 360 );
AddOpt( ESCHER_Prop_dxTextRight, nRight * 360 );
AddOpt( ESCHER_Prop_dyTextTop, nTop * 360 );
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 51e4c6b63b96..6bc298fa559a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -63,6 +63,8 @@ DECLARE_OOXMLEXPORT_TEST(testAtPageShapeRelOrientation, "rotated_shape.fodt")
// now test text rotation -> VML writing direction
assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Fallback/w:pict/v:shape/v:textbox", "style", "mso-layout-flow-alt:bottom-to-top");
+ // text wrap -> VML
+ assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Fallback/w:pict/v:shape/w10:wrap", "type", "none");
}
commit 6fc19c8cf830dbdfd2c9a2c82990ec4bc0268fc2
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Aug 7 16:41:18 2020 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Aug 7 16:42:17 2020 +0200
sw: register w10 prefix
Change-Id: I1ca9c3c7c4f36b666ee7d17967b80fdaa7004874
diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx
index 38f8e95a4a40..d62b92b58fc0 100644
--- a/sw/qa/inc/swmodeltestbase.hxx
+++ b/sw/qa/inc/swmodeltestbase.hxx
@@ -962,6 +962,7 @@ protected:
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("a14"), BAD_CAST("http://schemas.microsoft.com/office/drawing/2010/main"));
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("c"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/chart"));
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("o"), BAD_CAST("urn:schemas-microsoft-com:office:office"));
+ xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("w10"), BAD_CAST("urn:schemas-microsoft-com:office:word"));
// odt
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("office"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:office:1.0"));
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("style"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:style:1.0"));
commit d06c9076a2f3830ff94b4a05016c8c7a265b7ac4
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Aug 6 14:11:38 2020 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Aug 6 17:59:06 2020 +0200
oox: VML export: for rotated text shape, produce bottom-to-top
This is for shapes that fail the lcl_isTextBox() check in
VMLExport::StartShape(), they can be rotated too but with a different
property than the "TextPreRotateAngle" that is used in
VMLExport::EndShape().
Change-Id: I530aae8b7138f47bae8434e205632f5f4adbb231
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100249
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit 090c61eb93db4302d4565d5f11f7673190835fdb)
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 98f3243e5461..6fcc83a66da6 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -1369,8 +1369,23 @@ sal_Int32 VMLExport::StartShape()
if( pParaObj )
{
+ uno::Reference<beans::XPropertySet> xPropertySet(const_cast<SdrObject*>(m_pSdrObject)->getUnoShape(), uno::UNO_QUERY);
+ sax_fastparser::FastAttributeList* pTextboxAttrList = FastSerializerHelper::createAttrList();
+ sax_fastparser::XFastAttributeListRef xTextboxAttrList(pTextboxAttrList);
+ if (xPropertySet->getPropertySetInfo()->hasPropertyByName("RotateAngle"))
+ {
+ sal_Int32 nTextRotateAngle = sal_Int32();
+ if (xPropertySet->getPropertyValue("RotateAngle") >>= nTextRotateAngle)
+ {
+ if (nTextRotateAngle == 9000)
+ {
+ pTextboxAttrList->add(XML_style, "mso-layout-flow-alt:bottom-to-top");
+ }
+ }
+ }
+
// this is reached only in case some text is attached to the shape
- m_pSerializer->startElementNS(XML_v, XML_textbox);
+ m_pSerializer->startElementNS(XML_v, XML_textbox, xTextboxAttrList);
m_pTextExport->WriteOutliner(*pParaObj);
m_pSerializer->endElementNS(XML_v, XML_textbox);
if( bOwnParaObj )
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 634215adab08..51e4c6b63b96 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -60,6 +60,10 @@ DECLARE_OOXMLEXPORT_TEST(testAtPageShapeRelOrientation, "rotated_shape.fodt")
"/wp:positionV/wp:posOffset", "1080135");
assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/w:drawing/wp:anchor"
"/wp:positionV", "relativeFrom", "page");
+
+ // now test text rotation -> VML writing direction
+ assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Fallback/w:pict/v:shape/v:textbox", "style", "mso-layout-flow-alt:bottom-to-top");
+
}
CPPUNIT_PLUGIN_IMPLEMENT();
commit a3d656d73063efa41b40b25b241ced11bf4af3e9
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Aug 4 19:09:38 2020 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Aug 6 17:20:16 2020 +0200
tdf#135464 sw: avoid invalid combinations of HoriOrientRelation and FLY_AT_PAGE
... when using Anchor->To Page context menu.
For shapes, in SwDoc::ChgAnchor() and for sw flys in
SwDoc::SetFlyFrameAnchor().
Change-Id: I7d747b2558ef69df99636ea0fb0409deb461a79a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100131
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit 1de2b0d3234462b488db54d36ebc17e2b579b0f0)
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index 4451115905a8..cc3b858028c2 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -372,6 +372,7 @@ sal_Int8 SwDoc::SetFlyFrameAnchor( SwFrameFormat& rFormat, SfxItemSet& rSet, boo
pItem = nullptr;
SwFormatHoriOrient aOldH( rFormat.GetHoriOrient() );
+ bool bPutOldH(false);
if( text::HoriOrientation::NONE == aOldH.GetHoriOrient() && ( !pItem ||
aOldH.GetPos() == static_cast<const SwFormatHoriOrient*>(pItem)->GetPos() ))
@@ -386,6 +387,22 @@ sal_Int8 SwDoc::SetFlyFrameAnchor( SwFrameFormat& rFormat, SfxItemSet& rSet, boo
aOldH.SetRelationOrient( pH->GetRelationOrient() );
}
aOldH.SetPos( nPos );
+ bPutOldH = true;
+ }
+ if (nNew == RndStdIds::FLY_AT_PAGE)
+ {
+ sal_Int16 nRelOrient(pItem
+ ? static_cast<const SwFormatHoriOrient*>(pItem)->GetRelationOrient()
+ : aOldH.GetRelationOrient());
+ if (sw::GetAtPageRelOrientation(nRelOrient, false))
+ {
+ SAL_INFO("sw.ui", "fixing horizontal RelOrientation for at-page anchor");
+ aOldH.SetRelationOrient(nRelOrient);
+ bPutOldH = true;
+ }
+ }
+ if (bPutOldH)
+ {
rSet.Put( aOldH );
}
@@ -915,6 +932,17 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList,
// of attributes (method call <SetAttr(..)>) takes care of the
// invalidation of the object position.
SetAttr( aNewAnch, *pContact->GetFormat() );
+ if (aNewAnch.GetAnchorId() == RndStdIds::FLY_AT_PAGE)
+ {
+ SwFormatHoriOrient item(pContact->GetFormat()->GetHoriOrient());
+ sal_Int16 nRelOrient(item.GetRelationOrient());
+ if (sw::GetAtPageRelOrientation(nRelOrient, false))
+ {
+ SAL_INFO("sw.ui", "fixing horizontal RelOrientation for at-page anchor");
+ item.SetRelationOrient(text::RelOrientation::PAGE_FRAME);
+ SetAttr(item, *pContact->GetFormat());
+ }
+ }
if ( _bPosCorr )
{
// #i33313# - consider not connected 'virtual' drawing
diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx
index 079468fdf062..f3813192c928 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -719,7 +719,10 @@ void SwAnchoredDrawObject::AdjustPositioningAttr( const SwFrame* _pNewAnchorFram
nVertRelPos = aObjRect.Top() - aAnchorPos.Y();
}
- GetFrameFormat().SetFormatAttr( SwFormatHoriOrient( nHoriRelPos, text::HoriOrientation::NONE, text::RelOrientation::FRAME ) );
+ GetFrameFormat().SetFormatAttr( SwFormatHoriOrient( nHoriRelPos, text::HoriOrientation::NONE,
+ GetFrameFormat().GetAnchor().GetAnchorId() == RndStdIds::FLY_AT_PAGE
+ ? text::RelOrientation::PAGE_FRAME
+ : text::RelOrientation::FRAME ) );
GetFrameFormat().SetFormatAttr( SwFormatVertOrient( nVertRelPos, text::VertOrientation::NONE, text::RelOrientation::FRAME ) );
}
commit ee7573ad173b69bc39317cd90131b82c76990435
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Aug 4 18:56:08 2020 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Aug 6 17:20:16 2020 +0200
tdf#135464 sw: ODT->DOCX: fix positioning of at-page shapes and frames
Exporting at-page anchored flys to DOCX can result in wrong positions,
because DocxSdrExport::startDMLAnchorInline() converts
text::RelOrientation::FRAME to relativeFrom="column", i.e. the margin,
but sw displays it as relative to the page.
In fact at-page and FRAME is an invalid combination according to the
table in ODF 1.3, 20.298 style:horizontal-pos, the paragraph and
character relations are not valid for page-anchored flys.
Since there are lots of ODT files with this invalid combination, try to
fix it on import, in SwXFrame and SwXShape.
Funnily, SwXShape is attached before the properties are set, while
SwXFrame is attached after the properties are set.
The anchor frame for at-page is always a SwPageFrame.
Unfortunately there is a case where PRINT_AREA and PAGE_PRINT_AREA
differ, namely the CalcClipRect() only handles PRINT_AREA so it will
crop to the right margin with that but not with PAGE_PRINT_AREA,
so don't map this value.
Change-Id: I4d5f7f87d045ac4539b9170e55c34d4afe801f4d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100130
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit 12645900dece0a9aa0661fee796c27f672217977)
diff --git a/sw/inc/fmtornt.hxx b/sw/inc/fmtornt.hxx
index 24ffdc907e26..d0bea643f980 100644
--- a/sw/inc/fmtornt.hxx
+++ b/sw/inc/fmtornt.hxx
@@ -108,6 +108,12 @@ inline const SwFormatVertOrient &SwFormat::GetVertOrient(bool bInP) const
inline const SwFormatHoriOrient &SwFormat::GetHoriOrient(bool bInP) const
{ return m_aSet.GetHoriOrient(bInP); }
+namespace sw {
+
+ bool GetAtPageRelOrientation(sal_Int16 & rOrientation, bool const isIgnorePrintArea);
+
+}
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlexport/data/rotated_shape.fodt b/sw/qa/extras/ooxmlexport/data/rotated_shape.fodt
new file mode 100644
index 000000000000..fce84f93e945
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/rotated_shape.fodt
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:officeooo="http://openoffice.org/2009/office" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rpt="http://openoffice.org/2005/report" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns
:config:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="ur
n:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:font-face-decls>
+ <style:font-face style:name="Times New Roman" svg:font-family="'Times New Roman'" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="Arial" svg:font-family="Arial" style:font-family-generic="swiss" style:font-pitch="variable"/>
+ <style:font-face style:name="Lucida Sans" svg:font-family="'Lucida Sans'" style:font-family-generic="system" style:font-pitch="variable"/>
+ <style:font-face style:name="NSimSun" svg:font-family="NSimSun" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+ <style:default-style style:family="graphic">
+ <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/>
+ <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:font-independent-line-spacing="false">
+ <style:tab-stops/>
+ </style:paragraph-properties>
+ <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Times New Roman" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="NSimSun" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lucida Sans" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/>
+ </style:default-style>
+ <style:default-style style:family="paragraph">
+ <style:paragraph-properties fo:orphans="2" fo:widows="2" fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
+ <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Times New Roman" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="NSimSun" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lucida Sans" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false"/>
+ </style:default-style>
+ <style:default-style style:family="table">
+ <style:table-properties table:border-model="collapsing"/>
+ </style:default-style>
+ <style:default-style style:family="table-row">
+ <style:table-row-properties fo:keep-together="auto"/>
+ </style:default-style>
+ <style:style style:name="Standard" style:family="paragraph" style:class="text"/>
+ <text:notes-configuration text:note-class="footnote" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/>
+ <text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/>
+ <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/>
+ </office:styles>
+ <office:automatic-styles>
+ <style:style style:name="P1" style:family="paragraph">
+ <style:paragraph-properties style:writing-mode="lr-tb"/>
+ </style:style>
+ <style:style style:name="P2" style:family="paragraph">
+ <loext:graphic-properties draw:fill="none" draw:fill-color="#ffffff"/>
+ <style:paragraph-properties style:writing-mode="lr-tb"/>
+ <style:text-properties fo:font-size="11pt"/>
+ </style:style>
+ <style:style style:name="T1" style:family="text">
+ <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Arial" fo:font-size="7pt" fo:language="de" fo:country="DE" style:font-name-asian="Times New Roman" style:font-size-asian="7pt" style:font-name-complex="Arial" style:font-size-complex="12pt" style:language-complex="ar" style:country-complex="SA"/>
+ </style:style>
+ <style:style style:name="gr1" style:family="graphic">
+ <style:graphic-properties draw:stroke="none" draw:fill="none" draw:fill-color="#ffffff" draw:textarea-horizontal-align="justify" draw:textarea-vertical-align="middle" draw:auto-grow-height="false" draw:auto-grow-width="false" fo:padding-top="0.254cm" fo:padding-bottom="0.254cm" fo:padding-left="0.127cm" fo:padding-right="0.127cm" fo:wrap-option="wrap" draw:shadow="hidden" style:run-through="foreground" style:wrap="run-through" style:number-wrapped-paragraphs="no-limit" style:vertical-pos="from-top" style:vertical-rel="page" style:horizontal-pos="from-left" style:horizontal-rel="paragraph" draw:wrap-influence-on-position="once-concurrent" loext:allow-overlap="true" style:flow-with-text="false"/>
+ <style:paragraph-properties style:writing-mode="lr-tb"/>
+ </style:style>
+ <style:style style:name="fr1" style:family="graphic" style:parent-style-name="Graphics">
+ <style:graphic-properties style:horizontal-pos="from-left" style:horizontal-rel="paragraph" style:vertical-pos="from-top" style:vertical-rel="page" style:mirror="none" fo:clip="rect(0cm, 0cm, 0cm, 0cm)" draw:luminance="0%" draw:contrast="0%" draw:red="0%" draw:green="0%" draw:blue="0%" draw:gamma="100%" draw:color-inversion="false" draw:image-opacity="100%" draw:color-mode="standard"/>
+ </style:style>
+ <style:page-layout style:name="pm1">
+ <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0cm">
+ <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
+ </style:page-layout-properties>
+ <style:header-style/>
+ <style:footer-style/>
+ </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+ <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+ </office:master-styles>
+ <office:body>
+ <office:text>
+ <draw:frame text:anchor-type="page" text:anchor-page-number="1" draw:z-index="0" draw:name="Shape1" draw:style-name="gr1" draw:text-style-name="P2" svg:width="5.896cm" svg:height="0.957cm" draw:transform="rotate (1.5707963267949) translate (1.13418055555556cm 26.0579305555556cm)">
+ <draw:text-box>
+ <text:p text:style-name="P1"><text:span text:style-name="T1"><text:s/></text:span><text:span text:style-name="T1">Foo</text:span></text:p>
+ </draw:text-box>
+ </draw:frame><draw:frame draw:style-name="fr1" draw:name="Image1" text:anchor-type="page" text:anchor-page-number="1" svg:width="0.67cm" svg:height="0.67cm" draw:z-index="0"><draw:image draw:mime-type="image/png" svg:x="2cm" svg:y="3cm">
+ <office:binary-data>iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAAXNSR0IArs4c6QAAAAZiS0dE
+ AP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJBhI0A6HXrrIAAABl
+ SURBVDjLY/z//z8DtQATMYokl7D8p4phMIOIMZCJFBcRMpCJVK/hM5CJnDDCJc9EbmBjU8dE
+ jkG41DPhM+h5zB9GfHx0fTgjAJtGfOIMDAwMLMQoItZAJgYqglHDhpNhjNQsaQHF4y3hS/bS
+ HgAAAABJRU5ErkJggg==
+ </office:binary-data>
+ </draw:image>
+ </draw:frame>
+ <text:p text:style-name="Standard"/>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index dedad4d00eab..634215adab08 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -33,6 +33,35 @@ DECLARE_OOXMLEXPORT_TEST(testTdf133334_followPgStyle, "tdf133334_followPgStyle.o
CPPUNIT_ASSERT_EQUAL(2, getPages());
}
+DECLARE_OOXMLEXPORT_TEST(testAtPageShapeRelOrientation, "rotated_shape.fodt")
+{
+ // invalid combination of at-page anchor and horizontal-rel="paragraph"
+ // caused relativeFrom="column" instead of relativeFrom="page"
+
+ xmlDocPtr pXmlDocument = parseExport("word/document.xml");
+ if (!pXmlDocument)
+ return;
+
+ assertXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor"
+ "/wp:positionH/wp:posOffset", "-480060");
+ assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor"
+ "/wp:positionH", "relativeFrom", "page");
+ assertXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor"
+ "/wp:positionV/wp:posOffset", "8147685");
+ assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor"
+ "/wp:positionV", "relativeFrom", "page");
+
+ // same for sw
+ assertXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/w:drawing/wp:anchor"
+ "/wp:positionH/wp:posOffset", "720090");
+ assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/w:drawing/wp:anchor"
+ "/wp:positionH", "relativeFrom", "page");
+ assertXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/w:drawing/wp:anchor"
+ "/wp:positionV/wp:posOffset", "1080135");
+ assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/w:drawing/wp:anchor"
+ "/wp:positionV", "relativeFrom", "page");
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 79235781896d..18700e9b2eb4 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -98,6 +98,39 @@
using namespace ::com::sun::star;
+namespace sw {
+
+bool GetAtPageRelOrientation(sal_Int16 & rOrientation, bool const isIgnorePrintArea)
+{
+ switch (rOrientation)
+ {
+ case text::RelOrientation::CHAR:
+ case text::RelOrientation::FRAME:
+ rOrientation = text::RelOrientation::PAGE_FRAME;
+ return true;
+ case text::RelOrientation::PRINT_AREA:
+ if (isIgnorePrintArea)
+ {
+ return false;
+ }
+ else
+ {
+ rOrientation = text::RelOrientation::PAGE_PRINT_AREA;
+ return true;
+ }
+ case text::RelOrientation::FRAME_LEFT:
+ rOrientation = text::RelOrientation::PAGE_LEFT;
+ return true;
+ case text::RelOrientation::FRAME_RIGHT:
+ rOrientation = text::RelOrientation::PAGE_RIGHT;
+ return true;
+ default:
+ return false;
+ }
+}
+
+} // namespace sw
+
SfxPoolItem* SwFormatLineNumber::CreateDefault() { return new SwFormatLineNumber; }
static sal_Int16 lcl_IntToRelation(const uno::Any& rVal)
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index a94255c55408..d1b058fa49a2 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -1227,6 +1227,21 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a
}
}
}
+ else if (pEntry->nWID == RES_HORI_ORIENT
+ && pEntry->nMemberId == MID_HORIORIENT_RELATION
+ && aSet.Get(RES_ANCHOR).GetAnchorId() == RndStdIds::FLY_AT_PAGE)
+ {
+ uno::Any value(aValue);
+ sal_Int16 nRelOrient(text::RelOrientation::PAGE_FRAME);
+ aValue >>= nRelOrient;
+ if (sw::GetAtPageRelOrientation(nRelOrient, true))
+ {
+ SAL_WARN("sw.core", "SwXShape: fixing invalid horizontal RelOrientation for at-page anchor");
+ value <<= nRelOrient;
+ }
+ m_pPropSet->setPropertyValue( *pEntry, value, aSet );
+ pFormat->SetFormatAttr(aSet);
+ }
else
{
m_pPropSet->setPropertyValue( *pEntry, aValue, aSet );
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index e2e5c9411715..0636d530662c 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2749,6 +2749,19 @@ void SwXFrame::attachToRange(uno::Reference<text::XTextRange> const& xTextRange,
aAnchor.SetAnchor( aPam.GetPoint() );
aFrameSet.Put(aAnchor);
}
+
+ if (eAnchorId == RndStdIds::FLY_AT_PAGE)
+ {
+ sal_Int16 nRelOrient(aFrameSet.Get(RES_HORI_ORIENT).GetRelationOrient());
+ if (sw::GetAtPageRelOrientation(nRelOrient, true))
+ {
+ SAL_WARN("sw.core", "SwXFrame: fixing invalid horizontal RelOrientation for at-page anchor");
+
+ SwFormatHoriOrient item(aFrameSet.Get(RES_HORI_ORIENT));
+ item.SetRelationOrient(nRelOrient);
+ aFrameSet.Put(item);
+ }
+ }
}
const ::uno::Any* pStyle;
commit d789f24953c9e8f839de51427547b95bf99393a0
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Apr 14 17:42:06 2020 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Aug 6 13:49:56 2020 +0200
sw: DOCX export: export AddExternalLeading as w:noLeading
For 11pt Arial, can fit 59 paragraphs on a page vs. 57...
This is annoyingly complicated by the fact that Word 2013 ignores
w:noLeading element if compatibilityMode is 15.
Change-Id: Ie3093eabba45cdf6e7903ed860f5bad24dcc0323
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92208
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit 968a7e3247169489d29cc7de0079eea12a663870)
For the backport, don't care about compatibilityMode, it won't be in
grab-bag on ODF import so rely on the default of 12.
Change-Id: Ia41d6a4c99ebcc364997d0bb565addf7dc546ced
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index c368e6682833..c03d971e8fdc 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3695,6 +3695,7 @@ sal_Int32 lcl_getWordCompatibilityMode( const SwDoc& rDoc )
uno::Reference< beans::XPropertySet > xPropSet( rDoc.GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW );
uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
+ sal_Int32 nWordCompatibilityMode = -1;
if ( xPropSetInfo->hasPropertyByName( UNO_NAME_MISC_OBJ_INTEROPGRABBAG ) )
{
uno::Sequence< beans::PropertyValue > propList;
@@ -3725,14 +3726,14 @@ sal_Int32 lcl_getWordCompatibilityMode( const SwDoc& rDoc )
if ( sName == "compatibilityMode" && sUri == "http://schemas.microsoft.com/office/word" )
{
- return sVal.toInt32();
+ nWordCompatibilityMode = sVal.toInt32();
}
}
}
}
}
- return -1; // Word compatibility mode not found
+ return nWordCompatibilityMode;
}
}
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 7fed578100d1..a212f4e5c9b8 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -895,6 +895,21 @@ void DocxExport::WriteProperties( )
m_pFilter->exportDocumentProperties( xDocProps, bSecurityOptOpenReadOnly );
}
+static auto
+WriteCompat(SwDoc const& rDoc, ::sax_fastparser::FSHelperPtr const& rpFS
+ ) -> void
+{
+ if (!rDoc.getIDocumentSettingAccess().get(DocumentSettingId::ADD_EXT_LEADING))
+ {
+ rpFS->singleElementNS(XML_w, XML_noLeading);
+ }
+ // Do not justify lines with manual break
+ if (rDoc.getIDocumentSettingAccess().get(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK))
+ {
+ rpFS->singleElementNS(XML_w, XML_doNotExpandShiftReturn);
+ }
+}
+
void DocxExport::WriteSettings()
{
SwViewShell *pViewShell(m_pDoc->getIDocumentLayoutAccess().GetCurrentViewShell());
@@ -978,14 +993,6 @@ void DocxExport::WriteSettings()
pFS->singleElementNS( XML_w, XML_defaultTabStop, FSNS( XML_w, XML_val ),
OString::number(m_aSettings.defaultTabStop) );
- // Do not justify lines with manual break
- if( m_pDoc->getIDocumentSettingAccess().get( DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK ))
- {
- pFS->startElementNS(XML_w, XML_compat);
- pFS->singleElementNS(XML_w, XML_doNotExpandShiftReturn);
- pFS->endElementNS( XML_w, XML_compat );
- }
-
// export current mail merge database and table names
SwDBData aData = m_pDoc->GetDBData();
if ( !aData.sDataSource.isEmpty() && aData.nCommandType == css::sdb::CommandType::TABLE && !aData.sCommand.isEmpty() )
@@ -1046,6 +1053,7 @@ void DocxExport::WriteSettings()
bHasDummyRedlineProtectionKey = aKey.getLength() == 1 && aKey[0] == 1;
}
const OUString aGrabBagName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG;
+ bool bHasCompat = false;
if ( xPropSetInfo->hasPropertyByName( aGrabBagName ) )
{
uno::Sequence< beans::PropertyValue > propList;
@@ -1076,6 +1084,10 @@ void DocxExport::WriteSettings()
{
pFS->startElementNS(XML_w, XML_compat);
+ WriteCompat(*m_pDoc, pFS);
+
+ bHasCompat = true;
+
uno::Sequence< beans::PropertyValue > aCompatSettingsSequence;
rProp.Value >>= aCompatSettingsSequence;
@@ -1161,6 +1173,14 @@ void DocxExport::WriteSettings()
}
}
}
+ if (!bHasCompat)
+ {
+ pFS->startElementNS(XML_w, XML_compat);
+
+ WriteCompat(*m_pDoc, pFS);
+
+ pFS->endElementNS( XML_w, XML_compat );
+ }
if (! hasProtectionProperties)
{
commit 659a8dac6c1801f115aaf4034e8e1e4fdb0e116b
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Apr 14 18:10:53 2020 +0200
Commit: Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Thu Aug 6 13:49:56 2020 +0200
writerfilter: DOCX import: import w:noLeading as AddExternalLeading
Change-Id: I3d7fa2984975205d284575c60c6c47284b00c4a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92209
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit 3cd3ae30217a80449799d7d9426c3756c572712e)
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 3b95e006ffad..288c18b83fd4 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -6610,6 +6610,10 @@ void DomainMapper_Impl::ApplySettingsTable()
if( m_pSettingsTable->GetEmbedSystemFonts())
xSettings->setPropertyValue( getPropertyName( PROP_EMBED_SYSTEM_FONTS ), uno::makeAny(true) );
xSettings->setPropertyValue("AddParaTableSpacing", uno::makeAny(m_pSettingsTable->GetDoNotUseHTMLParagraphAutoSpacing()));
+ if (m_pSettingsTable->GetNoLeading())
+ {
+ xSettings->setPropertyValue("AddExternalLeading", uno::makeAny(!m_pSettingsTable->GetNoLeading()));
+ }
if( m_pSettingsTable->GetProtectForm() )
xSettings->setPropertyValue("ProtectForm", uno::makeAny( true ));
}
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx
index 58399cf0a151..02c3944cc415 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -255,6 +255,7 @@ struct SettingsTable_Impl
bool m_bRedlineProtection;
OUString m_sRedlineProtectionKey;
bool m_bDisplayBackgroundShape;
+ bool m_bNoLeading = false;
uno::Sequence<beans::PropertyValue> m_pThemeFontLangProps;
@@ -570,6 +571,9 @@ void SettingsTable::lcl_sprm(Sprm& rSprm)
case NS_ooxml::LN_CT_Settings_displayBackgroundShape:
m_pImpl->m_bDisplayBackgroundShape = nIntValue;
break;
+ case NS_ooxml::LN_CT_Compat_noLeading:
+ m_pImpl->m_bNoLeading = nIntValue != 0;
+ break;
default:
{
#ifdef DBG_UTIL
@@ -787,6 +791,11 @@ bool SettingsTable::GetLongerSpaceSequence() const
return m_pImpl->m_bLongerSpaceSequence;
}
+bool SettingsTable::GetNoLeading() const
+{
+ return m_pImpl->m_bNoLeading;
+}
+
}//namespace dmapper
} //namespace writerfilter
diff --git a/writerfilter/source/dmapper/SettingsTable.hxx b/writerfilter/source/dmapper/SettingsTable.hxx
index 26c69d907b35..7f8cc8ba9bc4 100644
--- a/writerfilter/source/dmapper/SettingsTable.hxx
+++ b/writerfilter/source/dmapper/SettingsTable.hxx
@@ -78,6 +78,7 @@ class SettingsTable : public LoggedProperties, public LoggedTable
bool GetNoColumnBalance() const;
bool GetProtectForm() const;
bool GetLongerSpaceSequence() const;
+ bool GetNoLeading() const;
bool GetNoHyphenateCaps() const;
sal_Int16 GetHypenationZone() const;
commit 3115faaa72b25bdd3af140d275635b0f0cd06e3a
Author: Eike Rathke <erack at redhat.com>
AuthorDate: Thu Aug 6 01:40:04 2020 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Aug 6 09:52:00 2020 +0200
Resolves: tdf#135249 Duration input 0:123 or 0:0:123 or 0:123:59 is valid
Change-Id: Ie624b324822495192edc65d046945eb92356550b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100192
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Jenkins
(cherry picked from commit 1616b53292cdc22c04d07bb21e71bf43dcd22299)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100212
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index e1b7c856f6e4..11a3e637157e 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -980,6 +980,9 @@ bool ImpSvNumberInputScan::GetTimeRef( double& fOutNumber,
SAL_WARN( "svl.numbers", "ImpSvNumberInputScan::GetTimeRef: bad number index");
}
+ // 0:123 or 0:0:123 or 0:123:59 is valid
+ bool bAllowDuration = (nHour == 0 && !nAmPm);
+
if (nAmPm && nHour > 12) // not a valid AM/PM clock time
{
bRet = false;
@@ -1000,16 +1003,18 @@ bool ImpSvNumberInputScan::GetTimeRef( double& fOutNumber,
else if (nIndex - nStartIndex < nCnt)
{
nMinute = static_cast<sal_uInt16>(sStrArray[nNums[nIndex++]].toInt32());
- if (!(eInputOptions & SvNumInputOptions::LAX_TIME)
+ if (!(eInputOptions & SvNumInputOptions::LAX_TIME) && !bAllowDuration
&& nIndex > 1 && nMinute > 59)
- bRet = false; // 1:60 or 1:123 is invalid, 123:1 is valid
+ bRet = false; // 1:60 or 1:123 is invalid, 123:1 or 0:123 is valid
+ if (bAllowDuration)
+ bAllowDuration = (nMinute == 0);
}
if (nIndex - nStartIndex < nCnt)
{
nSecond = static_cast<sal_uInt16>(sStrArray[nNums[nIndex++]].toInt32());
- if (!(eInputOptions & SvNumInputOptions::LAX_TIME)
+ if (!(eInputOptions & SvNumInputOptions::LAX_TIME) && !bAllowDuration
&& nIndex > 1 && nSecond > 59 && !(nHour == 23 && nMinute == 59 && nSecond == 60))
- bRet = false; // 1:60 or 1:123 or 1:1:123 is invalid, 123:1 or 123:1:1 is valid, or leap second
+ bRet = false; // 1:60 or 1:123 or 1:1:123 is invalid, 123:1 or 123:1:1 or 0:0:123 is valid, or leap second
}
if (nIndex - nStartIndex < nCnt)
{
commit ce10b3340c1b2e04a2ef9e0f454a64f898bff8cb
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Tue Aug 4 12:26:23 2020 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Wed Aug 5 15:14:23 2020 +0200
tdf#135144 sw: copy bookmarks in SwDoc::CopyMasterHeader()
... and SwDoc::CopyMasterFooter(); this is the same as commit
9f7ee38acec0cb614e37aecc5ea9c5f1c63b61b6 but for 2 other functions that
do the same thing.
Change-Id: Id7ed449a004ee3c9452d4603bf8632e2720651ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100077
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit af38654b4b8388f0a0236601742b7ab3d1590ae8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100059
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index d1cc84f8d8e3..e6f9fed947a3 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -293,7 +293,9 @@ void SwDoc::CopyMasterHeader(const SwPageDesc &rChged, const SwFormatHeader &rHe
GetNodes().Copy_( aRange, aTmp, false );
aTmp = *pSttNd;
GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRange, nullptr, aTmp);
-
+ SwPaM const source(aRange.aStart, aRange.aEnd);
+ SwPosition dest(aTmp);
+ sw::CopyBookmarks(source, dest);
pFormat->SetFormatAttr( SwFormatContent( pSttNd ) );
rDescFrameFormat.SetFormatAttr( SwFormatHeader( pFormat ) );
}
@@ -365,7 +367,9 @@ void SwDoc::CopyMasterFooter(const SwPageDesc &rChged, const SwFormatFooter &rFo
GetNodes().Copy_( aRange, aTmp, false );
aTmp = *pSttNd;
GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRange, nullptr, aTmp);
-
+ SwPaM const source(aRange.aStart, aRange.aEnd);
+ SwPosition dest(aTmp);
+ sw::CopyBookmarks(source, dest);
pFormat->SetFormatAttr( SwFormatContent( pSttNd ) );
rDescFrameFormat.SetFormatAttr( SwFormatFooter( pFormat ) );
}
commit 790ab54d7232d232ba84f17f285d4639ddba80d5
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Aug 3 21:03:43 2020 +0200
Commit: Michael Stahl <michael.stahl at cib.de>
CommitDate: Wed Aug 5 12:09:46 2020 +0200
tdf#130707 xmloff: survive <text:database-display> in editeng text
Regression from commit 28d67b792724a23015dec32fb0278b729f676736
(tdf#107776 sw ODF shape import: make is-textbox check more strict,
2019-08-26), now that we correctly identify what shape text to import as
"textbox" (Writer TextFrame) and what to import as editeng text, there
are documents out there that try to import mailmerge fields into
editeng-based shape text. Fix missing error handling there.
Note that the error is not just silently ignored, we do insert the field
result into the shape text, existing code provides this already.
(cherry picked from commit fd18d12efdfbe0e26d41d733edc711d0f40a7804)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100038
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit fec8b842d701cca0b79af9ea9f6192a8cf7610b0)
Change-Id: Ibe631ac5d94c1c7795dd00bad05fdcca0e6741a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100055
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
diff --git a/xmloff/CppunitTest_xmloff_text.mk b/xmloff/CppunitTest_xmloff_text.mk
new file mode 100644
index 000000000000..e3259672605b
--- /dev/null
+++ b/xmloff/CppunitTest_xmloff_text.mk
@@ -0,0 +1,44 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,xmloff_text))
+
+$(eval $(call gb_CppunitTest_use_externals,xmloff_text,\
+ boost_headers \
+))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,xmloff_text, \
+ xmloff/qa/unit/text \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,xmloff_text, \
+ comphelper \
+ cppu \
+ embobj \
+ sal \
+ test \
+ unotest \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,xmloff_text))
+
+$(eval $(call gb_CppunitTest_use_ure,xmloff_text))
+$(eval $(call gb_CppunitTest_use_vcl,xmloff_text))
+
+$(eval $(call gb_CppunitTest_use_rdb,xmloff_text,services))
+
+$(eval $(call gb_CppunitTest_use_custom_headers,xmloff_text,\
+ officecfg/registry \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,xmloff_text))
+
+# vim: set noet sw=4 ts=4:
diff --git a/xmloff/Module_xmloff.mk b/xmloff/Module_xmloff.mk
index 16cf0f817889..fe69b86b09f6 100644
--- a/xmloff/Module_xmloff.mk
+++ b/xmloff/Module_xmloff.mk
@@ -30,6 +30,7 @@ $(eval $(call gb_Module_add_check_targets,xmloff,\
$(if $(MERGELIBS),, \
CppunitTest_xmloff_uxmloff) \
CppunitTest_xmloff_style \
+ CppunitTest_xmloff_text \
))
$(eval $(call gb_Module_add_subsequentcheck_targets,xmloff,\
diff --git a/xmloff/qa/unit/data/mail-merge-editeng.odt b/xmloff/qa/unit/data/mail-merge-editeng.odt
new file mode 100644
index 000000000000..e6466e44e01e
Binary files /dev/null and b/xmloff/qa/unit/data/mail-merge-editeng.odt differ
diff --git a/xmloff/qa/unit/text.cxx b/xmloff/qa/unit/text.cxx
new file mode 100644
index 000000000000..d7da798bafab
--- /dev/null
+++ b/xmloff/qa/unit/text.cxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/bootstrapfixture.hxx>
+#include <unotest/macros_test.hxx>
+#include <comphelper/processfactory.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+
+using namespace ::com::sun::star;
+
+char const DATA_DIRECTORY[] = "/xmloff/qa/unit/data/";
+
+/// Covers xmloff/source/text/ fixes.
+class XmloffStyleTest : public test::BootstrapFixture, public unotest::MacrosTest
+{
+private:
+ uno::Reference<lang::XComponent> mxComponent;
+
+public:
+ void setUp() override;
+ void tearDown() override;
+ uno::Reference<lang::XComponent>& getComponent() { return mxComponent; }
+};
+
+void XmloffStyleTest::setUp()
+{
+ test::BootstrapFixture::setUp();
+
+ uno::Reference<uno::XComponentContext> xComponentContext
+ = comphelper::getProcessComponentContext();
+ mxDesktop.set(frame::Desktop::create(xComponentContext));
+}
+
+void XmloffStyleTest::tearDown()
+{
+ if (mxComponent.is())
+ mxComponent->dispose();
+
+ test::BootstrapFixture::tearDown();
+}
+
+CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testMailMergeInEditeng)
+{
+ OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "mail-merge-editeng.odt";
+ getComponent() = loadFromDesktop(aURL);
+ // Without the accompanying fix in place, this test would have failed, as unexpected
+ // <text:database-display> in editeng text abored the whole import process.
+ CPPUNIT_ASSERT(getComponent().is());
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/txtvfldi.cxx b/xmloff/source/text/txtvfldi.cxx
index 5a1f2255035e..7bc398e146c6 100644
--- a/xmloff/source/text/txtvfldi.cxx
+++ b/xmloff/source/text/txtvfldi.cxx
@@ -45,6 +45,7 @@
#include <rtl/ustring.hxx>
#include <osl/diagnose.h>
+#include <sal/log.hxx>
#include <tools/debug.hxx>
@@ -1017,27 +1018,34 @@ void XMLDatabaseDisplayImportContext::EndElement()
if (xTextContent.is())
{
// insert, set field properties and exit!
- GetImportHelper().InsertTextContent(xTextContent);
+ try
+ {
+ GetImportHelper().InsertTextContent(xTextContent);
- // prepare field: format from database?
- bool bTmp = !aValueHelper.IsFormatOK();
- xField->setPropertyValue("DataBaseFormat", Any(bTmp));
+ // prepare field: format from database?
+ bool bTmp = !aValueHelper.IsFormatOK();
+ xField->setPropertyValue("DataBaseFormat", Any(bTmp));
- // value, value-type and format done by value helper
- aValueHelper.PrepareField(xField);
+ // value, value-type and format done by value helper
+ aValueHelper.PrepareField(xField);
- // visibility
- if( bDisplayOK )
- {
- xField->setPropertyValue(sAPI_is_visible, Any(bDisplay));
- }
+ // visibility
+ if( bDisplayOK )
+ {
+ xField->setPropertyValue(sAPI_is_visible, Any(bDisplay));
+ }
- // set presentation
- aAny <<= GetContent();
- xField->setPropertyValue(sAPI_current_presentation, aAny);
+ // set presentation
+ aAny <<= GetContent();
+ xField->setPropertyValue(sAPI_current_presentation, aAny);
- // success!
- return;
+ // success!
+ return;
+ }
+ catch (const lang::IllegalArgumentException& rException)
+ {
+ SAL_WARN("xmloff.text", "Failed to insert text content: " << rException.Message);
+ }
}
}
}
commit 810b9dabc0b91629b0aadadb999b396a7879b385
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sat Jul 25 18:55:18 2020 +0300
Commit: Michael Stahl <michael.stahl at cib.de>
CommitDate: Mon Aug 3 11:24:57 2020 +0200
tdf#130559: don't fail creation of preview when BackingComp can't add...
an event listener. This crashes when loading a document with print preview
set as active view.
Regression after commit 128ecffe53394c1f045521c2efb42ea03a319f4b.
Change-Id: I5dc421f7c08dd70d51772fac5432f33cd9a1491a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99442
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
(cherry picked from commit e3b695f6a1525ac6b32abd27a6368a7e8b7d09fa)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99740
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit a9457b3c18f6030b19d8cb1aada3709649a05460)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99747
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx
index fe3688abdd43..54187748819f 100644
--- a/sc/source/ui/view/prevwsh.cxx
+++ b/sc/source/ui/view/prevwsh.cxx
@@ -153,10 +153,21 @@ ScPreviewShell::ScPreviewShell( SfxViewFrame* pViewFrame,
{
Construct( &pViewFrame->GetWindow() );
- SfxShell::SetContextBroadcasterEnabled(true);
- SfxShell::SetContextName(vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Printpreview));
- SfxShell::BroadcastContextForActivation(true);
-
+ try
+ {
+ SfxShell::SetContextBroadcasterEnabled(true);
+ SfxShell::SetContextName(
+ vcl::EnumContext::GetContextName(vcl::EnumContext::Context::Printpreview));
+ SfxShell::BroadcastContextForActivation(true);
+ }
+ catch (const css::uno::RuntimeException& e)
+ {
+ // tdf#130559: allow BackingComp to fail adding listener when opening document
+ css::uno::Reference<css::lang::XServiceInfo> xServiceInfo(e.Context, css::uno::UNO_QUERY);
+ if (!xServiceInfo || !xServiceInfo->supportsService("com.sun.star.frame.StartModule"))
+ throw;
+ SAL_WARN("sc.ui", "Opening file from StartModule straight into print preview");
+ }
auto& pNotebookBar = pViewFrame->GetWindow().GetSystemWindow()->GetNotebookBar();
if (pNotebookBar)
commit ffb822516a84c57c19638eafd51a4059a0592d5a
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Jul 31 14:46:13 2020 +0200
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sun Aug 2 00:05:57 2020 +0200
tdf#134965 sw: avoid RemoveFollowFlowLine() SNAFU
A follow-flow-line SwRowFrame is deleted in RemoveFollowFlowLine()
while it is being iterated in stack frame #18.
0 SwRowFrame::~SwRowFrame() (this=0xaa035b0, __in_chrg=<optimized out>) at sw/source/core/layout/tabfrm.cxx:3807
1 SwFrame::DestroyFrame(SwFrame*) (pFrame=0xaa035b0) at sw/source/core/layout/ssfrm.cxx:389
2 SwTabFrame::RemoveFollowFlowLine() (this=0x9c16790) at sw/source/core/layout/tabfrm.cxx:945
3 SwTabFrame::MakeAll(OutputDevice*) (this=0x9c16790, pRenderContext=0x72afaf0) at sw/source/core/layout/tabfrm.cxx:2203
4 SwFrame::PrepareMake(OutputDevice*) (this=0x9c16790, pRenderContext=0x72afaf0) at sw/source/core/layout/calcmove.cxx:370
5 SwFrame::Calc(OutputDevice*) const (this=0x9c16790, pRenderContext=0x72afaf0) at sw/source/core/layout/trvlfrm.cxx:1791
6 SwFrame::PrepareMake(OutputDevice*) (this=0x925b740, pRenderContext=0x72afaf0) at sw/source/core/layout/calcmove.cxx:248
7 SwFrame::Calc(OutputDevice*) const (this=0x925b740, pRenderContext=0x72afaf0) at sw/source/core/layout/trvlfrm.cxx:1791
8 SwFrame::PrepareMake(OutputDevice*) (this=0x925b8e0, pRenderContext=0x72afaf0) at sw/source/core/layout/calcmove.cxx:248
9 SwFrame::Calc(OutputDevice*) const (this=0x925b8e0, pRenderContext=0x72afaf0) at sw/source/core/layout/trvlfrm.cxx:1791
10 SwFrame::PrepareMake(OutputDevice*) (this=0x925ba70, pRenderContext=0x72afaf0) at sw/source/core/layout/calcmove.cxx:248
11 SwFrame::Calc(OutputDevice*) const (this=0x925ba70, pRenderContext=0x72afaf0) at sw/source/core/layout/trvlfrm.cxx:1791
12 SwFrame::MakePos() (this=0x925bc20) at sw/source/core/layout/calcmove.cxx:552
13 SwTextFrame::MakePos() (this=0x925bc20) at sw/source/core/text/frmform.cxx:339
14 SwContentFrame::MakeAll(OutputDevice*) (this=0x925bc20) at sw/source/core/layout/calcmove.cxx:1408
15 SwFrame::PrepareMake(OutputDevice*) (this=0x925bc20, pRenderContext=0x72afaf0) at sw/source/core/layout/calcmove.cxx:370
16 SwFrame::Calc(OutputDevice*) const (this=0x925bc20, pRenderContext=0x72afaf0) at sw/source/core/layout/trvlfrm.cxx:1791
17 SwContentFrame::CalcLowers(SwLayoutFrame&, SwLayoutFrame const&, long, bool) (rLay=..., rDontLeave=..., nBottom=168478, bSkipRowSpanCells=true) at sw/source/core/layout/tabfrm.cxx:1521
18 lcl_RecalcRow(SwRowFrame&, long) (rRow=..., nBottom=168478) at sw/source/core/layout/tabfrm.cxx:1651
19 SwTabFrame::MakeAll(OutputDevice*) (this=0x93ec7e0, pRenderContext=0x72afaf0) at sw/source/core/layout/tabfrm.cxx:2421
20 SwFrame::PrepareMake(OutputDevice*) (this=0x3df3cc0, pRenderContext=0x72afaf0) at sw/source/core/layout/calcmove.cxx:316
21 SwFrame::Calc(OutputDevice*) const (this=0x3df3cc0, pRenderContext=0x72afaf0) at sw/source/core/layout/trvlfrm.cxx:1791
22 GetFrameOfModify(SwRootFrame const*, SwModify const&, SwFrameType, SwPosition const*, std::pair<Point, bool> const*) (pLayout=0x72aa850, rMod=..., nFrameType=(SwFrameType::Txt | SwFrameType::NoTxt), pPos=0x71f35e0, pViewPosAndCalcFrame=0x7ffc99f591a0) at sw/source/core/layout/frmtool.cxx:3697
23 SwContentNode::getLayoutFrame(SwRootFrame const*, SwPosition const*, std::pair<Point, bool> const*) const (this=0x6fcfb50, _pRoot=0x72aa850, pPos=0x71f35e0, pViewPosAndCalcFrame=0x7ffc99f591a0) at sw/source/core/docnode/node.cxx:1194
24 SwCursorShell::GetCurrFrame(bool) const (this=0x72a9730, bCalcFrame=true) at sw/source/core/crsr/crsrsh.cxx:2455
25 SwFEShell::GetAnyCurRect(CurRectType, Point const*, com::sun::star::uno::Reference<com::sun::star::embed::XEmbeddedObject> const&) const (this=0x72a9730, eType=CurRectType::PageCalc, pPt=0x0, xObj=empty uno::Reference) at sw/source/core/frmedt/fews.cxx:113
26 SwView::StateStatusLine(SfxItemSet&) (this=0x72af430, rSet=SfxItemSet of pool 0x6fa3d50 with parent 0x0 and Which ranges: [(10000, 10000), (10221, 10221), (10223, 10225), (11064, 11065), (21182, 21182), (21185, 21185), (21189, 21189)] = {...}) at sw/source/uibase/uiview/view2.cxx:1517
Not obvious why this changed with calling MakeFrames() instead of
SwNodes::CopyNodes(bNewFrames=true) or how to best prevent it; adding
another FrameDeleteGuard avoids the crash at least.
(regression from 166b5010b402a41b192b1659093a25acf9065fd9)
Change-Id: Ifd5a0c93064c9536429dda30a2c4ebc7a31b7e7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99870
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit aed92491f356b008fe1cd25b5cd6cc43279db3a3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99848
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 42150626aa10..060d5151e3bc 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -2381,6 +2381,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
GetUpper()->Grow( LONG_MAX, true ) );
{
+ SwFrameDeleteGuard g(Lower()); // tdf#134965 prevent RemoveFollowFlowLine()
SetInRecalcLowerRow( true );
::lcl_RecalcRow(*static_cast<SwRowFrame*>(Lower()), nDeadLine);
SetInRecalcLowerRow( false );
commit a45400449536d75b4858821d88197fffefe66631
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Jul 30 18:27:28 2020 +0200
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sun Aug 2 00:05:17 2020 +0200
tdf#134436 sw: fix SwUndoDelete::RedoImpl() with section at end...
... of document; the root cause is that in some intermediate delete
operation, the delete will remove a section start/end node pair that
surrounds the last text node in the document, but
SwUndoDelete::RedoImpl() will not remove it, thus for subsequent Undo
actions the indexes are messed up and weird things happen.
Fix this in DocumentContentOperationsManager::DeleteRangeImplImpl(),
with the same weird "is point at the end" check as SwUndoDelete.
Change-Id: Iebf20d3c129c69692df8d57e3c5b9e6fec281e4b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99810
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit 22a77cb83a3769a8b43d80565282988a74214866)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99858
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/sw/qa/extras/uiwriter/data/tdf134436.fodt b/sw/qa/extras/uiwriter/data/tdf134436.fodt
new file mode 100644
index 000000000000..40d02a83a23b
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf134436.fodt
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:officeooo="http://openoffice.org/2009/office" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rpt="http://openoffice.org/2005/report" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns
:config:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="ur
n:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:font-face-decls>
+ <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="Lohit Devanagari" svg:font-family="'Lohit Devanagari'" style:font-family-generic="system" style:font-pitch="variable"/>
+ <style:font-face style:name="Source Han Serif CN" svg:font-family="'Source Han Serif CN'" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+ <style:default-style style:family="graphic">
+ <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/>
+ <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
+ <style:tab-stops/>
+ </style:paragraph-properties>
+ <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han Serif CN" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/>
+ </style:default-style>
+ <style:default-style style:family="paragraph">
+ <style:paragraph-properties fo:orphans="2" fo:widows="2" fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
+ <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han Serif CN" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false"/>
+ </style:default-style>
+ <style:default-style style:family="table">
+ <style:table-properties table:border-model="collapsing"/>
+ </style:default-style>
+ <style:default-style style:family="table-row">
+ <style:table-row-properties fo:keep-together="auto"/>
+ </style:default-style>
+ <style:style style:name="Standard" style:family="paragraph" style:class="text"/>
+ <style:style style:name="Table_20_Contents" style:display-name="Table Contents" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
+ <style:paragraph-properties fo:orphans="0" fo:widows="0" text:number-lines="false" text:line-number="0"/>
+ </style:style>
+ <text:notes-configuration text:note-class="footnote" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/>
+ <text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/>
+ <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/>
+ </office:styles>
+ <office:automatic-styles>
+ <style:style style:name="Table1" style:family="table">
+ <style:table-properties style:width="17cm" table:align="margins"/>
+ </style:style>
+ <style:style style:name="Table1.A" style:family="table-column">
+ <style:table-column-properties style:column-width="17cm" style:rel-column-width="65535*"/>
+ </style:style>
+ <style:style style:name="Table1.A1" style:family="table-cell">
+ <style:table-cell-properties fo:padding="0.097cm" fo:border="0.05pt solid #000000"/>
+ </style:style>
+ <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard">
+ <style:text-properties officeooo:rsid="001bc824" officeooo:paragraph-rsid="001bc824"/>
+ </style:style>
+ <style:style style:name="P2" style:family="paragraph" style:parent-style-name="Table_20_Contents">
+ <style:text-properties officeooo:rsid="001bc824" officeooo:paragraph-rsid="001bc824"/>
+ </style:style>
+ <style:style style:name="Sect1" style:family="section">
+ <style:section-properties style:editable="false">
+ <style:columns fo:column-count="1" fo:column-gap="0cm"/>
+ </style:section-properties>
+ </style:style>
+ <style:page-layout style:name="pm1">
+ <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm">
+ <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
+ </style:page-layout-properties>
+ <style:header-style/>
+ <style:footer-style/>
+ </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+ <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+ </office:master-styles>
+ <office:body>
+ <office:text>
+ <table:table table:name="Table1" table:style-name="Table1">
+ <table:table-column table:style-name="Table1.A"/>
+ <table:table-row>
+ <table:table-cell table:style-name="Table1.A1" office:value-type="string">
+ <text:p text:style-name="P2">a</text:p>
+ </table:table-cell>
+ </table:table-row>
+ </table:table>
+ <text:p text:style-name="P1">b</text:p>
+ <text:section text:style-name="Sect1" text:name="Section1">
+ <text:p text:style-name="P1"/>
+ </text:section>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 157773a7648a..c14306e233c9 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -5472,6 +5472,87 @@ void SwUiWriterTest::testRedlineCopyPaste()
CPPUNIT_ASSERT_EQUAL(OUString("abcdefgh"), pTextNode->GetText());
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf134436)
+{
+ load(DATA_DIRECTORY, "tdf134436.fodt");
+
+ SwXTextDocument* pXTextDocument = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pXTextDocument);
+ SwDoc * pDoc = pXTextDocument->GetDocShell()->GetDoc();
+ CPPUNIT_ASSERT(pDoc);
+ SwWrtShell * pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+ CPPUNIT_ASSERT(pWrtShell);
+
+ uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
+ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
+ uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
+
+ // select all 3 times, table at the start
+ lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {});
+ lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {});
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+ // the stupid SwXTextView::getString doesn't work "for symmetry" so use CursorShell
+ CPPUNIT_ASSERT_EQUAL(OUString("a\nb\n"), pWrtShell->GetCursor()->GetText());
+
+ // first, the section doesn't get deleted
+ lcl_dispatchCommand(mxComponent, ".uno:Delete", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+ CPPUNIT_ASSERT_EQUAL(OUString(""), pWrtShell->GetCursor()->GetText());
+
+ lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+ CPPUNIT_ASSERT_EQUAL(OUString("a\nb\n"), pWrtShell->GetCursor()->GetText());
+
+ // second, the section does get deleted because point is at the end
+ lcl_dispatchCommand(mxComponent, ".uno:Delete", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xSections->getCount());
+ CPPUNIT_ASSERT_EQUAL(OUString(""), pWrtShell->GetCursor()->GetText());
+
+ lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+ CPPUNIT_ASSERT_EQUAL(OUString("a\nb\n"), pWrtShell->GetCursor()->GetText());
+
+ // the problem was that the section was not deleted on Redo
+ lcl_dispatchCommand(mxComponent, ".uno:Redo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xSections->getCount());
+ CPPUNIT_ASSERT_EQUAL(OUString(""), pWrtShell->GetCursor()->GetText());
+
+ lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xSections->getCount());
+ CPPUNIT_ASSERT_EQUAL(OUString("a\nb\n"), pWrtShell->GetCursor()->GetText());
+
+ lcl_dispatchCommand(mxComponent, ".uno:Redo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xTables->getCount());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xSections->getCount());
+ CPPUNIT_ASSERT_EQUAL(OUString(""), pWrtShell->GetCursor()->GetText());
+}
+
void SwUiWriterTest::testRedlineParam()
{
// Create a document with minimal content.
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index af03431639b2..162b8389e463 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -4235,6 +4235,19 @@ bool DocumentContentOperationsManager::DeleteRangeImplImpl(SwPaM & rPam)
if( aSttIdx != nEnde )
{
+ // tdf#134436 delete section nodes like SwUndoDelete::SwUndoDelete
+ SwNode *pTmpNd;
+ while (pEnd == rPam.GetPoint()
+ && nEnde + 2 < m_rDoc.GetNodes().Count()
+ && (pTmpNd = m_rDoc.GetNodes()[nEnde + 1])->IsEndNode()
+ && pTmpNd->StartOfSectionNode()->IsSectionNode()
+ && aSttIdx <= pTmpNd->StartOfSectionNode()->GetIndex())
+ {
+ SwNodeRange range(*pTmpNd->StartOfSectionNode(), *pTmpNd);
+ m_rDoc.GetNodes().SectionUp(&range);
+ --nEnde; // account for deleted start node
+ }
+
// delete the Nodes into the NodesArary
m_rDoc.GetNodes().Delete( aSttIdx, nEnde - aSttIdx.GetIndex() );
}
commit f5f042fd0a8f107064763e04bdbbc098311e8d88
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Jul 31 13:32:29 2020 +0200
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sun Aug 2 00:03:55 2020 +0200
tdf#134931 sw_redlinehide: fix layout following paste of table
The pasted table does get a SwTabFrame but the problem is that
TurboAction() is called and formats the pre-existing SwTextFrame and
somehow that just sets all the valid flags on the new SwTabFrame without
doing any formatting.
Previously, SwNodes::CopyNodes(bNewFrames=true) would call
SwTabFrame::Paste() which invalidates the page.
In InsertCnt_(), for new SwSectionFrames InvalidatePage() is already
called so do the same for SwTabFrame which gets rid of the "turbo".
(regression from 166b5010b402a41b192b1659093a25acf9065fd9)
Change-Id: I970a04bd8e76f5418bddb66af915ac466f44daf3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99867
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit 5f7b937e9f81824f11022bc6b4dd222f700883cd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99845
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index af968c9d3e58..745c1818d859 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1615,6 +1615,10 @@ void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
pPageMaker->CheckInsert( nIndex );
pFrame->InsertBehind( pLay, pPrv );
+ if (pPage) // would null in SwCellFrame ctor
+ { // tdf#134931 call ResetTurbo(); not sure if Paste() would be
+ pFrame->InvalidatePage(pPage); // better than InsertBehind()?
+ }
// #i27138#
// notify accessibility paragraphs objects about changed
// CONTENT_FLOWS_FROM/_TO relation.
commit a6753768fe914fb110bc4e4def4699b8e54b7e49
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Jul 30 01:28:14 2020 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri Jul 31 11:45:51 2020 +0200
tdf#133967: sw_uiwriter: Add unittest
Change-Id: I7ec43fd7109e883b0ae560cc8832e449a09fddb0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99758
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
(cherry picked from commit a6e02f6337f038a445b858bb91bf14d1a14768e4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99735
Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99791
diff --git a/sw/qa/extras/uiwriter/data/tdf133967.odt b/sw/qa/extras/uiwriter/data/tdf133967.odt
new file mode 100644
index 000000000000..18ed5bfb7844
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf133967.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 3d7291de336b..157773a7648a 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -233,6 +233,7 @@ public:
void testSearchWithTransliterate();
void testTdf73660();
void testNewDocModifiedState();
+ void testTdf133967();
void testTdf132187();
void testTdf77342();
void testTdf63553();
@@ -441,6 +442,7 @@ public:
CPPUNIT_TEST(testSearchWithTransliterate);
CPPUNIT_TEST(testTdf73660);
CPPUNIT_TEST(testNewDocModifiedState);
+ CPPUNIT_TEST(testTdf133967);
CPPUNIT_TEST(testTdf132187);
CPPUNIT_TEST(testTdf77342);
CPPUNIT_TEST(testTdf63553);
@@ -4339,6 +4341,34 @@ void SwUiWriterTest::testUnicodeNotationToggle()
CPPUNIT_ASSERT_EQUAL( sDocString, sOriginalDocString );
}
+void SwUiWriterTest::testTdf133967()
+{
+ load(DATA_DIRECTORY, "tdf133967.odt");
+
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+ CPPUNIT_ASSERT_EQUAL(6, getPages());
+
+ lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {});
+
+ lcl_dispatchCommand(mxComponent, ".uno:Cut", {});
+ Scheduler::ProcessEventsToIdle();
+
+ for (sal_Int32 i = 0; i < 10; ++i)
+ {
+ lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ lcl_dispatchCommand(mxComponent, ".uno:Redo", {});
+ Scheduler::ProcessEventsToIdle();
+ }
+
+ // Without the fix in place, this test would have failed with:
+ //- Expected: 1
+ //- Actual : 45
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
void SwUiWriterTest::testTdf132187()
{
load(DATA_DIRECTORY, "tdf132187.odt");
commit 941086cdc0e8aa792eddc3d2284cd795aa8f7ea3
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Jul 29 19:02:46 2020 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Jul 30 22:03:33 2020 +0200
tdf#134252 sw_redlinehide: fix SwUndoDelete for table before end of section
In this funny case, the SwPaM starts inside a section, and ends in the
first text node following the end of the section, which happens to be in
a different section (but that doesn't matter)... this is because
IsSelOvr() moves the end of the selection resulting in the 3rd SelAll
off of the table end node (as the section ends with a table), but then
it's on the section end node and moves forward again.
SwUndoDelete::UndoImpl() must first create the outer section frames,
skip over the start text node which has frames handled by
RecreateStartTextFrames() and then create the frames following the start
text node, where the end node of the outer section now finds its expected
outer section frame.
This relies on the code from 55576842ec72a748d0bad123d41fa03c89fc136d
to move the existing text frame below the new section frame(s).
(regression from 6c7245e789f973cf6dad03f7008ab3f9d12d350c)
Change-Id: I9f39b09e603e75ef813d5c855d828ec9bd5fdd95
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99723
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit 740f1796504f66408b692225a9676c9ee3d63722)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99785
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sw/qa/extras/uiwriter/data/tdf134252.fodt b/sw/qa/extras/uiwriter/data/tdf134252.fodt
new file mode 100644
index 000000000000..6e19ac847dd8
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf134252.fodt
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:officeooo="http://openoffice.org/2009/office" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rpt="http://openoffice.org/2005/report" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns
:config:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="ur
n:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:font-face-decls>
+ <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/>
+ <style:font-face style:name="Lohit Devanagari" svg:font-family="'Lohit Devanagari'" style:font-family-generic="system" style:font-pitch="variable"/>
+ <style:font-face style:name="Source Han Serif CN" svg:font-family="'Source Han Serif CN'" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+ <style:default-style style:family="graphic">
+ <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:flow-with-text="false"/>
+ <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false">
+ <style:tab-stops/>
+ </style:paragraph-properties>
+ <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han Serif CN" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/>
+ </style:default-style>
+ <style:default-style style:family="paragraph">
+ <style:paragraph-properties fo:orphans="2" fo:widows="2" fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
+ <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han Serif CN" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false"/>
+ </style:default-style>
+ <style:default-style style:family="table">
+ <style:table-properties table:border-model="collapsing"/>
+ </style:default-style>
+ <style:default-style style:family="table-row">
+ <style:table-row-properties fo:keep-together="auto"/>
+ </style:default-style>
+ <style:style style:name="Standard" style:family="paragraph" style:class="text"/>
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list