[Libreoffice-commits] .: Branch 'feature/tubes2' - sc/CppunitTest_sc_ucalc.mk sc/source tubes/README

Michael Meeks michael at kemper.freedesktop.org
Fri Mar 23 09:02:45 PDT 2012


 sc/CppunitTest_sc_ucalc.mk       |    6 ++++++
 sc/source/ui/collab/sendfunc.cxx |   36 ++++++++++++++++++++++++++++++++++--
 tubes/README                     |   18 ++++++++++++++++++
 3 files changed, 58 insertions(+), 2 deletions(-)

New commits:
commit 70f51922b9e1ac57e6a0548f249732c27d856ba7
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Fri Mar 23 16:01:00 2012 +0000

    tubes: update readme, get -something- working wrt. document transfer

diff --git a/sc/CppunitTest_sc_ucalc.mk b/sc/CppunitTest_sc_ucalc.mk
index 87f39ff..cf81696 100644
--- a/sc/CppunitTest_sc_ucalc.mk
+++ b/sc/CppunitTest_sc_ucalc.mk
@@ -45,6 +45,12 @@ $(call gb_CxxObject_get_target,sc/qa/unit/ucalc): \
     $(call gb_Library_get_target,localedata_en) \
 
 
+ifeq ($(ENABLE_TELEPATHY),TRUE)
+$(eval $(call gb_Library_add_linked_libs,sc_ucalc,\
+	tubes \
+))
+endif
+
 $(eval $(call gb_CppunitTest_add_linked_libs,sc_ucalc, \
     avmedia \
     basegfx \
diff --git a/sc/source/ui/collab/sendfunc.cxx b/sc/source/ui/collab/sendfunc.cxx
index 1026d9b..adda0d2 100644
--- a/sc/source/ui/collab/sendfunc.cxx
+++ b/sc/source/ui/collab/sendfunc.cxx
@@ -41,9 +41,14 @@
 #include <unotools/tempfile.hxx>
 #include <unotools/localfilehelper.hxx>
 #include <comphelper/mediadescriptor.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
 #include <com/sun/star/frame/XLoadable.hpp>
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/document/XDocumentRecovery.hpp>
+#include <com/sun/star/util/XCloseable.hpp>
 
 namespace css = ::com::sun::star;
 
@@ -308,7 +313,8 @@ IMPL_LINK( ScDocFuncRecv, ReceiveFileCallback, rtl::OUString *, pStr )
     fprintf( stderr, "incoming file '%s'\n",
              rtl::OUStringToOString( *pStr, RTL_TEXTENCODING_UTF8 ).getStr() );
 
-    css::uno::Sequence < css::beans::PropertyValue > aLoadArgs(5);
+    // using the frame::XLoadable interface fails with a DoubleInitializationException
+/*    css::uno::Sequence < css::beans::PropertyValue > aLoadArgs(5);
     aLoadArgs[0].Name = rtl::OUString( "URL" );
     aLoadArgs[0].Value <<= (*pStr);
     aLoadArgs[1].Name = rtl::OUString( "FilterName" );
@@ -320,7 +326,6 @@ IMPL_LINK( ScDocFuncRecv, ReceiveFileCallback, rtl::OUString *, pStr )
     aLoadArgs[3].Value <<= sal_Int32( 3 );
     aLoadArgs[4].Name = rtl::OUString( "UpdateDocMode" );
     aLoadArgs[4].Value <<= sal_Int32( 2 );
-
     try
     {
         css::uno::Reference < css::frame::XLoadable > xLoad(
@@ -331,6 +336,33 @@ IMPL_LINK( ScDocFuncRecv, ReceiveFileCallback, rtl::OUString *, pStr )
     {
         fprintf( stderr, "exception when loading '%s' !\n",
                  rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+                 } */
+// #2 - tried out the SfxAutoReloadTimer_Impl - shove stuff at the SID_RELOAD slot ...
+
+// #3 - can we use the framework/inc/services/frame.hxx 's "sTargetFrameName"
+// magic to load into our current frame ? ... :-)
+
+    css::uno::Reference< css::lang::XMultiServiceFactory > rFactory =
+        ::comphelper::getProcessServiceFactory();
+
+    css::uno::Sequence < css::beans::PropertyValue > args(0);
+// FIXME: should this be hidden before it is synched & ready ? ...
+//    args[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Hidden"));
+//    args[0].Value <<= sal_True;
+    try
+    {
+        css::uno::Reference < css::frame::XComponentLoader > xLoader(
+                ::comphelper::getProcessServiceFactory()->createInstance(
+                        "com.sun.star.frame.Desktop" ),
+                        css::uno::UNO_QUERY_THROW );
+        css::uno::Reference < css::util::XCloseable > xDoc(
+                xLoader->loadComponentFromURL( *pStr, "_blank", 0, args ),
+                css::uno::UNO_QUERY_THROW );
+    }
+    catch ( css::uno::Exception& e )
+    {
+        fprintf( stderr, "exception when loading '%s' !\n",
+                 rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
     }
 
     return 0;
diff --git a/tubes/README b/tubes/README
index 3f2f637..126114a 100644
--- a/tubes/README
+++ b/tubes/README
@@ -25,6 +25,24 @@ make everything service-activatable:
 Otherwise, you need to make sure liboapprover and a Telepathy-enabled
 LibreOffice are running.
 
+Status 2012-03-23:
+
+* To do interesting things with this code build and run calc thus:
+
+	SAL_LOG=1 LIBO_TUBES=slave ./soffice -calc   # user one
+	SAL_LOG=1 LIBO_TUBES=master ./soffice -calc  # user two
+
+	hope that a nasty race-condition doesn't occur during startup:
+which is flagged by "we are supposed to handle only one channel" you
+hit it: bang - just try again.
+
+	you also require only a single jabber connection enabled (in
+empathy) and to have your opponent added and approved on both sides.
+
+	Now type simple strings into cells, rename sheets, or type
+'saveme' to transfer your document as-is to the other side ...
+
+
 Status 2012-03-20:
 
 * no LibO code depends on this module yet, so it is not built in a regular


More information about the Libreoffice-commits mailing list