[Libreoffice-commits] core.git: 3 commits - Repository.mk vcl/Module_vcl.mk vcl/workben

Chris Sherlock chris.sherlock79 at gmail.com
Sun May 18 01:21:56 PDT 2014


 Repository.mk             |    6 ++++-
 vcl/Module_vcl.mk         |    6 ++++-
 vcl/workben/svdem.cxx     |    2 -
 vcl/workben/svpclient.cxx |   47 +++++++++++++++++++++-------------------------
 vcl/workben/svptest.cxx   |   19 +++++++++++-------
 vcl/workben/vcldemo.cxx   |   19 +++++++++++-------
 6 files changed, 56 insertions(+), 43 deletions(-)

New commits:
commit 01c52c3f7115569798591320f094e2a3db23bdbf
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Sun May 18 18:13:18 2014 +1000

    vcl: fix svpclient
    
    I have converted the UNO stuff to the more modern variety (i.e. the
    stuff that actually works now...), use GraphicFilter to get the
    bitmap and fixed the string copy typo.
    
    Change-Id: I6a3c1af54d222ef70814d2bb581cc2f3c058bb2f

diff --git a/Repository.mk b/Repository.mk
index 15288f7..65c80e0 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -121,6 +121,7 @@ $(eval $(call gb_Helper_register_executables,OOO, \
 	$(if $(filter-out ANDROID IOS,$(OS)), \
         svdemo \
         svptest \
+        svpclient \
         vcldemo) \
 ))
 
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index a38d076..c8c436a 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -28,6 +28,7 @@ $(eval $(call gb_Module_add_targets,vcl,\
     $(if $(filter-out ANDROID IOS,$(OS)), \
         Executable_svdemo \
         Executable_svptest \
+        Executable_svpclient \
         Executable_vcldemo) \
     Library_vclopengl \
 ))
diff --git a/vcl/workben/svpclient.cxx b/vcl/workben/svpclient.cxx
index 4537158..60823d0 100644
--- a/vcl/workben/svpclient.cxx
+++ b/vcl/workben/svpclient.cxx
@@ -18,7 +18,12 @@
  */
 
 #include <sal/main.h>
+
+#include <cppuhelper/bootstrap.hxx>
+#include <comphelper/processfactory.hxx>
+
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/awt/ImageScaleMode.hpp>
 
 #include <vcl/event.hxx>
@@ -28,6 +33,8 @@
 #include <vcl/lstbox.hxx>
 #include <vcl/imgctrl.hxx>
 #include <vcl/bitmapex.hxx>
+#include <vcl/graphicfilter.hxx>
+#include <vcl/graph.hxx>
 #include <tools/extendapplicationenvironment.hxx>
 #include <tools/stream.hxx>
 
@@ -36,10 +43,6 @@
 
 #include <math.h>
 
-#include <comphelper/processfactory.hxx>
-#include <cppuhelper/servicefactory.hxx>
-#include <cppuhelper/bootstrap.hxx>
-
 #include <errno.h>
 #include <unistd.h>
 #include <stdio.h>
@@ -47,10 +50,9 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 
-using namespace cppu;
-using namespace comphelper;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
+using namespace cppu;
 
 // Forward declaration
 void Main();
@@ -60,23 +62,13 @@ SAL_IMPLEMENT_MAIN()
     tools::extendApplicationEnvironment();
 
     // create the global service-manager
-    Reference< XMultiServiceFactory > xFactory;
-    try
-    {
-        Reference< XComponentContext > xCtx = defaultBootstrap_InitialComponentContext();
-        xFactory = Reference< XMultiServiceFactory >(  xCtx->getServiceManager(), UNO_QUERY );
-        if( xFactory.is() )
-            setProcessServiceFactory( xFactory );
-    }
-    catch(const com::sun::star::uno::Exception&)
-    {
-    }
+    Reference< XComponentContext > xContext = defaultBootstrap_InitialComponentContext();
+    Reference< XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), UNO_QUERY );
 
-    if( ! xFactory.is() )
-    {
-        fprintf( stderr, "Could not bootstrap UNO, installation must be in disorder. Exiting.\n" );
-        exit( 1 );
-    }
+    if( !xServiceManager.is() )
+        Application::Abort( "Failed to bootstrap" );
+
+    comphelper::setProcessServiceFactory( xServiceManager );
 
     InitVCL();
     ::Main();
@@ -235,13 +227,18 @@ IMPL_LINK( MyWin, SelectHdl, ListBox*, )
     {
         OStringBuffer aCommand( 64 );
         aCommand.append( "get " );
-        aCommand.append( OUStringToOString( aEntry.Copy( nPos+2 ), RTL_TEXTENCODING_ASCII_US ) );
+        aCommand.append( OUStringToOString( aEntry.copy( nPos+2 ), RTL_TEXTENCODING_ASCII_US ) );
         OString aAnswer( processCommand( aCommand.makeStringAndClear() ) );
         SvMemoryStream aStream( aAnswer.getLength() );
         aStream.Write( aAnswer.getStr(), aAnswer.getLength() );
         aStream.Seek( STREAM_SEEK_TO_BEGIN );
-        Bitmap aBitmap;
-        aStream >> aBitmap;
+
+        Graphic aGraphicResult;
+        GraphicFilter &rFilter = GraphicFilter::GetGraphicFilter();
+        rFilter.ImportGraphic( aGraphicResult, OUString("import"), aStream );
+
+        Bitmap aBitmap = aGraphicResult.GetBitmap();
+
         fprintf( stderr, "got bitmap of size %ldx%ld\n",
                  sal::static_int_cast< long >(aBitmap.GetSizePixel().Width()),
                  sal::static_int_cast< long >(aBitmap.GetSizePixel().Height()));
commit c0d5da912302ed14469ba3ed0900d346122d34b0
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Sun May 18 16:07:08 2014 +1000

    vcl: fix svptest
    
    Change-Id: Ibaec6e027aa9fd61824ff6b4f1f71b69d217dfdc

diff --git a/Repository.mk b/Repository.mk
index db18c10..15288f7 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -120,6 +120,7 @@ $(eval $(call gb_Helper_register_executables,OOO, \
 	) \
 	$(if $(filter-out ANDROID IOS,$(OS)), \
         svdemo \
+        svptest \
         vcldemo) \
 ))
 
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 641d061..a38d076 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -27,6 +27,7 @@ $(eval $(call gb_Module_add_targets,vcl,\
         Executable_ui-previewer) \
     $(if $(filter-out ANDROID IOS,$(OS)), \
         Executable_svdemo \
+        Executable_svptest \
         Executable_vcldemo) \
     Library_vclopengl \
 ))
diff --git a/vcl/workben/svptest.cxx b/vcl/workben/svptest.cxx
index 0078e7b..134a4fd 100644
--- a/vcl/workben/svptest.cxx
+++ b/vcl/workben/svptest.cxx
@@ -19,7 +19,12 @@
 
 #include <sal/main.h>
 #include <tools/extendapplicationenvironment.hxx>
+
+#include <cppuhelper/bootstrap.hxx>
+#include <comphelper/processfactory.hxx>
+
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
 
 #include <vcl/event.hxx>
 #include <vcl/svapp.hxx>
@@ -34,12 +39,9 @@
 
 #include <math.h>
 
-#include <comphelper/processfactory.hxx>
-#include <cppuhelper/servicefactory.hxx>
-#include <cppuhelper/bootstrap.hxx>
-
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
+using namespace cppu;
 
 // Forward declaration
 void Main();
@@ -48,10 +50,13 @@ SAL_IMPLEMENT_MAIN()
 {
     tools::extendApplicationEnvironment();
 
-    Reference< XMultiServiceFactory > xMS;
-    xMS = cppu::createRegistryServiceFactory( OUString( "types.rdb" ), OUString( "applicat.rdb" ), true );
+    Reference< XComponentContext > xContext = defaultBootstrap_InitialComponentContext();
+    Reference< XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), UNO_QUERY );
+
+    if( !xServiceManager.is() )
+        Application::Abort( "Failed to bootstrap" );
 
-    comphelper::setProcessServiceFactory( xMS );
+    comphelper::setProcessServiceFactory( xServiceManager );
 
     InitVCL();
     ::Main();
commit 37c766dcde54412050bda323dd6f146b22232e60
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Sun May 18 15:56:42 2014 +1000

    vcl: make vcldemo work
    
    Change-Id: Icef2d988c37fb7b25245ad9f3f3856fa86f76a77

diff --git a/Repository.mk b/Repository.mk
index 53049ac..db18c10 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -118,7 +118,9 @@ $(eval $(call gb_Helper_register_executables,OOO, \
 		unopkg \
 		unopkg_com \
 	) \
-	$(if $(filter-out ANDROID IOS,$(OS)),svdemo) \
+	$(if $(filter-out ANDROID IOS,$(OS)), \
+        svdemo \
+        vcldemo) \
 ))
 
 $(eval $(call gb_Helper_register_executables_for_install,UREBIN,ure,\
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 35a08bb..641d061 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -25,7 +25,9 @@ $(eval $(call gb_Module_add_targets,vcl,\
     $(if $(filter DESKTOP,$(BUILD_TYPE)), \
         StaticLibrary_vclmain \
         Executable_ui-previewer) \
-    $(if $(filter-out ANDROID IOS,$(OS)),Executable_svdemo) \
+    $(if $(filter-out ANDROID IOS,$(OS)), \
+        Executable_svdemo \
+        Executable_vcldemo) \
     Library_vclopengl \
 ))
 
diff --git a/vcl/workben/svdem.cxx b/vcl/workben/svdem.cxx
index 5cc7d9c..3224694 100644
--- a/vcl/workben/svdem.cxx
+++ b/vcl/workben/svdem.cxx
@@ -31,8 +31,6 @@
 #include <vcl/wrkwin.hxx>
 #include <vcl/msgbox.hxx>
 
-#include <cstdio>
-
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
 using namespace cppu;
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index 80c5d66..3ce00ed 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -19,22 +19,24 @@
 
 #include <sal/main.h>
 #include <tools/extendapplicationenvironment.hxx>
+
+#include <cppuhelper/bootstrap.hxx>
+#include <comphelper/processfactory.hxx>
+
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
 
 #include <vcl/event.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/wrkwin.hxx>
 #include <vcl/msgbox.hxx>
 
-#include <comphelper/processfactory.hxx>
-#include <cppuhelper/servicefactory.hxx>
-#include <cppuhelper/bootstrap.hxx>
-
 #include <unistd.h>
 #include <stdio.h>
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
+using namespace cppu;
 
 // Forward declaration
 void Main();
@@ -43,10 +45,13 @@ SAL_IMPLEMENT_MAIN()
 {
     tools::extendApplicationEnvironment();
 
-    Reference< XMultiServiceFactory > xMS;
-    xMS = cppu::createRegistryServiceFactory( OUString( "types.rdb" ), OUString( "applicat.rdb" ), true );
+    Reference< XComponentContext > xContext = defaultBootstrap_InitialComponentContext();
+    Reference< XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), UNO_QUERY );
+
+    if( !xServiceManager.is() )
+        Application::Abort( "Failed to bootstrap" );
 
-    comphelper::setProcessServiceFactory( xMS );
+    comphelper::setProcessServiceFactory( xServiceManager );
 
     InitVCL();
     ::Main();


More information about the Libreoffice-commits mailing list