summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/odfimport/data/forcepoint101.fodt13
-rw-r--r--sw/qa/extras/odfimport/odfimport.cxx6
-rw-r--r--sw/source/core/unocore/unodraw.cxx4
-rw-r--r--sw/source/core/unocore/unoframe.cxx1
-rw-r--r--xmloff/source/text/XMLTextShapeImportHelper.cxx15
5 files changed, 33 insertions, 6 deletions
diff --git a/sw/qa/extras/odfimport/data/forcepoint101.fodt b/sw/qa/extras/odfimport/data/forcepoint101.fodt
new file mode 100644
index 000000000000..7210888262dc
--- /dev/null
+++ b/sw/qa/extras/odfimport/data/forcepoint101.fodt
@@ -0,0 +1,13 @@
+<?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="urn: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:body>
+ <office:text>
+ <draw:custom-shape text:anchor-type="page" texnumber="1" draw:z-index="1" draw:name="Shape2" svg:width="2.276cm" svg:height="2.276cm" svg:x="4.752cm" svg:y="2.902cm">
+ <text:p/>
+ </draw:custom-shape>
+ <text:p>
+ <draw:custom-shape draw:z-index="0" draw:name="Shape1" svg:width="3.44cm" svg:height="2.065cm" svg:x="-1.337cm" svg:y="0.912cm"><text:p/></draw:custom-shape>
+ <field:fieldmark-start text:name="__Fieldmark__0_1348794289" field:type="vnd.oasis.opendocument.field.FORMTEXT"/>foobar<field:fieldmark-end/></text:p>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index 336cca824232..9c177f981aa4 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -1334,5 +1334,11 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf146597)
// This was creashed before.
}
+// just care that it doesn't crash/assert
+CPPUNIT_TEST_FIXTURE(Test, testForcepoint101)
+{
+ load(mpTestDocumentPath, "forcepoint101.fodt");
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index e61a66850001..5c5811ee3934 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -668,9 +668,11 @@ void SwXDrawPage::add(const uno::Reference< drawing::XShape > & xShape)
{
aAnchor.SetType(RndStdIds::FLY_AS_CHAR);
}
- else if (RndStdIds::FLY_AT_PAGE == aAnchor.GetAnchorId())
+ else if (RndStdIds::FLY_AT_PAGE == aAnchor.GetAnchorId()
+ && 0 == aAnchor.GetPageNum())
{
aAnchor.SetAnchor(pInternalPam->Start());
+ aAnchor.SetType(RndStdIds::FLY_AT_CHAR); // convert invalid at-page
}
}
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 6b21f34b25ce..2513c991451b 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2778,6 +2778,7 @@ void SwXFrame::attachToRange(uno::Reference<text::XTextRange> const& xTextRange,
0 == static_cast<const SwFormatAnchor*>(pItem)->GetPageNum() )
{
SwFormatAnchor aAnchor( *static_cast<const SwFormatAnchor*>(pItem) );
+ aAnchor.SetType(RndStdIds::FLY_AT_CHAR); // convert invalid at-page
aAnchor.SetAnchor( aPam.GetPoint() );
aFrameSet.Put(aAnchor);
}
diff --git a/xmloff/source/text/XMLTextShapeImportHelper.cxx b/xmloff/source/text/XMLTextShapeImportHelper.cxx
index 89b7de528c95..f4a62f4ad9b7 100644
--- a/xmloff/source/text/XMLTextShapeImportHelper.cxx
+++ b/xmloff/source/text/XMLTextShapeImportHelper.cxx
@@ -119,11 +119,7 @@ void XMLTextShapeImportHelper::addShape(
// anchor type
xPropSet->setPropertyValue( gsAnchorType, Any(eAnchorType) );
- Reference < XTextContent > xTxtCntnt( rShape, UNO_QUERY );
- xTxtImport->InsertTextContent( xTxtCntnt );
-
- // page number (must be set after the frame is inserted, because it
- // will be overwritten then inserting the frame.
+ // page number must be set before the frame is inserted
switch( eAnchorType )
{
case TextContentAnchorType_AT_PAGE:
@@ -133,6 +129,15 @@ void XMLTextShapeImportHelper::addShape(
xPropSet->setPropertyValue( gsAnchorPageNo, Any(nPage) );
}
break;
+ default:
+ break;
+ }
+
+ Reference < XTextContent > xTxtCntnt( rShape, UNO_QUERY );
+ xTxtImport->InsertTextContent( xTxtCntnt );
+
+ switch( eAnchorType )
+ {
case TextContentAnchorType_AS_CHARACTER:
xPropSet->setPropertyValue( gsVertOrientPosition, Any(nY) );
break;