1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: htmlex.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SD_HTMLEX_HXX
32 #define _SD_HTMLEX_HXX
34 #include <com/sun/star/beans/PropertyValue.hpp>
35 #include <com/sun/star/ucb/XSimpleFileAccess.hpp>
36 #include <vcl/gdimtf.hxx>
37 #include <svtools/itemset.hxx>
38 #include "resltn.hxx" // enum PublishingResolution
39 #include <svtools/colrdlg.hxx>
40 #include <svtools/ehdl.hxx>
42 #include "strings.hrc"
43 #include "DrawDocShell.hxx"
45 #include "ViewShell.hxx"
46 #include "assclass.hxx"
49 #include "sdresid.hxx"
54 #include <boost/scoped_ptr.hpp>
56 #define NUM_BUTTONS 12
58 #define PUB_LOWRES_WIDTH 640
59 #define PUB_LOWRES_HEIGHT 480
60 #define PUB_MEDRES_WIDTH 800
61 #define PUB_MEDRES_HEIGHT 600
62 #define PUB_HIGHRES_WIDTH 1024
63 #define PUB_HIGHRES_HEIGHT 768
65 #define HtmlButtonThemaStr = "private://gallery/hidden/HtmlExportButtons";
81 class HtmlErrorContext
: public ErrorContext
89 HtmlErrorContext(Window
*pWin
=0);
90 ~HtmlErrorContext() {};
92 virtual BOOL
GetString( ULONG nErrId
, String
& rCtxStr
);
94 void SetContext( USHORT nResId
);
95 void SetContext( USHORT nResId
, const String
& rURL
);
96 void SetContext( USHORT nResId
, const String
& rURL1
, const String
& rURL2
);
99 // =====================================================================
100 // this class exports an Impress Document as a HTML Presentation
101 // =====================================================================
104 std::vector
< SdPage
* > maPages
;
105 std::vector
< SdPage
* > maNotesPages
;
109 SdDrawDocument
* mpDoc
;
110 ::sd::DrawDocShell
* mpDocSh
;
112 HtmlErrorContext meEC
;
114 HtmlPublishMode meMode
;
115 SfxProgress
* mpProgress
;
117 USHORT mnSdPageCount
;
118 USHORT mnPagesWritten
;
122 UINT16 mnHeightPixel
;
123 PublishingFormat meFormat
;
134 String maDocFileName
;
140 UINT32 mnSlideDuration
;
145 bool mbUserAttr
; // die folgenden Farben werden fuer das <body>
146 Color maTextColor
; // tag genutzt, wenn mbUserAttr true ist
151 Color maFirstPageColor
;
154 String maHTMLExtension
;
155 String
** mpHTMLFiles
;
156 String
** mpImageFiles
;
157 String
** mpPageNames
;
158 String
** mpTextFiles
;
160 String maExportPath
; // Das Ausgabeverzeichnes bzw. die URL
164 PublishingScript meScript
;
166 const String maHTMLHeader
;
168 boost::scoped_ptr
< ButtonSet
> mpButtonSet
;
170 SdrTextObj
* GetLayoutTextObject(SdrPage
* pPage
);
172 void SetDocColors( SdPage
* pPage
= NULL
);
174 bool CreateImagesForPresPages();
175 bool CreateHtmlTextForPresPages();
176 bool CreateHtmlForPresPages();
177 bool CreateContentPage();
178 void CreateFileNames();
179 bool CreateBitmaps();
180 bool CreateOutlinePages();
182 bool CreateNotesPages();
183 bool CreateNavBarFrames();
185 bool CreateASPScripts();
186 bool CreatePERLScripts();
187 bool CreateImageFileList();
188 bool CreateImageNumberFile();
190 bool checkForExistingFiles();
191 bool checkFileExists( ::com::sun::star::uno::Reference
< ::com::sun::star::ucb::XSimpleFileAccess
>& xFileAccess
, String
const & aFileName
);
193 String
getDocumentTitle();
194 bool SavePresentation();
196 String
CreateLink( const String
& aLink
, const String
& aText
,
197 const String
& aTarget
= String()) const;
198 String
CreateImage( const String
& aImage
, const String
& aAltText
, INT16 nWidth
= -1, INT16 nHeight
= -1 ) const;
199 String
CreateNavBar( USHORT nSdPage
, bool bIsText
) const;
200 String
CreateBodyTag() const;
202 String
ParagraphToHTMLString( SdrOutliner
* pOutliner
, ULONG nPara
, const Color
& rBackgroundColor
);
203 String
TextAttribToHTMLString( SfxItemSet
* pSet
, HtmlState
* pState
, const Color
& rBackgroundColor
);
205 String
CreateTextForTitle( SdrOutliner
* pOutliner
, SdPage
* pPage
, const Color
& rBackgroundColor
);
206 String
CreateTextForPage( SdrOutliner
* pOutliner
, SdPage
* pPage
, bool bHeadLine
, const Color
& rBackgroundColor
);
207 String
CreateTextForNotesPage( SdrOutliner
* pOutliner
, SdPage
* pPage
, bool bHeadLine
, const Color
& rBackgroundColor
);
209 String
CreateHTMLCircleArea( ULONG nRadius
, ULONG nCenterX
,
210 ULONG nCenterY
, const String
& rHRef
) const;
211 String
CreateHTMLPolygonArea( const ::basegfx::B2DPolyPolygon
& rPolyPoly
, Size aShift
, double fFactor
, const String
& rHRef
) const;
212 String
CreateHTMLRectArea( const Rectangle
& rRect
,
213 const String
& rHRef
) const;
215 String
CreatePageURL( USHORT nPgNum
);
217 String
InsertSound( const String
& rSoundFile
);
218 bool CopyFile( const String
& rSourceFile
, const String
& rDestPath
);
219 bool CopyScript( const String
& rPath
, const String
& rSource
, const String
& rDest
, bool bUnix
= false );
221 void InitProgress( USHORT nProgrCount
);
222 void ResetProgress();
224 String
WriteMetaCharset() const;
226 void InitExportParameters( const com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
>& rParams
);
229 void ExportWebCast();
231 bool WriteHtml( const String
& rFileName
, bool bAddExtension
, const String
& rHtmlData
);
232 String
GetButtonName( int nButton
) const;
235 HtmlExport( rtl::OUString aPath
, const com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
>& rParams
, SdDrawDocument
* pExpDoc
, ::sd::DrawDocShell
* pDocShell
);
236 virtual ~HtmlExport();
238 static String
ColorToHTMLString( Color aColor
);
239 static String
StringToHTMLString( const String
& rString
);
240 static String
StringToURL( const String
& rURL
);
243 #endif // _SD_HTMLEX_HXX