merge the formfield patch from ooo-build
[ooovba.git] / sd / source / filter / html / htmlex.hxx
blob6ec482189724f1dce9d162c15ad87ff2c8bbf85a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: htmlex.hxx,v $
10 * $Revision: 1.14 $
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"
44 #include "Window.hxx"
45 #include "ViewShell.hxx"
46 #include "assclass.hxx"
48 #ifndef _SD_RESID_HXX
49 #include "sdresid.hxx"
50 #endif
51 #include "pubdlg.hxx"
53 #include <vector>
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";
67 class List;
68 class SfxProgress;
69 class SdrOutliner;
70 class SdPage;
71 class HtmlState;
72 class SdrTextObj;
73 class SdrPage;
74 class SdDrawDocument;
75 class ButtonSet;
77 namespace sd {
78 class View;
81 class HtmlErrorContext : public ErrorContext
83 private:
84 USHORT mnResId;
85 String maURL1;
86 String maURL2;
88 public:
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 // =====================================================================
102 class HtmlExport
104 std::vector< SdPage* > maPages;
105 std::vector< SdPage* > maNotesPages;
107 String maPath;
109 SdDrawDocument* mpDoc;
110 ::sd::DrawDocShell* mpDocSh;
112 HtmlErrorContext meEC;
114 HtmlPublishMode meMode;
115 SfxProgress* mpProgress;
116 bool mbImpress;
117 USHORT mnSdPageCount;
118 USHORT mnPagesWritten;
119 bool mbContentsPage;
120 INT16 mnButtonThema;
121 UINT16 mnWidthPixel;
122 UINT16 mnHeightPixel;
123 PublishingFormat meFormat;
124 bool mbHeader;
125 bool mbNotes;
126 bool mbFrames;
127 bool mbKiosk;
128 String maIndex;
129 String maEMail;
130 String maAuthor;
131 String maHomePage;
132 String maInfo;
133 INT16 mnCompression;
134 String maDocFileName;
135 String maFramePage;
136 String mDocTitle;
137 bool mbDownload;
139 bool mbAutoSlide;
140 UINT32 mnSlideDuration;
141 bool mbSlideSound;
142 bool mbHiddenSlides;
143 bool mbEndless;
145 bool mbUserAttr; // die folgenden Farben werden fuer das <body>
146 Color maTextColor; // tag genutzt, wenn mbUserAttr true ist
147 Color maBackColor;
148 Color maLinkColor;
149 Color maVLinkColor;
150 Color maALinkColor;
151 Color maFirstPageColor;
152 bool mbDocColors;
154 String maHTMLExtension;
155 String** mpHTMLFiles;
156 String** mpImageFiles;
157 String** mpPageNames;
158 String** mpTextFiles;
160 String maExportPath; // Das Ausgabeverzeichnes bzw. die URL
161 String maIndexUrl;
162 String maURLPath;
163 String maCGIPath;
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();
181 bool CreateFrames();
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);
227 void ExportHtml();
228 void ExportKiosk();
229 void ExportWebCast();
231 bool WriteHtml( const String& rFileName, bool bAddExtension, const String& rHtmlData );
232 String GetButtonName( int nButton ) const;
234 public:
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