summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2014-05-18 18:13:18 +1000
committerChris Sherlock <chris.sherlock79@gmail.com>2014-05-18 18:16:02 +1000
commit01c52c3f7115569798591320f094e2a3db23bdbf (patch)
tree53ca68885624c0aa65f2e9975f16e6f285627919 /vcl
parentc0d5da912302ed14469ba3ed0900d346122d34b0 (diff)
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
Diffstat (limited to 'vcl')
-rw-r--r--vcl/Module_vcl.mk1
-rw-r--r--vcl/workben/svpclient.cxx47
2 files changed, 23 insertions, 25 deletions
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index a38d0764f612..c8c436ae3171 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 4537158734f6..60823d0e4601 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()));