Kaydet (Commit) cdb764a6 authored tarafından Grzegorz Araminowicz's avatar Grzegorz Araminowicz Kaydeden (comit) Miklos Vajna

PPTX import: save also OOXDrawing in InteropGrabBag

Change-Id: Ieaf341dd13e06046044f3523c3aad74476160402
Reviewed-on: https://gerrit.libreoffice.org/69328
Tested-by: Jenkins
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/72473
üst f8586c22
...@@ -225,6 +225,8 @@ public: ...@@ -225,6 +225,8 @@ public:
/// Changes reference semantics to value semantics for fill properties. /// Changes reference semantics to value semantics for fill properties.
void cloneFillProperties(); void cloneFillProperties();
void keepDiagramDrawing(::oox::core::XmlFilterBase& rFilterBase, const OUString& rFragmentPath);
protected: protected:
enum FrameType enum FrameType
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
#include <com/sun/star/beans/XMultiPropertySet.hpp> #include <com/sun/star/beans/XMultiPropertySet.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/xml/AttributeData.hpp> #include <com/sun/star/xml/AttributeData.hpp>
#include <com/sun/star/xml/dom/XDocument.hpp>
#include <com/sun/star/xml/sax/XFastSAXSerializable.hpp> #include <com/sun/star/xml/sax/XFastSAXSerializable.hpp>
#include <com/sun/star/drawing/HomogenMatrix3.hpp> #include <com/sun/star/drawing/HomogenMatrix3.hpp>
#include <com/sun/star/drawing/TextVerticalAdjust.hpp> #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
...@@ -1394,6 +1395,22 @@ Reference< XShape > const & Shape::createAndInsert( ...@@ -1394,6 +1395,22 @@ Reference< XShape > const & Shape::createAndInsert(
return mxShape; return mxShape;
} }
void Shape::keepDiagramDrawing(XmlFilterBase& rFilterBase, const OUString& rFragmentPath)
{
uno::Sequence<uno::Any> diagramDrawing(2);
// drawingValue[0] => dom, drawingValue[1] => Sequence of associated relationships
sal_Int32 length = maDiagramDoms.getLength();
maDiagramDoms.realloc(length + 1);
diagramDrawing[0] <<= rFilterBase.importFragment(rFragmentPath);
diagramDrawing[1] <<= resolveRelationshipsOfTypeFromOfficeDoc(rFilterBase, rFragmentPath, "image");
beans::PropertyValue* pValue = maDiagramDoms.getArray();
pValue[length].Name = "OOXDrawing";
pValue[length].Value <<= diagramDrawing;
}
void Shape::keepDiagramCompatibilityInfo() void Shape::keepDiagramCompatibilityInfo()
{ {
try try
......
...@@ -149,11 +149,14 @@ void PPTShapeGroupContext::importExtDrawings( ) ...@@ -149,11 +149,14 @@ void PPTShapeGroupContext::importExtDrawings( )
{ {
for (auto const& extDrawing : pGraphicShape->getExtDrawings()) for (auto const& extDrawing : pGraphicShape->getExtDrawings())
{ {
getFilter().importFragment( new ExtDrawingFragmentHandler( getFilter(), getFragmentPathFromRelId(extDrawing), OUString aFragmentPath = getFragmentPathFromRelId(extDrawing);
getFilter().importFragment( new ExtDrawingFragmentHandler( getFilter(), aFragmentPath,
mpSlidePersistPtr, mpSlidePersistPtr,
meShapeLocation, meShapeLocation,
mpGroupShapePtr, mpGroupShapePtr,
pGraphicShape ) ); pGraphicShape ) );
pGraphicShape->keepDiagramDrawing(getFilter(), aFragmentPath);
// Apply font color imported from color fragment // Apply font color imported from color fragment
if( pGraphicShape->getFontRefColorForNodes().isUsed() ) if( pGraphicShape->getFontRefColorForNodes().isUsed() )
applyFontRefColor(mpGroupShapePtr, pGraphicShape->getFontRefColorForNodes()); applyFontRefColor(mpGroupShapePtr, pGraphicShape->getFontRefColorForNodes());
......
...@@ -425,23 +425,8 @@ ShapeContextHandler::getShape() ...@@ -425,23 +425,8 @@ ShapeContextHandler::getShape()
oox::drawingml::ShapePtr pShapePtr( new Shape( "com.sun.star.drawing.GroupShape" ) ); oox::drawingml::ShapePtr pShapePtr( new Shape( "com.sun.star.drawing.GroupShape" ) );
pShapePtr->setDiagramType(); pShapePtr->setDiagramType();
mxFilterBase->importFragment(new ShapeDrawingFragmentHandler(*mxFilterBase, aFragmentPath, pShapePtr)); mxFilterBase->importFragment(new ShapeDrawingFragmentHandler(*mxFilterBase, aFragmentPath, pShapePtr));
pShapePtr->setDiagramDoms(mpShape->getDiagramDoms());
uno::Sequence<beans::PropertyValue> aValue(mpShape->getDiagramDoms()); pShapePtr->keepDiagramDrawing(*mxFilterBase, aFragmentPath);
uno::Sequence < uno::Any > diagramDrawing(2);
// drawingValue[0] => dom, drawingValue[1] => Sequence of associated relationships
sal_Int32 length = aValue.getLength();
aValue.realloc(length+1);
diagramDrawing[0] <<= mxFilterBase->importFragment( aFragmentPath );
diagramDrawing[1] <<= pShapePtr->resolveRelationshipsOfTypeFromOfficeDoc(
*mxFilterBase, aFragmentPath, "image" );
beans::PropertyValue* pValue = aValue.getArray();
pValue[length].Name = "OOXDrawing";
pValue[length].Value <<= diagramDrawing;
pShapePtr->setDiagramDoms( aValue );
pShapePtr->addShape( *mxFilterBase, mpThemePtr.get(), xShapes, aMatrix, pShapePtr->getFillProperties() ); pShapePtr->addShape( *mxFilterBase, mpThemePtr.get(), xShapes, aMatrix, pShapePtr->getFillProperties() );
xResult = pShapePtr->getXShape(); xResult = pShapePtr->getXShape();
......
...@@ -916,6 +916,7 @@ void SdImportTestSmartArt::testInteropGrabBag() ...@@ -916,6 +916,7 @@ void SdImportTestSmartArt::testInteropGrabBag()
CPPUNIT_ASSERT(aGrabBag.find("OOXLayout") != aGrabBag.end()); CPPUNIT_ASSERT(aGrabBag.find("OOXLayout") != aGrabBag.end());
CPPUNIT_ASSERT(aGrabBag.find("OOXStyle") != aGrabBag.end()); CPPUNIT_ASSERT(aGrabBag.find("OOXStyle") != aGrabBag.end());
CPPUNIT_ASSERT(aGrabBag.find("OOXColor") != aGrabBag.end()); CPPUNIT_ASSERT(aGrabBag.find("OOXColor") != aGrabBag.end());
CPPUNIT_ASSERT(aGrabBag.find("OOXDrawing") != aGrabBag.end());
xDocShRef->DoClose(); xDocShRef->DoClose();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment