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, \ ...@@ -121,6 +121,7 @@ $(eval $(call gb_Helper_register_executables,OOO, \
$(if $(filter-out ANDROID IOS,$(OS)), \ $(if $(filter-out ANDROID IOS,$(OS)), \
svdemo \ svdemo \
svptest \ svptest \
svpclient \
vcldemo) \ vcldemo) \
)) ))
......
...@@ -28,6 +28,7 @@ $(eval $(call gb_Module_add_targets,vcl,\ ...@@ -28,6 +28,7 @@ $(eval $(call gb_Module_add_targets,vcl,\
$(if $(filter-out ANDROID IOS,$(OS)), \ $(if $(filter-out ANDROID IOS,$(OS)), \
Executable_svdemo \ Executable_svdemo \
Executable_svptest \ Executable_svptest \
Executable_svpclient \
Executable_vcldemo) \ Executable_vcldemo) \
Library_vclopengl \ Library_vclopengl \
)) ))
......
...@@ -18,7 +18,12 @@ ...@@ -18,7 +18,12 @@
*/ */
#include <sal/main.h> #include <sal/main.h>
#include <cppuhelper/bootstrap.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/awt/ImageScaleMode.hpp> #include <com/sun/star/awt/ImageScaleMode.hpp>
#include <vcl/event.hxx> #include <vcl/event.hxx>
...@@ -28,6 +33,8 @@ ...@@ -28,6 +33,8 @@
#include <vcl/lstbox.hxx> #include <vcl/lstbox.hxx>
#include <vcl/imgctrl.hxx> #include <vcl/imgctrl.hxx>
#include <vcl/bitmapex.hxx> #include <vcl/bitmapex.hxx>
#include <vcl/graphicfilter.hxx>
#include <vcl/graph.hxx>
#include <tools/extendapplicationenvironment.hxx> #include <tools/extendapplicationenvironment.hxx>
#include <tools/stream.hxx> #include <tools/stream.hxx>
...@@ -36,10 +43,6 @@ ...@@ -36,10 +43,6 @@
#include <math.h> #include <math.h>
#include <comphelper/processfactory.hxx>
#include <cppuhelper/servicefactory.hxx>
#include <cppuhelper/bootstrap.hxx>
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
...@@ -47,10 +50,9 @@ ...@@ -47,10 +50,9 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
using namespace cppu;
using namespace comphelper;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang; using namespace ::com::sun::star::lang;
using namespace cppu;
// Forward declaration // Forward declaration
void Main(); void Main();
...@@ -60,23 +62,13 @@ SAL_IMPLEMENT_MAIN() ...@@ -60,23 +62,13 @@ SAL_IMPLEMENT_MAIN()
tools::extendApplicationEnvironment(); tools::extendApplicationEnvironment();
// create the global service-manager // create the global service-manager
Reference< XMultiServiceFactory > xFactory; Reference< XComponentContext > xContext = defaultBootstrap_InitialComponentContext();
try Reference< XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), UNO_QUERY );
{
Reference< XComponentContext > xCtx = defaultBootstrap_InitialComponentContext();
xFactory = Reference< XMultiServiceFactory >( xCtx->getServiceManager(), UNO_QUERY );
if( xFactory.is() )
setProcessServiceFactory( xFactory );
}
catch(const com::sun::star::uno::Exception&)
{
}
if( ! xFactory.is() ) if( !xServiceManager.is() )
{ Application::Abort( "Failed to bootstrap" );
fprintf( stderr, "Could not bootstrap UNO, installation must be in disorder. Exiting.\n" );
exit( 1 ); comphelper::setProcessServiceFactory( xServiceManager );
}
InitVCL(); InitVCL();
::Main(); ::Main();
...@@ -235,13 +227,18 @@ IMPL_LINK( MyWin, SelectHdl, ListBox*, ) ...@@ -235,13 +227,18 @@ IMPL_LINK( MyWin, SelectHdl, ListBox*, )
{ {
OStringBuffer aCommand( 64 ); OStringBuffer aCommand( 64 );
aCommand.append( "get " ); 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() ) ); OString aAnswer( processCommand( aCommand.makeStringAndClear() ) );
SvMemoryStream aStream( aAnswer.getLength() ); SvMemoryStream aStream( aAnswer.getLength() );
aStream.Write( aAnswer.getStr(), aAnswer.getLength() ); aStream.Write( aAnswer.getStr(), aAnswer.getLength() );
aStream.Seek( STREAM_SEEK_TO_BEGIN ); 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", fprintf( stderr, "got bitmap of size %ldx%ld\n",
sal::static_int_cast< long >(aBitmap.GetSizePixel().Width()), sal::static_int_cast< long >(aBitmap.GetSizePixel().Width()),
sal::static_int_cast< long >(aBitmap.GetSizePixel().Height())); 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