Hello,
I worked a little on "add slide thumbnails to HTML export" part.
The code compiles ok with Debian testing updated x86 (and no parameter
at all in autogen), gcc (Debian 4.5.2-4)
I only tried this :
- create a impress document with 2 slides
- export to XHTML, HTML and save it in test.html
then I got these files :
- test.html
- img0.png
- img1.png
- thumb0.png
- thumb1.png
- text0.html
- text1.html
I don't know if it's what was expected but i'm sure it needs some
reviewing since I added, changed and removed 1 or 2 things from the
original patch.
If this patch is ok, i can of course push it.
Julien.
commit a60dd719453536a559801619f0c5a5af0cfc2701
Author: Julien Nabet <serval2412@yahoo.fr>
Date: Fri Mar 25 00:11:37 2011 +0100
Try to resurrect "add slide thumbnails to HTML export" part
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index 2687a6e..64e2b7e 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -387,7 +387,7 @@ HtmlExport::HtmlExport(
meMode( PUBLISH_HTML ),
mbContentsPage(false),
mnButtonThema(-1),
- mnWidthPixel( PUB_LOWRES_WIDTH ),
+ mnWidthPixel( PUB_MEDRES_WIDTH ),
meFormat( FORMAT_JPG ),
mbNotes(false),
mnCompression( -1 ),
@@ -399,6 +399,7 @@ HtmlExport::HtmlExport(
maHTMLExtension(SdResId(STR_HTMLEXP_DEFAULT_EXTENSION)),
mpHTMLFiles(NULL),
mpImageFiles(NULL),
+ mpThumbnailFiles(NULL),
mpPageNames(NULL),
mpTextFiles(NULL),
maIndexUrl(RTL_CONSTASCII_USTRINGPARAM("index")),
@@ -437,12 +438,13 @@ HtmlExport::~HtmlExport()
// ------------------------------------------------------------------
// Listen loeschen
// ------------------------------------------------------------------
- if(mpImageFiles && mpHTMLFiles && mpPageNames && mpTextFiles)
+ if(mpImageFiles && mpHTMLFiles && mpThumbnailFiles && mpPageNames && mpTextFiles )
{
for ( sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
{
delete mpImageFiles[nSdPage];
delete mpHTMLFiles[nSdPage];
+ delete mpThumbnailFiles[nSdPage];
delete mpPageNames[nSdPage];
delete mpTextFiles[nSdPage];
}
@@ -450,6 +452,7 @@ HtmlExport::~HtmlExport()
delete[] mpImageFiles;
delete[] mpHTMLFiles;
+ delete[] mpThumbnailFiles;
delete[] mpPageNames;
delete[] mpTextFiles;
}
@@ -740,6 +743,11 @@ void HtmlExport::ExportHtml()
if( !CreateImagesForPresPages() )
break;
+ if( mbContentsPage &&
+ !CreateImagesForPresPages( true ) )
+ break;
+
+
if( !CreateHtmlForPresPages() )
break;
@@ -973,7 +981,7 @@ bool HtmlExport::SavePresentation()
// =====================================================================
// Image-Dateien anlegen
// =====================================================================
-bool HtmlExport::CreateImagesForPresPages()
+bool HtmlExport::CreateImagesForPresPages( bool bThumbnail)
{
try
{
@@ -990,9 +998,9 @@ bool HtmlExport::CreateImagesForPresPages()
Sequence< PropertyValue > aFilterData(((meFormat==FORMAT_JPG)&&(mnCompression != -1))? 3 :
2);
aFilterData[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("PixelWidth") );
- aFilterData[0].Value <<= (sal_Int32)mnWidthPixel;
+ aFilterData[0].Value <<= (sal_Int32)(bThumbnail ? PUB_THUMBNAIL_WIDTH : mnWidthPixel );
aFilterData[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("PixelHeight") );
- aFilterData[1].Value <<= (sal_Int32)mnHeightPixel;
+ aFilterData[1].Value <<= (sal_Int32)(bThumbnail ? PUB_THUMBNAIL_HEIGHT : mnHeightPixel);
if((meFormat==FORMAT_JPG)&&(mnCompression != -1))
{
aFilterData[2].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Quality") );
@@ -1019,7 +1027,11 @@ bool HtmlExport::CreateImagesForPresPages()
SdPage* pPage = maPages[ nSdPage ];
OUString aFull(maExportPath);
- aFull += *mpImageFiles[nSdPage];
+ if (bThumbnail)
+ aFull += *mpThumbnailFiles[nSdPage];
+ else
+ aFull += *mpImageFiles[nSdPage];
+
aDescriptor[0].Value <<= aFull;
@@ -1893,7 +1905,7 @@ bool HtmlExport::CreateContentPage()
aStr.AppendAscii( "<center><table width=\"90%\"><tr>\r\n" );
// Inhaltsverzeichnis
- aStr.AppendAscii( "<td valign=\"top\" align=\"left\" width=\"50%\">\r\n" );
+ aStr.AppendAscii( "<td valign=\"top\" align=\"left\" width=\"25%\">\r\n" );
aStr.AppendAscii( "<h3>" );
aStr += RESTOHTML(STR_HTMLEXP_CONTENTS);
aStr.AppendAscii( "</h3>" );
@@ -1911,7 +1923,7 @@ bool HtmlExport::CreateContentPage()
aStr.AppendAscii( "</td>\r\n" );
// Dokument Infos
- aStr.AppendAscii( "<td valign=\"top\" width=\"50%\">\r\n" );
+ aStr.AppendAscii( "<td valign=\"top\" align=\"left\" width=\"75%\">\r\n" );
if(maAuthor.Len())
{
@@ -1962,6 +1974,21 @@ bool HtmlExport::CreateContentPage()
aStr.AppendAscii( "</a></p>\r\n" );
}
+ for(sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
+ {
+ String aText;
+
+ aText.AppendAscii( "<img src=\"" );
+ aText += StringToURL( *mpThumbnailFiles[nSdPage] );
+ aText.AppendAscii( "\" width=\"256\" height=\"192\" alt=\"" );
+ aText += StringToHTMLString( *mpPageNames[nSdPage] );
+ aText.AppendAscii( "\">" );
+
+ aStr += CreateLink(*mpHTMLFiles[nSdPage], aText);
+ aStr.AppendAscii( "\r\n" );
+ }
+
+
aStr.AppendAscii( "</td></tr></table></center>\r\n" );
aStr.AppendAscii( "</body>\r\n</html>" );
@@ -2086,6 +2113,7 @@ void HtmlExport::CreateFileNames()
// Listen mit neuen Dateinamen anlegen
mpHTMLFiles = new String*[mnSdPageCount];
mpImageFiles = new String*[mnSdPageCount];
+ mpThumbnailFiles = new String*[mnSdPageCount];
mpPageNames = new String*[mnSdPageCount];
mpTextFiles = new String*[mnSdPageCount];
@@ -2116,6 +2144,15 @@ void HtmlExport::CreateFileNames()
mpImageFiles[nSdPage] = pName;
+ pName = new String( RTL_CONSTASCII_USTRINGPARAM("thumb") );
+ *pName += String::CreateFromInt32(nSdPage);
+ if( meFormat!=FORMAT_JPG )
+ pName->AppendAscii( ".png" );
+ else
+ pName->AppendAscii( ".jpg" );
+
+ mpThumbnailFiles[nSdPage] = pName;
+
pName = new String( RTL_CONSTASCII_USTRINGPARAM("text"));
*pName += String::CreateFromInt32(nSdPage);
*pName += maHTMLExtension;
@@ -3108,6 +3145,7 @@ bool HtmlExport::checkForExistingFiles()
{
if( (mpImageFiles[nSdPage] && checkFileExists( xFA, *mpImageFiles[nSdPage] )) ||
(mpHTMLFiles[nSdPage] && checkFileExists( xFA, *mpHTMLFiles[nSdPage] )) ||
+ (mpThumbnailFiles[nSdPage] && checkFileExists( xFA, *mpThumbnailFiles[nSdPage] ))
||
(mpPageNames[nSdPage] && checkFileExists( xFA, *mpPageNames[nSdPage] )) ||
(mpTextFiles[nSdPage] && checkFileExists( xFA, *mpTextFiles[nSdPage] )) )
{
diff --git a/sd/source/filter/html/htmlex.hxx b/sd/source/filter/html/htmlex.hxx
index 43af349..09dd697 100644
--- a/sd/source/filter/html/htmlex.hxx
+++ b/sd/source/filter/html/htmlex.hxx
@@ -58,6 +58,9 @@
#define PUB_HIGHRES_WIDTH 1024
#define PUB_HIGHRES_HEIGHT 768
+#define PUB_THUMBNAIL_WIDTH 256
+#define PUB_THUMBNAIL_HEIGHT 192
+
#define HtmlButtonThemaStr = "private://gallery/hidden/HtmlExportButtons";
class List;
@@ -149,6 +152,7 @@ class HtmlExport
String maHTMLExtension;
String** mpHTMLFiles;
String** mpImageFiles;
+ String** mpThumbnailFiles;
String** mpPageNames;
String** mpTextFiles;
@@ -166,7 +170,7 @@ class HtmlExport
void SetDocColors( SdPage* pPage = NULL );
- bool CreateImagesForPresPages();
+ bool CreateImagesForPresPages( bool bThumbnails = false );
bool CreateHtmlTextForPresPages();
bool CreateHtmlForPresPages();
bool CreateContentPage();
Context
- [Libreoffice] Review needed to try to resurrect "add slide thumbnails to HTML export" part · Julien Nabet
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.