xref: /trunk/main/sdext/source/minimizer/graphiccollector.cxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1  /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sdext.hxx"
30 
31 #include "graphiccollector.hxx"
32 #include <com/sun/star/awt/XDevice.hpp>
33 #include <com/sun/star/frame/XFramesSupplier.hpp>
34 #include <com/sun/star/drawing/FillStyle.hpp>
35 #include <com/sun/star/drawing/BitmapMode.hpp>
36 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
37 #include <com/sun/star/presentation/XPresentationPage.hpp>
38 #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
39 
40 #include "impoptimizer.hxx"
41 
42 using namespace ::rtl;
43 using namespace ::com::sun::star;
44 using namespace ::com::sun::star::uno;
45 using namespace ::com::sun::star::awt;
46 using namespace ::com::sun::star::drawing;
47 using namespace ::com::sun::star::graphic;
48 using namespace ::com::sun::star::frame;
49 using namespace ::com::sun::star::beans;
50 using namespace ::com::sun::star::presentation;
51 
52 const DeviceInfo& GraphicCollector::GetDeviceInfo( const Reference< XComponentContext >& rxFact )
53 {
54     static DeviceInfo aDeviceInfo;
55     if( !aDeviceInfo.Width )
56     {
57         try
58         {
59             Reference< XFramesSupplier > xDesktop( rxFact->getServiceManager()->createInstanceWithContext(
60                     OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ), rxFact ), UNO_QUERY_THROW );
61             Reference< XFrame > xFrame( xDesktop->getActiveFrame() );
62             Reference< XWindow > xWindow( xFrame->getContainerWindow() );
63             Reference< XDevice > xDevice( xWindow, UNO_QUERY_THROW );
64             aDeviceInfo = xDevice->getInfo();
65         }
66         catch( Exception& )
67         {
68         }
69     }
70     return aDeviceInfo;
71 }
72 
73 void ImpAddEntity( std::vector< GraphicCollector::GraphicEntity >& rGraphicEntities, const GraphicSettings& rGraphicSettings, const GraphicCollector::GraphicUser& rUser )
74 {
75     const rtl::OUString aGraphicURL( rUser.maGraphicURL );
76     const rtl::OUString sPackageURL( OUString::createFromAscii( "vnd.sun.star.GraphicObject:" ) );
77 
78     if ( rGraphicSettings.mbEmbedLinkedGraphics || ( !aGraphicURL.getLength() || aGraphicURL.match( sPackageURL, 0 ) ) )
79     {
80         std::vector< GraphicCollector::GraphicEntity >::iterator aIter( rGraphicEntities.begin() );
81         while( aIter != rGraphicEntities.end() )
82         {
83             if ( aIter->maUser[ 0 ].maGraphicURL == aGraphicURL )
84             {
85                 if ( rUser.maLogicalSize.Width > aIter->maLogicalSize.Width )
86                     aIter->maLogicalSize.Width = rUser.maLogicalSize.Width;
87                 if ( rUser.maLogicalSize.Height > aIter->maLogicalSize.Height )
88                     aIter->maLogicalSize.Height = rUser.maLogicalSize.Height;
89                 aIter->maUser.push_back( rUser );
90                 break;
91             }
92             aIter++;
93         }
94         if ( aIter == rGraphicEntities.end() )
95         {
96             GraphicCollector::GraphicEntity aEntity( rUser );
97             rGraphicEntities.push_back( aEntity );
98         }
99     }
100 }
101 
102 void ImpAddGraphicEntity( const Reference< XComponentContext >& rxMSF, Reference< XShape >& rxShape, const GraphicSettings& rGraphicSettings, std::vector< GraphicCollector::GraphicEntity >& rGraphicEntities )
103 {
104     Reference< XGraphic > xGraphic;
105     Reference< XPropertySet > xShapePropertySet( rxShape, UNO_QUERY_THROW );
106     if ( xShapePropertySet->getPropertyValue( TKGet( TK_Graphic ) ) >>= xGraphic )
107     {
108         text::GraphicCrop aGraphicCropLogic( 0, 0, 0, 0 );
109 
110         GraphicCollector::GraphicUser aUser;
111         aUser.mxShape = rxShape;
112         aUser.mbFillBitmap = sal_False;
113         xShapePropertySet->getPropertyValue( TKGet( TK_GraphicURL ) ) >>= aUser.maGraphicURL;
114         xShapePropertySet->getPropertyValue( TKGet( TK_GraphicStreamURL ) ) >>= aUser.maGraphicStreamURL;
115         xShapePropertySet->getPropertyValue( TKGet( TK_GraphicCrop ) ) >>= aGraphicCropLogic;
116         awt::Size aLogicalSize( rxShape->getSize() );
117 
118         // calculating the logical size, as if there were no cropping
119         if ( aGraphicCropLogic.Left || aGraphicCropLogic.Right || aGraphicCropLogic.Top || aGraphicCropLogic.Bottom )
120         {
121             awt::Size aSize100thMM( GraphicCollector::GetOriginalSize( rxMSF, xGraphic ) );
122             if ( aSize100thMM.Width && aSize100thMM.Height )
123             {
124                 awt::Size aCropSize( aSize100thMM.Width - ( aGraphicCropLogic.Left + aGraphicCropLogic.Right ),
125                                      aSize100thMM.Height - ( aGraphicCropLogic.Top + aGraphicCropLogic.Bottom ));
126                 if ( aCropSize.Width && aCropSize.Height )
127                 {
128                     awt::Size aNewLogSize( static_cast< sal_Int32 >( static_cast< double >( aSize100thMM.Width * aLogicalSize.Width ) / aCropSize.Width ),
129                         static_cast< sal_Int32 >( static_cast< double >( aSize100thMM.Height * aLogicalSize.Height ) / aCropSize.Height ) );
130                     aLogicalSize = aNewLogSize;
131                 }
132             }
133         }
134         aUser.maGraphicCropLogic = aGraphicCropLogic;
135         aUser.maLogicalSize = aLogicalSize;
136         ImpAddEntity( rGraphicEntities, rGraphicSettings, aUser );
137     }
138 }
139 
140 void ImpAddFillBitmapEntity( const Reference< XComponentContext >& rxMSF, const Reference< XPropertySet >& rxPropertySet, const awt::Size& rLogicalSize,
141     std::vector< GraphicCollector::GraphicEntity >& rGraphicEntities, const GraphicSettings& rGraphicSettings, const Reference< XPropertySet >& rxPagePropertySet )
142 {
143     try
144     {
145         FillStyle eFillStyle;
146         if ( rxPropertySet->getPropertyValue( TKGet( TK_FillStyle ) ) >>= eFillStyle )
147         {
148             if ( eFillStyle == FillStyle_BITMAP )
149             {
150                 rtl::OUString aFillBitmapURL;
151                 Reference< XBitmap > xFillBitmap;
152                 if ( rxPropertySet->getPropertyValue( TKGet( TK_FillBitmap ) ) >>= xFillBitmap )
153                 {
154                     Reference< XGraphic > xGraphic( xFillBitmap, UNO_QUERY_THROW );
155                     if ( xGraphic.is() )
156                     {
157                         awt::Size aLogicalSize( rLogicalSize );
158                         Reference< XPropertySetInfo > axPropSetInfo( rxPropertySet->getPropertySetInfo() );
159                         if ( axPropSetInfo.is() )
160                         {
161                             if ( axPropSetInfo->hasPropertyByName( TKGet( TK_FillBitmapMode ) ) )
162                             {
163                                 BitmapMode eBitmapMode;
164                                 if ( rxPropertySet->getPropertyValue( TKGet( TK_FillBitmapMode ) ) >>= eBitmapMode )
165                                 {
166                                     if ( ( eBitmapMode == BitmapMode_REPEAT ) || ( eBitmapMode == BitmapMode_NO_REPEAT ) )
167                                     {
168                                         sal_Bool bLogicalSize = sal_False;
169                                         awt::Size aSize( 0, 0 );
170                                         if ( ( rxPropertySet->getPropertyValue( TKGet( TK_FillBitmapLogicalSize ) ) >>= bLogicalSize )
171                                           && ( rxPropertySet->getPropertyValue( TKGet( TK_FillBitmapSizeX ) ) >>= aSize.Width )
172                                           && ( rxPropertySet->getPropertyValue( TKGet( TK_FillBitmapSizeY ) ) >>= aSize.Height ) )
173                                         {
174                                             if ( bLogicalSize )
175                                             {
176                                                 if ( !aSize.Width || !aSize.Height )
177                                                 {
178                                                     awt::Size aSize100thMM( GraphicCollector::GetOriginalSize( rxMSF, xGraphic ) );
179                                                     if ( aSize100thMM.Width && aSize100thMM.Height )
180                                                         aLogicalSize = aSize100thMM;
181                                                 }
182                                                 else
183                                                     aLogicalSize = aSize;
184                                             }
185                                             else
186                                             {
187                                                 aLogicalSize.Width = sal::static_int_cast< sal_Int32 >( ( static_cast< double >( aLogicalSize.Width ) * aSize.Width ) / -100.0 );
188                                                 aLogicalSize.Height = sal::static_int_cast< sal_Int32 >( ( static_cast< double >( aLogicalSize.Height ) * aSize.Height ) / -100.0 );
189                                             }
190                                         }
191                                     }
192                                 }
193                             }
194                         }
195                         GraphicCollector::GraphicUser aUser;
196                         aUser.mxPropertySet = rxPropertySet;
197                         rxPropertySet->getPropertyValue( TKGet( TK_FillBitmapURL ) ) >>= aUser.maGraphicURL;
198                         aUser.mbFillBitmap = sal_True;
199                         aUser.maLogicalSize = aLogicalSize;
200                         aUser.mxPagePropertySet = rxPagePropertySet;
201                         ImpAddEntity( rGraphicEntities, rGraphicSettings, aUser );
202                     }
203                 }
204             }
205         }
206     }
207     catch( Exception& )
208     {
209     }
210 }
211 
212 void ImpCollectBackgroundGraphic( const Reference< XComponentContext >& rxMSF, const Reference< XDrawPage >& rxDrawPage, const GraphicSettings& rGraphicSettings, std::vector< GraphicCollector::GraphicEntity >& rGraphicEntities )
213 {
214     try
215     {
216         awt::Size aLogicalSize( 28000, 21000 );
217         Reference< XPropertySet > xPropertySet( rxDrawPage, UNO_QUERY_THROW );
218         xPropertySet->getPropertyValue( TKGet( TK_Width ) ) >>= aLogicalSize.Width;
219         xPropertySet->getPropertyValue( TKGet( TK_Height ) ) >>= aLogicalSize.Height;
220 
221         Reference< XPropertySet > xBackgroundPropSet;
222         if ( xPropertySet->getPropertyValue( TKGet( TK_Background ) ) >>= xBackgroundPropSet )
223             ImpAddFillBitmapEntity( rxMSF, xBackgroundPropSet, aLogicalSize, rGraphicEntities, rGraphicSettings, xPropertySet );
224     }
225     catch( Exception& )
226     {
227     }
228 }
229 
230 void ImpCollectGraphicObjects( const Reference< XComponentContext >& rxMSF, const Reference< XShapes >& rxShapes, const GraphicSettings& rGraphicSettings, std::vector< GraphicCollector::GraphicEntity >& rGraphicEntities )
231 {
232     for ( sal_Int32 i = 0; i < rxShapes->getCount(); i++ )
233     {
234         try
235         {
236             const OUString sGraphicObjectShape( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.GraphicObjectShape" ) );
237             const OUString sGroupShape( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.GroupShape" ) );
238             Reference< XShape > xShape( rxShapes->getByIndex( i ), UNO_QUERY_THROW );
239             const OUString sShapeType( xShape->getShapeType() );
240             if ( sShapeType == sGroupShape )
241             {
242                 Reference< XShapes > xShapes( xShape, UNO_QUERY_THROW );
243                 ImpCollectGraphicObjects( rxMSF, xShapes, rGraphicSettings, rGraphicEntities );
244                 continue;
245             }
246 
247             if ( sShapeType == sGraphicObjectShape )
248                 ImpAddGraphicEntity( rxMSF, xShape, rGraphicSettings, rGraphicEntities );
249 
250             // now check for a fillstyle
251             Reference< XPropertySet > xEmptyPagePropSet;
252             Reference< XPropertySet > xShapePropertySet( xShape, UNO_QUERY_THROW );
253             awt::Size aLogicalSize( xShape->getSize() );
254             ImpAddFillBitmapEntity( rxMSF, xShapePropertySet, aLogicalSize, rGraphicEntities, rGraphicSettings, xEmptyPagePropSet );
255         }
256         catch( Exception& )
257         {
258         }
259     }
260 }
261 
262 awt::Size GraphicCollector::GetOriginalSize( const Reference< XComponentContext >& rxMSF, const Reference< XGraphic >& rxGraphic )
263 {
264     awt::Size aSize100thMM( 0, 0 );
265     Reference< XPropertySet > xGraphicPropertySet( rxGraphic, UNO_QUERY_THROW );
266     if ( xGraphicPropertySet->getPropertyValue( TKGet( TK_Size100thMM ) ) >>= aSize100thMM )
267     {
268         if ( !aSize100thMM.Width && !aSize100thMM.Height )
269         {   // MAPMODE_PIXEL USED :-(
270             awt::Size aSourceSizePixel( 0, 0 );
271             if ( xGraphicPropertySet->getPropertyValue( TKGet( TK_SizePixel ) ) >>= aSourceSizePixel )
272             {
273                 const DeviceInfo& rDeviceInfo( GraphicCollector::GetDeviceInfo( rxMSF ) );
274                 if ( rDeviceInfo.PixelPerMeterX && rDeviceInfo.PixelPerMeterY )
275                 {
276                     aSize100thMM.Width = static_cast< sal_Int32 >( ( aSourceSizePixel.Width * 100000.0 ) / rDeviceInfo.PixelPerMeterX );
277                     aSize100thMM.Height = static_cast< sal_Int32 >( ( aSourceSizePixel.Height * 100000.0 ) / rDeviceInfo.PixelPerMeterY );
278                 }
279             }
280         }
281     }
282     return aSize100thMM;
283 }
284 
285 void GraphicCollector::CollectGraphics( const Reference< XComponentContext >& rxMSF, const Reference< XModel >& rxModel,
286         const GraphicSettings& rGraphicSettings, std::vector< GraphicCollector::GraphicEntity >& rGraphicList )
287 {
288     try
289     {
290         sal_Int32 i;
291         Reference< XDrawPagesSupplier > xDrawPagesSupplier( rxModel, UNO_QUERY_THROW );
292         Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY_THROW );
293         for ( i = 0; i < xDrawPages->getCount(); i++ )
294         {
295             Reference< XDrawPage > xDrawPage( xDrawPages->getByIndex( i ), UNO_QUERY_THROW );
296             ImpCollectBackgroundGraphic( rxMSF, xDrawPage, rGraphicSettings, rGraphicList );
297             Reference< XShapes > xDrawShapes( xDrawPage, UNO_QUERY_THROW );
298             ImpCollectGraphicObjects( rxMSF, xDrawShapes, rGraphicSettings, rGraphicList );
299 
300             Reference< XPresentationPage > xPresentationPage( xDrawPage, UNO_QUERY_THROW );
301             Reference< XDrawPage > xNotesPage( xPresentationPage->getNotesPage() );
302             ImpCollectBackgroundGraphic( rxMSF, xNotesPage, rGraphicSettings, rGraphicList );
303             Reference< XShapes > xNotesShapes( xNotesPage, UNO_QUERY_THROW );
304             ImpCollectGraphicObjects( rxMSF, xNotesShapes, rGraphicSettings, rGraphicList );
305         }
306         Reference< XMasterPagesSupplier > xMasterPagesSupplier( rxModel, UNO_QUERY_THROW );
307         Reference< XDrawPages > xMasterPages( xMasterPagesSupplier->getMasterPages(), UNO_QUERY_THROW );
308         for ( i = 0; i < xMasterPages->getCount(); i++ )
309         {
310             Reference< XDrawPage > xMasterPage( xMasterPages->getByIndex( i ), UNO_QUERY_THROW );
311             ImpCollectBackgroundGraphic( rxMSF, xMasterPage, rGraphicSettings, rGraphicList );
312             Reference< XShapes > xMasterPageShapes( xMasterPage, UNO_QUERY_THROW );
313             ImpCollectGraphicObjects( rxMSF, xMasterPageShapes, rGraphicSettings, rGraphicList );
314         }
315 
316         std::vector< GraphicCollector::GraphicEntity >::iterator aGraphicIter( rGraphicList.begin() );
317         std::vector< GraphicCollector::GraphicEntity >::iterator aGraphicIEnd( rGraphicList.end() );
318         while( aGraphicIter != aGraphicIEnd )
319         {
320             // check if it is possible to remove the crop area
321             aGraphicIter->mbRemoveCropArea = rGraphicSettings.mbRemoveCropArea;
322             if ( aGraphicIter->mbRemoveCropArea )
323             {
324                 std::vector< GraphicCollector::GraphicUser >::iterator aGUIter( aGraphicIter->maUser.begin() );
325                 while( aGraphicIter->mbRemoveCropArea && ( aGUIter != aGraphicIter->maUser.end() ) )
326                 {
327                     if ( aGUIter->maGraphicCropLogic.Left || aGUIter->maGraphicCropLogic.Top
328                         || aGUIter->maGraphicCropLogic.Right || aGUIter->maGraphicCropLogic.Bottom )
329                     {
330                         if ( aGUIter == aGraphicIter->maUser.begin() )
331                             aGraphicIter->maGraphicCropLogic = aGUIter->maGraphicCropLogic;
332                         else if ( ( aGraphicIter->maGraphicCropLogic.Left != aGUIter->maGraphicCropLogic.Left )
333                             || ( aGraphicIter->maGraphicCropLogic.Top != aGUIter->maGraphicCropLogic.Top )
334                             || ( aGraphicIter->maGraphicCropLogic.Right != aGUIter->maGraphicCropLogic.Right )
335                             || ( aGraphicIter->maGraphicCropLogic.Bottom != aGUIter->maGraphicCropLogic.Bottom ) )
336                         {
337                             aGraphicIter->mbRemoveCropArea = sal_False;
338                         }
339                     }
340                     else
341                         aGraphicIter->mbRemoveCropArea = sal_False;
342                     aGUIter++;
343                 }
344             }
345             if ( !aGraphicIter->mbRemoveCropArea )
346                 aGraphicIter->maGraphicCropLogic = text::GraphicCrop( 0, 0, 0, 0 );
347             aGraphicIter++;
348         }
349     }
350     catch ( Exception& )
351     {
352     }
353 }
354 
355 void ImpCountGraphicObjects( const Reference< XComponentContext >& rxMSF, const Reference< XShapes >& rxShapes, const GraphicSettings& rGraphicSettings, sal_Int32& rnGraphics )
356 {
357     for ( sal_Int32 i = 0; i < rxShapes->getCount(); i++ )
358     {
359         try
360         {
361             const OUString sGraphicObjectShape( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.GraphicObjectShape" ) );
362             const OUString sGroupShape( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.GroupShape" ) );
363             Reference< XShape > xShape( rxShapes->getByIndex( i ), UNO_QUERY_THROW );
364             const OUString sShapeType( xShape->getShapeType() );
365             if ( sShapeType == sGroupShape )
366             {
367                 Reference< XShapes > xShapes( xShape, UNO_QUERY_THROW );
368                 ImpCountGraphicObjects( rxMSF, xShapes, rGraphicSettings, rnGraphics );
369                 continue;
370             }
371 
372             if ( sShapeType == sGraphicObjectShape )
373             {
374                 rnGraphics++;
375             }
376 
377             // now check for a fillstyle
378             Reference< XPropertySet > xEmptyPagePropSet;
379             Reference< XPropertySet > xShapePropertySet( xShape, UNO_QUERY_THROW );
380             awt::Size aLogicalSize( xShape->getSize() );
381 
382             FillStyle eFillStyle;
383             if ( xShapePropertySet->getPropertyValue( TKGet( TK_FillStyle ) ) >>= eFillStyle )
384             {
385                 if ( eFillStyle == FillStyle_BITMAP )
386                 {
387                     rnGraphics++;
388                 }
389             }
390         }
391         catch( Exception& )
392         {
393         }
394     }
395 }
396 
397 void ImpCountBackgroundGraphic( const Reference< XComponentContext >& /* rxMSF */, const Reference< XDrawPage >& rxDrawPage,
398                                const GraphicSettings& /* rGraphicSettings */, sal_Int32& rnGraphics )
399 {
400     try
401     {
402         awt::Size aLogicalSize( 28000, 21000 );
403         Reference< XPropertySet > xPropertySet( rxDrawPage, UNO_QUERY_THROW );
404         xPropertySet->getPropertyValue( TKGet( TK_Width ) ) >>= aLogicalSize.Width;
405         xPropertySet->getPropertyValue( TKGet( TK_Height ) ) >>= aLogicalSize.Height;
406 
407         Reference< XPropertySet > xBackgroundPropSet;
408         if ( xPropertySet->getPropertyValue( TKGet( TK_Background ) ) >>= xBackgroundPropSet )
409         {
410             FillStyle eFillStyle;
411             if ( xBackgroundPropSet->getPropertyValue( TKGet( TK_FillStyle ) ) >>= eFillStyle )
412             {
413                 if ( eFillStyle == FillStyle_BITMAP )
414                 {
415                     rnGraphics++;
416                 }
417             }
418         }
419     }
420     catch( Exception& )
421     {
422     }
423 }
424 
425 void GraphicCollector::CountGraphics( const Reference< XComponentContext >& rxMSF, const Reference< XModel >& rxModel,
426         const GraphicSettings& rGraphicSettings, sal_Int32& rnGraphics )
427 {
428     try
429     {
430         sal_Int32 i;
431         Reference< XDrawPagesSupplier > xDrawPagesSupplier( rxModel, UNO_QUERY_THROW );
432         Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY_THROW );
433         for ( i = 0; i < xDrawPages->getCount(); i++ )
434         {
435             Reference< XDrawPage > xDrawPage( xDrawPages->getByIndex( i ), UNO_QUERY_THROW );
436             ImpCountBackgroundGraphic( rxMSF, xDrawPage, rGraphicSettings, rnGraphics );
437             Reference< XShapes > xDrawShapes( xDrawPage, UNO_QUERY_THROW );
438             ImpCountGraphicObjects( rxMSF, xDrawShapes, rGraphicSettings, rnGraphics );
439 
440             Reference< XPresentationPage > xPresentationPage( xDrawPage, UNO_QUERY_THROW );
441             Reference< XDrawPage > xNotesPage( xPresentationPage->getNotesPage() );
442             ImpCountBackgroundGraphic( rxMSF, xNotesPage, rGraphicSettings, rnGraphics );
443             Reference< XShapes > xNotesShapes( xNotesPage, UNO_QUERY_THROW );
444             ImpCountGraphicObjects( rxMSF, xNotesShapes, rGraphicSettings, rnGraphics );
445         }
446         Reference< XMasterPagesSupplier > xMasterPagesSupplier( rxModel, UNO_QUERY_THROW );
447         Reference< XDrawPages > xMasterPages( xMasterPagesSupplier->getMasterPages(), UNO_QUERY_THROW );
448         for ( i = 0; i < xMasterPages->getCount(); i++ )
449         {
450             Reference< XDrawPage > xMasterPage( xMasterPages->getByIndex( i ), UNO_QUERY_THROW );
451             ImpCountBackgroundGraphic( rxMSF, xMasterPage, rGraphicSettings, rnGraphics );
452             Reference< XShapes > xMasterPageShapes( xMasterPage, UNO_QUERY_THROW );
453             ImpCountGraphicObjects( rxMSF, xMasterPageShapes, rGraphicSettings, rnGraphics );
454         }
455     }
456     catch ( Exception& )
457     {
458     }
459 }
460 
461