diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-03-15 01:22:13 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-03-15 01:30:54 +0100 |
commit | ff98426745b76fef17e78d75f9b18b26ebc69a74 (patch) | |
tree | 9262b1f41e1493e2bd909ba56e9d57b6fed12f63 /sc/source | |
parent | ca4d16429ab0d060b8e894fc6363b75ba82c80b0 (diff) |
initial work on an odc export
We can now export a chart to odc when we are in chart edit mode from
Calc. I need to add support for it to Writer and Impress as well.
We can already open these files but copy&paste from the opened file
fails. The next step is then to add a new menu entry
Insert->Object->Chart from file
Change-Id: I14d1702e79517e7319a1929de2be5501d375885d
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/ui/app/drwtrans.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/app/transobj.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 47 | ||||
-rw-r--r-- | sc/source/ui/inc/docsh.hxx | 2 |
4 files changed, 49 insertions, 4 deletions
diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx index c0fb8ab73b68..1fdd9e3933db 100644 --- a/sc/source/ui/app/drwtrans.cxx +++ b/sc/source/ui/app/drwtrans.cxx @@ -578,7 +578,7 @@ sal_Bool ScDrawTransferObj::WriteObject( SotStorageStreamRef& rxOStm, void* pUse ::comphelper::OStorageHelper::GetStorageFromURL( aTempFile.GetURL(), embed::ElementModes::READWRITE ); // write document storage - pEmbObj->SetupStorage( xWorkStore, SOFFICE_FILEFORMAT_CURRENT, false ); + pEmbObj->SetupStorage( xWorkStore, SOFFICE_FILEFORMAT_CURRENT, false, false ); // mba: no relative ULRs for clipboard! SfxMedium aMedium( xWorkStore, String() ); diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 103f64f8f281..5325fac83632 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -446,7 +446,7 @@ sal_Bool ScTransferObj::WriteObject( SotStorageStreamRef& rxOStm, void* pUserObj ::comphelper::OStorageHelper::GetStorageFromURL( aTempFile.GetURL(), embed::ElementModes::READWRITE ); // write document storage - pEmbObj->SetupStorage( xWorkStore, SOFFICE_FILEFORMAT_CURRENT, false ); + pEmbObj->SetupStorage( xWorkStore, SOFFICE_FILEFORMAT_CURRENT, false, false ); // mba: no relative ULRs for clipboard! SfxMedium aMedium( xWorkStore, String() ); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index c56d0100fc23..150c26993b5a 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -47,6 +47,16 @@ #include <com/sun/star/task/XJob.hpp> #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/XAcceleratorConfiguration.hpp> +#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/table/XTableChartsSupplier.hpp> +#include <com/sun/star/table/XTableCharts.hpp> +#include <com/sun/star/table/XTableChart.hpp> +#include <com/sun/star/chart2/XChartDocument.hpp> +#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp> +#include <com/sun/star/frame/XStorable2.hpp> +#include <com/sun/star/frame/Desktop.hpp> #include "scabstdlg.hxx" #include <sot/formats.hxx> @@ -493,6 +503,29 @@ sal_Bool ScDocShell::SaveXML( SfxMedium* pSaveMedium, const ::com::sun::star::un return bRet; } +bool ScDocShell::SaveCurrentChart( SfxMedium& rMedium ) +{ + bool bRet = false; + + try + { + + uno::Reference< lang::XComponent > xCurrentComponent = frame::Desktop::create( comphelper::getProcessComponentContext() )->getCurrentComponent(); + + uno::Reference< frame::XStorable2 > xStorable( xCurrentComponent, uno::UNO_QUERY_THROW ); + + uno::Reference< frame::XModel > xChartDoc ( xCurrentComponent, uno::UNO_QUERY_THROW ); + + ScXMLChartExportWrapper aExport( xChartDoc, rMedium ); + bRet = aExport.Export(); + } + catch(...) + { + SAL_WARN("sc", "exception thrown while saving chart. Bug!!!"); + } + return bRet; +} + sal_Bool ScDocShell::Load( SfxMedium& rMedium ) { RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::Load" ); @@ -1584,10 +1617,20 @@ sal_Bool ScDocShell::SaveAs( SfxMedium& rMedium ) PrepareSaveGuard aPrepareGuard( *this); + OUString aFltName = rMedium.GetFilter()->GetFilterName(); + bool bChartExport = aFltName.indexOf("chart8") != -1; + // wait cursor is handled with progress bar - sal_Bool bRet = SfxObjectShell::SaveAs( rMedium ); - if( bRet ) + sal_Bool bRet = false; + if(!bChartExport) + { + bRet = SfxObjectShell::SaveAs( rMedium ); bRet = SaveXML( &rMedium, NULL ); + } + else + { + bRet = SaveCurrentChart( rMedium ); + } return bRet; } diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 010ea826c362..55054f807909 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -139,6 +139,8 @@ class SC_DLLPUBLIC ScDocShell: public SfxObjectShell, public SfxListener SC_DLLPRIVATE sal_Bool SaveXML( SfxMedium* pMedium, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& ); SC_DLLPRIVATE SCTAB GetSaveTab(); + SC_DLLPRIVATE bool SaveCurrentChart( SfxMedium& rMedium ); + SC_DLLPRIVATE sal_uLong DBaseImport( const String& rFullFileName, CharSet eCharSet, ScColWidthParam aColWidthParam[MAXCOLCOUNT], ScFlatBoolRowSegments& rRowHeightsRecalc ); SC_DLLPRIVATE sal_uLong DBaseExport( |