Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SD_HTMLEX_HXX
30 : : #define _SD_HTMLEX_HXX
31 : :
32 : : #include <com/sun/star/beans/PropertyValue.hpp>
33 : : #include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
34 : : #include <vcl/gdimtf.hxx>
35 : : #include <svl/itemset.hxx>
36 : : #include "resltn.hxx" // enum PublishingResolution
37 : : #include <svtools/colrdlg.hxx>
38 : : #include <svtools/ehdl.hxx>
39 : :
40 : : #include "strings.hrc"
41 : : #include "DrawDocShell.hxx"
42 : : #include "Window.hxx"
43 : : #include "ViewShell.hxx"
44 : : #include "assclass.hxx"
45 : :
46 : : #include "sdresid.hxx"
47 : : #include "pubdlg.hxx"
48 : :
49 : : #include <vector>
50 : : #include <boost/scoped_ptr.hpp>
51 : :
52 : : #define NUM_BUTTONS 12
53 : :
54 : : #define PUB_LOWRES_WIDTH 640
55 : : #define PUB_LOWRES_HEIGHT 480
56 : : #define PUB_MEDRES_WIDTH 800
57 : : #define PUB_MEDRES_HEIGHT 600
58 : : #define PUB_HIGHRES_WIDTH 1024
59 : : #define PUB_HIGHRES_HEIGHT 768
60 : :
61 : : #define PUB_THUMBNAIL_WIDTH 256
62 : : #define PUB_THUMBNAIL_HEIGHT 192
63 : :
64 : : class SfxProgress;
65 : : class SdrOutliner;
66 : : class SdPage;
67 : : class HtmlState;
68 : : class SdrTextObj;
69 : : class SdrPage;
70 : : class SdDrawDocument;
71 : : class ButtonSet;
72 : :
73 : : class HtmlErrorContext : public ErrorContext
74 : : {
75 : : private:
76 : : sal_uInt16 mnResId;
77 : : String maURL1;
78 : : String maURL2;
79 : :
80 : : public:
81 : : HtmlErrorContext(Window *pWin=0);
82 [ # # ][ # # ]: 0 : ~HtmlErrorContext() {};
[ # # ]
83 : :
84 : : virtual sal_Bool GetString( sal_uLong nErrId, String& rCtxStr );
85 : :
86 : : void SetContext( sal_uInt16 nResId, const String& rURL );
87 : : void SetContext( sal_uInt16 nResId, const String& rURL1, const String& rURL2 );
88 : : };
89 : :
90 : : /// this class exports an Impress Document as a HTML Presentation.
91 : : class HtmlExport
92 : : {
93 : : std::vector< SdPage* > maPages;
94 : : std::vector< SdPage* > maNotesPages;
95 : :
96 : : String maPath;
97 : :
98 : : SdDrawDocument* mpDoc;
99 : : ::sd::DrawDocShell* mpDocSh;
100 : :
101 : : HtmlErrorContext meEC;
102 : :
103 : : HtmlPublishMode meMode;
104 : : SfxProgress* mpProgress;
105 : : bool mbImpress;
106 : : sal_uInt16 mnSdPageCount;
107 : : sal_uInt16 mnPagesWritten;
108 : : bool mbContentsPage;
109 : : sal_Int16 mnButtonThema;
110 : : sal_uInt16 mnWidthPixel;
111 : : sal_uInt16 mnHeightPixel;
112 : : PublishingFormat meFormat;
113 : : bool mbHeader;
114 : : bool mbNotes;
115 : : bool mbFrames;
116 : : bool mbKiosk;
117 : : String maIndex;
118 : : String maEMail;
119 : : String maAuthor;
120 : : String maHomePage;
121 : : String maInfo;
122 : : sal_Int16 mnCompression;
123 : : String maDocFileName;
124 : : String maFramePage;
125 : : String mDocTitle;
126 : : bool mbDownload;
127 : :
128 : : bool mbAutoSlide;
129 : : sal_uInt32 mnSlideDuration;
130 : : bool mbSlideSound;
131 : : bool mbHiddenSlides;
132 : : bool mbEndless;
133 : :
134 : : bool mbUserAttr;
135 : : Color maTextColor; ///< The following colors are used for the <body> tag if mbUserAttr is true.
136 : : Color maBackColor;
137 : : Color maLinkColor;
138 : : Color maVLinkColor;
139 : : Color maALinkColor;
140 : : Color maFirstPageColor;
141 : : bool mbDocColors;
142 : :
143 : : String maHTMLExtension;
144 : : String** mpHTMLFiles;
145 : : String** mpImageFiles;
146 : : String** mpThumbnailFiles;
147 : : String** mpPageNames;
148 : : String** mpTextFiles;
149 : :
150 : : String maExportPath; ///< output directory or URL.
151 : : String maIndexUrl;
152 : : String maURLPath;
153 : : String maCGIPath;
154 : : PublishingScript meScript;
155 : :
156 : : const String maHTMLHeader;
157 : :
158 : : boost::scoped_ptr< ButtonSet > mpButtonSet;
159 : :
160 : : SdrTextObj* GetLayoutTextObject(SdrPage* pPage);
161 : :
162 : : void SetDocColors( SdPage* pPage = NULL );
163 : :
164 : : bool CreateImagesForPresPages( bool bThumbnails = false );
165 : : bool CreateHtmlTextForPresPages();
166 : : bool CreateHtmlForPresPages();
167 : : bool CreateContentPage();
168 : : void CreateFileNames();
169 : : bool CreateBitmaps();
170 : : bool CreateOutlinePages();
171 : : bool CreateFrames();
172 : : bool CreateNotesPages();
173 : : bool CreateNavBarFrames();
174 : :
175 : : bool CreateASPScripts();
176 : : bool CreatePERLScripts();
177 : : bool CreateImageFileList();
178 : : bool CreateImageNumberFile();
179 : :
180 : : bool checkForExistingFiles();
181 : : bool checkFileExists( ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess2 >& xFileAccess, String const & aFileName );
182 : :
183 : : String getDocumentTitle();
184 : : bool SavePresentation();
185 : :
186 : : String CreateLink( const String& aLink, const String& aText,
187 : : const String& aTarget = String()) const;
188 : : String CreateImage( const String& aImage, const String& aAltText, sal_Int16 nWidth = -1, sal_Int16 nHeight = -1 ) const;
189 : : String CreateNavBar( sal_uInt16 nSdPage, bool bIsText ) const;
190 : : String CreateBodyTag() const;
191 : :
192 : : String ParagraphToHTMLString( SdrOutliner* pOutliner, sal_uLong nPara, const Color& rBackgroundColor );
193 : : String TextAttribToHTMLString( SfxItemSet* pSet, HtmlState* pState, const Color& rBackgroundColor );
194 : :
195 : : String CreateTextForTitle( SdrOutliner* pOutliner, SdPage* pPage, const Color& rBackgroundColor );
196 : : String CreateTextForPage( SdrOutliner* pOutliner, SdPage* pPage, bool bHeadLine, const Color& rBackgroundColor );
197 : : String CreateTextForNotesPage( SdrOutliner* pOutliner, SdPage* pPage, bool bHeadLine, const Color& rBackgroundColor );
198 : :
199 : : String CreateHTMLCircleArea( sal_uLong nRadius, sal_uLong nCenterX,
200 : : sal_uLong nCenterY, const String& rHRef ) const;
201 : : String CreateHTMLPolygonArea( const ::basegfx::B2DPolyPolygon& rPolyPoly, Size aShift, double fFactor, const String& rHRef ) const;
202 : : String CreateHTMLRectArea( const Rectangle& rRect,
203 : : const String& rHRef ) const;
204 : :
205 : : String CreatePageURL( sal_uInt16 nPgNum );
206 : :
207 : : String InsertSound( const String& rSoundFile );
208 : : bool CopyFile( const String& rSourceFile, const String& rDestPath );
209 : : bool CopyScript( const String& rPath, const String& rSource, const String& rDest, bool bUnix = false );
210 : :
211 : : void InitProgress( sal_uInt16 nProgrCount );
212 : : void ResetProgress();
213 : :
214 : : String WriteMetaCharset() const;
215 : :
216 : : void InitExportParameters( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rParams);
217 : : void ExportHtml();
218 : : void ExportKiosk();
219 : : void ExportWebCast();
220 : :
221 : : bool WriteHtml( const String& rFileName, bool bAddExtension, const String& rHtmlData );
222 : : String GetButtonName( int nButton ) const;
223 : :
224 : : public:
225 : : HtmlExport( rtl::OUString aPath, const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rParams, SdDrawDocument* pExpDoc, ::sd::DrawDocShell* pDocShell );
226 : : virtual ~HtmlExport();
227 : :
228 : : static String ColorToHTMLString( Color aColor );
229 : : static String StringToHTMLString( const String& rString );
230 : : static String StringToURL( const String& rURL );
231 : : };
232 : :
233 : : #endif // _SD_HTMLEX_HXX
234 : :
235 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|