diff options
author | Noel Power <noel.power@novell.com> | 2011-08-22 15:41:30 +0100 |
---|---|---|
committer | Noel Power <noel.power@novell.com> | 2011-08-22 15:44:55 +0100 |
commit | 117281ba12e703fcd04ca87309dfd4a31432d1c5 (patch) | |
tree | e530aa17f0781b1296f1d45ec4ad5c21e1f029b4 /svtools/source/graphic | |
parent | dcd3f14c52d056ccb7117622a6b2bf939ab0567d (diff) |
fix leaking 'Pictures' streams from basic dialogs in base
With database document, any contents of the Pictures folder ( afaics only basic dialogs store content here ) is never cleaned up between saves.
Diffstat (limited to 'svtools/source/graphic')
-rw-r--r-- | svtools/source/graphic/grfmgr.cxx | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx index f41b26e24278..43b8687515a9 100644 --- a/svtools/source/graphic/grfmgr.cxx +++ b/svtools/source/graphic/grfmgr.cxx @@ -47,9 +47,19 @@ #include <vcl/pdfextoutdevdata.hxx> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> + #define WATERMARK_LUM_OFFSET 50 #define WATERMARK_CON_OFFSET -70 +using com::sun::star::uno::Reference; +using com::sun::star::uno::XInterface; +using com::sun::star::uno::UNO_QUERY; +using com::sun::star::uno::Sequence; +using com::sun::star::container::XNameContainer; +using com::sun::star::beans::XPropertySet; + GraphicManager* GraphicObject::mpGlobalMgr = NULL; struct GrfSimpleCacheObj @@ -1183,4 +1193,34 @@ GraphicObject GraphicObject::CreateGraphicObjectFromURL( const ::rtl::OUString & } } +void +GraphicObject::InspectForGraphicObjectImageURL( const Reference< XInterface >& xIf, std::vector< rtl::OUString >& rvEmbedImgUrls ) +{ + static rtl::OUString sImageURL(RTL_CONSTASCII_USTRINGPARAM( "ImageURL" ) ); + Reference< XPropertySet > xProps( xIf, UNO_QUERY ); + if ( xProps.is() ) + { + + if ( xProps->getPropertySetInfo()->hasPropertyByName( sImageURL ) ) + { + rtl::OUString sURL; + xProps->getPropertyValue( sImageURL ) >>= sURL; + if ( sURL.getLength() && sURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 ) + rvEmbedImgUrls.push_back( sURL ); + } + } + Reference< XNameContainer > xContainer( xIf, UNO_QUERY ); + if ( xContainer.is() ) + { + Sequence< rtl::OUString > sNames = xContainer->getElementNames(); + sal_Int32 nContainees = sNames.getLength(); + for ( sal_Int32 index = 0; index < nContainees; ++index ) + { + Reference< XInterface > xCtrl; + xContainer->getByName( sNames[ index ] ) >>= xCtrl; + InspectForGraphicObjectImageURL( xCtrl, rvEmbedImgUrls ); + } + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |