[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source test/source

2023-12-04 Thread Tomaž Vajngerl (via logerrit)
 include/oox/export/drawingml.hxx   |   14 ++-
 oox/source/export/drawingml.cxx|  103 +++--
 oox/source/token/namespaces-strict.txt |1 
 oox/source/token/namespaces.txt|1 
 oox/source/token/tokens.txt|2 
 sw/qa/extras/ooxmlexport/data/SvgImageTest.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport20.cxx |   27 ++
 sw/source/filter/ww8/docxattributeoutput.cxx   |   16 +++
 test/source/xmltesttools.cxx   |2 
 9 files changed, 157 insertions(+), 9 deletions(-)

New commits:
commit bfbbf06bcea4d58117c14fd3f3b8743a3714f97e
Author: Tomaž Vajngerl 
AuthorDate: Sun Dec 3 13:21:35 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 4 10:33:34 2023 +0100

tdf#126084 support writing SVG images into OOXML using the MS OOXML 
extension

SVG files aren't supported in OOXML, but we can write it using the
MS OOXML extension, which is supported in the latest MSO versions.

For now this only implements the support in the exporter.

Change-Id: I688180fb5772f3999c2ee3020bc234f90d57cc2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157237
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 9028cfdc0f9f..dcbb1b544390 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -259,16 +259,25 @@ private:
 DocumentType meDocumentType;
 
 OUString writeNewEntryToStorage(const Graphic& rGraphic, bool 
bRelPathToMedia);
+OUString writeNewSvgEntryToStorage(const Graphic& rGraphic, bool 
bRelPathToMedia);
 
 public:
+enum class TypeHint
+{
+Detect,
+SVG
+};
+
 GraphicExport(sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* 
pFilterBase, DocumentType eDocumentType)
 : mpFS(pFS)
 , mpFilterBase(pFilterBase)
 , meDocumentType(eDocumentType)
 {}
 
-OUString writeToStorage(Graphic const& rGraphic, bool bRelPathToMedia = 
false);
+OUString writeToStorage(Graphic const& rGraphic, bool bRelPathToMedia = 
false, TypeHint eHint = TypeHint::Detect);
+
 void writeBlip(Graphic const& rGraphic, std::vector 
const& rEffects, bool bRelPathToMedia = false);
+void writeSvgExtension(OUString const& rSvgRelId);
 };
 
 class OOX_DLLPUBLIC DrawingML
@@ -353,7 +362,7 @@ public:
 
 void SetBackgroundDark(bool bIsDark) { mbIsBackgroundDark = bIsDark; }
 /// If bRelPathToMedia is true add "../" to image folder path while adding 
the image relationship
-OUString writeGraphicToStorage(const Graphic &rGraphic , bool 
bRelPathToMedia = false);
+OUString writeGraphicToStorage(const Graphic &rGraphic , bool 
bRelPathToMedia = false, GraphicExport::TypeHint eHint = 
GraphicExport::TypeHint::Detect);
 
 void WriteColor( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT );
 void WriteColor( const OUString& sColorSchemeName, const 
css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 
nAlpha = MAX_PERCENT );
@@ -516,6 +525,7 @@ public:
 const OUString& sRelationshipType,
 OUString* pRelationshipId );
 
+std::shared_ptr createGraphicExport();
 };
 
 }
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 228aa2326cc0..05c96c9ad798 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1283,12 +1283,34 @@ OUString DrawingML::GetRelationCompPrefix() const
 return OUString(getRelationCompPrefix(meDocumentType));
 }
 
+void GraphicExport::writeSvgExtension(OUString const& rSvgRelId)
+{
+if (rSvgRelId.isEmpty())
+return;
+
+mpFS->startElementNS(XML_a, XML_extLst);
+mpFS->startElementNS(XML_a, XML_ext, XML_uri, 
"{96DAC541-7B7A-43D3-8B79-37D633B846F1}");
+mpFS->singleElementNS(XML_asvg, XML_svgBlip,
+FSNS(XML_xmlns, XML_asvg), 
mpFilterBase->getNamespaceURL(OOX_NS(asvg)),
+FSNS(XML_r, XML_embed), rSvgRelId);
+mpFS->endElementNS(XML_a, XML_ext);
+mpFS->endElementNS( XML_a, XML_extLst);
+}
+
 void GraphicExport::writeBlip(Graphic const& rGraphic, 
std::vector const& rEffects, bool bRelPathToMedia)
 {
 OUString sRelId = writeToStorage(rGraphic, bRelPathToMedia);
 
 mpFS->startElementNS(XML_a, XML_blip, FSNS(XML_r, XML_embed), sRelId);
 
+auto const& rVectorGraphicDataPtr = rGraphic.getVectorGraphicData();
+
+if (rVectorGraphicDataPtr && rVectorGraphicDataPtr->getType() == 
VectorGraphicDataType::Svg)
+{
+OUString sSvgRelId = writeToStorage(rGraphic, bRelPathToMedia, 
TypeHint::SVG);
+writeSvgExtension(sSvgRelId);
+}
+
 for (auto const& rEffect : rEffects)
 {
 switch (rEffect.meType)
@@ -1514,19 +1536,72 @@ OUString GraphicExport::writeNewEntryToStorage(const 
Graphic& rGraphic, boo

[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source

2023-04-11 Thread Tünde Tóth (via logerrit)
 include/oox/core/xmlfilterbase.hxx   |4 
 oox/source/export/shapes.cxx |   23 +++
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx   |   11 +++
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx|   10 --
 sw/source/filter/ww8/docxattributeoutput.cxx |6 ++
 5 files changed, 44 insertions(+), 10 deletions(-)

New commits:
commit 7460e4f4a7b15cc7984adf65bc17e3d580413224
Author: Tünde Tóth 
AuthorDate: Wed Mar 29 15:09:11 2023 +0200
Commit: László Németh 
CommitDate: Tue Apr 11 19:35:57 2023 +0200

tdf#154469 DOCX export: fix hyperlink in group shape

Hyperlink inserted to shape lost after export,
if the shape was inside a group shape.

Follow-up to commit 7f4f88b883f81fbce975f72aea0f66a54e269ead
"tdf#145147 DOCX import: fix hyperlink in group shape".

Change-Id: I48b582c04b6f779cb5393179f65a32d7a7eca5ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149716
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/core/xmlfilterbase.hxx 
b/include/oox/core/xmlfilterbase.hxx
index 89a7994a904b..317c2a2cb789 100644
--- a/include/oox/core/xmlfilterbase.hxx
+++ b/include/oox/core/xmlfilterbase.hxx
@@ -221,6 +221,10 @@ public:
  */
 sal_Int32 GetUniqueId() { return mnMaxDocId++; }
 
+sal_Int32 GetMaxDocId() { return mnMaxDocId; }
+
+void SetMaxDocId(sal_Int32 maxDocId) { mnMaxDocId = maxDocId; }
+
 /** Write the document properties into into the current OPC package.
 
 @param xProperties  The document properties to export.
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index eab82a86336d..83d308ca793f 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -902,6 +902,29 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 else
 {
 pFS->startElementNS(mnXmlNamespace, XML_wsp);
+if (m_xParent.is())
+{
+pFS->startElementNS(mnXmlNamespace, XML_cNvPr, XML_id,
+OString::number(GetShapeID(xShape) == -1 ? 
GetNewShapeID(xShape)
+ : 
GetShapeID(xShape)),
+XML_name, GetShapeName(xShape));
+
+if (GetProperty(rXPropSet, "Hyperlink"))
+{
+OUString sURL;
+mAny >>= sURL;
+if (!sURL.isEmpty())
+{
+OUString sRelId = mpFB->addRelation(
+mpFS->getOutputStream(), 
oox::getRelationship(Relationship::HYPERLINK),
+mpURLTransformer->getTransformedString(sURL),
+mpURLTransformer->isExternalURL(sURL));
+
+mpFS->singleElementNS(XML_a, XML_hlinkClick, FSNS(XML_r, 
XML_id), sRelId);
+}
+}
+pFS->endElementNS(mnXmlNamespace, XML_cNvPr);
+}
 pFS->singleElementNS(mnXmlNamespace, XML_cNvSpPr);
 }
 
diff --git a/sw/qa/extras/ooxmlimport/data/grouped_link.docx 
b/sw/qa/extras/ooxmlexport/data/grouped_link.docx
similarity index 100%
rename from sw/qa/extras/ooxmlimport/data/grouped_link.docx
rename to sw/qa/extras/ooxmlexport/data/grouped_link.docx
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 04ce5b8d452c..908d8db90e3e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -878,6 +878,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf149996, 
"lorem_hyperlink.fodt")
 // because the exported file was corrupted.
 }
 
+DECLARE_OOXMLEXPORT_TEST(testGroupedShapeLink, "grouped_link.docx")
+{
+// tdf#145147 Hyperlink in grouped shape not imported
+// tdf#154469 Hyperlink in grouped shape not exported
+uno::Reference xGroupShape(getShape(1), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("https://www.libreoffice.org";),
+ getProperty(xGroupShape->getByIndex(0), 
"Hyperlink"));
+CPPUNIT_ASSERT_EQUAL(OUString("https://www.documentfoundation.org";),
+ getProperty(xGroupShape->getByIndex(1), 
"Hyperlink"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index bcd75b78ecf5..caaa4b6842de 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -1144,16 +1144,6 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf154695)
 }
 }
 
-CPPUNIT_TEST_FIXTURE(Test, testTdf145147)
-{
-createSwDoc("grouped_link.docx");
-uno::Reference xGroupShape(getShape(1), uno::UNO_QUERY);
-CPPUNIT_ASSERT_EQUAL(OUString("https://www.libreoffice.org";),
- getProperty(xGroupShape->getByIndex(0), 
"Hyperlink"));
-CP

[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source

2021-08-05 Thread Samuel Mehrbrodt (via logerrit)
 include/oox/vml/vmlshape.hxx|2 -
 include/oox/vml/vmlshapecontext.hxx |4 +-
 oox/source/token/properties.txt |1 
 oox/source/vml/vmlshape.cxx |7 ++-
 oox/source/vml/vmlshapecontext.cxx  |   13 +++
 sw/qa/extras/ooxmlexport/data/docxopenhyperlinkbox.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx  |   22 
 sw/source/filter/ww8/docxsdrexport.cxx  |   29 +++-
 8 files changed, 66 insertions(+), 12 deletions(-)

New commits:
commit e12d4c7e361f449fcf143a61caed92129aca3468
Author: Samuel Mehrbrodt 
AuthorDate: Wed Aug 4 21:57:39 2021 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Thu Aug 5 09:00:45 2021 +0200

tdf#123643 Import/Export for hyperlinks on text boxes

Change-Id: Ied436c4a619985f27e5854369d319d76c05890d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120028
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx
index d90ecc2865bf..19c82384efcd 100644
--- a/include/oox/vml/vmlshape.hxx
+++ b/include/oox/vml/vmlshape.hxx
@@ -112,7 +112,6 @@ struct ShapeTypeModel
 OptValue moCropRight; ///< Specifies how much to crop the image 
from the right in as a fraction of picture size.
 OptValue moCropTop; ///< Specifies how much to crop the image 
from the top down as a fraction of picture size.
 OUString maLayoutFlowAlt; ///< Specifies the alternate layout flow for 
text in textboxes.
-OUString maHyperlink; ///< The hyperlink assigned to the shape
 
 explicitShapeTypeModel();
 
@@ -218,6 +217,7 @@ struct ShapeModel
 bool mbSignatureLineShowSignDate;
 bool mbSignatureLineCanAddComment;
 bool mbInGroup;
+OUString maHyperlink; ///< The hyperlink assigned to the shape
 
 explicitShapeModel();
 ~ShapeModel();
diff --git a/include/oox/vml/vmlshapecontext.hxx 
b/include/oox/vml/vmlshapecontext.hxx
index 0d4b3ddd9e7e..49fc6826ae5a 100644
--- a/include/oox/vml/vmlshapecontext.hxx
+++ b/include/oox/vml/vmlshapecontext.hxx
@@ -107,8 +107,6 @@ public:
 private:
 /** Processes the 'style' attribute. */
 voidsetStyle( const OUString& rStyle );
-/** Processes the 'href' attribute. */
-voidsetHyperlink( const OUString& rHyperlink );
 
 /** Resolve a relation identifier to a fragment path. */
 OptValue< OUString > decodeFragmentPath( const AttributeList& rAttribs, 
sal_Int32 nToken ) const;
@@ -141,6 +139,8 @@ private:
 voidsetControl2( const OUString& rPoints );
 /** Processes the 'path' attribute. */
 voidsetVmlPath( const OUString& rPath );
+/** Processes the 'href' attribute. */
+voidsetHyperlink( const OUString& rHyperlink );
 
 private:
 ShapeBase&  mrShape;
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 04b550e669ea..b35a5bc3cd4a 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -255,6 +255,7 @@ HoriOrientRelation
 HorizontalSplitMode
 HorizontalSplitPositionTwips
 Hyperlink
+HyperLinkURL
 IgnoreBlankCells
 IgnoreCase
 IgnoreLeadingSpaces
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index d1029173a1db..4e4b848db941 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -770,6 +770,9 @@ Reference< XShape > SimpleShape::implConvertAndInsert( 
const Reference< XShapes
 {
 PropertySet(xShape).setAnyProperty(PROP_WritingMode, 
uno::makeAny(nWritingMode));
 }
+// tdf#123626
+if (!maShapeModel.maHyperlink.isEmpty())
+PropertySet(xShape).setAnyProperty(PROP_HyperLinkURL, 
makeAny(maShapeModel.maHyperlink));
 }
 else
 {
@@ -814,8 +817,8 @@ Reference< XShape > SimpleShape::implConvertAndInsert( 
const Reference< XShapes
 PropertySet(xShape).setAnyProperty(PROP_TextWordWrap, 
makeAny(maTypeModel.maWrapStyle == "square"));
 
 // tdf#123626
-if (!maTypeModel.maHyperlink.isEmpty())
-PropertySet(xShape).setAnyProperty(PROP_Hyperlink, 
makeAny(maTypeModel.maHyperlink));
+if (!maShapeModel.maHyperlink.isEmpty())
+PropertySet(xShape).setAnyProperty(PROP_Hyperlink, 
makeAny(maShapeModel.maHyperlink));
 
 PropertySet(xShape).setAnyProperty(PROP_TextAutoGrowHeight,
makeAny(maTypeModel.mbAutoHeight));
diff --git a/oox/source/vml/vmlshapecontext.cxx 
b/oox/source/vml/vmlshapecontext.cxx
index d53a924c278a..82ca210e7588 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -312,7 +312,6 @@ ShapeTypeContext::ShapeTypeContext(ContextHandler2Helper 
const & rParent

[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source

2021-03-26 Thread Daniel Arato (NISZ) (via logerrit)
 include/oox/export/drawingml.hxx |8 +++--
 include/oox/export/vmlexport.hxx |6 ++-
 oox/source/export/drawingml.cxx  |   31 ++-
 oox/source/export/vmlexport.cxx  |   10 +++---
 sw/qa/extras/ooxmlexport/data/tdf118535.odt  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx   |   13 
 sw/source/filter/ww8/docxattributeoutput.cxx |   42 ---
 sw/source/filter/ww8/docxattributeoutput.hxx |   11 +++
 sw/source/filter/ww8/docxexport.cxx  |4 --
 9 files changed, 88 insertions(+), 37 deletions(-)

New commits:
commit 797fef38612fb2fd62d1f6591619b9361e526bca
Author: Daniel Arato (NISZ) 
AuthorDate: Tue Mar 9 14:11:11 2021 +0100
Commit: László Németh 
CommitDate: Fri Mar 26 13:07:57 2021 +0100

tdf#118535 DOCX export: save header image once

Writer used to dump the same image file as many times
as it was featured in different headers or footers in
the document, bloating the .docx file size.

This is countered by making all "relationships" in the
header*.xml.rels files point to the same image.

Change-Id: I44d72630289c721d58d8f7e208517df2f1fe621c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112656
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 2cd17e6defb0..cfcad30fa257 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -125,8 +125,10 @@ public:
 virtual void WriteTextBox(css::uno::Reference 
xShape) = 0;
 /// Look up the RelId of a graphic based on its checksum.
 virtual OUString FindRelId(BitmapChecksum nChecksum) = 0;
-/// Store the RelId of a graphic based on its checksum.
-virtual void CacheRelId(BitmapChecksum nChecksum, const OUString& rRelId) 
= 0;
+/// Look up the filename of a graphic based on its checksum.
+virtual OUString FindFileName(BitmapChecksum nChecksum) = 0;
+/// Store the RelId and filename of a graphic based on its checksum.
+virtual void CacheRelId(BitmapChecksum nChecksum, const OUString& rRelId, 
const OUString& rFileName) = 0;
 ///  Get textbox which belongs to the shape.
 virtual css::uno::Reference GetUnoTextFrame(
 css::uno::Reference xShape) = 0;
@@ -192,7 +194,7 @@ public:
 
 void SetBackgroundDark(bool bIsDark) { mbIsBackgroundDark = bIsDark; }
 /// If bRelPathToMedia is true add "../" to image folder path while adding 
the image relationship
-OUString WriteImage( const Graphic &rGraphic , bool bRelPathToMedia = 
false);
+OUString WriteImage( const Graphic &rGraphic , bool bRelPathToMedia = 
false, OUString* pFileName = nullptr );
 
 void WriteColor( ::Color nColor, sal_Int32 nAlpha = MAX_PERCENT );
 void WriteColor( const OUString& sColorSchemeName, const 
css::uno::Sequence< css::beans::PropertyValue >& aTransformations, sal_Int32 
nAlpha = MAX_PERCENT );
diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx
index dd5edc57c208..9a53a07652c8 100644
--- a/include/oox/export/vmlexport.hxx
+++ b/include/oox/export/vmlexport.hxx
@@ -67,8 +67,10 @@ public:
 virtual void WriteVMLTextBox(css::uno::Reference 
xShape) = 0;
 /// Look up the RelId of a graphic based on its checksum.
 virtual OUString FindRelId(BitmapChecksum nChecksum) = 0;
-/// Store the RelId of a graphic based on its checksum.
-virtual void CacheRelId(BitmapChecksum nChecksum, const OUString& rRelId) 
= 0;
+/// Look up the filename of a graphic based on its checksum.
+virtual OUString FindFileName(BitmapChecksum nChecksum) = 0;
+/// Store the RelId and filename of a graphic based on its checksum.
+virtual void CacheRelId(BitmapChecksum nChecksum, const OUString& rRelId, 
const OUString& rFileName) = 0;
 protected:
 VMLTextExport() {}
 virtual ~VMLTextExport() {}
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 67f26e71daea..32780296ce89 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1162,7 +1162,7 @@ const char* DrawingML::GetRelationCompPrefix() const
 return "unknown";
 }
 
-OUString DrawingML::WriteImage( const Graphic& rGraphic , bool bRelPathToMedia 
)
+OUString DrawingML::WriteImage( const Graphic& rGraphic , bool 
bRelPathToMedia, OUString* pFileName )
 {
 GfxLink aLink = rGraphic.GetGfxLink ();
 OUString sMediaType;
@@ -1266,15 +1266,18 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic 
, bool bRelPathToMedia )
 sRelationCompPrefix = "../";
 else
 sRelationCompPrefix = GetRelationCompPrefix();
+OUString sPath = OUStringBuffer()
+ .appendAscii( sRelationCompPrefix.getStr() )
+ .appendAscii( sRelPathToMedia.getStr() )
+ .append( static_cast(mnImageCounter ++) )
+ 

[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source

2021-02-22 Thread Michael Stahl (via logerrit)
 include/oox/export/vmlexport.hxx |6 
 oox/source/export/vmlexport.cxx  |8 
 sw/qa/extras/ooxmlexport/data/shape-atpage-in-table.fodt |  185 +++
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx   |   11 
 sw/source/filter/ww8/docxattributeoutput.cxx |3 
 sw/source/filter/ww8/docxsdrexport.cxx   |6 
 6 files changed, 214 insertions(+), 5 deletions(-)

New commits:
commit 60b61fdaf85cecea0f972fc435530ee5d7492c98
Author: Michael Stahl 
AuthorDate: Mon Feb 22 14:11:05 2021 +0100
Commit: Michael Stahl 
CommitDate: Mon Feb 22 19:09:36 2021 +0100

oox: VML export: write o:allowincell attribute on shapes

Apparently the default is "t", which causes a fly that is anchored
at-page with the first content on the page being a table to be wrongly
positioned.

Change-Id: Iba1b961c6e884b2a55928952937187732ef73a5a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111336
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx
index 4ee885fba6bd..dd5edc57c208 100644
--- a/include/oox/export/vmlexport.hxx
+++ b/include/oox/export/vmlexport.hxx
@@ -86,6 +86,7 @@ class OOX_DLLPUBLIC VMLExport : public EscherEx
 sal_Int16 m_eHOri, m_eVOri, m_eHRel, m_eVRel;
 rtl::Reference m_pWrapAttrList;
 bool m_bInline; // css::text::TextContentAnchorType_AS_CHARACTER
+bool m_IsFollowingTextFlow = false;
 
 /// The object we're exporting.
 const SdrObject* m_pSdrObject;
@@ -140,8 +141,9 @@ public:
 /// Export the sdr object as VML.
 ///
 /// Call this when you need to export the object as VML.
-OString const & AddSdrObject( const SdrObject& rObj, sal_Int16 eHOri = -1,
-sal_Int16 eVOri = -1, sal_Int16 eHRel = -1,
+OString const & AddSdrObject( const SdrObject& rObj,
+bool const bIsFollowingTextFlow = false,
+sal_Int16 eHOri = -1, sal_Int16 eVOri = -1, sal_Int16 eHRel = -1,
 sal_Int16 eVRel = -1,
 sax_fastparser::FastAttributeList* pWrapAttrList = nullptr,
 const bool bOOxmlExport = false );
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 07157edc3f85..9c6b89ef7dd7 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -1400,6 +1400,8 @@ sal_Int32 VMLExport::StartShape()
 break;
 }
 
+m_pShapeAttrList->addNS(XML_o, XML_allowincell, m_IsFollowingTextFlow ? 
"t" : "f");
+
 // add style
 m_pShapeAttrList->add( XML_style, m_ShapeStyle.makeStringAndClear() );
 
@@ -1530,7 +1532,9 @@ void VMLExport::EndShape( sal_Int32 nShapeElement )
 m_pSerializer->endElementNS( XML_v, nShapeElement );
 }
 
-OString const & VMLExport::AddSdrObject( const SdrObject& rObj, sal_Int16 
eHOri, sal_Int16 eVOri, sal_Int16 eHRel, sal_Int16 eVRel,
+OString const & VMLExport::AddSdrObject( const SdrObject& rObj,
+bool const bIsFollowingTextFlow,
+sal_Int16 eHOri, sal_Int16 eVOri, sal_Int16 eHRel, sal_Int16 eVRel,
 FastAttributeList* pWrapAttrList,
 const bool bOOxmlExport )
 {
@@ -1541,6 +1545,7 @@ OString const & VMLExport::AddSdrObject( const SdrObject& 
rObj, sal_Int16 eHOri,
 m_eVRel = eVRel;
 m_pWrapAttrList = pWrapAttrList;
 m_bInline = false;
+m_IsFollowingTextFlow = bIsFollowingTextFlow;
 EscherEx::AddSdrObject(rObj, bOOxmlExport);
 return m_sShapeId;
 }
@@ -1554,6 +1559,7 @@ OString const & VMLExport::AddInlineSdrObject( const 
SdrObject& rObj, const bool
 m_eVRel = -1;
 m_pWrapAttrList.clear();
 m_bInline = true;
+m_IsFollowingTextFlow = true;
 EscherEx::AddSdrObject(rObj, bOOxmlExport);
 return m_sShapeId;
 }
diff --git a/sw/qa/extras/ooxmlexport/data/shape-atpage-in-table.fodt 
b/sw/qa/extras/ooxmlexport/data/shape-atpage-in-table.fodt
new file mode 100644
index ..42c9c7790509
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/shape-atpage-in-table.fodt
@@ -0,0 +1,185 @@
+
+
+http://openoffice.org/2004/office"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/"; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:ooow="http://openoffice.org/200
 4/write

[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source

2020-09-11 Thread Attila Bakos (via logerrit)
 include/oox/export/vmlexport.hxx |1 
 oox/source/export/vmlexport.cxx  |   78 +++
 sw/qa/extras/ooxmlexport/data/tdf135667.odt  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx   |   17 +
 sw/source/filter/ww8/docxattributeoutput.cxx |  291 ---
 sw/source/filter/ww8/docxattributeoutput.hxx |4 
 6 files changed, 288 insertions(+), 103 deletions(-)

New commits:
commit 65bc6e12ef8a681ec4597635d0b3d86e9ac355d3
Author: Attila Bakos 
AuthorDate: Fri Sep 4 11:48:16 2020 +0200
Commit: László Németh 
CommitDate: Fri Sep 11 17:27:24 2020 +0200

tdf#135667 DOCX export: fix border line of OLE objects

which wasn't exported.

Note: the enlarged monolithic export function was
split in the following new functions:

- WriteOLEShape() exports the replacement shape of
the OLE object.

- GetOLEStyle() returns the string value of the
style attribute.

- ExportOLESurround() handles the surround settings.

Also add GetVMLShapeTypeDefinition() to reuse picture
frame VML formula string used by VMLExport.

Co-authored-by: Arató Dániel (NISZ)

Change-Id: I29800a50c60a824a14849ac286a18e5e2f97c689
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102034
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx
index 06dbbc57a21c..94aeb8601f1a 100644
--- a/include/oox/export/vmlexport.hxx
+++ b/include/oox/export/vmlexport.hxx
@@ -145,6 +145,7 @@ public:
 voidSetHashMarkForType(bool bUseHashMarkForType) { 
m_bUseHashMarkForType = bUseHashMarkForType; }
 voidOverrideShapeIDGen(bool bOverrideShapeIdGeneration,
 const OString& sShapeIDPrefix = OString());
+static OString GetVMLShapeTypeDefinition(const OString& sShapeID, const 
bool bIsPictureFrame);
 
 protected:
 /// Add an attribute to the generated  element.
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 0a0a634708bf..dea03c552cee 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -1219,6 +1219,46 @@ sal_uInt32 VMLExport::GenerateShapeId()
 return m_nShapeIDCounter++;
 }
 
+OString VMLExport::GetVMLShapeTypeDefinition( const OString& sShapeID, const 
bool bIsPictureFrame )
+{
+OString sShapeType;
+if ( !bIsPictureFrame )
+// We don't have a shape definition for host control in 
presetShapeDefinitions.xml
+// So use a definition copied from DOCX file created with MSO
+sShapeType = "\n"
+"\n"
+"\n"
+"\n"
+"";
+else
+// We don't have a shape definition for picture frame in 
presetShapeDefinitions.xml
+// So use a definition copied from DOCX file created with MSO
+sShapeType = "\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"\n"
+"";
+return sShapeType;
+}
+
 sal_Int32 VMLExport::StartShape()
 {
 if ( m_nShapeType == ESCHER_ShpInst_Nil )
@@ -1237,56 +1277,22 @@ sal_Int32 VMLExport::StartShape()
 case ESCHER_ShpInst_Line:   nShapeElement = XML_line;  
break;
 case ESCHER_ShpInst_HostControl:
 {
-// We don't have a shape definition for host control in 
presetShapeDefinitions.xml
-// So use a definition copied from DOCX file created with MSO
 bReferToShapeType = true;
 nShapeElement = XML_shape;
 if ( !m_aShapeTypeWritten[ m_nShapeType ] )
 {
-OString sShapeType =
-"\n"
-"\n"
-"\n"
-"\n"
-"";
-m_pSerializer->write(sShapeType);
+
m_pSerializer->write(GetVMLShapeTypeDefinition(OString::number(m_nShapeType), 
false));
 m_aShapeTypeWritten[ m_nShapeType ] = true;
 }
 break;
 }
 case ESCHER_ShpInst_PictureFrame:
 {
-// We don't have a shape definition for picture frame in 
presetShapeDefinitions.xml
-// So use a definition copied from DOCX file created with MSO
 bReferToShapeType = true;
 nShapeElement = XML_shape;
 if ( !m_aShapeTypeWritten[ m_nShapeType

[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source writerfilter/source

2020-09-03 Thread Daniel Arato (NISZ) (via logerrit)
 include/oox/ole/oleobjecthelper.hxx  |2 +-
 oox/source/ole/oleobjecthelper.cxx   |   10 +++---
 sw/qa/extras/ooxmlexport/data/tdf131537.odt  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx|7 +++
 sw/source/filter/ww8/docxattributeoutput.cxx |   16 +++-
 writerfilter/source/dmapper/OLEHandler.cxx   |4 ++--
 6 files changed, 24 insertions(+), 15 deletions(-)

New commits:
commit 07dcb0dab759d4ab535d99c0e6d326959906b87e
Author: Daniel Arato (NISZ) 
AuthorDate: Mon Aug 31 12:48:07 2020 +0200
Commit: László Németh 
CommitDate: Thu Sep 3 18:34:55 2020 +0200

tdf#131537 DOCX export: fix OLE "Display as icon"

for example to avoid converting OLE icons of an ODF document
to an icon-size embedded spreadsheet.

When creating a new OLE object in Writer the user has an option called
"Display as icon" which causes the actual contents of the OLE to be
hidden when rendered in the document. This setting, referred to
internally as the DrawAspect of the object, was imported fine, but when
exported to a .docx it always had the value "Content" (corresponding to
"Display as icon" being unchecked). Now OLE objects with "Display as
icon" checked are saved with DrawAspect="Icon".

A grab bag entry was previously used to let the DrawAspect setting flow
through Writer from OOXML import to export. Now this workaround is no
longer needed and is removed by the present commit.

Change-Id: I46ea4fc95a26bcd1f85e19a506c0965f73d4257a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101711
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/include/oox/ole/oleobjecthelper.hxx 
b/include/oox/ole/oleobjecthelper.hxx
index a9d6bfec54bd..d2506f3d4949 100644
--- a/include/oox/ole/oleobjecthelper.hxx
+++ b/include/oox/ole/oleobjecthelper.hxx
@@ -76,7 +76,7 @@ private:
 OOX_DLLPUBLIC void SaveInteropProperties(
css::uno::Reference const& xModel,
OUString const& rObjectName, OUString const* pOldObjectName,
-   OUString const& rProgId, OUString const& rDrawAspect);
+   OUString const& rProgId);
 
 
 } // namespace oox::ole
diff --git a/oox/source/ole/oleobjecthelper.cxx 
b/oox/source/ole/oleobjecthelper.cxx
index b6c4edb4314e..6716ac1ebb29 100644
--- a/oox/source/ole/oleobjecthelper.cxx
+++ b/oox/source/ole/oleobjecthelper.cxx
@@ -87,7 +87,7 @@ OleObjectHelper::~OleObjectHelper()
 // just "application/vnd.sun.star.oleobject"
 void SaveInteropProperties(uno::Reference const& xModel,
OUString const& rObjectName, OUString const*const pOldObjectName,
-   OUString const& rProgId, OUString const& rDrawAspect)
+   OUString const& rProgId)
 {
 static const char sEmbeddingsPropName[] = "EmbeddedObjects";
 
@@ -100,11 +100,9 @@ void SaveInteropProperties(uno::Reference 
const& xModel,
 if (aGrabBag.find(sEmbeddingsPropName) != aGrabBag.end())
 objectsList << aGrabBag[sEmbeddingsPropName];
 
-uno::Sequence< beans::PropertyValue > aGrabBagAttribute(2);
+uno::Sequence< beans::PropertyValue > aGrabBagAttribute(1);
 aGrabBagAttribute[0].Name = "ProgID";
 aGrabBagAttribute[0].Value <<= rProgId;
-aGrabBagAttribute[1].Name = "DrawAspect";
-aGrabBagAttribute[1].Value <<= rDrawAspect;
 
 // If we got an "old name", erase that first.
 if (pOldObjectName)
@@ -148,9 +146,7 @@ bool OleObjectHelper::importOleObject( PropertyMap& 
rPropMap, const OleObjectInf
 xOutStrm->writeBytes( rOleObject.maEmbeddedData );
 xOutStrm->closeOutput();
 
-SaveInteropProperties(m_xModel, aObjectId, nullptr,
-rOleObject.maProgId,
-rOleObject.mbShowAsIcon ? OUString("Icon") : 
OUString("Content"));
+SaveInteropProperties(m_xModel, aObjectId, nullptr, 
rOleObject.maProgId);
 
 OUString aUrl = mxResolver->resolveEmbeddedObjectURL( aObjectId );
 OSL_ENSURE( aUrl.match( g_aEmbeddedObjScheme ), 
"OleObjectHelper::importOleObject - unexpected URL scheme" );
diff --git a/sw/qa/extras/ooxmlexport/data/tdf131537.odt 
b/sw/qa/extras/ooxmlexport/data/tdf131537.odt
new file mode 100644
index ..21f396368917
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf131537.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 6c07f4534ed4..af9cd5c86a56 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -909,6 +909,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testfdo80898, 
"fdo80898.docx")
 "Word.Document.8");
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testOleIconDrawAspect, "tdf131537.odt")
+{
+xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/w:object/o:OLEObject",
+"DrawAspect", "Icon");
+}
+
 DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTableCel

[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source writerfilter/source

2019-11-22 Thread Justin Luth (via logerrit)
 include/oox/vml/vmltextbox.hxx|1 
 oox/source/vml/vmltextbox.cxx |   34 
 oox/source/vml/vmltextboxcontext.cxx  |3 +
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx|8 ++
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx |   13 
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |5 +
 sw/source/filter/ww8/docxattributeoutput.cxx  |   22 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   59 ++
 writerfilter/source/dmapper/StyleSheetTable.cxx   |   14 -
 9 files changed, 121 insertions(+), 38 deletions(-)

New commits:
commit 334409fbde555a957cd34e295cc27f2c2bf6e194
Author: Justin Luth 
AuthorDate: Tue Oct 22 15:50:19 2019 +0300
Commit: Miklos Vajna 
CommitDate: Fri Nov 22 10:47:44 2019 +0100

tdf#128153 docx/VML: apply style properties to shape text

This replaces LO 4.3 commit 8766011bccfd0f12f8dd77d2f94eb16e2e8c3471
DOCX import: set document-level font size default based on default para 
style

...and is needed for tdf#118947, since bogus DEFAULT_VALUEs
really hinder determining what a table style should override.

Shape text should inherit the font size from the style that is specified.
In many cases, it will not be specified, and therefore the default style
was appropriate, but in cases where a style IS specified, then of course
use that fontsize ... and every other character and paragraph property.
HOWEVER, I only added the properties used in vml import for now,
and I skipped asian/complex fontnames since VML only handles CharHeight,
and not CharHeightAsian/Complex.
 -note: this does not affect direct formatting - it just sets
  default value at the shape level, not at the paragraph level.

So far I have only looked at DOCX:VML - which satisfies the
unit tests. There are other codepaths that lead to PushShapeContext
though, and this should be easy to expand to other import
situations. I've tried lots of asserts to find unit tests
that should be modified, and so far they all seemed to point
to VML - although round-tripping doesn't use VML and still
requires at minimum the CharHeight property to be overridden,
so limiting non-VML to that to maintain backward compatibility,
and reduce regression footprint.

Since we have to emulate here (since paragraph styles are not
supported on Draw text), a perfect solution cannot possibly be
found - specifically in cases where multiple paragraphs exist
in one shape with different styles applied, or where some
pararaphs apply a paragraph property and others do not.

Compromise 1: For ambiguous paragraph styles, fallback to the
default paragraph style. Rationale: Normally, most styles
inherit from default and only change a couple of properties.
So MOST of the properties will match the normal style.
The chances that the default style will be correct are
more likely than that some other random default would be.
  -note: no existing unit tests were ambiguous

Compromise 2: Ideally, each paragraph could report whether
it had DIRECT formatting, and the paragraphs could be
walked through instead of the shapes. But I don't think
that is reasonably possible in this SyncProperties situation.

At first I had a grabbag framework setup that monitored
when a paragraph property was set, and then skipped applying
that property. But I later noticed that the PropertyState
for paragraph properties actually did seem to reflect
that - which is a better solution if it works properly.

Regression potential:
-for VML: should be limited to non-charheight properties
where the default style sets some weird default, and
an ambiguous style sets it back to the program default.
Prior to this patch, the default style value wouldn't apply.
On the flip side (and more likely scenario), non-ambiguous
cases will use the correct value and look more like MSWord,
as seen in many existing unit tests that now use corrected fonts.
-for non-VML: should be none since I limit it to only
CharHeight which was previously emulated by changing the
program default.

Change-Id: I8f1fb7ed01f990dbf998ebe04064c2645a68e1aa
Reviewed-on: https://gerrit.libreoffice.org/81365
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 

diff --git a/include/oox/vml/vmltextbox.hxx b/include/oox/vml/vmltextbox.hxx
index e361d1b7040c..7a37577c71ad 100644
--- a/include/oox/vml/vmltextbox.hxx
+++ b/include/oox/vml/vmltextbox.hxx
@@ -43,6 +43,7 @@ struct ShapeTypeModel;
 struct TextParagraphModel
 {
 OptValue moParaAdjust; ///< Paragraph adjust (left, center, 
right, etc.)
+OptValue moParaStyleName;
 };
 
 /** Font settings for a text portion in a textbox. */
diff --git a/oox/source/vml/vmltextbox.cxx b/o

[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source

2014-07-17 Thread sushil_shinde
 include/oox/export/drawingml.hxx |4 ++--
 oox/source/export/drawingml.cxx  |2 +-
 oox/source/vml/vmlshape.cxx  |6 ++
 sw/qa/extras/ooxmlexport/data/TextFrameRotation.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |   11 +++
 sw/source/filter/ww8/docxsdrexport.cxx   |   17 +++--
 sw/source/filter/ww8/docxsdrexport.hxx   |2 ++
 7 files changed, 33 insertions(+), 9 deletions(-)

New commits:
commit 1bdd6d2129eecda564478d494fd46d14a54b6ac5
Author: sushil_shinde 
Date:   Thu Jul 10 11:46:22 2014 +0530

fdo#80894 : Rotation value for textframe was missing after RT.

   - Rotation property is not available for TextFrame in LO.
   - Hence grabbaged this value.
   - Roundtripped rotation value by converting it properly for both dml and 
vml textbox.
   - Added UT for it.

Change-Id: Ia040d55dc2ea79500df76877ba44a02971c872a8
Reviewed-on: https://gerrit.libreoffice.org/10190
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 6f64fcf..bf46326 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -29,10 +29,10 @@
 #include 
 #include 
 #include "oox/drawingml/drawingmltypes.hxx"
-#ifndef PPTX_EXPORT_ROTATE_CLOCKWISIFY
+#ifndef OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY
 // Our rotation is counter-clockwise and is in 100ths of a degree.
 // drawingML rotation is clockwise and is in 6ths of a degree.
-#define PPTX_EXPORT_ROTATE_CLOCKWISIFY(input) ((2160-input*600)%2160)
+#define OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(input) 
((2160-input*600)%2160)
 #endif
 
 class Graphic;
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 274453e..75b6cfe 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1102,7 +1102,7 @@ void DrawingML::WriteShapeTransformation( Reference< 
XShape > rXShape, sal_Int32
 {
 if (bFlipV) {nRotation=(nRotation+18000)%36000;}
 }
-WriteTransformation( Rectangle( Point( aPos.X, aPos.Y ), Size( 
aSize.Width, aSize.Height ) ), nXmlNamespace, bFlipH, bFlipV, 
PPTX_EXPORT_ROTATE_CLOCKWISIFY(nRotation) );
+WriteTransformation( Rectangle( Point( aPos.X, aPos.Y ), Size( 
aSize.Width, aSize.Height ) ), nXmlNamespace, bFlipH, bFlipV, 
OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRotation) );
 }
 
 void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, bool 
bIsField )
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 879b462..f98c717 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -319,6 +319,12 @@ Reference< XShape > ShapeBase::convertAndInsert( const 
Reference< XShapes >& rxS
 aGrabBag.realloc( length+1 );
 aGrabBag[length].Name = "VML-Z-ORDER";
 aGrabBag[length].Value = uno::makeAny( 
maTypeModel.maZIndex.toInt32() );
+if(!(maTypeModel.maRotation).isEmpty())
+{
+aGrabBag.realloc( length+2 );
+aGrabBag[length+1].Name = "mso-rotation-angle";
+aGrabBag[length+1].Value = 
uno::makeAny(sal_Int32(NormAngle360((maTypeModel.maRotation.toInt32()) * 
-100)));
+}
 propertySet->setPropertyValue( "FrameInteropGrabBag", 
uno::makeAny(aGrabBag) );
 }
 else
diff --git a/sw/qa/extras/ooxmlexport/data/TextFrameRotation.docx 
b/sw/qa/extras/ooxmlexport/data/TextFrameRotation.docx
new file mode 100644
index 000..fde69c5
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/TextFrameRotation.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index a5aa50d..afc8242 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3741,6 +3741,17 @@ DECLARE_OOXMLEXPORT_TEST(testfdo80898, "fdo80898.docx")
 "/word/embeddings/oleObject1.doc");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testFdo80894, "TextFrameRotation.docx")
+{
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+   return;
+
+// Rotation value was not roundtripped for textframe.
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:r[2]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:xfrm",
+"rot","1620");
+}
+
 DECLARE_OOXMLEXPORT_TEST(test2colHeader, "2col-header.docx")
 {
 // Header was lost on export when the document had multiple columns.
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index bb923aa..363b5b9 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexp

[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source writerfilter/source

2014-04-22 Thread umeshkadam
 include/oox/drawingml/shape.hxx   |   16 ++
 oox/source/drawingml/shape.cxx|   19 +++
 oox/source/shape/WpsContext.cxx   |   35 +-
 oox/source/token/tokens.txt   |1 
 sw/qa/extras/ooxmlexport/data/LinkedTextBoxes.docx|binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |   10 +
 sw/source/filter/ww8/docxsdrexport.cxx|   75 +++--
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |  103 +-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |2 
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |3 
 10 files changed, 250 insertions(+), 14 deletions(-)

New commits:
commit 255194801e9eb8e3aaede56837450af35f8313e0
Author: umeshkadam 
Date:   Fri Apr 18 13:12:53 2014 +0530

fod#77122 DOCX filter: link between textboxes is not being preserved

Added support for linked textboxes for docx interoperability.

Reviewed on:
https://gerrit.libreoffice.org/9092

Change-Id: I7db4f5a1783afff53c64908d182788b262f5e863

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index a7232fa..926f223 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -63,6 +63,15 @@ struct ChartShapeInfo
 explicit ChartShapeInfo( bool bEmbedShapes ) : mbEmbedShapes( 
bEmbedShapes ) {}
 };
 
+/// Attributes for a linked textbox.
+struct LinkedTxbxAttr
+{
+sal_Int32 id;
+sal_Int32 seq;
+LinkedTxbxAttr(): id(0),seq(0){};
+~LinkedTxbxAttr(){};
+};
+
 class OOX_DLLPUBLIC Shape
 : public boost::enable_shared_from_this< Shape >
 {
@@ -176,6 +185,11 @@ public:
 voidsetDiagramDoms(const 
com::sun::star::uno::Sequence& 
rDiagramDoms) { maDiagramDoms = rDiagramDoms; }
 com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< 
com::sun::star::uno::Any > >resolveRelationshipsOfTypeFromOfficeDoc(
   
core::XmlFilterBase& rFilter, const OUString& sFragment, const OUString& sType 
);
+voidsetLinkedTxbxAttributes(const LinkedTxbxAttr& rhs){ 
maLinkedTxbxAttr = rhs; };
+voidsetTxbxHasLinkedTxtBox( const bool rhs){ 
mbHasLinkedTxbx = rhs; };
+const LinkedTxbxAttr& getLinkedTxbxAttributes() { return 
maLinkedTxbxAttr; };
+boolisLinkedTxbx() { return mbHasLinkedTxbx; };
+
 protected:
 
 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
@@ -279,6 +293,8 @@ private:
  // to propagate it 
when applying reference shape
 bool mbLockedCanvas; ///< Is this shape part of a locked canvas?
 bool mbWps; ///< Is this a wps shape?
+LinkedTxbxAttr  maLinkedTxbxAttr;
+boolmbHasLinkedTxbx; // this text box has 
linked text box ?
 
 com::sun::star::uno::Sequence 
maDiagramDoms;
 };
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index f7150db..1d0d452 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -139,6 +139,8 @@ Shape::Shape( const ShapePtr& pSourceShape )
 , mbHiddenMasterShape( pSourceShape->mbHiddenMasterShape )
 , mbLockedCanvas( pSourceShape->mbLockedCanvas )
 , mbWps( pSourceShape->mbWps )
+, maLinkedTxbxAttr()
+, mbHasLinkedTxbx(false)
 , maDiagramDoms( pSourceShape->maDiagramDoms )
 {}
 
@@ -677,6 +679,23 @@ Reference< XShape > Shape::createAndInsert(
 aGrabBag[length].Value = 
uno::makeAny(mpCustomShapePropertiesPtr->getShapePresetTypeName());
 
propertySet->setPropertyValue("FrameInteropGrabBag",uno::makeAny(aGrabBag));
 }
+//If the text box has links then save the link information so 
that
+//it can be accessed in DomainMapper_Impl.cxx while chaining 
the text frames.
+if (this->isLinkedTxbx())
+{
+uno::Reference propertySet (mxShape, 
uno::UNO_QUERY);
+uno::Sequence aGrabBag;
+propertySet->getPropertyValue("FrameInteropGrabBag") >>= 
aGrabBag;
+sal_Int32 length = aGrabBag.getLength();
+aGrabBag.realloc( length + 3 );
+aGrabBag[length].Name = "TxbxHasLink";
+aGrabBag[length].Value = 
uno::makeAny(this->isLinkedTxbx());
+aGrabBag[length + 1 ].Name = "Txbx-Id";
+aGrabBag[length + 1 ].Value = 
uno::makeAny(this->getLinkedTxbxAttributes().id);
+aGrabBag[length + 2 ].Name = "Txbx-Seq";
+aGrabBag[length + 2 ].Value = 
uno::makeAny(this->getLinkedTxbxAttributes().seq);
+
propertySet->setPropertyValue("FrameInteropGrabBag",uno::makeAny(aGrabBag));
+

[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source

2014-03-11 Thread Ravindra Vidhate
 include/oox/export/vmlexport.hxx|2 
 oox/source/export/vmlexport.cxx |   27 -
 sw/qa/extras/ooxmlexport/data/pictureWatermark.docx |binary
 sw/qa/extras/ooxmlexport/data/textWatermark.docx|binary
 sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx |   26 
 sw/source/filter/ww8/wrtw8nds.cxx   |   58 +++-
 sw/source/filter/ww8/wrtww8.hxx |2 
 7 files changed, 111 insertions(+), 4 deletions(-)

New commits:
commit ff2f55d6f0a515c8c6e4186e124db28cc4056f5b
Author: Ravindra Vidhate 
Date:   Wed Mar 5 11:38:22 2014 +0530

fdo#35324: Text and picture water are not imported  and not preserved in RT.

Problem : Open docx file which has Text/Picture as water mark.
1. The text is not imported properly also picture water mark is also 
considered as shape.
2. It writes the watermarks in Document.xml, while it should write in only 
Header.xml.

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx

Reviewed on:
https://gerrit.libreoffice.org/8457

Change-Id: Ic988858da25a4cba3ae16e614d920e2e16053a5f

diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx
index 2b414c0..744dbbd 100644
--- a/include/oox/export/vmlexport.hxx
+++ b/include/oox/export/vmlexport.hxx
@@ -90,7 +90,7 @@ public:
 sal_Int16 eVOri = -1, sal_Int16 eHRel = -1,
 sal_Int16 eVRel = -1, const Point* pNdTopLeft = 0, const sal_Bool 
bOOxmlExport = false );
 virtual void  AddSdrObjectVMLObject( const SdrObject& rObj);
-
+static bool IsWaterMarkShape(const OUString& rStr);
 protected:
 /// Add an attribute to the generated  element.
 ///
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 35eeae7..fe82ea0 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -175,7 +175,28 @@ void VMLExport::AddShape( sal_uInt32 nShapeType, 
sal_uInt32 nShapeFlags, sal_uIn
 {
 m_nShapeType = nShapeType;
 m_nShapeFlags = nShapeFlags;
-m_pShapeAttrList->add( XML_id, ShapeIdString( nShapeId ) );
+// If shape is a watermark object - should keep the original shape's name
+// because Microsoft detects if it is a watermark by the actual name
+if (!IsWaterMarkShape(m_pSdrObject->GetName()))
+{
+// Not a watermark object
+m_pShapeAttrList->add( XML_id, ShapeIdString( nShapeId ) );
+}
+else
+{
+// A watermark object - store the optional shape ID also ('o:spid')
+m_pShapeAttrList->add( XML_id, 
OUStringToOString(m_pSdrObject->GetName(), RTL_TEXTENCODING_UTF8) );
+}
+}
+
+bool VMLExport::IsWaterMarkShape(const OUString& rStr)
+{
+ if (rStr.isEmpty() )  return false;
+
+ if (rStr.match(OUString("PowerPlusWaterMarkObject")) || 
rStr.match(OUString("WordPictureWatermark")))
+return true;
+ else
+return false;
 }
 
 static void impl_AddArrowHead( sax_fastparser::FastAttributeList *pAttrList, 
sal_Int32 nElement, sal_uInt32 nValue )
@@ -787,7 +808,9 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, 
const Rectangle& rRect
 aStream.Seek(0);
 OUString idStr = 
SvxMSDffManager::MSDFFReadZString(aStream, it->nPropSize, true);
 aStream.Seek(0);
-m_pShapeAttrList->add(XML_ID, OUStringToOString(idStr, 
RTL_TEXTENCODING_UTF8));
+if (!IsWaterMarkShape(m_pSdrObject->GetName()))
+ m_pShapeAttrList->add(XML_ID, 
OUStringToOString(idStr, RTL_TEXTENCODING_UTF8));
+
 bAlreadyWritten[ESCHER_Prop_wzName] = true;
 }
 break;
diff --git a/sw/qa/extras/ooxmlexport/data/pictureWatermark.docx 
b/sw/qa/extras/ooxmlexport/data/pictureWatermark.docx
new file mode 100644
index 000..b526ecf
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/pictureWatermark.docx differ
diff --git a/sw/qa/extras/ooxmlexport/data/textWatermark.docx 
b/sw/qa/extras/ooxmlexport/data/textWatermark.docx
new file mode 100644
index 000..c8bff75
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/textWatermark.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
index 8842cdd..d46f583 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
@@ -911,6 +911,32 @@ DECLARE_OOXMLEXPORT_TEST(testDkVert, "dkvert.docx")
 CPPUNIT_ASSERT_EQUAL(sal_Int32(25), getProperty(xShape, 
"FillHatch").Distance);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTextWatermark, "textWatermark.docx")
+{
+//The problem was that the watermark ID was not preserved,
+//and Word uses the object ID to identify if it is a watermark.
+//It has to have the 'PowerPlusWaterMarkObject' string in it
+xmlDocPtr pXmlHeader1 = parseExport("word/header1.x

[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source

2014-03-05 Thread Vinaya Mandke
 include/oox/drawingml/shape.hxx |3 
 oox/source/drawingml/diagram/diagram.cxx|   15 
 oox/source/drawingml/diagram/diagram.hxx|4 -
 oox/source/drawingml/shape.cxx  |   40 +++
 oox/source/shape/ShapeContextHandler.cxx|   11 ++-
 sw/qa/extras/ooxmlexport/data/fdo74792.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx|   24 ++
 sw/source/filter/ww8/docxsdrexport.cxx  |  101 ++--
 sw/source/filter/ww8/docxsdrexport.hxx  |5 +
 9 files changed, 193 insertions(+), 10 deletions(-)

New commits:
commit 6536826f2f4c747582d60ed40b0418c6a67a9829
Author: Vinaya Mandke 
Date:   Tue Feb 25 13:13:11 2014 +0530

fdo#74792 [DOCX] Grab-bag rels and images for SmartArt

Added support to grab-bag rels and associated Images for
data[i].xml, and drawing[i].xml.
Added UT for the same

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/8362

Change-Id: I545825f67214f14037ab72b77764a07d575b8b5b

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index fa3f58c..7f3ba65 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -178,7 +178,8 @@ public:
 const com::sun::star::uno::Sequence &
 getDiagramDoms() { return maDiagramDoms; }
 voidsetDiagramDoms(const 
com::sun::star::uno::Sequence& 
rDiagramDoms) { maDiagramDoms = rDiagramDoms; }
-
+com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< 
com::sun::star::uno::Any > >resolveRelationshipsOfType(
+  
core::XmlFilterBase& rFilter, OUString sFragment, OUString sType );
 protected:
 
 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
diff --git a/oox/source/drawingml/diagram/diagram.cxx 
b/oox/source/drawingml/diagram/diagram.cxx
index da439ea..4672a28 100644
--- a/oox/source/drawingml/diagram/diagram.cxx
+++ b/oox/source/drawingml/diagram/diagram.cxx
@@ -338,6 +338,9 @@ uno::Sequence 
Diagram::getDomsAsPropertyValues() const
 {
 sal_Int32 length = maMainDomMap.size();
 
+if ( 0 < maDataRelsMap.getLength() )
+++length;
+
 uno::Sequence aValue(length);
 beans::PropertyValue* pValue = aValue.getArray();
 for (DiagramDomMap::const_iterator i = maMainDomMap.begin();
@@ -349,6 +352,13 @@ uno::Sequence 
Diagram::getDomsAsPropertyValues() const
 ++pValue;
 }
 
+if ( 0 < maDataRelsMap.getLength() )
+{
+pValue[0].Name = OUString("OOXDiagramDataRels");
+pValue[0].Value = uno::makeAny ( maDataRelsMap );
+++pValue;
+}
+
 return aValue;
 }
 
@@ -410,6 +420,11 @@ void loadDiagram( ShapePtr& pShape,
"OOXData",
pDiagram,
xRefDataModel);
+
+pDiagram->getDataRelsMap() = pShape->resolveRelationshipsOfType( 
rFilter, xRefDataModel->getFragmentPath(),
+   
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"; );
+
+
 // Pass the info to pShape
 for( ::std::vector::const_iterator aIt = 
pData->getExtDrawings().begin(), aEnd = pData->getExtDrawings().end();
 aIt != aEnd; ++aIt )
diff --git a/oox/source/drawingml/diagram/diagram.hxx 
b/oox/source/drawingml/diagram/diagram.hxx
index 031c66b..ae611c9 100644
--- a/oox/source/drawingml/diagram/diagram.hxx
+++ b/oox/source/drawingml/diagram/diagram.hxx
@@ -157,6 +157,7 @@ typedef boost::shared_ptr< LayoutNode > LayoutNodePtr;
 
 
 typedef std::map< OUString, uno::Reference > 
DiagramDomMap;
+typedef uno::Sequence< uno::Sequence< uno::Any > > DiagramRelsMap;
 
 
 
@@ -296,7 +297,7 @@ public:
 DiagramColorMap& getColors() { return maColors; }
 const DiagramColorMap& getColors() const { return maColors; }
 DiagramDomMap & getDomMap() { return maMainDomMap; }
-
+DiagramRelsMap & getDataRelsMap() { return maDataRelsMap; }
 void addTo( const ShapePtr & pShape );
 
 uno::Sequence getDomsAsPropertyValues() const;
@@ -308,6 +309,7 @@ private:
 DiagramColorMapmaColors;
 std::map< OUString, ShapePtr > maShapeMap;
 DiagramDomMap  maMainDomMap;
+DiagramRelsMap maDataRelsMap;
 };
 
 
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index ce1d3b6..3a2ebae 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1200,6 +1200,46 @@ void Shape::putPropertiesToGrabBag( const Sequence< 
PropertyValue >& aProperties
 }
 }
 
+uno::Sequence< uno::Sequence< uno::Any > >  
Shape::resolveRelationshipsOfType(core::XmlFilterBase& rFilter, OUString 
sFragment, OUString sType )
+{
+uno::Sequence< uno::Sequence< uno::Any > > xRelListTemp;
+sal_Int32 counter = 0;

[Libreoffice-commits] core.git: include/oox oox/source sw/qa sw/source

2014-01-13 Thread Nikhil Walvekar
 include/oox/drawingml/customshapeproperties.hxx |3 +++
 oox/source/drawingml/customshapeproperties.cxx  |1 +
 oox/source/drawingml/shape.cxx  |   12 
 oox/source/shape/WpsContext.cxx |1 +
 sw/qa/extras/ooxmlexport/data/fdo70942.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx|9 +
 sw/source/filter/ww8/docxattributeoutput.cxx|   23 +++
 7 files changed, 45 insertions(+), 4 deletions(-)

New commits:
commit 3cf58da99ef152db31fa8378045d4bff041f7ff4
Author: Nikhil Walvekar 
Date:   Fri Jan 10 20:21:45 2014 +0530

fdo#70942 Preserve original shape type, if shape contains text.

Currently we change shape type to textframe if a shape contains
text. Due to this shape information is not preserved when file
is saved.

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/7372

Change-Id: I7af3ce29f857d6fa2ceab0350937d91638361e7c

diff --git a/include/oox/drawingml/customshapeproperties.hxx 
b/include/oox/drawingml/customshapeproperties.hxx
index e6df846..fdf8d49 100644
--- a/include/oox/drawingml/customshapeproperties.hxx
+++ b/include/oox/drawingml/customshapeproperties.hxx
@@ -135,6 +135,8 @@ public:
 sal_Int32 getShapePresetType() const { return mnShapePresetType; }
 OUString getShapePresetTypeName() const;
 void setShapePresetType( sal_Int32 nShapePresetType ){ mnShapePresetType = 
nShapePresetType; };
+sal_BoolgetShapeTypeOverride(){ return 
mbShapeTypeOverride; };
+voidsetShapeTypeOverride( sal_Bool 
bShapeTypeOverride ) { mbShapeTypeOverride = bShapeTypeOverride; };
 
 std::vector< CustomShapeGuide >&getAdjustmentGuideList(){ return 
maAdjustmentGuideList; };
 std::vector< CustomShapeGuide >&getGuideList(){ return maGuideList; };
@@ -155,6 +157,7 @@ public:
 private:
 
 sal_Int32   mnShapePresetType;
+sal_BoolmbShapeTypeOverride;
 std::vector< CustomShapeGuide > maAdjustmentGuideList;
 std::vector< CustomShapeGuide > maGuideList;
 std::vector< AdjustHandle > maAdjustHandleList;
diff --git a/oox/source/drawingml/customshapeproperties.cxx 
b/oox/source/drawingml/customshapeproperties.cxx
index 247e8cf..cdc6974 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -44,6 +44,7 @@ namespace oox { namespace drawingml {
 
 CustomShapeProperties::CustomShapeProperties()
 : mnShapePresetType ( -1 )
+, mbShapeTypeOverride(sal_False)
 , mbMirroredX   ( sal_False )
 , mbMirroredY   ( sal_False )
 , mnTextRotateAngle ( 0 )
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 9437f02..eff9ad4 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -621,6 +621,18 @@ Reference< XShape > Shape::createAndInsert(
 {
 if (aServiceName == "com.sun.star.text.TextFrame")
 {
+if (mpCustomShapePropertiesPtr != NULL && 
mpCustomShapePropertiesPtr->getShapeTypeOverride())
+{
+uno::Reference propertySet (mxShape, 
uno::UNO_QUERY);
+uno::Sequence aGrabBag;
+propertySet->getPropertyValue("FrameInteropGrabBag") >>= 
aGrabBag;
+sal_Int32 length = aGrabBag.getLength();
+aGrabBag.realloc( length+1);
+aGrabBag[length].Name = "mso-orig-shape-type";
+aGrabBag[length].Value = 
uno::makeAny(mpCustomShapePropertiesPtr->getShapePresetTypeName());
+
propertySet->setPropertyValue("FrameInteropGrabBag",uno::makeAny(aGrabBag));
+}
+
 // TextFrames have BackColor, not FillColor
 if (aShapeProps.hasProperty(PROP_FillColor))
 {
diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx
index e2bbb0e..04e8a23 100644
--- a/oox/source/shape/WpsContext.cxx
+++ b/oox/source/shape/WpsContext.cxx
@@ -101,6 +101,7 @@ oox::core::ContextHandlerRef 
WpsContext::onCreateContext(sal_Int32 nElementToken
 }
 break;
 case XML_txbx:
+mpShape->getCustomShapeProperties()->setShapeTypeOverride(true);
 mpShape->setServiceName("com.sun.star.text.TextFrame");
 break;
 default:
diff --git a/sw/qa/extras/ooxmlexport/data/fdo70942.docx 
b/sw/qa/extras/ooxmlexport/data/fdo70942.docx
new file mode 100644
index 000..a04a784
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo70942.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index d4f5e3f..95b2cb2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2413,6 +2413,15 @@ DECLARE_OOXML