LCOV - code coverage report
Current view: top level - oox/source/shape - ShapeContextHandler.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 289 0.0 %
Date: 2014-04-14 Functions: 0 39 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <com/sun/star/xml/sax/XFastSAXSerializable.hpp>
      21             : 
      22             : #include "ShapeContextHandler.hxx"
      23             : #include "ShapeDrawingFragmentHandler.hxx"
      24             : #include "LockedCanvasContext.hxx"
      25             : #include "WpsContext.hxx"
      26             : #include "WpgContext.hxx"
      27             : #include "oox/vml/vmldrawingfragment.hxx"
      28             : #include "oox/vml/vmlshape.hxx"
      29             : #include "oox/drawingml/themefragmenthandler.hxx"
      30             : #include <boost/scoped_ptr.hpp>
      31             : #include <cppuhelper/supportsservice.hxx>
      32             : 
      33             : namespace oox { namespace shape {
      34             : 
      35             : using namespace ::com::sun::star;
      36             : using namespace core;
      37             : using namespace drawingml;
      38             : 
      39           0 : OUString SAL_CALL ShapeContextHandler_getImplementationName()
      40             : {
      41           0 :     return OUString( "com.sun.star.comp.oox.ShapeContextHandler" );
      42             : }
      43             : 
      44             : uno::Sequence< OUString > SAL_CALL
      45           0 : ShapeContextHandler_getSupportedServiceNames()
      46             : {
      47           0 :     uno::Sequence< OUString > s(1);
      48           0 :     s[0] = "com.sun.star.xml.sax.FastShapeContextHandler";
      49           0 :     return s;
      50             : }
      51             : 
      52             : uno::Reference< uno::XInterface > SAL_CALL
      53           0 : ShapeContextHandler_createInstance( const uno::Reference< uno::XComponentContext > & context)
      54             :         SAL_THROW((uno::Exception))
      55             : {
      56           0 :     return static_cast< ::cppu::OWeakObject* >( new ShapeContextHandler(context) );
      57             : }
      58             : 
      59             : 
      60           0 : ShapeContextHandler::ShapeContextHandler
      61             : (uno::Reference< uno::XComponentContext > const & context) :
      62           0 : mnStartToken(0), m_xContext(context)
      63             : {
      64             :     try
      65             :     {
      66           0 :         mxFilterBase.set( new ShapeFilterBase(context) );
      67             :     }
      68           0 :     catch( uno::Exception& )
      69             :     {
      70             :     }
      71           0 : }
      72             : 
      73           0 : ShapeContextHandler::~ShapeContextHandler()
      74             : {
      75           0 : }
      76             : 
      77           0 : uno::Reference<xml::sax::XFastContextHandler> ShapeContextHandler::getLockedCanvasContext(sal_Int32 nElement)
      78             : {
      79           0 :     if (!mxLockedCanvasContext.is())
      80             :     {
      81           0 :         FragmentHandler2Ref rFragmentHandler(new ShapeFragmentHandler(*mxFilterBase, msRelationFragmentPath));
      82           0 :         ShapePtr pMasterShape;
      83             : 
      84           0 :         switch (nElement & 0xffff)
      85             :         {
      86             :             case XML_lockedCanvas:
      87           0 :                 mxLockedCanvasContext.set(new LockedCanvasContext(*rFragmentHandler));
      88           0 :                 break;
      89             :             default:
      90           0 :                 break;
      91           0 :         }
      92             :     }
      93             : 
      94           0 :     return mxLockedCanvasContext;
      95             : }
      96             : 
      97             : /*
      98             :  * This method creates new ChartGraphicDataContext Object.
      99             :  */
     100           0 : uno::Reference<xml::sax::XFastContextHandler> ShapeContextHandler::getChartShapeContext(sal_Int32 nElement)
     101             : {
     102           0 :     if (!mxChartShapeContext.is())
     103             :     {
     104           0 :         switch (nElement & 0xffff)
     105             :         {
     106             :             case XML_chart:
     107             :             {
     108             :                 boost::scoped_ptr<ContextHandler2Helper> pFragmentHandler(
     109           0 :                         new ShapeFragmentHandler(*mxFilterBase, msRelationFragmentPath));
     110           0 :                 mpShape.reset(new Shape("com.sun.star.drawing.OLE2Shape" ));
     111           0 :                 mxChartShapeContext.set(new ChartGraphicDataContext(*pFragmentHandler, mpShape, true));
     112           0 :                 break;
     113             :             }
     114             :             default:
     115           0 :                 break;
     116             :         }
     117             :     }
     118             : 
     119           0 :     return mxChartShapeContext;
     120             : }
     121             : 
     122           0 : uno::Reference<xml::sax::XFastContextHandler> ShapeContextHandler::getWpsContext(sal_Int32 nStartElement, sal_Int32 nElement)
     123             : {
     124           0 :     if (!mxWpsContext.is())
     125             :     {
     126           0 :         FragmentHandler2Ref rFragmentHandler(new ShapeFragmentHandler(*mxFilterBase, msRelationFragmentPath));
     127           0 :         ShapePtr pMasterShape;
     128             : 
     129           0 :         uno::Reference<drawing::XShape> xShape;
     130             :         // No element happens in case of pretty-printed XML, bodyPr is the case when we are called again after <wps:txbx>.
     131           0 :         if (!nElement || nElement == WPS_TOKEN(bodyPr))
     132             :             // Assume that this is just a continuation of the previous shape.
     133           0 :             xShape = mxSavedShape;
     134             : 
     135           0 :         switch (getBaseToken(nStartElement))
     136             :         {
     137             :             case XML_wsp:
     138           0 :                 mxWpsContext.set(new WpsContext(*rFragmentHandler, xShape));
     139           0 :                 break;
     140             :             default:
     141           0 :                 break;
     142           0 :         }
     143             :     }
     144             : 
     145           0 :     return mxWpsContext;
     146             : }
     147             : 
     148           0 : uno::Reference<xml::sax::XFastContextHandler> ShapeContextHandler::getWpgContext(sal_Int32 nElement)
     149             : {
     150           0 :     if (!mxWpgContext.is())
     151             :     {
     152           0 :         FragmentHandler2Ref rFragmentHandler(new ShapeFragmentHandler(*mxFilterBase, msRelationFragmentPath));
     153           0 :         ShapePtr pMasterShape;
     154             : 
     155           0 :         switch (getBaseToken(nElement))
     156             :         {
     157             :             case XML_wgp:
     158           0 :                 mxWpgContext.set(new WpgContext(*rFragmentHandler));
     159           0 :                 break;
     160             :             default:
     161           0 :                 break;
     162           0 :         }
     163             :     }
     164             : 
     165           0 :     return mxWpgContext;
     166             : }
     167             : 
     168             : uno::Reference<xml::sax::XFastContextHandler>
     169           0 : ShapeContextHandler::getGraphicShapeContext(::sal_Int32 Element )
     170             : {
     171           0 :     if (! mxGraphicShapeContext.is())
     172             :     {
     173             :         boost::shared_ptr<ContextHandler2Helper> pFragmentHandler
     174           0 :             (new ShapeFragmentHandler(*mxFilterBase, msRelationFragmentPath));
     175           0 :         ShapePtr pMasterShape;
     176             : 
     177           0 :         switch (Element & 0xffff)
     178             :         {
     179             :             case XML_graphic:
     180           0 :                 mpShape.reset(new Shape("com.sun.star.drawing.GraphicObjectShape" ));
     181             :                 mxGraphicShapeContext.set
     182           0 :                 (new GraphicalObjectFrameContext(*pFragmentHandler, pMasterShape, mpShape, true));
     183           0 :                 break;
     184             :             case XML_pic:
     185           0 :                 mpShape.reset(new Shape("com.sun.star.drawing.GraphicObjectShape" ));
     186             :                 mxGraphicShapeContext.set
     187           0 :                 (new GraphicShapeContext(*pFragmentHandler, pMasterShape, mpShape));
     188           0 :                 break;
     189             :             default:
     190           0 :                 break;
     191           0 :         }
     192             :     }
     193             : 
     194           0 :     return mxGraphicShapeContext;
     195             : }
     196             : 
     197             : uno::Reference<xml::sax::XFastContextHandler>
     198           0 : ShapeContextHandler::getDrawingShapeContext()
     199             : {
     200           0 :     if (!mxDrawingFragmentHandler.is())
     201             :     {
     202           0 :         mpDrawing.reset( new oox::vml::Drawing( *mxFilterBase, mxDrawPage, oox::vml::VMLDRAWING_WORD ) );
     203             :         mxDrawingFragmentHandler.set
     204             :           (dynamic_cast<ContextHandler *>
     205             :            (new oox::vml::DrawingFragment
     206           0 :             ( *mxFilterBase, msRelationFragmentPath, *mpDrawing )));
     207             :     }
     208             : 
     209           0 :     return mxDrawingFragmentHandler;
     210             : }
     211             : 
     212             : uno::Reference<xml::sax::XFastContextHandler>
     213           0 : ShapeContextHandler::getDiagramShapeContext()
     214             : {
     215           0 :     if (!mxDiagramShapeContext.is())
     216             :     {
     217           0 :         boost::shared_ptr<ContextHandler2Helper> pFragmentHandler(new ShapeFragmentHandler(*mxFilterBase, msRelationFragmentPath));
     218           0 :         mpShape.reset(new Shape());
     219           0 :         mxDiagramShapeContext.set(new DiagramGraphicDataContext(*pFragmentHandler, mpShape));
     220             :     }
     221             : 
     222           0 :     return mxDiagramShapeContext;
     223             : }
     224             : 
     225             : uno::Reference<xml::sax::XFastContextHandler>
     226           0 : ShapeContextHandler::getContextHandler(sal_Int32 nElement)
     227             : {
     228           0 :     uno::Reference<xml::sax::XFastContextHandler> xResult;
     229             : 
     230           0 :     switch (getNamespace( mnStartToken ))
     231             :     {
     232             :         case NMSP_doc:
     233             :         case NMSP_vml:
     234           0 :             xResult.set(getDrawingShapeContext());
     235           0 :             break;
     236             :         case NMSP_dmlDiagram:
     237           0 :             xResult.set(getDiagramShapeContext());
     238           0 :             break;
     239             :         case NMSP_dmlLockedCanvas:
     240           0 :             xResult.set(getLockedCanvasContext(mnStartToken));
     241           0 :             break;
     242             :         case NMSP_dmlChart:
     243           0 :             xResult.set(getChartShapeContext(mnStartToken));
     244           0 :             break;
     245             :         case NMSP_wps:
     246           0 :             xResult.set(getWpsContext(mnStartToken, nElement));
     247           0 :             break;
     248             :         case NMSP_wpg:
     249           0 :             xResult.set(getWpgContext(mnStartToken));
     250           0 :             break;
     251             :         default:
     252           0 :             xResult.set(getGraphicShapeContext(mnStartToken));
     253           0 :             break;
     254             :     }
     255             : 
     256           0 :     return xResult;
     257             : }
     258             : 
     259             : // ::com::sun::star::xml::sax::XFastContextHandler:
     260           0 : void SAL_CALL ShapeContextHandler::startFastElement
     261             : (::sal_Int32 Element,
     262             :  const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
     263             :     throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
     264             : {
     265             :     static const OUString sInputStream
     266           0 :         ("InputStream");
     267             : 
     268           0 :     uno::Sequence<beans::PropertyValue> aSeq(1);
     269           0 :     aSeq[0].Name = sInputStream;
     270           0 :     aSeq[0].Value <<= mxInputStream;
     271           0 :     mxFilterBase->filter(aSeq);
     272             : 
     273           0 :     mpThemePtr.reset(new Theme());
     274             : 
     275           0 :     if (Element == DGM_TOKEN(relIds) || Element == LC_TOKEN(lockedCanvas) || Element == C_TOKEN(chart) ||
     276           0 :         Element == WPS_TOKEN(wsp) || Element == WPG_TOKEN(wgp) || Element == OOX_TOKEN(dmlPicture, pic))
     277             :     {
     278             :         // Parse the theme relation, if available; the diagram won't have colors without it.
     279           0 :         if (!msRelationFragmentPath.isEmpty())
     280             :         {
     281           0 :             FragmentHandlerRef rFragmentHandler(new ShapeFragmentHandler(*mxFilterBase, msRelationFragmentPath));
     282           0 :             OUString aThemeFragmentPath = rFragmentHandler->getFragmentPathFromFirstTypeFromOfficeDoc( "theme" );
     283           0 :             if(!aThemeFragmentPath.isEmpty())
     284             :             {
     285           0 :                 uno::Reference<xml::sax::XFastSAXSerializable> xDoc(mxFilterBase->importFragment(aThemeFragmentPath), uno::UNO_QUERY_THROW);
     286           0 :                 mxFilterBase->importFragment(new ThemeFragmentHandler(*mxFilterBase, aThemeFragmentPath, *mpThemePtr ), xDoc);
     287           0 :                 ShapeFilterBase* pShapeFilterBase(dynamic_cast<ShapeFilterBase*>(mxFilterBase.get()));
     288           0 :                 if (pShapeFilterBase)
     289           0 :                     pShapeFilterBase->setCurrentTheme(mpThemePtr);
     290           0 :             }
     291             :         }
     292             : 
     293           0 :         createFastChildContext(Element, Attribs);
     294             :     }
     295             : 
     296             :     // Entering VML block (startFastElement() is called for the outermost tag),
     297             :     // handle possible recursion.
     298           0 :     if ( getContextHandler() == getDrawingShapeContext() )
     299           0 :         mpDrawing->getShapes().pushMark();
     300             : 
     301           0 :     uno::Reference<XFastContextHandler> xContextHandler(getContextHandler());
     302             : 
     303           0 :     if (xContextHandler.is())
     304           0 :         xContextHandler->startFastElement(Element, Attribs);
     305           0 : }
     306             : 
     307           0 : void SAL_CALL ShapeContextHandler::startUnknownElement
     308             : (const OUString & Namespace, const OUString & Name,
     309             :  const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
     310             :     throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
     311             : {
     312           0 :     if ( getContextHandler() == getDrawingShapeContext() )
     313           0 :         mpDrawing->getShapes().pushMark();
     314             : 
     315           0 :     uno::Reference<XFastContextHandler> xContextHandler(getContextHandler());
     316             : 
     317           0 :     if (xContextHandler.is())
     318           0 :         xContextHandler->startUnknownElement(Namespace, Name, Attribs);
     319           0 : }
     320             : 
     321           0 : void SAL_CALL ShapeContextHandler::endFastElement(::sal_Int32 Element)
     322             :     throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
     323             : {
     324           0 :     uno::Reference<XFastContextHandler> xContextHandler(getContextHandler());
     325             : 
     326           0 :     if (xContextHandler.is())
     327           0 :         xContextHandler->endFastElement(Element);
     328             :     // In case a textbox is sent, and later we get additional properties for
     329             :     // the textbox, then the wps context is not cleared, so do that here.
     330           0 :     if (Element == (NMSP_wps | XML_wsp))
     331             :     {
     332           0 :         uno::Reference<lang::XServiceInfo> xServiceInfo(mxSavedShape, uno::UNO_QUERY);
     333           0 :         if (xServiceInfo.is() && xServiceInfo->supportsService("com.sun.star.text.TextFrame"))
     334           0 :             mxWpsContext.clear();
     335           0 :         mxSavedShape.clear();
     336           0 :     }
     337           0 : }
     338             : 
     339           0 : void SAL_CALL ShapeContextHandler::endUnknownElement
     340             : (const OUString & Namespace,
     341             :  const OUString & Name)
     342             :     throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
     343             : {
     344           0 :     uno::Reference<XFastContextHandler> xContextHandler(getContextHandler());
     345             : 
     346           0 :     if (xContextHandler.is())
     347           0 :         xContextHandler->endUnknownElement(Namespace, Name);
     348           0 : }
     349             : 
     350             : uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
     351           0 : ShapeContextHandler::createFastChildContext
     352             : (::sal_Int32 Element,
     353             :  const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
     354             :     throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
     355             : {
     356           0 :     uno::Reference< xml::sax::XFastContextHandler > xResult;
     357           0 :     uno::Reference< xml::sax::XFastContextHandler > xContextHandler(getContextHandler(Element));
     358             : 
     359           0 :     if (xContextHandler.is())
     360           0 :         xResult.set(xContextHandler->createFastChildContext
     361           0 :                     (Element, Attribs));
     362             : 
     363           0 :     return xResult;
     364             : }
     365             : 
     366             : uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
     367           0 : ShapeContextHandler::createUnknownChildContext
     368             : (const OUString & Namespace,
     369             :  const OUString & Name,
     370             :  const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
     371             :     throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
     372             : {
     373           0 :     uno::Reference<XFastContextHandler> xContextHandler(getContextHandler());
     374             : 
     375           0 :     if (xContextHandler.is())
     376           0 :         return xContextHandler->createUnknownChildContext
     377           0 :             (Namespace, Name, Attribs);
     378             : 
     379           0 :     return uno::Reference< xml::sax::XFastContextHandler >();
     380             : }
     381             : 
     382           0 : void SAL_CALL ShapeContextHandler::characters(const OUString & aChars)
     383             :     throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
     384             : {
     385           0 :     uno::Reference<XFastContextHandler> xContextHandler(getContextHandler());
     386             : 
     387           0 :     if (xContextHandler.is())
     388           0 :         xContextHandler->characters(aChars);
     389           0 : }
     390             : 
     391             : // ::com::sun::star::xml::sax::XFastShapeContextHandler:
     392             : uno::Reference< drawing::XShape > SAL_CALL
     393           0 : ShapeContextHandler::getShape() throw (uno::RuntimeException, std::exception)
     394             : {
     395           0 :     uno::Reference< drawing::XShape > xResult;
     396           0 :     uno::Reference< drawing::XShapes > xShapes( mxDrawPage, uno::UNO_QUERY );
     397             : 
     398           0 :     if (mxFilterBase.is() && xShapes.is())
     399             :     {
     400           0 :         if ( getContextHandler() == getDrawingShapeContext() )
     401             :         {
     402           0 :             mpDrawing->finalizeFragmentImport();
     403           0 :             if( boost::shared_ptr< vml::ShapeBase > pShape = mpDrawing->getShapes().takeLastShape() )
     404           0 :                 xResult = pShape->convertAndInsert( xShapes );
     405             :             // Only now remove the recursion mark, because getShape() is called in writerfilter
     406             :             // after endFastElement().
     407           0 :             mpDrawing->getShapes().popMark();
     408             :         }
     409           0 :         else if (mxDiagramShapeContext.is())
     410             :         {
     411           0 :             basegfx::B2DHomMatrix aMatrix;
     412           0 :             if (mpShape->getExtDrawings().size() == 0)
     413             :             {
     414           0 :                 mpShape->addShape( *mxFilterBase, mpThemePtr.get(), xShapes, aMatrix, mpShape->getFillProperties() );
     415           0 :                 xResult = mpShape->getXShape();
     416             :             }
     417             :             else
     418             :             {
     419             :                 // Prerendered diagram output is available, then use that, and throw away the original result.
     420           0 :                 for (std::vector<OUString>::const_iterator aIt = mpShape->getExtDrawings().begin(); aIt != mpShape->getExtDrawings().end(); ++aIt)
     421             :                 {
     422           0 :                     DiagramGraphicDataContext* pDiagramGraphicDataContext = dynamic_cast<DiagramGraphicDataContext*>(mxDiagramShapeContext.get());
     423           0 :                     if (!pDiagramGraphicDataContext)
     424           0 :                         break;
     425           0 :                     OUString aFragmentPath(pDiagramGraphicDataContext->getFragmentPathFromRelId(*aIt));
     426           0 :                     oox::drawingml::ShapePtr pShapePtr( new Shape( "com.sun.star.drawing.GroupShape" ) );
     427           0 :                     pShapePtr->setDiagramType();
     428           0 :                     mxFilterBase->importFragment(new ShapeDrawingFragmentHandler(*mxFilterBase, aFragmentPath, pShapePtr));
     429             : 
     430           0 :                     uno::Sequence<beans::PropertyValue> aValue(mpShape->getDiagramDoms());
     431           0 :                     uno::Sequence < uno::Any > diagramDrawing(2);
     432             :                     // drawingValue[0] => dom, drawingValue[1] => Sequence of associated relationships
     433             : 
     434           0 :                     sal_Int32 length = aValue.getLength();
     435           0 :                     aValue.realloc(length+1);
     436             : 
     437           0 :                     diagramDrawing[0] = uno::makeAny( mxFilterBase->importFragment( aFragmentPath ) );
     438           0 :                     diagramDrawing[1] = uno::makeAny( pShapePtr->resolveRelationshipsOfTypeFromOfficeDoc(
     439           0 :                                 *mxFilterBase, aFragmentPath, "image" )  );
     440             : 
     441           0 :                     beans::PropertyValue* pValue = aValue.getArray();
     442           0 :                     pValue[length].Name = "OOXDrawing";
     443           0 :                     pValue[length].Value = uno::makeAny( diagramDrawing );
     444             : 
     445           0 :                     pShapePtr->setDiagramDoms( aValue );
     446             : 
     447           0 :                     pShapePtr->addShape( *mxFilterBase, mpThemePtr.get(), xShapes, aMatrix, pShapePtr->getFillProperties() );
     448           0 :                     xResult = pShapePtr->getXShape();
     449           0 :                 }
     450           0 :                 mpShape.reset((Shape*)0);
     451             :             }
     452           0 :             mxDiagramShapeContext.clear();
     453             :         }
     454           0 :         else if (mxLockedCanvasContext.is())
     455             :         {
     456           0 :             ShapePtr pShape = dynamic_cast<LockedCanvasContext*>(mxLockedCanvasContext.get())->getShape();
     457           0 :             if (pShape)
     458             :             {
     459           0 :                 basegfx::B2DHomMatrix aMatrix;
     460           0 :                 pShape->addShape(*mxFilterBase, mpThemePtr.get(), xShapes, aMatrix, pShape->getFillProperties());
     461           0 :                 xResult = pShape->getXShape();
     462           0 :                 mxLockedCanvasContext.clear();
     463           0 :             }
     464             :         }
     465           0 :         else if (mxChartShapeContext.is())
     466             :         {
     467           0 :             ChartGraphicDataContext* pChartGraphicDataContext = dynamic_cast<ChartGraphicDataContext*>(mxChartShapeContext.get());
     468           0 :             if (pChartGraphicDataContext)
     469             :             {
     470           0 :                 basegfx::B2DHomMatrix aMatrix;
     471           0 :                 oox::drawingml::ShapePtr xShapePtr( pChartGraphicDataContext->getShape());
     472             :                 // See SwXTextDocument::createInstance(), ODF import uses the same hack.
     473           0 :                 xShapePtr->setServiceName("com.sun.star.drawing.temporaryForXMLImportOLE2Shape");
     474           0 :                 xShapePtr->addShape( *mxFilterBase, mpThemePtr.get(), xShapes, aMatrix, xShapePtr->getFillProperties() );
     475           0 :                 xResult = xShapePtr->getXShape();
     476             :             }
     477           0 :             mxChartShapeContext.clear();
     478             :         }
     479           0 :         else if (mxWpsContext.is())
     480             :         {
     481           0 :             ShapePtr pShape = dynamic_cast<WpsContext&>(*mxWpsContext.get()).getShape();
     482           0 :             if (pShape)
     483             :             {
     484           0 :                 basegfx::B2DHomMatrix aMatrix;
     485           0 :                 pShape->setPosition(maPosition);
     486           0 :                 pShape->addShape(*mxFilterBase, mpThemePtr.get(), xShapes, aMatrix, pShape->getFillProperties());
     487           0 :                 xResult = pShape->getXShape();
     488           0 :                 mxSavedShape = xResult;
     489           0 :                 mxWpsContext.clear();
     490           0 :             }
     491             :         }
     492           0 :         else if (mxWpgContext.is())
     493             :         {
     494           0 :             ShapePtr pShape = dynamic_cast<WpgContext*>(mxWpgContext.get())->getShape();
     495           0 :             if (pShape)
     496             :             {
     497           0 :                 basegfx::B2DHomMatrix aMatrix;
     498           0 :                 pShape->setPosition(maPosition);
     499           0 :                 pShape->addShape(*mxFilterBase, mpThemePtr.get(), xShapes, aMatrix, pShape->getFillProperties());
     500           0 :                 xResult = pShape->getXShape();
     501           0 :                 mxWpgContext.clear();
     502           0 :             }
     503             :         }
     504           0 :         else if (mpShape.get() != NULL)
     505             :         {
     506           0 :             basegfx::B2DHomMatrix aTransformation;
     507           0 :             mpShape->addShape(*mxFilterBase, mpThemePtr.get(), xShapes, aTransformation, mpShape->getFillProperties() );
     508           0 :             xResult.set(mpShape->getXShape());
     509           0 :             mxGraphicShapeContext.clear( );
     510             :         }
     511             :     }
     512             : 
     513           0 :     return xResult;
     514             : }
     515             : 
     516             : css::uno::Reference< css::drawing::XDrawPage > SAL_CALL
     517           0 : ShapeContextHandler::getDrawPage() throw (css::uno::RuntimeException, std::exception)
     518             : {
     519           0 :     return mxDrawPage;
     520             : }
     521             : 
     522           0 : void SAL_CALL ShapeContextHandler::setDrawPage
     523             : (const css::uno::Reference< css::drawing::XDrawPage > & the_value)
     524             :     throw (css::uno::RuntimeException, std::exception)
     525             : {
     526           0 :     mxDrawPage = the_value;
     527           0 : }
     528             : 
     529             : css::uno::Reference< css::frame::XModel > SAL_CALL
     530           0 : ShapeContextHandler::getModel() throw (css::uno::RuntimeException, std::exception)
     531             : {
     532           0 :     if( !mxFilterBase.is() )
     533           0 :         throw uno::RuntimeException();
     534           0 :     return mxFilterBase->getModel();
     535             : }
     536             : 
     537           0 : void SAL_CALL ShapeContextHandler::setModel
     538             : (const css::uno::Reference< css::frame::XModel > & the_value)
     539             :     throw (css::uno::RuntimeException, std::exception)
     540             : {
     541           0 :     if( !mxFilterBase.is() )
     542           0 :         throw uno::RuntimeException();
     543           0 :     uno::Reference<lang::XComponent> xComp(the_value, uno::UNO_QUERY_THROW);
     544           0 :     mxFilterBase->setTargetDocument(xComp);
     545           0 : }
     546             : 
     547             : uno::Reference< io::XInputStream > SAL_CALL
     548           0 : ShapeContextHandler::getInputStream() throw (uno::RuntimeException, std::exception)
     549             : {
     550           0 :     return mxInputStream;
     551             : }
     552             : 
     553           0 : void SAL_CALL ShapeContextHandler::setInputStream
     554             : (const uno::Reference< io::XInputStream > & the_value)
     555             :     throw (uno::RuntimeException, std::exception)
     556             : {
     557           0 :     mxInputStream = the_value;
     558           0 : }
     559             : 
     560           0 : OUString SAL_CALL ShapeContextHandler::getRelationFragmentPath()
     561             :     throw (uno::RuntimeException, std::exception)
     562             : {
     563           0 :     return msRelationFragmentPath;
     564             : }
     565             : 
     566           0 : void SAL_CALL ShapeContextHandler::setRelationFragmentPath(const OUString & the_value)
     567             :     throw (uno::RuntimeException, std::exception)
     568             : {
     569           0 :     msRelationFragmentPath = the_value;
     570           0 : }
     571             : 
     572           0 : ::sal_Int32 SAL_CALL ShapeContextHandler::getStartToken() throw (::com::sun::star::uno::RuntimeException, std::exception)
     573             : {
     574           0 :     return mnStartToken;
     575             : }
     576             : 
     577           0 : void SAL_CALL ShapeContextHandler::setStartToken( ::sal_Int32 _starttoken ) throw (::com::sun::star::uno::RuntimeException, std::exception)
     578             : {
     579           0 :     mnStartToken = _starttoken;
     580           0 : }
     581             : 
     582           0 : awt::Point SAL_CALL ShapeContextHandler::getPosition() throw (uno::RuntimeException, std::exception)
     583             : {
     584           0 :     return maPosition;
     585             : }
     586             : 
     587           0 : void SAL_CALL ShapeContextHandler::setPosition(const awt::Point& rPosition) throw (uno::RuntimeException, std::exception)
     588             : {
     589           0 :     maPosition = rPosition;
     590           0 : }
     591             : 
     592           0 : OUString ShapeContextHandler::getImplementationName()
     593             :     throw (css::uno::RuntimeException, std::exception)
     594             : {
     595           0 :     return ShapeContextHandler_getImplementationName();
     596             : }
     597             : 
     598           0 : uno::Sequence< OUString > ShapeContextHandler::getSupportedServiceNames()
     599             :     throw (css::uno::RuntimeException, std::exception)
     600             : {
     601           0 :     return ShapeContextHandler_getSupportedServiceNames();
     602             : }
     603             : 
     604           0 : sal_Bool SAL_CALL ShapeContextHandler::supportsService(const OUString & ServiceName)
     605             :     throw (css::uno::RuntimeException, std::exception)
     606             : {
     607           0 :     return cppu::supportsService(this, ServiceName);
     608             : }
     609             : 
     610           0 : }}
     611             : 
     612             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10