diff options
author | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2012-07-30 09:56:15 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-08-06 10:23:07 +0100 |
commit | 292bc25e49a1797ef07736c227d74aa105822e6a (patch) | |
tree | 406b0aee041433d23e11988aeccefa07104b684b | |
parent | 0c1f4762caf333d2f32671d2113e450bccd003b8 (diff) |
Basic (unstyled) note export and display working.
Change-Id: Ic17267131d9a777955cd55415e5fe1e106d09e10
5 files changed, 47 insertions, 3 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java index cf45e09d9cb4..6372556a55c5 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java @@ -91,8 +91,10 @@ public class PresentationFragment extends Fragment { } private void updateSlideNumberDisplay() { - mNumberText.setText((mSlideShow.getCurrentSlide() + 1) + "/" - + mSlideShow.getSize()); + int aSlide = mSlideShow.getCurrentSlide(); + mNumberText.setText((aSlide + 1) + "/" + mSlideShow.getSize()); + mNotes.loadData("<html><body>" + mSlideShow.getNotes(aSlide) + + "</html></body>", "text/html", null); } // -------------------------------------------------- RESIZING LISTENER ---- diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java index b03c03b3d2f8..258bff1b26be 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java @@ -34,6 +34,7 @@ public class CommunicationService extends Service { public static final int MSG_SLIDESHOW_STARTED = 1; public static final int MSG_SLIDE_CHANGED = 2; public static final int MSG_SLIDE_PREVIEW = 3; + public static final int MSG_SLIDE_NOTES = 4; private Transmitter mTransmitter; diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java index e78f07ed4a06..1cecd49a0000 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java @@ -90,6 +90,28 @@ public class Receiver { // TODO Auto-generated catch block e.printStackTrace(); } + } else if (aInstruction.equals("slide_notes")) { + int aSlideNumber = Integer.parseInt(aCommand.get(1)); + String aNotes = new String(); + for (int i = 2; i < aCommand.size(); i++) { + aNotes += aCommand.get(i); + } + + // Store image internally + mSlideShow.putNotes(aSlideNumber, aNotes); + + // Notify the frontend + Message aMessage = Message.obtain(null, + CommunicationService.MSG_SLIDE_NOTES); + Bundle aData = new Bundle(); + aData.putInt("slide_number", aSlideNumber); + aMessage.setData(aData); + try { + mActivityMessenger.send(aMessage); + } catch (RemoteException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } } diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java b/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java index 75b13a84f049..74f9ba958305 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java @@ -15,6 +15,8 @@ import android.util.SparseArray; public class SlideShow { private SparseArray<byte[]> mPreviewImages = new SparseArray<byte[]>(); + private SparseArray<String> mNotes = new SparseArray<String>(); + private int mSize = 0; private int mCurrentSlide = 0; @@ -46,6 +48,14 @@ public class SlideShow { return BitmapFactory.decodeByteArray(aImage, 0, aImage.length); } + protected void putNotes(int aSlide, String aNotes) { + mNotes.put(aSlide, aNotes); + } + + public String getNotes(int aSlide) { + return mNotes.get(aSlide); + } + // ---------------------------------------------------- TIMER -------------- private Timer mTimer = new Timer(); diff --git a/sd/source/ui/remotecontrol/ImagePreparer.cxx b/sd/source/ui/remotecontrol/ImagePreparer.cxx index 17fdc091f290..fa2f81c43500 100644 --- a/sd/source/ui/remotecontrol/ImagePreparer.cxx +++ b/sd/source/ui/remotecontrol/ImagePreparer.cxx @@ -38,6 +38,7 @@ #include <com/sun/star/document/XFilter.hpp> #include <com/sun/star/document/XExporter.hpp> #include <com/sun/star/lang/XServiceName.hpp> +#include <com/sun/star/presentation/XPresentationPage.hpp> #include <com/sun/star/text/XTextRange.hpp> using namespace ::sd; @@ -221,16 +222,24 @@ OString ImagePreparer::prepareNotes( sal_uInt32 aSlideNumber ) if ( !xController->isRunning() ) return ""; + uno::Reference<css::drawing::XDrawPage> aNotesPage; uno::Reference< drawing::XDrawPage > xSourceDoc( xController->getSlideByIndex( aSlideNumber ), uno::UNO_QUERY_THROW ); + uno::Reference<presentation::XPresentationPage> xPresentationPage( + xSourceDoc, UNO_QUERY); + if (xPresentationPage.is()) + aNotesPage = xPresentationPage->getNotesPage(); + else + return ""; + static const ::rtl::OUString sNotesShapeName ( "com.sun.star.presentation.NotesShape" ); static const ::rtl::OUString sTextShapeName ( "com.sun.star.drawing.TextShape" ); - uno::Reference<container::XIndexAccess> xIndexAccess ( xSourceDoc, UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess ( aNotesPage, UNO_QUERY); if (xIndexAccess.is()) { |