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 : #ifndef _SD_HTMLEX_HXX
21 : #define _SD_HTMLEX_HXX
22 :
23 : #include <com/sun/star/beans/PropertyValue.hpp>
24 : #include <com/sun/star/ucb/XSimpleFileAccess3.hpp>
25 : #include <vcl/gdimtf.hxx>
26 : #include <svl/itemset.hxx>
27 : #include "resltn.hxx" // enum PublishingResolution
28 : #include <svtools/colrdlg.hxx>
29 : #include <svtools/ehdl.hxx>
30 :
31 : #include "strings.hrc"
32 : #include "DrawDocShell.hxx"
33 : #include "Window.hxx"
34 : #include "ViewShell.hxx"
35 : #include "assclass.hxx"
36 :
37 : #include "sdresid.hxx"
38 : #include "htmlpublishmode.hxx"
39 :
40 : #include <vector>
41 : #include <boost/scoped_ptr.hpp>
42 :
43 : #define PUB_LOWRES_WIDTH 640
44 : #define PUB_LOWRES_HEIGHT 480
45 : #define PUB_MEDRES_WIDTH 800
46 : #define PUB_MEDRES_HEIGHT 600
47 : #define PUB_HIGHRES_WIDTH 1024
48 : #define PUB_HIGHRES_HEIGHT 768
49 :
50 : #define PUB_THUMBNAIL_WIDTH 256
51 : #define PUB_THUMBNAIL_HEIGHT 192
52 :
53 : class SfxProgress;
54 : class SdrOutliner;
55 : class SdPage;
56 : class HtmlState;
57 : class SdrTextObj;
58 : class SdrPage;
59 : class SdDrawDocument;
60 : class ButtonSet;
61 :
62 : class HtmlErrorContext : public ErrorContext
63 : {
64 : private:
65 : sal_uInt16 mnResId;
66 : String maURL1;
67 : String maURL2;
68 :
69 : public:
70 : HtmlErrorContext(Window *pWin=0);
71 0 : ~HtmlErrorContext() {};
72 :
73 : virtual bool GetString( sal_uLong nErrId, OUString& rCtxStr );
74 :
75 : void SetContext( sal_uInt16 nResId, const String& rURL );
76 : void SetContext( sal_uInt16 nResId, const String& rURL1, const String& rURL2 );
77 : };
78 :
79 : /// this class exports an Impress Document as a HTML Presentation.
80 : class HtmlExport
81 : {
82 : std::vector< SdPage* > maPages;
83 : std::vector< SdPage* > maNotesPages;
84 :
85 : String maPath;
86 :
87 : SdDrawDocument* mpDoc;
88 : ::sd::DrawDocShell* mpDocSh;
89 :
90 : HtmlErrorContext meEC;
91 :
92 : HtmlPublishMode meMode;
93 : SfxProgress* mpProgress;
94 : bool mbImpress;
95 : sal_uInt16 mnSdPageCount;
96 : sal_uInt16 mnPagesWritten;
97 : bool mbContentsPage;
98 : sal_Int16 mnButtonThema;
99 : sal_uInt16 mnWidthPixel;
100 : sal_uInt16 mnHeightPixel;
101 : PublishingFormat meFormat;
102 : bool mbHeader;
103 : bool mbNotes;
104 : bool mbFrames;
105 : String maIndex;
106 : String maEMail;
107 : String maAuthor;
108 : String maHomePage;
109 : String maInfo;
110 : sal_Int16 mnCompression;
111 : String maDocFileName;
112 : String maFramePage;
113 : String mDocTitle;
114 : bool mbDownload;
115 :
116 : bool mbAutoSlide;
117 : double mfSlideDuration;
118 : bool mbSlideSound;
119 : bool mbHiddenSlides;
120 : bool mbEndless;
121 :
122 : bool mbUserAttr;
123 : Color maTextColor; ///< The following colors are used for the <body> tag if mbUserAttr is true.
124 : Color maBackColor;
125 : Color maLinkColor;
126 : Color maVLinkColor;
127 : Color maALinkColor;
128 : Color maFirstPageColor;
129 : bool mbDocColors;
130 :
131 : String maHTMLExtension;
132 : String** mpHTMLFiles;
133 : String** mpImageFiles;
134 : String** mpThumbnailFiles;
135 : String** mpPageNames;
136 : String** mpTextFiles;
137 :
138 : String maExportPath; ///< output directory or URL.
139 : String maIndexUrl;
140 : String maURLPath;
141 : String maCGIPath;
142 : PublishingScript meScript;
143 :
144 : const String maHTMLHeader;
145 :
146 : boost::scoped_ptr< ButtonSet > mpButtonSet;
147 :
148 : SdrTextObj* GetLayoutTextObject(SdrPage* pPage);
149 :
150 : void SetDocColors( SdPage* pPage = NULL );
151 :
152 : bool CreateImagesForPresPages( bool bThumbnails = false );
153 : bool CreateHtmlTextForPresPages();
154 : bool CreateHtmlForPresPages();
155 : bool CreateContentPage();
156 : void CreateFileNames();
157 : bool CreateBitmaps();
158 : bool CreateOutlinePages();
159 : bool CreateFrames();
160 : bool CreateNotesPages();
161 : bool CreateNavBarFrames();
162 :
163 : bool CreateASPScripts();
164 : bool CreatePERLScripts();
165 : bool CreateImageFileList();
166 : bool CreateImageNumberFile();
167 :
168 : bool checkForExistingFiles();
169 : bool checkFileExists( ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess3 >& xFileAccess, String const & aFileName );
170 :
171 : String getDocumentTitle();
172 : bool SavePresentation();
173 :
174 : String CreateLink( const String& aLink, const String& aText,
175 : const String& aTarget = String()) const;
176 : String CreateImage( const String& aImage, const String& aAltText, sal_Int16 nWidth = -1, sal_Int16 nHeight = -1 ) const;
177 : String CreateNavBar( sal_uInt16 nSdPage, bool bIsText ) const;
178 : String CreateBodyTag() const;
179 :
180 : String ParagraphToHTMLString( SdrOutliner* pOutliner, sal_Int32 nPara, const Color& rBackgroundColor );
181 : String TextAttribToHTMLString( SfxItemSet* pSet, HtmlState* pState, const Color& rBackgroundColor );
182 :
183 : String CreateTextForTitle( SdrOutliner* pOutliner, SdPage* pPage, const Color& rBackgroundColor );
184 : String CreateTextForPage( SdrOutliner* pOutliner, SdPage* pPage, bool bHeadLine, const Color& rBackgroundColor );
185 : String CreateTextForNotesPage( SdrOutliner* pOutliner, SdPage* pPage, bool bHeadLine, const Color& rBackgroundColor );
186 :
187 : String CreateHTMLCircleArea( sal_uLong nRadius, sal_uLong nCenterX,
188 : sal_uLong nCenterY, const String& rHRef ) const;
189 : String CreateHTMLPolygonArea( const ::basegfx::B2DPolyPolygon& rPolyPoly, Size aShift, double fFactor, const String& rHRef ) const;
190 : String CreateHTMLRectArea( const Rectangle& rRect,
191 : const String& rHRef ) const;
192 :
193 : String CreatePageURL( sal_uInt16 nPgNum );
194 :
195 : String InsertSound( const String& rSoundFile );
196 : bool CopyFile( const OUString& rSourceFile, const OUString& rDestFile );
197 : bool CopyScript( const String& rPath, const String& rSource, const String& rDest, bool bUnix = false );
198 :
199 : void InitProgress( sal_uInt16 nProgrCount );
200 : void ResetProgress();
201 :
202 : String WriteMetaCharset() const;
203 :
204 : void InitExportParameters( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rParams);
205 : void ExportHtml();
206 : void ExportKiosk();
207 : void ExportWebCast();
208 :
209 : bool WriteHtml( const String& rFileName, bool bAddExtension, const String& rHtmlData );
210 : String GetButtonName( int nButton ) const;
211 :
212 : public:
213 : HtmlExport( OUString aPath, const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rParams, SdDrawDocument* pExpDoc, ::sd::DrawDocShell* pDocShell );
214 : virtual ~HtmlExport();
215 :
216 : static String ColorToHTMLString( Color aColor );
217 : static String StringToHTMLString( const String& rString );
218 : static String StringToURL( const String& rURL );
219 : };
220 :
221 : #endif // _SD_HTMLEX_HXX
222 :
223 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|