LCOV - code coverage report
Current view: top level - sdext/source/minimizer - graphiccollector.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 229 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 11 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             : 
      21             : #include "graphiccollector.hxx"
      22             : #include <com/sun/star/awt/XDevice.hpp>
      23             : #include <com/sun/star/frame/Desktop.hpp>
      24             : #include <com/sun/star/frame/XFramesSupplier.hpp>
      25             : #include <com/sun/star/drawing/FillStyle.hpp>
      26             : #include <com/sun/star/drawing/BitmapMode.hpp>
      27             : #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
      28             : #include <com/sun/star/presentation/XPresentationPage.hpp>
      29             : #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
      30             : 
      31             : #include "impoptimizer.hxx"
      32             : 
      33             : using namespace ::com::sun::star;
      34             : using namespace ::com::sun::star::uno;
      35             : using namespace ::com::sun::star::awt;
      36             : using namespace ::com::sun::star::drawing;
      37             : using namespace ::com::sun::star::graphic;
      38             : using namespace ::com::sun::star::frame;
      39             : using namespace ::com::sun::star::beans;
      40             : using namespace ::com::sun::star::presentation;
      41             : 
      42           0 : const DeviceInfo& GraphicCollector::GetDeviceInfo( const Reference< XComponentContext >& rxFact )
      43             : {
      44           0 :     static DeviceInfo aDeviceInfo;
      45           0 :     if( !aDeviceInfo.Width )
      46             :     {
      47             :         try
      48             :         {
      49           0 :             Reference< XDesktop2 > xDesktop = Desktop::create( rxFact );
      50           0 :             Reference< XFrame > xFrame( xDesktop->getActiveFrame() );
      51           0 :             Reference< XWindow > xWindow( xFrame->getContainerWindow() );
      52           0 :             Reference< XDevice > xDevice( xWindow, UNO_QUERY_THROW );
      53           0 :             aDeviceInfo = xDevice->getInfo();
      54             :         }
      55           0 :         catch( Exception& )
      56             :         {
      57             :         }
      58             :     }
      59           0 :     return aDeviceInfo;
      60             : }
      61             : 
      62           0 : void ImpAddEntity( std::vector< GraphicCollector::GraphicEntity >& rGraphicEntities, const GraphicSettings& rGraphicSettings, const GraphicCollector::GraphicUser& rUser )
      63             : {
      64           0 :     const OUString aGraphicURL( rUser.maGraphicURL );
      65           0 :     const OUString sPackageURL( "vnd.sun.star.GraphicObject:" );
      66             : 
      67           0 :     if ( rGraphicSettings.mbEmbedLinkedGraphics || (aGraphicURL.isEmpty() || aGraphicURL.match( sPackageURL, 0 ) ) )
      68             :     {
      69           0 :         std::vector< GraphicCollector::GraphicEntity >::iterator aIter( rGraphicEntities.begin() );
      70           0 :         while( aIter != rGraphicEntities.end() )
      71             :         {
      72           0 :             if ( aIter->maUser[ 0 ].maGraphicURL == aGraphicURL )
      73             :             {
      74           0 :                 if ( rUser.maLogicalSize.Width > aIter->maLogicalSize.Width )
      75           0 :                     aIter->maLogicalSize.Width = rUser.maLogicalSize.Width;
      76           0 :                 if ( rUser.maLogicalSize.Height > aIter->maLogicalSize.Height )
      77           0 :                     aIter->maLogicalSize.Height = rUser.maLogicalSize.Height;
      78           0 :                 aIter->maUser.push_back( rUser );
      79           0 :                 break;
      80             :             }
      81           0 :             ++aIter;
      82             :         }
      83           0 :         if ( aIter == rGraphicEntities.end() )
      84             :         {
      85           0 :             GraphicCollector::GraphicEntity aEntity( rUser );
      86           0 :             rGraphicEntities.push_back( aEntity );
      87             :         }
      88           0 :     }
      89           0 : }
      90             : 
      91           0 : void ImpAddGraphicEntity( const Reference< XComponentContext >& rxMSF, Reference< XShape >& rxShape, const GraphicSettings& rGraphicSettings, std::vector< GraphicCollector::GraphicEntity >& rGraphicEntities )
      92             : {
      93           0 :     Reference< XGraphic > xGraphic;
      94           0 :     Reference< XPropertySet > xShapePropertySet( rxShape, UNO_QUERY_THROW );
      95           0 :     if ( xShapePropertySet->getPropertyValue( "Graphic" ) >>= xGraphic )
      96             :     {
      97           0 :         text::GraphicCrop aGraphicCropLogic( 0, 0, 0, 0 );
      98             : 
      99           0 :         GraphicCollector::GraphicUser aUser;
     100           0 :         aUser.mxShape = rxShape;
     101           0 :         aUser.mbFillBitmap = false;
     102           0 :         xShapePropertySet->getPropertyValue( "GraphicURL" ) >>= aUser.maGraphicURL;
     103           0 :         xShapePropertySet->getPropertyValue( "GraphicStreamURL" ) >>= aUser.maGraphicStreamURL;
     104           0 :         xShapePropertySet->getPropertyValue( "GraphicCrop" ) >>= aGraphicCropLogic;
     105           0 :         awt::Size aLogicalSize( rxShape->getSize() );
     106             : 
     107             :         // calculating the logical size, as if there were no cropping
     108           0 :         if ( aGraphicCropLogic.Left || aGraphicCropLogic.Right || aGraphicCropLogic.Top || aGraphicCropLogic.Bottom )
     109             :         {
     110           0 :             awt::Size aSize100thMM( GraphicCollector::GetOriginalSize( rxMSF, xGraphic ) );
     111           0 :             if ( aSize100thMM.Width && aSize100thMM.Height )
     112             :             {
     113           0 :                 awt::Size aCropSize( aSize100thMM.Width - ( aGraphicCropLogic.Left + aGraphicCropLogic.Right ),
     114           0 :                                      aSize100thMM.Height - ( aGraphicCropLogic.Top + aGraphicCropLogic.Bottom ));
     115           0 :                 if ( aCropSize.Width && aCropSize.Height )
     116             :                 {
     117           0 :                     awt::Size aNewLogSize( static_cast< sal_Int32 >( static_cast< double >( aSize100thMM.Width * aLogicalSize.Width ) / aCropSize.Width ),
     118           0 :                         static_cast< sal_Int32 >( static_cast< double >( aSize100thMM.Height * aLogicalSize.Height ) / aCropSize.Height ) );
     119           0 :                     aLogicalSize = aNewLogSize;
     120             :                 }
     121             :             }
     122             :         }
     123           0 :         aUser.maGraphicCropLogic = aGraphicCropLogic;
     124           0 :         aUser.maLogicalSize = aLogicalSize;
     125           0 :         ImpAddEntity( rGraphicEntities, rGraphicSettings, aUser );
     126           0 :     }
     127           0 : }
     128             : 
     129           0 : void ImpAddFillBitmapEntity( const Reference< XComponentContext >& rxMSF, const Reference< XPropertySet >& rxPropertySet, const awt::Size& rLogicalSize,
     130             :     std::vector< GraphicCollector::GraphicEntity >& rGraphicEntities, const GraphicSettings& rGraphicSettings, const Reference< XPropertySet >& rxPagePropertySet )
     131             : {
     132             :     try
     133             :     {
     134             :         FillStyle eFillStyle;
     135           0 :         if ( rxPropertySet->getPropertyValue( "FillStyle" ) >>= eFillStyle )
     136             :         {
     137           0 :             if ( eFillStyle == FillStyle_BITMAP )
     138             :             {
     139           0 :                 Reference< XBitmap > xFillBitmap;
     140           0 :                 if ( rxPropertySet->getPropertyValue( "FillBitmap" ) >>= xFillBitmap )
     141             :                 {
     142           0 :                     Reference< XGraphic > xGraphic( xFillBitmap, UNO_QUERY_THROW );
     143           0 :                     if ( xGraphic.is() )
     144             :                     {
     145           0 :                         awt::Size aLogicalSize( rLogicalSize );
     146           0 :                         Reference< XPropertySetInfo > axPropSetInfo( rxPropertySet->getPropertySetInfo() );
     147           0 :                         if ( axPropSetInfo.is() )
     148             :                         {
     149           0 :                             if ( axPropSetInfo->hasPropertyByName( "FillBitmapMode" ) )
     150             :                             {
     151             :                                 BitmapMode eBitmapMode;
     152           0 :                                 if ( rxPropertySet->getPropertyValue( "FillBitmapMode" ) >>= eBitmapMode )
     153             :                                 {
     154           0 :                                     if ( ( eBitmapMode == BitmapMode_REPEAT ) || ( eBitmapMode == BitmapMode_NO_REPEAT ) )
     155             :                                     {
     156           0 :                                         bool bLogicalSize = false;
     157           0 :                                         awt::Size aSize( 0, 0 );
     158           0 :                                         if ( ( rxPropertySet->getPropertyValue( "FillBitmapLogicalSize" ) >>= bLogicalSize )
     159           0 :                                           && ( rxPropertySet->getPropertyValue( "FillBitmapSizeX" ) >>= aSize.Width )
     160           0 :                                           && ( rxPropertySet->getPropertyValue( "FillBitmapSizeY" ) >>= aSize.Height ) )
     161             :                                         {
     162           0 :                                             if ( bLogicalSize )
     163             :                                             {
     164           0 :                                                 if ( !aSize.Width || !aSize.Height )
     165             :                                                 {
     166           0 :                                                     awt::Size aSize100thMM( GraphicCollector::GetOriginalSize( rxMSF, xGraphic ) );
     167           0 :                                                     if ( aSize100thMM.Width && aSize100thMM.Height )
     168           0 :                                                         aLogicalSize = aSize100thMM;
     169             :                                                 }
     170             :                                                 else
     171           0 :                                                     aLogicalSize = aSize;
     172             :                                             }
     173             :                                             else
     174             :                                             {
     175           0 :                                                 aLogicalSize.Width = sal::static_int_cast< sal_Int32 >( ( static_cast< double >( aLogicalSize.Width ) * aSize.Width ) / -100.0 );
     176           0 :                                                 aLogicalSize.Height = sal::static_int_cast< sal_Int32 >( ( static_cast< double >( aLogicalSize.Height ) * aSize.Height ) / -100.0 );
     177             :                                             }
     178             :                                         }
     179             :                                     }
     180             :                                 }
     181             :                             }
     182             :                         }
     183           0 :                         GraphicCollector::GraphicUser aUser;
     184           0 :                         aUser.mxPropertySet = rxPropertySet;
     185           0 :                         rxPropertySet->getPropertyValue( "FillBitmapURL" ) >>= aUser.maGraphicURL;
     186           0 :                         aUser.mbFillBitmap = true;
     187           0 :                         aUser.maLogicalSize = aLogicalSize;
     188           0 :                         aUser.mxPagePropertySet = rxPagePropertySet;
     189           0 :                         ImpAddEntity( rGraphicEntities, rGraphicSettings, aUser );
     190           0 :                     }
     191           0 :                 }
     192             :             }
     193             :         }
     194             :     }
     195           0 :     catch( Exception& )
     196             :     {
     197             :     }
     198           0 : }
     199             : 
     200           0 : void ImpCollectBackgroundGraphic( const Reference< XComponentContext >& rxMSF, const Reference< XDrawPage >& rxDrawPage, const GraphicSettings& rGraphicSettings, std::vector< GraphicCollector::GraphicEntity >& rGraphicEntities )
     201             : {
     202             :     try
     203             :     {
     204           0 :         awt::Size aLogicalSize( 28000, 21000 );
     205           0 :         Reference< XPropertySet > xPropertySet( rxDrawPage, UNO_QUERY_THROW );
     206           0 :         xPropertySet->getPropertyValue( "Width" ) >>= aLogicalSize.Width;
     207           0 :         xPropertySet->getPropertyValue( "Height" ) >>= aLogicalSize.Height;
     208             : 
     209           0 :         Reference< XPropertySet > xBackgroundPropSet;
     210           0 :         if ( xPropertySet->getPropertyValue( "Background" ) >>= xBackgroundPropSet )
     211           0 :             ImpAddFillBitmapEntity( rxMSF, xBackgroundPropSet, aLogicalSize, rGraphicEntities, rGraphicSettings, xPropertySet );
     212             :     }
     213           0 :     catch( Exception& )
     214             :     {
     215             :     }
     216           0 : }
     217             : 
     218           0 : void ImpCollectGraphicObjects( const Reference< XComponentContext >& rxMSF, const Reference< XShapes >& rxShapes, const GraphicSettings& rGraphicSettings, std::vector< GraphicCollector::GraphicEntity >& rGraphicEntities )
     219             : {
     220           0 :     for ( sal_Int32 i = 0; i < rxShapes->getCount(); i++ )
     221             :     {
     222             :         try
     223             :         {
     224           0 :             const OUString sGraphicObjectShape( "com.sun.star.drawing.GraphicObjectShape"  );
     225           0 :             const OUString sGroupShape( "com.sun.star.drawing.GroupShape"  );
     226           0 :             Reference< XShape > xShape( rxShapes->getByIndex( i ), UNO_QUERY_THROW );
     227           0 :             const OUString sShapeType( xShape->getShapeType() );
     228           0 :             if ( sShapeType == sGroupShape )
     229             :             {
     230           0 :                 Reference< XShapes > xShapes( xShape, UNO_QUERY_THROW );
     231           0 :                 ImpCollectGraphicObjects( rxMSF, xShapes, rGraphicSettings, rGraphicEntities );
     232           0 :                 continue;
     233             :             }
     234             : 
     235           0 :             if ( sShapeType == sGraphicObjectShape )
     236           0 :                 ImpAddGraphicEntity( rxMSF, xShape, rGraphicSettings, rGraphicEntities );
     237             : 
     238             :             // now check for a fillstyle
     239           0 :             Reference< XPropertySet > xEmptyPagePropSet;
     240           0 :             Reference< XPropertySet > xShapePropertySet( xShape, UNO_QUERY_THROW );
     241           0 :             awt::Size aLogicalSize( xShape->getSize() );
     242           0 :             ImpAddFillBitmapEntity( rxMSF, xShapePropertySet, aLogicalSize, rGraphicEntities, rGraphicSettings, xEmptyPagePropSet );
     243             :         }
     244           0 :         catch( Exception& )
     245             :         {
     246             :         }
     247             :     }
     248           0 : }
     249             : 
     250           0 : awt::Size GraphicCollector::GetOriginalSize( const Reference< XComponentContext >& rxMSF, const Reference< XGraphic >& rxGraphic )
     251             : {
     252           0 :     awt::Size aSize100thMM( 0, 0 );
     253           0 :     Reference< XPropertySet > xGraphicPropertySet( rxGraphic, UNO_QUERY_THROW );
     254           0 :     if ( xGraphicPropertySet->getPropertyValue( "Size100thMM" ) >>= aSize100thMM )
     255             :     {
     256           0 :         if ( !aSize100thMM.Width && !aSize100thMM.Height )
     257             :         {   // MAPMODE_PIXEL USED :-(
     258           0 :             awt::Size aSourceSizePixel( 0, 0 );
     259           0 :             if ( xGraphicPropertySet->getPropertyValue( "SizePixel" ) >>= aSourceSizePixel )
     260             :             {
     261           0 :                 const DeviceInfo& rDeviceInfo( GraphicCollector::GetDeviceInfo( rxMSF ) );
     262           0 :                 if ( rDeviceInfo.PixelPerMeterX && rDeviceInfo.PixelPerMeterY )
     263             :                 {
     264           0 :                     aSize100thMM.Width = static_cast< sal_Int32 >( ( aSourceSizePixel.Width * 100000.0 ) / rDeviceInfo.PixelPerMeterX );
     265           0 :                     aSize100thMM.Height = static_cast< sal_Int32 >( ( aSourceSizePixel.Height * 100000.0 ) / rDeviceInfo.PixelPerMeterY );
     266             :                 }
     267             :             }
     268             :         }
     269             :     }
     270           0 :     return aSize100thMM;
     271             : }
     272             : 
     273           0 : void GraphicCollector::CollectGraphics( const Reference< XComponentContext >& rxMSF, const Reference< XModel >& rxModel,
     274             :         const GraphicSettings& rGraphicSettings, std::vector< GraphicCollector::GraphicEntity >& rGraphicList )
     275             : {
     276             :     try
     277             :     {
     278             :         sal_Int32 i;
     279           0 :         Reference< XDrawPagesSupplier > xDrawPagesSupplier( rxModel, UNO_QUERY_THROW );
     280           0 :         Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY_THROW );
     281           0 :         for ( i = 0; i < xDrawPages->getCount(); i++ )
     282             :         {
     283           0 :             Reference< XDrawPage > xDrawPage( xDrawPages->getByIndex( i ), UNO_QUERY_THROW );
     284           0 :             ImpCollectBackgroundGraphic( rxMSF, xDrawPage, rGraphicSettings, rGraphicList );
     285           0 :             ImpCollectGraphicObjects( rxMSF, xDrawPage, rGraphicSettings, rGraphicList );
     286             : 
     287           0 :             Reference< XPresentationPage > xPresentationPage( xDrawPage, UNO_QUERY_THROW );
     288           0 :             Reference< XDrawPage > xNotesPage( xPresentationPage->getNotesPage() );
     289           0 :             ImpCollectBackgroundGraphic( rxMSF, xNotesPage, rGraphicSettings, rGraphicList );
     290           0 :             ImpCollectGraphicObjects( rxMSF, xNotesPage, rGraphicSettings, rGraphicList );
     291           0 :         }
     292           0 :         Reference< XMasterPagesSupplier > xMasterPagesSupplier( rxModel, UNO_QUERY_THROW );
     293           0 :         Reference< XDrawPages > xMasterPages( xMasterPagesSupplier->getMasterPages(), UNO_QUERY_THROW );
     294           0 :         for ( i = 0; i < xMasterPages->getCount(); i++ )
     295             :         {
     296           0 :             Reference< XDrawPage > xMasterPage( xMasterPages->getByIndex( i ), UNO_QUERY_THROW );
     297           0 :             ImpCollectBackgroundGraphic( rxMSF, xMasterPage, rGraphicSettings, rGraphicList );
     298           0 :             ImpCollectGraphicObjects( rxMSF, xMasterPage, rGraphicSettings, rGraphicList );
     299           0 :         }
     300             : 
     301           0 :         std::vector< GraphicCollector::GraphicEntity >::iterator aGraphicIter( rGraphicList.begin() );
     302           0 :         std::vector< GraphicCollector::GraphicEntity >::iterator aGraphicIEnd( rGraphicList.end() );
     303           0 :         while( aGraphicIter != aGraphicIEnd )
     304             :         {
     305             :             // check if it is possible to remove the crop area
     306           0 :             aGraphicIter->mbRemoveCropArea = rGraphicSettings.mbRemoveCropArea;
     307           0 :             if ( aGraphicIter->mbRemoveCropArea )
     308             :             {
     309           0 :                 std::vector< GraphicCollector::GraphicUser >::iterator aGUIter( aGraphicIter->maUser.begin() );
     310           0 :                 while( aGraphicIter->mbRemoveCropArea && ( aGUIter != aGraphicIter->maUser.end() ) )
     311             :                 {
     312           0 :                     if ( aGUIter->maGraphicCropLogic.Left || aGUIter->maGraphicCropLogic.Top
     313           0 :                         || aGUIter->maGraphicCropLogic.Right || aGUIter->maGraphicCropLogic.Bottom )
     314             :                     {
     315           0 :                         if ( aGUIter == aGraphicIter->maUser.begin() )
     316           0 :                             aGraphicIter->maGraphicCropLogic = aGUIter->maGraphicCropLogic;
     317           0 :                         else if ( ( aGraphicIter->maGraphicCropLogic.Left != aGUIter->maGraphicCropLogic.Left )
     318           0 :                             || ( aGraphicIter->maGraphicCropLogic.Top != aGUIter->maGraphicCropLogic.Top )
     319           0 :                             || ( aGraphicIter->maGraphicCropLogic.Right != aGUIter->maGraphicCropLogic.Right )
     320           0 :                             || ( aGraphicIter->maGraphicCropLogic.Bottom != aGUIter->maGraphicCropLogic.Bottom ) )
     321             :                         {
     322           0 :                             aGraphicIter->mbRemoveCropArea = false;
     323             :                         }
     324             :                     }
     325             :                     else
     326           0 :                         aGraphicIter->mbRemoveCropArea = false;
     327           0 :                     ++aGUIter;
     328             :                 }
     329             :             }
     330           0 :             if ( !aGraphicIter->mbRemoveCropArea )
     331           0 :                 aGraphicIter->maGraphicCropLogic = text::GraphicCrop( 0, 0, 0, 0 );
     332           0 :             ++aGraphicIter;
     333           0 :         }
     334             :     }
     335           0 :     catch ( Exception& )
     336             :     {
     337             :     }
     338           0 : }
     339             : 
     340           0 : void ImpCountGraphicObjects( const Reference< XComponentContext >& rxMSF, const Reference< XShapes >& rxShapes, const GraphicSettings& rGraphicSettings, sal_Int32& rnGraphics )
     341             : {
     342           0 :     for ( sal_Int32 i = 0; i < rxShapes->getCount(); i++ )
     343             :     {
     344             :         try
     345             :         {
     346           0 :             const OUString sGraphicObjectShape( "com.sun.star.drawing.GraphicObjectShape"  );
     347           0 :             const OUString sGroupShape( "com.sun.star.drawing.GroupShape"  );
     348           0 :             Reference< XShape > xShape( rxShapes->getByIndex( i ), UNO_QUERY_THROW );
     349           0 :             const OUString sShapeType( xShape->getShapeType() );
     350           0 :             if ( sShapeType == sGroupShape )
     351             :             {
     352           0 :                 Reference< XShapes > xShapes( xShape, UNO_QUERY_THROW );
     353           0 :                 ImpCountGraphicObjects( rxMSF, xShapes, rGraphicSettings, rnGraphics );
     354           0 :                 continue;
     355             :             }
     356             : 
     357           0 :             if ( sShapeType == sGraphicObjectShape )
     358             :             {
     359           0 :                 rnGraphics++;
     360             :             }
     361             : 
     362             :             // now check for a fillstyle
     363           0 :             Reference< XPropertySet > xEmptyPagePropSet;
     364           0 :             Reference< XPropertySet > xShapePropertySet( xShape, UNO_QUERY_THROW );
     365             :             FillStyle eFillStyle;
     366           0 :             if ( xShapePropertySet->getPropertyValue( "FillStyle" ) >>= eFillStyle )
     367             :             {
     368           0 :                 if ( eFillStyle == FillStyle_BITMAP )
     369             :                 {
     370           0 :                     rnGraphics++;
     371             :                 }
     372           0 :             }
     373             :         }
     374           0 :         catch( Exception& )
     375             :         {
     376             :         }
     377             :     }
     378           0 : }
     379             : 
     380           0 : void ImpCountBackgroundGraphic(
     381             :     const Reference< XDrawPage >& rxDrawPage, sal_Int32& rnGraphics )
     382             : {
     383             :     try
     384             :     {
     385           0 :         awt::Size aLogicalSize( 28000, 21000 );
     386           0 :         Reference< XPropertySet > xPropertySet( rxDrawPage, UNO_QUERY_THROW );
     387           0 :         xPropertySet->getPropertyValue( "Width" ) >>= aLogicalSize.Width;
     388           0 :         xPropertySet->getPropertyValue( "Height" ) >>= aLogicalSize.Height;
     389             : 
     390           0 :         Reference< XPropertySet > xBackgroundPropSet;
     391           0 :         if ( xPropertySet->getPropertyValue( "Background" ) >>= xBackgroundPropSet )
     392             :         {
     393             :             FillStyle eFillStyle;
     394           0 :             if ( xBackgroundPropSet->getPropertyValue( "FillStyle" ) >>= eFillStyle )
     395             :             {
     396           0 :                 if ( eFillStyle == FillStyle_BITMAP )
     397             :                 {
     398           0 :                     rnGraphics++;
     399             :                 }
     400             :             }
     401           0 :         }
     402             :     }
     403           0 :     catch( Exception& )
     404             :     {
     405             :     }
     406           0 : }
     407             : 
     408           0 : void GraphicCollector::CountGraphics( const Reference< XComponentContext >& rxMSF, const Reference< XModel >& rxModel,
     409             :         const GraphicSettings& rGraphicSettings, sal_Int32& rnGraphics )
     410             : {
     411             :     try
     412             :     {
     413             :         sal_Int32 i;
     414           0 :         Reference< XDrawPagesSupplier > xDrawPagesSupplier( rxModel, UNO_QUERY_THROW );
     415           0 :         Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY_THROW );
     416           0 :         for ( i = 0; i < xDrawPages->getCount(); i++ )
     417             :         {
     418           0 :             Reference< XDrawPage > xDrawPage( xDrawPages->getByIndex( i ), UNO_QUERY_THROW );
     419           0 :             ImpCountBackgroundGraphic( xDrawPage, rnGraphics );
     420           0 :             ImpCountGraphicObjects( rxMSF, xDrawPage, rGraphicSettings, rnGraphics );
     421             : 
     422           0 :             Reference< XPresentationPage > xPresentationPage( xDrawPage, UNO_QUERY_THROW );
     423           0 :             Reference< XDrawPage > xNotesPage( xPresentationPage->getNotesPage() );
     424           0 :             ImpCountBackgroundGraphic( xNotesPage, rnGraphics );
     425           0 :             ImpCountGraphicObjects( rxMSF, xNotesPage, rGraphicSettings, rnGraphics );
     426           0 :         }
     427           0 :         Reference< XMasterPagesSupplier > xMasterPagesSupplier( rxModel, UNO_QUERY_THROW );
     428           0 :         Reference< XDrawPages > xMasterPages( xMasterPagesSupplier->getMasterPages(), UNO_QUERY_THROW );
     429           0 :         for ( i = 0; i < xMasterPages->getCount(); i++ )
     430             :         {
     431           0 :             Reference< XDrawPage > xMasterPage( xMasterPages->getByIndex( i ), UNO_QUERY_THROW );
     432           0 :             ImpCountBackgroundGraphic( xMasterPage, rnGraphics );
     433           0 :             ImpCountGraphicObjects( rxMSF, xMasterPage, rGraphicSettings, rnGraphics );
     434           0 :         }
     435             :     }
     436           0 :     catch ( Exception& )
     437             :     {
     438             :     }
     439           0 : }
     440             : 
     441             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11