summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/oox/vml/vmlshape.hxx2
-rw-r--r--oox/source/token/properties.txt1
-rw-r--r--oox/source/vml/vmlshape.cxx20
-rw-r--r--oox/source/vml/vmlshapecontext.cxx2
-rw-r--r--sw/qa/extras/ooxmlimport/data/n592908-frame.docxbin0 -> 13589 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/data/n592908-picture.docxbin0 -> 62593 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx24
-rw-r--r--writerfilter/source/dmapper/OLEHandler.cxx12
-rw-r--r--writerfilter/source/ooxml/OOXMLFastContextHandler.cxx8
-rw-r--r--writerfilter/source/ooxml/OOXMLFastContextHandler.hxx2
10 files changed, 56 insertions, 15 deletions
diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx
index 7b6a4a9376c7..e16fe90635c8 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
explicit ShapeTypeModel();
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 243058010841..fb3e5a5e4529 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 3239151aa0f0..0af325d52233 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 c5edd00e65ac..e0f8cfb659a7 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 | XML_wrap:
mrTypeModel.moWrapAnchorX = rAttribs.getString(XML_anchorx);
mrTypeModel.moWrapAnchorY = rAttribs.getString(XML_anchory);
+ mrTypeModel.moWrapType = rAttribs.getString(XML_type);
+ mrTypeModel.moWrapSide = rAttribs.getString(XML_side);
break;
case VML_TOKEN( shadow ):
{
diff --git a/sw/qa/extras/ooxmlimport/data/n592908-frame.docx b/sw/qa/extras/ooxmlimport/data/n592908-frame.docx
new file mode 100644
index 000000000000..ff59cacbad79
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/n592908-frame.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/data/n592908-picture.docx b/sw/qa/extras/ooxmlimport/data/n592908-picture.docx
new file mode 100644
index 000000000000..2766d3691cdd
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/n592908-picture.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 25e44951faf3..423900f70d33 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -107,6 +107,8 @@ public:
void testTableWidth();
void testConditionalstylesTbllook();
void testFdo63685();
+ void testN592908_Frame();
+ void testN592908_Picture();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -184,6 +186,8 @@ void Test::run()
{"table_width.docx", &Test::testTableWidth},
{"conditionalstyles-tbllook.docx", &Test::testConditionalstylesTbllook},
{"fdo63685.docx", &Test::testFdo63685},
+ {"n592908-frame.docx", &Test::testN592908_Frame},
+ {"n592908-picture.docx", &Test::testN592908_Picture},
};
header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1315,6 +1319,26 @@ void Test::testFdo63685()
CPPUNIT_ASSERT_EQUAL(sal_Int32(318), getProperty<sal_Int32>(xDraws->getByIndex(0), "TopMargin"));
}
+void Test::testN592908_Frame()
+{
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY);
+ text::WrapTextMode eValue;
+ xPropertySet->getPropertyValue("Surround") >>= eValue;
+ CPPUNIT_ASSERT_EQUAL(eValue, text::WrapTextMode_PARALLEL);
+}
+
+void Test::testN592908_Picture()
+{
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY);
+ text::WrapTextMode eValue;
+ xPropertySet->getPropertyValue("Surround") >>= eValue;
+ CPPUNIT_ASSERT_EQUAL(eValue, text::WrapTextMode_PARALLEL);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/OLEHandler.cxx b/writerfilter/source/dmapper/OLEHandler.cxx
index ae4490f30cc3..e2a333535ecb 100644
--- a/writerfilter/source/dmapper/OLEHandler.cxx
+++ b/writerfilter/source/dmapper/OLEHandler.cxx
@@ -113,17 +113,7 @@ void OLEHandler::lcl_attribute(Id rName, Value & rVal)
{
SAL_WARN("writerfilter", "Exception in OLE Handler: " << e.Message);
}
-
- try
- {
- xShapeProps->setPropertyValue(
- rNameSupplier.GetName( PROP_SURROUND ),
- uno::makeAny( m_nWrapMode ) );
- }
- catch( const uno::Exception& e )
- {
- SAL_WARN("writerfilter", "Exception while setting wrap mode: " << e.Message);
- }
+ // No need to set the wrapping here as it's either set in oox or will be set later
}
}
break;
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 8c02cca4bcbc..f4a7924432ea 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -2283,11 +2283,14 @@ OOXMLFastContextHandlerWrapper::lcl_createFastChildContext
bool bInNamespaces = mMyNamespaces.find(nNameSpace) != mMyNamespaces.end();
bool bInTokens = mMyTokens.find( Element ) != mMyTokens.end( );
+ OOXMLFastContextHandlerShape* pShapeCtx = (OOXMLFastContextHandlerShape*)mpParent;
+
// We have methods to _add_ individual tokens or whole namespaces to be
// processed by writerfilter (instead of oox), but we have no method to
// filter out a single token. Just hardwire the wrap token here till we
// need a more generic solution.
- if ( bInNamespaces && Element != static_cast<sal_Int32>(NS_vml_wordprocessingDrawing | OOXML_wrap) )
+ bool bIsWrap = Element == static_cast<sal_Int32>(NS_vml_wordprocessingDrawing | OOXML_wrap);
+ if ( bInNamespaces && ((pShapeCtx->isShapeSent() && bIsWrap) || !bIsWrap) )
xResult.set(OOXMLFactory::getInstance()->createFastChildContextFromStart(this, Element));
else if (mxContext.is())
{
@@ -2302,10 +2305,7 @@ OOXMLFastContextHandlerWrapper::lcl_createFastChildContext
xResult.set(this);
if ( bInTokens )
- {
- OOXMLFastContextHandlerShape* pShapeCtx = (OOXMLFastContextHandlerShape*)mpParent;
pShapeCtx->sendShape( Element );
- }
return xResult;
}
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
index b47f611046a8..b1941b65c179 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
@@ -531,6 +531,7 @@ public:
virtual ResourceEnum_t getResource() const { return SHAPE; }
void sendShape( Token_t Element );
+ bool isShapeSent( ) { return m_bShapeSent; }
protected:
typedef uno::Reference<XFastShapeContextHandler> ShapeContextRef;
@@ -633,6 +634,7 @@ private:
set<Id> mMyNamespaces;
set<Token_t> mMyTokens;
OOXMLPropertySet::Pointer_t mpPropertySet;
+ bool mbShapeSent;
OOXMLFastContextHandler * getFastContextHandler() const;
};