Difference between revisions of "OpenOffice.org Internship/Projects/2010/Customizable html export for Impress"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Downloads)
(Phases)
Line 41: Line 41:
  
 
PHASE II
 
PHASE II
* Develop a prototype template extension -- ''In progress''
+
* Develop a prototype template extension -- ''done''
 
* Implement the extension with basic export -- ''done''
 
* Implement the extension with basic export -- ''done''
 
* Add support for Index/Notes/TextView/Navigation to HTML/javasript. -- ''In progress''
 
* Add support for Index/Notes/TextView/Navigation to HTML/javasript. -- ''In progress''
Line 59: Line 59:
 
* Make a small browser based(cross platform) template development IDE to make development and deployment of templates easy.
 
* Make a small browser based(cross platform) template development IDE to make development and deployment of templates easy.
 
* Implement webcast support(with today's new age technology)
 
* Implement webcast support(with today's new age technology)
 
  
 
===Enhancements/bugs to be cured===
 
===Enhancements/bugs to be cured===

Revision as of 04:23, 29 September 2010

Updated: 21/9/10 (see Update History for details)

Overview

The current html export for OOo impress and draw application produces outdated html. The goal of this internship project is to create a new html export extension that will replace the currently available html export in impress and draw. The extension should make use of modern html elements including css and javascript and support a template system so that non coders are able to alter the results of the generated html output.


Goals/Requirements

  • An OOo extension that exports a set of files that make the current presentation document (or draw) viewable in any current browser
  • The extension must include a settings dialog to configure the output during export
  • The extension must support templates, a template will define the visual style and the user interaction elements like navigation buttons or table of contents etc.
  • Template must not be 'hard coded' in the extension so adding more templates is possible without changing and compiling source code.
  • The extension must include 2-3 sample templates that are both "user friendly" and "visual appealing“
  • The extension must support the key features from the old HTML export (export of links, adding additional information like creator, email, automatic slide advances, etc)
  • The extension must be able to also export selected text from the presentation like title, outline and subtitle text. This is mainly an accessibility feature to enable visually impaired users to read the contents of the exported presentation.
  • Export should an alternative text only view or a text overlay to support accessibility.
  • There should be no connection to the installed OpenOffice or any extensions, the files we put in the export directory must include everything needed.
  • The generated html file should be as simple as possible. All functionality should come from the template. Goal is to make developing, modifying templates easier for the user, not for us.
  • Templates should not make use of any javascript library to avoid conflicts with web pages where other versions of this library are used or incompatible other libraries are used.
  • All important configuration should be done during export.
  • Easy integration in existing web pages
  • The created output should provide a fall-back if javascript is disabled in the browser.
  • The templates used by the extension should be made installable via extensions themselves so others can contribute templates too.
  • Implement a powerful easy to use and easy to develop template system.
  • Automatic Presentation System(slide incrementer)
  • Support for outline and notes in the exported presentation.
  • Support for Audio.
  • Export should also contain information about the presentation.


Project plan

This section describes the various phases, bugs to be corrected and current domain of work.

Phases

PHASE I

  • Develop how templates will be implemented-- done
  • Develop a basic prototype template and format-- done
  • Define format of html output created by the extension -- done
  • Develop the JavaScript core and template development API(minimal form)-- done
  • Develop system to integrate in the existing HTML documents-- done

PHASE II

  • Develop a prototype template extension -- done
  • Implement the extension with basic export -- done
  • Add support for Index/Notes/TextView/Navigation to HTML/javasript. -- In progress
  • Implement the templates system with configuration/extension deployment support -- In Progress

PHASE III

  • Specify configuration dialog
  • Implement configuration dialog

PHASE IV

  • Test and Optimise the developed System and code under all systems and browser.
  • Perform Fixes and improve the system if some imperfections and errors found.

PHASE V
All tasks mentioned below are part of exciting requirements, they are NOT in the current scope of the project, but if there is any time left in the end, following things will be tried upon.

  • Make one small simple browser based tool for non-coders, to make modifing templates a piece of cake.
  • Make a small browser based(cross platform) template development IDE to make development and deployment of templates easy.
  • Implement webcast support(with today's new age technology)

Enhancements/bugs to be cured

All reported bugs and needed enhancements are mentioned here, they will be worked upon in the final stages(phase IV).

  • Under firefox-Linux version, there is a problem extracting z-index values by javascript, where as in windows it work fine. -- to be cured


Current Work Progress

currently working on the template system at the extension end.


Documentation

Information about the extension and its working.


Structure of export

The exported presentation will have following files and folders and their corresponding functions are listed below.


Directory Structure

  • Root(/)
    • Template(folder)
      • images
      • Default.js
      • Default.css
      • templateInfo.txt
    • Index.html
    • Resource(folder)
      • Presentation.js
      • Presentation.css
    • noJS(folder)
    • Slides(folder)
    • manual.txt
    • oooadd.js


Description:

  • Root: represents root folder in which presentation is exported.
  • Template: folder containing template files.
  • Images: the folder will contain template specific images.
  • Default.js: the javascript file for the template. Used to implement visual styles and other functionality.
  • Default.css: the css file for the template
  • templateInfo.txt: information about the template.
  • Index.html: the main HTML file to be executed in browser.(user will be asked to supply a name for this file during export.)
  • Resource: the folder containing the main HTML .js/.css resource files.
  • Presentation.js: javascript file for the presentation core. It is used to implement the basic core implicit functionality of the exported presentation.
  • Presentation.css: CSS file for the main HTML document.
  • Info.txt: information about the export and how to use it, user guide.
  • oooadd.js: it is the javascript file used to embed this presentation in other html document easily and automatically. See oooadd.js section below for details.



Embeding Presentation Information in the HTML Document

The information about the presentation has to be added in the exported HTML. It has to be done in user understandable way and clean enough for making the file less complex with easy accessibility of the information.


IDEA:
The idea was to use META tags for storing the metadata about the presentation. These tags will be created by the export extension during the time of export.


Chosen Details:

  1. Author: author name as exported by the extension.
  2. No. of slides: total number of slides.
  3. Presentation title: title of this presentation
  4. Software version: the version of OpenOffice software used.
  5. Export extension version: Version of the Extension
  6. Date/time created: Time stamp of export.
  7. Outline view: set 1 if user has enabled outline view during export configuration
  8. Notes view: set 1 if user has enabled notes view during export configuration


Syntax:
For each detail one meta tag will be inserted in the head section like:

<meta name=name of the detail” content=”its value/>


Tags added in head section of the HTML:

<meta name=”oooAuthor” content=”its value/>
<meta name=”oooSlideCount” content=”its value/>
<meta name=”oooTitle” content=”its value/>
<meta name=”oooVersion” content=”its value/>
<meta name=”oooExportVersion” content=”its value/>
<meta name=”oooTimeStamp” content=”its value/>
<meta name=”oooOutline” content=”its value/>
<meta name=”oooNotes” content=”its value/>

The configuration data will also be added in the same manner for the javascript engine during the export.




Embed In Existing HTML Pages

The exported presentation can be easily embedded in the existing HTML pages and can show up in the page itself as an overlay without any redirection or page refreshes.

  • Definition: Trigger is the element of the HTML which will launch the presentation on clicking over it.


Steps To Embed:
There are 3 steps to embed the presentation in existing HTML.

  1. Export the presentation and save it in a folder anywhere in the file system or on any remote server.
  2. In the HEAD section of the HTML page in which you want to embed the presentation add:
    <script type="text/javascript" src="path/oooadd.js"></script>
    You don’t have to add any other file, it will automatically implement all CSS and and event handlers.
  3. In the body section, To any existing element ’OR’ you can create a new element of any type you can add following attributes to its tag to make it the trigger for launching presentation.
  • Required attributes:
    • Class = “presentationTrigger” if your element already have any class assigned then use class = “[pre assigned class][space]presentationTrigger” i.e. we are assigning two classes to that element.
    • Ooopath = “path to presentation root folder or URL to presentation stored in some remote location”
  • Optional Attribute(to provide flexibility):
    • ooobgColor // set background color of overlay background. Default: black
    • ooobgTrans // set transparency color of overlay background. Default: 80%
    • ooosize // set size of the presentation displayed, values(0-100) % w.r.t screen size. Default: 99.5%
    • ooobgMargin // set size of the backgroud margin, values(0-100) % w.r.t screen size. Default: 98%
    • oooOSD // if set '1' then will display message "click here to launch presentation" on bringing the mouseover the target, set '0' if you have your own event handlers for "onmouseover/onmouseout" default value is '0'

If any or all optional attributes are not defined explicitly then default values will be automatically taken.
NOTE: all variables, functions, objects, attributes start with prefix ’ooo’ to minimize the conflict in the names within the document.
Examples:

<div(or any element) class="presentationTrigger" ooopath="path to presentation folder"></div(or any element)>
<div class="presentationTrigger" ooopath="samplePresentation"></div>
<div class="presentationTrigger" ooopath="cache/samplePresentation"></div>
you can also link to remote presentations:
<div class="presentationTrigger" ooopath="http://www.site.com/folder/samplePresentation"></div>


FEATURES:
Following are the features of this system:

  1. can have multiple triggers in each page.
  2. Simple to understand and use
  3. Highly customizable
  4. Can embed multiple separate presentations in one page
  5. Can embed remote presentations with webcast
  6. No need to wrap elements in <a></a> tags, all event handling applied automatically.
  7. Even amateur novice users can understand and customize, NO javascript knowledge required, and all parameters/Attributes are custom made for easy understanding by any user.
  8. NO need to configure javascript files, all done using attributes,
  9. Each trigger can have its own settings for the presentation launch, see the link above for what I am trying to say.
  10. The presentation is 100% isolated from the parent HTML. i.e. if both the parent webpage and the presentation have some “class|id|variables|functions” of common name then also there will be NO conflict between them.
  11. By default the class name for trigger is “presentationTrigger” , but in certain cases user might require to change the class name to one of his, then that could be done simply by adding one META tag in the head section:
<meta name=”oooTriggerClass” content=”theNewClassName” />



Structure of Main HTML file

The main HTML page will be more like a skeleton defining the core required elements.


Navigational elements and other elements related to additional look and feel will not be added beforehand in this HTML, they will be added dynamically by the presenter.js if requested by the template, this method will help remove code duplication and will simplify the HTML file.


The HTML file will have 100% DIV based layouts, no tables. These DIV’s in the HTML will be styled and placed by the template automatically on loading. All these DIV’s will have self explanatory class names and ID’s for easy interpretation by the end users.


The HTML will also contain one NO-JavaScript Trap to aid viewing in non JavaScript browsers. Will display a message and provide rollback to a non javascript version.


The main advantage of this structure is that: templates will get full control of look and feel, will make the export highly customizable, template developing will be very easy and it will encourage development of very creative templates.


Even template development and customization will be easy by the people who are NOT experts or have LESS JavaScript knowledge.


for the structure of the HTML file, see the Source Code section.



Template Related Files

Templates have following files:


Images Folder It contains images associated with the template
Default.js The JavaScript file which define the elements and functionality of the template. Template API Library can be used by the template in this file.
Default.css The CSS file used by the template to define style of various elements.


Template API Library

Template developers are provided with a library to make developing presentation templates easy. And it will also solve the problem how templates will be integrated and used. A guide will be developed to explain all the methods and uses of the API library with tutorials for template building. will be made online by next month. Keep looking..


External Links

Here is the raw documentation containing the up to date thoughts and architecture. it will be updated time to time with the progress and advancements done during that time period.( Last Update:5-Aug,2010, , Expected Next Update: by 20-Sept,2010 )

(if there is any problem with this link, kindly inform me at kushal.likhi@gmail.com)

Downloads

various downloads

Oxt Extension

This is the Basic working build with a basic default template. built using Linux Fedora13 and DEV300_m83.

Documentation in .pdf format

This under progress work, it will be updated slowly with time.

Sample Template Extension

here is a sample Template add-on Extension for the html filter.

Source Code

you can download the complete up to date source code here. version: 2-21/9/10

SOURCE CODE

Contain working source for the extension buildVersion-1.4.11a Dated:21/sept/10 The code below will be updated as the development will progress.(this source code is not complete or final, a lot of things have to be done, its for monitoring progress)

Export Extension End

Source code for files at the export extension end.


services.cxx

it defines services offered by the extension.

/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 * 
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/
 
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sdext.hxx"
 
#include "htmlex.hxx"
 
#include <cppuhelper/factory.hxx>
#include <cppuhelper/implementationentry.hxx>
 
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::registry;
 
 
namespace
{
    static Reference< XInterface > Create_HTMLExporter( const Reference< XComponentContext >& _rxContext )
    {
        return *(new HTMLExporter( _rxContext ));
    }
}
 
extern "C" void SAL_CALL component_getImplementationEnvironment(
    const sal_Char **ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
{
    *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
 
namespace
{
    typedef Reference< XInterface > (SAL_CALL * ComponentFactory)( const Reference< XComponentContext >& );
 
    struct ComponentDescription
    {
	    const sal_Char*	    pAsciiServiceName;
	    const sal_Char*     pAsciiImplementationName;
        ComponentFactory    pFactory;
 
        ComponentDescription()
            :pAsciiServiceName( NULL )
            ,pAsciiImplementationName( NULL )
            ,pFactory( NULL )
        {
        }
	    ComponentDescription( const sal_Char* _pAsciiServiceName, const sal_Char* _pAsciiImplementationName, ComponentFactory _pFactory )
            :pAsciiServiceName( _pAsciiServiceName )
            ,pAsciiImplementationName( _pAsciiImplementationName )
            ,pFactory( _pFactory )
        {
        }
    };
 
    static const ComponentDescription* lcl_getComponents()
    {
        static const ComponentDescription aDescriptions[] = {
            ComponentDescription( "com.sun.star.document.ExportFilter", "com.sun.star.comp.documents.HTMLExExporter", Create_HTMLExporter ),
            ComponentDescription()
        };
        return aDescriptions;
    }
}
 
extern "C" sal_Bool SAL_CALL component_writeInfo( void* /*pServiceManager*/, void* pRegistryKey )
{
	Reference< XRegistryKey > xRootKey( static_cast< XRegistryKey* >( pRegistryKey ) );
 
	::rtl::OUString sRootKey( "/", 1, RTL_TEXTENCODING_ASCII_US );
 
    const ComponentDescription* pComponents = lcl_getComponents();
    while ( pComponents->pAsciiServiceName != NULL )
	{
		::rtl::OUString sMainKeyName( sRootKey );
		sMainKeyName += ::rtl::OUString::createFromAscii( pComponents->pAsciiImplementationName );
		sMainKeyName += ::rtl::OUString::createFromAscii( "/UNO/SERVICES" );
 
		try
		{
			Reference< XRegistryKey >  xNewKey( xRootKey->createKey( sMainKeyName ) );
            xNewKey->createKey( ::rtl::OUString::createFromAscii( pComponents->pAsciiServiceName ) );
		}
		catch( Exception& )
		{
			OSL_ASSERT( "OModule::writeComponentInfos: something went wrong while creating the keys!" );
			return sal_False;
		}
        ++pComponents;
    }
    return sal_True;
}
 
extern "C" void* SAL_CALL component_getFactory(
    const sal_Char* pImplementationName, void* /*pServiceManager*/, void* /*pRegistryKey*/ )
{
    ::rtl::OUString sImplementationName( ::rtl::OUString::createFromAscii( pImplementationName ) );
 
    Reference< XSingleComponentFactory > xFactory;
 
    const ComponentDescription* pComponents = lcl_getComponents();
    while ( pComponents->pAsciiServiceName != NULL )
	{
        if ( 0 == sImplementationName.compareToAscii( pComponents->pAsciiImplementationName ) )
        {
            Sequence< ::rtl::OUString > sServices(1);
            sServices[0] = ::rtl::OUString::createFromAscii( pComponents->pAsciiServiceName );
 
            xFactory = ::cppu::createSingleComponentFactory(
                pComponents->pFactory,
                sImplementationName,
                sServices,
                NULL
            );
            break;
        }
 
        ++pComponents;
    }
 
    // by definition, objects returned via this C API need to ber acquired once
    xFactory->acquire();
    return xFactory.get();
}


htmlex.hxx

header file for the HTMLExporer

/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 * 
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/
 
#ifndef INCLUDED_HTMLEX_HXX
#define INCLUDED_HTMLEX_HXX
 
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/document/XExporter.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/util/URL.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
 
#include "Template.hxx"
 
#include <cppuhelper/compbase2.hxx>
#include <cppuhelper/basemutex.hxx>
 
typedef ::cppu::WeakComponentImplHelper2< 
    com::sun::star::document::XFilter,
    com::sun::star::document::XExporter > HTMLExporterBase;
 
 
// prototype of the HTMLExporter Class
class HTMLExporter : private cppu::BaseMutex, public HTMLExporterBase
{
public:
//constructor for the class
    explicit HTMLExporter( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
 
// XFilter 
    virtual sal_Bool SAL_CALL filter( const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rFilterData ) throw(com::sun::star::uno::RuntimeException);
 
//on cancel
    virtual void SAL_CALL cancel() throw();
 
// XExporter 
    virtual void SAL_CALL setSourceDocument( const com::sun::star::uno::Reference< com::sun::star::lang::XComponent >& xDocument )
        throw( com::sun::star::lang::IllegalArgumentException );
 
 
 
private:
	com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext;
	com::sun::star::uno::Reference< com::sun::star::lang::XMultiComponentFactory > mxServiceFactory;
	com::sun::star::uno::Reference< com::sun::star::util::XURLTransformer > mxURLTransformer;
	com::sun::star::uno::Reference< com::sun::star::document::XExporter > mxGraphicExporter;
	com::sun::star::uno::Reference< com::sun::star::ucb::XSimpleFileAccess2 > mxFileAccess;
 
	void getPackedFilesURL();	
	bool copyFile(const rtl::OUString& rSourceURL, const rtl::OUString& rDestURL, bool Replace);
	void createFolders( com::sun::star::util::URL aBaseURL ); 
	void createHTMLFile( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xOutputStream, const rtl::OUString& rsDocumentTitle );
	void writeHTMLMetaData( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xOutputStream, const rtl::OUString& aTitle );
	void createSlideImages();	
	bool copyCoreFiles();
	void copyTemplateFiles();
	void createNoJsPresentation( const rtl::OUString& rsDocumentTitle );
	bool copyDefaultTemplateFiles();
	rtl::OUString getSlideImageName( sal_Int32 nPageIndex );
	rtl::OUString copySoundFile( const rtl::OUString& rSourceURL );
	void writeIndexData( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xOutputStream );
	void writeTextViewData( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xOutputStream );
	void writeNotesData( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xOutputStream );
	void writeTemplateSpecificData( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xOutputStream );
 
// configuration data
	rtl::OUString msImageExtension;
	rtl::OUString msImageFolderName;
	rtl::OUString msExtensionVersion;
	rtl::OUString msNotes;
	rtl::OUString msOutline;
	rtl::OUString msSound;
	rtl::OUString msIndex;
	rtl::OUString msAutoTime;
	rtl::OUString msShowIndexOnStart;
 
// document model access
	com::sun::star::uno::Reference< com::sun::star::frame::XModel > mxModel;
	com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > mxDrawPages;
 
//private data
	com::sun::star::util::URL maDocumentBaseURL;
	com::sun::star::util::URL maExtensionBaseURL;
	com::sun::star::util::URL maCompleteURL;
 
	Template maTemplate;
 
};
 
#endif

htmlex.cxx

the main C++ file for the HTMLExporter

/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 * 
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/
 
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sdext.hxx"
#include "htmlex.hxx"
#include<boost/preprocessor/stringize.hpp>
#include <osl/file.h>
#include <osl/thread.h>
#include <osl/diagnose.h>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/implementationentry.hxx>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/frame/XLoadable.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
#include <com/sun/star/deployment/XPackageInformationProvider.hpp>
#include <stdio.h>
#include <boost/shared_ptr.hpp>
 
using rtl::OUString;
using namespace com::sun::star;
using namespace com::sun::star::uno;
using namespace com::sun::star::io;
using namespace com::sun::star::util;
using namespace com::sun::star::drawing;
using namespace com::sun::star::container;
using namespace com::sun::star::beans;
using namespace com::sun::star::deployment;
 
 
// constructor for HTMLExporter class
HTMLExporter::HTMLExporter( const Reference< XComponentContext >& xContext )
: HTMLExporterBase( m_aMutex )
, mxContext( xContext, UNO_QUERY_THROW )
, mxServiceFactory( xContext->getServiceManager(), UNO_QUERY_THROW )
, mxURLTransformer( mxServiceFactory->createInstanceWithContext( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer" )), xContext), UNO_QUERY_THROW )
, mxGraphicExporter( mxServiceFactory->createInstanceWithContext( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GraphicExportFilter")), xContext), UNO_QUERY_THROW )
, mxFileAccess( mxServiceFactory->createInstanceWithContext( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")), xContext), UNO_QUERY_THROW )
, msImageExtension( RTL_CONSTASCII_USTRINGPARAM( "png" ) )
, msImageFolderName( RTL_CONSTASCII_USTRINGPARAM( "slides" ) )
, msExtensionVersion( RTL_CONSTASCII_USTRINGPARAM( "1.x.xb" ) )
, msNotes( RTL_CONSTASCII_USTRINGPARAM( "yes" ) )
, msOutline( RTL_CONSTASCII_USTRINGPARAM( "yes" ) )
, msSound( RTL_CONSTASCII_USTRINGPARAM( "yes" ) )
, msIndex( RTL_CONSTASCII_USTRINGPARAM( "yes" ) )
, msAutoTime( RTL_CONSTASCII_USTRINGPARAM( "5.00" ) )
, msShowIndexOnStart( RTL_CONSTASCII_USTRINGPARAM( "yes" ) )
, maTemplate(xContext)
{
}
 
 
// write the OUString object data to the XOutputStream in UTF-8 Encoding
void writeUTF8String( const Reference< XOutputStream >& xOutputStream, const OUString& rString )
{
	rtl::OString aStr( rtl::OUStringToOString( rString, RTL_TEXTENCODING_UTF8 ) ) ;
 
	const Sequence< sal_Int8 > aData( (const sal_Int8*)aStr.getStr(), aStr.getLength() );
	xOutputStream->writeBytes( aData );
}
 
// write the Character string to the XOutputStream in UTF-8 Encoding
void writeUTF8String( const Reference< XOutputStream >& xOutputStream, const sal_Char* pStr )
{
	const Sequence< sal_Int8 > aData( (const sal_Int8*)pStr, strlen( (char*)pStr ) );
	xOutputStream->writeBytes( aData );
}
 
 
//get the url of the location where extension is installed.
void HTMLExporter::getPackedFilesURL()
{
	Reference<com::sun::star::deployment::XPackageInformationProvider> xProvider( mxContext->getValueByName( OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.deployment.PackageInformationProvider"))),UNO_QUERY_THROW);
 
OUString sURL( xProvider->getPackageLocation(rtl::OUString::createFromAscii( BOOST_PP_STRINGIZE(HTMLEX_IMPL_IDENTIFIER))));
 
 
maExtensionBaseURL.Path = sURL;
maExtensionBaseURL.Name = OUString();
maExtensionBaseURL.Complete = sURL;
//mxURLTransformer->assemble( maExtensionBaseURL );
 
}
 
// function to copy a file
bool HTMLExporter::copyFile(const rtl::OUString& rSourceURL, const rtl::OUString& rDestURL, bool Replace)
{
	if( !mxFileAccess->exists( rDestURL ) )
	{
		mxFileAccess->copy( rSourceURL, rDestURL );
		return true;
	}
	else 
	{
		if(Replace)
		{
			mxFileAccess->kill( rDestURL );
			mxFileAccess->copy( rSourceURL, rDestURL );
		}
		else
		{
			return false;
		}
	}
 
	return true;
 
}
 
// create target directory structure
void HTMLExporter::createFolders(URL aBaseURL)
{
 
	URL aCreateDirBase;
	OUString aDirList[4];
	aDirList[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( "resource" )); 
	aDirList[1] = OUString(RTL_CONSTASCII_USTRINGPARAM( "template" )); 
	aDirList[2] = OUString(RTL_CONSTASCII_USTRINGPARAM( "nojs" )); 
	aDirList[3] = OUString(RTL_CONSTASCII_USTRINGPARAM( "template/images" )); 
	sal_Int32 aDirCount = 4; // todo improve
	for(sal_Int32 i = 0; i < aDirCount; i++)
	{
		aCreateDirBase = aBaseURL;
		aCreateDirBase.Path += aDirList[i];
		aCreateDirBase.Name = OUString();		
		mxURLTransformer->assemble( aCreateDirBase );
		if( !mxFileAccess->exists( aCreateDirBase.Complete ) )
			mxFileAccess->createFolder( aCreateDirBase.Complete );
 
	}
 
 
}
 
//XImporter
void SAL_CALL HTMLExporter::setSourceDocument( const uno::Reference< lang::XComponent >& xDocument ) throw( lang::IllegalArgumentException )
{
    mxModel.set( xDocument, UNO_QUERY );
 
	if( mxModel.is() )
	{
		Reference< XDrawPagesSupplier > xDPS( mxModel, UNO_QUERY );
		if( xDPS.is() )
			mxDrawPages.set( xDPS->getDrawPages(), UNO_QUERY );
	}
 
	// we need a document with draw pages to export them
    if( !mxDrawPages.is()  )
		throw lang::IllegalArgumentException();
}
 
 
// XFilter the big one!!
sal_Bool SAL_CALL HTMLExporter::filter( const uno::Sequence< beans::PropertyValue >& rFilterData ) throw( uno::RuntimeException )
{
    sal_Bool bRet = sal_False;
    if( mxModel.is() )
    {
//defining things
        const OUString sOutputStream ( RTL_CONSTASCII_USTRINGPARAM ( "OutputStream" ) );
        const OUString sStream ( RTL_CONSTASCII_USTRINGPARAM ( "StreamForOutput" ) );
	const OUString sDocumentTitle( RTL_CONSTASCII_USTRINGPARAM ( "DocumentTitle" ) );
	const OUString sDocumentBaseURL( RTL_CONSTASCII_USTRINGPARAM ( "DocumentBaseURL" ) );
 
	Reference< XOutputStream > xOutputStream;
	Reference< XOutputStream > xStreamForOutput;
 
	OUString sTitle, sCompleteURL;
 
// parse parameter from the com::sun::star::document::MediaDescriptor service 
        const beans::PropertyValue* pAttribs = rFilterData.getConstArray();
 
        sal_Int32 nAttribs = rFilterData.getLength();
 
        for( sal_Int32 i = 0; i < nAttribs; i++ )
        {
 
            if ( pAttribs[i].Name == sOutputStream )
                pAttribs[i].Value >>= xOutputStream;
            else if ( pAttribs[i].Name == sStream )
                pAttribs[i].Value >>= xStreamForOutput;
			else if ( pAttribs[i].Name == sDocumentTitle )
				pAttribs[i].Value >>= sTitle;
			else if ( pAttribs[i].Name == sDocumentBaseURL )
				pAttribs[i].Value >>= sCompleteURL;
		}
 
 
		if( !xOutputStream.is() )
			xOutputStream = xStreamForOutput;
 
		if( xOutputStream.is() ) try
		{
			// fill out all members of maDocumentBaseURL
			maDocumentBaseURL.Complete = sCompleteURL;
			mxURLTransformer->parseStrict( maDocumentBaseURL );
			maCompleteURL.Complete = sCompleteURL;
 
			getPackedFilesURL();			
			createFolders( maDocumentBaseURL );
			copyCoreFiles();
			copyTemplateFiles();
			createHTMLFile( xOutputStream, sTitle );
			createSlideImages();
			createNoJsPresentation(sTitle);
			bRet = true;
		}
		catch( Exception& )
		{
		}
    }
 
 
    return bRet;
}
 
void SAL_CALL HTMLExporter::cancel() throw()
{
//when cancelled,, not sure what to put here.. :O
}
 
 
OUString HTMLExporter::getSlideImageName( sal_Int32 nPageIndex )
{
	OUString sSlideImageName( RTL_CONSTASCII_USTRINGPARAM( "img" ) );
	sSlideImageName += OUString::valueOf( nPageIndex + 1 );
	sSlideImageName += OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) );
	sSlideImageName += msImageExtension;
	return sSlideImageName;
}
 
rtl::OUString HTMLExporter::copySoundFile( const rtl::OUString& rSourceURL )
{
	URL aSoundSourceURL;
	aSoundSourceURL.Complete = rSourceURL;
	mxURLTransformer->parseStrict( maDocumentBaseURL );
 
	URL aTargetSoundFileURL = maDocumentBaseURL;
	aTargetSoundFileURL.Name = aSoundSourceURL.Name;
	mxURLTransformer->assemble( aTargetSoundFileURL );
 
	// copy if it does not yet exists
	if( !mxFileAccess->exists( aTargetSoundFileURL.Complete ) )
		mxFileAccess->copy( rSourceURL, aTargetSoundFileURL.Complete );
 
	// return relative path (which in this case is only the name)
	return aTargetSoundFileURL.Name;
}
 
void HTMLExporter::createSlideImages()
{
	if( mxDrawPages.is() ) try
	{
		// create images folder		
		URL aSlideFolderURL = maDocumentBaseURL;
		aSlideFolderURL.Path += msImageFolderName;
		aSlideFolderURL.Name = OUString();
		mxURLTransformer->assemble( aSlideFolderURL );
		if( !mxFileAccess->exists( aSlideFolderURL.Complete ) )
			mxFileAccess->createFolder( aSlideFolderURL.Complete );
 
		// export slide images
		const sal_Int32 nSlideCount = mxDrawPages->getCount();
		for( sal_Int32 nPageIndex = 0; nPageIndex < nSlideCount; nPageIndex++ )
		{
			Reference< XComponent > xDrawPage( mxDrawPages->getByIndex(nPageIndex), UNO_QUERY_THROW );
 
			URL aSlideURL = aSlideFolderURL;
			aSlideURL.Name = getSlideImageName( nPageIndex );
			mxURLTransformer->assemble( aSlideURL );
 
			// create the slide image
			Reference< XFilter > xFilter( mxGraphicExporter, UNO_QUERY_THROW );
 
			Sequence< PropertyValue > aFilterData( 2 );
			aFilterData[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Width") );
			aFilterData[0].Value <<= (sal_Int32)800; // todo: get from configuration dialog
			aFilterData[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("Translucent") );
			aFilterData[1].Value <<= (sal_Bool)sal_False;
 
			Sequence< PropertyValue > aDescriptor( 3 );
			aDescriptor[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("FilterName") );
			aDescriptor[0].Value <<= msImageExtension.toAsciiUpperCase();
			aDescriptor[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("URL") );
			aDescriptor[1].Value <<= aSlideURL.Complete;
			aDescriptor[2].Name = OUString( RTL_CONSTASCII_USTRINGPARAM("FilterData") );
			aDescriptor[2].Value <<= aFilterData;
 
			mxGraphicExporter->setSourceDocument( xDrawPage );
			xFilter->filter( aDescriptor );
		}
	}
	catch( Exception& )
	{
		OSL_ENSURE(false, "HTMLExporter::createHTMLFile, exception caught!");
	}
}
 
// copy core files
bool HTMLExporter::copyCoreFiles()
{
 
	URL aTargetDirectory = maDocumentBaseURL;
 
	URL aSourceCss;
	aSourceCss.Complete = maExtensionBaseURL.Path;
	aSourceCss.Complete += OUString( RTL_CONSTASCII_USTRINGPARAM( "/files/presentation.css" ) );
	mxURLTransformer->parseStrict( aSourceCss );	
	URL aTargetCss = aTargetDirectory;
	aTargetCss.Path += OUString( RTL_CONSTASCII_USTRINGPARAM( "resource" ) );
	aTargetCss.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "presentation.css" ) );
	mxURLTransformer->assemble( aTargetCss );
	if(!copyFile(aSourceCss.Complete, aTargetCss.Complete, true))
		return false;
 
	URL aSourceJs;
	aSourceJs.Complete = maExtensionBaseURL.Path;
	aSourceJs.Complete += OUString( RTL_CONSTASCII_USTRINGPARAM( "/files/presentation.js" ) );
	mxURLTransformer->parseStrict( aSourceJs );	
	URL aTargetJs = aTargetDirectory;
	aTargetJs.Path += OUString( RTL_CONSTASCII_USTRINGPARAM( "resource" ) );
	aTargetJs.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "presentation.js" ) );
	mxURLTransformer->assemble( aTargetJs );	
	if(!copyFile(aSourceJs.Complete, aTargetJs.Complete, true))
		return false;
 
	URL aSourceIco;
	aSourceIco.Complete = maExtensionBaseURL.Path;
	aSourceIco.Complete += OUString( RTL_CONSTASCII_USTRINGPARAM( "/files/favicon.ico" ) );
	mxURLTransformer->parseStrict( aSourceIco );	
	URL aTargetIco = aTargetDirectory;
	aTargetIco.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "favicon.ico" ) );
	mxURLTransformer->assemble( aTargetIco );	
	if(!copyFile(aSourceIco.Complete, aTargetIco.Complete, true))
		return false;
 
	URL aSourceManual;
	aSourceManual.Complete = maExtensionBaseURL.Path;
	aSourceManual.Complete += OUString( RTL_CONSTASCII_USTRINGPARAM( "/files/manual.txt" ) );
	mxURLTransformer->parseStrict( aSourceManual );	
	URL aTargetManual = aTargetDirectory;
	aTargetManual.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "manual.txt" ) );
	mxURLTransformer->assemble( aTargetManual );	
	if(!copyFile(aSourceManual.Complete, aTargetManual.Complete, true))
		return false;
 
	URL aSourceAddJs;
	aSourceAddJs.Complete = maExtensionBaseURL.Path;
	aSourceAddJs.Complete += OUString( RTL_CONSTASCII_USTRINGPARAM( "/files/oooadd.js" ) );
	mxURLTransformer->parseStrict( aSourceAddJs );	
	URL aTargetAddJs = aTargetDirectory;
	aTargetAddJs.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "oooadd.js" ) );
	mxURLTransformer->assemble( aTargetAddJs );	
	if(!copyFile(aSourceAddJs.Complete, aTargetAddJs.Complete, true))
		return false;
 
	return true;		
}
 
// copy default template files
bool HTMLExporter::copyDefaultTemplateFiles()
{
	/*
	URL aCopyFileBase;
	URL aFileSource;
	OUString aFileList[12];
	aFileList[0] = OUString(RTL_CONSTASCII_USTRINGPARAM( "template/default.js" )); 
	aFileList[1] = OUString(RTL_CONSTASCII_USTRINGPARAM( "template/default.css" )); 
	aFileList[2] = OUString(RTL_CONSTASCII_USTRINGPARAM( "template/info.txt" )); 
	aFileList[3] = OUString(RTL_CONSTASCII_USTRINGPARAM( "template/images/bgty.png" )); 
	aFileList[4] = OUString(RTL_CONSTASCII_USTRINGPARAM( "template/images/end.png" )); 
	aFileList[5] = OUString(RTL_CONSTASCII_USTRINGPARAM( "template/images/next.png" )); 
	aFileList[6] = OUString(RTL_CONSTASCII_USTRINGPARAM( "template/images/ns.png" )); 
	aFileList[7] = OUString(RTL_CONSTASCII_USTRINGPARAM( "template/images/previous.png" )); 
	aFileList[8] = OUString(RTL_CONSTASCII_USTRINGPARAM( "template/images/ps.png" )); 
	aFileList[9] = OUString(RTL_CONSTASCII_USTRINGPARAM( "template/images/start.png" )); 
	aFileList[10] = OUString(RTL_CONSTASCII_USTRINGPARAM( "template/images/stop.png" )); 
	aFileList[11] = OUString(RTL_CONSTASCII_USTRINGPARAM( "template/images/text.png" )); 
	sal_Int32 aFileCount = 12;
	for(sal_Int32 i = 0; i < aFileCount; i++)
	{
		aCopyFileBase = maDocumentBaseURL;
		aFileSource.Complete = maExtensionBaseURL.Path;
		aCopyFileBase.Path += aFileList[i];
		aCopyFileBase.Complete = aCopyFileBase.Path;
		mxURLTransformer->parseStrict( aCopyFileBase );
		aFileSource.Complete += OUString( RTL_CONSTASCII_USTRINGPARAM( "/files/" ) );
		aFileSource.Complete += aCopyFileBase.Name;
		if(!copyFile(aFileSource.Complete, aCopyFileBase.Complete, true))
		return false;
 
	}
*/
 
	URL aSource;
	URL aTarget;
 
	aSource.Complete = maExtensionBaseURL.Path;
	aSource.Complete += OUString( RTL_CONSTASCII_USTRINGPARAM( "/files/default.css" ) );
	mxURLTransformer->parseStrict( aSource );	
	aTarget = maDocumentBaseURL;
	aTarget.Path += OUString( RTL_CONSTASCII_USTRINGPARAM( "template" ) );
	aTarget.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "default.css" ) );
	mxURLTransformer->assemble( aTarget );
	if(!copyFile(aSource.Complete, aTarget.Complete, true))
		return false;
 
	aSource.Complete = maExtensionBaseURL.Path;
	aSource.Complete += OUString( RTL_CONSTASCII_USTRINGPARAM( "/files/default.js" ) );
	mxURLTransformer->parseStrict( aSource );	
	aTarget = maDocumentBaseURL;
	aTarget.Path += OUString( RTL_CONSTASCII_USTRINGPARAM( "template" ) );
	aTarget.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "default.js" ) );
	mxURLTransformer->assemble( aTarget );
	if(!copyFile(aSource.Complete, aTarget.Complete, true))
		return false;
 
	aSource.Complete = maExtensionBaseURL.Path;
	aSource.Complete += OUString( RTL_CONSTASCII_USTRINGPARAM( "/files/bgty.png" ) );
	mxURLTransformer->parseStrict( aSource );	
	aTarget = maDocumentBaseURL;
	aTarget.Path += OUString( RTL_CONSTASCII_USTRINGPARAM( "template/images" ) );
	aTarget.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "bgty.png" ) );
	mxURLTransformer->assemble( aTarget );
	if(!copyFile(aSource.Complete, aTarget.Complete, true))
		return false;
 
	aSource.Complete = maExtensionBaseURL.Path;
	aSource.Complete += OUString( RTL_CONSTASCII_USTRINGPARAM( "/files/info.txt" ) );
	mxURLTransformer->parseStrict( aSource );	
	aTarget = maDocumentBaseURL;
	aTarget.Path += OUString( RTL_CONSTASCII_USTRINGPARAM( "template" ) );
	aTarget.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "info.txt" ) );
	mxURLTransformer->assemble( aTarget );
	if(!copyFile(aSource.Complete, aTarget.Complete, true))
		return false;
 
	aSource.Complete = maExtensionBaseURL.Path;
	aSource.Complete += OUString( RTL_CONSTASCII_USTRINGPARAM( "/files/next.png" ) );
	mxURLTransformer->parseStrict( aSource );	
	aTarget = maDocumentBaseURL;
	aTarget.Path += OUString( RTL_CONSTASCII_USTRINGPARAM( "template/images" ) );
	aTarget.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "next.png" ) );
	mxURLTransformer->assemble( aTarget );
	if(!copyFile(aSource.Complete, aTarget.Complete, true))
		return false;
 
	aSource.Complete = maExtensionBaseURL.Path;
	aSource.Complete += OUString( RTL_CONSTASCII_USTRINGPARAM( "/files/ns.png" ) );
	mxURLTransformer->parseStrict( aSource );	
	aTarget = maDocumentBaseURL;
	aTarget.Path += OUString( RTL_CONSTASCII_USTRINGPARAM( "template/images" ) );
	aTarget.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "ns.png" ) );
	mxURLTransformer->assemble( aTarget );
	if(!copyFile(aSource.Complete, aTarget.Complete, true))
		return false;
 
	aSource.Complete = maExtensionBaseURL.Path;
	aSource.Complete += OUString( RTL_CONSTASCII_USTRINGPARAM( "/files/previous.png" ) );
	mxURLTransformer->parseStrict( aSource );	
	aTarget = maDocumentBaseURL;
	aTarget.Path += OUString( RTL_CONSTASCII_USTRINGPARAM( "template/images" ) );
	aTarget.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "previous.png" ) );
	mxURLTransformer->assemble( aTarget );
	if(!copyFile(aSource.Complete, aTarget.Complete, true))
		return false;
 
	aSource.Complete = maExtensionBaseURL.Path;
	aSource.Complete += OUString( RTL_CONSTASCII_USTRINGPARAM( "/files/ps.png" ) );
	mxURLTransformer->parseStrict( aSource );	
	aTarget = maDocumentBaseURL;
	aTarget.Path += OUString( RTL_CONSTASCII_USTRINGPARAM( "template/images" ) );
	aTarget.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "ps.png" ) );
	mxURLTransformer->assemble( aTarget );
	if(!copyFile(aSource.Complete, aTarget.Complete, true))
		return false;
 
	aSource.Complete = maExtensionBaseURL.Path;
	aSource.Complete += OUString( RTL_CONSTASCII_USTRINGPARAM( "/files/start.png" ) );
	mxURLTransformer->parseStrict( aSource );	
	aTarget = maDocumentBaseURL;
	aTarget.Path += OUString( RTL_CONSTASCII_USTRINGPARAM( "template/images" ) );
	aTarget.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "start.png" ) );
	mxURLTransformer->assemble( aTarget );
	if(!copyFile(aSource.Complete, aTarget.Complete, true))
		return false;
 
	aSource.Complete = maExtensionBaseURL.Path;
	aSource.Complete += OUString( RTL_CONSTASCII_USTRINGPARAM( "/files/stop.png" ) );
	mxURLTransformer->parseStrict( aSource );	
	aTarget = maDocumentBaseURL;
	aTarget.Path += OUString( RTL_CONSTASCII_USTRINGPARAM( "template/images" ) );
	aTarget.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "stop.png" ) );
	mxURLTransformer->assemble( aTarget );
	if(!copyFile(aSource.Complete, aTarget.Complete, true))
		return false;
 
	aSource.Complete = maExtensionBaseURL.Path;
	aSource.Complete += OUString( RTL_CONSTASCII_USTRINGPARAM( "/files/text.png" ) );
	mxURLTransformer->parseStrict( aSource );	
	aTarget = maDocumentBaseURL;
	aTarget.Path += OUString( RTL_CONSTASCII_USTRINGPARAM( "template/images" ) );
	aTarget.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "text.png" ) );
	mxURLTransformer->assemble( aTarget );
	if(!copyFile(aSource.Complete, aTarget.Complete, true))
		return false;
 
	aSource.Complete = maExtensionBaseURL.Path;
	aSource.Complete += OUString( RTL_CONSTASCII_USTRINGPARAM( "/files/end.png" ) );
	mxURLTransformer->parseStrict( aSource );	
	aTarget = maDocumentBaseURL;
	aTarget.Path += OUString( RTL_CONSTASCII_USTRINGPARAM( "template/images" ) );
	aTarget.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "end.png" ) );
	mxURLTransformer->assemble( aTarget );
	if(!copyFile(aSource.Complete, aTarget.Complete, true))
		return false;
 
return true;
 
}
 
 
 
 
//function to export the presentation without javascript in NoJs folder
void HTMLExporter::createNoJsPresentation(const rtl::OUString& rsDocumentTitle)
{
// stream for writing index.html file
	URL afileURL;
	afileURL.Path = maDocumentBaseURL.Path;
	afileURL.Path += OUString( RTL_CONSTASCII_USTRINGPARAM( "nojs/index.html" ) );
	//afileURL.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "index.html" ) );
	//mxURLTransformer->assemble( afileURL );
	Reference< XOutputStream > xOutputStream1;
	xOutputStream1 = mxFileAccess->openFileWrite( afileURL.Path );
//todo Improove to a good format... default format exported
writeUTF8String( xOutputStream1, "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n" );
	writeUTF8String( xOutputStream1, "<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n<title>");
	writeUTF8String( xOutputStream1, rsDocumentTitle );
	writeUTF8String( xOutputStream1, "</title>\r\n</head>\r\n<body>\r\n" );
 
	if( mxDrawPages.is() )
	{
		const sal_Int32 nSlideCount = mxDrawPages->getCount();
 
		for( sal_Int32 nPageIndex = 0; nPageIndex < nSlideCount; nPageIndex++ ) try
		{
			Reference< XDrawPage > xPage( mxDrawPages->getByIndex( nPageIndex ), UNO_QUERY_THROW );
			Reference< XPropertySet > xPageProps( xPage, UNO_QUERY );
 
			// user interface name of the current slide
			OUString sPageName;
			xPageProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "LinkDisplayName" ) ) ) >>= sPageName;
 
			// url to slide sound file
			OUString sSoundURL;
			xPageProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ) ) >>= sSoundURL;
 
 
			writeUTF8String( xOutputStream1, "<div class=\"slide\">\r\n" );
			writeUTF8String( xOutputStream1, "<img class=\"slideimage\" src=\"../" );
			writeUTF8String( xOutputStream1, msImageFolderName );
			writeUTF8String( xOutputStream1, "/" );
			writeUTF8String( xOutputStream1, getSlideImageName( nPageIndex ) );
			writeUTF8String( xOutputStream1, "\" alt=\"" );
			writeUTF8String( xOutputStream1, sPageName );
			writeUTF8String( xOutputStream1, "/>\r\n" );
			writeUTF8String( xOutputStream1, "<div class=\"slidename\">" );
			writeUTF8String( xOutputStream1, sPageName );
			writeUTF8String( xOutputStream1, "</div>\r\n" );
 
			if( sSoundURL.getLength() != 0 )
			{
				// todo: convert to ogg?
				writeUTF8String( xOutputStream1, "<audio preload class=\"slideaudio\"><source src=\"" );
				writeUTF8String( xOutputStream1, copySoundFile( sSoundURL ) );
				writeUTF8String( xOutputStream1, "\"></audio>\r\n" );
			}
			writeUTF8String( xOutputStream1, "</div>\r\n");
		}
		catch( Exception& )
		{
			OSL_ENSURE(false, "HTMLExporter::createHTMLFile, exception caught!");
		}
	}
 
	writeUTF8String( xOutputStream1, "</body>\r\n</html>\r\n" );
	xOutputStream1->flush();
}
 
void HTMLExporter::writeHTMLMetaData( const Reference< XOutputStream >& xOutputStream, const OUString& aTitle )
{// work left here
	const sal_Int32 nSlideCount = mxDrawPages->getCount();
	OUString aAuthor;
	OUString aSlideCount( rtl::OUString::valueOf(nSlideCount,10) );
	OUString aVersion;
	OUString aTimeStamp;
 
 
	//aSlideCount = OUString( RTL_CONSTASCII_USTRINGPARAM ( nSlideCount ));
 
	writeUTF8String( xOutputStream,"<!-- *************** META INFORMATION ******************************* -->\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n");
	writeUTF8String( xOutputStream,"<meta name=\"oooAuthor\" content=\"");
	writeUTF8String( xOutputStream,aAuthor);
	writeUTF8String( xOutputStream,"\" />\r\n");
 
	writeUTF8String( xOutputStream,"<meta name=\"oooSlideCount\" content=\"");
	writeUTF8String( xOutputStream,aSlideCount);
	writeUTF8String( xOutputStream,"\" />\r\n");
 
	writeUTF8String( xOutputStream,"<meta name=\"oooTitle\" content=\"");
	writeUTF8String( xOutputStream,aTitle);
	writeUTF8String( xOutputStream,"\" />\r\n");
 
	writeUTF8String( xOutputStream,"<meta name=\"oooVersion\" content=\"");
	writeUTF8String( xOutputStream,aVersion);
	writeUTF8String( xOutputStream,"\" />\r\n");
 
	writeUTF8String( xOutputStream,"<meta name=\"oooExtensionVersion\" content=\"");
	writeUTF8String( xOutputStream,msExtensionVersion);
	writeUTF8String( xOutputStream,"\" />\r\n");
 
	writeUTF8String( xOutputStream,"<meta name=\"oooTimeStamp\" content=\"");
	writeUTF8String( xOutputStream,aTimeStamp);
	writeUTF8String( xOutputStream,"\" />\r\n");
 
	writeUTF8String( xOutputStream,"<meta name=\"oooOutline\" content=\"");
	writeUTF8String( xOutputStream,msOutline);
	writeUTF8String( xOutputStream,"\" />\r\n");
 
	writeUTF8String( xOutputStream,"<meta name=\"oooNotes\" content=\"");
	writeUTF8String( xOutputStream,msNotes);
	writeUTF8String( xOutputStream,"\" />\r\n");
 
	writeUTF8String( xOutputStream,"<meta name=\"oooIndex\" content=\"");
	writeUTF8String( xOutputStream,msIndex);
	writeUTF8String( xOutputStream,"\" />\r\n");
 
	writeUTF8String( xOutputStream,"<meta name=\"oooSound\" content=\"");
	writeUTF8String( xOutputStream,msSound);
	writeUTF8String( xOutputStream,"\" />\r\n");
 
	writeUTF8String( xOutputStream,"<meta name=\"oooAutoTime\" content=\"");
	writeUTF8String( xOutputStream,msAutoTime);
	writeUTF8String( xOutputStream,"\" />\r\n");
 
	writeUTF8String( xOutputStream,"<meta name=\"oooWebcastStatus\" content=\"0\" />");
 
	writeUTF8String( xOutputStream,"<meta name=\"oooShowIndexOnStart\" content=\"");
	writeUTF8String( xOutputStream,msShowIndexOnStart);
	writeUTF8String( xOutputStream,"\" />\r\n");
 
	writeUTF8String( xOutputStream,"<!-- *************** META INFORMATION ENDS *************************** -->\r\n" );
 
}
 
 
//create the main html file.
void HTMLExporter::createHTMLFile( const Reference< XOutputStream >& xOutputStream, const OUString& rsDocumentTitle )
{
	writeUTF8String( xOutputStream, "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n" );
	writeUTF8String( xOutputStream, "<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n<title>");
	writeUTF8String( xOutputStream, rsDocumentTitle );
	writeUTF8String( xOutputStream, "</title>\r\n" );
 
// write Meta Data
	writeHTMLMetaData( xOutputStream, rsDocumentTitle );
 
// dependant/required files included
	writeUTF8String( xOutputStream, "<script type=\"text/javascript\" src=\"resource/presentation.js\"></script>\r\n");
	writeUTF8String( xOutputStream, "<link type=\"text/css\" rel=\"stylesheet\" href=\"resource/presentation.css\" />\r\n");
	writeUTF8String( xOutputStream, "<link type=\"text/css\" rel=\"stylesheet\" href=\"template/default.css\" />\r\n");
	writeUTF8String( xOutputStream, "<script type=\"text/javascript\" src=\"template/default.js\"></script>\r\n");
	writeUTF8String( xOutputStream, "<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"favicon.ico\" />\r\n");
 
	writeUTF8String( xOutputStream, "</head>\r\n");
 
	writeUTF8String( xOutputStream, "<body>\r\n");
	writeUTF8String( xOutputStream, "<!-- Nothing unwanted in the body,, everything will be added by template realtime on demand. No Code Redundancy.. Hurray!! -->\r\n");
	writeUTF8String( xOutputStream, "<!-- there could be special template elements added during export process to add flexibility.. that completely depends on template designer and his/her creativity-->\r\n");
	writeUTF8String( xOutputStream, "<!--******************************************************************************************************************\r\n");
	writeUTF8String( xOutputStream, "Followind section is for Javascript RollBack.. this will only be displayed if javascript is disabled.. -->\r\n");
	writeUTF8String( xOutputStream, "<div id=\"NoJs\">\r\n");
	writeUTF8String( xOutputStream, "<h1 align=\"center\">Welcome!</h1>\r\n");
	writeUTF8String( xOutputStream, "<h2 align=\"center\">JavaScript Seems To Be Disabled!</h2>\r\n");
	writeUTF8String( xOutputStream, "<h4 align=\"center\"><a href=\"nojs/index.html\">Click Here To Launch Standard Non Javascript Version</a></h4>\r\n");
	writeUTF8String( xOutputStream, "<h4 align=\"center\">Or</h4>\r\n");
	writeUTF8String( xOutputStream, "<h4 align=\"center\">Enable JavaScript In Your Browser</h4>\r\n");
	writeUTF8String( xOutputStream, "</div>\r\n");
 
	writeUTF8String( xOutputStream, "<!-- Index -->\r\n");
	writeUTF8String( xOutputStream, "<div id=\"index\">\r\n");
 
	// write index data
	writeIndexData( xOutputStream );	
 
	writeUTF8String( xOutputStream, "</div>\r\n");
 
	writeUTF8String( xOutputStream, "<!-- Background -->\r\n");
	writeUTF8String( xOutputStream, "<div id=\"background\"></div>\r\n");
 
	writeUTF8String( xOutputStream, "<!-- text only view -->\r\n");
	writeUTF8String( xOutputStream, "<div id=\"textOnly\">\r\n");
 
	// write text only view data
	writeTextViewData( xOutputStream );
 
	writeUTF8String( xOutputStream, "</div>\r\n");
 
	writeUTF8String( xOutputStream, "<!-- notes -->\r\n");
	writeUTF8String( xOutputStream, "<div id=\"notesContainer\">\r\n");
 
	//notes data
	writeNotesData( xOutputStream );	
 
	writeUTF8String( xOutputStream, "</div>\r\n");
 
	writeUTF8String( xOutputStream, "<!-- TEMPLATE SPECIFIC ELEMENTS HERE (if any)-->\r\n");
 
	//template specific elements 
	writeTemplateSpecificData( xOutputStream );
 
	writeUTF8String( xOutputStream, "</body>\r\n");
	writeUTF8String( xOutputStream, "</html>\r\n");
	xOutputStream->flush();	
}
 
// function to copy template files
void HTMLExporter::copyTemplateFiles()
{
//todo
// to copy default template, for testing and in case no template extension found
copyDefaultTemplateFiles();
}
 
void HTMLExporter::writeIndexData( const Reference< XOutputStream >& xOutputStream )
{
//todo
}
 
void HTMLExporter::writeTextViewData( const Reference< XOutputStream >& xOutputStream )
{
//todo
}
 
void HTMLExporter::writeNotesData( const Reference< XOutputStream >& xOutputStream )
{
//todo
}
 
void HTMLExporter::writeTemplateSpecificData( const Reference< XOutputStream >& xOutputStream )
{
//todo
}

makefile.mk

makefile for the HTML Export extension.

#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# 
# Copyright 2000, 2010 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
#
# This file is part of OpenOffice.org.
#
# OpenOffice.org is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# only, as published by the Free Software Foundation.
#
# OpenOffice.org is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License version 3 for more details
# (a copy is included in the LICENSE file that accompanied this code).
#
# You should have received a copy of the GNU Lesser General Public License
# version 3 along with OpenOffice.org.  If not, see
# <http://www.openoffice.org/license.html>
# for a copy of the LGPLv3 License.
#
#*************************************************************************
 
PRJ=..$/..
 
PRJNAME=sdext
TARGET=htmlex
ENABLE_EXCEPTIONS=TRUE
 
# --- Settings -----------------------------------------------------
 
MKDEPENDSOLVER:=
.INCLUDE: settings.mk
 
.IF "$(L10N_framework)"==""
 
# --- Files --------------------------------------------------------
 
EXTENSIONNAME:=HTMLEx
EXTENSION_ZIPNAME:=htmlexv1.4.11
CDEFS += -DHTMLEX_IMPL_IDENTIFIER="com.sun.star.$(EXTENSIONNAME)-$(PLATFORMID)"
SLOFILES=\
    $(SLO)$/htmlex.obj \
    $(SLO)$/Template.obj \
    $(SLO)$/services.obj
 
SHL1DLLPRE=
SHL1TARGET=$(TARGET).uno
 
SHL1LIBS=\
	$(SLB)$/$(TARGET).lib
 
SHL1STDLIBS=\
    $(CPPUHELPERLIB)	\
	$(ZLIB3RDLIB)	    \
	$(CPPULIB)			\
	$(SALLIB)
 
SHL1DEPN=
SHL1IMPLIB=	i$(SHL1TARGET)
SHL1DEF=	$(MISC)$/$(SHL1TARGET).def
SHL1VERSIONMAP=$(SOLARENV)/src/component.map
SHL1RPATH=OXT
 
DEF1NAME=$(SHL1TARGET)
 
# --- Extension packaging ------------------------------------------
 
DESCRIPTION_SRC:=config$/description.xml
MANIFEST_SRC:=config$/manifest.xml
COMPONENT_CONFIGDIR:=config
COMPONENT_CONFIGDEST:=.
COMPONENT_XCU= \
    $(EXTENSIONDIR)$/htmlex_export_filter.xcu \
    $(EXTENSIONDIR)$/templates.xcu
 
COMPONENT_FILES= \
    $(EXTENSIONDIR)$/templates.xcs
 
COMPONENT_TEMPLATE1_FILES = \
	$(EXTENSIONDIR)$/template1$/res$/preview.png \
	$(EXTENSIONDIR)$/template1$/res$/default.css \
	$(EXTENSIONDIR)$/template1$/res$/default.js \
	$(EXTENSIONDIR)$/template1$/images$/end.png \
	$(EXTENSIONDIR)$/template1$/images$/next.png \
	$(EXTENSIONDIR)$/template1$/images$/ns.png \
	$(EXTENSIONDIR)$/template1$/images$/previous.png \
	$(EXTENSIONDIR)$/template1$/images$/ps.png \
	$(EXTENSIONDIR)$/template1$/images$/start.png \
	$(EXTENSIONDIR)$/template1$/images$/stop.png \
	$(EXTENSIONDIR)$/template1$/images$/bgty.png \
	$(EXTENSIONDIR)$/template1$/images$/text.png \
	$(EXTENSIONDIR)$/template1$/extras$/info.txt
 
COMPONENT_TEMPLATE2_FILES = \
	$(EXTENSIONDIR)$/template2$/res$/preview.png \
	$(EXTENSIONDIR)$/template2$/res$/default.css \
	$(EXTENSIONDIR)$/template2$/res$/default.js \
	$(EXTENSIONDIR)$/template2$/images$/end.png \
	$(EXTENSIONDIR)$/template2$/images$/next.png \
	$(EXTENSIONDIR)$/template2$/images$/ns.png \
	$(EXTENSIONDIR)$/template2$/images$/previous.png \
	$(EXTENSIONDIR)$/template2$/images$/ps.png \
	$(EXTENSIONDIR)$/template2$/images$/start.png \
	$(EXTENSIONDIR)$/template2$/images$/stop.png \
	$(EXTENSIONDIR)$/template2$/images$/bgty.png \
	$(EXTENSIONDIR)$/template2$/images$/text.png \
	$(EXTENSIONDIR)$/template2$/extras$/info.txt
 
COMPONENT_TEMPLATE3_FILES = \
	$(EXTENSIONDIR)$/template3$/res$/preview.png \
	$(EXTENSIONDIR)$/template3$/res$/default.css \
	$(EXTENSIONDIR)$/template3$/res$/default.js \
	$(EXTENSIONDIR)$/template3$/images$/end.png \
	$(EXTENSIONDIR)$/template3$/images$/next.png \
	$(EXTENSIONDIR)$/template3$/images$/ns.png \
	$(EXTENSIONDIR)$/template3$/images$/previous.png \
	$(EXTENSIONDIR)$/template3$/images$/ps.png \
	$(EXTENSIONDIR)$/template3$/images$/start.png \
	$(EXTENSIONDIR)$/template3$/images$/stop.png \
	$(EXTENSIONDIR)$/template3$/images$/bgty.png \
	$(EXTENSIONDIR)$/template3$/images$/text.png \
	$(EXTENSIONDIR)$/template3$/extras$/info.txt
 
 
COMPONENT_EXTRAS= \
	$(EXTENSIONDIR)$/files/manual.txt \
	$(EXTENSIONDIR)$/files/oooadd.js \
	$(EXTENSIONDIR)$/files/presentation.css \
	$(EXTENSIONDIR)$/files/presentation.js \
	$(EXTENSIONDIR)$/files/favicon.ico \
 
 
# native libraries
COMPONENT_LIBRARIES= \
    $(EXTENSIONDIR)$/$(SHL1TARGET)$(DLLPOST)
 
EXTENSION_PACKDEPS=$(COMPONENT_EXTRAS) $(COMPONENT_TEMPLATE1_FILES) $(COMPONENT_TEMPLATE2_FILES) $(COMPONENT_TEMPLATE3_FILES) makefile.mk
 
.INCLUDE : extension_pre.mk
.ENDIF # L10N_framework
.INCLUDE : target.mk
 
.IF "$(L10N_framework)"==""
.INCLUDE : extension_post.mk
 
$(COMPONENT_EXTRAS) : files$/$$(@:f)
	@@-$(MKDIRHIER) $(@:d)
    $(COPY) $< $@
 
$(COMPONENT_TEMPLATE1_FILES) : template1$/$$(@:f)
	@@-$(MKDIRHIER) $(@:d)
    $(COPY) $< $@
 
$(COMPONENT_TEMPLATE2_FILES) : template2$/$$(@:f)
	@@-$(MKDIRHIER) $(@:d)
    $(COPY) $< $@
 
$(COMPONENT_TEMPLATE3_FILES) : template3$/$$(@:f)
	@@-$(MKDIRHIER) $(@:d)
    $(COPY) $< $@
 
.ENDIF # L10N_framework

manifest.xml

manifest file for the export filter

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd">
<manifest:manifest xmlns:manifest="http://openoffice.org/2001/manifest">
  <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=native"
                       manifest:full-path="htmlex.unoSHARED_EXTENSION"/>
  <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
					   manifest:full-path="htmlex_export_filter.xcu"/>
  <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
					             manifest:full-path="templates.xcu"/>
  <manifest:file-entry manifest:media-type="application/vnd.sun.star.package-bundle-description"
                       manifest:full-path="help/component.txt"/>
  <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-schema"
                       manifest:full-path="templates.xcs"/>
</manifest:manifest>


htmlex_export_filter.xcu

Configuration file for the export filter

<?xml version="1.0" encoding="UTF-8"?>
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Filter" oor:package="org.openoffice.TypeDetection">
  <node oor:name="Filters">
    <node oor:name="impress_htmlex_export" oor:type="xs:string" oor:op="replace">
      <prop oor:name="DocumentService">
        <value>com.sun.star.presentation.PresentationDocument</value>
      </prop>
      <prop oor:name="FileFormatVersion" oor:type="xs:int">
        <value>0</value>
      </prop>
      <prop oor:name="FilterService" oor:type="xs:string">
        <value>com.sun.star.comp.documents.HTMLExExporter</value>
      </prop>
      <prop oor:name="Flags" oor:type="oor:string-list">
        <value>3RDPARTYFILTER ALIEN EXPORT</value>
      </prop>
      <prop oor:name="Type" oor:type="xs:string">
        <value>XHTML_File</value>
      </prop>
      <prop oor:name="UIName">
        <value xml:lang="x-default">HTML New Export v1.3.x.a Kushal</value>
      </prop>
      <prop oor:name="TemplateName"/>
      <prop oor:name="UIComponent"/>
    </node>
  </node>
</oor:component-data>


description.xml

Description of the export filter

<?xml version="1.0" encoding="UTF-8"?>
<description
 
    xmlns="http://openoffice.org/extensions/description/2006"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:dep="http://openoffice.org/extensions/description/2006">
    <identifier value="UPDATED_IDENTIFIER" />
 
    <dependencies>
        <OpenOffice.org-minimal-version value="3.0" dep:name="OpenOffice.org 3.0"/>
    </dependencies>
 
    <registration>
        <simple-license accept-by="admin" default-license-id="lic-en-US" suppress-if-required="true" >
        <license-text xlink:href="licensefile" lang="isocode" license-id="lic-isocode"/>
        </simple-license>
    </registration>
 
    <version value="1.3.7" />
 
    <platform value="UPDATED_SUPPORTED_PLATFORM" />
 
    <publisher>
        <name xlink:href="http://www.oracle.com/us/products/applications/open-office" lang="en">Oracle</name>
    </publisher>
 
    <display-name>
        <name lang="en-US">HTML New Export v1.3.x.a Kushal</name>
    </display-name>
 
    <icon>
      <default xlink:href="images/extension_32.png" />
      <high-contrast xlink:href="images/extension_32_h.png" />
    </icon>
 
</description>

templates.xcs

This file defines the configuration schema for the templates

<?xml version='1.0' encoding='UTF-8'?>
<!--***********************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 * 
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************ -->
<oor:component-schema oor:name="SdHtmlExport" oor:package="org.openoffice.Office.extension" xml:lang="en-US" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <info>
    <author>Christan Lippka and Kushal Likhi</author>
    <desc >Contains information about installed html export templates for impress and draw.</desc>
  </info>
  <templates>
    <group oor:name="Template">
      <info>
        <desc>Lists the information about a html export template.</desc>
      </info>
      <prop oor:name="UIName" oor:localized="true" oor:type="xs:string">
        <info>
          <desc>Localized name of this template for showing it at the UI.</desc>
        </info>
	<value/>
      </prop>
      <prop oor:name="Author" oor:type="xs:string">
        <info>
          <desc>Name of this templates creator.</desc>
        </info>
	<value/>
      </prop>
      <prop oor:name="Description" oor:localized="true" oor:type="xs:string">
        <info>
          <desc>Short Localized description of this template.</desc>
        </info>
	<value/>
      </prop>           
      <prop oor:name="PreviewImageURL" oor:type="xs:string">
        <info>
          <desc>URL to the templates preview image.</desc>
        </info>
	<value/>
      </prop>
      <prop oor:name="TemplateURL" oor:type="xs:string">
        <info>
          <desc>URL to the template files.</desc>
        </info>
	<value/>
      </prop>
      <prop oor:name="ImagesDir" oor:type="xs:string">
        <info>
          <desc>URL to the file which contains the list of images packed in the template.</desc>
        </info>
        <value/>
      </prop>
      <prop oor:name="ExtrasDir" oor:type="xs:string">
        <info>
          <desc>URL to the file which contains the list of extra files if in case are there in the template.</desc>
        </info>
        <value/>
      </prop>
      <prop oor:name="HTMLInjectURL" oor:type="xs:string">
        <info>
          <desc>URL to the file which contain the template specific HTML code to be added to the exported HTML file.</desc>
        </info>
        <value/>
      </prop>
      <prop oor:name="SupportAuto" oor:type="xs:string">
        <info>
          <desc>Boolean value to denote the template support to auto slide show.</desc>
        </info>
        <value/>
      </prop>
      <prop oor:name="SupportNotes" oor:type="xs:string">
        <info>
          <desc>Boolean value to denote the template support to notes.</desc>
        </info>
        <value/>
      </prop>
      <prop oor:name="SupportTextView" oor:type="xs:string">
        <info>
          <desc>Boolean value to denote the template support to text view.</desc>
        </info>
        <value/>
      </prop>
      <prop oor:name="SupportIndex" oor:type="xs:string">
        <info>
          <desc>Boolean value to denote the template support to display index.</desc>
        </info>
        <value/>
      </prop>
      <prop oor:name="SupportedBrowsers" oor:type="xs:string">
        <info>
          <desc>list of browsers tested and supported by this template.</desc>
        </info>
        <value/>
      </prop>
    </group>
  </templates>
  <component>
    <set oor:name="Templates" oor:node-type="Template">
      <info>
        <desc>Lists the registered Templates.</desc>
      </info>
    </set>
  </component>
</oor:component-schema>

templates.xcu

This file defines the packed templates. there are 3 packed templates by default.

<?xml version="1.0" encoding="UTF-8"?>
<!--***********************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 * 
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************ -->
<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="SdHtmlExport" oor:package="org.openoffice.Office.extension">
  <node oor:name="Templates">
    <node oor:name="Default_template_1" oor:op="replace">
      <prop oor:name="UIName">
        <value xml:lang="x-default">Default Template 1</value>
      </prop>
      <prop oor:name="Author">
        <value>Kushal Likhi</value>
      </prop>
      <prop oor:name="Description">
        <value>The first default template included with the HTML Export.</value>
      </prop>
      <prop oor:name="PreviewImageURL">
        <value>%origin%/template1/preview.png</value>
      </prop>
      <prop oor:name="TemplateURL">
        <value>%origin%/template1</value>
      </prop>
      <prop oor:name="ImageDir" oor:type="xs:string">
        <value>%origin%/template1/images</value>
      </prop>
      <prop oor:name="ExtrasDir" oor:type="xs:string">
        <value>%origin%/template1/extras</value>
      </prop>
      <prop oor:name="HTMLInjectURL" oor:type="xs:string">
        <value>%origin%/template1/inject.html</value>
      </prop>
      <prop oor:name="SupportAuto" oor:type="xs:string">
        <value>true</value>
      </prop>
      <prop oor:name="SupportNotes" oor:type="xs:string">
        <value>true</value>
      </prop>
      <prop oor:name="SupportTextView" oor:type="xs:string">
        <value>true</value>
      </prop>
      <prop oor:name="SupportIndex" oor:type="xs:string">
        <value>true</value>
      </prop>
      <prop oor:name="SupportedBrowsers" oor:type="xs:string">
        <value>Opera,IE,Firefox,Safari,Chrome - All latest versions tested.</value>
      </prop>
    </node>
    <node oor:name="Default_template_2" oor:op="replace">
      <prop oor:name="UIName">
        <value xml:lang="x-default">Default Template 2</value>
      </prop>
      <prop oor:name="Author">
        <value>Kushal Likhi</value>
      </prop>
      <prop oor:name="Description">
        <value>The Second default template included with the HTML Export.</value>
      </prop>
      <prop oor:name="PreviewImageURL">
        <value>%origin%/template2/preview.png</value>
      </prop>
      <prop oor:name="TemplateURL">
        <value>%origin%/template2</value>
      </prop>
      <prop oor:name="ImageDir" oor:type="xs:string">
        <value>%origin%/template2/images</value>
      </prop>
      <prop oor:name="ExtrasDir" oor:type="xs:string">
        <value>%origin%/template2/extras</value>
      </prop>
      <prop oor:name="HTMLInjectURL" oor:type="xs:string">
        <value>%origin%/template2/inject.html</value>
      </prop>
      <prop oor:name="SupportAuto" oor:type="xs:string">
        <value>true</value>
      </prop>
      <prop oor:name="SupportNotes" oor:type="xs:string">
        <value>true</value>
      </prop>
      <prop oor:name="SupportTextView" oor:type="xs:string">
        <value>true</value>
      </prop>
      <prop oor:name="SupportIndex" oor:type="xs:string">
        <value>true</value>
      </prop>
      <prop oor:name="SupportedBrowsers" oor:type="xs:string">
        <value>Opera,IE,Firefox,Safari,Chrome - All latest versions tested.</value>
      </prop>
    </node>
    <node oor:name="Default_template_3" oor:op="replace">
      <prop oor:name="UIName">
        <value xml:lang="x-default">Default Template 3</value>
      </prop>
      <prop oor:name="Author">
        <value>Kushal Likhi</value>
      </prop>
      <prop oor:name="Description">
        <value>The third default template included with the HTML Export.</value>
      </prop>
      <prop oor:name="PreviewImageURL">
        <value>%origin%/template3/preview.png</value>
      </prop>
      <prop oor:name="TemplateURL">
        <value>%origin%/template3</value>
      </prop>
      <prop oor:name="ImageDir" oor:type="xs:string">
        <value>%origin%/template3/images</value>
      </prop>
      <prop oor:name="ExtrasDir" oor:type="xs:string">
        <value>%origin%/template3/extras</value>
      </prop>
      <prop oor:name="HTMLInjectURL" oor:type="xs:string">
        <value>%origin%/template3/inject.html</value>
      </prop>
      <prop oor:name="SupportAuto" oor:type="xs:string">
        <value>true</value>
      </prop>
      <prop oor:name="SupportNotes" oor:type="xs:string">
        <value>true</value>
      </prop>
      <prop oor:name="SupportTextView" oor:type="xs:string">
        <value>true</value>
      </prop>
      <prop oor:name="SupportIndex" oor:type="xs:string">
        <value>true</value>
      </prop>
      <prop oor:name="SupportedBrowsers" oor:type="xs:string">
        <value>Opera,IE,Firefox,Safari,Chrome - All latest versions tested.</value>
      </prop>
    </node>
</oor:component-data>

Template.hxx

Header file to declare Template class

/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 * 
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/
#ifndef INCLUDED_TEMPLATE_HXX
#define INCLUDED_TEMPLATE_HXX
 
 
#include <com/sun/star/util/URL.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
#include <com/sun/star/io/XTextInputStream.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
 
 
class Template
{
 
	private:
		// various keys for configuration data.
		rtl::OUString maUINameKey;
		rtl::OUString maAuthorKey;
		rtl::OUString maDescriptionKey;
		rtl::OUString maPreviewImageURLKey;
		rtl::OUString maTemplateURLKey;
		rtl::OUString maImagesDirURLKey;
		rtl::OUString maExtrasDirURLKey;
		rtl::OUString maHTMLInjectURLKey;
		rtl::OUString maSupportAutoKey;
		rtl::OUString maSupportNotesKey;
		rtl::OUString maSupportTextViewKey;
		rtl::OUString maSupportIndexKey;
		rtl::OUString maSupportedBrowsersKey;
 
		rtl::OUString maRootPath;
		rtl::OUString maSeperator;
 
		com::sun::star::uno::Reference< com::sun::star::lang::XMultiComponentFactory > mxServiceFactory;
		com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xConfigProvider;
		com::sun::star::uno::Sequence< rtl::OUString >	FoundTemplates;
 
		com::sun::star::uno::Sequence< com::sun::star::uno::Any > lParams;
    		com::sun::star::beans::PropertyValue aParam ;
 
		com::sun::star::uno::Reference< com::sun::star::util::XURLTransformer > mxURLTransformer;
		com::sun::star::uno::Reference< com::sun::star::ucb::XSimpleFileAccess2 > mxFileAccess;
		com::sun::star::uno::Reference< com::sun::star::io::XTextInputStream > mxTextInputStream;
 
 
 
	public:
 
		// constructor for the class
		Template( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext );
		//configuretion data of the selected template. for public access 
		rtl::OUString UIName;
		rtl::OUString Author;
		rtl::OUString Description;
		rtl::OUString PreviewImageURL;
		rtl::OUString TemplateURL;
		rtl::OUString ImagesDirURL;
		rtl::OUString ExtrasDirURL;
		rtl::OUString HTMLInjectURL;
		rtl::OUString SupportAuto;
		rtl::OUString SupportNotes;
		rtl::OUString SupportTextView;
		rtl::OUString SupportIndex;
		rtl::OUString SupportedBrowsers;
		// variable that will store the number of templates found in the system.
		sal_Int32 TemplateCount;
 
 
		//function to get the installed templates
		bool getTemplates();
		bool copyImages(com::sun::star::util::URL baseURL);
		bool copyJsCssFiles(com::sun::star::util::URL baseURL);
		bool copyMiscFiles(com::sun::star::util::URL baseURL);
		bool selectTemplate(sal_Int32 Sno);
		bool addHTMLData( const com::sun::star::uno::Reference< com::sun::star::io::XOutputStream >& xOutputStream );		
 
 
};
#endif

Template.cxx

This file defines Template class

/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 * 
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sdext.hxx"
#include "Template.hxx"
#include <com/sun/star/container/XNameAccess.hpp>
 
 
using rtl::OUString;
using namespace rtl;
using namespace com::sun::star;
using namespace com::sun::star::uno;
using namespace com::sun::star::ucb;
using namespace com::sun::star::util;
using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::container;
using namespace com::sun::star::io;
 
Template::Template( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext )
: maUINameKey( RTL_CONSTASCII_USTRINGPARAM( "UIName" ) )
, maAuthorKey( RTL_CONSTASCII_USTRINGPARAM( "Author" ) )
, maDescriptionKey( RTL_CONSTASCII_USTRINGPARAM( "Description" ) )
, maPreviewImageURLKey( RTL_CONSTASCII_USTRINGPARAM( "PreviewImageURL" ) )
, maTemplateURLKey( RTL_CONSTASCII_USTRINGPARAM( "TemplateURL" ) )
, maImagesDirURLKey( RTL_CONSTASCII_USTRINGPARAM( "ImageListURL" ) )
, maExtrasDirURLKey( RTL_CONSTASCII_USTRINGPARAM( "ExtrasListURL" ) )
, maHTMLInjectURLKey( RTL_CONSTASCII_USTRINGPARAM( "HTMLInjectURL" ) )
, maSupportAutoKey( RTL_CONSTASCII_USTRINGPARAM( "SupportAuto" ) )
, maSupportNotesKey( RTL_CONSTASCII_USTRINGPARAM( "SupportNotes" ) )
, maSupportTextViewKey( RTL_CONSTASCII_USTRINGPARAM( "SupportTextView" ) )
, maSupportIndexKey( RTL_CONSTASCII_USTRINGPARAM( "SupportIndex" ) )
, maSupportedBrowsersKey( RTL_CONSTASCII_USTRINGPARAM( "SupportedBrowsers" ) )
, maRootPath( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.extension.SdHtmlExport/Templates"))
, maSeperator( RTL_CONSTASCII_USTRINGPARAM("/"))
, xConfigProvider( mxServiceFactory->createInstanceWithContext(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider")), xContext), UNO_QUERY_THROW )
, lParams(2)
, mxURLTransformer( mxServiceFactory->createInstanceWithContext( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer" )), xContext ), UNO_QUERY_THROW )
, mxFileAccess( mxServiceFactory->createInstanceWithContext( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")), xContext ), UNO_QUERY_THROW )
, mxTextInputStream( mxServiceFactory->createInstanceWithContext( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.XTextInputStream")), xContext  ), UNO_QUERY_THROW )
{
}
 
bool Template::getTemplates()
{
 
	// enable "all locales mode"
	aParam.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("locale"));
	aParam.Value <<= OUString(RTL_CONSTASCII_USTRINGPARAM("*"));
	lParams[0] <<= aParam;
 
	// set root path
	aParam.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath"));
	aParam.Value <<= maRootPath;
	lParams[1] <<= aParam;
 
	Reference< XNameAccess > xTemplates( xConfigProvider->createInstanceWithArguments( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationAccess")), lParams), UNO_QUERY_THROW );
 
	Sequence< OUString > aList( xTemplates->getElementNames() );
	FoundTemplates = aList;
	TemplateCount = FoundTemplates.getLength();
	return true;
 
}
 
 
bool Template::copyImages(URL baseURL)
{
//todo
return true;
}
 
 
bool Template::copyJsCssFiles(URL baseURL)
{
//todo
return true;
}
 
 
bool Template::copyMiscFiles(URL baseURL)
{
//todo
return true;
}
 
 
bool Template::selectTemplate(sal_Int32 Sno)
{
//todo
return true;
}
 
 
bool Template::addHTMLData( const Reference< XOutputStream >& xOutputStream )
{
//todo
 
return true;
}

Client Browser End

files working at client browser end


oooadd.js

This file is used to embed the presentation in existing documents

/*
 
oooadd.js
 
NOTE: all variables and functions have a prefix "ooo" to minnimise conflicts..
 
use this script to embbed the presentation in an existing webpage.
 
syntax:
in the head section add this script
<script type="text/javascript" src="(path)/add.js"></script>
 
in the body section,, just assign the class="presentationTrigger" to ANY element and add one custom attribute ooopath="path to presentation folder", rest all will be automatically done by this script, i.e adding action listeners, event handlers, pointer display on hover and CSS. on clicking that element(s) it will launch presentation in current document as an overlay.
syntax:
<div(or any element) class="presentationTrigger" ooopath="path to presentation folder"></div(or any element)>
ex.
<div class="presentationTrigger" ooopath="samplePresentation"></div>
<div class="presentationTrigger" ooopath="cache/samplePresentation"></div>
you can also link to remote presentations:
<div class="presentationTrigger" ooopath="http://www.site.com/folder/samplePresentation"></div>
 
you can add multiple seperate presentations in one file, by changing the value of ooo attribute for each trigger to desired path.
 
IF YOU WANT TO USE YOUR OWN CLASS NAME, then edit the variable "triggerClass" below
 
 
*/
 
//*****************************************DEFAULT SETTINGS HERE*********************
// class Name of the trigger
var oootriggerClass = "presentationTrigger";
var boooBackGroundColor = "#000000";
var boooBackMargin = 99.5;
var booobackGroundTransparency = 0.80;
var boooifrSize = 98;
var boooOSD = false;
//**********************************EDIT THINGS BELOW WITH CARE********************
 
var oooBackGroundColor;
var oooBackMargin;
var ooobackGroundTransparency;
var oooifrSize;
var oooOSD;
 
var ooorszflag = false;
// ooobrowser object holds data about current browser window, like height, width.
var ooobrowser = new Object();
ooobrowser.width = 0;
ooobrowser.height = 0;
//get size of window
function ooogetSize(){
	if( typeof( window.innerWidth ) == 'number' ) 
	{ 
	ooobrowser.width = window.innerWidth; 
	ooobrowser.height = window.innerHeight;
	}
	else if(document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight)) 
	{
	ooobrowser.width = document.documentElement.clientWidth; 
	ooobrowser.height = document.documentElement.clientHeight;
	} 
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
	{
	ooobrowser.width = document.body.clientWidth; 
	ooobrowser.height = document.body.clientHeight;
	}};
 
//  on click event handler
function oooonclick(e){
 
	var path;
	ifpos = new Object();
	bgpos = new Object();
	// get the right event and target element. cross browser support
	var ehandle = (e==null)?window.event.srcElement:e.target;
	//gathering the attributes and the information stored in them
	var source = ehandle.getAttribute("ooopath");
	oooBackGroundColor = (ehandle.getAttribute("ooobgColor") == null)?boooBackGroundColor:ehandle.getAttribute("ooobgColor");
	oooBackMargin = (ehandle.getAttribute("ooobgMargin") == null)?boooBackMargin:Math.abs(ehandle.getAttribute("ooobgMargin"));
	ooobackGroundTransparency = (ehandle.getAttribute("ooobgTrans") == null)?booobackGroundTransparency:Math.abs(ehandle.getAttribute("ooobgTrans"));
	oooifrSize = (ehandle.getAttribute("ooosize") == null)?boooifrSize:parseInt(ehandle.getAttribute("ooosize"));
	oooOSD = (ehandle.getAttribute("oooOSD") == null)?boooOSD:parseInt(ehandle.getAttribute("oooOSD"));
	// checking if ooopath attributr is set, its required hence if not message is shown
	if(source == null){
	 alert("NO TARGET PRESENTATION DEFINED!! add '' ooopath='path to folder' '' Attribute to this trigger.");
	 return 1;
	}
	else
	{
		path = source + "/index.html";
	}
	ooorszflag=true;
	// setting parameters for iframe
	ifpos.height = ((oooifrSize/100)*ooobrowser.height);
	ifpos.width = ((oooifrSize/100)*ooobrowser.width);
	if(oooifrSize >96){ifpos.width = ooobrowser.width - (ooobrowser.height - ifpos.height)}
	ifpos.top = parseInt((ooobrowser.height - ifpos.height) / 2);
	ifpos.left = parseInt((ooobrowser.width - ifpos.width)/2);
	//setting parameters for background
	bgpos.height = ((oooBackMargin/100)*ooobrowser.height);
	bgpos.width = ((oooBackMargin/100)*ooobrowser.width);
	if(oooifrSize >96){bgpos.width = ooobrowser.width - (ooobrowser.height - bgpos.height)}
	bgpos.top = parseInt((ooobrowser.height - bgpos.height) / 2);
	bgpos.left = parseInt((ooobrowser.width - bgpos.width)/2);
	//creating background
	var backgnd = document.createElement("div");
	backgnd.style.backgroundColor = oooBackGroundColor;
	backgnd.id = "ooobgdiv";
	backgnd.style.top = bgpos.top+"px";
	backgnd.style.left = bgpos.left+"px";
	backgnd.style.height = bgpos.height +"px";
	backgnd.style.width = bgpos.width +"px";
	backgnd.style.position = "absolute";
	backgnd.style.zIndex = 12;
	backgnd.style.filter = "alpha(opacity=" +(00)+")";
	backgnd.style.opacity = 0.0+"";
	document.getElementsByTagName("body").item(0).appendChild(backgnd);
	backgnd.style.filter = "alpha(opacity=" +(ooobackGroundTransparency*100)+")";
	backgnd.style.opacity = ooobackGroundTransparency+"";
	//creating iframe
	var Iframe = document.createElement("iframe");
	Iframe.src = path;
	Iframe.style.position = "absolute";
	Iframe.id = "oooIframe";
	Iframe.style.top = ifpos.top + "px";
	Iframe.style.left = ifpos.left + "px";
	Iframe.setAttribute("allowtransparency","1");
	Iframe.setAttribute("scrolling","auto");
	Iframe.setAttribute("frameborder","0");
	Iframe.style.border = "none";
	Iframe.style.overflow = "auto";
	Iframe.style.height = ifpos.height +"px";
	Iframe.style.width = ifpos.width +"px";
	Iframe.style.zIndex = 13;
	document.getElementsByTagName("body").item(0).appendChild(Iframe);
	//creating close button
	var closeb = document.createElement("div");
	closeb.innerHTML = "Close |X|";
	closeb.style.color= "#ffffff";
	closeb.style.fontSize = "10px";
	closeb.id = "ooocloseb";
	closeb.style.backgroundColor = "#ff0000";
	closeb.style.fontWeight = "bold";
	closeb.style.position = "absolute";
	closeb.style.zIndex = 14;
	closeb.style.border = "solid";
	closeb.style.top = "0px";
	closeb.style.height = "14px";
	closeb.style.width = "50px";
	closeb.style.left = (ooobrowser.width - 53) + "px";
	closeb.style.borderColor = "#000000";
	closeb.style.borderRight = "none";
	closeb.style.borderTop = "none";
	closeb.style.cursor = "pointer";
	closeb.align = "center";
	closeb.onclick = oooclose;
	document.getElementsByTagName("body").item(0).appendChild(closeb);
}
 
 
// window on load event handler
function oooonload(){
	ooogetSize();
	oooapply();
}
 
// apply properties to all triggers
function oooapply(){	
	var allHTMLTags = new Array();
	var allHTMLTags=document.getElementsByTagName("*");
	for (i=0; i<allHTMLTags.length; i++) {
		if (allHTMLTags[i].className==oootriggerClass) {
			allHTMLTags[i].style.cursor = "pointer";
			allHTMLTags[i].onclick = oooonclick;
			if(oooOSD){
			allHTMLTags[i].onmouseover = oooonmouseover;
			allHTMLTags[i].onmouseout = oooonmouseout;
			}
		}
	}
}
// event handler,, it is an override, enter your onmouseover js code here
function oooonmouseover(){
 
}
 
// event handler,, it is an override, enter your onmouseout js code here
function oooonmouseout(){
 
 
}
 
function oooclose(){
	document.getElementsByTagName("body").item(0).removeChild(document.getElementById("ooocloseb"));
	document.getElementsByTagName("body").item(0).removeChild(document.getElementById("oooIframe"));
	document.getElementsByTagName("body").item(0).removeChild(document.getElementById("ooobgdiv"));
	ooorszflag=false;
}
 
function oooresize(){
 
	if(ooorszflag){
	ooogetSize();
	ifpos = new Object();
	bgpos = new Object();
	var bg = document.getElementById("ooobgdiv");
	var cb = document.getElementById("ooocloseb");
	var ifr = document.getElementById("oooIframe");
	ifpos.height = ((oooifrSize/100)*ooobrowser.height);
	ifpos.width = ((oooifrSize/100)*ooobrowser.width);
	if(oooifrSize >96){ifpos.width = ooobrowser.width - (ooobrowser.height - ifpos.height)}
	ifpos.top = parseInt((ooobrowser.height - ifpos.height) / 2);
	ifpos.left = parseInt((ooobrowser.width - ifpos.width)/2);
	bgpos.height = ((oooBackMargin/100)*ooobrowser.height);
	bgpos.width = ((oooBackMargin/100)*ooobrowser.width);
	if(oooifrSize >96){bgpos.width = ooobrowser.width - (ooobrowser.height - bgpos.height)}
	bgpos.top = parseInt((ooobrowser.height - bgpos.height) / 2);
	bgpos.left = parseInt((ooobrowser.width - bgpos.width)/2);
	bg.style.top = bgpos.top + "px";
	bg.style.left = bgpos.left + "px";
	bg.style.height = bgpos.height + "px";
	bg.style.width = bgpos.width + "px";
	ifr.style.top = ifpos.top + "px";
	ifr.style.left = ifpos.left + "px";
	ifr.style.height = ifpos.height + "px";
	ifr.style.width = ifpos.width + "px";
	cb.style.left = (ooobrowser.width - 53) + "px";
 
	}
}
 
window.onload = oooonload;
window.onresize = oooresize;


presentation.js

It is the standard core of the exported presentation, it will remain constant or same for all exports and templates, its main functions are:

  1. Initialize and load the HTML Document.
  2. Provide Dynamic functionality to HTML page, i.e. to work in single document without refresh or links.
  3. A bridge between template and the HTML document(But without restrictions, template still could override this and work directly on HTML if required by the developer)
  4. And the most important, provide template developers with a library for developing templates. This library will make template development easy, simple, fast and powerful even by novice developers.
var presentation = new Object(); //onload(), onresize(), loadSlide(), printPage(), writeCookie(), readCookie(), preloadImage(),
presentation.template = new Object();//folder,js,css,onload(),resize()
presentation.template.events = new Object(); // 10 handler overrides , 10 event inlines
presentation.client = new Object(); //height, width, getSize(), statusMsg()
presentation.client.browserInfo = new BI(); // name, codename, version, platform, JavaEnabled
presentation.client.system = new PD(); //platform
presentation.info = new Object(); //6 vars
presentation.settings = new Object();// 7 vars
presentation.effects = new Object(); // slide()
presentation.element = new Object();//addElement(),RemoveElementById(),addCssJs(), place(), size(), placeNsize(), aplace(), asize(), aplaceNsize()
presentation.events = new Object();// 10 event handlers
presentation.element.button = new Object();
presentation.element.button.text = new Object();//id,eclass,add(),remove()
presentation.element.button.normal = new Object();//id,eclass,add(),remove()
presentation.element.button.notes = new Object();//id,eclass,add(),remove()
presentation.element.button.mute = new Object();//id,eclass,add(),remove()
presentation.element.button.index = new Object();//id,eclass,add(),remove()
presentation.element.navigation = new Object();
presentation.element.navigation.next = new Object();//id,eclass,add(),remove()
presentation.element.navigation.prev = new Object();//id,eclass,add(),remove()
presentation.element.navigation.first = new Object();//id,eclass,add(),remove()
presentation.element.navigation.end = new Object();//id,eclass,add(),remove()
presentation.element.navigation.play = new Object();//id,eclass,add(),remove()
 
layer = new Object();
layer.cache = 1;
layer.bg = 2;
layer.bs1 = 3;
layer.bs2 = 4;
layer.bs3 = 5;
layer.activeSlide = 6;
layer.as1 = 7;
layer.as2 = 8;
layer.as3 = 9;
layer.as4 = 10;
layer.navigation = 11;
layer.specialContent = 12;
layer.buttons = 13;
 
presentation.settings.playMode = false;
presentation.settings.notesMode = false;
 
presentation.element.navigation.next.id = "NextButton";
presentation.element.navigation.next.eclass = "navigation";
presentation.element.navigation.next.add = function(image){presentation.element.addElement("img",this.id,this.eclass);
document.getElementById(this.id).onclick = presentation.events.NextClick;
document.getElementById(this.id).onmouseover = presentation.events.NextMouseOver;
document.getElementById(this.id).onmouseout = presentation.events.NextMouseOut;
document.getElementById(this.id).src = image;
};
presentation.element.navigation.next.remove = function(){presentation.element.removeElementById(presentation.element.navigation.next.id);};
 
presentation.element.navigation.prev.id = "PrvButton";
presentation.element.navigation.prev.eclass = "navigation";
presentation.element.navigation.prev.add = function(image){presentation.element.addElement("img",this.id,this.eclass);
document.getElementById(this.id).onclick = presentation.events.PrevClick;
document.getElementById(this.id).onmouseover = presentation.events.PrevMouseOver;
document.getElementById(this.id).onmouseout = presentation.events.PrevMouseOut;
document.getElementById(this.id).src = image;
};
presentation.element.navigation.prev.remove = function(){presentation.element.removeElementById(this.id);};
 
 
presentation.element.navigation.first.id = "FirstButton";
presentation.element.navigation.first.eclass = "navigation";
presentation.element.navigation.first.add = function(image){presentation.element.addElement("img",this.id,this.eclass);
document.getElementById(this.id).onclick = presentation.events.StartClick;
document.getElementById(this.id).onmouseover = presentation.events.StartMouseOver;
document.getElementById(this.id).onmouseout = presentation.events.StartMouseOut;
document.getElementById(this.id).src = image;
};
presentation.element.navigation.first.remove = function(){presentation.element.removeElementById(this.id);};
 
presentation.element.navigation.end.id = "EndButton";
presentation.element.navigation.end.eclass = "navigation";
presentation.element.navigation.end.add = function(image){presentation.element.addElement("img",this.id,this.eclass);
 
document.getElementById(this.id).onclick = presentation.events.EndClick;
document.getElementById(this.id).onmouseover = presentation.events.EndMouseOver;
document.getElementById(this.id).onmouseout = presentation.events.EndMouseOut;
document.getElementById(this.id).src = image;
};
presentation.element.navigation.end.remove = function(){presentation.element.removeElementById(this.id);};
 
presentation.element.navigation.play.id = "PlayButton";
presentation.element.navigation.play.eclass = "navigation";
presentation.element.navigation.play.add = function(image){presentation.element.addElement("img",this.id,this.eclass);
 
document.getElementById(this.id).onclick = presentation.events.PlayClick;
document.getElementById(this.id).onmouseover = presentation.events.PlayMouseOver;
document.getElementById(this.id).onmouseout = presentation.events.PlayMouseOut;
document.getElementById(this.id).src = image;
};
presentation.element.navigation.play.remove = function(){presentation.element.removeElementById(this.id);};
 
presentation.element.button.text.id = "TextButton";
presentation.element.button.text.eclass = "button";
presentation.element.button.text.add = function(image){presentation.element.addElement("img",this.id,this.eclass);
document.getElementById(this.id).onclick = presentation.events.TextClick;
document.getElementById(this.id).onmouseover = presentation.events.TextMouseOver;
document.getElementById(this.id).onmouseout = presentation.events.TextMouseOut;
document.getElementById(this.id).src = image;
};
presentation.element.button.text.remove = function(){presentation.element.removeElementById(this.id);};
 
presentation.element.button.normal.id = "NormalButton";
presentation.element.button.normal.eclass = "button";
presentation.element.button.normal.add = function(image){presentation.element.addElement("img",this.id,this.eclass);
document.getElementById(this.id).onclick = presentation.events.NormalClick;
document.getElementById(this.id).onmouseover = presentation.events.NormalMouseOver;
document.getElementById(this.id).onmouseout = presentation.events.NormalMouseOut;
document.getElementById(this.id).src = image;
};
presentation.element.button.normal.remove = function(){presentation.element.removeElementById(this.id);};
 
presentation.element.button.notes.id = "NotesButton";
presentation.element.button.notes.eclass = "button";
presentation.element.button.notes.add = function(image){presentation.element.addElement("img",this.id,this.eclass);
document.getElementById(this.id).onclick = presentation.events.NotesClick;
document.getElementById(this.id).onmouseover = presentation.events.NotesMouseOver;
document.getElementById(this.id).onmouseout = presentation.events.NotesMouseOut;
document.getElementById(this.id).src = image;
};
presentation.element.button.notes.remove = function(){presentation.element.removeElementById(this.id);};
 
presentation.element.button.mute.id = "MuteButton";
presentation.element.button.mute.eclass = "button";
presentation.element.button.mute.add = function(image){presentation.element.addElement("img",this.id,this.eclass);
document.getElementById(this.id).onclick = presentation.events.MuteClick;
document.getElementById(this.id).onmouseover = presentation.events.MuteMouseOver;
document.getElementById(this.id).onmouseout = presentation.events.MuteMouseOut;
document.getElementById(this.id).src = image;
};
presentation.element.button.mute.remove = function(){presentation.element.removeElementById(this.id);};
 
presentation.element.button.index.id = "IndexButton";
presentation.element.button.index.eclass = "button";
presentation.element.button.index.add = function(image){presentation.element.addElement("img",this.id,this.eclass);
document.getElementById(this.id).onclick = presentation.events.IndexClick;
document.getElementById(this.id).onmouseover = presentation.events.IndexMouseOver;
document.getElementById(this.id).onmouseout = presentation.events.IndexMouseOut;
document.getElementById(this.id).src = image;
};
presentation.element.button.index.remove = function(){presentation.element.removeElementById(this.id);};
 
 
 
 
presentation.info.author = document.getElementsByName("oooAuthor").item(0).getAttribute("content");
presentation.info.slideCount = document.getElementsByName("oooSlideCount").item(0).getAttribute("content");
presentation.info.title = document.getElementsByName("oooTitle").item(0).getAttribute("content");
presentation.info.version = document.getElementsByName("oooVersion").item(0).getAttribute("content");
presentation.info.extensionVersion = document.getElementsByName("oooExtensionVersion").item(0).getAttribute("content");
presentation.info.timeStamp = document.getElementsByName("oooTimeStamp").item(0).getAttribute("content");
 
presentation.settings.outline = (document.getElementsByName("oooOutline").item(0).getAttribute("content") == "yes")?true:false;
presentation.settings.notes = (document.getElementsByName("oooNotes").item(0).getAttribute("content") == "yes")?true:false;
presentation.settings.index = (document.getElementsByName("oooIndex").item(0).getAttribute("content") == "yes")?true:false;
presentation.settings.sound = (document.getElementsByName("oooSound").item(0).getAttribute("content") == "yes")?true:false;
presentation.settings.indexOnLoad = (document.getElementsByName("oooShowIndexOnStart").item(0).getAttribute("content") == "yes")?true:false;
presentation.settings.autoTime = parseInt(document.getElementsByName("oooAutoTime").item(0).getAttribute("content"))*1000;
presentation.settings.webcastStatus = parseInt(document.getElementsByName("oooWebcastStatus").item(0).getAttribute("content"));
 
 
 
presentation.onload = function(){
	presentation.client.getSize();
	document.getElementById("NoJs").style.display = "none";
 
	presentation.info.currentSlide=1;
 
	for(n=1;n<=presentation.info.slideCount;n++){
	presentation.loadSlide(n);
	}
	if(presentation.settings.indexOnLoad){
		presentation.events.IndexClick();
	}
	var id = "s"+presentation.info.currentSlide;
 
	document.getElementById(id).style.zIndex = layer.activeSlide;
 
	if(typeof(presentation.template.onload)!="undefined"){presentation.template.onload();}
};
 
presentation.onresize = function(){
	presentation.client.getSize();
 
	if(typeof(presentation.template.resize)!="undefined"){presentation.template.resize();}
}
 
window.onload = presentation.onload;
window.onresize = presentation.onresize;
 
presentation.element.addElement = function(tag,id,eclass){
	var ce = document.createElement(tag);
	ce.id = id;
	ce.className = eclass;
	document.getElementsByTagName("body").item(0).appendChild(ce);
}
 
presentation.element.removeElementById = function(id){
	document.getElementsByTagName("body").item(0).removeChild(document.getElementById(id));
}
 
presentation.element.addCssJs = function(filename, filetype){
 if (filetype=="js"){
  var fileref=document.createElement("script");
  fileref.setAttribute("type","text/javascript");
  fileref.setAttribute("src", filename);
 }
 else if (filetype=="css"){
  var fileref=document.createElement("link");
  fileref.setAttribute("rel", "stylesheet");
  fileref.setAttribute("type", "text/css");
  fileref.setAttribute("href", filename);
 }
 if (typeof fileref!="undefined")
  document.getElementsByTagName("head").item(0).appendChild(fileref);
}
 
presentation.client.getSize = function(){
	if( typeof( window.innerWidth ) == 'number' ) 
	{ 
	presentation.client.width = window.innerWidth; 
	presentation.client.height = window.innerHeight;
	}
	else if(document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight)) 
	{
	presentation.client.width = document.documentElement.clientWidth; 
	presentation.client.height = document.documentElement.clientHeight;
	} 
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
	{
	presentation.client.width = document.body.clientWidth; 
	presentation.client.height = document.body.clientHeight;
	}};
 
presentation.element.place = function(id,top,left){
	var el=document.getElementById(id);
	el.style.position = "absolute";
	el.style.top = parseInt((presentation.client.height/100)*top) + "px";
	el.style.left = parseInt((presentation.client.width/100)*left) + "px";
}
 
presentation.element.size = function(id,height,width){
	var el=document.getElementById(id);
	el.style.position = "absolute";
	el.style.width = parseInt((presentation.client.width/100)*width) + "px";
	el.style.height = parseInt((presentation.client.height/100)*height) + "px";
}
 
presentation.element.placeNsize = function(id,top,left,height,width){
	presentation.element.place(id,top,left);
	presentation.element.size(id,height,width);
}
 
presentation.element.aplace = function(id,top,left){
	var el=document.getElementById(id);
	el.style.position = "absolute";
	el.style.top = parseInt(top) + "px";
	el.style.left = parseInt(left) + "px";
}
 
presentation.element.asize = function(id,height,width){
	var el=document.getElementById(id);
	el.style.position = "absolute";
	el.style.width = parseInt(width) + "px";
	el.style.height = parseInt(height) + "px";
}
 
presentation.element.placeNsizeByClass = function(eclass,top,left,height,width){
 
	var allHTMLTags = new Array();
	var allHTMLTags=document.getElementsByTagName("*");
	for (i=0; i<allHTMLTags.length; i++) {
		if (allHTMLTags[i].className==eclass) {
 
			presentation.element.placeNsize(allHTMLTags.item(i).id,top,left,height,width);
		}
	}
}
 
presentation.element.aplaceNsize = function(id,top,left,height,width){
	presentation.element.place(id,top,left);
	presentation.element.size(id,height,width);
}
 
presentation.events.StartClick = function(){
 
	if(typeof(presentation.template.events.StartClick)!="undefined"){presentation.template.events.StartClick();}
	else
	{
		var o = "s"+presentation.info.currentSlide;
		presentation.info.currentSlide = 1;
		var n = "s"+presentation.info.currentSlide;
		var ozi = parseInt(document.getElementById(n).style.zIndex);
		document.getElementById(n).style.zIndex = presentation.settings.SlideOnDisplayLayer;
		document.getElementById(o).style.zIndex = ozi;
		if(typeof(presentation.template.events.InlineStartClick)!="undefined"){presentation.template.events.InlineStartClick();}
	}
	};
presentation.events.EndClick = function(){
 
	if(typeof(presentation.template.events.EndClick)!="undefined"){presentation.template.events.EndClick();}
	else
	{
		var o = "s"+presentation.info.currentSlide;
		presentation.info.currentSlide = presentation.info.slideCount;
		var n = "s"+presentation.info.currentSlide;
		var ozi = parseInt(document.getElementById(n).style.zIndex);
		document.getElementById(n).style.zIndex = presentation.settings.SlideOnDisplayLayer;
		document.getElementById(o).style.zIndex = ozi;
		if(typeof(presentation.template.events.InlineEndClick)!="undefined"){presentation.template.events.InlineEndClick();}
	}
 
	};
presentation.events.NextClick = function(){
 
	if(typeof(presentation.template.events.NextClick)!="undefined"){presentation.template.events.NextClick();}
	else
	{
		if(presentation.info.currentSlide==presentation.info.slideCount){
			if(presentation.settings.playMode){
				presentation.events.PlayClick();}
			return 0;}
		var o = "s"+presentation.info.currentSlide;
		presentation.info.currentSlide++;
		var n = "s"+presentation.info.currentSlide;
		var ozi = parseInt(document.getElementById(n).style.zIndex);
		document.getElementById(n).style.zIndex = presentation.settings.SlideOnDisplayLayer;
		document.getElementById(o).style.zIndex = ozi;
		if(typeof(presentation.template.events.InlineNextClick)!="undefined"){presentation.template.events.InlineNextClick();}
	}
 
	};
presentation.events.PrevClick = function(){
 
	if(typeof(presentation.template.events.PrevClick)!="undefined"){presentation.template.events.PrevClick();}
	else
	{
		if(presentation.info.currentSlide==1){return 0;}
		var o = "s"+presentation.info.currentSlide;
		presentation.info.currentSlide--;
		var n = "s"+presentation.info.currentSlide;
		var ozi = parseInt(document.getElementById(n).style.zIndex);
		document.getElementById(n).style.zIndex = presentation.settings.SlideOnDisplayLayer;
		document.getElementById(o).style.zIndex = ozi;
		if(typeof(presentation.template.events.InlinePrevClick)!="undefined"){presentation.template.events.InlinePrevClick();}
	}
	};
presentation.events.PlayClick = function(){
 
	if(typeof(presentation.template.events.PlayClick)!="undefined"){presentation.template.events.PlayClick();}
	else
	{
		if(!presentation.settings.playMode){
		presentation.settings.intervalID = setInterval("presentation.events.NextClick()",presentation.settings.autoTime);
		presentation.settings.playMode=true;
		}
		else{
		clearInterval(presentation.settings.intervalID);
		presentation.settings.playMode = false;
		}
	if(typeof(presentation.template.events.InlinePlayClick)!="undefined"){presentation.template.events.InlinePlayClick();}	
	}
	};
presentation.events.NotesClick = function(){
 
	if(typeof(presentation.template.events.NotesClick)!="undefined"){presentation.template.events.NotesClick();}
	else{
 
		if(!presentation.settings.notesMode){	
		var id;
		for(i=1;i<=presentation.info.slideCount;i++){
			id="n"+i;
			document.getElementById(id).style.display="none";
		}
		id = "n"+presentation.info.currentSlide;
		document.getElementById(id).style.display = "inline";
		document.getElementById("notesContainer").style.display = "inline";
		presentation.settings.notesMode = true;
		}
		else{
		document.getElementById("notesContainer").style.display = "none";
		presentation.settings.notesMode = false;
		}
		if(typeof(presentation.template.events.InlineNotesClick)!="undefined"){presentation.template.events.InlineNotesClick();}
	}
	};
presentation.events.NormalClick = function(){
 
	if(typeof(presentation.template.events.NormalClick)!="undefined"){presentation.template.events.NormalClick();}
	else {
	if(typeof(presentation.template.events.InlineNormalClick)!="undefined"){presentation.template.events.InlineNormalClick();}
	}
	};
presentation.events.IndexClick = function(){
 
	if(typeof(presentation.template.events.IndexClick)!="undefined"){presentation.template.events.IndexClick();}
	else {
	if(typeof(presentation.template.events.InlineIndexClick)!="undefined"){presentation.template.events.InlineIndexClick();}
	}
	};
presentation.events.TextClick = function(){
 
	if(typeof(presentation.template.events.TextClick)!="undefined"){presentation.template.events.TextClick();}
	else {
	if(typeof(presentation.template.events.InlineTextClick)!="undefined"){presentation.template.events.InlineTextClick();}
	}
	};
presentation.events.MuteClick = function(){
 
	if(typeof(presentation.template.events.MuteClick)!="undefined"){presentation.template.events.MuteClick();}
	else {
	if(typeof(presentation.template.events.InlineMuteClick)!="undefined"){presentation.template.events.InlineMuteClick();}
	}
	};
 
presentation.events.StartMouseOver = function(){
 
	if(typeof(presentation.template.events.StartMouseOver)!="undefined"){presentation.template.events.StartMouseOver();}
	else {
	if(typeof(presentation.template.events.InlineStartMouseOver)!="undefined"){presentation.template.events.InlineStartMouseOver();}
	}
	};
presentation.events.EndMouseOver = function(){
 
	if(typeof(presentation.template.events.EndMouseOver)!="undefined"){presentation.template.events.EndMouseOver();}
	else {
	if(typeof(presentation.template.events.InlineEndMouseOver)!="undefined"){presentation.template.events.InlineEndMouseOver();}
	}
	};
presentation.events.NextMouseOver = function(){
 
	if(typeof(presentation.template.events.NextMouseOver)!="undefined"){presentation.template.events.NextMouseOver();}
	else {
	if(typeof(presentation.template.events.InlineNextMouseOver)!="undefined"){presentation.template.events.InlineNextMouseOver();}
	}
	};
presentation.events.PrevMouseOver = function(){
 
	if(typeof(presentation.template.events.PrevMouseOver)!="undefined"){presentation.template.events.PrevMouseOver();}
	else {
	if(typeof(presentation.template.events.InlinePrevMouseOver)!="undefined"){presentation.template.events.InlinePrevMouseOver();}
	}
	};
presentation.events.PlayMouseOver = function(){
 
	if(typeof(presentation.template.events.PlayMouseOver)!="undefined"){presentation.template.events.PlayMouseOver();}
	else {
	if(typeof(presentation.template.events.InlinePlayMouseOver)!="undefined"){presentation.template.events.InlinePlayMouseOver();}
	}
	};
presentation.events.NotesMouseOver = function(){
 
	if(typeof(presentation.template.events.NotesMouseOver)!="undefined"){presentation.template.events.NotesMouseOver();}
	else {
	if(typeof(presentation.template.events.InlineNotesMouseOver)!="undefined"){presentation.template.events.InlineNotesMouseOver();}
	}
	};
presentation.events.NormalMouseOver = function(){
 
	if(typeof(presentation.template.events.NormalMouseOver)!="undefined"){presentation.template.events.NormalMouseOver();}
	else {
	if(typeof(presentation.template.events.InlineNormalMouseOver)!="undefined"){presentation.template.events.InlineNormalMouseOver();}
	}
	};
presentation.events.IndexMouseOver = function(){
 
	if(typeof(presentation.template.events.IndexMouseOver)!="undefined"){presentation.template.events.IndexMouseOver();}
	else {
	if(typeof(presentation.template.events.InlineIndexMouseOver)!="undefined"){presentation.template.events.InlineIndexMouseOver();}
	}
	};
presentation.events.TextMouseOver = function(){
 
	if(typeof(presentation.template.events.TextMouseOver)!="undefined"){presentation.template.events.TextMouseOver();}
	else {
	if(typeof(presentation.template.events.InlineTextMouseOver)!="undefined"){presentation.template.events.InlineTextMouseOver();}
	}
	};
presentation.events.MuteMouseOver = function(){
 
	if(typeof(presentation.template.events.MuteMouseOver)!="undefined"){presentation.template.events.MuteMouseOver();}
	else {
	if(typeof(presentation.template.events.InlineMuteMouseOver)!="undefined"){presentation.template.events.InlineMuteMouseOver();}
	}
	};
 
presentation.events.StartMouseOut = function(){
 
	if(typeof(presentation.template.events.StartMouseOut)!="undefined"){presentation.template.events.StartMouseOut();}
	else {
	if(typeof(presentation.template.events.InlineStartMouseOut)!="undefined"){presentation.template.events.InlineStartMouseOut();}
	}
	};
presentation.events.EndMouseOut = function(){
 
	if(typeof(presentation.template.events.EndMouseOut)!="undefined"){presentation.template.events.EndMouseOut();}
	else {
	if(typeof(presentation.template.events.InlineEndMouseOut)!="undefined"){presentation.template.events.InlineEndMouseOut();}
	}
	};
presentation.events.NextMouseOut = function(){
 
	if(typeof(presentation.template.events.NextMouseOut)!="undefined"){presentation.template.events.NextMouseOut();}
	else {
	if(typeof(presentation.template.events.InlineNextMouseOut)!="undefined"){presentation.template.events.InlineNextMouseOut();}
	}
	};
presentation.events.PrevMouseOut = function(){
 
	if(typeof(presentation.template.events.PrevMouseOut)!="undefined"){presentation.template.events.PrevMouseOut();}
	else {
	if(typeof(presentation.template.events.InlinePrevMouseOut)!="undefined"){presentation.template.events.InlinePrevMouseOut();}
	}
	};
presentation.events.PlayMouseOut = function(){
 
	if(typeof(presentation.template.events.PlayMouseOut)!="undefined"){presentation.template.events.PlayMouseOut();}
	else {
	if(typeof(presentation.template.events.InlinePlayMouseOut)!="undefined"){presentation.template.events.InlinePlayMouseOut();}
	}
	};
presentation.events.NotesMouseOut = function(){
 
	if(typeof(presentation.template.events.NotesMouseOut)!="undefined"){presentation.template.events.NotesMouseOut();}
	else {
	if(typeof(presentation.template.events.InlineNotesMouseOut)!="undefined"){presentation.template.events.InlineNotesMouseOut();}
	}
	};
presentation.events.NormalMouseOut = function(){
 
	if(typeof(presentation.template.events.NormalMouseOut)!="undefined"){presentation.template.events.NormalMouseOut();}
	else {
	if(typeof(presentation.template.events.InlineNormalMouseOut)!="undefined"){presentation.template.events.InlineNormalMouseOut();}
	}
	};
presentation.events.IndexMouseOut = function(){
 
	if(typeof(presentation.template.events.IndexMouseOut)!="undefined"){presentation.template.events.IndexMouseOut();}
	else {
	if(typeof(presentation.template.events.InlineIndexMouseOut)!="undefined"){presentation.template.events.InlineIndexMouseOut();}
	}
	};
presentation.events.TextMouseOut = function(){
 
	if(typeof(presentation.template.events.TextMouseOut)!="undefined"){presentation.template.events.TextMouseOut();}
	else {
	if(typeof(presentation.template.events.InlineTextMouseOut)!="undefined"){presentation.template.events.InlineTextMouseOut();}
	}
	};
presentation.events.MuteMouseOut = function(){
 
	if(typeof(presentation.template.events.MuteMouseOut)!="undefined"){presentation.template.events.MuteMouseOut();}
	else {
	if(typeof(presentation.template.events.InlineMuteMouseOut)!="undefined"){presentation.template.events.InlineMuteMouseOut();}
	}
	};
 
presentation.loadSlide = function(num){
	var id = "s"+num;
	presentation.element.addElement("img",id,"slide");
	var el = document.getElementById(id);
	el.style.position = "absolute";
	el.style.zIndex = 1;
	el.src = "slides/img"+num+".png";
}
 
function BI()
 
{
  this.name = navigator.appName;
  this.codename = navigator.appCodeName;
  this.version = navigator.appVersion.substring(0,4);
  this.platform = navigator.platform;
  this.javaEnabled = navigator.javaEnabled();
}
 
function PD()
{
  if(navigator.appVersion.indexOf("Win") != -1)
  {
    this.platform = "Windows";
  }
  else if(navigator.appVersion.indexOf("Mac") != -1)
  {
    this.platform = "Macintosh";
  }
  else this.platform = "Other";
}
 
presentation.printPage = function() { print(document); }
 
presentation.readCookie = function(name)
{
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}
 
presentation.writeCookie = function(name, value, hours)
{
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire;
}
 
presentation.preloadImage = function()
{ 
  var args = simplePreload.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++)
  {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}
 
presentation.client.statusMsg = function(msgStr) { self.status = msgStr; }
/*
presentation.addSound = function(){
	var sid = Math.ceil(Math.random()*100000);
	var iframe = document.createElement("iframe");
	iframe.style.zIndex = layer.cache;
	iframe.id = sid;
	document.getElementsByTagName("body").item(0).appendChild(iframe);	
	iframe.doc = null;
	   if(iframe.contentDocument)
	      iframe.doc = iframe.contentDocument;
	   else if(iframe.contentWindow)
	      iframe.doc = iframe.contentWindow.document;
	   else if(iframe.document)
	      iframe.doc = iframe.document;
 
		iframe.doc.createElement("html");
		iframe.doc.createElement("bgsound");
 
	   iframe.doc.open();
	   iframe.doc.close();
	return sid;
}
 
presentation.effects.slideIn = function(id,dir,time){
	var el = document.getElementById(id);
	var otop = el.style.top;
	otop = otop.replace("px","");
	var oleft = el.style.left;
	oleft = oleft.replace("px","");
	var oheight = el.style.height;
	oheight = oheight.replace("px","");
	var owidth = el.style.width;
	owidth = owidth.replace("px","");
	el.setAttribute("oootop",otop);
	el.setAttribute("oooleft",oleft);
	el.setAttribute("oooheight",oheight);
	el.setAttribute("ooowidth",owidth);
	el.setAttribute("ooodisp",el.style.display);
	el.setAttribute("ooooverflow",el.style.overflow);
	el.setAttribute("ss","true");
	switch(dir){
		case "l":
		sil(el,t);
		break;
		case "r":
		sir(el,t);
		break;
		case "u":
		siu(el,t);
		break;
		case "d":
		sid(el,t);
		break;
	}
}
*/
presentation.element.sendToLayer = function(eid,lid){
	var el = document.getElementById(eid);
	el.style.position = "absolute";
	el.style.zIndex = lid;
 
}


presentation.css

A common css file for the exported HTML. It is common for all exports and templates.

@charset "utf-8";
/* CSS Document , for detailed customizations of elements check the default.css file in the Template folder*/
 
/* following tag defines that the body of the HTML Document will not have any margin/border it will display contents from 
edge to edge of the browser window */
body{
	margin:0px;
	border:none;
	padding:0px;
	height:100%;
}
 
/* properties for NoJs Containers, it contains the message displayed if JavaScript is disabled in the client machine*/
#NoJs{
	background-color:#FFC;
	position:absolute;
	top:0px;
	left:0px;
	height:100%;
	width:100%;
	z-index:10;
}
 
.notesContainer{
	position:absolute;
	display:none;
	z-index:1;
}
 
#index,#textOnly{
	position:absolute;
	z-index:1;
	display:none;
	overflow:auto;
	height:100%;
	width:100%;
}
 
.notes{
	position:relative;
	display:none;
}
 
#background{
	background-color:#FFC;
	position:absolute;
	z-index:2;
	width:100%;
	height:100%;
}
 
.slide{
	position:absolute;
	z-index:1;
}
 
.DisplayedSlide{
	position:absolute;
	z-index:6;
}


default.html

This is the default format of the exported HTML file

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- *************** META INFORMATION ******************************* -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="oooAuthor" content="kushal" />
<meta name="oooSlideCount" content="7" />
<meta name="oooTitle" content="test" />
<meta name="oooVersion" content="3.0" />
<meta name="oooExtensionVersion" content="1.0" />
<meta name="oooTimeStamp" content="its value" />
<meta name="oooOutline" content="yes" />
<meta name="oooNotes" content="yes"/>
<meta name="oooIndex" content="yes"/>
<meta name="oooSound" content="yes"/>
<meta name="oooAutoTime" content="5.00" />
<meta name="oooWebcastStatus" content="0" />
<meta name="oooShowIndexOnStart" content="yes" />
<!-- *************** META INFORMATION ENDS *************************** -->
 
 
<script type="text/javascript" src="resource/presentation.js"></script>
<link type="text/css" rel="stylesheet" href="resource/presentation.css" />
<link type="text/css" rel="stylesheet" href="template/default.css" />
<script type="text/javascript" src="template/default.js"></script>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
<title>openOffice Exported | Presentation Title</title>
</head>
 
<body>
<!-- Nothing unwanted in the body,, everything will be added by template realtime on demand. No Code Redundancy.. Hurray!! -->
<!-- there could be special template elements added during export process to add flexibility.. that completely depends on template designer and his/her creativity-->
<!-- ******************************************************************************************************************
Followind section is for Javascript RollBack.. this will only be displayed if javascript is disabled.. -->
<div id="NoJs">
<h1 align="center">Welcome!</h1>
<h2 align="center">JavaScript Seems To Be Disabled!</h2>
<h4 align="center"><a href="noJS/index.html">Click Here To Launch Standard Non Javascript Version</a></h4>
<h4 align="center">Or</h4>
<h4 align="center">Enable JavaScript In Your Browser</h4>
</div>
 
<!-- Index -->
<div id="index"></div>
 
<!-- Background -->
<div id="background"></div>
 
<!-- text only view -->
<div id="textOnly"></div>
 
<!-- notes (content depends on the presentation, here there are 7 slides hence we have notes from n1-n7 (EXAMPLE))-->
<div id="notesContainer">
<div id="n1" class="notes">vnsdvjds;</div>
<div id="n2" class="notes">nsdknsd</div>
<div id="n3" class="notes">kdvsdk;</div>
<div id="n4" class="notes">dsdsods</div>
<div id="n5" class="notes">dvndskndsn</div>
<div id="n6" class="notes">dvxcm;zxczx;</div>
<div id="n7" class="notes">dvndsxmc .zxzxn</div>
</div>
 
<!-- TEMPLATE SPECIFIC ELEMENTS HERE (if any)-->
 
 
</body>
</html>

Project status

  • The project is accepted for the OpenOffice summer internship program 2010

Update History

Contains Log for the updates made to this wiki page

On 21/9/10

  • Under source code section updated presentation.js
  • Under source code section updated makefile.mk
  • Under source code section updated manifest.xml
  • Under source code section added file template.xcs
  • Under source code section added file template.xcu
  • Under source code section added file Template.hxx
  • Under source code section added file Template.cxx
  • Added downloads section
  • Updated .pdf Document

On 24/9/10

  • Under source code section updated Template.hxx
  • Under source code section updated Template.cxx
  • Under source code section updated htmlex.hxx

On 29/9/10

  • Under source code section updated Template.hxx
  • Under source code section updated Template.cxx
  • Under source code section updated htmlex.hxx
  • Under source code section updated makefile.mk
  • Under source code section updated templates.xcs
  • Under source code section updated templates.xcu
  • Updated project plan.
  • Under downloads added sample template extension
  • Under documentation added a new section "Template Extension Format"

Developers

this extension is developed by Kushal Likhi under a very good guidance and mentoring by Christan Lippka

Personal tools