[Libreoffice-commits] .: Branch 'feature/tubes2' - sc/source
Michael Meeks
michael at kemper.freedesktop.org
Thu Mar 22 12:55:12 PDT 2012
sc/source/ui/collab/sendfunc.cxx | 38 ++++++++++++++++++++++++++++++++++++++
sc/source/ui/inc/docfunc.hxx | 3 +--
2 files changed, 39 insertions(+), 2 deletions(-)
New commits:
commit 96fc7b84dd6820acd6fb59116ee69bf383bbdb80
Author: Michael Meeks <michael.meeks at suse.com>
Date: Thu Mar 22 19:44:44 2012 +0000
tubes: re-use autorecovery to serialize to a file for exchange
diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx
index f1aec1b..9d9a10c 100644
--- a/sc/source/ui/collab/sendfunc.cxx
+++ b/sc/source/ui/collab/sendfunc.cxx
@@ -34,6 +34,14 @@
#include "docsh.hxx"
#include "docfunc.hxx"
+// new file send/recv fun ...
+#include <unotools/tempfile.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <comphelper/mediadescriptor.hxx>
+#include <com/sun/star/document/XDocumentRecovery.hpp>
+
+namespace css = ::com::sun::star;
+
namespace {
rtl::OUString cellToString( ScBaseCell *pCell )
@@ -282,6 +290,32 @@ class ScDocFuncSend : public ScDocFunc
mpChain->RecvMessage( rOp.toString() );
}
+ void SendFile( const rtl::OUString &rURL )
+ {
+ (void)rURL;
+
+ String aTmpPath = utl::TempFile::CreateTempName();
+ aTmpPath.Append( rtl::OUString( ".ods" ) );
+
+ rtl::OUString aFileURL;
+ ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aTmpPath, aFileURL );
+
+ ::comphelper::MediaDescriptor aDescriptor;
+ // some issue with hyperlinks:
+ aDescriptor[::comphelper::MediaDescriptor::PROP_DOCUMENTBASEURL()] <<= ::rtl::OUString();
+ try {
+ css::uno::Reference< css::document::XDocumentRecovery > xDocRecovery(
+ rDocShell.GetBaseModel(), css::uno::UNO_QUERY_THROW);
+
+ xDocRecovery->storeToRecoveryFile( aFileURL, aDescriptor.getAsConstPropertyValueList() );
+ } catch (const css::uno::Exception &ex) {
+ fprintf( stderr, "exception foo !\n" );
+ }
+
+ fprintf( stderr, "Temp file is '%s'\n",
+ rtl::OUStringToOString( aFileURL, RTL_TEXTENCODING_UTF8 ).getStr() );
+}
+
public:
// FIXME: really ScDocFunc should be an abstract base, so
// we don't need the rDocSh hack/pointer
@@ -314,6 +348,10 @@ public:
aOp.appendString( rText );
aOp.appendBool( bApi );
SendMessage( aOp );
+
+ if ( rtl::OUString( rText ) == "saveme" )
+ SendFile( rText );
+
return true; // needs some code auditing action
}
diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx
index e47442e..1303f5e 100644
--- a/sc/source/ui/inc/docfunc.hxx
+++ b/sc/source/ui/inc/docfunc.hxx
@@ -57,7 +57,7 @@ struct ScCellMergeOption;
class ScDocFunc
{
-private:
+protected:
ScDocShell& rDocShell;
sal_Bool AdjustRowHeight( const ScRange& rRange, sal_Bool bPaint = true );
@@ -67,7 +67,6 @@ private:
sal_Bool& rCancel, sal_Bool bApi );
void NotifyInputHandler( const ScAddress& rPos );
-protected:
ScDocFunc( ScDocShell& rDocSh ): rDocShell(rDocSh) {}
public:
virtual ~ScDocFunc() {}
More information about the Libreoffice-commits
mailing list