[Libreoffice-commits] core.git: sc/source svx/inc svx/source
Tomaž Vajngerl
quikee at gmail.com
Sat Mar 30 08:55:56 PDT 2013
sc/source/ui/drawfunc/chartsh.cxx | 11 -
svx/inc/svx/extedit.hxx | 5
svx/inc/svx/graphichelper.hxx | 10 +
svx/source/core/extedit.cxx | 56 ++++----
svx/source/core/graphichelper.cxx | 247 +++++++++++++++++++++++++++++---------
5 files changed, 234 insertions(+), 95 deletions(-)
New commits:
commit a5e22906c0b27019b61b41161ccc8cbc2cf40ade
Author: Tomaž Vajngerl <quikee at gmail.com>
Date: Tue Mar 26 23:07:42 2013 +0100
Export Chart as Graphic - allow vector graphic export
Readd removed SaveShapeAsGraphic to GraphicHelper with which it
is possible to export any shape to vector/raster graphic.
Additionally cleanup GraphicHelper and ExternalEdit (convertsion
to OUString, remove unused imports, comments).
Change-Id: I1af45e2ed5d3b66dbd80a5f3a71c44530e46baef
diff --git a/sc/source/ui/drawfunc/chartsh.cxx b/sc/source/ui/drawfunc/chartsh.cxx
index d4de9cf..170ede8 100644
--- a/sc/source/ui/drawfunc/chartsh.cxx
+++ b/sc/source/ui/drawfunc/chartsh.cxx
@@ -40,6 +40,8 @@
#define ScChartShell
#include "scslots.hxx"
+using namespace ::css::uno;
+
SFX_IMPL_INTERFACE(ScChartShell, ScDrawShell, ScResId(SCSTR_CHARTSHELL) )
{
SFX_OBJECTBAR_REGISTRATION( SFX_OBJECTBAR_OBJECT | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_SERVER,
@@ -88,13 +90,8 @@ void ScChartShell::ExecuteExportAsGraphic( SfxRequest& )
if( pObject && pObject->ISA( SdrOle2Obj ) )
{
- SdrOle2Obj* aOle2Object = ((SdrOle2Obj*) pObject)->Clone();
- aOle2Object->NbcResize(Point(), Fraction(1,1), Fraction(1,1));
- const Graphic* pGraphic = aOle2Object->GetGraphic();
- if( pGraphic != NULL )
- {
- GraphicHelper::ExportGraphic( *pGraphic, String("") );
- }
+ Reference< XShape > xSourceDoc = Reference< XShape >( pObject->getUnoShape(), UNO_QUERY_THROW );
+ GraphicHelper::SaveShapeAsGraphic( xSourceDoc );
}
}
diff --git a/svx/inc/svx/extedit.hxx b/svx/inc/svx/extedit.hxx
index 3760c54..6f3c44a 100644
--- a/svx/inc/svx/extedit.hxx
+++ b/svx/inc/svx/extedit.hxx
@@ -24,10 +24,10 @@
#ifndef _EXTEDIT_HXX
#define _EXTEDIT_HXX
+#include <svtools/grfmgr.hxx>
#include <osl/file.hxx>
#include <osl/process.h>
#include <vcl/graph.hxx>
-#include <svtools/grfmgr.hxx>
#include <vcl/timer.hxx>
#include <svx/svxdllapi.h>
@@ -35,7 +35,7 @@ class SVX_DLLPUBLIC ExternalToolEdit
{
public:
GraphicObject* m_pGraphicObject;
- rtl::OUString m_aFileName;
+ OUString m_aFileName;
ExternalToolEdit();
virtual ~ExternalToolEdit();
@@ -43,7 +43,6 @@ public:
virtual void Update( Graphic& aGraphic ) = 0;
void Edit( GraphicObject *pGraphic );
-
DECL_LINK( StartListeningEvent, void *pEvent );
static void threadWorker( void *pThreadData );
diff --git a/svx/inc/svx/graphichelper.hxx b/svx/inc/svx/graphichelper.hxx
index 317e0ff..1d9e9e3 100644
--- a/svx/inc/svx/graphichelper.hxx
+++ b/svx/inc/svx/graphichelper.hxx
@@ -23,12 +23,18 @@
#include <vcl/graph.hxx>
#include <svx/svxdllapi.h>
+#include <com/sun/star/drawing/XShape.hpp>
+
+using namespace css::uno;
+using namespace css::drawing;
+
class SVX_DLLPUBLIC GraphicHelper
{
public:
- static void GetPreferedExtension( String &rExt, const Graphic &rGrf );
- static String ExportGraphic( const Graphic &rGraphic, const String &rGrfName );
+ static void GetPreferedExtension( OUString& rExtension, const Graphic& rGraphic );
+ static OUString ExportGraphic( const Graphic& rGraphic, const OUString& rGraphicName );
+ static void SaveShapeAsGraphic( const Reference< XShape >& xShape );
};
diff --git a/svx/source/core/extedit.cxx b/svx/source/core/extedit.cxx
index a4bc79f..bd8343e 100644
--- a/svx/source/core/extedit.cxx
+++ b/svx/source/core/extedit.cxx
@@ -22,6 +22,11 @@
* instead of those above.
*/
+#include <vcl/svapp.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/cvtgrf.hxx>
+#include <vcl/graphicfilter.hxx>
+#include <svx/xoutbmp.hxx>
#include <svx/extedit.hxx>
#include <svx/graphichelper.hxx>
#include <sfx2/viewfrm.hxx>
@@ -30,21 +35,17 @@
#include <osl/thread.hxx>
#include <osl/process.h>
#include <osl/time.h>
-#include <vcl/graphicfilter.hxx>
#include <svtools/filechangedchecker.hxx>
-#include <svx/xoutbmp.hxx>
#include <unotools/ucbstreamhelper.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/graph.hxx>
-#include <vcl/cvtgrf.hxx>
-
-#include "com/sun/star/system/SystemShellExecute.hpp"
-#include "com/sun/star/system/SystemShellExecuteFlags.hpp"
#include <comphelper/processfactory.hxx>
-
#include <boost/bind.hpp>
-using namespace ::com::sun::star;
+#include <com/sun/star/system/SystemShellExecute.hpp>
+#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
+
+using namespace css::uno;
+using namespace css::system;
+
ExternalToolEdit::ExternalToolEdit()
{}
@@ -73,9 +74,7 @@ IMPL_LINK (ExternalToolEdit, StartListeningEvent, void*, pEvent)
//Start an event listener implemented via VCL timeout
ExternalToolEdit* pData = ( ExternalToolEdit* )pEvent;
- new FileChangedChecker(
- pData->m_aFileName,
- ::boost::bind(&HandleCloseEvent, pData));
+ new FileChangedChecker(pData->m_aFileName, ::boost::bind(&HandleCloseEvent, pData));
return 0;
}
@@ -88,9 +87,9 @@ void ExternalToolEdit::threadWorker(void* pThreadData)
// getting changed
Application::PostUserEvent( LINK( NULL, ExternalToolEdit, StartListeningEvent ), pThreadData);
- uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute(
- com::sun::star::system::SystemShellExecute::create(::comphelper::getProcessComponentContext() ) );
- xSystemShellExecute->execute( pData->m_aFileName, rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY );
+ Reference<XSystemShellExecute> xSystemShellExecute(
+ SystemShellExecute::create( ::comphelper::getProcessComponentContext() ) );
+ xSystemShellExecute->execute( pData->m_aFileName, OUString(), SystemShellExecuteFlags::URIS_ONLY );
}
void ExternalToolEdit::Edit( GraphicObject* pGraphicObject )
@@ -100,37 +99,36 @@ void ExternalToolEdit::Edit( GraphicObject* pGraphicObject )
const Graphic aGraphic = pGraphicObject->GetGraphic();
//get the Preferred File Extension for this graphic
- String fExtension;
+ OUString fExtension;
GraphicHelper::GetPreferedExtension(fExtension, aGraphic);
//Create the temp File
- rtl::OUString tempFileBase, tempFileName;
+ OUString aTempFileBase;
+ OUString aTempFileName;
+
oslFileHandle pHandle;
- osl::FileBase::createTempFile(0, &pHandle, &tempFileBase);
+ osl::FileBase::createTempFile(0, &pHandle, &aTempFileBase);
// Move it to a file name with image extension properly set
- tempFileName = tempFileBase + rtl::OUString('.') + rtl::OUString(fExtension);
- osl::File::move(tempFileBase, tempFileName);
+ aTempFileName = aTempFileBase + OUString('.') + OUString(fExtension);
+ osl::File::move(aTempFileBase, aTempFileName);
//Write Graphic to the Temp File
GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter();
sal_uInt16 nFilter(rGraphicFilter.GetExportFormatNumber(fExtension));
+
String aFilter(rGraphicFilter.GetExportFormatShortName(nFilter));
- String sPath(tempFileName);
+ String sPath(aTempFileName);
// Write the Graphic to the file now
- XOutBitmap::WriteGraphic(aGraphic, sPath, aFilter, XOUTBMP_USE_NATIVE_IF_POSSIBLE|XOUTBMP_DONT_EXPAND_FILENAME);
+ XOutBitmap::WriteGraphic(aGraphic, sPath, aFilter, XOUTBMP_USE_NATIVE_IF_POSSIBLE | XOUTBMP_DONT_EXPAND_FILENAME);
// There is a possiblity that sPath extnesion might have been changed if the
// provided extension is not writable
- tempFileName = rtl::OUString(sPath);
+ m_aFileName = OUString(sPath);
//Create a thread
- rtl_uString* aFileName = new rtl_uString();
- rtl_uString_newFromAscii(
- &aFileName,
- rtl::OUStringToOString(tempFileName, RTL_TEXTENCODING_UTF8).getStr());
- m_aFileName = aFileName;
+
// Create the data that is needed by the thread later
osl_createThread(ExternalToolEdit::threadWorker, this);
}
diff --git a/svx/source/core/graphichelper.cxx b/svx/source/core/graphichelper.cxx
index 2cc0c7c..4671c91 100644
--- a/svx/source/core/graphichelper.cxx
+++ b/svx/source/core/graphichelper.cxx
@@ -18,119 +18,144 @@
*/
#include <tools/string.hxx>
-#include <svx/graphichelper.hxx>
#include <unotools/pathoptions.hxx>
#include <vcl/graphicfilter.hxx>
#include <sfx2/docfile.hxx>
-#include <svx/xoutbmp.hxx>
#include <sfx2/filedlghelper.hxx>
+#include <svx/xoutbmp.hxx>
#include <svx/dialmgr.hxx>
+#include <svx/graphichelper.hxx>
#include <svx/dialogs.hrc>
+#include <cppuhelper/exc_hlp.hxx>
+#include <comphelper/anytostring.hxx>
+#include <comphelper/processfactory.hxx>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <com/sun/star/graphic/GraphicType.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+
+using namespace css::uno;
+using namespace css::lang;
+using namespace css::graphic;
+using namespace css::ucb;
+using namespace css::beans;
+using namespace css::io;
+using namespace css::document;
+using namespace css::ui::dialogs;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::ui::dialogs;
-using namespace ::sfx2;
+using namespace sfx2;
-void GraphicHelper::GetPreferedExtension( String &rExtension, const Graphic &rGraphic )
+void GraphicHelper::GetPreferedExtension( OUString& rExtension, const Graphic& rGraphic )
{
- // propose the "best" filter using the native-info, if applicable
- const sal_Char* pExtension = "png";
+ OUString aExtension = "png";
switch( const_cast<Graphic&>( rGraphic ).GetLink().GetType() )
{
case GFX_LINK_TYPE_NATIVE_GIF:
- pExtension = "gif";
+ aExtension = "gif";
break;
case GFX_LINK_TYPE_NATIVE_TIF:
- pExtension = "tif";
+ aExtension = "tif";
break;
case GFX_LINK_TYPE_NATIVE_WMF:
- pExtension = "wmf";
+ aExtension = "wmf";
break;
case GFX_LINK_TYPE_NATIVE_MET:
- pExtension = "met";
+ aExtension = "met";
break;
case GFX_LINK_TYPE_NATIVE_PCT:
- pExtension = "pct";
+ aExtension = "pct";
break;
case GFX_LINK_TYPE_NATIVE_JPG:
- pExtension = "jpg";
+ aExtension = "jpg";
break;
default:
break;
}
- rExtension.AssignAscii( pExtension );
+ rExtension = aExtension;
}
-String GraphicHelper::ExportGraphic( const Graphic &rGraphic, const String &rGrfName )
+OUString GraphicHelper::ExportGraphic( const Graphic& rGraphic, const OUString& rGraphicName )
{
SvtPathOptions aPathOpt;
- String sGrfPath( aPathOpt.GetGraphicPath() );
+ OUString sGraphicsPath( aPathOpt.GetGraphicPath() );
- FileDialogHelper aDlgHelper( TemplateDescription::FILESAVE_AUTOEXTENSION, 0 );
- Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
+ FileDialogHelper aDialogHelper( TemplateDescription::FILESAVE_AUTOEXTENSION, 0 );
+ Reference < XFilePicker > xFilePicker = aDialogHelper.GetFilePicker();
INetURLObject aPath;
- aPath.SetSmartURL( sGrfPath );
+ aPath.SetSmartURL( sGraphicsPath );
// fish out the graphic's name
- String aName = rGrfName;
+ OUString aName = rGraphicName;
- aDlgHelper.SetTitle( SVX_RESSTR(RID_SVXSTR_EXPORT_GRAPHIC_TITLE));
- aDlgHelper.SetDisplayDirectory( aPath.GetMainURL(INetURLObject::DECODE_TO_IURI) );
+ aDialogHelper.SetTitle( SVX_RESSTR(RID_SVXSTR_EXPORT_GRAPHIC_TITLE));
+ aDialogHelper.SetDisplayDirectory( aPath.GetMainURL(INetURLObject::DECODE_TO_IURI) );
INetURLObject aURL;
aURL.SetSmartURL( aName );
- aDlgHelper.SetFileName( aURL.GetName() );
+ aDialogHelper.SetFileName( aURL.GetName() );
- GraphicFilter& rGF = GraphicFilter::GetGraphicFilter();
- const sal_uInt16 nCount = rGF.GetExportFormatCount();
+ GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter();
+ const sal_uInt16 nCount = rGraphicFilter.GetExportFormatCount();
- String aExt( aURL.GetExtension() );
- if( !aExt.Len() )
- GetPreferedExtension( aExt, rGraphic );
+ OUString aExtension( aURL.GetExtension() );
+ if( aExtension.isEmpty() )
+ {
+ GetPreferedExtension( aExtension, rGraphic );
+ }
- aExt.ToLowerAscii();
- sal_uInt16 nDfltFilter = USHRT_MAX;
+ aExtension = aExtension.toAsciiLowerCase();
+ sal_uInt16 nDefaultFilter = USHRT_MAX;
- Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY);
+ Reference<XFilterManager> xFilterManager(xFilePicker, UNO_QUERY);
for ( sal_uInt16 i = 0; i < nCount; i++ )
{
- xFltMgr->appendFilter( rGF.GetExportFormatName( i ), rGF.GetExportWildcard( i ) );
- if ( COMPARE_EQUAL == aExt.CompareIgnoreCaseToAscii(rGF.GetExportFormatShortName( i ).ToLowerAscii() ))
- nDfltFilter = i;
+ xFilterManager->appendFilter( rGraphicFilter.GetExportFormatName( i ), rGraphicFilter.GetExportWildcard( i ) );
+ OUString aFormatShortName = rGraphicFilter.GetExportFormatShortName( i );
+ if ( aFormatShortName.equalsIgnoreAsciiCase( aExtension ) )
+ {
+ nDefaultFilter = i;
+ }
}
- if ( USHRT_MAX == nDfltFilter )
+ if ( USHRT_MAX == nDefaultFilter )
{
// "wrong" extension?
- GetPreferedExtension( aExt, rGraphic );
+ GetPreferedExtension( aExtension, rGraphic );
for ( sal_uInt16 i = 0; i < nCount; ++i )
- if ( aExt == rGF.GetExportFormatShortName( i ).ToLowerAscii() )
+ if ( aExtension == rGraphicFilter.GetExportFormatShortName( i ).ToLowerAscii() )
{
- nDfltFilter = i;
+ nDefaultFilter = i;
break;
}
}
- if( USHRT_MAX != nDfltFilter )
+ if( USHRT_MAX != nDefaultFilter )
{
- xFltMgr->setCurrentFilter( rGF.GetExportFormatName( nDfltFilter ) ) ;
+ xFilterManager->setCurrentFilter( rGraphicFilter.GetExportFormatName( nDefaultFilter ) ) ;
- if( aDlgHelper.Execute() == ERRCODE_NONE )
+ if( aDialogHelper.Execute() == ERRCODE_NONE )
{
- String sPath( xFP->getFiles().getConstArray()[0] );
+ OUString sPath( xFilePicker->getFiles().getConstArray()[0] );
// remember used path - please don't optimize away!
aPath.SetSmartURL( sPath);
- sGrfPath = aPath.GetPath();
+ sGraphicsPath = aPath.GetPath();
- if( rGrfName.Len() &&
- nDfltFilter == rGF.GetExportFormatNumber( xFltMgr->getCurrentFilter()))
+ if( !rGraphicName.isEmpty() &&
+ nDefaultFilter == rGraphicFilter.GetExportFormatNumber( xFilterManager->getCurrentFilter()))
{
// try to save the original graphic
- SfxMedium aIn( rGrfName, STREAM_READ | STREAM_NOCREATE );
+ SfxMedium aIn( rGraphicName, STREAM_READ | STREAM_NOCREATE );
if( aIn.GetInStream() && !aIn.GetInStream()->GetError() )
{
SfxMedium aOut( sPath, STREAM_WRITE | STREAM_SHARE_DENYNONE);
@@ -149,19 +174,133 @@ String GraphicHelper::ExportGraphic( const Graphic &rGraphic, const String &rGrf
}
sal_uInt16 nFilter;
- if ( !xFltMgr->getCurrentFilter().isEmpty() && rGF.GetExportFormatCount() )
- nFilter = rGF.GetExportFormatNumber( xFltMgr->getCurrentFilter() );
+ if ( !xFilterManager->getCurrentFilter().isEmpty() && rGraphicFilter.GetExportFormatCount() )
+ {
+ nFilter = rGraphicFilter.GetExportFormatNumber( xFilterManager->getCurrentFilter() );
+ }
else
+ {
nFilter = GRFILTER_FORMAT_DONTKNOW;
- String aFilter( rGF.GetExportFormatShortName( nFilter ) );
- XOutBitmap::WriteGraphic( rGraphic, sPath, aFilter,
- XOUTBMP_DONT_EXPAND_FILENAME|
- XOUTBMP_DONT_ADD_EXTENSION|
+ }
+ OUString aFilter( rGraphicFilter.GetExportFormatShortName( nFilter ) );
+
+ String aFilterString( aFilter );
+ String aPathString( sPath );
+ XOutBitmap::WriteGraphic( rGraphic, aPathString, aFilterString,
+ XOUTBMP_DONT_EXPAND_FILENAME |
+ XOUTBMP_DONT_ADD_EXTENSION |
XOUTBMP_USE_NATIVE_IF_POSSIBLE );
return sPath;
}
}
- return String();
+ return OUString();
+}
+
+void GraphicHelper::SaveShapeAsGraphic( const Reference< XShape >& xShape )
+{
+ try
+ {
+ Reference< XMultiServiceFactory > xServiceFactory( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
+ Reference< XPropertySet > xShapeSet( xShape, UNO_QUERY_THROW );
+
+ OUString aMimeType;
+ OUString sGraphicURL;
+
+ SvtPathOptions aPathOpt;
+ String sGraphicPath( aPathOpt.GetGraphicPath() );
+
+ FileDialogHelper aDialogHelper( TemplateDescription::FILESAVE_AUTOEXTENSION, 0 );
+ Reference < XFilePicker > xFilePicker = aDialogHelper.GetFilePicker();
+
+ aDialogHelper.SetTitle( OUString( "Save as Picture" ) );
+
+ INetURLObject aPath;
+ aPath.SetSmartURL( sGraphicPath );
+ xFilePicker->setDisplayDirectory( aPath.GetMainURL(INetURLObject::DECODE_TO_IURI) );
+
+ // populate filter dialog filter list and select default filter to match graphic mime type
+
+ GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter();
+ Reference<XFilterManager> xFilterManager( xFilePicker, UNO_QUERY );
+ OUString aDefaultFormatName;
+ sal_uInt16 nCount = rGraphicFilter.GetExportFormatCount();
+
+ std::map< OUString, OUString > aMimeTypeMap;
+
+ for ( sal_uInt16 i = 0; i < nCount; i++ )
+ {
+ const OUString aExportFormatName( rGraphicFilter.GetExportFormatName( i ) );
+ const OUString aFilterMimeType( rGraphicFilter.GetExportFormatMediaType( i ) );
+ xFilterManager->appendFilter( aExportFormatName, rGraphicFilter.GetExportWildcard( i ) );
+ aMimeTypeMap[ aExportFormatName ] = aFilterMimeType;
+ if( aMimeType == aFilterMimeType )
+ aDefaultFormatName = aExportFormatName;
+ }
+
+ if( aDefaultFormatName.getLength() == 0 )
+ {
+ nCount = rGraphicFilter.GetImportFormatCount();
+ for( sal_uInt16 i = 0; i < nCount; i++ )
+ {
+ const OUString aFilterMimeType( rGraphicFilter.GetImportFormatMediaType( i ) );
+ if( aMimeType == aFilterMimeType )
+ {
+ aDefaultFormatName = rGraphicFilter.GetImportFormatName( i );
+ xFilterManager->appendFilter( aDefaultFormatName, rGraphicFilter.GetImportWildcard( i ) );
+ aMimeTypeMap[ aDefaultFormatName ] = aFilterMimeType;
+ break;
+ }
+ }
+ }
+
+ if( aDefaultFormatName.getLength() == 0 )
+ aDefaultFormatName = OUString( "PNG - Portable Network Graphic" );
+
+ xFilterManager->setCurrentFilter( aDefaultFormatName );
+
+ // execute dialog
+
+ if( aDialogHelper.Execute() == ERRCODE_NONE )
+ {
+ OUString sPath( xFilePicker->getFiles().getConstArray()[0] );
+ OUString aExportMimeType( aMimeTypeMap[xFilterManager->getCurrentFilter()] );
+
+ Reference< XInputStream > xGraphStream;
+ if( aMimeType == aExportMimeType )
+ {
+ xShapeSet->getPropertyValue( OUString( "GraphicStream" ) ) >>= xGraphStream;
+ }
+
+ if( xGraphStream.is() )
+ {
+ OUString aSimpleFileAccessFilter( "com.sun.star.ucb.SimpleFileAccess" );
+ Reference<XSimpleFileAccess2> xFileAccess( xServiceFactory->createInstance( aSimpleFileAccessFilter ), UNO_QUERY_THROW );
+ xFileAccess->writeFile( sPath, xGraphStream );
+ }
+ else
+ {
+ OUString aGraphicExportFilter("com.sun.star.drawing.GraphicExportFilter");
+ Reference<XExporter> xGraphicExporter( xServiceFactory->createInstance( aGraphicExportFilter ), UNO_QUERY_THROW );
+ Reference<XFilter> xFilter( xGraphicExporter, UNO_QUERY_THROW );
+
+ Sequence<PropertyValue> aDescriptor( 2 );
+ aDescriptor[0].Name = OUString("MediaType");
+ aDescriptor[0].Value <<= aExportMimeType;
+ aDescriptor[1].Name = OUString("URL");
+ aDescriptor[1].Value <<= sPath;
+
+ Reference< XComponent > xSourceDocument = Reference< XComponent >( xShape, UNO_QUERY_THROW );
+ if ( xSourceDocument.is() )
+ {
+ xGraphicExporter->setSourceDocument( xSourceDocument );
+ xFilter->filter( aDescriptor );
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list