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