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 INCLUDED_SD_SOURCE_FILTER_HTML_HTMLEX_HXX
21 : #define INCLUDED_SD_SOURCE_FILTER_HTML_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"
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 : OUString maURL1;
67 : OUString maURL2;
68 :
69 : public:
70 : HtmlErrorContext(Window *pWin=0);
71 0 : virtual ~HtmlErrorContext() {};
72 :
73 : virtual bool GetString( sal_uLong nErrId, OUString& rCtxStr ) SAL_OVERRIDE;
74 :
75 : void SetContext( sal_uInt16 nResId, const OUString& rURL );
76 : void SetContext( sal_uInt16 nResId, const OUString& rURL1, const OUString& 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 : OUString 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 : OUString maIndex;
106 : OUString maEMail;
107 : OUString maAuthor;
108 : OUString maHomePage;
109 : OUString maInfo;
110 : sal_Int16 mnCompression;
111 : OUString maDocFileName;
112 : OUString maFramePage;
113 : OUString 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 : OUString maHTMLExtension;
132 : std::vector<OUString> maHTMLFiles;
133 : std::vector<OUString> maImageFiles;
134 : std::vector<OUString> maThumbnailFiles;
135 : std::vector<OUString> maPageNames;
136 : std::vector<OUString> maTextFiles;
137 :
138 : OUString maExportPath; ///< output directory or URL.
139 : OUString maIndexUrl;
140 : OUString maURLPath;
141 : OUString maCGIPath;
142 : PublishingScript meScript;
143 :
144 : const OUString 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, OUString const & aFileName );
170 :
171 : OUString getDocumentTitle();
172 : bool SavePresentation();
173 :
174 : OUString CreateLink( const OUString& aLink, const OUString& aText,
175 : const OUString& aTarget = OUString()) const;
176 : OUString CreateImage( const OUString& aImage, const OUString& aAltText, sal_Int16 nWidth = -1, sal_Int16 nHeight = -1 ) const;
177 : OUString CreateNavBar( sal_uInt16 nSdPage, bool bIsText ) const;
178 : OUString CreateBodyTag() const;
179 :
180 : OUString ParagraphToHTMLString( SdrOutliner* pOutliner, sal_Int32 nPara, const Color& rBackgroundColor );
181 : OUString TextAttribToHTMLString( SfxItemSet* pSet, HtmlState* pState, const Color& rBackgroundColor );
182 :
183 : OUString CreateTextForTitle( SdrOutliner* pOutliner, SdPage* pPage, const Color& rBackgroundColor );
184 : OUString CreateTextForPage( SdrOutliner* pOutliner, SdPage* pPage, bool bHeadLine, const Color& rBackgroundColor );
185 : OUString CreateTextForNotesPage( SdrOutliner* pOutliner, SdPage* pPage, bool bHeadLine, const Color& rBackgroundColor );
186 :
187 : OUString CreateHTMLCircleArea( sal_uLong nRadius, sal_uLong nCenterX,
188 : sal_uLong nCenterY, const OUString& rHRef ) const;
189 : OUString CreateHTMLPolygonArea( const ::basegfx::B2DPolyPolygon& rPolyPoly, Size aShift, double fFactor, const OUString& rHRef ) const;
190 : OUString CreateHTMLRectArea( const Rectangle& rRect,
191 : const OUString& rHRef ) const;
192 :
193 : OUString CreatePageURL( sal_uInt16 nPgNum );
194 :
195 : OUString InsertSound( const OUString& rSoundFile );
196 : bool CopyFile( const OUString& rSourceFile, const OUString& rDestFile );
197 : bool CopyScript( const OUString& rPath, const OUString& rSource, const OUString& rDest, bool bUnix = false );
198 :
199 : void InitProgress( sal_uInt16 nProgrCount );
200 : void ResetProgress();
201 :
202 : OUString CreateMetaCharset() 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 OUString& rFileName, bool bAddExtension, const OUString& rHtmlData );
210 : OUString GetButtonName( int nButton ) const;
211 :
212 : public:
213 : HtmlExport( const 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 OUString ColorToHTMLString( Color aColor );
217 : static OUString StringToHTMLString( const OUString& rString );
218 : };
219 :
220 : #endif // INCLUDED_SD_SOURCE_FILTER_HTML_HTMLEX_HXX
221 :
222 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|