/************************************************************** * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * *************************************************************/ #ifndef GRAPHICCOLLECTOR_HXX #define GRAPHICCOLLECTOR_HXX #include #include #include #include #include #include #include #include #include struct GraphicSettings { sal_Bool mbJPEGCompression; sal_Int32 mnJPEGQuality; sal_Bool mbRemoveCropArea; sal_Int32 mnImageResolution; sal_Bool mbEmbedLinkedGraphics; GraphicSettings( sal_Bool bJPEGCompression, sal_Int32 nJPEGQuality, sal_Bool bRemoveCropArea, sal_Int32 nImageResolution, sal_Bool bEmbedLinkedGraphics ) : mbJPEGCompression( bJPEGCompression ) , mnJPEGQuality( nJPEGQuality ) , mbRemoveCropArea( bRemoveCropArea ) , mnImageResolution( nImageResolution ) , mbEmbedLinkedGraphics( bEmbedLinkedGraphics ) {}; }; class GraphicCollector { public: struct GraphicUser { com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxShape; // if mbFillBitmap is false the xShape has com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > mxPropertySet; // to be used otherwise the PropertySet com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > mxPagePropertySet; rtl::OUString maGraphicURL; rtl::OUString maGraphicStreamURL; com::sun::star::text::GraphicCrop maGraphicCropLogic; com::sun::star::awt::Size maLogicalSize; sal_Bool mbFillBitmap; GraphicUser() : mxShape(), maGraphicCropLogic( 0, 0, 0, 0 ), mbFillBitmap( sal_False ) {}; }; struct GraphicEntity { com::sun::star::awt::Size maLogicalSize; // the biggest logical size the graphic will be displayed sal_Bool mbRemoveCropArea; // com::sun::star::text::GraphicCrop maGraphicCropLogic; std::vector< GraphicUser > maUser; GraphicEntity( const GraphicUser& rUser ) : maLogicalSize( rUser.maLogicalSize ), mbRemoveCropArea( sal_False ), maGraphicCropLogic( 0, 0, 0, 0 ) { maUser.push_back( rUser ); }; }; static const com::sun::star::awt::DeviceInfo& GetDeviceInfo( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxFact ); static com::sun::star::awt::Size GetOriginalSize( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext, const com::sun::star::uno::Reference< com::sun::star::graphic::XGraphic >& rxGraphic ); // collecting graphic instances, the downside of this method is that every graphic is swapped in static void CollectGraphics( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext, const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rxModel, const GraphicSettings& rGraphicSettings, std::vector< GraphicEntity >& io_rGraphicList ); // counting graphics without swapping in graphics static void CountGraphics( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext, const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rxModel, const GraphicSettings& rGraphicSettings, sal_Int32& rGraphics ); }; // -------------------- // - GRAPHICCOLLECTOR - // -------------------- #endif // GRAPHICCOLLECTOR_HXX