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

Generated by: LCOV version 1.10