incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1220836 [4/4] - in /incubator/ooo/trunk: ./ main/ main/basegfx/inc/basegfx/color/ main/basegfx/inc/basegfx/matrix/ main/basegfx/inc/basegfx/polygon/ main/basegfx/source/color/ main/basegfx/source/polygon/ main/cppcanvas/source/mtfrenderer/...
Date Mon, 19 Dec 2011 16:41:25 GMT
Modified: incubator/ooo/trunk/main/vcl/source/gdi/metaact.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/metaact.cxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/metaact.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/metaact.cxx Mon Dec 19 16:41:21 2011
@@ -34,7 +34,8 @@
 #include <vcl/salbtype.hxx>
 #include <vcl/metaact.hxx>
 #include <vcl/graphictools.hxx>
-#include <vcl/rendergraphicrasterizer.hxx>
+//#include <svgio/svgreader/svgreader.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
 
 // ========================================================================
 
@@ -232,7 +233,6 @@ MetaAction* MetaAction::ReadMetaAction( 
 		case( META_COMMENT_ACTION ): pAction = new MetaCommentAction; break;
 		case( META_LAYOUTMODE_ACTION ): pAction = new MetaLayoutModeAction; break;
 		case( META_TEXTLANGUAGE_ACTION ): pAction = new MetaTextLanguageAction; break;
-        case( META_RENDERGRAPHIC_ACTION	): pAction = new MetaRenderGraphicAction; break;
 
 		default:
 		{
@@ -2025,7 +2025,7 @@ void MetaBmpExAction::Execute( OutputDev
 
 MetaAction* MetaBmpExAction::Clone()
 {
-	MetaAction* pClone = (MetaAction*) new MetaBmpExAction( *this );
+	MetaBmpExAction* pClone = new MetaBmpExAction( *this );
 	pClone->ResetRefCount();
 	return pClone;
 }
@@ -4297,82 +4297,4 @@ void MetaTextLanguageAction::Read( SvStr
 	rIStm >> meTextLanguage;
 }
 
-// ========================================================================
-
-IMPL_META_ACTION( RenderGraphic, META_RENDERGRAPHIC_ACTION )
-
-// ------------------------------------------------------------------------
-
-MetaRenderGraphicAction::MetaRenderGraphicAction( const Point& rPoint, const Size&
rSize,
-                                                  const vcl::RenderGraphic& rRenderGraphic,
-                                                  double fRotateAngle, double fShearAngleX,
double fShearAngleY ) :
-	MetaAction( META_RENDERGRAPHIC_ACTION ),
-	maRenderGraphic( rRenderGraphic ),
-	maPoint( rPoint ),
-	maSize( rSize ),
-	mfRotateAngle( fRotateAngle ),
-	mfShearAngleX( fShearAngleX ),
-	mfShearAngleY( fShearAngleY )
-{
-}
-
-// ------------------------------------------------------------------------
-
-void MetaRenderGraphicAction::Execute( OutputDevice* pOut )
-{
-	pOut->DrawRenderGraphic( maPoint, maSize, maRenderGraphic );
-}
-
-// ------------------------------------------------------------------------
-
-MetaAction* MetaRenderGraphicAction::Clone()
-{
-	MetaAction* pClone = (MetaAction*) new MetaRenderGraphicAction( *this );
-	pClone->ResetRefCount();
-	return pClone;
-}
-
-// ------------------------------------------------------------------------
-
-void MetaRenderGraphicAction::Move( long nHorzMove, long nVertMove )
-{
-	maPoint.Move( nHorzMove, nVertMove );
-}
-
-// ------------------------------------------------------------------------
-
-void MetaRenderGraphicAction::Scale( double fScaleX, double fScaleY )
-{
-    Rectangle aRectangle( maPoint, maSize );
-	ImplScaleRect( aRectangle, fScaleX, fScaleY );
-    maPoint = aRectangle.TopLeft();
-    maSize = aRectangle.GetSize();
-}
-
-// ------------------------------------------------------------------------
-
-sal_Bool MetaRenderGraphicAction::Compare( const MetaAction& rMetaAction ) const
-{
-	return ( maRenderGraphic.IsEqual( ( (MetaRenderGraphicAction&) rMetaAction).maRenderGraphic
) &&
-		   ( maPoint == ( (MetaRenderGraphicAction&) rMetaAction).maPoint ) &&
-		   ( maSize == ( (MetaRenderGraphicAction&) rMetaAction).maSize ) &&
-		   ( mfRotateAngle == ( (MetaRenderGraphicAction&) rMetaAction).mfRotateAngle ) &&
-		   ( mfShearAngleX == ( (MetaRenderGraphicAction&) rMetaAction).mfShearAngleX ) &&
-		   ( mfShearAngleY == ( (MetaRenderGraphicAction&) rMetaAction).mfShearAngleY ) );
-}
-
-// ------------------------------------------------------------------------
-
-void MetaRenderGraphicAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
-{
-	WRITE_BASE_COMPAT( rOStm, 1, pData );
-    rOStm << maRenderGraphic << maPoint << maSize << mfRotateAngle
<< mfShearAngleX << mfShearAngleY;
-}
-
-// ------------------------------------------------------------------------
-
-void MetaRenderGraphicAction::Read( SvStream& rIStm, ImplMetaReadData* )
-{
-	COMPAT( rIStm );
-	rIStm >> maRenderGraphic >> maPoint >> maSize >> mfRotateAngle >>
mfShearAngleX >> mfShearAngleY;
-}
+// eof

Modified: incubator/ooo/trunk/main/vcl/source/gdi/outdev6.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/outdev6.cxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/outdev6.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/outdev6.cxx Mon Dec 19 16:41:21 2011
@@ -33,7 +33,6 @@
 #include <vcl/svapp.hxx>
 #include <vcl/wrkwin.hxx>
 #include <vcl/graph.hxx>
-#include <vcl/rendergraphicrasterizer.hxx>
 
 #include <wall2.hxx>
 #include <salgdi.hxx>
@@ -1246,25 +1245,3 @@ bool OutputDevice::DrawEPS( const Point&
     return bDrawn;
 }
 
-// ------------------------------------------------------------------
-
-void OutputDevice::DrawRenderGraphic( const Point& rPoint, const Size& rSize,
-                                      const ::vcl::RenderGraphic& rRenderGraphic )
-{
-	DBG_TRACE( "OutputDevice::DrawRenderGraphic()" );
-
-	if( mpMetaFile )
-		mpMetaFile->AddAction( new MetaRenderGraphicAction( rPoint, rSize, rRenderGraphic )
);
-
-    if( !rRenderGraphic.IsEmpty() )
-    {
-        ::vcl::RenderGraphicRasterizer  aRasterizer( rRenderGraphic );
-        BitmapEx                        aBmpEx;
-        const Size                      aSizePixel( LogicToPixel( rSize ) );
-        GDIMetaFile*                    pOldMetaFile = mpMetaFile;
-
-        mpMetaFile = NULL;
-        DrawBitmapEx( rPoint, rSize, aRasterizer.Rasterize( aSizePixel ) );
-        mpMetaFile = pOldMetaFile;
-    }
-}

Modified: incubator/ooo/trunk/main/vcl/source/gdi/pdfwriter_impl2.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/pdfwriter_impl2.cxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/pdfwriter_impl2.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/pdfwriter_impl2.cxx Mon Dec 19 16:41:21 2011
@@ -31,7 +31,6 @@
 #include "vcl/metaact.hxx"
 #include "vcl/bmpacc.hxx"
 #include "vcl/graph.hxx"
-#include "vcl/rendergraphicrasterizer.hxx"
 
 #include "svdata.hxx"
 
@@ -1044,17 +1043,6 @@ void PDFWriterImpl::playMetafile( const 
 				}
 				break;
 
-				case( META_RENDERGRAPHIC_ACTION ):
-				{
-					const MetaRenderGraphicAction* pA = static_cast< const MetaRenderGraphicAction* >(
pAction );
-                    const ::vcl::RenderGraphicRasterizer aRasterizer( pA->GetRenderGraphic()
);
-
-					implWriteBitmapEx( pA->GetPoint(), pA->GetSize(),
-                                       aRasterizer.Rasterize( pDummyVDev->LogicToPixel(
pA->GetSize() ) ),
-                                       pDummyVDev, i_rContext );
-				}
-				break;
-
 				default:
 					// #i24604# Made assertion fire only once per
 					// metafile. The asserted actions here are all

Modified: incubator/ooo/trunk/main/vcl/source/gdi/print2.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/print2.cxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/print2.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/print2.cxx Mon Dec 19 16:41:21 2011
@@ -42,7 +42,6 @@
 #include <vcl/print.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/bmpacc.hxx>
-#include <vcl/rendergraphicrasterizer.hxx>
 
 #include <print.h>
 
@@ -111,9 +110,6 @@ static bool ImplIsActionSpecial( const M
         case META_BMPEXSCALEPART_ACTION:
             return static_cast<const MetaBmpExScalePartAction&>(rAct).GetBitmapEx().IsTransparent();
 
-        case META_RENDERGRAPHIC_ACTION:
-            return true;
-
         default:
             return false;
     }
@@ -201,16 +197,6 @@ static void ImplConvertTransparentAction
                 aBmpEx = static_cast<const MetaBmpExScaleAction&>(rAct).GetBitmapEx();
                 break;
 
-            case META_RENDERGRAPHIC_ACTION:
-            {
-                const ::vcl::RenderGraphicRasterizer aRasterizer( static_cast<const MetaRenderGraphicAction&>(rAct).
-                                                                      GetRenderGraphic()
);
-
-                aBmpEx = aRasterizer.Rasterize( rStateOutDev.LogicToPixel(
-                             static_cast<const MetaRenderGraphicAction&>(rAct).GetSize()
) );
-                break;
-            }
-
             case META_TRANSPARENT_ACTION:
 
             default:
@@ -278,11 +264,6 @@ static void ImplConvertTransparentAction
                                        static_cast<const MetaBmpExScalePartAction&>(rAct).GetSrcSize(),
                                        aBmp ));
                 break;
-            case META_RENDERGRAPHIC_ACTION:
-                o_rMtf.AddAction( new MetaBmpScaleAction(
-                                       static_cast<const MetaRenderGraphicAction&>(rAct).GetPoint(),
-                                       static_cast<const MetaRenderGraphicAction&>(rAct).GetSize(),
-                                       aBmp ));
             default:
                 DBG_ERROR("Unexpected case");
                 break;
@@ -395,7 +376,6 @@ static bool ImplIsNotTransparent( const 
 		case META_TEXTRECT_ACTION:
 		case META_STRETCHTEXT_ACTION:
 		case META_TEXTLINE_ACTION:
-		case META_RENDERGRAPHIC_ACTION:
             // all other actions: generate non-transparent output
             bRet = true;
             break;
@@ -650,13 +630,6 @@ static Rectangle ImplCalcActionBounds( c
 			DBG_ERROR("META_TEXTLINE_ACTION not supported");
         break;
 
-        case( META_RENDERGRAPHIC_ACTION ):
-        {
-            const MetaRenderGraphicAction& rRenderAct = static_cast<const MetaRenderGraphicAction&>(rAct);
-			aActionBounds = Rectangle( rRenderAct.GetPoint(), rRenderAct.GetSize() );
-        }
-        break;
-
 		default:
             break;
 	}
@@ -682,7 +655,6 @@ static bool ImplIsActionHandlingTranspar
         case META_BMPEX_ACTION:
         case META_BMPEXSCALE_ACTION:
         case META_BMPEXSCALEPART_ACTION:
-        case META_RENDERGRAPHIC_ACTION:
             return true;
 
         default:

Modified: incubator/ooo/trunk/main/vcl/util/makefile.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/util/makefile.mk?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/util/makefile.mk (original)
+++ incubator/ooo/trunk/main/vcl/util/makefile.mk Mon Dec 19 16:41:21 2011
@@ -99,8 +99,6 @@ HXXDEPNLST= $(INC)$/vcl$/accel.hxx      
             $(INC)$/vcl$/print.hxx       \
             $(INC)$/vcl$/prndlg.hxx      \
             $(INC)$/vcl$/region.hxx      \
-            $(INC)$/vcl$/rendergraphic.hxx		\
-            $(INC)$/vcl$/rendergraphicrasterizer.hxx	\
             $(INC)$/vcl$/salbtype.hxx    \
             $(INC)$/vcl$/scrbar.hxx      \
             $(INC)$/vcl$/slider.hxx      \

Modified: incubator/ooo/trunk/main/xmloff/Library_xo.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/xmloff/Library_xo.mk?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/xmloff/Library_xo.mk (original)
+++ incubator/ooo/trunk/main/xmloff/Library_xo.mk Mon Dec 19 16:41:21 2011
@@ -119,6 +119,7 @@ $(eval $(call gb_Library_add_exception_o
 	xmloff/source/core/xmltkmap \
 	xmloff/source/core/xmltoken \
 	xmloff/source/core/xmluconv \
+	xmloff/source/core/xmlmultiimagehelper \
 	xmloff/source/draw/EnhancedCustomShapeToken \
 	xmloff/source/draw/XMLGraphicsDefaultStyle \
 	xmloff/source/draw/XMLImageMapContext \

Modified: incubator/ooo/trunk/main/xmloff/Package_inc.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/xmloff/Package_inc.mk?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/xmloff/Package_inc.mk (original)
+++ incubator/ooo/trunk/main/xmloff/Package_inc.mk Mon Dec 19 16:41:21 2011
@@ -129,3 +129,4 @@ $(eval $(call gb_Package_add_file,xmloff
 $(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmltoken.hxx,xmloff/xmltoken.hxx))
 $(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmltypes.hxx,xmloff/xmltypes.hxx))
 $(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmluconv.hxx,xmloff/xmluconv.hxx))
+$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/xmlmultiimagehelper.hxx,xmloff/xmlmultiimagehelper.hxx))

Modified: incubator/ooo/trunk/main/xmloff/inc/xmloff/txtparae.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/xmloff/inc/xmloff/txtparae.hxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/xmloff/inc/xmloff/txtparae.hxx (original)
+++ incubator/ooo/trunk/main/xmloff/inc/xmloff/txtparae.hxx Mon Dec 19 16:41:21 2011
@@ -146,6 +146,7 @@ protected:
 	const ::rtl::OUString sGraphicFilter;
 	const ::rtl::OUString sGraphicRotation;
 	const ::rtl::OUString sGraphicURL;
+	const ::rtl::OUString sReplacementGraphicURL;
 	const ::rtl::OUString sHeight;
 	const ::rtl::OUString sHoriOrient;
 	const ::rtl::OUString sHoriOrientPosition;

Modified: incubator/ooo/trunk/main/xmloff/source/draw/shapeexport2.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/xmloff/source/draw/shapeexport2.cxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/xmloff/source/draw/shapeexport2.cxx (original)
+++ incubator/ooo/trunk/main/xmloff/source/draw/shapeexport2.cxx Mon Dec 19 16:41:21 2011
@@ -1156,7 +1156,30 @@ void XMLShapeExport::ImpExportGraphicObj
 		{
 			if( !bIsEmptyPresObj )
 			{
-				OUString aStreamURL;
+                OUString aReplacementUrl;
+                xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("ReplacementGraphicURL")))
>>= aReplacementUrl;
+
+                // If there is no url, then then graphic is empty
+                if(aReplacementUrl.getLength())
+                {
+                    const OUString aStr = mrExport.AddEmbeddedGraphicObject(aReplacementUrl);
+
+                    if(aStr.getLength())
+                    {
+                        mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr);
+                        mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
+                        mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
+                        mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD
);
+
+                        // xlink:href for replacement, only written for Svg content
+                        SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_IMAGE,
sal_True, sal_True);
+
+                        // optional office:binary-data
+                        mrExport.AddEmbeddedGraphicObjectAsBase64(aReplacementUrl);
+                    }
+                }
+
+                OUString aStreamURL;
 				OUString aStr;
 
 				xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicStreamURL")))
>>= aStreamURL;
@@ -1189,7 +1212,7 @@ void XMLShapeExport::ImpExportGraphicObj
 				{
 					if( aStr[ 0 ] == '#' )
 					{
-						aStreamURL = OUString::createFromAscii( "vnd.sun.star.Package:" );
+						aStreamURL = sPackageURL;
 						aStreamURL = aStreamURL.concat( aStr.copy( 1, aStr.getLength() - 1 ) );
 					}
 

Modified: incubator/ooo/trunk/main/xmloff/source/draw/ximpshap.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/xmloff/source/draw/ximpshap.cxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/xmloff/source/draw/ximpshap.cxx (original)
+++ incubator/ooo/trunk/main/xmloff/source/draw/ximpshap.cxx Mon Dec 19 16:41:21 2011
@@ -82,6 +82,7 @@
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <tools/string.hxx>
 #include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
+#include <com/sun/star/container/XChild.hpp>
 
 // --> OD 2006-02-22 #b6382898#
 #include <com/sun/star/text/XTextDocument.hpp>
@@ -3328,7 +3329,10 @@ SdXMLFrameShapeContext::SdXMLFrameShapeC
 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes,
         sal_Bool bTemporaryShape)
 : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ),
-	mbSupportsReplacement( sal_False )
+    multiImageImportHelper(),
+	mbSupportsReplacement( sal_False ),
+    mxImplContext(),
+    mxReplImplContext()
 {
 	uno::Reference < util::XCloneable > xClone( xAttrList, uno::UNO_QUERY );
 	if( xClone.is() )
@@ -3342,6 +3346,67 @@ SdXMLFrameShapeContext::~SdXMLFrameShape
 {
 }
 
+void SdXMLFrameShapeContext::removeGraphicFromImportContext(const SvXMLImportContext&
rContext) const
+{
+    const SdXMLGraphicObjectShapeContext* pSdXMLGraphicObjectShapeContext = dynamic_cast<
const SdXMLGraphicObjectShapeContext* >(&rContext);
+
+    if(pSdXMLGraphicObjectShapeContext)
+    {
+        try
+        {
+            uno::Reference< container::XChild > xChild(pSdXMLGraphicObjectShapeContext->getShape(),
uno::UNO_QUERY_THROW);
+
+            if(xChild.is())
+            {
+                uno::Reference< drawing::XShapes > xParent(xChild->getParent(),
uno::UNO_QUERY_THROW);
+            
+                if(xParent.is())
+                {
+                    // remove from parent
+                    xParent->remove(pSdXMLGraphicObjectShapeContext->getShape());
+
+                    // dispose
+                    uno::Reference< lang::XComponent > xComp(pSdXMLGraphicObjectShapeContext->getShape(),
UNO_QUERY);
+
+                    if(xComp.is())
+                    {
+                        xComp->dispose();
+                    }
+                }
+            }
+        }
+        catch( uno::Exception& )
+        {
+            DBG_ERROR( "Error in cleanup of multiple graphic object import (!)" );
+        }
+    }
+}
+
+rtl::OUString SdXMLFrameShapeContext::getGraphicURLFromImportContext(const SvXMLImportContext&
rContext) const
+{
+    rtl::OUString aRetval;
+    const SdXMLGraphicObjectShapeContext* pSdXMLGraphicObjectShapeContext = dynamic_cast<
const SdXMLGraphicObjectShapeContext* >(&rContext);
+
+    if(pSdXMLGraphicObjectShapeContext)
+    {
+        try
+        {
+            const uno::Reference< beans::XPropertySet > xPropSet(pSdXMLGraphicObjectShapeContext->getShape(),
uno::UNO_QUERY_THROW);
+
+            if(xPropSet.is())
+            {
+                xPropSet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicStreamURL")))
>>= aRetval;
+            }
+        }
+        catch( uno::Exception& )
+        {
+            DBG_ERROR( "Error in cleanup of multiple graphic object import (!)" );
+        }
+    }
+
+    return aRetval;
+}
+
 SvXMLImportContext *SdXMLFrameShapeContext::CreateChildContext( sal_uInt16 nPrefix,
 	const OUString& rLocalName,
 	const uno::Reference< xml::sax::XAttributeList>& xAttrList )
@@ -3350,13 +3415,30 @@ SvXMLImportContext *SdXMLFrameShapeConte
 
 	if( !mxImplContext.Is() )
 	{
-		pContext = GetImport().GetShapeImport()->CreateFrameChildContext(
-						GetImport(), nPrefix, rLocalName, xAttrList, mxShapes, mxAttrList );
+        pContext = GetImport().GetShapeImport()->CreateFrameChildContext(
+            GetImport(), nPrefix, rLocalName, xAttrList, mxShapes, mxAttrList);
 
-		mxImplContext = pContext;
-		mbSupportsReplacement = IsXMLToken( rLocalName, XML_OBJECT ) ||
-								IsXMLToken( rLocalName, XML_OBJECT_OLE );
-	}
+        mxImplContext = pContext;
+        mbSupportsReplacement = IsXMLToken(rLocalName, XML_OBJECT ) || IsXMLToken(rLocalName,
XML_OBJECT_OLE);
+        setSupportsMultipleContents(IsXMLToken(rLocalName, XML_IMAGE));
+
+        if(getSupportsMultipleContents() && dynamic_cast< SdXMLGraphicObjectShapeContext*
>(pContext))
+        {
+            addContent(*mxImplContext);
+        }
+    }
+    else if(getSupportsMultipleContents() && XML_NAMESPACE_DRAW == nPrefix &&
IsXMLToken(rLocalName, XML_IMAGE))
+    {
+        // read another image
+        pContext = GetImport().GetShapeImport()->CreateFrameChildContext(
+            GetImport(), nPrefix, rLocalName, xAttrList, mxShapes, mxAttrList);
+        mxImplContext = pContext;
+
+        if(dynamic_cast< SdXMLGraphicObjectShapeContext* >(pContext))
+        {
+            addContent(*mxImplContext);
+        }
+    }
 	else if( mbSupportsReplacement && !mxReplImplContext &&
 			 XML_NAMESPACE_DRAW == nPrefix &&
 			 IsXMLToken( rLocalName, XML_IMAGE ) )
@@ -3415,6 +3497,9 @@ void SdXMLFrameShapeContext::StartElemen
 
 void SdXMLFrameShapeContext::EndElement()
 {
+    /// solve if multiple image child contexts were imported
+    solveMultipleImages();
+
 	if( !mxImplContext.Is() )
 	{
 		// now check if this is an empty presentation object

Modified: incubator/ooo/trunk/main/xmloff/source/draw/ximpshap.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/xmloff/source/draw/ximpshap.hxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/xmloff/source/draw/ximpshap.hxx (original)
+++ incubator/ooo/trunk/main/xmloff/source/draw/ximpshap.hxx Mon Dec 19 16:41:21 2011
@@ -38,6 +38,7 @@
 
 #include <vector>
 #include <xmloff/shapeimport.hxx>
+#include <xmloff/xmlmultiimagehelper.hxx>
 
 //////////////////////////////////////////////////////////////////////////////
 // common shape context
@@ -573,13 +574,18 @@ public:
 //////////////////////////////////////////////////////////////////////////////
 // draw:-frame
 
-class SdXMLFrameShapeContext : public SdXMLShapeContext
+class SdXMLFrameShapeContext : public SdXMLShapeContext, public multiImageImportHelper
 {
 private:
 	sal_Bool mbSupportsReplacement;
 	SvXMLImportContextRef mxImplContext;
 	SvXMLImportContextRef mxReplImplContext;
 
+protected:
+    /// helper to get the created xShape instance, needs to be overloaded
+    virtual rtl::OUString getGraphicURLFromImportContext(const SvXMLImportContext& rContext)
const;
+    virtual void removeGraphicFromImportContext(const SvXMLImportContext& rContext) const;
+
 public:
 	TYPEINFO();
 

Modified: incubator/ooo/trunk/main/xmloff/source/text/XMLTextFrameContext.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/xmloff/source/text/XMLTextFrameContext.cxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/xmloff/source/text/XMLTextFrameContext.cxx (original)
+++ incubator/ooo/trunk/main/xmloff/source/text/XMLTextFrameContext.cxx Mon Dec 19 16:41:21
2011
@@ -433,6 +433,7 @@ public:
 	TYPEINFO();
 
 	sal_Bool CreateIfNotThere();
+	const OUString& GetHRef() const { return sHRef; }
 
 	XMLTextFrameContext_Impl( SvXMLImport& rImport,
 			sal_uInt16 nPrfx,
@@ -466,7 +467,7 @@ public:
 	::com::sun::star::text::TextContentAnchorType GetAnchorType() const { return eAnchorType;
}
 
 	const ::com::sun::star::uno::Reference <
-		::com::sun::star::beans::XPropertySet >& GetPropSet() { return xPropSet; }
+		::com::sun::star::beans::XPropertySet >& GetPropSet() const { return xPropSet; }
 };
 
 TYPEINIT1( XMLTextFrameContext_Impl, SvXMLImportContext );
@@ -759,8 +760,6 @@ void XMLTextFrameContext_Impl::Create( s
 		xTextImportHelper->InsertTextContent( xTxtCntnt );
 	}
 
-	Reference < XShape > xShape( xPropSet, UNO_QUERY );
-
 	// #107848#
 	// Make adding the shepe to Z-Ordering dependent from if we are
 	// inside a inside_deleted_section (redlining). That is necessary
@@ -770,7 +769,9 @@ void XMLTextFrameContext_Impl::Create( s
 	if(!GetImport().HasTextImport()
 		|| !GetImport().GetTextImport()->IsInsideDeleteContext())
 	{
-		GetImport().GetShapeImport()->shapeWithZIndexAdded( xShape, nZIndex );
+    	Reference < XShape > xShape( xPropSet, UNO_QUERY );
+
+        GetImport().GetShapeImport()->shapeWithZIndexAdded( xShape, nZIndex );
 	}
 
 	if( XML_TEXT_FRAME_TEXTBOX == nType )
@@ -1308,6 +1309,42 @@ void XMLTextFrameContext_Impl::SetDesc( 
 
 TYPEINIT1( XMLTextFrameContext, SvXMLImportContext );
 
+void XMLTextFrameContext::removeGraphicFromImportContext(const SvXMLImportContext& rContext)
const
+{
+    const XMLTextFrameContext_Impl* pXMLTextFrameContext_Impl = dynamic_cast< const XMLTextFrameContext_Impl*
>(&rContext);
+
+    if(pXMLTextFrameContext_Impl)
+    {
+        try
+        {
+            // just dispose to delete
+            uno::Reference< lang::XComponent > xComp(pXMLTextFrameContext_Impl->GetPropSet(),
UNO_QUERY);
+
+            if(xComp.is())
+            {
+                xComp->dispose();
+            }
+        }
+        catch( uno::Exception& )
+        {
+            DBG_ERROR( "Error in cleanup of multiple graphic object import (!)" );
+        }
+    }
+}
+
+rtl::OUString XMLTextFrameContext::getGraphicURLFromImportContext(const SvXMLImportContext&
rContext) const
+{
+    rtl::OUString aRetval;
+    const XMLTextFrameContext_Impl* pXMLTextFrameContext_Impl = dynamic_cast< const XMLTextFrameContext_Impl*
>(&rContext);
+
+    if(pXMLTextFrameContext_Impl)
+    {
+        return pXMLTextFrameContext_Impl->GetHRef();
+    }
+
+    return aRetval;
+}
+
 sal_Bool XMLTextFrameContext::CreateIfNotThere()
 {
 	sal_Bool bRet = sal_False;
@@ -1339,6 +1376,7 @@ XMLTextFrameContext::XMLTextFrameContext
 		const Reference< XAttributeList > & xAttrList,
 		TextContentAnchorType eATyp )
 :	SvXMLImportContext( rImport, nPrfx, rLName )
+,   multiImageImportHelper()
 ,	m_xAttrList( new SvXMLAttributeList( xAttrList ) )
 ,	m_pHyperlink( 0 )
 // --> OD 2009-07-22 #i73249#
@@ -1396,11 +1434,14 @@ XMLTextFrameContext::XMLTextFrameContext
 
 XMLTextFrameContext::~XMLTextFrameContext()
 {
-	delete m_pHyperlink;
+    delete m_pHyperlink;
 }
 
 void XMLTextFrameContext::EndElement()
 {
+    /// solve if multiple image child contexts were imported
+    solveMultipleImages();
+
 	SvXMLImportContext *pContext = &m_xImplContext;
 	XMLTextFrameContext_Impl *pImpl = PTR_CAST( XMLTextFrameContext_Impl, pContext );
 	if( pImpl )
@@ -1505,6 +1546,10 @@ SvXMLImportContext *XMLTextFrameContext:
 				{
 					m_bSupportsReplacement = sal_True;
 				}
+                else if(XML_TEXT_FRAME_GRAPHIC == nFrameType)
+                {
+                    setSupportsMultipleContents(IsXMLToken(rLocalName, XML_IMAGE));
+                }
 
 				if( !pContext )
 				{
@@ -1517,9 +1562,24 @@ SvXMLImportContext *XMLTextFrameContext:
 				}
 
 				m_xImplContext = pContext;
+
+                if(getSupportsMultipleContents() && XML_TEXT_FRAME_GRAPHIC == nFrameType)
+                {
+                    addContent(*m_xImplContext);
+                }
 			}
 		}
 	}
+    else if(getSupportsMultipleContents() && XML_NAMESPACE_DRAW == p_nPrefix &&
IsXMLToken(rLocalName, XML_IMAGE))
+    {
+        // read another image
+        pContext = new XMLTextFrameContext_Impl(
+            GetImport(), p_nPrefix, rLocalName, xAttrList,
+            m_eDefaultAnchorType, XML_TEXT_FRAME_GRAPHIC, m_xAttrList);
+        
+        m_xImplContext = pContext;
+        addContent(*m_xImplContext);
+    }
 	else if( m_bSupportsReplacement && !m_xReplImplContext &&
 			 XML_NAMESPACE_DRAW == p_nPrefix &&
 			 IsXMLToken( rLocalName, XML_IMAGE ) )

Modified: incubator/ooo/trunk/main/xmloff/source/text/XMLTextFrameContext.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/xmloff/source/text/XMLTextFrameContext.hxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/xmloff/source/text/XMLTextFrameContext.hxx (original)
+++ incubator/ooo/trunk/main/xmloff/source/text/XMLTextFrameContext.hxx Mon Dec 19 16:41:21
2011
@@ -28,6 +28,7 @@
 #include <com/sun/star/text/TextContentAnchorType.hpp>
 #endif
 #include <xmloff/xmlictxt.hxx>
+#include <xmloff/xmlmultiimagehelper.hxx>
 
 namespace com { namespace sun { namespace star {
 	namespace text { class XTextCursor; class XTextContent; }
@@ -36,7 +37,7 @@ namespace com { namespace sun { namespac
 class SvXMLAttributeList;
 class XMLTextFrameContextHyperlink_Impl;
 
-class XMLTextFrameContext : public SvXMLImportContext
+class XMLTextFrameContext : public SvXMLImportContext, public multiImageImportHelper
 {
 	::com::sun::star::uno::Reference<
 		::com::sun::star::xml::sax::XAttributeList > m_xAttrList;
@@ -66,6 +67,11 @@ class XMLTextFrameContext : public SvXML
 	sal_Bool CreateIfNotThere( ::com::sun::star::uno::Reference <
 		::com::sun::star::beans::XPropertySet >& rPropSet );
 
+protected:
+    /// helper to get the created xShape instance, needs to be overloaded
+    virtual rtl::OUString getGraphicURLFromImportContext(const SvXMLImportContext& rContext)
const;
+    virtual void removeGraphicFromImportContext(const SvXMLImportContext& rContext) const;
+
 public:
 
 	TYPEINFO();

Modified: incubator/ooo/trunk/main/xmloff/source/text/txtparae.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/xmloff/source/text/txtparae.cxx?rev=1220836&r1=1220835&r2=1220836&view=diff
==============================================================================
--- incubator/ooo/trunk/main/xmloff/source/text/txtparae.cxx (original)
+++ incubator/ooo/trunk/main/xmloff/source/text/txtparae.cxx Mon Dec 19 16:41:21 2011
@@ -1223,6 +1223,7 @@ XMLTextParagraphExport::XMLTextParagraph
 	sGraphicFilter(RTL_CONSTASCII_USTRINGPARAM("GraphicFilter")),
 	sGraphicRotation(RTL_CONSTASCII_USTRINGPARAM("GraphicRotation")),
 	sGraphicURL(RTL_CONSTASCII_USTRINGPARAM("GraphicURL")),
+	sReplacementGraphicURL(RTL_CONSTASCII_USTRINGPARAM("ReplacementGraphicURL")),
 	sHeight(RTL_CONSTASCII_USTRINGPARAM("Height")),
 	sHoriOrient(RTL_CONSTASCII_USTRINGPARAM("HoriOrient")),
 	sHoriOrientPosition(RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition")),
@@ -3018,9 +3019,33 @@ void XMLTextParagraphExport::_exportText
 								  sRet.makeStringAndClear() );
 	}
 
+    // original content
+    SvXMLElementExport aElem(GetExport(), XML_NAMESPACE_DRAW, XML_FRAME, sal_False, sal_True);
 
-	SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW,
-							  XML_FRAME, sal_False, sal_True );
+    // replacement graphic for backwards compatibility, but
+    // only for SVG currently
+    OUString sReplacementOrigURL;
+    rPropSet->getPropertyValue( sReplacementGraphicURL ) >>= sReplacementOrigURL;
+
+    if(sReplacementOrigURL.getLength())
+    {
+        const OUString sReplacementURL(GetExport().AddEmbeddedGraphicObject( sReplacementOrigURL
));
+
+        // If there is no url, then then graphic is empty
+        if(sReplacementURL.getLength())
+        {
+            GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sReplacementURL);
+            GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE);
+            GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED);
+            GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD);
+            
+            // xlink:href for replacement, only written for Svg content
+            SvXMLElementExport aElement(GetExport(), XML_NAMESPACE_DRAW, XML_IMAGE, sal_False,
sal_True);
+
+            // optional office:binary-data
+            GetExport().AddEmbeddedGraphicObjectAsBase64(sReplacementURL);
+        }
+    }
 
 	// xlink:href
 	OUString sOrigURL;



Mime
View raw message