Kaydet (Commit) 01c52c3f authored tarafından Chris Sherlock's avatar Chris Sherlock

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
üst c0d5da91
......@@ -121,6 +121,7 @@ $(eval $(call gb_Helper_register_executables,OOO, \
$(if $(filter-out ANDROID IOS,$(OS)), \
svdemo \
svptest \
svpclient \
vcldemo) \
))
......
......@@ -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 \
))
......
......@@ -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()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment