LCOV - code coverage report
Current view: top level - oox/source/ppt - pptshape.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 119 207 57.5 %
Date: 2012-08-25 Functions: 9 11 81.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 247 693 35.6 %

           Branch data     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 "oox/ppt/pptshape.hxx"
      21                 :            : #include "oox/core/xmlfilterbase.hxx"
      22                 :            : #include "oox/drawingml/textbody.hxx"
      23                 :            : 
      24                 :            : #include <com/sun/star/container/XNamed.hpp>
      25                 :            : #include <com/sun/star/beans/XMultiPropertySet.hpp>
      26                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      27                 :            : #include <com/sun/star/drawing/HomogenMatrix3.hpp>
      28                 :            : #include <com/sun/star/text/XText.hpp>
      29                 :            : #include <basegfx/matrix/b2dhommatrix.hxx>
      30                 :            : #include "oox/ppt/slidepersist.hxx"
      31                 :            : 
      32                 :            : using rtl::OUString;
      33                 :            : using namespace ::oox::core;
      34                 :            : using namespace ::oox::drawingml;
      35                 :            : using namespace ::com::sun::star;
      36                 :            : using namespace ::com::sun::star::awt;
      37                 :            : using namespace ::com::sun::star::uno;
      38                 :            : using namespace ::com::sun::star::beans;
      39                 :            : using namespace ::com::sun::star::frame;
      40                 :            : using namespace ::com::sun::star::text;
      41                 :            : using namespace ::com::sun::star::drawing;
      42                 :            : 
      43                 :            : namespace oox { namespace ppt {
      44                 :            : 
      45                 :        183 : PPTShape::PPTShape( const oox::ppt::ShapeLocation eShapeLocation, const sal_Char* pServiceName )
      46                 :            : : Shape( pServiceName )
      47                 :            : , meShapeLocation( eShapeLocation )
      48         [ +  - ]:        183 : , mbReferenced( sal_False )
      49                 :            : {
      50                 :        183 : }
      51                 :            : 
      52         [ +  - ]:        183 : PPTShape::~PPTShape()
      53                 :            : {
      54         [ -  + ]:        366 : }
      55                 :            : 
      56                 :          0 : static const char* lclDebugSubType( sal_Int32 nType )
      57                 :            : {
      58   [ #  #  #  #  :          0 :     switch (nType) {
          #  #  #  #  #  
                   #  # ]
      59                 :            :         case XML_ctrTitle :
      60                 :          0 :             return "ctrTitle";
      61                 :            :         case XML_title :
      62                 :          0 :             return "title";
      63                 :            :         case XML_subTitle :
      64                 :          0 :             return "subTitle";
      65                 :            :         case XML_obj :
      66                 :          0 :             return "obj";
      67                 :            :         case XML_body :
      68                 :          0 :             return "body";
      69                 :            :         case XML_dt :
      70                 :          0 :             return "dt";
      71                 :            :         case XML_hdr :
      72                 :          0 :             return "hdr";
      73                 :            :         case XML_ftr :
      74                 :          0 :             return "frt";
      75                 :            :         case XML_sldNum :
      76                 :          0 :             return "sldNum";
      77                 :            :         case XML_sldImg :
      78                 :          0 :             return "sldImg";
      79                 :            :     }
      80                 :            : 
      81                 :          0 :     return "unknown - please extend lclDebugSubType";
      82                 :            : }
      83                 :            : 
      84                 :          0 : oox::drawingml::TextListStylePtr PPTShape::getSubTypeTextListStyle( const SlidePersist& rSlidePersist, sal_Int32 nSubType )
      85                 :            : {
      86                 :          0 :     oox::drawingml::TextListStylePtr pTextListStyle;
      87                 :            : 
      88                 :            :     OSL_TRACE( "subtype style: %s", lclDebugSubType( nSubType ) );
      89                 :            : 
      90   [ #  #  #  # ]:          0 :     switch( nSubType )
      91                 :            :     {
      92                 :            :         case XML_ctrTitle :
      93                 :            :         case XML_title :
      94                 :            :         case XML_subTitle :
      95 [ #  # ][ #  # ]:          0 :             pTextListStyle = rSlidePersist.getMasterPersist().get() ? rSlidePersist.getMasterPersist()->getTitleTextStyle() : rSlidePersist.getTitleTextStyle();
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
      96                 :          0 :             break;
      97                 :            :         case XML_obj :
      98 [ #  # ][ #  # ]:          0 :             pTextListStyle = rSlidePersist.getMasterPersist().get() ? rSlidePersist.getMasterPersist()->getBodyTextStyle() : rSlidePersist.getBodyTextStyle();
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
      99                 :          0 :             break;
     100                 :            :         case XML_body :
     101         [ #  # ]:          0 :             if ( rSlidePersist.isNotesPage() )
     102 [ #  # ][ #  # ]:          0 :                 pTextListStyle = rSlidePersist.getMasterPersist().get() ? rSlidePersist.getMasterPersist()->getNotesTextStyle() : rSlidePersist.getNotesTextStyle();
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     103                 :            :             else
     104 [ #  # ][ #  # ]:          0 :                 pTextListStyle = rSlidePersist.getMasterPersist().get() ? rSlidePersist.getMasterPersist()->getBodyTextStyle() : rSlidePersist.getBodyTextStyle();
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     105                 :          0 :             break;
     106                 :            :     }
     107                 :            : 
     108                 :          0 :     return pTextListStyle;
     109                 :            : }
     110                 :            : 
     111                 :        108 : void PPTShape::addShape(
     112                 :            :         oox::core::XmlFilterBase& rFilterBase,
     113                 :            :         SlidePersist& rSlidePersist,
     114                 :            :         const oox::drawingml::Theme* pTheme,
     115                 :            :         const Reference< XShapes >& rxShapes,
     116                 :            :         basegfx::B2DHomMatrix& aTransformation,
     117                 :            :         const awt::Rectangle* pShapeRect,
     118                 :            :         ::oox::drawingml::ShapeIdMap* pShapeMap )
     119                 :            : {
     120                 :            :     OSL_TRACE("add shape id: %s location: %s subtype: %d service: %s", rtl::OUStringToOString(msId, RTL_TEXTENCODING_UTF8 ).getStr(), meShapeLocation == Master ? "master" : meShapeLocation == Slide ? "slide" : meShapeLocation == Layout ? "layout" : "other", mnSubType, rtl::OUStringToOString(msServiceName, RTL_TEXTENCODING_UTF8 ).getStr());
     121                 :            :     // only placeholder from layout are being inserted
     122 [ +  + ][ +  + ]:        108 :     if ( mnSubType && ( meShapeLocation == Master ) )
     123                 :        108 :         return;
     124                 :            :     try
     125                 :            :     {
     126                 :         63 :         rtl::OUString sServiceName( msServiceName );
     127         [ +  - ]:         63 :         if( !sServiceName.isEmpty() )
     128                 :            :         {
     129         [ +  - ]:         63 :             oox::drawingml::TextListStylePtr aMasterTextListStyle;
     130 [ +  - ][ +  - ]:         63 :             Reference< lang::XMultiServiceFactory > xServiceFact( rFilterBase.getModel(), UNO_QUERY_THROW );
     131                 :         63 :             sal_Bool bClearText = sal_False;
     132                 :            : 
     133   [ +  +  +  - ]:        123 :             if ( sServiceName != "com.sun.star.drawing.GraphicObjectShape" &&
                 [ +  + ]
     134                 :         60 :                  sServiceName != "com.sun.star.drawing.OLE2Shape" )
     135                 :            :             {
     136                 :         60 :                 const rtl::OUString sOutlinerShapeService( "com.sun.star.presentation.OutlinerShape"  );
     137                 :            :                 OSL_TRACE("has master: %p", rSlidePersist.getMasterPersist().get());
     138   [ +  +  -  +  :         60 :                 switch( mnSubType )
          +  -  +  +  +  
             -  -  -  -  
                      + ]
     139                 :            :                 {
     140                 :            :                     case XML_ctrTitle :
     141                 :            :                     case XML_title :
     142                 :            :                     {
     143                 :          9 :                         sServiceName = "com.sun.star.presentation.TitleTextShape";
     144 [ -  + ][ #  # ]:          9 :                         aMasterTextListStyle = rSlidePersist.getMasterPersist().get() ? rSlidePersist.getMasterPersist()->getTitleTextStyle() : rSlidePersist.getTitleTextStyle();
         [ #  # ][ +  - ]
         [ +  - ][ +  - ]
         [ -  + ][ #  # ]
           [ +  -  #  # ]
                 [ +  - ]
     145                 :            :                     }
     146                 :          9 :                     break;
     147                 :            :                     case XML_subTitle :
     148                 :            :                     {
     149 [ +  - ][ +  - ]:          6 :                         if ( ( meShapeLocation == Master ) || ( meShapeLocation == Layout ) )
     150                 :          6 :                             sServiceName = rtl::OUString();
     151                 :            :                         else {
     152                 :          0 :                             sServiceName = "com.sun.star.presentation.SubtitleShape";
     153 [ #  # ][ #  # ]:          0 :                             aMasterTextListStyle = rSlidePersist.getMasterPersist().get() ? rSlidePersist.getMasterPersist()->getTitleTextStyle() : rSlidePersist.getTitleTextStyle();
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     154                 :            :                         }
     155                 :            :                     }
     156                 :          6 :                     break;
     157                 :            :                        case XML_obj :
     158                 :            :                     {
     159                 :          0 :                         sServiceName = sOutlinerShapeService;
     160 [ #  # ][ #  # ]:          0 :                         aMasterTextListStyle = rSlidePersist.getMasterPersist().get() ? rSlidePersist.getMasterPersist()->getBodyTextStyle() : rSlidePersist.getBodyTextStyle();
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     161                 :            :                     }
     162                 :          0 :                     break;
     163                 :            :                     case XML_body :
     164                 :            :                     {
     165         [ +  + ]:          6 :                         if ( rSlidePersist.isNotesPage() )
     166                 :            :                         {
     167                 :          3 :                             sServiceName = "com.sun.star.presentation.NotesShape";
     168 [ +  - ][ +  - ]:          3 :                             aMasterTextListStyle = rSlidePersist.getMasterPersist().get() ? rSlidePersist.getMasterPersist()->getNotesTextStyle() : rSlidePersist.getNotesTextStyle();
         [ +  - ][ #  # ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ #  # ]
                 [ +  - ]
     169                 :            :                         }
     170                 :            :                         else
     171                 :            :                         {
     172                 :          3 :                             sServiceName = sOutlinerShapeService;
     173 [ +  - ][ +  - ]:          3 :                             aMasterTextListStyle = rSlidePersist.getMasterPersist().get() ? rSlidePersist.getMasterPersist()->getBodyTextStyle() : rSlidePersist.getBodyTextStyle();
         [ +  - ][ #  # ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ #  # ]
                 [ +  - ]
     174                 :            :                         }
     175                 :            :                     }
     176                 :          6 :                     break;
     177                 :            :                     case XML_dt :
     178                 :          3 :                         sServiceName = "com.sun.star.presentation.DateTimeShape";
     179                 :          3 :                         bClearText = sal_True;
     180                 :          3 :                     break;
     181                 :            :                     case XML_hdr :
     182                 :          0 :                         sServiceName = "com.sun.star.presentation.HeaderShape";
     183                 :          0 :                         bClearText = sal_True;
     184                 :          0 :                     break;
     185                 :            :                     case XML_ftr :
     186                 :          6 :                         sServiceName = "com.sun.star.presentation.FooterShape";
     187                 :          6 :                         bClearText = sal_True;
     188                 :          6 :                     break;
     189                 :            :                     case XML_sldNum :
     190                 :          9 :                         sServiceName = "com.sun.star.presentation.SlideNumberShape";
     191                 :          9 :                         bClearText = sal_True;
     192                 :          9 :                     break;
     193                 :            :                     case XML_sldImg :
     194                 :          3 :                         sServiceName = "com.sun.star.presentation.PageShape";
     195                 :          3 :                     break;
     196                 :            :                     case XML_chart :
     197         [ #  # ]:          0 :                         if ( meShapeLocation == Layout )
     198                 :          0 :                             sServiceName = sOutlinerShapeService;
     199                 :            :                         else
     200                 :          0 :                             sServiceName = "com.sun.star.presentation.ChartShape";
     201                 :          0 :                     break;
     202                 :            :                     case XML_tbl :
     203         [ #  # ]:          0 :                         if ( meShapeLocation == Layout )
     204                 :          0 :                             sServiceName = sOutlinerShapeService;
     205                 :            :                         else
     206                 :          0 :                             sServiceName = "com.sun.star.presentation.TableShape";
     207                 :          0 :                     break;
     208                 :            :                     case XML_pic :
     209         [ #  # ]:          0 :                         if ( meShapeLocation == Layout )
     210                 :          0 :                             sServiceName = sOutlinerShapeService;
     211                 :            :                         else
     212                 :          0 :                             sServiceName = "com.sun.star.presentation.GraphicObjectShape";
     213                 :          0 :                     break;
     214                 :            :                     case XML_media :
     215         [ #  # ]:          0 :                         if ( meShapeLocation == Layout )
     216                 :          0 :                             sServiceName = sOutlinerShapeService;
     217                 :            :                         else
     218                 :          0 :                             sServiceName = "com.sun.star.presentation.MediaShape";
     219                 :          0 :                     break;
     220                 :            :                     default:
     221 [ -  + ][ #  # ]:         18 :                         if ( mnSubType && meShapeLocation == Layout )
     222                 :          0 :                             sServiceName = sOutlinerShapeService;
     223                 :         18 :                     break;
     224                 :         60 :                 }
     225                 :            :             }
     226                 :            : 
     227                 :            :             OSL_TRACE("shape service: %s", rtl::OUStringToOString(sServiceName, RTL_TEXTENCODING_UTF8 ).getStr());
     228                 :            : 
     229 [ +  + ][ +  + ]:         63 :             if( mnSubType && getSubTypeIndex().has() && meShapeLocation == Layout ) {
         [ +  + ][ +  + ]
     230 [ +  - ][ +  - ]:         18 :                 oox::drawingml::ShapePtr pPlaceholder = PPTShape::findPlaceholderByIndex( getSubTypeIndex().get(), rSlidePersist.getShapes()->getChildren(), true );
                 [ +  - ]
     231         [ +  + ]:         18 :                 if (!pPlaceholder.get())
     232 [ +  - ][ +  - ]:         15 :                     pPlaceholder = PPTShape::findPlaceholder( mnSubType, rSlidePersist.getShapes()->getChildren(), true );
         [ +  - ][ +  - ]
                 [ +  - ]
     233                 :            : 
     234         [ +  - ]:         18 :                 if (pPlaceholder.get()) {
     235 [ +  - ][ -  + ]:         18 :                     if( maSize.Width == 0 || maSize.Height == 0 ) {
     236                 :          0 :                         awt::Size aSize = maSize;
     237         [ #  # ]:          0 :                         if( maSize.Width == 0 )
     238                 :          0 :                             aSize.Width = pPlaceholder->getSize().Width;
     239         [ #  # ]:          0 :                         if( maSize.Height == 0 )
     240                 :          0 :                             aSize.Height = pPlaceholder->getSize().Height;
     241                 :          0 :                         setSize( aSize );
     242 [ #  # ][ #  # ]:          0 :                         if ( maPosition.X == 0 || maPosition.Y == 0 ) {
     243                 :          0 :                             awt::Point aPosition = maPosition;
     244         [ #  # ]:          0 :                             if( maPosition.X == 0 )
     245                 :          0 :                                 aPosition.X = pPlaceholder->getPosition().X;
     246         [ #  # ]:          0 :                             if( maPosition.Y == 0 )
     247                 :          0 :                                 aPosition.Y = pPlaceholder->getPosition().Y;
     248                 :          0 :                             setPosition( aPosition );
     249                 :            :                         }
     250                 :            :                     }
     251         [ +  - ]:         18 :                 }
     252                 :            :             }
     253                 :            : 
     254                 :            :             // use placeholder index if possible
     255 [ +  + ][ +  + ]:         63 :             if( mnSubType && getSubTypeIndex().has() && rSlidePersist.getMasterPersist().get() ) {
         [ +  - ][ +  + ]
         [ +  + ][ +  - ]
           [ +  +  #  # ]
     256 [ +  - ][ +  - ]:          9 :                 oox::drawingml::ShapePtr pPlaceholder = PPTShape::findPlaceholderByIndex( getSubTypeIndex().get(), rSlidePersist.getMasterPersist()->getShapes()->getChildren() );
         [ +  - ][ +  - ]
                 [ +  - ]
     257                 :            :                 // TODO: Check if this is required for non-notes slides as well...
     258 [ +  + ][ +  + ]:          9 :                 if( rSlidePersist.isNotesPage() && pPlaceholder.get() && pPlaceholder->getSubType() != getSubType() )
         [ +  - ][ +  + ]
     259         [ +  - ]:          3 :                     pPlaceholder.reset();
     260                 :            : 
     261                 :          9 :                 if( pPlaceholder.get()) {
     262                 :            :                     OSL_TRACE("found placeholder with index: %d and type: %s", getSubTypeIndex().get(), lclDebugSubType( mnSubType ));
     263                 :            :                 }
     264         [ -  + ]:          9 :                 if( pPlaceholder.get() ) {
     265         [ #  # ]:          0 :                     PPTShape* pPPTPlaceholder = dynamic_cast< PPTShape* >( pPlaceholder.get() );
     266 [ #  # ][ #  # ]:          0 :                     TextListStylePtr pNewTextListStyle ( new TextListStyle() );
                 [ #  # ]
     267                 :            : 
     268 [ #  # ][ #  # ]:          0 :                     if( pPlaceholder->getTextBody() ) {
                 [ #  # ]
     269                 :            : 
     270 [ #  # ][ #  # ]:          0 :                         pNewTextListStyle->apply( pPlaceholder->getTextBody()->getTextListStyle() );
                 [ #  # ]
     271 [ #  # ][ #  # ]:          0 :                         if( pPlaceholder->getMasterTextListStyle().get() )
                 [ #  # ]
     272 [ #  # ][ #  # ]:          0 :                             pNewTextListStyle->apply( *pPlaceholder->getMasterTextListStyle() );
                 [ #  # ]
     273                 :            : 
     274                 :            :                         // OSL_TRACE("placeholder body style");
     275                 :            :                         // pPlaceholder->getTextBody()->getTextListStyle().dump();
     276                 :            :                         // OSL_TRACE("master text list style");
     277                 :            :                         // pPlaceholder->getMasterTextListStyle()->dump();
     278                 :            : 
     279         [ #  # ]:          0 :                         aMasterTextListStyle = pNewTextListStyle;
     280                 :            :                         // OSL_TRACE("combined master text list style");
     281                 :            :                         // aMasterTextListStyle->dump();
     282                 :            :                     }
     283         [ #  # ]:          0 :                     if( pPPTPlaceholder->mpPlaceholder.get() ) {
     284                 :            :                         OSL_TRACE("placeholder has parent placeholder: %s type: %s index: %d",
     285                 :            :                                   rtl::OUStringToOString( pPPTPlaceholder->mpPlaceholder->getId(), RTL_TEXTENCODING_UTF8 ).getStr(),
     286                 :            :                                   lclDebugSubType( pPPTPlaceholder->mpPlaceholder->getSubType() ),
     287                 :            :                                   pPPTPlaceholder->mpPlaceholder->getSubTypeIndex().get() );
     288                 :            :                         OSL_TRACE("has textbody %d", pPPTPlaceholder->mpPlaceholder->getTextBody() != NULL );
     289         [ #  # ]:          0 :                         TextListStylePtr pPlaceholderStyle = getSubTypeTextListStyle( rSlidePersist, pPPTPlaceholder->mpPlaceholder->getSubType() );
     290 [ #  # ][ #  # ]:          0 :                         if( pPPTPlaceholder->mpPlaceholder->getTextBody() )
                 [ #  # ]
     291 [ #  # ][ #  # ]:          0 :                             pNewTextListStyle->apply( pPPTPlaceholder->mpPlaceholder->getTextBody()->getTextListStyle() );
                 [ #  # ]
     292         [ #  # ]:          0 :                         if( pPlaceholderStyle.get() ) {
     293         [ #  # ]:          0 :                             pNewTextListStyle->apply( *pPlaceholderStyle );
     294                 :            :                             //pPlaceholderStyle->dump();
     295         [ #  # ]:          0 :                         }
     296         [ #  # ]:          0 :                     }
     297         [ -  + ]:          9 :                 } else if( !mpPlaceholder.get() ) {
     298         [ #  # ]:          0 :                     aMasterTextListStyle.reset();
     299                 :            :                 }
     300         [ +  - ]:          9 :                 OSL_TRACE("placeholder id: %s", pPlaceholder.get() ? rtl::OUStringToOString(pPlaceholder->getId(), RTL_TEXTENCODING_UTF8 ).getStr() : "not found");
     301                 :            :             }
     302                 :            : 
     303         [ +  + ]:         63 :             if ( !sServiceName.isEmpty() )
     304                 :            :             {
     305         [ +  + ]:         57 :                 if ( !aMasterTextListStyle.get() )
     306                 :            :                 {
     307 [ +  - ][ +  + ]:         42 :                     bool isOther = !getTextBody().get() && !sServiceName.equalsAscii("com.sun.star.drawing.GroupShape");
         [ +  - ][ +  - ]
         [ +  - ][ #  # ]
     308 [ +  + ][ +  - ]:         42 :                     TextListStylePtr aSlideStyle = isOther ? rSlidePersist.getOtherTextStyle() : rSlidePersist.getDefaultTextStyle();
                 [ +  - ]
     309                 :            :                     // Combine from MasterSlide details as well.
     310 [ +  - ][ +  - ]:         42 :                     if( rSlidePersist.getMasterPersist().get() )
                 [ +  + ]
     311                 :            :                     {
     312 [ +  + ][ +  - ]:         27 :                         aMasterTextListStyle = isOther ? rSlidePersist.getMasterPersist()->getOtherTextStyle() : rSlidePersist.getMasterPersist()->getDefaultTextStyle();
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  + ]
         [ +  - ][ +  + ]
                 [ +  - ]
           [ #  #  #  # ]
     313         [ +  - ]:         27 :                         if( aSlideStyle.get() )
     314         [ +  - ]:         27 :                             aMasterTextListStyle->apply( *aSlideStyle.get() );
     315                 :            :                     }
     316                 :            :                     else
     317                 :            :                     {
     318         [ +  - ]:         15 :                         aMasterTextListStyle = aSlideStyle;
     319         [ +  - ]:         42 :                     }
     320                 :            :                 }
     321                 :            : 
     322 [ +  - ][ +  - ]:         57 :             if( aMasterTextListStyle.get() && getTextBody().get() ) {
         [ +  + ][ +  - ]
                 [ +  - ]
           [ +  +  #  # ]
     323 [ +  - ][ +  - ]:         42 :                 TextListStylePtr aCombinedTextListStyle (new TextListStyle());
                 [ +  - ]
     324                 :            : 
     325         [ +  - ]:         42 :                 aCombinedTextListStyle->apply( *aMasterTextListStyle.get() );
     326                 :            : 
     327 [ +  + ][ +  - ]:         42 :                 if( mpPlaceholder.get() && mpPlaceholder->getTextBody().get() )
         [ +  - ][ +  + ]
                 [ +  - ]
           [ +  +  #  # ]
     328 [ +  - ][ +  - ]:         36 :                     aCombinedTextListStyle->apply( mpPlaceholder->getTextBody()->getTextListStyle() );
                 [ +  - ]
     329 [ +  - ][ +  - ]:         42 :                 aCombinedTextListStyle->apply( getTextBody()->getTextListStyle() );
                 [ +  - ]
     330                 :            : 
     331 [ +  - ][ +  - ]:         42 :                 setMasterTextListStyle( aCombinedTextListStyle );
     332                 :            :             } else
     333         [ +  - ]:         15 :                 setMasterTextListStyle( aMasterTextListStyle );
     334                 :            : 
     335         [ +  - ]:         57 :             Reference< XShape > xShape( createAndInsert( rFilterBase, sServiceName, pTheme, rxShapes, pShapeRect, bClearText, mpPlaceholder.get() != NULL, aTransformation ) );
     336 [ +  + ][ +  - ]:         57 :                 if ( !rSlidePersist.isMasterPage() && rSlidePersist.getPage().is() && ( (sal_Int32)mnSubType == XML_title ) )
         [ +  - ][ -  + ]
                 [ +  + ]
           [ -  +  #  # ]
     337                 :            :                  {
     338                 :            :                     try
     339                 :            :                     {
     340                 :          0 :                         rtl::OUString aTitleText;
     341         [ #  # ]:          0 :                         Reference< XTextRange > xText( xShape, UNO_QUERY_THROW );
     342 [ #  # ][ #  # ]:          0 :                         aTitleText = xText->getString();
     343 [ #  # ][ #  # ]:          0 :                         if ( !aTitleText.isEmpty() && ( aTitleText.getLength() < 64 ) )    // just a magic value, but we don't want to set slide names which are too long
                 [ #  # ]
     344                 :            :                         {
     345 [ #  # ][ #  # ]:          0 :                             Reference< container::XNamed > xName( rSlidePersist.getPage(), UNO_QUERY_THROW );
     346 [ #  # ][ #  # ]:          0 :                             xName->setName( aTitleText );
     347         [ #  # ]:          0 :                         }
     348                 :            :                     }
     349         [ #  # ]:          0 :                     catch( uno::Exception& )
     350                 :            :                     {
     351                 :            : 
     352                 :            :                     }
     353                 :            :                 }
     354 [ +  - ][ +  - ]:         57 :                 if( pShapeMap && !msId.isEmpty() )
                 [ +  - ]
     355                 :            :                 {
     356 [ +  - ][ +  - ]:         57 :                     (*pShapeMap)[ msId ] = shared_from_this();
         [ +  - ][ +  - ]
     357                 :            :                 }
     358                 :            : 
     359                 :            :                 // if this is a group shape, we have to add also each child shape
     360         [ +  - ]:         57 :                 Reference< XShapes > xShapes( xShape, UNO_QUERY );
     361         [ -  + ]:         57 :                 if ( xShapes.is() )
     362 [ #  # ][ #  # ]:         57 :                     addChildren( rFilterBase, *this, pTheme, xShapes, pShapeRect ? *pShapeRect : awt::Rectangle( maPosition.X, maPosition.Y, maSize.Width, maSize.Height ), pShapeMap, aTransformation );
     363         [ +  - ]:         63 :             }
     364         [ #  # ]:         63 :         }
     365                 :            :     }
     366                 :          0 :     catch( const Exception&  )
     367                 :            :     {
     368                 :            :     }
     369                 :            : }
     370                 :            : 
     371                 :         42 : void PPTShape::applyShapeReference( const oox::drawingml::Shape& rReferencedShape, bool bUseText )
     372                 :            : {
     373                 :         42 :     Shape::applyShapeReference( rReferencedShape, bUseText );
     374                 :         42 : }
     375                 :            : 
     376                 :        120 : oox::drawingml::ShapePtr PPTShape::findPlaceholder( const sal_Int32 nMasterPlaceholder, std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly )
     377                 :            : {
     378         [ +  - ]:        120 :     oox::drawingml::ShapePtr aShapePtr;
     379                 :        120 :     std::vector< oox::drawingml::ShapePtr >::reverse_iterator aRevIter( rShapes.rbegin() );
     380 [ +  - ][ +  + ]:        240 :     while( aRevIter != rShapes.rend() )
     381                 :            :     {
     382 [ +  - ][ +  + ]:        180 :         if ( (*aRevIter)->getSubType() == nMasterPlaceholder &&
           [ +  -  +  -  
           +  + ][ +  + ]
     383                 :         30 :              ( !bMasterOnly ||
     384 [ +  - ][ +  - ]:         60 :                ( dynamic_cast< PPTShape* >( (*aRevIter).get() ) && dynamic_cast< PPTShape* >( (*aRevIter).get() )->getShapeLocation() == Master ) ) )
         [ +  - ][ -  + ]
     385                 :            :         {
     386 [ +  - ][ +  - ]:         15 :             aShapePtr = *aRevIter;
     387                 :         15 :             break;
     388                 :            :         }
     389         [ +  - ]:        105 :         std::vector< oox::drawingml::ShapePtr >& rChildren = (*aRevIter)->getChildren();
     390 [ +  - ][ +  - ]:        105 :         aShapePtr = findPlaceholder( nMasterPlaceholder, rChildren, bMasterOnly );
                 [ +  - ]
     391         [ +  + ]:        105 :         if ( aShapePtr.get() )
     392                 :         15 :             break;
     393         [ +  - ]:         90 :         ++aRevIter;
     394                 :            :     }
     395                 :        120 :     return aShapePtr;
     396                 :            : }
     397                 :            : 
     398                 :        486 : oox::drawingml::ShapePtr PPTShape::findPlaceholderByIndex( const sal_Int32 nIdx, std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly )
     399                 :            : {
     400         [ +  - ]:        486 :     oox::drawingml::ShapePtr aShapePtr;
     401                 :            : 
     402                 :        486 :     std::vector< oox::drawingml::ShapePtr >::reverse_iterator aRevIter( rShapes.rbegin() );
     403 [ +  - ][ +  + ]:        930 :     while( aRevIter != rShapes.rend() )
     404                 :            :     {
     405 [ +  - ][ +  + ]:        486 :         if ( (*aRevIter)->getSubTypeIndex().has() && (*aRevIter)->getSubTypeIndex().get() == nIdx &&
         [ +  - ][ +  + ]
           [ +  +  +  -  
           +  + ][ +  + ]
     406                 :         30 :              ( !bMasterOnly ||
     407 [ +  - ][ +  - ]:         42 :                ( dynamic_cast< PPTShape* >( (*aRevIter).get() ) && dynamic_cast< PPTShape* >( (*aRevIter).get() )->getShapeLocation() == Master ) ) )
         [ +  - ][ -  + ]
     408                 :            :         {
     409 [ +  - ][ +  - ]:         12 :             aShapePtr = *aRevIter;
     410                 :         12 :             break;
     411                 :            :         }
     412         [ +  - ]:        432 :         std::vector< oox::drawingml::ShapePtr >& rChildren = (*aRevIter)->getChildren();
     413 [ +  - ][ +  - ]:        432 :         aShapePtr = findPlaceholderByIndex( nIdx, rChildren, bMasterOnly );
                 [ +  - ]
     414         [ +  + ]:        432 :         if ( aShapePtr.get() )
     415                 :         12 :             break;
     416         [ +  - ]:        420 :         ++aRevIter;
     417                 :            :     }
     418                 :        486 :     return aShapePtr;
     419                 :            : }
     420                 :            : 
     421 [ +  - ][ +  - ]:        285 : } }
     422                 :            : 
     423                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10