[Libreoffice-commits] .: Branch 'feature/remote' - android/sdremote sd/source
Andrzej J.R. Hunt
ajrhunt at kemper.freedesktop.org
Mon Jul 30 08:55:22 PDT 2012
android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java | 3
sd/source/ui/remotecontrol/ImagePreparer.cxx | 91 ++++++++++
sd/source/ui/remotecontrol/ImagePreparer.hxx | 1
3 files changed, 93 insertions(+), 2 deletions(-)
New commits:
commit e0cd94d7ba784be7d035b36d1a65382b330e9470
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date: Mon Jul 30 17:54:17 2012 +0200
Attempt to use the XHTML export filter for note export (not functional yet).
Change-Id: Iaf88b879d679a9dabc31468c51fe9b943c2053e5
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
index 6372556..4b759ef 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
@@ -93,8 +93,7 @@ public class PresentationFragment extends Fragment {
private void updateSlideNumberDisplay() {
int aSlide = mSlideShow.getCurrentSlide();
mNumberText.setText((aSlide + 1) + "/" + mSlideShow.getSize());
- mNotes.loadData("<html><body>" + mSlideShow.getNotes(aSlide)
- + "</html></body>", "text/html", null);
+ mNotes.loadData(mSlideShow.getNotes(aSlide), "text/html", null);
}
// -------------------------------------------------- RESIZING LISTENER ----
diff --git a/sd/source/ui/remotecontrol/ImagePreparer.cxx b/sd/source/ui/remotecontrol/ImagePreparer.cxx
index fa2f81c..06ebc4c 100644
--- a/sd/source/ui/remotecontrol/ImagePreparer.cxx
+++ b/sd/source/ui/remotecontrol/ImagePreparer.cxx
@@ -35,6 +35,7 @@
#include <rtl/strbuf.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/document/XExporter.hpp>
#include <com/sun/star/lang/XServiceName.hpp>
@@ -82,6 +83,7 @@ void ImagePreparer::execute()
}
sendNotes( i );
}
+// notesToHtml( 0 );
mRef.clear();
}
@@ -207,13 +209,102 @@ void ImagePreparer::sendNotes( sal_uInt32 aSlideNumber )
aBuffer.append( OString::valueOf( sal_Int32( aSlideNumber ) ).getStr() );
aBuffer.append( "\n" );
+ aBuffer.append( "<html><body>" );
aBuffer.append( aNotes );
+ aBuffer.append( "</html></body>" );
aBuffer.append( "\n\n" );
pTransmitter->addMessage( aBuffer.makeStringAndClear(),
Transmitter::Priority::LOW );
}
+OString ImagePreparer::notesToHtml( sal_uInt32 aSlideNumber )
+{
+ OString aRet("");
+
+ OUString aFileURL;
+ FileBase::createTempFile( 0, 0, &aFileURL );
+ fprintf( stderr, OUStringToOString( aFileURL, RTL_TEXTENCODING_UTF8).getStr() );
+
+ if ( !xController->isRunning() )
+ return "";
+
+ // Get the filter
+ uno::Reference< lang::XMultiServiceFactory > xServiceManager(
+ ::comphelper::getProcessServiceFactory(),
+ uno::UNO_QUERY_THROW );
+
+ uno::Reference< container::XNameAccess > xFilterFactory(
+ xServiceManager->createInstance( "com.sun.star.document.FilterFactory" ), uno::UNO_QUERY_THROW );
+
+ if ( xFilterFactory->hasByName( "com.sun.star.comp.Writer.XmlFilterAdaptor" ) )
+ fprintf ( stderr, "Is contained\n" );
+ else fprintf( stderr, "Not contained\n" );
+
+// uno::Sequence<Any> aList(6);
+// aList[0] <<= OUString("com.sun.star.documentconversion.XSLTFilter");
+// aList[1] <<= OUString("");
+// aList[2] <<= OUString("com.sun.star.comp.Impress.XMLOasisImporter");
+// aList[3] <<= OUString("com.sun.star.comp.Impress.XMLOasisExporter"),
+// aList[4] <<= OUString("");
+// aList[5] <<= OUString("../share/xslt/export/xhtml/opendoc2xhtml.xsl");
+
+// uno::Reference< lang::XMultiServiceFactory > xFilterF( xFilterFactory, uno::UNO_QUERY_THROW );
+// xFilterF->createInstanceWithArguments(OUString("com.sun.star.comp.Writer.XmlFilterAdaptor"), aList);
+
+ css::uno::Reference< document::XFilter > xFilter( xFilterFactory->getByName(
+ "com.sun.star.comp.Writer.XmlFilterAdaptor" ), uno::UNO_QUERY_THROW );
+
+ // Get the page
+ uno::Reference< lang::XComponent > xNotesPage;
+ uno::Reference< drawing::XDrawPage > xSourceDoc(
+ xController->getSlideByIndex( aSlideNumber ),
+ uno::UNO_QUERY_THROW );
+
+ uno::Reference<presentation::XPresentationPage> xPresentationPage(
+ xSourceDoc, UNO_QUERY);
+ if (xPresentationPage.is())
+ xNotesPage = uno::Reference< lang::XComponent >(
+ xPresentationPage->getNotesPage(), uno::UNO_QUERY_THROW );
+ else
+ return "";
+
+ // Start Exporting
+ uno::Reference< document::XExporter > xExporter( xFilter,
+ uno::UNO_QUERY_THROW );
+
+ xExporter->setSourceDocument( xNotesPage );
+
+ uno::Sequence< beans::PropertyValue > aProps(1);
+
+ aProps[0].Name = "URL";
+ aProps[0].Value <<= aFileURL;
+
+// aProps[1].Name = "com.sun.star.comp.Impress.XMLOasisExporter";
+// aProps[1].Value <<= OUString( "../share/xslt/export/xhtml/opendoc2xhtml.xsl" );
+// aProps[2].Name = "FilterData";
+// aProps[2].Value <<= aFilterData;
+
+ fprintf( stderr, "Trying to filter\n" );
+ 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;
+
+ return aRet;
+}
+
// Code copied from sdremote/source/presenter/PresenterNotesView.cxx
OString ImagePreparer::prepareNotes( sal_uInt32 aSlideNumber )
{
diff --git a/sd/source/ui/remotecontrol/ImagePreparer.hxx b/sd/source/ui/remotecontrol/ImagePreparer.hxx
index 130eeb6..2adf228 100644
--- a/sd/source/ui/remotecontrol/ImagePreparer.hxx
+++ b/sd/source/ui/remotecontrol/ImagePreparer.hxx
@@ -45,6 +45,7 @@ private:
void sendNotes( sal_uInt32 aSlideNumber );
rtl::OString prepareNotes( sal_uInt32 aSlideNumber );
+ rtl::OString notesToHtml( sal_uInt32 aSlideNumber );
};
}
More information about the Libreoffice-commits
mailing list