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

2022-02-03 Thread Attila Bakos (NISZ) (via logerrit)
 include/oox/shape/ShapeContextHandler.hxx |   18 +++---
 oox/source/shape/ShapeContextHandler.cxx  |   31 +++---
 sw/qa/extras/ooxmlexport/data/tdf146802.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx|   13 +++
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |5 +-
 5 files changed, 48 insertions(+), 19 deletions(-)

New commits:
commit 4a38ca4035ac03571925e72cb47e0beb8da2003a
Author: Attila Bakos (NISZ) 
AuthorDate: Wed Jan 19 17:43:54 2022 +0100
Commit: László Németh 
CommitDate: Thu Feb 3 09:12:20 2022 +0100

tdf#146802 OOXML import: fix embedded VML in grouped textbox

E.g. OLE formulas inside them broke document load.

Regression from 121cbc250b36290f0f8c7265fea57256dad69553
"tdf#66039 DOCX: import textboxes (with tables, images etc.)
in group shapes".

Note: now embedded VML OLE is loaded in WPG shapes, thanks to
that the ShapeHandler in oox/ has a stack having the start
token inside for each shape.

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

diff --git a/include/oox/shape/ShapeContextHandler.hxx 
b/include/oox/shape/ShapeContextHandler.hxx
index 27b70d2cf2c4..a245224730ed 100644
--- a/include/oox/shape/ShapeContextHandler.hxx
+++ b/include/oox/shape/ShapeContextHandler.hxx
@@ -19,6 +19,7 @@
 #pragma once
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -90,12 +91,15 @@ public:
 void setRelationFragmentPath(const OUString & the_value);
 
 sal_Int32 getStartToken() const;
-void setStartToken( sal_Int32 _starttoken );
+void popStartToken();
+void pushStartToken( sal_Int32 _starttoken );
 
 void setPosition(const css::awt::Point& rPosition);
 
-const bool& getFullWPGSupport() { return m_bFullWPGSUpport; };
-void setFullWPGSupport(const bool& rbUse) { m_bFullWPGSUpport = rbUse; };
+const bool& getFullWPGSupport() { return m_bFullWPGSUpport; }
+void setFullWPGSupport(const bool& rbUse) { m_bFullWPGSUpport = rbUse; }
+
+bool isWordProcessingGroupShape() const { return mxWpgContext ? true : 
false; }
 
 void setDocumentProperties(const 
css::uno::Reference& xDocProps);
 void setMediaDescriptor(const 
css::uno::Sequence& rMediaDescriptor);
@@ -109,9 +113,13 @@ private:
 ShapeContextHandler(ShapeContextHandler const &) = delete;
 void operator =(ShapeContextHandler const &) = delete;
 
-::sal_uInt32 mnStartToken;
+// Special stack which always has at least one element.
+// In case of group shapes with embedded content it will have more element 
than one.
+std::stack mnStartTokenStack;
+
 css::awt::Point maPosition;
-bool m_bFullWPGSUpport;
+bool m_bFullWPGSUpport; // Is this DrawingML shape supposed to be 
proccessed as WPG?
+
 drawingml::ShapePtr mpShape;
 std::shared_ptr< vml::Drawing > mpDrawing;
 
diff --git a/oox/source/shape/ShapeContextHandler.cxx 
b/oox/source/shape/ShapeContextHandler.cxx
index 6eb9e5ce9083..cacd46d82d14 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -44,7 +44,6 @@ using namespace core;
 using namespace drawingml;
 
 ShapeContextHandler::ShapeContextHandler(const 
rtl::Reference& xFilterBase) :
-  mnStartToken(0),
   m_bFullWPGSUpport(false),
   mxShapeFilterBase(xFilterBase)
 
@@ -225,8 +224,9 @@ uno::Reference
 ShapeContextHandler::getContextHandler(sal_Int32 nElement)
 {
 uno::Reference xResult;
+const sal_uInt32 nStartToken = getStartToken();
 
-switch (getNamespace( mnStartToken ))
+switch (getNamespace( nStartToken ))
 {
 case NMSP_doc:
 case NMSP_vml:
@@ -236,19 +236,19 @@ ShapeContextHandler::getContextHandler(sal_Int32 nElement)
 xResult.set(getDiagramShapeContext());
 break;
 case NMSP_dmlLockedCanvas:
-xResult.set(getLockedCanvasContext(mnStartToken));
+xResult.set(getLockedCanvasContext(nStartToken));
 break;
 case NMSP_dmlChart:
-xResult.set(getChartShapeContext(mnStartToken));
+xResult.set(getChartShapeContext(nStartToken));
 break;
 case NMSP_wps:
-xResult.set(getWpsContext(mnStartToken, nElement));
+xResult.set(getWpsContext(nStartToken, nElement));
 break;
 case NMSP_wpg:
-xResult.set(getWpgContext(mnStartToken));
+xResult.set(getWpgContext(nStartToken));
 break;
 default:
-xResult.set(getGraphicShapeContext(mnStartToken));
+xResult.set(getGraphicShapeContext(nStartToken));
 break;
 }
 
@@ -456,7 +456,7 @@ ShapeContextHandler::getShape()
 //NMSP_dmlChart == getNamespace( mnStartToken ) check is introduced to 
make sure that
 

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

2022-01-03 Thread Attila Bakos (NISZ) (via logerrit)
 include/oox/shape/ShapeContextHandler.hxx |5 +-
 oox/source/drawingml/shape.cxx|2 
 oox/source/shape/ShapeContextHandler.cxx  |8 ++-
 oox/source/shape/WpgContext.cxx   |   45 +-
 oox/source/shape/WpgContext.hxx   |8 ++-
 sw/qa/extras/ooxmlexport/data/testWPGtextboxes.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx|   21 
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx |7 +-
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx |2 
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx |4 -
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx |7 +-
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx |7 ++
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |4 +
 13 files changed, 92 insertions(+), 28 deletions(-)

New commits:
commit 2951cbdf3a6e2b62461665546b47e1d253fcb834
Author: Attila Bakos (NISZ) 
AuthorDate: Wed Nov 10 14:10:11 2021 +0100
Commit: László Németh 
CommitDate: Mon Jan 3 14:28:15 2022 +0100

tdf#143574 OOXML export/import of textboxes in group shapes

In this part, oox module has been modified in order to prepare
for WPG handling during OOXML import. Note: Wpg is the drawingML
equivalent of v:group, supporting text boxes in the group.

1) Added new parameter for WpgContext to support nested
Wpg shapes, and WPS enabled for the WPG member shapes.

2) A bug has fixed, where group member line shape and
connector shapes have wrong positions before in the group.

3) Unit tests had to be modified, and 3 of them disabled
temporarily due to missing Writerfilter implementation (what
will be the next commit)

Now group shapes can have textboxes and the text is imported
for that, but complex content is still missing (this will be
fixed in writerfilter by the next commit).

Known issue: WPG shapes with textboxes in floating table
have issues during import at floating table conversion, so until
this is not fixed this function is disabled for shapes in tables
(will be fixed a follow-up commit later).

Follow-up to commit 19394a924fdc486202ca27e318385287eb0df26f
"tdf#143574 sw: textboxes in group shapes -- part 4".

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

diff --git a/include/oox/shape/ShapeContextHandler.hxx 
b/include/oox/shape/ShapeContextHandler.hxx
index 934ea374fd7c..27b70d2cf2c4 100644
--- a/include/oox/shape/ShapeContextHandler.hxx
+++ b/include/oox/shape/ShapeContextHandler.hxx
@@ -94,6 +94,9 @@ public:
 
 void setPosition(const css::awt::Point& rPosition);
 
+const bool& getFullWPGSupport() { return m_bFullWPGSUpport; };
+void setFullWPGSupport(const bool& rbUse) { m_bFullWPGSUpport = rbUse; };
+
 void setDocumentProperties(const 
css::uno::Reference& xDocProps);
 void setMediaDescriptor(const 
css::uno::Sequence& rMediaDescriptor);
 
@@ -108,7 +111,7 @@ private:
 
 ::sal_uInt32 mnStartToken;
 css::awt::Point maPosition;
-
+bool m_bFullWPGSUpport;
 drawingml::ShapePtr mpShape;
 std::shared_ptr< vml::Drawing > mpDrawing;
 
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 78a27f8a0c9c..fd9eb691b2e8 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1531,7 +1531,7 @@ Reference< XShape > const & Shape::createAndInsert(
 // These can have a custom geometry, so position should be set here,
 // after creation but before custom shape handling, using the position
 // we got from the caller.
-if (mbWps && aServiceName == "com.sun.star.drawing.LineShape")
+if (mbWps && aServiceName == "com.sun.star.drawing.LineShape" && 
!pParentGroupShape)
 mxShape->setPosition(maPosition);
 
 if( bIsCustomShape )
diff --git a/oox/source/shape/ShapeContextHandler.cxx 
b/oox/source/shape/ShapeContextHandler.cxx
index 5404cc82fe81..3454c0e03f87 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -47,7 +47,9 @@ using namespace drawingml;
 
 ShapeContextHandler::ShapeContextHandler(const 
rtl::Reference& xFilterBase) :
   mnStartToken(0),
+  m_bFullWPGSUpport(false),
   mxShapeFilterBase(xFilterBase)
+
 {
 }
 
@@ -139,8 +141,12 @@ uno::Reference const & 
ShapeContextHandler::getWp
 switch (getBaseToken(nElement))
 {
 case XML_wgp:
-mxWpgContext.set(static_cast(new 
WpgContext(*rFragmentHandler)));
+{
+rtl::Reference rContext = new 
WpgContext(*rFragmentHandler, oox::drawingml::ShapePtr());
+rContext->setFullWPGSupport(m_bFullWPGSUpport);
+

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

2014-04-08 Thread Sourav
 include/oox/vml/vmlshape.hxx  |1 +
 oox/source/vml/vmlshape.cxx   |   14 ++
 oox/source/vml/vmlshapecontext.cxx|1 +
 sw/qa/extras/ooxmlexport/data/fdo76591.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |8 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   17 -
 6 files changed, 40 insertions(+), 1 deletion(-)

New commits:
commit 69eebf8735973a05c931182d2ebfe35ce25f4b1a
Author: Sourav sourav.maha...@synerzip.com
Date:   Fri Apr 4 18:06:44 2014 +0530

fdo76591:-Textbox property (order- send behind text) is not preserved.

Z-Index was not handledin LO for vml.
I have made the changes to handle that using aGrabBag.

Change-Id: I2af3b2974c8eb699bc6a7b743dc438584d6517ac
Reviewed-on: https://gerrit.libreoffice.org/8833
Reviewed-by: Miklos Vajna vmik...@collabora.co.uk
Tested-by: Miklos Vajna vmik...@collabora.co.uk

diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx
index d38c58f..832d3be 100644
--- a/include/oox/vml/vmlshape.hxx
+++ b/include/oox/vml/vmlshape.hxx
@@ -64,6 +64,7 @@ struct OOX_DLLPUBLIC ShapeTypeModel
 OptValue Int32Pair  moCoordPos;   /// Top-left position of 
coordinate system for children scaling.
 OptValue Int32Pair  moCoordSize;  /// Size of coordinate system 
for children scaling.
 OUString maPosition; /// Position type of the shape.
+OUString maZIndex;/// ZIndex of the shape
 OUString maLeft; /// X position of the shape bounding 
box (number with unit).
 OUString maTop;  /// Y position of the shape bounding 
box (number with unit).
 OUString maWidth;/// Width of the shape bounding box 
(number with unit).
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index e79c9b8..d4bdbcf 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -41,6 +41,7 @@
 #include com/sun/star/text/XTextContent.hpp
 #include com/sun/star/text/XTextDocument.hpp
 #include com/sun/star/text/XTextFrame.hpp
+ #include com/sun/star/lang/XServiceInfo.hpp
 #include com/sun/star/text/TextContentAnchorType.hpp
 #include rtl/math.hxx
 #include rtl/ustrbuf.hxx
@@ -322,6 +323,19 @@ Reference XShape  ShapeBase::convertAndInsert( const 
Reference XShapes  rxS
 PropertySet aShapeProp( xShape );
 if( aShapeProp.hasProperty( PROP_Name ) )
 aShapeProp.setProperty( PROP_Name, getShapeName() );
+uno::Reference lang::XServiceInfo  xSInfo( xShape, 
uno::UNO_QUERY_THROW );
+if (xSInfo-supportsService(com.sun.star.text.TextFrame))
+{
+uno::Sequencebeans::PropertyValue aGrabBag;
+uno::Referencebeans::XPropertySet propertySet (xShape, 
uno::UNO_QUERY);
+propertySet-getPropertyValue(FrameInteropGrabBag) = 
aGrabBag;
+sal_Int32 length = aGrabBag.getLength();
+
+aGrabBag.realloc( length+1 );
+aGrabBag[length].Name = VML-Z-ORDER;
+aGrabBag[length].Value = uno::makeAny( 
maTypeModel.maZIndex.toInt32() );
+propertySet-setPropertyValue( FrameInteropGrabBag, 
uno::makeAny(aGrabBag) );
+}
 Reference XControlShape  xControlShape( xShape, 
uno::UNO_QUERY );
 if ( xControlShape.is()  !getTypeModel().mbVisible )
 {
diff --git a/oox/source/vml/vmlshapecontext.cxx 
b/oox/source/vml/vmlshapecontext.cxx
index fdeca32..146940e 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -399,6 +399,7 @@ void ShapeTypeContext::setStyle( const OUString rStyle )
 if( ConversionHelper::separatePair( aName, aValue, rStyle.getToken( 0, 
';', nIndex ), ':' ) )
 {
  if( aName == position )  mrTypeModel.maPosition = 
aValue;
+else if( aName == z-index )mrTypeModel.maZIndex = aValue;
 else if( aName == left )   mrTypeModel.maLeft = aValue;
 else if( aName == top )mrTypeModel.maTop = aValue;
 else if( aName == width )  mrTypeModel.maWidth = aValue;
diff --git a/sw/qa/extras/ooxmlexport/data/fdo76591.docx 
b/sw/qa/extras/ooxmlexport/data/fdo76591.docx
new file mode 100644
index 000..8ca4387
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo76591.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 68ef7ebb..aa48fda 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2989,6 +2989,14 @@ DECLARE_OOXMLEXPORT_TEST(testFDO76163 , fdo76163.docx)
 assertXPath ( pXmlDoc, 

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

2013-04-30 Thread Cédric Bosdonnat
 include/oox/vml/vmlshape.hxx  |2 +
 oox/source/token/properties.txt   |1 
 oox/source/vml/vmlshape.cxx   |   20 +++
 oox/source/vml/vmlshapecontext.cxx|2 +
 sw/qa/extras/ooxmlimport/data/n592908-frame.docx  |binary
 sw/qa/extras/ooxmlimport/data/n592908-picture.docx|binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx  |   24 ++
 writerfilter/source/dmapper/OLEHandler.cxx|   12 -
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |8 +++---
 writerfilter/source/ooxml/OOXMLFastContextHandler.hxx |2 +
 10 files changed, 56 insertions(+), 15 deletions(-)

New commits:
commit b399c1a38cf7217bf530af3a78e8472d97890ac8
Author: Cédric Bosdonnat cedric.bosdon...@free.fr
Date:   Mon Apr 29 15:41:37 2013 +0200

n#592908: docx import, fixed handling of w10:wrap

commit f837c4288cdae4921b3fb6747ba2e2cd5ce2dcd2 moved the handling of
w10:wrap tag in oox, but thus no wrapping was imported any more.

The fix consists in letting the w10:wrap element be handled by 
writerfilter's
dmapper if the shape has already been retrieved from oox (which is the
case for textboxes). In other cases, make sure that we don't set the
Surround property once again in writerfilter as that would override what
has been done in oox.

(cherry picked from commit 51d5e90b7c09cb980bc72a2c6b1a65303ef15ea2)

Conflicts:
oox/inc/oox/vml/vmlshape.hxx
sw/qa/extras/ooxmlimport/ooxmlimport.cxx

Change-Id: I8ab158641afcf6b9945c52238e7f5adb9e8b3adf

diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx
index 7b6a4a9..e16fe90 100644
--- a/include/oox/vml/vmlshape.hxx
+++ b/include/oox/vml/vmlshape.hxx
@@ -93,6 +93,8 @@ struct OOX_DLLPUBLIC ShapeTypeModel
 OptValue OUString  moGraphicTitle; /// Title of the graphic.
 OptValue OUString  moWrapAnchorX;  /// The base object from which our 
horizontal positioning should be calculated.
 OptValue OUString  moWrapAnchorY;  /// The base object from which our 
vertical positioning should be calculated.
+OptValue ::rtl::OUString  moWrapType; /// How to wrap the text 
around the object
+OptValue ::rtl::OUString  moWrapSide; /// On which side to wrap the 
text around the object
 
 explicitShapeTypeModel();
 
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 2430580..fb3e5a5 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -465,6 +465,7 @@ StringItemList
 Subtotals
 SubViewSize
 Suffix
+Surround
 SwapXAndYAxis
 Symbol
 SymbolColor
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 3239151..0af325d 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -36,6 +36,7 @@
 #include com/sun/star/text/RelOrientation.hpp
 #include com/sun/star/text/SizeType.hpp
 #include com/sun/star/text/VertOrientation.hpp
+#include com/sun/star/text/WrapTextMode.hpp
 #include com/sun/star/text/XTextContent.hpp
 #include com/sun/star/text/XTextDocument.hpp
 #include com/sun/star/text/XTextFrame.hpp
@@ -405,6 +406,24 @@ SimpleShape::SimpleShape( Drawing rDrawing, const 
OUString rService ) :
 {
 }
 
+void lcl_setSurround(PropertySet rPropSet, const ShapeTypeModel rTypeModel)
+{
+sal_Int32 nSurround = com::sun::star::text::WrapTextMode_THROUGHT;
+if ( rTypeModel.moWrapType.get() == square || rTypeModel.moWrapType 
.get()== tight ||
+ rTypeModel.moWrapType.get() == through )
+{
+nSurround = com::sun::star::text::WrapTextMode_PARALLEL;
+if ( rTypeModel.moWrapSide.get() == left )
+nSurround = com::sun::star::text::WrapTextMode_LEFT;
+else if ( rTypeModel.moWrapSide.get() == right )
+nSurround = com::sun::star::text::WrapTextMode_RIGHT;
+}
+else if ( rTypeModel.moWrapType.get() == topAndBottom )
+nSurround = com::sun::star::text::WrapTextMode_NONE;
+
+rPropSet.setProperty(PROP_Surround, nSurround);
+}
+
 void lcl_SetAnchorType(PropertySet rPropSet, const ShapeTypeModel rTypeModel)
 {
 if ( rTypeModel.maPositionHorizontal == center )
@@ -449,6 +468,7 @@ void lcl_SetAnchorType(PropertySet rPropSet, const 
ShapeTypeModel rTypeModel)
 {
 rPropSet.setProperty(PROP_AnchorType, 
text::TextContentAnchorType_AS_CHARACTER);
 }
+lcl_setSurround( rPropSet, rTypeModel );
 }
 
 Reference XShape  SimpleShape::implConvertAndInsert( const Reference 
XShapes  rxShapes, const awt::Rectangle rShapeRect ) const
diff --git a/oox/source/vml/vmlshapecontext.cxx 
b/oox/source/vml/vmlshapecontext.cxx
index c5edd00..e0f8cfb 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -360,6 +360,8 @@ ContextHandlerRef ShapeTypeContext::onCreateContext( 
sal_Int32 nElement, const A
 case NMSP_vmlWord