LCOV - code coverage report
Current view: top level - libreoffice/sd/source/filter/html - htmlex.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1645 0.0 %
Date: 2012-12-27 Functions: 0 70 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include "htmlex.hxx"
      22             : #include <com/sun/star/document/XExporter.hpp>
      23             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      24             : #include <com/sun/star/document/XFilter.hpp>
      25             : #include <com/sun/star/ucb/SimpleFileAccess.hpp>
      26             : 
      27             : #include <rtl/uri.hxx>
      28             : #include <comphelper/processfactory.hxx>
      29             : #include <osl/file.hxx>
      30             : #include <tools/fsys.hxx>
      31             : #include <unotools/pathoptions.hxx>
      32             : #include <svtools/FilterConfigItem.hxx>
      33             : #include <unotools/ucbstreamhelper.hxx>
      34             : #include <unotools/localfilehelper.hxx>
      35             : #include <com/sun/star/frame/XStorable.hpp>
      36             : #include <sfx2/progress.hxx>
      37             : #include <vcl/wrkwin.hxx>
      38             : #include <svl/aeitem.hxx>
      39             : #include <svx/svditer.hxx>
      40             : #include <svtools/imaprect.hxx>
      41             : #include <svtools/imapcirc.hxx>
      42             : #include <svtools/imappoly.hxx>
      43             : #include <vcl/msgbox.hxx>
      44             : #include <sfx2/app.hxx>
      45             : #include <editeng/outlobj.hxx>
      46             : #include <editeng/editobj.hxx>
      47             : #include <svx/svdopath.hxx>
      48             : #include <svx/xoutbmp.hxx>
      49             : #include <svtools/htmlout.hxx>
      50             : #include <sfx2/docfile.hxx>
      51             : #include <vcl/cvtgrf.hxx>
      52             : #include <svtools/colorcfg.hxx>
      53             : #include <svtools/filter.hxx>
      54             : #include <editeng/colritem.hxx>
      55             : #include <editeng/editeng.hxx>
      56             : #include <editeng/wghtitem.hxx>
      57             : #include <editeng/udlnitem.hxx>
      58             : #include <editeng/postitem.hxx>
      59             : #include <editeng/crsditem.hxx>
      60             : #include <editeng/flditem.hxx>
      61             : #include <sfx2/dispatch.hxx>
      62             : #include <sfx2/fcontnr.hxx>
      63             : #include <svl/style.hxx>
      64             : #include <editeng/frmdiritem.hxx>
      65             : #include <svx/svdoutl.hxx>
      66             : #include <tools/urlobj.hxx>               // INetURLObject
      67             : #include <vcl/bmpacc.hxx>
      68             : #include <svtools/sfxecode.hxx>
      69             : #include <com/sun/star/beans/PropertyState.hpp>
      70             : #include <tools/resmgr.hxx>
      71             : #include "comphelper/anytostring.hxx"
      72             : #include "cppuhelper/exc_hlp.hxx"
      73             : 
      74             : #include "drawdoc.hxx"
      75             : #include "Outliner.hxx"
      76             : #include "sdpage.hxx"
      77             : #include "sdattr.hxx"
      78             : #include "glob.hrc"
      79             : #include "anminfo.hxx"
      80             : #include "imapinfo.hxx"
      81             : #include "sdresid.hxx"
      82             : #include "buttonset.hxx"
      83             : #include <basegfx/polygon/b2dpolygon.hxx>
      84             : 
      85             : using ::rtl::OUString;
      86             : using ::rtl::OString;
      87             : using namespace ::com::sun::star;
      88             : using namespace ::com::sun::star::uno;
      89             : using namespace ::com::sun::star::beans;
      90             : using namespace ::com::sun::star::frame;
      91             : using namespace ::com::sun::star::lang;
      92             : using namespace ::com::sun::star::document;
      93             : 
      94             : #define KEY_QUALITY     "JPG-EXPORT-QUALITY"
      95             : 
      96             : // Parameter aus Itemset abfragen
      97             : 
      98             : #define RESTOHTML( res ) StringToHTMLString(String(SdResId(res)))
      99             : #define S2H( str ) StringToHTMLString( str )
     100             : 
     101             : // bei Aenderungen auch NUM_BUTTONS in pubdlg.hxx aendern!!
     102             : const char *pButtonNames[NUM_BUTTONS] =
     103             : {
     104             :     "first-inactive.png",
     105             :     "first.png",
     106             :     "left-inactive.png",
     107             :     "left.png",
     108             :     "right-inactive.png",
     109             :     "right.png",
     110             :     "last-inactive.png",
     111             :     "last.png",
     112             :     "home.png",
     113             :     "text.png",
     114             :     "expand.png",
     115             :     "collapse.png",
     116             : };
     117             : 
     118             : #define BTN_FIRST_0 0
     119             : #define BTN_FIRST_1 1
     120             : #define BTN_PREV_0  2
     121             : #define BTN_PREV_1  3
     122             : #define BTN_NEXT_0  4
     123             : #define BTN_NEXT_1  5
     124             : #define BTN_LAST_0  6
     125             : #define BTN_LAST_1  7
     126             : #define BTN_INDEX   8
     127             : #define BTN_TEXT    9
     128             : #define BTN_MORE    10
     129             : #define BTN_LESS    11
     130             : 
     131             : // *********************************************************************
     132             : // Hilfsklasse fuer das simple erzeugen von Dateien lokal/remote
     133             : // *********************************************************************
     134             : class EasyFile
     135             : {
     136             : private:
     137             :     SvStream*   pOStm;
     138             :     SfxMedium*  pMedium;
     139             :     bool        bOpen;
     140             : 
     141             : public:
     142             : 
     143             :     EasyFile();
     144             :     ~EasyFile();
     145             : 
     146             :     sal_uLong createStream( const String& rUrl, SvStream*& rpStr );
     147             :     sal_uLong createFileName(  const String& rUrl, String& rFileName );
     148             :     sal_uLong close();
     149             : };
     150             : 
     151             : // *********************************************************************
     152             : // Hilfsklasse fuer das einbinden von Textattributen in die Html-Ausgabe
     153             : // *********************************************************************
     154           0 : class HtmlState
     155             : {
     156             : private:
     157             :     bool mbColor;
     158             :     bool mbWeight;
     159             :     bool mbItalic;
     160             :     bool mbUnderline;
     161             :     bool mbStrike;
     162             :     bool mbLink;
     163             :     Color maColor;
     164             :     Color maDefColor;
     165             :     String maLink;
     166             :     String maTarget;
     167             : 
     168             : public:
     169             :     HtmlState( Color aDefColor );
     170             : 
     171             :     String SetWeight( bool bWeight );
     172             :     String SetItalic( bool bItalic );
     173             :     String SetUnderline( bool bUnderline );
     174             :     String SetColor( Color aColor );
     175             :     String SetStrikeout( bool bStrike );
     176             :     String SetLink( const String& aLink, const String& aTarget );
     177             :     String Flush();
     178             : };
     179             : 
     180             : // =====================================================================
     181             : // alle noch offennen Tags schliessen
     182             : // =====================================================================
     183           0 : String HtmlState::Flush()
     184             : {
     185           0 :     String aStr, aEmpty;
     186             : 
     187           0 :     aStr += SetWeight(false);
     188           0 :     aStr += SetItalic(false);
     189           0 :     aStr += SetUnderline(false);
     190           0 :     aStr += SetStrikeout(false);
     191           0 :     aStr += SetColor(maDefColor);
     192           0 :     aStr += SetLink(aEmpty,aEmpty);
     193             : 
     194           0 :     return aStr;
     195             : }
     196             : 
     197             : // =====================================================================
     198             : // c'tor mit Defaultfarbe fuer die Seite
     199             : // =====================================================================
     200           0 : HtmlState::HtmlState( Color aDefColor )
     201             : {
     202           0 :     mbColor = false;
     203           0 :     mbWeight = false;
     204           0 :     mbItalic = false;
     205           0 :     mbUnderline = false;
     206           0 :     mbLink = false;
     207           0 :     mbStrike = false;
     208           0 :     maDefColor = aDefColor;
     209           0 : }
     210             : 
     211             : // =====================================================================
     212             : // aktiviert/deaktiviert Fettdruck
     213             : // =====================================================================
     214           0 : String HtmlState::SetWeight( bool bWeight )
     215             : {
     216           0 :     String aStr;
     217             : 
     218           0 :     if(bWeight && !mbWeight)
     219           0 :         aStr.AppendAscii( "<b>" );
     220           0 :     else if(!bWeight && mbWeight)
     221           0 :         aStr.AppendAscii( "</b>" );
     222             : 
     223           0 :     mbWeight = bWeight;
     224           0 :     return aStr;
     225             : }
     226             : 
     227             : // =====================================================================
     228             : // aktiviert/deaktiviert Italic
     229             : // =====================================================================
     230           0 : String HtmlState::SetItalic( bool bItalic )
     231             : {
     232           0 :     String aStr;
     233             : 
     234           0 :     if(bItalic && !mbItalic)
     235           0 :         aStr.AppendAscii( "<i>" );
     236           0 :     else if(!bItalic && mbItalic)
     237           0 :         aStr.AppendAscii( "</i>" );
     238             : 
     239           0 :     mbItalic = bItalic;
     240           0 :     return aStr;
     241             : }
     242             : 
     243             : // =====================================================================
     244             : // aktiviert/deaktiviert Unterstrichen
     245             : // =====================================================================
     246           0 : String HtmlState::SetUnderline( bool bUnderline )
     247             : {
     248           0 :     String aStr;
     249             : 
     250           0 :     if(bUnderline && !mbUnderline)
     251           0 :         aStr.AppendAscii( "<u>" );
     252           0 :     else if(!bUnderline && mbUnderline)
     253           0 :         aStr.AppendAscii( "</u>" );
     254             : 
     255           0 :     mbUnderline = bUnderline;
     256           0 :     return aStr;
     257             : }
     258             : 
     259             : // =====================================================================
     260             : // aktiviert/deaktiviert Durchstreichen
     261             : // =====================================================================
     262           0 : String HtmlState::SetStrikeout( bool bStrike )
     263             : {
     264           0 :     String aStr;
     265             : 
     266           0 :     if(bStrike && !mbStrike)
     267           0 :         aStr.AppendAscii( "<strike>" );
     268           0 :     else if(!bStrike && mbStrike)
     269           0 :         aStr.AppendAscii( "</strike>" );
     270             : 
     271           0 :     mbStrike = bStrike;
     272           0 :     return aStr;
     273             : }
     274             : 
     275             : // =====================================================================
     276             : // Setzt die angegebenne Textfarbe
     277             : // =====================================================================
     278           0 : String HtmlState::SetColor( Color aColor )
     279             : {
     280           0 :     String aStr;
     281             : 
     282           0 :     if(mbColor && aColor == maColor)
     283           0 :         return aStr;
     284             : 
     285           0 :     if(mbColor)
     286             :     {
     287           0 :         aStr.AppendAscii( "</font>" );
     288           0 :         mbColor = false;
     289             :     }
     290             : 
     291           0 :     if(aColor != maDefColor)
     292             :     {
     293           0 :         maColor = aColor;
     294             : 
     295           0 :         aStr.AppendAscii( "<font color=\"" );
     296           0 :         aStr += HtmlExport::ColorToHTMLString(aColor);
     297           0 :         aStr.AppendAscii( "\">" );
     298             : 
     299           0 :         mbColor = true;
     300             :     }
     301             : 
     302           0 :     return aStr;
     303             : }
     304             : 
     305             : // =====================================================================
     306             : // aktiviert/deaktiviert einen Hyperlink
     307             : // =====================================================================
     308           0 : String HtmlState::SetLink( const String& aLink, const String& aTarget )
     309             : {
     310           0 :     String aStr;
     311             : 
     312           0 :     if(mbLink&&maLink == aLink&&maTarget==aTarget)
     313           0 :         return aStr;
     314             : 
     315           0 :     if(mbLink)
     316             :     {
     317           0 :         aStr.AppendAscii( "</a>" );
     318           0 :         mbLink = false;
     319             :     }
     320             : 
     321           0 :     if(aLink.Len())
     322             :     {
     323           0 :         aStr.AppendAscii( "<a href=\"" );
     324           0 :         aStr += HtmlExport::StringToURL(aLink);
     325           0 :         if(aTarget.Len())
     326             :         {
     327           0 :             aStr.AppendAscii( "\" target=\"" );
     328           0 :             aStr += aTarget;
     329             :         }
     330           0 :         aStr.AppendAscii( "\">" );
     331           0 :         mbLink = true;
     332           0 :         maLink = aLink;
     333           0 :         maTarget = aTarget;
     334             :     }
     335             : 
     336           0 :     return aStr;
     337             : }
     338             : 
     339             : // *********************************************************************
     340             : // class HtmlExport Methoden
     341             : // *********************************************************************
     342             : 
     343           0 : static String getParagraphStyle( SdrOutliner* pOutliner, sal_uInt16 nPara )
     344             : {
     345           0 :     SfxItemSet aParaSet( pOutliner->GetParaAttribs( nPara ) );
     346             : 
     347           0 :     String sStyle( RTL_CONSTASCII_USTRINGPARAM("direction:") );
     348           0 :     if( static_cast<const SvxFrameDirectionItem*>(aParaSet.GetItem( EE_PARA_WRITINGDIR ))->GetValue() == FRMDIR_HORI_RIGHT_TOP )
     349             :     {
     350           0 :         sStyle += String( RTL_CONSTASCII_USTRINGPARAM("rtl;") );
     351             :     }
     352             :     else
     353             :     {
     354           0 :          sStyle += String( RTL_CONSTASCII_USTRINGPARAM("ltr;") );
     355             :     }
     356           0 :     return sStyle;
     357             : }
     358             : 
     359             : // =====================================================================
     360             : // Konstruktor fuer die Html Export Hilfsklasse
     361             : // =====================================================================
     362           0 : HtmlExport::HtmlExport(
     363             :     OUString aPath,
     364             :     const Sequence< PropertyValue >& rParams,
     365             :     SdDrawDocument* pExpDoc,
     366             :     ::sd::DrawDocShell* pDocShell )
     367             :     :   maPath( aPath ),
     368             :         mpDoc(pExpDoc),
     369             :         mpDocSh( pDocShell ),
     370             :         meEC(NULL),
     371             :         meMode( PUBLISH_HTML ),
     372             :         mbContentsPage(false),
     373             :         mnButtonThema(-1),
     374             :         mnWidthPixel( PUB_MEDRES_WIDTH ),
     375             :         meFormat( FORMAT_JPG ),
     376             :         mbNotes(false),
     377             :         mnCompression( -1 ),
     378             :         mbDownload( false ),
     379             :         mbSlideSound(true),
     380             :         mbHiddenSlides(true),
     381             :         mbUserAttr(false),
     382             :         mbDocColors(false),
     383             :         maHTMLExtension(SdResId(STR_HTMLEXP_DEFAULT_EXTENSION)),
     384             :         mpHTMLFiles(NULL),
     385             :         mpImageFiles(NULL),
     386             :         mpThumbnailFiles(NULL),
     387             :         mpPageNames(NULL),
     388             :         mpTextFiles(NULL),
     389             :         maIndexUrl("index"),
     390             :         meScript( SCRIPT_ASP ),
     391             :         maHTMLHeader(
     392             :             "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\r\n"
     393             :             "     \"http://www.w3.org/TR/html4/transitional.dtd\">\r\n"
     394             :             "<html>\r\n<head>\r\n" ),
     395           0 :         mpButtonSet( new ButtonSet() )
     396             : {
     397           0 :     bool bChange = mpDoc->IsChanged();
     398             : 
     399           0 :     maIndexUrl += maHTMLExtension;
     400             : 
     401           0 :     InitExportParameters( rParams );
     402             : 
     403           0 :     switch( meMode )
     404             :     {
     405             :     case PUBLISH_HTML:
     406             :     case PUBLISH_FRAMES:
     407           0 :         ExportHtml();
     408           0 :         break;
     409             :     case PUBLISH_WEBCAST:
     410           0 :         ExportWebCast();
     411           0 :         break;
     412             :     case PUBLISH_KIOSK:
     413           0 :         ExportKiosk();
     414           0 :         break;
     415             :     }
     416             : 
     417           0 :     mpDoc->SetChanged(bChange);
     418           0 : }
     419             : 
     420           0 : HtmlExport::~HtmlExport()
     421             : {
     422             :     // ------------------------------------------------------------------
     423             :     // Listen loeschen
     424             :     // ------------------------------------------------------------------
     425           0 :     if(mpImageFiles && mpHTMLFiles && mpThumbnailFiles && mpPageNames && mpTextFiles )
     426             :     {
     427           0 :         for ( sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
     428             :         {
     429           0 :             delete mpImageFiles[nSdPage];
     430           0 :             delete mpHTMLFiles[nSdPage];
     431           0 :             delete mpThumbnailFiles[nSdPage];
     432           0 :             delete mpPageNames[nSdPage];
     433           0 :             delete mpTextFiles[nSdPage];
     434             :         }
     435             :     }
     436             : 
     437           0 :     delete[] mpImageFiles;
     438           0 :     delete[] mpHTMLFiles;
     439           0 :     delete[] mpThumbnailFiles;
     440           0 :     delete[] mpPageNames;
     441           0 :     delete[] mpTextFiles;
     442           0 : }
     443             : 
     444             : /** get common export parameters from item set */
     445           0 : void HtmlExport::InitExportParameters( const Sequence< PropertyValue >& rParams )
     446             : {
     447           0 :     mbImpress = mpDoc && mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS;
     448             : 
     449           0 :     sal_Int32 nArgs = rParams.getLength();
     450           0 :     const PropertyValue* pParams = rParams.getConstArray();
     451           0 :     OUString aStr;
     452           0 :     while( nArgs-- )
     453             :     {
     454           0 :         if ( pParams->Name == "PublishMode" )
     455             :         {
     456           0 :             sal_Int32 temp = 0;
     457           0 :             pParams->Value >>= temp;
     458           0 :             meMode = (HtmlPublishMode)temp;
     459             :         }
     460           0 :         else if ( pParams->Name == "IndexURL" )
     461             :         {
     462           0 :             pParams->Value >>= aStr;
     463           0 :             maIndexUrl = aStr;
     464             :         }
     465           0 :         else if ( pParams->Name == "Format" )
     466             :         {
     467           0 :             sal_Int32 temp = 0;
     468           0 :             pParams->Value >>= temp;
     469           0 :             meFormat = (PublishingFormat)temp;
     470             :         }
     471           0 :         else if ( pParams->Name == "Compression" )
     472             :         {
     473           0 :             pParams->Value >>= aStr;
     474           0 :             String aTmp( aStr );
     475           0 :             if(aTmp.Len())
     476             :             {
     477           0 :                 xub_StrLen nPos = aTmp.Search( '%' );
     478           0 :                 if(nPos != STRING_NOTFOUND)
     479           0 :                     aTmp.Erase(nPos,1);
     480           0 :                 mnCompression = (sal_Int16)aTmp.ToInt32();
     481           0 :             }
     482             :         }
     483           0 :         else if ( pParams->Name == "Width" )
     484             :         {
     485           0 :             sal_Int32 temp = 0;
     486           0 :             pParams->Value >>= temp;
     487           0 :             mnWidthPixel = (sal_uInt16)temp;
     488             :         }
     489           0 :         else if ( pParams->Name == "UseButtonSet" )
     490             :         {
     491           0 :             sal_Int32 temp = 0;
     492           0 :             pParams->Value >>= temp;
     493           0 :             mnButtonThema = (sal_Int16)temp;
     494             :         }
     495           0 :         else if ( pParams->Name == "IsExportNotes" )
     496             :         {
     497           0 :             if( mbImpress )
     498             :             {
     499           0 :                 sal_Bool temp = sal_False;
     500           0 :                 pParams->Value >>= temp;
     501           0 :                 mbNotes = temp;
     502             :             }
     503             :         }
     504           0 :         else if ( pParams->Name == "IsExportContentsPage" )
     505             :         {
     506           0 :             sal_Bool temp = sal_False;
     507           0 :             pParams->Value >>= temp;
     508           0 :             mbContentsPage = temp;
     509             :         }
     510           0 :         else if ( pParams->Name == "Author" )
     511             :         {
     512           0 :             pParams->Value >>= aStr;
     513           0 :             maAuthor = aStr;
     514             :         }
     515           0 :         else if ( pParams->Name == "EMail" )
     516             :         {
     517           0 :             pParams->Value >>= aStr;
     518           0 :             maEMail = aStr;
     519             :         }
     520           0 :         else if ( pParams->Name == "HomepageURL" )
     521             :         {
     522           0 :             pParams->Value >>= aStr;
     523           0 :             maHomePage = aStr;
     524             :         }
     525           0 :         else if ( pParams->Name == "UserText" )
     526             :         {
     527           0 :             pParams->Value >>= aStr;
     528           0 :             maInfo = aStr;
     529             :         }
     530           0 :         else if ( pParams->Name == "EnableDownload" )
     531             :         {
     532           0 :             sal_Bool temp = sal_False;
     533           0 :             pParams->Value >>= temp;
     534           0 :             mbDownload = temp;
     535             :         }
     536           0 :         else if ( pParams->Name == "SlideSound" )
     537             :         {
     538           0 :             sal_Bool temp = sal_True;
     539           0 :             pParams->Value >>= temp;
     540           0 :             mbSlideSound = temp;
     541             :         }
     542           0 :         else if ( pParams->Name == "HiddenSlides" )
     543             :         {
     544           0 :             sal_Bool temp = sal_True;
     545           0 :             pParams->Value >>= temp;
     546           0 :             mbHiddenSlides = temp;
     547             :         }
     548           0 :         else if ( pParams->Name == "BackColor" )
     549             :         {
     550           0 :             sal_Int32 temp = 0;
     551           0 :             pParams->Value >>= temp;
     552           0 :             maBackColor = temp;
     553           0 :             mbUserAttr = true;
     554             :         }
     555           0 :         else if ( pParams->Name == "TextColor" )
     556             :         {
     557           0 :             sal_Int32 temp = 0;
     558           0 :             pParams->Value >>= temp;
     559           0 :             maTextColor = temp;
     560           0 :             mbUserAttr = true;
     561             :         }
     562           0 :         else if ( pParams->Name == "LinkColor" )
     563             :         {
     564           0 :             sal_Int32 temp = 0;
     565           0 :             pParams->Value >>= temp;
     566           0 :             maLinkColor = temp;
     567           0 :             mbUserAttr = true;
     568             :         }
     569           0 :         else if ( pParams->Name == "VLinkColor" )
     570             :         {
     571           0 :             sal_Int32 temp = 0;
     572           0 :             pParams->Value >>= temp;
     573           0 :             maVLinkColor = temp;
     574           0 :             mbUserAttr = true;
     575             :         }
     576           0 :         else if ( pParams->Name == "ALinkColor" )
     577             :         {
     578           0 :             sal_Int32 temp = 0;
     579           0 :             pParams->Value >>= temp;
     580           0 :             maALinkColor = temp;
     581           0 :             mbUserAttr = true;
     582             :         }
     583           0 :         else if ( pParams->Name == "IsUseDocumentColors" )
     584             :         {
     585           0 :             sal_Bool temp = sal_False;
     586           0 :             pParams->Value >>= temp;
     587           0 :             mbDocColors = temp;
     588             :         }
     589           0 :         else if ( pParams->Name == "KioskSlideDuration" )
     590             :         {
     591           0 :             sal_Int32 temp = sal_False;
     592           0 :             pParams->Value >>= temp;
     593           0 :             mnSlideDuration = temp;
     594           0 :             mbAutoSlide = true;
     595             :         }
     596           0 :         else if ( pParams->Name == "KioskEndless" )
     597             :         {
     598           0 :             sal_Bool temp = sal_False;
     599           0 :             pParams->Value >>= temp;
     600           0 :             mbEndless = temp;
     601             :         }
     602           0 :         else if ( pParams->Name == "WebCastCGIURL" )
     603             :         {
     604           0 :             pParams->Value >>= aStr;
     605           0 :             maCGIPath = aStr;
     606             :         }
     607           0 :         else if ( pParams->Name == "WebCastTargetURL" )
     608             :         {
     609           0 :             pParams->Value >>= aStr;
     610           0 :             maURLPath = aStr;
     611             :         }
     612           0 :         else if ( pParams->Name == "WebCastScriptLanguage" )
     613             :         {
     614           0 :             pParams->Value >>= aStr;
     615           0 :             if ( aStr == "asp" )
     616             :             {
     617           0 :                 meScript = SCRIPT_ASP;
     618             :             }
     619             :             else
     620             :             {
     621           0 :                 meScript = SCRIPT_PERL;
     622             :             }
     623             :         }
     624             :         else
     625             :         {
     626             :             OSL_FAIL("Unknown property for html export detected!");
     627             :         }
     628             : 
     629           0 :         pParams++;
     630             :     }
     631             : 
     632           0 :     if( meMode == PUBLISH_KIOSK )
     633             :     {
     634           0 :         mbContentsPage = false;
     635           0 :         mbNotes = false;
     636             : 
     637             :     }
     638             : 
     639             :     // calculate image sizes
     640           0 :     SdPage* pPage = mpDoc->GetSdPage(0, PK_STANDARD);
     641           0 :     Size aTmpSize( pPage->GetSize() );
     642           0 :     double dRatio=((double)aTmpSize.Width())/aTmpSize.Height();
     643             : 
     644           0 :     mnHeightPixel = (sal_uInt16)(mnWidthPixel/dRatio);
     645             : 
     646             :     //------------------------------------------------------------------
     647             :     // Ziel ausklamuestern...
     648             : 
     649           0 :     INetURLObject aINetURLObj( maPath );
     650             :     DBG_ASSERT( aINetURLObj.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
     651             : 
     652           0 :     maExportPath = aINetURLObj.GetPartBeforeLastName(); // with trailing '/'
     653           0 :     maIndex = aINetURLObj.GetLastName();
     654             : 
     655           0 :     mnSdPageCount = mpDoc->GetSdPageCount( PK_STANDARD );
     656           0 :     for( sal_uInt16 nPage = 0; nPage < mnSdPageCount; nPage++ )
     657             :     {
     658           0 :         pPage = mpDoc->GetSdPage( nPage, PK_STANDARD );
     659             : 
     660           0 :         if( mbHiddenSlides || !pPage->IsExcluded() )
     661             :         {
     662           0 :             maPages.push_back( pPage );
     663           0 :             maNotesPages.push_back( mpDoc->GetSdPage( nPage, PK_NOTES ) );
     664             :         }
     665             :     }
     666           0 :     mnSdPageCount = maPages.size();
     667             : 
     668           0 :     mbFrames = meMode == PUBLISH_FRAMES;
     669             : 
     670           0 :     maDocFileName = maIndex;
     671           0 : }
     672             : 
     673             : ///////////////////////////////////////////////////////////////////////
     674             : // Exportiert das im Konstruktor angegebenne Impress Dokument nach HTML
     675             : ///////////////////////////////////////////////////////////////////////
     676           0 : void HtmlExport::ExportHtml()
     677             : {
     678           0 :     if(mbUserAttr)
     679             :     {
     680           0 :         if( maTextColor == COL_AUTO )
     681             :         {
     682           0 :             if( !maBackColor.IsDark() )
     683           0 :                 maTextColor = COL_BLACK;
     684             :         }
     685             :     }
     686           0 :     else if( mbDocColors )
     687             :     {
     688             :         // Standard Farben fuer das Farbschema 'Aus Dokument'
     689           0 :         SetDocColors();
     690           0 :         maFirstPageColor = maBackColor;
     691             :     }
     692             : 
     693             :     // get name for downloadable presentation if needed
     694           0 :     if( mbDownload )
     695             :     {
     696             :         // Separator such und Extension ausblenden
     697           0 :         sal_uInt16 nSepPos = maDocFileName.Search( sal_Unicode('.') );
     698             : 
     699           0 :         if(nSepPos != STRING_NOTFOUND)
     700           0 :             maDocFileName.Erase(nSepPos);
     701             : 
     702           0 :         maDocFileName.AppendAscii( ".odp" );
     703             :     }
     704             : 
     705             :     //////
     706             : 
     707           0 :     sal_uInt16 nProgrCount = mnSdPageCount;
     708           0 :     nProgrCount += mbImpress?mnSdPageCount:0;
     709           0 :     nProgrCount += mbContentsPage?1:0;
     710           0 :     nProgrCount += (mbFrames && mbNotes)?mnSdPageCount:0;
     711           0 :     nProgrCount += (mbFrames)?8:0;
     712           0 :     InitProgress( nProgrCount );
     713             : 
     714           0 :     mpDocSh->SetWaitCursor( true );
     715             : 
     716             :     //------------------------------------------------------------------
     717             :     // Exceptions sind doch was schoennes...
     718             : 
     719           0 :     CreateFileNames();
     720             : 
     721             :     // this is not a true while
     722             :     while( 1 )
     723             :     {
     724           0 :         if( checkForExistingFiles() )
     725           0 :             break;
     726             : 
     727           0 :         if( !CreateImagesForPresPages() )
     728           0 :             break;
     729             : 
     730           0 :         if( mbContentsPage &&
     731           0 :            !CreateImagesForPresPages( true ) )
     732           0 :             break;
     733             : 
     734             : 
     735           0 :         if( !CreateHtmlForPresPages() )
     736           0 :             break;
     737             : 
     738           0 :         if( mbImpress )
     739           0 :             if( !CreateHtmlTextForPresPages() )
     740           0 :                 break;
     741             : 
     742           0 :         if( mbFrames )
     743             :         {
     744           0 :             if( !CreateFrames() )
     745           0 :                 break;
     746             : 
     747           0 :             if( !CreateOutlinePages() )
     748           0 :                 break;
     749             : 
     750           0 :             if( !CreateNavBarFrames() )
     751           0 :                 break;
     752             : 
     753           0 :             if( mbNotes && mbImpress )
     754           0 :                 if( !CreateNotesPages() )
     755           0 :                     break;
     756             : 
     757             :         }
     758             : 
     759           0 :         if( mbContentsPage )
     760           0 :             if( !CreateContentPage() )
     761           0 :                 break;
     762             : 
     763           0 :         if( !CreateBitmaps() )
     764           0 :             break;
     765             : 
     766           0 :         mpDocSh->SetWaitCursor( false );
     767           0 :         ResetProgress();
     768             : 
     769           0 :         if( mbDownload )
     770           0 :             SavePresentation();
     771             : 
     772           0 :         return;
     773             :     }
     774             : 
     775             :     // if we get to this point the export was
     776             :     // canceled by the user after an error
     777           0 :     mpDocSh->SetWaitCursor( false );
     778           0 :     ResetProgress();
     779             : }
     780             : 
     781             : ///////////////////////////////////////////////////////////////////////
     782             : 
     783           0 : void HtmlExport::SetDocColors( SdPage* pPage )
     784             : {
     785           0 :     if( pPage == NULL )
     786           0 :         pPage = mpDoc->GetSdPage(0, PK_STANDARD);
     787             : 
     788           0 :     svtools::ColorConfig aConfig;
     789           0 :     maVLinkColor = Color(aConfig.GetColorValue(svtools::LINKSVISITED).nColor);
     790           0 :     maALinkColor = Color(aConfig.GetColorValue(svtools::LINKS).nColor);
     791           0 :     maLinkColor  = Color(aConfig.GetColorValue(svtools::LINKS).nColor);
     792           0 :     maTextColor  = Color(COL_BLACK);
     793             : 
     794           0 :     SfxStyleSheet* pSheet = NULL;
     795             : 
     796           0 :     if( mpDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS )
     797             :     {
     798             :         // Standard Textfarbe aus Outline-Vorlage der ersten Seite
     799           0 :         pSheet = pPage->GetStyleSheetForPresObj(PRESOBJ_OUTLINE);
     800           0 :         if(pSheet == NULL)
     801           0 :             pSheet = pPage->GetStyleSheetForPresObj(PRESOBJ_TEXT);
     802           0 :         if(pSheet == NULL)
     803           0 :             pSheet = pPage->GetStyleSheetForPresObj(PRESOBJ_TITLE);
     804             :     }
     805             : 
     806           0 :     if(pSheet == NULL)
     807           0 :         pSheet = mpDoc->GetDefaultStyleSheet();
     808             : 
     809           0 :     if(pSheet)
     810             :     {
     811           0 :         SfxItemSet& rSet = pSheet->GetItemSet();
     812           0 :         if(rSet.GetItemState(EE_CHAR_COLOR,sal_True) == SFX_ITEM_ON)
     813           0 :             maTextColor = ((SvxColorItem*)rSet.GetItem(EE_CHAR_COLOR,sal_True))->GetValue();
     814             :     }
     815             : 
     816             :     // Standard Hintergrundfarbe aus Background der MasterPage der ersten Seite
     817           0 :     maBackColor = pPage->GetPageBackgroundColor();
     818             : 
     819           0 :     if( maTextColor == COL_AUTO )
     820             :     {
     821           0 :         if( !maBackColor.IsDark() )
     822           0 :             maTextColor = COL_BLACK;
     823           0 :     }
     824           0 : }
     825             : 
     826             : ///////////////////////////////////////////////////////////////////////
     827             : 
     828           0 : void HtmlExport::InitProgress( sal_uInt16 nProgrCount )
     829             : {
     830           0 :     String aStr(SdResId(STR_CREATE_PAGES));
     831           0 :     mpProgress = new SfxProgress( mpDocSh, aStr, nProgrCount );
     832           0 : }
     833             : 
     834             : ///////////////////////////////////////////////////////////////////////
     835             : 
     836           0 : void HtmlExport::ResetProgress()
     837             : {
     838           0 :     delete mpProgress;
     839           0 :     mpProgress = NULL;
     840           0 : }
     841             : 
     842             : ///////////////////////////////////////////////////////////////////////
     843             : 
     844           0 : void HtmlExport::ExportKiosk()
     845             : {
     846           0 :     mnPagesWritten = 0;
     847           0 :     InitProgress( 2*mnSdPageCount );
     848             : 
     849           0 :     CreateFileNames();
     850           0 :     if( !checkForExistingFiles() )
     851             :     {
     852           0 :         if( CreateImagesForPresPages() )
     853           0 :             CreateHtmlForPresPages();
     854             :     }
     855             : 
     856           0 :     ResetProgress();
     857           0 : }
     858             : 
     859             : ///////////////////////////////////////////////////////////////////////
     860             : // Export Document with WebCast (TM) Technology
     861             : ///////////////////////////////////////////////////////////////////////
     862           0 : void HtmlExport::ExportWebCast()
     863             : {
     864           0 :     mnPagesWritten = 0;
     865           0 :     InitProgress( mnSdPageCount + 9 );
     866             : 
     867           0 :     mpDocSh->SetWaitCursor( sal_True );
     868             : 
     869           0 :     CreateFileNames();
     870             : 
     871           0 :     if(maCGIPath.Len() == 0)
     872           0 :         maCGIPath.Assign( sal_Unicode('.') );
     873             : 
     874           0 :     if( maCGIPath.GetChar( maCGIPath.Len() - 1 ) != sal_Unicode('/') )
     875           0 :         maCGIPath.Append( sal_Unicode('/') );
     876             : 
     877           0 :     if( meScript == SCRIPT_ASP )
     878             :     {
     879           0 :         maURLPath.AssignAscii( "./" );
     880             :     }
     881             :     else
     882             :     {
     883           0 :         if(maURLPath.Len() == 0)
     884           0 :             maURLPath.Assign( sal_Unicode('.') );
     885             : 
     886           0 :         if( maURLPath.GetChar( maURLPath.Len() - 1 ) != sal_Unicode('/') )
     887           0 :             maURLPath.Append( sal_Unicode('/') );
     888             :     }
     889             : 
     890             :     // this is not a true while
     891             :     while(1)
     892             :     {
     893           0 :         if( checkForExistingFiles() )
     894           0 :             break;
     895             : 
     896           0 :         if(!CreateImagesForPresPages())
     897           0 :             break;
     898             : 
     899           0 :         if( meScript == SCRIPT_ASP )
     900             :         {
     901           0 :             if(!CreateASPScripts())
     902           0 :                 break;
     903             :         }
     904             :         else
     905             :         {
     906           0 :             if(!CreatePERLScripts())
     907           0 :                 break;
     908             :         }
     909             : 
     910           0 :         if(!CreateImageFileList())
     911           0 :             break;
     912             : 
     913           0 :         if(!CreateImageNumberFile())
     914           0 :             break;
     915             : 
     916           0 :         break;
     917             :     }
     918             : 
     919           0 :     mpDocSh->SetWaitCursor( false );
     920           0 :     ResetProgress();
     921           0 : }
     922             : 
     923             : ///////////////////////////////////////////////////////////////////////
     924             : // Save the presentation as a downloadable file in the dest directory
     925             : ///////////////////////////////////////////////////////////////////////
     926             : 
     927           0 : bool HtmlExport::SavePresentation()
     928             : {
     929           0 :     meEC.SetContext( STR_HTMLEXP_ERROR_CREATE_FILE, maDocFileName );
     930             : 
     931           0 :     OUString aURL( maExportPath );
     932           0 :     aURL += maDocFileName;
     933             : 
     934             : 
     935           0 :     mpDocSh->EnableSetModified( true );
     936             : 
     937             :     try
     938             :     {
     939           0 :         uno::Reference< frame::XStorable > xStorable( mpDoc->getUnoModel(), uno::UNO_QUERY );
     940           0 :         if( xStorable.is() )
     941             :         {
     942           0 :             uno::Sequence< beans::PropertyValue > aProperties( 2 );
     943           0 :             aProperties[ 0 ].Name = "Overwrite";
     944           0 :             aProperties[ 0 ].Value <<= (sal_Bool)sal_True;
     945           0 :             aProperties[ 1 ].Name = "FilterName";
     946           0 :             aProperties[ 1 ].Value <<= rtl::OUString("impress8");
     947           0 :             xStorable->storeToURL( aURL, aProperties );
     948             : 
     949           0 :             mpDocSh->EnableSetModified( false );
     950             : 
     951           0 :             return true;
     952           0 :         }
     953             :     }
     954           0 :     catch( Exception& )
     955             :     {
     956             :     }
     957             : 
     958           0 :     mpDocSh->EnableSetModified( false );
     959             : 
     960           0 :     return false;
     961             : }
     962             : 
     963             : // =====================================================================
     964             : // Image-Dateien anlegen
     965             : // =====================================================================
     966           0 : bool HtmlExport::CreateImagesForPresPages( bool bThumbnail)
     967             : {
     968             :     try
     969             :     {
     970           0 :         Reference < XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() );
     971           0 :         if( !xMSF.is() )
     972           0 :             return false;
     973             : 
     974           0 :         Reference< XExporter > xGraphicExporter( xMSF->createInstance( "com.sun.star.drawing.GraphicExportFilter" ), UNO_QUERY );
     975           0 :         Reference< XFilter > xFilter( xGraphicExporter, UNO_QUERY );
     976             : 
     977             :         DBG_ASSERT( xFilter.is(), "no com.sun.star.drawing.GraphicExportFilter?" );
     978           0 :         if( !xFilter.is() )
     979           0 :             return false;
     980             : 
     981           0 :         Sequence< PropertyValue > aFilterData(((meFormat==FORMAT_JPG)&&(mnCompression != -1))? 3 : 2);
     982           0 :         aFilterData[0].Name = "PixelWidth";
     983           0 :         aFilterData[0].Value <<= (sal_Int32)(bThumbnail ? PUB_THUMBNAIL_WIDTH : mnWidthPixel );
     984           0 :         aFilterData[1].Name = "PixelHeight";
     985           0 :         aFilterData[1].Value <<= (sal_Int32)(bThumbnail ? PUB_THUMBNAIL_HEIGHT : mnHeightPixel);
     986           0 :         if((meFormat==FORMAT_JPG)&&(mnCompression != -1))
     987             :         {
     988           0 :             aFilterData[2].Name = "Quality";
     989           0 :             aFilterData[2].Value <<= (sal_Int32)mnCompression;
     990             :         }
     991             : 
     992           0 :         Sequence< PropertyValue > aDescriptor( 3 );
     993           0 :         aDescriptor[0].Name = "URL";
     994           0 :         aDescriptor[1].Name = "FilterName";
     995           0 :         OUString sFormat;
     996           0 :         if( meFormat == FORMAT_PNG )
     997           0 :             sFormat = "PNG";
     998           0 :         else if( meFormat == FORMAT_GIF )
     999           0 :             sFormat = "GIF";
    1000             :         else
    1001           0 :             sFormat = "JPG";
    1002             : 
    1003           0 :         aDescriptor[1].Value <<= sFormat;
    1004           0 :         aDescriptor[2].Name = "FilterData";
    1005           0 :         aDescriptor[2].Value <<= aFilterData;
    1006             : 
    1007           0 :         for (sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
    1008             :         {
    1009           0 :             SdPage* pPage = maPages[ nSdPage ];
    1010             : 
    1011           0 :             OUString aFull(maExportPath);
    1012           0 :             if (bThumbnail)
    1013           0 :                 aFull += *mpThumbnailFiles[nSdPage];
    1014             :             else
    1015           0 :                 aFull += *mpImageFiles[nSdPage];
    1016             : 
    1017             : 
    1018           0 :             aDescriptor[0].Value <<= aFull;
    1019             : 
    1020           0 :             Reference< XComponent > xPage( pPage->getUnoPage(), UNO_QUERY );
    1021           0 :             xGraphicExporter->setSourceDocument( xPage );
    1022           0 :             xFilter->filter( aDescriptor );
    1023             : 
    1024           0 :             if (mpProgress)
    1025           0 :                 mpProgress->SetState(++mnPagesWritten);
    1026           0 :         }
    1027             :     }
    1028           0 :     catch( Exception& )
    1029             :     {
    1030           0 :         return false;
    1031             :     }
    1032             : 
    1033           0 :     return true;
    1034             : }
    1035             : 
    1036             : // =====================================================================
    1037             : // Ermittelt das SdrTextObject mit dem Layout Text dieser Seite
    1038             : // =====================================================================
    1039           0 : SdrTextObj* HtmlExport::GetLayoutTextObject(SdrPage* pPage)
    1040             : {
    1041           0 :     sal_uLong           nObjectCount = pPage->GetObjCount();
    1042           0 :     SdrObject*      pObject      = NULL;
    1043           0 :     SdrTextObj*     pResult      = NULL;
    1044             : 
    1045           0 :     for (sal_uLong nObject = 0; nObject < nObjectCount; nObject++)
    1046             :     {
    1047           0 :         pObject = pPage->GetObj(nObject);
    1048           0 :         if (pObject->GetObjInventor() == SdrInventor &&
    1049           0 :             pObject->GetObjIdentifier() == OBJ_OUTLINETEXT)
    1050             :         {
    1051           0 :             pResult = (SdrTextObj*)pObject;
    1052           0 :             break;
    1053             :         }
    1054             :     }
    1055           0 :     return pResult;
    1056             : }
    1057             : 
    1058             : // =====================================================================
    1059             : // HTML-Text Versionen fuer Impress Seiten erzeugen
    1060             : // =====================================================================
    1061             : 
    1062           0 : String HtmlExport::WriteMetaCharset() const
    1063             : {
    1064           0 :     String aStr;
    1065           0 :     const sal_Char *pCharSet = rtl_getBestMimeCharsetFromTextEncoding( RTL_TEXTENCODING_UTF8 );
    1066           0 :     if ( pCharSet )
    1067             :     {
    1068           0 :         aStr.AppendAscii( "  <meta HTTP-EQUIV=CONTENT-TYPE CONTENT=\"text/html; charset=" );
    1069           0 :         aStr.AppendAscii( pCharSet );
    1070           0 :         aStr.AppendAscii( "\">\r\n" );
    1071             :     }
    1072           0 :     return aStr;
    1073             : }
    1074             : 
    1075           0 : bool HtmlExport::CreateHtmlTextForPresPages()
    1076             : {
    1077           0 :     bool bOk = true;
    1078             : 
    1079           0 :     SdrOutliner* pOutliner = mpDoc->GetInternalOutliner();
    1080             : 
    1081           0 :     for(sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount && bOk; nSdPage++)
    1082             :     {
    1083           0 :         SdPage* pPage = maPages[ nSdPage ];
    1084             : 
    1085           0 :         if( mbDocColors )
    1086             :         {
    1087           0 :             SetDocColors( pPage );
    1088             :         }
    1089             : 
    1090             : // HTML Kopf
    1091           0 :         String aStr(maHTMLHeader);
    1092           0 :         aStr += WriteMetaCharset();
    1093           0 :         aStr.AppendAscii( "  <title>" );
    1094           0 :         aStr += StringToHTMLString( *mpPageNames[nSdPage] );
    1095           0 :         aStr.AppendAscii( "</title>\r\n" );
    1096           0 :         aStr.AppendAscii( "</head>\r\n" );
    1097           0 :         aStr += CreateBodyTag();
    1098             : 
    1099             : // Navigationsleiste
    1100           0 :         aStr += CreateNavBar(nSdPage, true);
    1101             : 
    1102             : // Seitentitel
    1103           0 :         String sTitleText( CreateTextForTitle(pOutliner,pPage, pPage->GetPageBackgroundColor()) );
    1104           0 :         aStr.AppendAscii( "<h1 style=\"");
    1105           0 :         aStr.Append( getParagraphStyle( pOutliner, 0 ) );
    1106           0 :         aStr.AppendAscii( "\">" );
    1107           0 :         aStr += sTitleText;
    1108           0 :         aStr.AppendAscii( "</h1>\r\n" );
    1109             : 
    1110             : // Gliederungstext schreiben
    1111           0 :         aStr += CreateTextForPage( pOutliner, pPage, true, pPage->GetPageBackgroundColor() );
    1112             : 
    1113             : // Notizen
    1114           0 :         if(mbNotes)
    1115             :         {
    1116           0 :             SdPage* pNotesPage = maNotesPages[ nSdPage ];
    1117           0 :             String aNotesStr( CreateTextForNotesPage( pOutliner, pNotesPage, true, maBackColor) );
    1118             : 
    1119           0 :             if( aNotesStr.Len() )
    1120             :             {
    1121           0 :                 aStr.AppendAscii( "<br>\r\n<h3>" );
    1122           0 :                 aStr += RESTOHTML(STR_HTMLEXP_NOTES);
    1123           0 :                 aStr.AppendAscii( ":</h3>\r\n" );
    1124             : 
    1125           0 :                 aStr += aNotesStr;
    1126           0 :             }
    1127             :         }
    1128             : 
    1129             : // Seite beenden
    1130           0 :         aStr.AppendAscii( "</body>\r\n</html>" );
    1131             : 
    1132           0 :         bOk = WriteHtml( *mpTextFiles[nSdPage], false, aStr );
    1133             : 
    1134           0 :         if (mpProgress)
    1135           0 :             mpProgress->SetState(++mnPagesWritten);
    1136             : 
    1137           0 :     }
    1138             : 
    1139           0 :     pOutliner->Clear();
    1140             : 
    1141           0 :     return bOk;
    1142             : }
    1143             : 
    1144             : /** exports the given html data into a non unicode file in the current export path with
    1145             :     the given filename */
    1146           0 : bool HtmlExport::WriteHtml( const String& rFileName, bool bAddExtension, const String& rHtmlData )
    1147             : {
    1148           0 :     sal_uLong nErr = 0;
    1149             : 
    1150           0 :     String aFileName( rFileName );
    1151           0 :     if( bAddExtension )
    1152           0 :         aFileName += maHTMLExtension;
    1153             : 
    1154           0 :     meEC.SetContext( STR_HTMLEXP_ERROR_CREATE_FILE, rFileName );
    1155           0 :     EasyFile aFile;
    1156             :     SvStream* pStr;
    1157           0 :     String aFull( maExportPath );
    1158           0 :     aFull += aFileName;
    1159           0 :     nErr = aFile.createStream(aFull , pStr);
    1160           0 :     if(nErr == 0)
    1161             :     {
    1162             :         rtl::OString aStr(rtl::OUStringToOString(rHtmlData,
    1163           0 :             RTL_TEXTENCODING_UTF8));
    1164           0 :         *pStr << aStr.getStr();
    1165           0 :         nErr = aFile.close();
    1166             :     }
    1167             : 
    1168           0 :     if( nErr != 0 )
    1169           0 :         ErrorHandler::HandleError(nErr);
    1170             : 
    1171           0 :     return nErr == 0;
    1172             : }
    1173             : 
    1174             : // =====================================================================
    1175             : 
    1176             : /** Erzeugt den Outliner Text fuer das Titelobjekt einer Seite
    1177             :  */
    1178           0 : String HtmlExport::CreateTextForTitle( SdrOutliner* pOutliner, SdPage* pPage, const Color& rBackgroundColor )
    1179             : {
    1180           0 :     SdrTextObj* pTO = (SdrTextObj*)pPage->GetPresObj(PRESOBJ_TITLE);
    1181           0 :     if(!pTO)
    1182           0 :         pTO = GetLayoutTextObject(pPage);
    1183             : 
    1184           0 :     if (pTO && !pTO->IsEmptyPresObj())
    1185             :     {
    1186           0 :         OutlinerParaObject* pOPO = pTO->GetOutlinerParaObject();
    1187           0 :         if(pOPO && pOutliner->GetParagraphCount() != 0)
    1188             :         {
    1189           0 :             pOutliner->Clear();
    1190           0 :             pOutliner->SetText(*pOPO);
    1191           0 :             return ParagraphToHTMLString(pOutliner,0, rBackgroundColor);
    1192             :         }
    1193             :     }
    1194             : 
    1195           0 :     return String();
    1196             : }
    1197             : 
    1198             : // =====================================================================
    1199             : // Erzeugt den Outliner Text fuer eine Seite
    1200             : // =====================================================================
    1201           0 : String HtmlExport::CreateTextForPage( SdrOutliner* pOutliner,
    1202             :                                       SdPage* pPage,
    1203             :                                       bool bHeadLine, const Color& rBackgroundColor )
    1204             : {
    1205           0 :     String aStr;
    1206             : 
    1207           0 :     SdrTextObj* pTO = (SdrTextObj*)pPage->GetPresObj(PRESOBJ_TEXT);
    1208           0 :     if(!pTO)
    1209           0 :         pTO = GetLayoutTextObject(pPage);
    1210             : 
    1211           0 :     if (pTO && !pTO->IsEmptyPresObj())
    1212             :     {
    1213           0 :         OutlinerParaObject* pOPO = pTO->GetOutlinerParaObject();
    1214           0 :         if (pOPO)
    1215             :         {
    1216           0 :             pOutliner->Clear();
    1217           0 :             pOutliner->SetText( *pOPO );
    1218             : 
    1219           0 :             sal_uLong nCount = pOutliner->GetParagraphCount();
    1220             : 
    1221           0 :             Paragraph* pPara = NULL;
    1222           0 :             sal_Int16 nActDepth = -1;
    1223             : 
    1224           0 :             String aParaText;
    1225           0 :             for (sal_uLong nPara = 0; nPara < nCount; nPara++)
    1226             :             {
    1227           0 :                 pPara = pOutliner->GetParagraph(nPara);
    1228           0 :                 if(pPara == 0)
    1229           0 :                     continue;
    1230             : 
    1231           0 :                 const sal_Int16 nDepth = (sal_uInt16) pOutliner->GetDepth( (sal_uInt16) nPara );
    1232           0 :                 aParaText = ParagraphToHTMLString(pOutliner,nPara,rBackgroundColor);
    1233             : 
    1234           0 :                 if(aParaText.Len() == 0)
    1235           0 :                     continue;
    1236             : 
    1237           0 :                 if(nDepth < nActDepth )
    1238             :                 {
    1239           0 :                     do
    1240             :                     {
    1241           0 :                         aStr.AppendAscii( "</ul>" );
    1242           0 :                         nActDepth--;
    1243             :                     }
    1244             :                     while(nDepth < nActDepth);
    1245             :                 }
    1246           0 :                 else if(nDepth > nActDepth )
    1247             :                 {
    1248           0 :                     do
    1249             :                     {
    1250           0 :                         aStr.AppendAscii( "<ul>" );
    1251           0 :                         nActDepth++;
    1252             :                     }
    1253             :                     while( nDepth > nActDepth );
    1254             :                 }
    1255             : 
    1256           0 :                 String sStyle( getParagraphStyle( pOutliner, nPara ) );
    1257           0 :                 if(nActDepth >= 0 )
    1258             :                 {
    1259           0 :                     aStr.AppendAscii( "<li style=\"");
    1260           0 :                     aStr.Append( sStyle );
    1261           0 :                     aStr.AppendAscii( "\">" );
    1262             :                 }
    1263             : 
    1264           0 :                 if(nActDepth <= 0 && bHeadLine)
    1265             :                 {
    1266           0 :                     if( nActDepth == 0 )
    1267             :                     {
    1268           0 :                         aStr.AppendAscii( "<h2>" );
    1269             :                     }
    1270             :                     else
    1271             :                     {
    1272           0 :                         aStr.AppendAscii( "<h2 style=\"");
    1273           0 :                         aStr.Append( sStyle );
    1274           0 :                         aStr.AppendAscii( "\">" );
    1275             :                     }
    1276             :                 }
    1277           0 :                 aStr += aParaText;
    1278           0 :                 if(nActDepth == 0 && bHeadLine)
    1279           0 :                     aStr.AppendAscii( "</h2>" );
    1280           0 :                 if(nActDepth >= 0 )
    1281           0 :                     aStr.AppendAscii( "</li>" );
    1282           0 :                 aStr.AppendAscii( "\r\n" );
    1283           0 :             }
    1284             : 
    1285           0 :             while( nActDepth >= 0 )
    1286             :             {
    1287           0 :                 aStr.AppendAscii( "</ul>" );
    1288           0 :                 nActDepth--;
    1289           0 :             };
    1290             :         }
    1291             :     }
    1292             : 
    1293           0 :     return aStr;
    1294             : }
    1295             : 
    1296             : // =====================================================================
    1297             : // Erzeugt den Outliner Text fuer eine Notizseite
    1298             : // =====================================================================
    1299           0 : String HtmlExport::CreateTextForNotesPage( SdrOutliner* pOutliner,
    1300             :                                            SdPage* pPage,
    1301             :                                            bool,
    1302             :                                            const Color& rBackgroundColor )
    1303             : {
    1304           0 :     String aStr;
    1305             : 
    1306           0 :     SdrTextObj* pTO = (SdrTextObj*)pPage->GetPresObj(PRESOBJ_NOTES);
    1307             : 
    1308           0 :     if (pTO && !pTO->IsEmptyPresObj())
    1309             :     {
    1310           0 :         OutlinerParaObject* pOPO = pTO->GetOutlinerParaObject();
    1311           0 :         if (pOPO)
    1312             :         {
    1313           0 :             pOutliner->Clear();
    1314           0 :             pOutliner->SetText( *pOPO );
    1315             : 
    1316           0 :             sal_uLong nCount = pOutliner->GetParagraphCount();
    1317           0 :             for (sal_uLong nPara = 0; nPara < nCount; nPara++)
    1318             :             {
    1319           0 :                 aStr.AppendAscii("<p style=\"");
    1320           0 :                 aStr.Append( getParagraphStyle( pOutliner, nPara ) );
    1321           0 :                 aStr.AppendAscii("\">");
    1322           0 :                 aStr += ParagraphToHTMLString( pOutliner, nPara,rBackgroundColor );
    1323           0 :                 aStr.AppendAscii( "</p>\r\n" );
    1324             :             }
    1325             :         }
    1326             :     }
    1327             : 
    1328           0 :     return aStr;
    1329             : }
    1330             : 
    1331             : // =====================================================================
    1332             : // Wandelt einen Paragraphen des Outliners in Html
    1333             : // =====================================================================
    1334           0 : String HtmlExport::ParagraphToHTMLString( SdrOutliner* pOutliner, sal_uLong nPara, const Color& rBackgroundColor )
    1335             : {
    1336           0 :     String aStr;
    1337             : 
    1338           0 :     if(NULL == pOutliner)
    1339             :         return aStr;
    1340             : 
    1341             :     // TODO: MALTE!!!
    1342           0 :     EditEngine& rEditEngine = *(EditEngine*)&pOutliner->GetEditEngine();
    1343           0 :     bool bOldUpdateMode = rEditEngine.GetUpdateMode();
    1344           0 :     rEditEngine.SetUpdateMode(sal_True);
    1345             : 
    1346           0 :     Paragraph* pPara = pOutliner->GetParagraph(nPara);
    1347           0 :     if(NULL == pPara)
    1348             :         return aStr;
    1349             : 
    1350           0 :     HtmlState aState( (mbUserAttr || mbDocColors)  ? maTextColor : Color(COL_BLACK) );
    1351           0 :     std::vector<sal_uInt16> aPortionList;
    1352           0 :     rEditEngine.GetPortions( (sal_uInt16) nPara, aPortionList );
    1353             : 
    1354           0 :     sal_uInt16 nPos1 = 0;
    1355           0 :     for( std::vector<sal_uInt16>::const_iterator it( aPortionList.begin() ); it != aPortionList.end(); ++it )
    1356             :     {
    1357           0 :         sal_uInt16 nPos2 = *it;
    1358             : 
    1359           0 :         ESelection aSelection( (sal_uInt16) nPara, nPos1, (sal_uInt16) nPara, nPos2);
    1360             : 
    1361           0 :         SfxItemSet aSet( rEditEngine.GetAttribs( aSelection ) );
    1362             : 
    1363           0 :         String aPortion(StringToHTMLString(rEditEngine.GetText( aSelection )));
    1364             : 
    1365           0 :         aStr += TextAttribToHTMLString( &aSet, &aState, rBackgroundColor );
    1366           0 :         aStr += aPortion;
    1367             : 
    1368           0 :         nPos1 = nPos2;
    1369           0 :     }
    1370           0 :     aStr += aState.Flush();
    1371           0 :     rEditEngine.SetUpdateMode(bOldUpdateMode);
    1372             : 
    1373           0 :     return aStr;
    1374             : }
    1375             : 
    1376             : // =====================================================================
    1377             : // Erzeugt anhand der Attribute im angegebennen Set und dem gegebennen
    1378             : // HtmlState die noetigen Html-Tags um die Attribute zu uebernehmen
    1379             : // =====================================================================
    1380           0 : String HtmlExport::TextAttribToHTMLString( SfxItemSet* pSet, HtmlState* pState, const Color& rBackgroundColor )
    1381             : {
    1382           0 :     String aStr;
    1383             : 
    1384           0 :     if(NULL == pSet)
    1385             :         return aStr;
    1386             : 
    1387           0 :     String aLink, aTarget;
    1388           0 :     if ( pSet->GetItemState( EE_FEATURE_FIELD ) == SFX_ITEM_ON )
    1389             :     {
    1390           0 :         SvxFieldItem* pItem = (SvxFieldItem*)pSet->GetItem( EE_FEATURE_FIELD );
    1391           0 :         if(pItem)
    1392             :         {
    1393           0 :             SvxURLField* pURL = PTR_CAST(SvxURLField, pItem->GetField());
    1394           0 :             if(pURL)
    1395             :             {
    1396           0 :                 aLink = pURL->GetURL();
    1397           0 :                 aTarget = pURL->GetTargetFrame();
    1398             :             }
    1399             :         }
    1400             :     }
    1401             : 
    1402             :     bool bTemp;
    1403           0 :     String aTemp;
    1404             : 
    1405           0 :     if ( pSet->GetItemState( EE_CHAR_WEIGHT ) == SFX_ITEM_ON )
    1406             :     {
    1407           0 :         bTemp = ((const SvxWeightItem&)pSet->Get( EE_CHAR_WEIGHT )).GetWeight() == WEIGHT_BOLD;
    1408           0 :         aTemp = pState->SetWeight( bTemp );
    1409           0 :         if( bTemp )
    1410           0 :             aStr.Insert( aTemp, 0 );
    1411             :         else
    1412           0 :             aStr += aTemp;
    1413             :     }
    1414             : 
    1415           0 :     if ( pSet->GetItemState( EE_CHAR_UNDERLINE ) == SFX_ITEM_ON )
    1416             :     {
    1417           0 :         bTemp = ((const SvxUnderlineItem&)pSet->Get( EE_CHAR_UNDERLINE )).GetLineStyle() != UNDERLINE_NONE;
    1418           0 :         aTemp = pState->SetUnderline( bTemp );
    1419           0 :         if( bTemp )
    1420           0 :             aStr.Insert( aTemp, 0 );
    1421             :         else
    1422           0 :             aStr += aTemp;
    1423             :     }
    1424             : 
    1425           0 :     if ( pSet->GetItemState( EE_CHAR_STRIKEOUT ) == SFX_ITEM_ON )
    1426             :     {
    1427           0 :         bTemp = ((const SvxCrossedOutItem&)pSet->Get( EE_CHAR_STRIKEOUT )).GetStrikeout() != STRIKEOUT_NONE;
    1428           0 :         aTemp = pState->SetStrikeout( bTemp );
    1429           0 :         if( bTemp )
    1430           0 :             aStr.Insert( aTemp, 0 );
    1431             :         else
    1432           0 :             aStr += aTemp;
    1433             :     }
    1434             : 
    1435           0 :     if ( pSet->GetItemState( EE_CHAR_ITALIC ) == SFX_ITEM_ON )
    1436             :     {
    1437           0 :         bTemp = ((const SvxPostureItem&)pSet->Get( EE_CHAR_ITALIC )).GetPosture() != ITALIC_NONE;
    1438           0 :         aTemp = pState->SetItalic( bTemp );
    1439           0 :         if( bTemp )
    1440           0 :             aStr.Insert( aTemp, 0 );
    1441             :         else
    1442           0 :             aStr += aTemp;
    1443             :     }
    1444             : 
    1445           0 :     if(mbDocColors)
    1446             :     {
    1447           0 :         if ( pSet->GetItemState( EE_CHAR_COLOR ) == SFX_ITEM_ON )
    1448             :         {
    1449           0 :             Color aTextColor = ((const SvxColorItem&) pSet->Get( EE_CHAR_COLOR )).GetValue();
    1450           0 :             if( aTextColor == COL_AUTO )
    1451             :             {
    1452           0 :                 if( !rBackgroundColor.IsDark() )
    1453           0 :                     aTextColor = COL_BLACK;
    1454             :             }
    1455           0 :             aStr += pState->SetColor( aTextColor );
    1456             :         }
    1457             :     }
    1458             : 
    1459           0 :     if( aLink.Len() )
    1460           0 :         aStr.Insert( pState->SetLink(aLink, aTarget), 0 );
    1461             :     else
    1462           0 :         aStr += pState->SetLink(aLink, aTarget);
    1463             : 
    1464           0 :     return aStr;
    1465             : }
    1466             : 
    1467             : // =====================================================================
    1468             : // HTML-Wrapper fuer Bild-Dateien erzeugen
    1469             : // =====================================================================
    1470           0 : bool HtmlExport::CreateHtmlForPresPages()
    1471             : {
    1472           0 :     bool bOk = true;
    1473             : 
    1474           0 :     std::vector<SdrObject*> aClickableObjects;
    1475             : 
    1476           0 :     for(sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount && bOk; nSdPage++)
    1477             :     {
    1478             :         // Klickbare Objekte finden (auch auf der Masterpage) und
    1479             :         // in Liste stellen. In umgekehrter Zeichenreihenfolge in
    1480             :         // die Liste stellen, da in HTML bei Ueberlappungen die
    1481             :         // _erstgenannte_ Area wirkt.
    1482             : 
    1483           0 :         SdPage* pPage = maPages[ nSdPage ];
    1484             : 
    1485           0 :         if( mbDocColors )
    1486             :         {
    1487           0 :             SetDocColors( pPage );
    1488             :         }
    1489             : 
    1490           0 :         bool    bMasterDone = false;
    1491             : 
    1492           0 :         while (!bMasterDone)
    1493             :         {
    1494             :             // sal_True = rueckwaerts
    1495           0 :             SdrObjListIter aIter(*pPage, IM_DEEPWITHGROUPS, sal_True);
    1496             : 
    1497           0 :             SdrObject* pObject = aIter.Next();
    1498           0 :             while (pObject)
    1499             :             {
    1500           0 :                 SdAnimationInfo* pInfo     = mpDoc->GetAnimationInfo(pObject);
    1501           0 :                 SdIMapInfo*      pIMapInfo = mpDoc->GetIMapInfo(pObject);
    1502             : 
    1503           0 :                 if ((pInfo &&
    1504             :                      (pInfo->meClickAction == presentation::ClickAction_BOOKMARK  ||
    1505             :                       pInfo->meClickAction == presentation::ClickAction_DOCUMENT  ||
    1506             :                       pInfo->meClickAction == presentation::ClickAction_PREVPAGE  ||
    1507             :                       pInfo->meClickAction == presentation::ClickAction_NEXTPAGE  ||
    1508             :                       pInfo->meClickAction == presentation::ClickAction_FIRSTPAGE ||
    1509             :                       pInfo->meClickAction == presentation::ClickAction_LASTPAGE)) ||
    1510             :                      pIMapInfo)
    1511             :                 {
    1512           0 :                     aClickableObjects.push_back(pObject);
    1513             :                 }
    1514             : 
    1515           0 :                 pObject = aIter.Next();
    1516             :             }
    1517             :             // jetzt zur Masterpage oder beenden
    1518           0 :             if (!pPage->IsMasterPage())
    1519           0 :                 pPage = (SdPage*)(&(pPage->TRG_GetMasterPage()));
    1520             :             else
    1521           0 :                 bMasterDone = true;
    1522           0 :         }
    1523             : 
    1524             : // HTML Head
    1525           0 :         String aStr(maHTMLHeader);
    1526           0 :         aStr += WriteMetaCharset();
    1527           0 :         aStr.AppendAscii( "  <title>" );
    1528           0 :         aStr += StringToHTMLString(*mpPageNames[nSdPage]);
    1529           0 :         aStr.AppendAscii( "</title>\r\n" );
    1530             : 
    1531             : // insert timing information
    1532           0 :         pPage = maPages[ nSdPage ];
    1533           0 :         if( meMode == PUBLISH_KIOSK )
    1534             :         {
    1535           0 :             sal_uLong nSecs = 0;
    1536           0 :             bool bEndless = false;
    1537           0 :             if( !mbAutoSlide )
    1538             :             {
    1539           0 :                 if( pPage->GetPresChange() != PRESCHANGE_MANUAL )
    1540             :                 {
    1541           0 :                     nSecs = pPage->GetTime();
    1542           0 :                     bEndless = mpDoc->getPresentationSettings().mbEndless;
    1543             :                 }
    1544             :             }
    1545             :             else
    1546             :             {
    1547           0 :                 nSecs = mnSlideDuration;
    1548           0 :                 bEndless = mbEndless;
    1549             :             }
    1550             : 
    1551           0 :             if( nSecs != 0 )
    1552             :             {
    1553           0 :                 if( nSdPage < (mnSdPageCount-1) || bEndless )
    1554             :                 {
    1555           0 :                     aStr.AppendAscii( "<meta http-equiv=\"refresh\" content=\"" );
    1556           0 :                     aStr += String::CreateFromInt32(nSecs);
    1557           0 :                     aStr.AppendAscii( "; URL=" );
    1558             : 
    1559           0 :                     int nPage = nSdPage + 1;
    1560           0 :                     if( nPage == mnSdPageCount )
    1561           0 :                         nPage = 0;
    1562             : 
    1563           0 :                     aStr += StringToURL(*mpHTMLFiles[nPage]);
    1564             : 
    1565           0 :                     aStr.AppendAscii( "\">\r\n" );
    1566             :                 }
    1567             :             }
    1568             :         }
    1569             : 
    1570           0 :         aStr.AppendAscii( "</head>\r\n" );
    1571             : 
    1572             : // HTML Body
    1573           0 :         aStr += CreateBodyTag();
    1574             : 
    1575           0 :         if( mbSlideSound && pPage->IsSoundOn() )
    1576           0 :             aStr += InsertSound( pPage->GetSoundFile() );
    1577             : 
    1578             : // Navigationsleiste
    1579           0 :         if(!mbFrames )
    1580           0 :             aStr += CreateNavBar( nSdPage, false );
    1581             : // Image
    1582           0 :         aStr.AppendAscii( "<center>" );
    1583           0 :         aStr.AppendAscii( "<img src=\"" );
    1584           0 :         aStr += StringToURL( *mpImageFiles[nSdPage] );
    1585           0 :         aStr.AppendAscii( "\" alt=\"\"" );
    1586             : 
    1587           0 :         if (!aClickableObjects.empty())
    1588           0 :             aStr.AppendAscii( " USEMAP=\"#map0\"" );
    1589             : 
    1590           0 :         aStr.AppendAscii( "></center>\r\n" );
    1591             : 
    1592             : // Notizen
    1593           0 :         if(mbNotes && !mbFrames)
    1594             :         {
    1595           0 :             SdrOutliner* pOutliner = mpDoc->GetInternalOutliner();
    1596           0 :             SdPage* pNotesPage = maNotesPages[ nSdPage ];
    1597           0 :             String aNotesStr( CreateTextForNotesPage( pOutliner, pNotesPage, true, maBackColor) );
    1598           0 :             pOutliner->Clear();
    1599             : 
    1600           0 :             if( aNotesStr.Len() )
    1601             :             {
    1602           0 :                 aStr.AppendAscii( "<h3>" );
    1603           0 :                 aStr += RESTOHTML(STR_HTMLEXP_NOTES);
    1604           0 :                 aStr.AppendAscii( ":</h3><br>\r\n\r\n<p>" );
    1605             : 
    1606           0 :                 aStr += aNotesStr;
    1607           0 :                 aStr.AppendAscii( "\r\n</p>\r\n" );
    1608           0 :             }
    1609             :         }
    1610             : 
    1611             : // ggfs. Imagemap erzeugen
    1612           0 :         if (!aClickableObjects.empty())
    1613             :         {
    1614           0 :             aStr.AppendAscii( "<map name=\"map0\">\r\n" );
    1615             : 
    1616           0 :             for (sal_uInt32 nObject = 0, n = aClickableObjects.size(); nObject < n; nObject++)
    1617             :             {
    1618           0 :                 SdrObject* pObject = aClickableObjects[nObject];
    1619           0 :                 SdAnimationInfo* pInfo     = mpDoc->GetAnimationInfo(pObject);
    1620           0 :                 SdIMapInfo*      pIMapInfo = mpDoc->GetIMapInfo(pObject);
    1621             : 
    1622           0 :                 Rectangle aRect(pObject->GetCurrentBoundRect());
    1623           0 :                 Point     aLogPos(aRect.TopLeft());
    1624           0 :                 bool      bIsSquare = aRect.GetWidth() == aRect.GetHeight();
    1625             : 
    1626           0 :                 sal_uLong nPageWidth = pPage->GetSize().Width() - pPage->GetLftBorder() -
    1627           0 :                                    pPage->GetRgtBorder();
    1628             : 
    1629             :                 // das BoundRect bezieht sich auf den physikalischen
    1630             :                 // Seitenursprung, nicht auf den Koordinatenursprung
    1631           0 :                 aRect.Move(-pPage->GetLftBorder(), -pPage->GetUppBorder());
    1632             : 
    1633           0 :                 double fLogicToPixel = ((double)mnWidthPixel) / nPageWidth;
    1634           0 :                 aRect.Left()   = (long)(aRect.Left() * fLogicToPixel);
    1635           0 :                 aRect.Top()    = (long)(aRect.Top() * fLogicToPixel);
    1636           0 :                 aRect.Right()  = (long)(aRect.Right() * fLogicToPixel);
    1637           0 :                 aRect.Bottom() = (long)(aRect.Bottom() * fLogicToPixel);
    1638           0 :                 long nRadius = aRect.GetWidth() / 2;
    1639             : 
    1640             : 
    1641             :                 /*************************************************************
    1642             :                 |* wenn das Objekt eine eigene Imagemap enthaelt, werden ihre
    1643             :                 |* Areas in diese Imagemap eingefuegt
    1644             :                 \************************************************************/
    1645           0 :                 if (pIMapInfo)
    1646             :                 {
    1647           0 :                     const ImageMap& rIMap = pIMapInfo->GetImageMap();
    1648           0 :                     sal_uInt16 nAreaCount = rIMap.GetIMapObjectCount();
    1649           0 :                     for (sal_uInt16 nArea = 0; nArea < nAreaCount; nArea++)
    1650             :                     {
    1651           0 :                         IMapObject* pArea = rIMap.GetIMapObject(nArea);
    1652           0 :                         sal_uInt16 nType = pArea->GetType();
    1653           0 :                         String aURL( pArea->GetURL() );
    1654             : 
    1655             :                         // ggfs. Seiten- oder Objektnamen umwandeln in den
    1656             :                         // Namen der entsprechenden HTML-Datei
    1657             :                         sal_Bool        bIsMasterPage;
    1658           0 :                         sal_uInt16      nPgNum = mpDoc->GetPageByName( aURL, bIsMasterPage );
    1659           0 :                         SdrObject*  pObj = NULL;
    1660             : 
    1661           0 :                         if (nPgNum == SDRPAGE_NOTFOUND)
    1662             :                         {
    1663             :                             // Ist das Bookmark ein Objekt?
    1664           0 :                             pObj = mpDoc->GetObj( aURL );
    1665           0 :                             if (pObj)
    1666           0 :                                 nPgNum = pObj->GetPage()->GetPageNum();
    1667             :                         }
    1668           0 :                         if (nPgNum != SDRPAGE_NOTFOUND)
    1669             :                         {
    1670           0 :                             nPgNum = (nPgNum - 1) / 2;  // SdrPageNum --> SdPageNum
    1671           0 :                             aURL = CreatePageURL(nPgNum);
    1672             :                         }
    1673             : 
    1674           0 :                         switch(nType)
    1675             :                         {
    1676             :                             case IMAP_OBJ_RECTANGLE:
    1677             :                             {
    1678             :                                 Rectangle aArea(((IMapRectangleObject*)pArea)->
    1679           0 :                                                  GetRectangle(false));
    1680             : 
    1681             :                                 // Umrechnung in Pixelkoordinaten
    1682           0 :                                 aArea.Move(aLogPos.X() - pPage->GetLftBorder(),
    1683           0 :                                            aLogPos.Y() - pPage->GetUppBorder());
    1684           0 :                                 aArea.Left()   = (long)(aArea.Left() * fLogicToPixel);
    1685           0 :                                 aArea.Top()    = (long)(aArea.Top() * fLogicToPixel);
    1686           0 :                                 aArea.Right()  = (long)(aArea.Right() * fLogicToPixel);
    1687           0 :                                 aArea.Bottom() = (long)(aArea.Bottom() * fLogicToPixel);
    1688             : 
    1689           0 :                                 aStr += CreateHTMLRectArea(aArea, aURL);
    1690             :                             }
    1691           0 :                             break;
    1692             : 
    1693             :                             case IMAP_OBJ_CIRCLE:
    1694             :                             {
    1695             :                                 Point aCenter(((IMapCircleObject*)pArea)->
    1696           0 :                                                  GetCenter(false));
    1697           0 :                                 aCenter += Point(aLogPos.X() - pPage->GetLftBorder(),
    1698           0 :                                                  aLogPos.Y() - pPage->GetUppBorder());
    1699           0 :                                 aCenter.X() = (long)(aCenter.X() * fLogicToPixel);
    1700           0 :                                 aCenter.Y() = (long)(aCenter.Y() * fLogicToPixel);
    1701             : 
    1702             :                                 sal_uLong nCircleRadius = (((IMapCircleObject*)pArea)->
    1703           0 :                                                  GetRadius(false));
    1704           0 :                                 nCircleRadius = (sal_uLong)(nCircleRadius * fLogicToPixel);
    1705             :                                 aStr += CreateHTMLCircleArea(nCircleRadius,
    1706           0 :                                                             aCenter.X(), aCenter.Y(),
    1707           0 :                                                             aURL);
    1708             :                             }
    1709           0 :                             break;
    1710             : 
    1711             :                             case IMAP_OBJ_POLYGON:
    1712             :                             {
    1713           0 :                                 Polygon aArea(((IMapPolygonObject*)pArea)->GetPolygon(false));
    1714           0 :                                 aStr += CreateHTMLPolygonArea(::basegfx::B2DPolyPolygon(aArea.getB2DPolygon()), Size(aLogPos.X() - pPage->GetLftBorder(), aLogPos.Y() - pPage->GetUppBorder()), fLogicToPixel, aURL);
    1715             :                             }
    1716           0 :                             break;
    1717             : 
    1718             :                             default:
    1719             :                             {
    1720             :                                 DBG_WARNING("unbekannter IMAP_OBJ_Typ");
    1721             :                             }
    1722           0 :                             break;
    1723             :                         }
    1724           0 :                     }
    1725             :                 }
    1726             : 
    1727             : 
    1728             : 
    1729             :                 /*************************************************************
    1730             :                 |* wenn es eine presentation::ClickAction gibt, Bookmark bestimmen und eine
    1731             :                 |* Area fuer das ganze Objekt erzeugen
    1732             :                 \************************************************************/
    1733           0 :                 if( pInfo )
    1734             :                 {
    1735           0 :                     String      aHRef;
    1736           0 :                     presentation::ClickAction eClickAction = pInfo->meClickAction;
    1737             : 
    1738           0 :                     switch( eClickAction )
    1739             :                     {
    1740             :                         case presentation::ClickAction_BOOKMARK:
    1741             :                         {
    1742             :                             sal_Bool        bIsMasterPage;
    1743           0 :                             sal_uInt16      nPgNum = mpDoc->GetPageByName( pInfo->GetBookmark(), bIsMasterPage );
    1744           0 :                             SdrObject*  pObj = NULL;
    1745             : 
    1746           0 :                             if( nPgNum == SDRPAGE_NOTFOUND )
    1747             :                             {
    1748             :                                 // Ist das Bookmark ein Objekt?
    1749           0 :                                 pObj = mpDoc->GetObj(pInfo->GetBookmark());
    1750           0 :                                 if (pObj)
    1751           0 :                                     nPgNum = pObj->GetPage()->GetPageNum();
    1752             :                             }
    1753             : 
    1754           0 :                             if( SDRPAGE_NOTFOUND != nPgNum )
    1755           0 :                                 aHRef = CreatePageURL(( nPgNum - 1 ) / 2 );
    1756             :                         }
    1757           0 :                         break;
    1758             : 
    1759             :                         case presentation::ClickAction_DOCUMENT:
    1760           0 :                             aHRef = pInfo->GetBookmark();
    1761           0 :                         break;
    1762             : 
    1763             :                         case presentation::ClickAction_PREVPAGE:
    1764             :                         {
    1765           0 :                             sal_uLong nPage = nSdPage;
    1766           0 :                             if (nSdPage == 0)
    1767           0 :                                 nPage = 0;
    1768             :                             else
    1769           0 :                                 nPage = nSdPage - 1;
    1770             : 
    1771           0 :                             aHRef = CreatePageURL( (sal_uInt16) nPage);
    1772             :                         }
    1773           0 :                         break;
    1774             : 
    1775             :                         case presentation::ClickAction_NEXTPAGE:
    1776             :                         {
    1777           0 :                             sal_uLong nPage = nSdPage;
    1778           0 :                             if (nSdPage == mnSdPageCount - 1)
    1779           0 :                                 nPage = mnSdPageCount - 1;
    1780             :                             else
    1781           0 :                                 nPage = nSdPage + 1;
    1782             : 
    1783           0 :                             aHRef = CreatePageURL( (sal_uInt16) nPage);
    1784             :                         }
    1785           0 :                         break;
    1786             : 
    1787             :                         case presentation::ClickAction_FIRSTPAGE:
    1788           0 :                             aHRef = CreatePageURL(0);
    1789           0 :                         break;
    1790             : 
    1791             :                         case presentation::ClickAction_LASTPAGE:
    1792           0 :                             aHRef = CreatePageURL(mnSdPageCount - 1);
    1793           0 :                         break;
    1794             : 
    1795             :                         default:
    1796           0 :                             break;
    1797             :                     }
    1798             : 
    1799             :                     // jetzt die Areas
    1800           0 :                     if( aHRef.Len() )
    1801             :                     {
    1802             :                         // ein Kreis?
    1803           0 :                         if (pObject->GetObjInventor() == SdrInventor &&
    1804           0 :                             pObject->GetObjIdentifier() == OBJ_CIRC  &&
    1805             :                             bIsSquare )
    1806             :                         {
    1807           0 :                             aStr += CreateHTMLCircleArea(aRect.GetWidth() / 2,
    1808           0 :                                                     aRect.Left() + nRadius,
    1809           0 :                                                     aRect.Top() + nRadius,
    1810           0 :                                                     aHRef);
    1811             :                         }
    1812             :                         // ein Polygon?
    1813           0 :                         else if (pObject->GetObjInventor() == SdrInventor &&
    1814           0 :                                  (pObject->GetObjIdentifier() == OBJ_PATHLINE ||
    1815           0 :                                   pObject->GetObjIdentifier() == OBJ_PLIN ||
    1816           0 :                                   pObject->GetObjIdentifier() == OBJ_POLY))
    1817             :                         {
    1818           0 :                             aStr += CreateHTMLPolygonArea(((SdrPathObj*)pObject)->GetPathPoly(), Size(-pPage->GetLftBorder(), -pPage->GetUppBorder()), fLogicToPixel, aHRef);
    1819             :                         }
    1820             :                         // was anderes: das BoundRect nehmen
    1821             :                         else
    1822             :                         {
    1823           0 :                             aStr += CreateHTMLRectArea(aRect, aHRef);
    1824             :                         }
    1825             : 
    1826           0 :                     }
    1827             :                 }
    1828             :             }
    1829             : 
    1830           0 :             aStr.AppendAscii( "</map>\r\n" );
    1831             :         }
    1832           0 :         aClickableObjects.clear();
    1833             : 
    1834           0 :         aStr.AppendAscii( "</body>\r\n</html>" );
    1835             : 
    1836           0 :         bOk = WriteHtml( *mpHTMLFiles[nSdPage], false, aStr );
    1837             : 
    1838           0 :         if (mpProgress)
    1839           0 :             mpProgress->SetState(++mnPagesWritten);
    1840           0 :     }
    1841             : 
    1842           0 :     return bOk;
    1843             : }
    1844             : 
    1845             : // =====================================================================
    1846             : // Uebersichtsseite erzeugen
    1847             : // =====================================================================
    1848           0 : bool HtmlExport::CreateContentPage()
    1849             : {
    1850           0 :     if( mbDocColors )
    1851           0 :         SetDocColors();
    1852             : 
    1853             :     // Html Kopf
    1854           0 :     String aStr(maHTMLHeader);
    1855           0 :     aStr += WriteMetaCharset();
    1856           0 :     aStr.AppendAscii( "  <title>" );
    1857           0 :     aStr += StringToHTMLString(*mpPageNames[0]);
    1858           0 :     aStr.AppendAscii( "</title>\r\n</head>\r\n" );
    1859           0 :     aStr += CreateBodyTag();
    1860             : 
    1861             :     // Seitenkopf
    1862           0 :     aStr.AppendAscii( "<center>\r\n" );
    1863             : 
    1864           0 :     if(mbHeader)
    1865             :     {
    1866           0 :         aStr.AppendAscii( "<h1>" );
    1867           0 :         aStr += getDocumentTitle();
    1868           0 :         aStr.AppendAscii( "</h1><br>\r\n" );
    1869             :     }
    1870             : 
    1871           0 :     aStr.AppendAscii( "<h2>" );
    1872             : 
    1873             :     // Solaris compiler bug workaround
    1874           0 :     if( mbFrames )
    1875             :         aStr += CreateLink( maFramePage,
    1876           0 :                             RESTOHTML(STR_HTMLEXP_CLICKSTART) );
    1877             :     else
    1878           0 :         aStr += CreateLink( StringToHTMLString(*mpHTMLFiles[0]),
    1879           0 :                             RESTOHTML(STR_HTMLEXP_CLICKSTART) );
    1880             : 
    1881           0 :     aStr.AppendAscii( "</h2>\r\n</center>\r\n" );
    1882             : 
    1883           0 :     aStr.AppendAscii( "<center><table width=\"90%\"><tr>\r\n" );
    1884             : 
    1885             :     // Inhaltsverzeichnis
    1886           0 :     aStr.AppendAscii( "<td valign=\"top\" align=\"left\" width=\"25%\">\r\n" );
    1887           0 :     aStr.AppendAscii( "<h3>" );
    1888           0 :     aStr += RESTOHTML(STR_HTMLEXP_CONTENTS);
    1889           0 :     aStr.AppendAscii( "</h3>" );
    1890             : 
    1891           0 :     for(sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
    1892             :     {
    1893           0 :         String aPageName = *mpPageNames[nSdPage];
    1894           0 :         aStr.AppendAscii( "<div align=\"left\">" );
    1895           0 :         if(mbFrames)
    1896           0 :             aStr += StringToHTMLString(aPageName);
    1897             :         else
    1898           0 :             aStr += CreateLink(*mpHTMLFiles[nSdPage], aPageName);
    1899           0 :         aStr.AppendAscii( "</div>\r\n" );
    1900           0 :     }
    1901           0 :     aStr.AppendAscii( "</td>\r\n" );
    1902             : 
    1903             :     // Dokument Infos
    1904           0 :     aStr.AppendAscii( "<td valign=\"top\" align=\"left\" width=\"75%\">\r\n" );
    1905             : 
    1906           0 :     if(maAuthor.Len())
    1907             :     {
    1908           0 :         aStr.AppendAscii( "<p><strong>" );
    1909           0 :         aStr += RESTOHTML(STR_HTMLEXP_AUTHOR);
    1910           0 :         aStr.AppendAscii( ":</strong> " );
    1911           0 :         aStr += StringToHTMLString(maAuthor);
    1912           0 :         aStr.AppendAscii( "</p>\r\n" );
    1913             :     }
    1914             : 
    1915           0 :     if(maEMail.Len())
    1916             :     {
    1917           0 :         aStr.AppendAscii( "<p><strong>" );
    1918           0 :         aStr += RESTOHTML(STR_HTMLEXP_EMAIL);
    1919           0 :         aStr.AppendAscii( ":</strong> <a href=\"mailto:" );
    1920           0 :         aStr += StringToURL(maEMail);
    1921           0 :         aStr.AppendAscii( "\">" );
    1922           0 :         aStr += StringToHTMLString(maEMail);
    1923           0 :         aStr.AppendAscii( "</a></p>\r\n" );
    1924             :     }
    1925             : 
    1926           0 :     if(maHomePage.Len())
    1927             :     {
    1928           0 :         aStr.AppendAscii( "<p><strong>" );
    1929           0 :         aStr += RESTOHTML(STR_HTMLEXP_HOMEPAGE);
    1930           0 :         aStr.AppendAscii( ":</strong> <a href=\"" );
    1931           0 :         aStr += StringToURL(maHomePage);
    1932           0 :         aStr.AppendAscii( "\">" );
    1933           0 :         aStr += StringToHTMLString(maHomePage);
    1934           0 :         aStr.AppendAscii( "</a> </p>\r\n" );
    1935             :     }
    1936             : 
    1937           0 :     if(maInfo.Len())
    1938             :     {
    1939           0 :         aStr.AppendAscii( "<p><strong>" );
    1940           0 :         aStr += RESTOHTML(STR_HTMLEXP_INFO);
    1941           0 :         aStr.AppendAscii( ":</strong><br>\r\n" );
    1942           0 :         aStr += StringToHTMLString(maInfo);
    1943           0 :         aStr.AppendAscii( "</p>\r\n" );
    1944             :     }
    1945             : 
    1946           0 :     if(mbDownload)
    1947             :     {
    1948           0 :         aStr.AppendAscii( "<p><a href=\"" );
    1949           0 :         aStr += StringToURL(maDocFileName);
    1950           0 :         aStr.AppendAscii( "\">" );
    1951           0 :         aStr += RESTOHTML(STR_HTMLEXP_DOWNLOAD);
    1952           0 :         aStr.AppendAscii( "</a></p>\r\n" );
    1953             :     }
    1954             : 
    1955           0 :     for(sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
    1956             :     {
    1957           0 :         String aText;
    1958             : 
    1959           0 :         aText.AppendAscii( "<img src=\"" );
    1960           0 :         aText += StringToURL( *mpThumbnailFiles[nSdPage] );
    1961           0 :         aText.AppendAscii( "\" width=\"256\" height=\"192\" alt=\"" );
    1962           0 :         aText += StringToHTMLString( *mpPageNames[nSdPage] );
    1963           0 :         aText.AppendAscii( "\">" );
    1964             : 
    1965           0 :         aStr += CreateLink(*mpHTMLFiles[nSdPage], aText);
    1966           0 :         aStr.AppendAscii( "\r\n" );
    1967           0 :     }
    1968             : 
    1969             : 
    1970           0 :     aStr.AppendAscii( "</td></tr></table></center>\r\n" );
    1971             : 
    1972           0 :     aStr.AppendAscii( "</body>\r\n</html>" );
    1973             : 
    1974           0 :     bool bOk = WriteHtml( maIndex, false, aStr );
    1975             : 
    1976           0 :     if (mpProgress)
    1977           0 :         mpProgress->SetState(++mnPagesWritten);
    1978             : 
    1979           0 :     return bOk;
    1980             : }
    1981             : 
    1982             : // =====================================================================
    1983             : // Notiz Seiten erzeugen (fuer Frames)
    1984             : // =====================================================================
    1985           0 : bool HtmlExport::CreateNotesPages()
    1986             : {
    1987           0 :     bool bOk = true;
    1988             : 
    1989           0 :     SdrOutliner* pOutliner = mpDoc->GetInternalOutliner();
    1990           0 :     for( sal_uInt16 nSdPage = 0; bOk && nSdPage < mnSdPageCount; nSdPage++ )
    1991             :     {
    1992           0 :         SdPage* pPage = maNotesPages[nSdPage];
    1993           0 :         if( mbDocColors )
    1994           0 :             SetDocColors( pPage );
    1995             : 
    1996             :         // Html Kopf
    1997           0 :         String aStr(maHTMLHeader);
    1998           0 :         aStr += WriteMetaCharset();
    1999           0 :         aStr.AppendAscii( "  <title>" );
    2000           0 :         aStr += StringToHTMLString(*mpPageNames[0]);
    2001           0 :         aStr.AppendAscii( "</title>\r\n</head>\r\n" );
    2002           0 :         aStr += CreateBodyTag();
    2003             : 
    2004           0 :         if(pPage)
    2005           0 :             aStr += CreateTextForNotesPage( pOutliner, pPage, true, maBackColor );
    2006             : 
    2007           0 :         aStr.AppendAscii( "</body>\r\n</html>" );
    2008             : 
    2009           0 :         OUString aFileName( "note" );
    2010           0 :         aFileName += OUString::valueOf(nSdPage);
    2011           0 :         bOk = WriteHtml( aFileName, true, aStr );
    2012             : 
    2013             : 
    2014             : 
    2015           0 :         if (mpProgress)
    2016           0 :             mpProgress->SetState(++mnPagesWritten);
    2017           0 :     }
    2018             : 
    2019           0 :     pOutliner->Clear();
    2020             : 
    2021           0 :     return bOk;
    2022             : }
    2023             : 
    2024             : // =====================================================================
    2025             : // Outline Seiten erzeugen (fuer Frames)
    2026             : // =====================================================================
    2027           0 : bool HtmlExport::CreateOutlinePages()
    2028             : {
    2029           0 :     bool bOk = true;
    2030             : 
    2031           0 :     if( mbDocColors )
    2032             :     {
    2033           0 :         SetDocColors();
    2034             :     }
    2035             : 
    2036             :     // Seite 0 wird der zugeklappte Outline, Seite 1 der aufgeklappte
    2037           0 :     for (sal_Int32 nPage = 0; nPage < (mbImpress?2:1) && bOk; ++nPage)
    2038             :     {
    2039             :         // Html Kopf
    2040           0 :         String aStr(maHTMLHeader);
    2041           0 :         aStr += WriteMetaCharset();
    2042           0 :         aStr.AppendAscii( "  <title>" );
    2043           0 :         aStr += StringToHTMLString(*mpPageNames[0]);
    2044           0 :         aStr.AppendAscii( "</title>\r\n</head>\r\n" );
    2045           0 :         aStr += CreateBodyTag();
    2046             : 
    2047           0 :         SdrOutliner* pOutliner = mpDoc->GetInternalOutliner();
    2048           0 :         for(sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
    2049             :         {
    2050           0 :             SdPage* pPage = maPages[ nSdPage ];
    2051             : 
    2052           0 :             aStr.AppendAscii( "<div align=\"left\">" );
    2053           0 :             String aLink( RTL_CONSTASCII_USTRINGPARAM( "JavaScript:parent.NavigateAbs(" ) );
    2054           0 :             aLink += String::CreateFromInt32(nSdPage);
    2055           0 :             aLink.Append( sal_Unicode(')') );
    2056             : 
    2057           0 :             String aTitle = CreateTextForTitle(pOutliner,pPage, maBackColor);
    2058           0 :             if(aTitle.Len() == 0)
    2059           0 :                 aTitle = *mpPageNames[nSdPage];
    2060             : 
    2061           0 :             aStr.AppendAscii("<p style=\"");
    2062           0 :             aStr.Append( getParagraphStyle( pOutliner, 0 ) );
    2063           0 :             aStr.AppendAscii("\">");
    2064           0 :             aStr += CreateLink(aLink, aTitle);
    2065           0 :             aStr.AppendAscii("</p>");
    2066             : 
    2067           0 :             if(nPage==1)
    2068             :             {
    2069           0 :                 aStr += CreateTextForPage( pOutliner, pPage, false, maBackColor );
    2070             :             }
    2071           0 :             aStr.AppendAscii( "</div>\r\n" );
    2072           0 :         }
    2073           0 :         pOutliner->Clear();
    2074             : 
    2075           0 :         aStr.AppendAscii( "</body>\r\n</html>" );
    2076             : 
    2077           0 :         OUString aFileName( "outline" );
    2078           0 :         aFileName += OUString::valueOf(nPage);
    2079           0 :         bOk = WriteHtml( aFileName, true, aStr );
    2080             : 
    2081           0 :         if (mpProgress)
    2082           0 :             mpProgress->SetState(++mnPagesWritten);
    2083           0 :     }
    2084             : 
    2085           0 :     return bOk;
    2086             : }
    2087             : 
    2088             : // =====================================================================
    2089             : // Dateinamen festlegen
    2090             : // =====================================================================
    2091           0 : void HtmlExport::CreateFileNames()
    2092             : {
    2093             :     // Listen mit neuen Dateinamen anlegen
    2094           0 :     mpHTMLFiles = new String*[mnSdPageCount];
    2095           0 :     mpImageFiles = new String*[mnSdPageCount];
    2096           0 :     mpThumbnailFiles = new String*[mnSdPageCount];
    2097           0 :     mpPageNames = new String*[mnSdPageCount];
    2098           0 :     mpTextFiles = new String*[mnSdPageCount];
    2099             : 
    2100           0 :     mbHeader = false;   // Ueberschrift auf Uebersichtsseite?
    2101             : 
    2102           0 :     for (sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
    2103             :     {
    2104             :         String* pName;
    2105           0 :         if(nSdPage == 0 && !mbContentsPage && !mbFrames )
    2106           0 :             pName = new String(maIndex);
    2107             :         else
    2108             :         {
    2109           0 :             pName = new String( RTL_CONSTASCII_USTRINGPARAM("img") );
    2110           0 :             *pName += String::CreateFromInt32(nSdPage);
    2111           0 :             *pName += maHTMLExtension;
    2112             :         }
    2113             : 
    2114           0 :         mpHTMLFiles[nSdPage] = pName;
    2115             : 
    2116           0 :         pName = new String( RTL_CONSTASCII_USTRINGPARAM("img") );
    2117           0 :         *pName += String::CreateFromInt32(nSdPage);
    2118           0 :         if( meFormat==FORMAT_GIF )
    2119           0 :             pName->AppendAscii( ".gif" );
    2120           0 :         else if( meFormat==FORMAT_JPG )
    2121           0 :             pName->AppendAscii( ".jpg" );
    2122             :         else
    2123           0 :             pName->AppendAscii( ".png" );
    2124             : 
    2125           0 :         mpImageFiles[nSdPage] = pName;
    2126             : 
    2127           0 :         pName = new String( RTL_CONSTASCII_USTRINGPARAM("thumb") );
    2128           0 :         *pName += String::CreateFromInt32(nSdPage);
    2129           0 :         if( meFormat!=FORMAT_JPG )
    2130           0 :             pName->AppendAscii( ".png" );
    2131             :         else
    2132           0 :             pName->AppendAscii( ".jpg" );
    2133             : 
    2134           0 :         mpThumbnailFiles[nSdPage] = pName;
    2135             : 
    2136           0 :         pName = new String( RTL_CONSTASCII_USTRINGPARAM("text"));
    2137           0 :         *pName += String::CreateFromInt32(nSdPage);
    2138           0 :         *pName += maHTMLExtension;
    2139           0 :         mpTextFiles[nSdPage] = pName;
    2140             : 
    2141           0 :         SdPage* pSdPage = maPages[ nSdPage ];
    2142             : 
    2143             :         // get slide title from page name
    2144           0 :         String* pPageTitle = new String();
    2145           0 :         *pPageTitle = pSdPage->GetName();
    2146           0 :         mpPageNames[nSdPage] = pPageTitle;
    2147             :     }
    2148             : 
    2149           0 :     if(!mbContentsPage && mbFrames)
    2150           0 :         maFramePage = maIndex;
    2151             :     else
    2152             :     {
    2153           0 :         maFramePage.AssignAscii( "siframes" );
    2154           0 :         maFramePage += maHTMLExtension;
    2155             :     }
    2156           0 : }
    2157             : 
    2158           0 : String HtmlExport::getDocumentTitle()
    2159             : {
    2160             :     // check for a title object in this page, if its the first
    2161             :     // title it becomes this documents title for the content
    2162             :     // page
    2163           0 :     if( !mbHeader )
    2164             :     {
    2165           0 :         if(mbImpress)
    2166             :         {
    2167             :             // falls es ein nicht-leeres Titelobjekt gibt, dessen ersten Absatz
    2168             :             // als Seitentitel benutzen
    2169           0 :             SdPage* pSdPage = mpDoc->GetSdPage(0, PK_STANDARD);
    2170           0 :             SdrObject* pTitleObj = pSdPage->GetPresObj(PRESOBJ_TITLE);
    2171           0 :             if (pTitleObj && !pTitleObj->IsEmptyPresObj())
    2172             :             {
    2173           0 :                 OutlinerParaObject* pParaObject = pTitleObj->GetOutlinerParaObject();
    2174           0 :                 if (pParaObject)
    2175             :                 {
    2176             :                     const EditTextObject& rEditTextObject =
    2177           0 :                         pParaObject->GetTextObject();
    2178           0 :                     if (&rEditTextObject)
    2179             :                     {
    2180           0 :                         String aTest(rEditTextObject.GetText(0));
    2181           0 :                         if (aTest.Len() > 0)
    2182           0 :                             mDocTitle = aTest;
    2183             :                     }
    2184             :                 }
    2185             :             }
    2186             : 
    2187           0 :             for( sal_uInt16 i = 0; i < mDocTitle.Len(); i++ )
    2188           0 :                 if( mDocTitle.GetChar(i) == (sal_Unicode)0xff)
    2189           0 :                     mDocTitle.SetChar(i, sal_Unicode(' ') );
    2190             :         }
    2191             : 
    2192           0 :         if( !mDocTitle.Len() )
    2193             :         {
    2194           0 :             mDocTitle = maDocFileName;
    2195           0 :             int nDot = mDocTitle.Search( '.' );
    2196           0 :             if( nDot > 0 )
    2197           0 :                 mDocTitle.Erase( (sal_uInt16)nDot );
    2198             :         }
    2199           0 :         mbHeader = true;
    2200             :     }
    2201             : 
    2202           0 :     return mDocTitle;
    2203             : }
    2204             : 
    2205             : static const char* JS_NavigateAbs =
    2206             :     "function NavigateAbs( nPage )\r\n"
    2207             :     "{\r\n"
    2208             :     "  frames[\"show\"].location.href = \"img\" + nPage + \".$EXT\";\r\n"
    2209             :     "  //frames[\"notes\"].location.href = \"note\" + nPage + \".$EXT\";\r\n"
    2210             :     "  nCurrentPage = nPage;\r\n"
    2211             :     "  if(nCurrentPage==0)\r\n"
    2212             :     "  {\r\n"
    2213             :     "    frames[\"navbar1\"].location.href = \"navbar0.$EXT\";\r\n"
    2214             :     "  }\r\n"
    2215             :     "  else if(nCurrentPage==nPageCount-1)\r\n"
    2216             :     "  {\r\n"
    2217             :     "    frames[\"navbar1\"].location.href = \"navbar2.$EXT\";\r\n"
    2218             :     "  }\r\n"
    2219             :     "  else\r\n"
    2220             :     "  {\r\n"
    2221             :     "    frames[\"navbar1\"].location.href = \"navbar1.$EXT\";\r\n"
    2222             :     "  }\r\n"
    2223             :     "}\r\n\r\n";
    2224             : 
    2225             : static const char* JS_NavigateRel =
    2226             :     "function NavigateRel( nDelta )\r\n"
    2227             :     "{\r\n"
    2228             :     "  var nPage = parseInt(nCurrentPage) + parseInt(nDelta);\r\n"
    2229             :     "  if( (nPage >= 0) && (nPage < nPageCount) )\r\n"
    2230             :     "  {\r\n"
    2231             :     "    NavigateAbs( nPage );\r\n"
    2232             :     "  }\r\n"
    2233             :     "}\r\n\r\n";
    2234             : 
    2235             : static const char* JS_ExpandOutline =
    2236             :     "function ExpandOutline()\r\n"
    2237             :     "{\r\n"
    2238             :     "  frames[\"navbar2\"].location.href = \"navbar4.$EXT\";\r\n"
    2239             :     "  frames[\"outline\"].location.href = \"outline1.$EXT\";\r\n"
    2240             :     "}\r\n\r\n";
    2241             : 
    2242             : static const char * JS_CollapseOutline =
    2243             :     "function CollapseOutline()\r\n"
    2244             :     "{\r\n"
    2245             :     "  frames[\"navbar2\"].location.href = \"navbar3.$EXT\";\r\n"
    2246             :     "  frames[\"outline\"].location.href = \"outline0.$EXT\";\r\n"
    2247             :     "}\r\n\r\n";
    2248             : 
    2249             : // ====================================================================
    2250             : // Seite mit den Frames erzeugen
    2251             : // ====================================================================
    2252           0 : bool HtmlExport::CreateFrames()
    2253             : {
    2254           0 :     String aTmp;
    2255             :     String aStr( RTL_CONSTASCII_USTRINGPARAM(
    2256             :                     "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\"\r\n"
    2257             :                     "    \"http://www.w3.org/TR/html4/frameset.dtd\">\r\n"
    2258           0 :             "<html>\r\n<head>\r\n" ) );
    2259             : 
    2260           0 :     aStr += WriteMetaCharset();
    2261           0 :     aStr.AppendAscii( "  <title>" );
    2262           0 :     aStr += StringToHTMLString(*mpPageNames[0]);
    2263           0 :     aStr.AppendAscii( "</title>\r\n" );
    2264             : 
    2265           0 :     aStr.AppendAscii( "<script type=\"text/javascript\">\r\n<!--\r\n" );
    2266             : 
    2267           0 :     aStr.AppendAscii( "var nCurrentPage = 0;\r\nvar nPageCount = " );
    2268           0 :     aStr += String::CreateFromInt32(mnSdPageCount);
    2269           0 :     aStr.AppendAscii( ";\r\n\r\n" );
    2270             : 
    2271           0 :     String aFunction;
    2272           0 :     aFunction.AssignAscii(JS_NavigateAbs);
    2273             : 
    2274           0 :     if(mbNotes)
    2275             :     {
    2276           0 :         String aSlash( RTL_CONSTASCII_USTRINGPARAM( "//" ) );
    2277           0 :         aFunction.SearchAndReplaceAll(aSlash, OUString());
    2278             :     }
    2279             : 
    2280             :     // substitute HTML file extension
    2281           0 :     String aPlaceHolder(RTL_CONSTASCII_USTRINGPARAM(".$EXT"));
    2282           0 :     aFunction.SearchAndReplaceAll(aPlaceHolder, maHTMLExtension);
    2283           0 :     aStr += aFunction;
    2284             : 
    2285           0 :     aTmp.AssignAscii( JS_NavigateRel );
    2286           0 :     aTmp.SearchAndReplaceAll(aPlaceHolder, maHTMLExtension);
    2287           0 :     aStr += aTmp;
    2288             : 
    2289           0 :     if(mbImpress)
    2290             :     {
    2291           0 :         aTmp.AssignAscii( JS_ExpandOutline );
    2292           0 :         aTmp.SearchAndReplaceAll(aPlaceHolder, maHTMLExtension);
    2293           0 :         aStr += aTmp;
    2294             : 
    2295           0 :         aTmp.AssignAscii( JS_CollapseOutline );
    2296           0 :         aTmp.SearchAndReplaceAll(aPlaceHolder, maHTMLExtension);
    2297           0 :         aStr += aTmp;
    2298             :     }
    2299           0 :     aStr.AppendAscii( "// -->\r\n</script>\r\n" );
    2300             : 
    2301           0 :     aStr.AppendAscii( "</head>\r\n" );
    2302             : 
    2303           0 :     aStr.AppendAscii( "<frameset cols=\"*," );
    2304           0 :     aStr += String::CreateFromInt32((mnWidthPixel + 16));
    2305           0 :     aStr.AppendAscii( "\">\r\n" );
    2306           0 :     if(mbImpress)
    2307             :     {
    2308           0 :         aStr.AppendAscii( "  <frameset rows=\"42,*\">\r\n" );
    2309           0 :         aStr.AppendAscii( "    <frame src=\"navbar3" );
    2310           0 :         aStr += StringToURL(maHTMLExtension);
    2311           0 :         aStr.AppendAscii( "\" name=\"navbar2\" marginwidth=\"4\" marginheight=\"4\" scrolling=\"no\">\r\n" );
    2312             :     }
    2313           0 :     aStr.AppendAscii( "    <frame src=\"outline0" );
    2314           0 :     aStr += StringToURL(maHTMLExtension);
    2315           0 :     aStr.AppendAscii( "\" name=\"outline\">\r\n" );
    2316           0 :     if(mbImpress)
    2317           0 :         aStr.AppendAscii( "  </frameset>\r\n" );
    2318             : 
    2319           0 :     if(mbNotes)
    2320             :     {
    2321           0 :         aStr.AppendAscii( "  <frameset rows=\"42," );
    2322           0 :         aStr += String::CreateFromInt32((int)((double)mnWidthPixel * 0.75) + 16);
    2323           0 :         aStr.AppendAscii( ",*\">\r\n" );
    2324             :     }
    2325             :     else
    2326           0 :         aStr.AppendAscii( "  <frameset rows=\"42,*\">\r\n" );
    2327             : 
    2328           0 :     aStr.AppendAscii( "    <frame src=\"navbar0" );
    2329           0 :     aStr += StringToURL(maHTMLExtension);
    2330           0 :     aStr.AppendAscii( "\" name=\"navbar1\" marginwidth=\"4\" marginheight=\"4\" scrolling=\"no\">\r\n" );
    2331             : 
    2332           0 :     aStr.AppendAscii( "    <frame src=\"" );
    2333           0 :     aStr += StringToURL(*mpHTMLFiles[0]);
    2334           0 :     aStr.AppendAscii( "\" name=\"show\" marginwidth=\"4\" marginheight=\"4\">\r\n" );
    2335             : 
    2336           0 :     if(mbNotes)
    2337             :     {
    2338           0 :         aStr.AppendAscii( "    <frame src=\"note0" );
    2339           0 :         aStr += StringToURL(maHTMLExtension);
    2340           0 :         aStr.AppendAscii( "\" name=\"notes\">\r\n" );
    2341             :     }
    2342           0 :     aStr.AppendAscii( "  </frameset>\r\n" );
    2343             : 
    2344           0 :     aStr.AppendAscii( "<noframes>\r\n" );
    2345           0 :     aStr += CreateBodyTag();
    2346           0 :     aStr += RESTOHTML(STR_HTMLEXP_NOFRAMES);
    2347           0 :     aStr.AppendAscii( "\r\n</noframes>\r\n</frameset>\r\n</html>" );
    2348             : 
    2349           0 :     bool bOk = WriteHtml( maFramePage, false, aStr );
    2350             : 
    2351           0 :     if (mpProgress)
    2352           0 :         mpProgress->SetState(++mnPagesWritten);
    2353             : 
    2354           0 :     return bOk;
    2355             : }
    2356             : 
    2357             : // ====================================================================
    2358             : // Buttonleiste fuer Standard ausgeben
    2359             : // Es werden 4 html files erstellt
    2360             : // navbar0.htm Navigationsleiste Grafik fuer erste Seite
    2361             : // navbar1.htm Navigationsleiste Grafik fuer zweite bis vorletzte Seite
    2362             : // navbar2.htm Navigationsleiste Grafik fuer letzte Seite
    2363             : // navbar3.htm Navigationsleiste Outline zugeklappt
    2364             : // navbar4.htm Navigationsleiste Outline aufgeklappt
    2365             : // ====================================================================
    2366           0 : bool HtmlExport::CreateNavBarFrames()
    2367             : {
    2368           0 :     bool bOk = true;
    2369           0 :     String aButton;
    2370             : 
    2371           0 :     if( mbDocColors )
    2372             :     {
    2373           0 :         SetDocColors();
    2374           0 :         maBackColor = maFirstPageColor;
    2375             :     }
    2376             : 
    2377           0 :     for( int nFile = 0; nFile < 3 && bOk; nFile++ )
    2378             :     {
    2379           0 :         String aStr(maHTMLHeader);
    2380           0 :         aStr += WriteMetaCharset();
    2381           0 :         aStr.AppendAscii( "  <title>" );
    2382           0 :         aStr += StringToHTMLString(*mpPageNames[0]);
    2383           0 :         aStr.AppendAscii( "</title>\r\n</head>\r\n" );
    2384           0 :         aStr += CreateBodyTag();
    2385           0 :         aStr.AppendAscii( "<center>\r\n" );
    2386             : 
    2387             :     // erste Seite
    2388           0 :         aButton = String(SdResId(STR_HTMLEXP_FIRSTPAGE));
    2389           0 :         if(mnButtonThema != -1)
    2390             :             aButton = CreateImage(GetButtonName((nFile == 0 || mnSdPageCount == 1?
    2391           0 :                                   BTN_FIRST_0:BTN_FIRST_1)), aButton);
    2392             : 
    2393           0 :         if(nFile != 0 && mnSdPageCount > 1)
    2394           0 :             aButton = CreateLink( String(RTL_CONSTASCII_USTRINGPARAM("JavaScript:parent.NavigateAbs(0)")), aButton);
    2395             : 
    2396           0 :         aStr += aButton;
    2397           0 :         aStr.AppendAscii( "\r\n" );
    2398             : 
    2399             :     // zur vorherigen Seite
    2400           0 :         aButton = String(SdResId(STR_PUBLISH_BACK));
    2401           0 :         if(mnButtonThema != -1)
    2402             :             aButton = CreateImage(GetButtonName((nFile == 0 || mnSdPageCount == 1?
    2403           0 :                                     BTN_PREV_0:BTN_PREV_1)), aButton);
    2404             : 
    2405           0 :         if(nFile != 0 && mnSdPageCount > 1)
    2406           0 :             aButton = CreateLink( String(RTL_CONSTASCII_USTRINGPARAM("JavaScript:parent.NavigateRel(-1)")), aButton);
    2407             : 
    2408           0 :         aStr += aButton;
    2409           0 :         aStr.AppendAscii( "\r\n" );
    2410             : 
    2411             :     // zur naechsten Seite
    2412           0 :         aButton = String(SdResId(STR_PUBLISH_NEXT));
    2413           0 :         if(mnButtonThema != -1)
    2414             :             aButton = CreateImage(GetButtonName((nFile ==2 || mnSdPageCount == 1?
    2415           0 :                                     BTN_NEXT_0:BTN_NEXT_1)), aButton);
    2416             : 
    2417           0 :         if(nFile != 2 && mnSdPageCount > 1)
    2418           0 :             aButton = CreateLink(String(RTL_CONSTASCII_USTRINGPARAM("JavaScript:parent.NavigateRel(1)")), aButton);
    2419             : 
    2420           0 :         aStr += aButton;
    2421           0 :         aStr.AppendAscii( "\r\n" );
    2422             : 
    2423             :     // zur letzten Seite
    2424           0 :         aButton = String(SdResId(STR_HTMLEXP_LASTPAGE));
    2425           0 :         if(mnButtonThema != -1)
    2426             :             aButton = CreateImage(GetButtonName((nFile ==2 || mnSdPageCount == 1?
    2427           0 :                                   BTN_LAST_0:BTN_LAST_1)), aButton);
    2428             : 
    2429           0 :         if(nFile != 2 && mnSdPageCount > 1)
    2430             :         {
    2431           0 :             String aLink(RTL_CONSTASCII_USTRINGPARAM("JavaScript:parent.NavigateAbs("));
    2432           0 :             aLink += String::CreateFromInt32(mnSdPageCount-1);
    2433           0 :             aLink.AppendAscii( ")" );
    2434           0 :             aButton = CreateLink( aLink, aButton);
    2435             :         }
    2436             : 
    2437           0 :         aStr += aButton;
    2438           0 :         aStr.AppendAscii( "\r\n" );
    2439             : 
    2440             :     // Inhalt
    2441           0 :         if (mbContentsPage)
    2442             :         {
    2443           0 :             aButton = String(SdResId(STR_PUBLISH_OUTLINE));
    2444           0 :             if(mnButtonThema != -1)
    2445           0 :                 aButton = CreateImage(GetButtonName(BTN_INDEX), aButton);
    2446             : 
    2447             :             // zur Uebersicht
    2448           0 :             aStr += CreateLink(maIndex, aButton, String(RTL_CONSTASCII_USTRINGPARAM("_top")));
    2449           0 :             aStr.AppendAscii( "\r\n" );
    2450             :         }
    2451             : 
    2452             :     // Textmodus
    2453           0 :         if(mbImpress)
    2454             :         {
    2455           0 :             aButton = String(SdResId(STR_HTMLEXP_SETTEXT));
    2456           0 :             if(mnButtonThema != -1)
    2457           0 :                 aButton = CreateImage(GetButtonName(BTN_TEXT), aButton);
    2458             : 
    2459           0 :             String  aText0( RTL_CONSTASCII_USTRINGPARAM("text0"));
    2460           0 :             aText0 += maHTMLExtension;
    2461           0 :             aStr += CreateLink( aText0, aButton, String(RTL_CONSTASCII_USTRINGPARAM("_top")));
    2462           0 :             aStr.AppendAscii( "\r\n" );
    2463             :         }
    2464             : 
    2465             :     // Und fertich...
    2466           0 :         aStr.AppendAscii( "</center>\r\n" );
    2467           0 :         aStr.AppendAscii( "</body>\r\n</html>" );
    2468             : 
    2469           0 :         String aFileName( RTL_CONSTASCII_USTRINGPARAM("navbar") );
    2470           0 :         aFileName += String::CreateFromInt32(nFile);
    2471             : 
    2472           0 :         bOk = WriteHtml( aFileName, true, aStr );
    2473             : 
    2474           0 :         if (mpProgress)
    2475           0 :             mpProgress->SetState(++mnPagesWritten);
    2476           0 :     }
    2477             : 
    2478             :     // Jetzt kommt die Navigatonsleiste Outliner zugeklappt...
    2479           0 :     if(bOk)
    2480             :     {
    2481           0 :         String aStr(maHTMLHeader);
    2482           0 :         aStr += WriteMetaCharset();
    2483           0 :         aStr.AppendAscii( "  <title>" );
    2484           0 :         aStr += StringToHTMLString(*mpPageNames[0]);
    2485           0 :         aStr.AppendAscii( "</title>\r\n</head>\r\n" );
    2486           0 :         aStr += CreateBodyTag();
    2487             : 
    2488           0 :         aButton = String(SdResId(STR_HTMLEXP_OUTLINE));
    2489           0 :         if(mnButtonThema != -1)
    2490           0 :             aButton = CreateImage(GetButtonName(BTN_MORE), aButton);
    2491             : 
    2492           0 :         aStr += CreateLink(String(RTL_CONSTASCII_USTRINGPARAM("JavaScript:parent.ExpandOutline()")), aButton);
    2493           0 :         aStr.AppendAscii( "</body>\r\n</html>" );
    2494             : 
    2495           0 :         String aFileName( RTL_CONSTASCII_USTRINGPARAM("navbar3") );
    2496             : 
    2497           0 :         bOk = WriteHtml( aFileName, true, aStr );
    2498             : 
    2499           0 :         if (mpProgress)
    2500           0 :             mpProgress->SetState(++mnPagesWritten);
    2501             :     }
    2502             : 
    2503             :     // ... und jetzt Outliner aufgeklappt
    2504           0 :     if( bOk )
    2505             :     {
    2506           0 :         String aStr(maHTMLHeader);
    2507           0 :         aStr += WriteMetaCharset();
    2508           0 :         aStr.AppendAscii( "  <title>" );
    2509           0 :         aStr += StringToHTMLString(*mpPageNames[0]);
    2510           0 :         aStr.AppendAscii( "</title>\r\n</head>\r\n" );
    2511           0 :         aStr += CreateBodyTag();
    2512             : 
    2513           0 :         aButton = String(SdResId(STR_HTMLEXP_NOOUTLINE));
    2514           0 :         if(mnButtonThema != -1)
    2515           0 :             aButton = CreateImage(GetButtonName(BTN_LESS), aButton);
    2516             : 
    2517           0 :         aStr += CreateLink(String(RTL_CONSTASCII_USTRINGPARAM("JavaScript:parent.CollapseOutline()")), aButton);
    2518           0 :         aStr.AppendAscii( "</body>\r\n</html>" );
    2519             : 
    2520           0 :         String aFileName( RTL_CONSTASCII_USTRINGPARAM("navbar4") );
    2521           0 :         bOk = WriteHtml( aFileName, true, aStr );
    2522             : 
    2523           0 :         if (mpProgress)
    2524           0 :             mpProgress->SetState(++mnPagesWritten);
    2525             : 
    2526             :     }
    2527             : 
    2528           0 :     return bOk;
    2529             : }
    2530             : 
    2531             : // ====================================================================
    2532             : // Buttonleiste fuer Standard ausgeben
    2533             : // ====================================================================
    2534           0 : String HtmlExport::CreateNavBar( sal_uInt16 nSdPage, bool bIsText ) const
    2535             : {
    2536             :     // Navigationsleiste vorbereiten
    2537           0 :     String aStrNavFirst( SdResId(STR_HTMLEXP_FIRSTPAGE) );
    2538           0 :     String aStrNavPrev( SdResId(STR_PUBLISH_BACK) );
    2539           0 :     String aStrNavNext( SdResId(STR_PUBLISH_NEXT) );
    2540           0 :     String aStrNavLast( SdResId(STR_HTMLEXP_LASTPAGE) );
    2541           0 :     String aStrNavContent( SdResId(STR_PUBLISH_OUTLINE) );
    2542           0 :     String aStrNavText;
    2543           0 :     if( bIsText )
    2544             :     {
    2545           0 :         aStrNavText = String( SdResId(STR_HTMLEXP_SETGRAPHIC) );
    2546             :     }
    2547             :     else
    2548             :     {
    2549           0 :         aStrNavText = String( SdResId(STR_HTMLEXP_SETTEXT) );
    2550             :     }
    2551             : 
    2552           0 :     if(!bIsText && mnButtonThema != -1)
    2553             :     {
    2554           0 :         if(nSdPage<1 || mnSdPageCount == 1)
    2555             :         {
    2556           0 :             aStrNavFirst = CreateImage(GetButtonName(BTN_FIRST_0), aStrNavFirst);
    2557           0 :             aStrNavPrev  = CreateImage(GetButtonName(BTN_PREV_0), aStrNavPrev);
    2558             :         }
    2559             :         else
    2560             :         {
    2561           0 :             aStrNavFirst = CreateImage(GetButtonName(BTN_FIRST_1), aStrNavFirst);
    2562           0 :             aStrNavPrev  = CreateImage(GetButtonName(BTN_PREV_1), aStrNavPrev);
    2563             :         }
    2564             : 
    2565           0 :         if(nSdPage == mnSdPageCount-1 || mnSdPageCount == 1)
    2566             :         {
    2567           0 :             aStrNavNext    = CreateImage(GetButtonName(BTN_NEXT_0), aStrNavNext);
    2568           0 :             aStrNavLast    = CreateImage(GetButtonName(BTN_LAST_0), aStrNavLast);
    2569             :         }
    2570             :         else
    2571             :         {
    2572           0 :             aStrNavNext    = CreateImage(GetButtonName(BTN_NEXT_1), aStrNavNext);
    2573           0 :             aStrNavLast    = CreateImage(GetButtonName(BTN_LAST_1), aStrNavLast);
    2574             :         }
    2575             : 
    2576           0 :         aStrNavContent = CreateImage(GetButtonName(BTN_INDEX), aStrNavContent);
    2577           0 :         aStrNavText    = CreateImage(GetButtonName(BTN_TEXT), aStrNavText);
    2578             :     }
    2579             : 
    2580           0 :     String aStr( RTL_CONSTASCII_USTRINGPARAM("<center>\r\n")); //<table><tr>\r\n");
    2581             : 
    2582             :     // erste Seite
    2583           0 :     if(nSdPage > 0)
    2584           0 :         aStr += CreateLink(bIsText?*mpTextFiles[0]:*mpHTMLFiles[0],aStrNavFirst);
    2585             :     else
    2586           0 :         aStr += aStrNavFirst;
    2587           0 :     aStr.Append(sal_Unicode(' '));
    2588             : 
    2589             :     // to Previous page
    2590           0 :     if(nSdPage > 0)
    2591           0 :         aStr += CreateLink( bIsText?*mpTextFiles[nSdPage-1]:
    2592           0 :                                     *mpHTMLFiles[nSdPage-1],    aStrNavPrev);
    2593             :     else
    2594           0 :         aStr += aStrNavPrev;
    2595           0 :     aStr.Append(sal_Unicode(' '));
    2596             : 
    2597             :     // to Next page
    2598           0 :     if(nSdPage < mnSdPageCount-1)
    2599           0 :         aStr += CreateLink( bIsText?*mpTextFiles[nSdPage+1]:
    2600           0 :                                     *mpHTMLFiles[nSdPage+1], aStrNavNext);
    2601             :     else
    2602           0 :         aStr += aStrNavNext;
    2603           0 :     aStr.Append(sal_Unicode(' '));
    2604             : 
    2605             :     // to Last page
    2606           0 :     if(nSdPage < mnSdPageCount-1)
    2607           0 :         aStr += CreateLink( bIsText?*mpTextFiles[mnSdPageCount-1]:
    2608           0 :                                     *mpHTMLFiles[mnSdPageCount-1],
    2609           0 :                                     aStrNavLast );
    2610             :     else
    2611           0 :         aStr += aStrNavLast;
    2612           0 :     aStr.Append(sal_Unicode(' '));
    2613             : 
    2614             :     // to Index page
    2615           0 :     if (mbContentsPage)
    2616             :     {
    2617           0 :         aStr += CreateLink(maIndex, aStrNavContent);
    2618           0 :         aStr.Append(sal_Unicode(' '));
    2619             :     }
    2620             : 
    2621             :     // Text/Graphics
    2622           0 :     if(mbImpress)
    2623             :     {
    2624           0 :         aStr += CreateLink( bIsText?(mbFrames?maFramePage:*mpHTMLFiles[nSdPage]):
    2625           0 :                                     *mpTextFiles[nSdPage], aStrNavText);
    2626             : 
    2627             :     }
    2628             : 
    2629           0 :     aStr.AppendAscii( "</center><br>\r\n" );
    2630             : 
    2631           0 :     return aStr;
    2632             : }
    2633             : 
    2634             : /** export navigation graphics from button set */
    2635           0 : bool HtmlExport::CreateBitmaps()
    2636             : {
    2637           0 :     if(mnButtonThema != -1 && mpButtonSet.get() )
    2638             :     {
    2639           0 :         for( int nButton = 0; nButton < NUM_BUTTONS; nButton++ )
    2640             :         {
    2641           0 :             if(!mbFrames && (nButton == BTN_MORE || nButton == BTN_LESS))
    2642           0 :                 continue;
    2643             : 
    2644           0 :             if(!mbImpress && (nButton == BTN_TEXT || nButton == BTN_MORE || nButton == BTN_LESS ))
    2645           0 :                 continue;
    2646             : 
    2647           0 :             OUString aFull(maExportPath);
    2648           0 :             aFull += GetButtonName(nButton);
    2649           0 :             mpButtonSet->exportButton( mnButtonThema, aFull, GetButtonName(nButton) );
    2650           0 :         }
    2651             :     }
    2652           0 :     return true;
    2653             : }
    2654             : 
    2655             : // =====================================================================
    2656             : // Erzeugt den <body> Tag, inkl. der eingestellten Farbattribute
    2657             : // =====================================================================
    2658           0 : String HtmlExport::CreateBodyTag() const
    2659             : {
    2660           0 :     String aStr( RTL_CONSTASCII_USTRINGPARAM("<body") );
    2661             : 
    2662           0 :     if( mbUserAttr || mbDocColors )
    2663             :     {
    2664           0 :         Color aTextColor( maTextColor );
    2665           0 :         if( (aTextColor == COL_AUTO) && (!maBackColor.IsDark()) )
    2666           0 :             aTextColor = COL_BLACK;
    2667             : 
    2668           0 :         aStr.AppendAscii( " text=\"" );
    2669           0 :         aStr += ColorToHTMLString( aTextColor );
    2670           0 :         aStr.AppendAscii( "\" bgcolor=\"" );
    2671           0 :         aStr += ColorToHTMLString( maBackColor );
    2672           0 :         aStr.AppendAscii( "\" link=\"" );
    2673           0 :         aStr += ColorToHTMLString( maLinkColor );
    2674           0 :         aStr.AppendAscii( "\" vlink=\"" );
    2675           0 :         aStr += ColorToHTMLString( maVLinkColor );
    2676           0 :         aStr.AppendAscii( "\" alink=\"" );
    2677           0 :         aStr += ColorToHTMLString( maALinkColor );
    2678           0 :         aStr.AppendAscii( "\"" );
    2679             :     }
    2680             : 
    2681           0 :     aStr.AppendAscii( ">\r\n" );
    2682             : 
    2683           0 :     return aStr;
    2684             : }
    2685             : 
    2686             : // =====================================================================
    2687             : // Erzeugt einen Hyperlink
    2688             : // =====================================================================
    2689           0 : String HtmlExport::CreateLink( const String& aLink,
    2690             :                                const String& aText,
    2691             :                                const String& aTarget ) const
    2692             : {
    2693           0 :     String aStr( RTL_CONSTASCII_USTRINGPARAM("<a href=\""));
    2694           0 :     aStr += StringToURL(aLink);
    2695           0 :     if(aTarget.Len())
    2696             :     {
    2697           0 :         aStr.AppendAscii( "\" target=\"" );
    2698           0 :         aStr += aTarget;
    2699             :     }
    2700           0 :     aStr.AppendAscii( "\">" );
    2701           0 :     aStr += aText;
    2702           0 :     aStr.AppendAscii( "</a>" );
    2703             : 
    2704           0 :     return aStr;
    2705             : }
    2706             : 
    2707             : // =====================================================================
    2708             : // Erzeugt ein Image-tag
    2709             : // =====================================================================
    2710           0 : String HtmlExport::CreateImage( const String& aImage, const String& aAltText,
    2711             :                                 sal_Int16 nWidth,
    2712             :                                 sal_Int16 nHeight ) const
    2713             : {
    2714           0 :     String aStr( RTL_CONSTASCII_USTRINGPARAM("<img src=\""));
    2715           0 :     aStr += StringToURL(aImage);
    2716           0 :     aStr.AppendAscii( "\" border=0" );
    2717             : 
    2718           0 :     if( aAltText.Len())
    2719             :     {
    2720           0 :         aStr.AppendAscii( " alt=\"" );
    2721           0 :         aStr += aAltText;
    2722           0 :         aStr.Append(sal_Unicode('"'));
    2723             :     }
    2724             :     else
    2725             :     {
    2726             :         // Agerskov: HTML 4.01 has to have an alt attribut even if it is an empty string
    2727           0 :         aStr.AppendAscii( " alt=\"\"" );
    2728             :      }
    2729             : 
    2730           0 :     if(nWidth > -1)
    2731             :     {
    2732           0 :         aStr.AppendAscii( " width=" );
    2733           0 :         aStr += String::CreateFromInt32(nWidth);
    2734             :     }
    2735             : 
    2736           0 :     if(nHeight > -1)
    2737             :     {
    2738           0 :         aStr.AppendAscii( " height=" );
    2739           0 :         aStr += String::CreateFromInt32(nHeight);
    2740             :     }
    2741             : 
    2742           0 :     aStr.Append(sal_Unicode('>'));
    2743             : 
    2744           0 :     return aStr;
    2745             : }
    2746             : 
    2747             : // =====================================================================
    2748             : // Area fuer Kreis erzeugen; es werden Pixelkoordinaten erwartet
    2749             : // =====================================================================
    2750           0 : String HtmlExport::ColorToHTMLString( Color aColor )
    2751             : {
    2752             :     static char hex[] = "0123456789ABCDEF";
    2753           0 :     String aStr( RTL_CONSTASCII_USTRINGPARAM("#xxxxxx"));
    2754           0 :     aStr.SetChar(1, hex[(aColor.GetRed() >> 4) & 0xf] );
    2755           0 :     aStr.SetChar(2, hex[aColor.GetRed()   & 0xf] );
    2756           0 :     aStr.SetChar(3, hex[(aColor.GetGreen() >> 4) & 0xf] );
    2757           0 :     aStr.SetChar(4, hex[aColor.GetGreen() & 0xf] );
    2758           0 :     aStr.SetChar(5, hex[(aColor.GetBlue() >> 4) & 0xf] );
    2759           0 :     aStr.SetChar(6, hex[aColor.GetBlue()  & 0xf] );
    2760             : 
    2761           0 :     return aStr;
    2762             : }
    2763             : 
    2764             : // =====================================================================
    2765             : // Area fuer Kreis erzeugen; es werden Pixelkoordinaten erwartet
    2766             : // =====================================================================
    2767           0 : String HtmlExport::CreateHTMLCircleArea( sal_uLong nRadius,
    2768             :                                          sal_uLong nCenterX,
    2769             :                                          sal_uLong nCenterY,
    2770             :                                          const String& rHRef ) const
    2771             : {
    2772           0 :     String aStr( RTL_CONSTASCII_USTRINGPARAM("<area shape=\"circle\" alt=\"\" coords=\"" ));
    2773             : 
    2774           0 :     aStr += String::CreateFromInt32(nCenterX);
    2775           0 :     aStr.Append(sal_Unicode(','));
    2776           0 :     aStr += String::CreateFromInt32(nCenterY);
    2777           0 :     aStr.Append(sal_Unicode(','));
    2778           0 :     aStr += String::CreateFromInt32(nRadius);
    2779           0 :     aStr.AppendAscii( "\" href=\"" );
    2780           0 :     aStr += StringToURL(rHRef);
    2781           0 :     aStr.AppendAscii( "\">\n" );
    2782             : 
    2783           0 :     return aStr;
    2784             : }
    2785             : 
    2786             : 
    2787             : // =====================================================================
    2788             : // Area fuer Polygon erzeugen; es werden Pixelkoordinaten erwartet
    2789             : // =====================================================================
    2790           0 : String HtmlExport::CreateHTMLPolygonArea( const ::basegfx::B2DPolyPolygon& rPolyPolygon,
    2791             :     Size aShift, double fFactor, const String& rHRef ) const
    2792             : {
    2793           0 :     String          aStr;
    2794           0 :     const sal_uInt32 nNoOfPolygons(rPolyPolygon.count());
    2795             : 
    2796           0 :     for ( sal_uInt32 nXPoly = 0L; nXPoly < nNoOfPolygons; nXPoly++ )
    2797             :     {
    2798           0 :         const ::basegfx::B2DPolygon& aPolygon = rPolyPolygon.getB2DPolygon(nXPoly);
    2799           0 :         const sal_uInt32 nNoOfPoints(aPolygon.count());
    2800             : 
    2801           0 :         aStr.AppendAscii( "<area shape=\"polygon\" alt=\"\" coords=\"" );
    2802             : 
    2803           0 :         for ( sal_uInt32 nPoint = 0L; nPoint < nNoOfPoints; nPoint++ )
    2804             :         {
    2805           0 :             const ::basegfx::B2DPoint aB2DPoint(aPolygon.getB2DPoint(nPoint));
    2806           0 :             Point aPnt(FRound(aB2DPoint.getX()), FRound(aB2DPoint.getY()));
    2807             :             // das Koordinaten beziehen sich auf den
    2808             :             // physikalischen Seitenursprung, nicht auf den
    2809             :             // Koordinatenursprung
    2810           0 :             aPnt.Move(aShift.Width(), aShift.Height());
    2811             : 
    2812           0 :             aPnt.X() = (long)(aPnt.X() * fFactor);
    2813           0 :             aPnt.Y() = (long)(aPnt.Y() * fFactor);
    2814           0 :             aStr += String::CreateFromInt32(aPnt.X());
    2815           0 :             aStr.Append(sal_Unicode(','));
    2816           0 :             aStr += String::CreateFromInt32(aPnt.Y());
    2817             : 
    2818           0 :             if (nPoint < nNoOfPoints - 1)
    2819           0 :                 aStr.Append( sal_Unicode(',') );
    2820           0 :         }
    2821           0 :         aStr.AppendAscii( "\" href=\"" );
    2822           0 :         aStr += StringToURL(rHRef);
    2823           0 :         aStr.AppendAscii( "\">\n" );
    2824           0 :     }
    2825             : 
    2826           0 :     return aStr;
    2827             : }
    2828             : 
    2829             : // =====================================================================
    2830             : // Area fuer Rechteck erzeugen; es werden Pixelkoordinaten erwartet
    2831             : // =====================================================================
    2832           0 : String HtmlExport::CreateHTMLRectArea( const Rectangle& rRect,
    2833             :                                        const String& rHRef ) const
    2834             : {
    2835           0 :     String aStr( RTL_CONSTASCII_USTRINGPARAM("<area shape=\"rect\" alt=\"\" coords=\"") );
    2836             : 
    2837           0 :     aStr += String::CreateFromInt32(rRect.Left());
    2838           0 :     aStr.Append(sal_Unicode(','));
    2839           0 :     aStr += String::CreateFromInt32(rRect.Top());
    2840           0 :     aStr.Append(sal_Unicode(','));
    2841           0 :     aStr += String::CreateFromInt32(rRect.Right());
    2842           0 :     aStr.Append(sal_Unicode(','));
    2843           0 :     aStr += String::CreateFromInt32(rRect.Bottom());
    2844           0 :     aStr.AppendAscii( "\" href=\"" );
    2845           0 :     aStr += StringToURL(rHRef);
    2846           0 :     aStr.AppendAscii( "\">\n" );
    2847             : 
    2848           0 :     return aStr;
    2849             : }
    2850             : 
    2851             : // =====================================================================
    2852             : // StringToHTMLString, konvertiert einen String in
    2853             : // seine HTML-Repraesentation (Umlaute etc.)
    2854             : // =====================================================================
    2855           0 : String HtmlExport::StringToHTMLString( const String& rString )
    2856             : {
    2857           0 :     SvMemoryStream aMemStm;
    2858           0 :     HTMLOutFuncs::Out_String( aMemStm, rString, RTL_TEXTENCODING_UTF8 );
    2859           0 :     aMemStm << (char) 0;
    2860           0 :     return String( (char*)aMemStm.GetData(), RTL_TEXTENCODING_UTF8 );
    2861             : }
    2862             : 
    2863             : // =====================================================================
    2864             : // Erzeugt die URL einer bestimmten Seite
    2865             : // =====================================================================
    2866           0 : String HtmlExport::CreatePageURL( sal_uInt16 nPgNum )
    2867             : {
    2868           0 :     if(mbFrames)
    2869             :     {
    2870           0 :         String aUrl( RTL_CONSTASCII_USTRINGPARAM("JavaScript:parent.NavigateAbs("));
    2871           0 :         aUrl += String::CreateFromInt32(nPgNum);
    2872           0 :         aUrl.Append(sal_Unicode(')'));
    2873           0 :         return aUrl;
    2874             :     }
    2875             :     else
    2876           0 :         return *mpHTMLFiles[nPgNum];
    2877             : }
    2878             : 
    2879           0 : bool HtmlExport::CopyScript( const String& rPath, const String& rSource, const String& rDest, bool bUnix /* = false */ )
    2880             : {
    2881           0 :     INetURLObject   aURL( SvtPathOptions().GetConfigPath() );
    2882           0 :     String      aScript;
    2883             : 
    2884           0 :     aURL.Append( rtl::OUString("webcast") );
    2885           0 :     aURL.Append( rSource );
    2886             : 
    2887           0 :     meEC.SetContext( STR_HTMLEXP_ERROR_OPEN_FILE, rSource );
    2888             : 
    2889           0 :     sal_uLong       nErr = 0;
    2890           0 :     SvStream*   pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ );
    2891             : 
    2892           0 :     if( pIStm )
    2893             :     {
    2894           0 :         rtl::OString aLine;
    2895             : 
    2896           0 :         while( pIStm->ReadLine( aLine ) )
    2897             :         {
    2898           0 :             aScript.AppendAscii( aLine.getStr() );
    2899           0 :             if( bUnix )
    2900             :             {
    2901           0 :                 aScript.AppendAscii( "\n" );
    2902             :             }
    2903             :             else
    2904             :             {
    2905           0 :                 aScript.AppendAscii( "\r\n" );
    2906             :             }
    2907             :         }
    2908             : 
    2909           0 :         nErr = pIStm->GetError();
    2910           0 :         delete pIStm;
    2911             :     }
    2912             : 
    2913           0 :     if( nErr != 0 )
    2914             :     {
    2915           0 :         ErrorHandler::HandleError( nErr );
    2916           0 :         return (bool) nErr;
    2917             :     }
    2918             : 
    2919             : 
    2920           0 :     aScript.SearchAndReplaceAll( String(RTL_CONSTASCII_USTRINGPARAM("$$1")), getDocumentTitle() );
    2921             : 
    2922           0 :     const String aSaveStr( RESTOHTML( STR_WEBVIEW_SAVE ));
    2923           0 :     aScript.SearchAndReplaceAll( String(RTL_CONSTASCII_USTRINGPARAM("$$2")), aSaveStr );
    2924             : 
    2925           0 :     aScript.SearchAndReplaceAll( String(RTL_CONSTASCII_USTRINGPARAM("$$3")), maCGIPath );
    2926             : 
    2927           0 :     aScript.SearchAndReplaceAll( String(RTL_CONSTASCII_USTRINGPARAM("$$4")), String::CreateFromInt32(mnWidthPixel) );
    2928           0 :     aScript.SearchAndReplaceAll( String(RTL_CONSTASCII_USTRINGPARAM("$$5")), String::CreateFromInt32(mnHeightPixel) );
    2929             : 
    2930             : 
    2931           0 :     String aDest( rPath );
    2932           0 :     aDest += rDest;
    2933             : 
    2934           0 :     meEC.SetContext( STR_HTMLEXP_ERROR_CREATE_FILE, rDest );
    2935             :     // write script file
    2936             :     {
    2937           0 :         EasyFile aFile;
    2938             :         SvStream* pStr;
    2939           0 :         nErr = aFile.createStream(aDest, pStr);
    2940           0 :         if(nErr == 0)
    2941             :         {
    2942             :             rtl::OString aStr(rtl::OUStringToOString(aScript,
    2943           0 :                 RTL_TEXTENCODING_UTF8));
    2944           0 :             *pStr << aStr.getStr();
    2945             : 
    2946           0 :             nErr = aFile.close();
    2947           0 :         }
    2948             :     }
    2949             : 
    2950           0 :     if (mpProgress)
    2951           0 :         mpProgress->SetState(++mnPagesWritten);
    2952             : 
    2953           0 :     if( nErr != 0 )
    2954           0 :         ErrorHandler::HandleError( nErr );
    2955             : 
    2956           0 :     return nErr == 0;
    2957             : }
    2958             : 
    2959             : static const char * ASP_Scripts[] = { "common.inc", "webcast.asp", "show.asp", "savepic.asp", "poll.asp", "editpic.asp" };
    2960             : 
    2961             : /** erzeugt und speichert die f�r WebShow ben�tigte ASP Scripte */
    2962           0 : bool HtmlExport::CreateASPScripts()
    2963             : {
    2964           0 :     for( sal_uInt16 n = 0; n < (sizeof( ASP_Scripts ) / sizeof(char *)); n++ )
    2965             :     {
    2966           0 :         String aScript;
    2967             : 
    2968           0 :         aScript.AssignAscii( ASP_Scripts[n] );
    2969           0 :         if(!CopyScript(maExportPath, aScript, aScript))
    2970           0 :             return false;
    2971           0 :     }
    2972             : 
    2973           0 :     if(!CopyScript(maExportPath, String(RTL_CONSTASCII_USTRINGPARAM("edit.asp")), maIndex ))
    2974           0 :         return false;
    2975             : 
    2976           0 :     return true;
    2977             : }
    2978             : 
    2979             : 
    2980             : static const char *PERL_Scripts[] = { "webcast.pl", "common.pl", "editpic.pl", "poll.pl", "savepic.pl", "show.pl" };
    2981             : 
    2982             : /** erzeugt und speichert die f�r WebShow ben�tigte PERL Scripte */
    2983           0 : bool HtmlExport::CreatePERLScripts()
    2984             : {
    2985           0 :     for( sal_uInt16 n = 0; n < (sizeof( PERL_Scripts ) / sizeof(char *)); n++ )
    2986             :     {
    2987           0 :         String aScript;
    2988           0 :         aScript.AssignAscii( PERL_Scripts[n] );
    2989           0 :         if(!CopyScript(maExportPath, aScript, aScript, true))
    2990           0 :             return false;
    2991           0 :     }
    2992             : 
    2993           0 :     if(!CopyScript(maExportPath, rtl::OUString("edit.pl"), maIndex, true ))
    2994           0 :         return false;
    2995             : 
    2996           0 :     if(!CopyScript(maExportPath, rtl::OUString("index.pl"), maIndexUrl, true ))
    2997           0 :         return false;
    2998             : 
    2999           0 :     return true;
    3000             : }
    3001             : 
    3002             : /** Erzeugt eine Liste mit den Namen der gespeicherten Images */
    3003           0 : bool HtmlExport::CreateImageFileList()
    3004             : {
    3005           0 :     String aStr;
    3006           0 :     for( sal_uInt16 nSdPage = 0; nSdPage < mnSdPageCount; nSdPage++)
    3007             :     {
    3008           0 :         aStr += String::CreateFromInt32( nSdPage + 1 );
    3009           0 :         aStr.Append(sal_Unicode(';'));
    3010           0 :         aStr += maURLPath;
    3011           0 :         aStr += *mpImageFiles[nSdPage];
    3012           0 :         aStr.AppendAscii( "\r\n" );
    3013             :     }
    3014             : 
    3015           0 :     String aFileName( RTL_CONSTASCII_USTRINGPARAM("picture.txt") );
    3016           0 :     bool bOk = WriteHtml( aFileName, false, aStr );
    3017             : 
    3018           0 :     if (mpProgress)
    3019           0 :         mpProgress->SetState(++mnPagesWritten);
    3020             : 
    3021           0 :     return bOk;
    3022             : }
    3023             : 
    3024             : /** Erzeugt das File mit der aktuellen Seitennumer */
    3025           0 : bool HtmlExport::CreateImageNumberFile()
    3026             : {
    3027           0 :     String aFull( maExportPath );
    3028           0 :     String aFileName( RTL_CONSTASCII_USTRINGPARAM("currpic.txt") );
    3029           0 :     aFull += aFileName;
    3030             : 
    3031           0 :     meEC.SetContext( STR_HTMLEXP_ERROR_CREATE_FILE, aFileName );
    3032           0 :     EasyFile aFile;
    3033             :     SvStream* pStr;
    3034           0 :     sal_uLong nErr = aFile.createStream(aFull, pStr);
    3035           0 :     if(nErr == 0)
    3036             :     {
    3037           0 :         *pStr << (const char *)"1";
    3038           0 :         nErr = aFile.close();
    3039             :     }
    3040             : 
    3041           0 :     if (mpProgress)
    3042           0 :         mpProgress->SetState(++mnPagesWritten);
    3043             : 
    3044           0 :     if( nErr != 0 )
    3045           0 :         ErrorHandler::HandleError( nErr );
    3046             : 
    3047           0 :     return nErr == 0;
    3048             : }
    3049             : 
    3050             : // =====================================================================
    3051             : 
    3052           0 : String HtmlExport::InsertSound( const String& rSoundFile )
    3053             : {
    3054           0 :     if( rSoundFile.Len() == 0 )
    3055           0 :         return rSoundFile;
    3056             : 
    3057           0 :     String      aStr( RTL_CONSTASCII_USTRINGPARAM("<embed src=\"") );
    3058           0 :     INetURLObject   aURL( rSoundFile );
    3059             : 
    3060             :     DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
    3061             : 
    3062           0 :     aStr += String(aURL.getName());
    3063           0 :     aStr.AppendAscii( "\" hidden=\"true\" autostart=\"true\">" );
    3064             : 
    3065           0 :     CopyFile( rSoundFile, maExportPath );
    3066             : 
    3067           0 :     return aStr;
    3068             : }
    3069             : 
    3070             : // =====================================================================
    3071             : 
    3072           0 : bool HtmlExport::CopyFile( const String& rSourceFile, const String& rDestPath )
    3073             : {
    3074           0 :     DirEntry aSourceEntry( rSourceFile );
    3075           0 :     DirEntry aDestEntry( rDestPath );
    3076             : 
    3077           0 :     meEC.SetContext( STR_HTMLEXP_ERROR_COPY_FILE, aSourceEntry.GetName(), rDestPath );
    3078           0 :     FSysError nError = aSourceEntry.CopyTo( aDestEntry, FSYS_ACTION_COPYFILE );
    3079             : 
    3080           0 :     if( nError != FSYS_ERR_OK )
    3081             :     {
    3082           0 :         ErrorHandler::HandleError(nError);
    3083           0 :         return false;
    3084             :     }
    3085             :     else
    3086             :     {
    3087           0 :         return true;
    3088           0 :     }
    3089             : }
    3090             : 
    3091             : // =====================================================================
    3092             : 
    3093           0 : bool HtmlExport::checkFileExists( Reference< ::com::sun::star::ucb::XSimpleFileAccess3 >& xFileAccess, String const & aFileName )
    3094             : {
    3095             :     try
    3096             :     {
    3097           0 :         OUString url( maExportPath );
    3098           0 :         url += aFileName;
    3099           0 :         return xFileAccess->exists( url );
    3100             :     }
    3101           0 :     catch( com::sun::star::uno::Exception& )
    3102             :     {
    3103             :         OSL_FAIL(OString(OString("sd::HtmlExport::checkFileExists(), exception caught: ") +
    3104             :              rtl::OUStringToOString( comphelper::anyToString( cppu::getCaughtException() ), RTL_TEXTENCODING_UTF8 )).getStr() );
    3105             :     }
    3106             : 
    3107           0 :     return false;
    3108             : }
    3109             : 
    3110             : // ---------------------------------------------------------------------
    3111             : 
    3112           0 : bool HtmlExport::checkForExistingFiles()
    3113             : {
    3114           0 :     bool bFound = false;
    3115             : 
    3116             :     try
    3117             :     {
    3118           0 :         Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
    3119           0 :         uno::Reference<ucb::XSimpleFileAccess3> xFA(ucb::SimpleFileAccess::create(xContext));
    3120             : 
    3121             :         sal_uInt16 nSdPage;
    3122           0 :         for( nSdPage = 0; !bFound && (nSdPage < mnSdPageCount); nSdPage++)
    3123             :         {
    3124           0 :             if( (mpImageFiles[nSdPage] && checkFileExists( xFA, *mpImageFiles[nSdPage] )) ||
    3125           0 :                 (mpHTMLFiles[nSdPage] && checkFileExists( xFA, *mpHTMLFiles[nSdPage] )) ||
    3126           0 :                 (mpThumbnailFiles[nSdPage] && checkFileExists( xFA, *mpThumbnailFiles[nSdPage] )) ||
    3127           0 :                 (mpPageNames[nSdPage] && checkFileExists( xFA, *mpPageNames[nSdPage] )) ||
    3128           0 :                 (mpTextFiles[nSdPage] && checkFileExists( xFA, *mpTextFiles[nSdPage] )) )
    3129             :             {
    3130           0 :                 bFound = true;
    3131             :             }
    3132             :         }
    3133             : 
    3134           0 :         if( !bFound && mbDownload )
    3135           0 :             bFound = checkFileExists( xFA, maDocFileName );
    3136             : 
    3137           0 :         if( !bFound && mbFrames )
    3138           0 :             bFound = checkFileExists( xFA, maFramePage );
    3139             : 
    3140           0 :         if( bFound )
    3141             :         {
    3142           0 :             ResMgr *pResMgr = CREATERESMGR( dbw );
    3143           0 :             if( pResMgr )
    3144             :             {
    3145           0 :                 ResId aResId( 4077, *pResMgr );
    3146           0 :                 String aMsg( aResId );
    3147             : 
    3148           0 :                 OUString aSystemPath;
    3149           0 :                 osl::FileBase::getSystemPathFromFileURL( maExportPath, aSystemPath );
    3150           0 :                 aMsg.SearchAndReplaceAscii( "%FILENAME", aSystemPath );
    3151           0 :                 WarningBox aWarning( 0, WB_YES_NO | WB_DEF_YES, aMsg );
    3152           0 :                 aWarning.SetImage( WarningBox::GetStandardImage() );
    3153           0 :                 bFound = ( RET_NO == aWarning.Execute() );
    3154             : 
    3155           0 :                 delete pResMgr;
    3156             :             }
    3157             :             else
    3158             :             {
    3159           0 :                 bFound = false;
    3160             :             }
    3161           0 :         }
    3162             :     }
    3163           0 :     catch( Exception& )
    3164             :     {
    3165             :         OSL_FAIL(OString(OString("sd::HtmlExport::checkForExistingFiles(), exception caught: ") +
    3166             :              rtl::OUStringToOString( comphelper::anyToString( cppu::getCaughtException() ), RTL_TEXTENCODING_UTF8 )).getStr() );
    3167           0 :         bFound = false;
    3168             :     }
    3169             : 
    3170           0 :     return bFound;
    3171             : }
    3172             : 
    3173             : // ---------------------------------------------------------------------
    3174             : 
    3175           0 : String HtmlExport::StringToURL( const String& rURL )
    3176             : {
    3177           0 :     return rURL;
    3178             : }
    3179             : 
    3180           0 : String HtmlExport::GetButtonName( int nButton ) const
    3181             : {
    3182           0 :     String aName;
    3183           0 :     aName.AssignAscii( pButtonNames[nButton] );
    3184           0 :     return aName;
    3185             : }
    3186             : 
    3187             : // =====================================================================
    3188           0 : EasyFile::EasyFile()
    3189             : {
    3190           0 :     pMedium = NULL;
    3191           0 :     pOStm = NULL;
    3192           0 :     bOpen = false;
    3193           0 : }
    3194             : 
    3195             : // =====================================================================
    3196           0 : EasyFile::~EasyFile()
    3197             : {
    3198           0 :     if( bOpen )
    3199           0 :         close();
    3200           0 : }
    3201             : 
    3202             : // =====================================================================
    3203           0 : sal_uLong EasyFile::createStream(  const String& rUrl, SvStream* &rpStr )
    3204             : {
    3205           0 :     sal_uLong nErr = 0;
    3206             : 
    3207           0 :     if(bOpen)
    3208           0 :         nErr = close();
    3209             : 
    3210           0 :     String aFileName;
    3211             : 
    3212           0 :     if( nErr == 0 )
    3213           0 :         nErr = createFileName( rUrl, aFileName );
    3214             : 
    3215           0 :     if( nErr == 0 )
    3216             :     {
    3217           0 :         pOStm = ::utl::UcbStreamHelper::CreateStream( aFileName, STREAM_WRITE | STREAM_TRUNC );
    3218           0 :         if( pOStm )
    3219             :         {
    3220           0 :             bOpen = true;
    3221           0 :             nErr = pOStm->GetError();
    3222             :         }
    3223             :         else
    3224             :         {
    3225           0 :             nErr = ERRCODE_SFX_CANTCREATECONTENT;
    3226             :         }
    3227             :     }
    3228             : 
    3229           0 :     if( nErr != 0 )
    3230             :     {
    3231           0 :         bOpen = false;
    3232           0 :         delete pMedium;
    3233           0 :         delete pOStm;
    3234           0 :         pOStm = NULL;
    3235             :     }
    3236             : 
    3237           0 :     rpStr = pOStm;
    3238             : 
    3239           0 :     return nErr;
    3240             : }
    3241             : 
    3242             : // =====================================================================
    3243           0 : sal_uLong EasyFile::createFileName(  const String& rURL, String& rFileName )
    3244             : {
    3245           0 :     sal_uLong nErr = 0;
    3246             : 
    3247           0 :     if( bOpen )
    3248           0 :         nErr = close();
    3249             : 
    3250           0 :     if( nErr == 0 )
    3251             :     {
    3252           0 :         INetURLObject aURL( rURL );
    3253             : 
    3254           0 :         if( aURL.GetProtocol() == INET_PROT_NOT_VALID )
    3255             :         {
    3256           0 :             rtl::OUString aURLStr;
    3257           0 :             ::utl::LocalFileHelper::ConvertPhysicalNameToURL( rURL, aURLStr );
    3258           0 :             aURL = INetURLObject( aURLStr );
    3259             :         }
    3260             :         DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
    3261           0 :         rFileName = aURL.GetMainURL( INetURLObject::NO_DECODE );
    3262             :     }
    3263             : 
    3264           0 :     return nErr;
    3265             : }
    3266             : 
    3267             : // =====================================================================
    3268           0 : sal_uLong EasyFile::close()
    3269             : {
    3270           0 :     sal_uLong nErr = 0;
    3271             : 
    3272           0 :     delete pOStm;
    3273           0 :     pOStm = NULL;
    3274             : 
    3275           0 :     bOpen = false;
    3276             : 
    3277           0 :     if( pMedium )
    3278             :     {
    3279             :         // uebertragen
    3280           0 :         pMedium->Close();
    3281           0 :         pMedium->Commit();
    3282             : 
    3283           0 :         nErr = pMedium->GetError();
    3284             : 
    3285           0 :         delete pMedium;
    3286           0 :         pMedium = NULL;
    3287             :     }
    3288             : 
    3289           0 :     return nErr;
    3290             : }
    3291             : 
    3292             : // =====================================================================
    3293             : // This class helps reporting errors during file i/o
    3294             : // =====================================================================
    3295             : 
    3296           0 : HtmlErrorContext::HtmlErrorContext(Window *_pWin)
    3297           0 : : ErrorContext(_pWin)
    3298             : {
    3299           0 :     mnResId = 0;
    3300           0 : }
    3301             : 
    3302             : // =====================================================================
    3303             : 
    3304           0 : sal_Bool HtmlErrorContext::GetString( sal_uLong, OUString& rCtxStr )
    3305             : {
    3306             :     DBG_ASSERT( mnResId != 0, "No error context set" );
    3307           0 :     if( mnResId == 0 )
    3308           0 :         return false;
    3309             : 
    3310           0 :     rCtxStr = SdResId( mnResId );
    3311             : 
    3312           0 :     rCtxStr = rCtxStr.replaceAll( rtl::OUString("$(URL1)"), maURL1 );
    3313           0 :     rCtxStr = rCtxStr.replaceAll( rtl::OUString("$(URL2)"), maURL2 );
    3314             : 
    3315           0 :     return true;
    3316             : }
    3317             : 
    3318             : // =====================================================================
    3319             : 
    3320           0 : void HtmlErrorContext::SetContext( sal_uInt16 nResId, const String& rURL )
    3321             : {
    3322           0 :     mnResId = nResId;
    3323           0 :     maURL1 = rURL;
    3324           0 :     maURL2.Erase();
    3325           0 : }
    3326             : 
    3327             : // =====================================================================
    3328             : 
    3329           0 : void HtmlErrorContext::SetContext( sal_uInt16 nResId, const String& rURL1, const String& rURL2 )
    3330             : {
    3331           0 :     mnResId = nResId;
    3332           0 :     maURL1 = rURL1;
    3333           0 :     maURL2 = rURL2;
    3334           0 : }
    3335             : 
    3336             : // =====================================================================
    3337             : 
    3338             : 
    3339             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10