diff options
-rw-r--r-- | android/sdremote/src/org/libreoffice/impressremote/TestClient.java | 2 | ||||
-rw-r--r-- | sd/Library_sd.mk | 1 | ||||
-rw-r--r-- | sd/source/ui/inc/Server.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/Listener.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/Receiver.cxx | 97 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/Receiver.hxx | 6 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/Server.cxx | 16 |
7 files changed, 18 insertions, 108 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/TestClient.java b/android/sdremote/src/org/libreoffice/impressremote/TestClient.java index 1b0f749b8c17..4d716adac2a9 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/TestClient.java +++ b/android/sdremote/src/org/libreoffice/impressremote/TestClient.java @@ -158,8 +158,6 @@ public class TestClient extends Activity { mImageView.setImageBitmap(aBitmap); mCurrentPreviewImageMissing = false; } - mImageView.setImageBitmap(aBitmap); - // TODO: remove above line, use slide changed to show image. break; } diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk index 357be12fec04..0a371cec04e0 100644 --- a/sd/Library_sd.mk +++ b/sd/Library_sd.mk @@ -317,6 +317,7 @@ $(eval $(call gb_Library_add_exception_objects,sd,\ sd/source/ui/presenter/PresenterPreviewCache \ sd/source/ui/presenter/PresenterTextView \ sd/source/ui/presenter/SlideRenderer \ + sd/source/ui/remotecontrol/ImagePreparer \ sd/source/ui/remotecontrol/Server \ sd/source/ui/remotecontrol/Receiver \ sd/source/ui/remotecontrol/Listener \ diff --git a/sd/source/ui/inc/Server.hxx b/sd/source/ui/inc/Server.hxx index b0dcc1c62a75..065b1cdbc67b 100644 --- a/sd/source/ui/inc/Server.hxx +++ b/sd/source/ui/inc/Server.hxx @@ -35,6 +35,7 @@ namespace sd class Transmitter; class Listener; + class ImagePreparer; class Server : public salhelper::Thread { @@ -53,6 +54,7 @@ namespace sd void execute(); static Transmitter *pTransmitter; static rtl::Reference<Listener> mListener; + static rtl::Reference<ImagePreparer> mPreparer; }; } diff --git a/sd/source/ui/remotecontrol/Listener.cxx b/sd/source/ui/remotecontrol/Listener.cxx index e51bb57572b9..9607707b98df 100644 --- a/sd/source/ui/remotecontrol/Listener.cxx +++ b/sd/source/ui/remotecontrol/Listener.cxx @@ -101,7 +101,7 @@ void SAL_CALL Listener::slideTransitionStarted (void) sal_Int32 aSlide = mController->getCurrentSlideIndex(); OStringBuffer aBuilder( "slide_updated\n" ); - aBuilder.append( OString::valueOf( aSlide + 1 ) ); // Slides are numbered from 0 + aBuilder.append( OString::valueOf( aSlide ) ); aBuilder.append( "\n\n" ); if ( pTransmitter ) diff --git a/sd/source/ui/remotecontrol/Receiver.cxx b/sd/source/ui/remotecontrol/Receiver.cxx index 86a1a03decae..654664add5a3 100644 --- a/sd/source/ui/remotecontrol/Receiver.cxx +++ b/sd/source/ui/remotecontrol/Receiver.cxx @@ -12,10 +12,8 @@ #include <com/sun/star/presentation/XPresentationSupplier.hpp> #include <com/sun/star/presentation/XPresentation2.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> -#include <com/sun/star/document/XFilter.hpp> -#include <com/sun/star/document/XExporter.hpp> #include <com/sun/star/uno/RuntimeException.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> + #include <comphelper/processfactory.hxx> #include <osl/file.hxx> @@ -110,99 +108,6 @@ void Receiver::parseCommand( std::vector<OString> aCommand ) xSlideShowController->resume(); } } - // FIXME: remove later, this is just to test functionality -// sendPreview( 0, xSlideShowController, mTransmitter ); - -} - -void sendPreview( sal_uInt32 aSlideNumber, - const uno::Reference<presentation::XSlideShowController>& xSlideShowController, Transmitter *aTransmitter ) -{ - - sal_uInt64 aSize; // Unused - uno::Sequence<sal_Int8> aImageData = preparePreview( aSlideNumber, xSlideShowController, 320, 240, aSize ); - rtl::OUStringBuffer aStrBuffer; - ::sax::Converter::encodeBase64( aStrBuffer, aImageData ); - - OString aEncodedShortString = rtl::OUStringToOString( - aStrBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ); - - // Start the writing - rtl::OStringBuffer aBuffer; - - aBuffer.append( "slide_preview\n" ); - - rtl::OString aSlideNumberString( rtl::OString::valueOf( sal_Int32(2) ) ); // FIXME get number - aBuffer.append( aSlideNumberString.getStr() ); - aBuffer.append( "\n" ); - - aBuffer.append( aEncodedShortString.getStr() ); - aBuffer.append( "\n\n" ); - aTransmitter->addMessage( aBuffer.makeStringAndClear(), Transmitter::Priority::LOW ); - -} - -uno::Sequence<sal_Int8> -preparePreview(sal_uInt32 aSlideNumber, - const uno::Reference<presentation::XSlideShowController>& xSlideShowController, - sal_uInt32 aWidth, sal_uInt32 aHeight, sal_uInt64 &rSize ) -{ - (void)aWidth; (void)aHeight; // FIXME: remove me when I'm used - // Create temp file - OUString aFileURL; - FileBase::createTempFile( 0, 0, &aFileURL ); - - uno::Reference< lang::XMultiServiceFactory > xServiceManager( - ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); - - uno::Reference< document::XFilter > xFilter( xServiceManager->createInstance( - "com.sun.star.drawing.GraphicExportFilter" ) , uno::UNO_QUERY_THROW ); - - uno::Reference< document::XExporter > xExporter( xFilter, uno::UNO_QUERY_THROW ); - - uno::Reference< lang::XComponent > xSourceDoc( - xSlideShowController->getSlideByIndex( aSlideNumber ) , uno::UNO_QUERY_THROW ); - - xExporter->setSourceDocument( xSourceDoc ); - - uno::Sequence< beans::PropertyValue > aFilterData(3); - aFilterData[0].Name = "PixelWidth"; - aFilterData[0].Value <<= sal_Int32(2000); - aFilterData[1].Name = "PixelHeight"; - aFilterData[1].Value <<= sal_Int32(2000); - - // Add quality if jpg "Quality" [1-100] - // FIXME: is setting color mode needed. - aFilterData[2].Name = "ColorMode"; - aFilterData[2].Value <<= sal_Int32(0); // Color - - uno::Sequence< beans::PropertyValue > aProps(3); - aProps[0].Name = "MediaType"; - aProps[0].Value <<= OUString( "image/png" ); - - aProps[1].Name = "URL"; - aProps[1].Value <<= aFileURL; - - aProps[2].Name = "FilterData"; - aProps[2].Value <<= aFilterData; - - xFilter->filter( aProps ); - - // FIXME: error handling. - - File aFile( aFileURL ); - aFile.open(0); - sal_uInt64 aRead; - rSize = 0; - aFile.getSize( rSize ); - uno::Sequence<sal_Int8> aContents( rSize ); - - aFile.read( aContents.getArray(), rSize, aRead ); - aFile.close(); - File::remove( aFileURL ); - return aContents; - } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/remotecontrol/Receiver.hxx b/sd/source/ui/remotecontrol/Receiver.hxx index 99245d83525b..5c739136000a 100644 --- a/sd/source/ui/remotecontrol/Receiver.hxx +++ b/sd/source/ui/remotecontrol/Receiver.hxx @@ -38,11 +38,5 @@ private: }; } - -css::uno::Sequence<sal_Int8> preparePreview(sal_uInt32 aSlideNumber, const css::uno::Reference<css::presentation::XSlideShowController>& xSlideShowController, sal_uInt32 aWidth, sal_uInt32 aHeight, sal_uInt64 &aSize ); - -void sendPreview(sal_uInt32 aSlideNumber, const css::uno::Reference< - css::presentation::XSlideShowController>& xSlideShowController, sd::Transmitter *aTransmitter ); - #endif // _SD_IMPRESSREMOTE_RECEIVER_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/remotecontrol/Server.cxx b/sd/source/ui/remotecontrol/Server.cxx index 361954df0a01..ab6a212d56f4 100644 --- a/sd/source/ui/remotecontrol/Server.cxx +++ b/sd/source/ui/remotecontrol/Server.cxx @@ -13,10 +13,11 @@ #include <comphelper/processfactory.hxx> #include "sddll.hxx" -#include "Server.hxx" -#include "Receiver.hxx" -#include "Listener.hxx" +#include "ImagePreparer.hxx" +#include "Listener.hxx" +#include "Receiver.hxx" +#include "Server.hxx" using namespace std; using namespace sd; @@ -94,6 +95,11 @@ void Server::listenThread() // TODO: deal with transmision errors gracefully. mListener->disposing(); mListener = NULL; + + if ( mPreparer.is() ) + delete mPreparer.get(); + mPreparer = NULL; + delete pTransmitter; pTransmitter = NULL; fprintf( stderr, "Finished listening\n" ); @@ -134,6 +140,9 @@ void Server::presentationStarted( const css::uno::Reference< { mListener = rtl::Reference<Listener>( new Listener( spServer, pTransmitter ) ); mListener->init( rController ); + + mPreparer = rtl::Reference<ImagePreparer>( new ImagePreparer( rController, pTransmitter ) ); + mPreparer->launch(); } } @@ -142,6 +151,7 @@ void Server::presentationStarted( const css::uno::Reference< Server *sd::Server::spServer = NULL; Transmitter *sd::Server::pTransmitter = NULL; rtl::Reference<Listener> sd::Server::mListener = NULL; +rtl::Reference<ImagePreparer> sd::Server::mPreparer = NULL; void Server::setup() { |