summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorNoel Power <noel.power@novell.com>2011-08-22 15:41:30 +0100
committerNoel Power <noel.power@novell.com>2011-08-22 15:44:55 +0100
commit117281ba12e703fcd04ca87309dfd4a31432d1c5 (patch)
treee530aa17f0781b1296f1d45ec4ad5c21e1f029b4 /svtools
parentdcd3f14c52d056ccb7117622a6b2bf939ab0567d (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')
-rw-r--r--svtools/inc/svtools/grfmgr.hxx5
-rw-r--r--svtools/source/graphic/grfmgr.cxx40
2 files changed, 45 insertions, 0 deletions
diff --git a/svtools/inc/svtools/grfmgr.hxx b/svtools/inc/svtools/grfmgr.hxx
index 25d8929d7f87..f43aec4cbae9 100644
--- a/svtools/inc/svtools/grfmgr.hxx
+++ b/svtools/inc/svtools/grfmgr.hxx
@@ -536,6 +536,11 @@ public:
friend SvStream& operator>>( SvStream& rIStm, GraphicObject& rGraphicObj );
static GraphicObject CreateGraphicObjectFromURL( const ::rtl::OUString &rURL );
+ // will inspect an object ( e.g. a control ) for any 'ImageURL'
+ // properties and return these in a vector. Note: this implementation
+ // will cater for XNameContainer objects and deepinspect any containees
+ // if they exist
+ static void InspectForGraphicObjectImageURL( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIf, std::vector< rtl::OUString >& rvEmbedImgUrls );
};
// ------------------
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: */