bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / source / filter / html / htmlex.hxx
blob7a66fdad4f2ca9bb70f882fd9ebed0d120350009
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SD_SOURCE_FILTER_HTML_HTMLEX_HXX
21 #define INCLUDED_SD_SOURCE_FILTER_HTML_HTMLEX_HXX
23 #include <resltn.hxx>
24 #include <tools/color.hxx>
25 #include <tools/solar.h>
26 #include <vcl/errinf.hxx>
28 #include "htmlpublishmode.hxx"
30 #include <memory>
31 #include <vector>
33 namespace basegfx { class B2DPolyPolygon; }
34 namespace com { namespace sun { namespace star { namespace beans { struct PropertyValue; } } } }
35 namespace com { namespace sun { namespace star { namespace ucb { class XSimpleFileAccess3; } } } }
36 namespace sd { class DrawDocShell; }
37 namespace tools { class Rectangle; }
39 #define PUB_LOWRES_WIDTH 640
40 #define PUB_MEDRES_WIDTH 800
41 #define PUB_HIGHRES_WIDTH 1024
43 #define PUB_THUMBNAIL_WIDTH 256
44 #define PUB_THUMBNAIL_HEIGHT 192
46 class ErrCode;
47 class OutlinerParaObject;
48 class SfxItemSet;
49 class Size;
50 class SfxProgress;
51 class SdrOutliner;
52 class SdPage;
53 class HtmlState;
54 class SdrTextObj;
55 class SdrObjGroup;
56 namespace sdr { namespace table { class SdrTableObj; } }
57 class SdrPage;
58 class SdDrawDocument;
59 class ButtonSet;
61 class HtmlErrorContext : public ErrorContext
63 private:
64 const char* mpResId;
65 OUString maURL1;
66 OUString maURL2;
68 public:
69 explicit HtmlErrorContext();
71 virtual bool GetString( ErrCode nErrId, OUString& rCtxStr ) override;
73 void SetContext(const char* pResId, const OUString& rURL);
74 void SetContext(const char* pResId, const OUString& rURL1, const OUString& rURL2);
77 /// this class exports an Impress Document as a HTML Presentation.
78 class HtmlExport final
80 std::vector< SdPage* > maPages;
81 std::vector< SdPage* > maNotesPages;
83 OUString const maPath;
85 SdDrawDocument* mpDoc;
86 ::sd::DrawDocShell* mpDocSh;
88 HtmlErrorContext meEC;
90 HtmlPublishMode meMode;
91 std::unique_ptr<SfxProgress> mpProgress;
92 bool mbImpress;
93 sal_uInt16 mnSdPageCount;
94 sal_uInt16 mnPagesWritten;
95 bool mbContentsPage;
96 sal_Int16 mnButtonThema;
97 sal_uInt16 mnWidthPixel;
98 sal_uInt16 mnHeightPixel;
99 PublishingFormat meFormat;
100 bool mbHeader;
101 bool mbNotes;
102 bool mbFrames;
103 OUString maIndex;
104 OUString maEMail;
105 OUString maAuthor;
106 OUString maHomePage;
107 OUString maInfo;
108 sal_Int16 mnCompression;
109 OUString maDocFileName;
110 OUString maFramePage;
111 OUString mDocTitle;
112 bool mbDownload;
114 bool mbAutoSlide;
115 double mfSlideDuration;
116 bool mbSlideSound;
117 bool mbHiddenSlides;
118 bool mbEndless;
120 bool mbUserAttr;
121 Color maTextColor; ///< The following colors are used for the <body> tag if mbUserAttr is true.
122 Color maBackColor;
123 Color maLinkColor;
124 Color maVLinkColor;
125 Color maALinkColor;
126 Color maFirstPageColor;
127 bool mbDocColors;
129 std::vector<OUString> maHTMLFiles;
130 std::vector<OUString> maImageFiles;
131 std::vector<OUString> maThumbnailFiles;
132 std::vector<OUString> maPageNames;
133 std::vector<OUString> maTextFiles;
135 OUString maExportPath; ///< output directory or URL.
136 OUString maIndexUrl;
137 OUString maURLPath;
138 OUString maCGIPath;
139 PublishingScript meScript;
141 std::unique_ptr< ButtonSet > mpButtonSet;
143 static SdrTextObj* GetLayoutTextObject(SdrPage const * pPage);
145 void SetDocColors( SdPage* pPage = nullptr );
147 bool CreateImagesForPresPages( bool bThumbnails = false );
148 bool CreateHtmlTextForPresPages();
149 bool CreateHtmlForPresPages();
150 bool CreateContentPage();
151 void CreateFileNames();
152 void CreateBitmaps();
153 bool CreateOutlinePages();
154 bool CreateFrames();
155 bool CreateNotesPages();
156 bool CreateNavBarFrames();
158 bool CreateASPScripts();
159 bool CreatePERLScripts();
160 bool CreateImageFileList();
161 bool CreateImageNumberFile();
163 bool checkForExistingFiles();
164 bool checkFileExists( css::uno::Reference< css::ucb::XSimpleFileAccess3 > const & xFileAccess, OUString const & aFileName );
166 OUString const & getDocumentTitle();
167 bool SavePresentation();
169 static OUString CreateLink( const OUString& aLink, const OUString& aText,
170 const OUString& aTarget = OUString());
171 static OUString CreateImage( const OUString& aImage, const OUString& aAltText );
172 OUString CreateNavBar( sal_uInt16 nSdPage, bool bIsText ) const;
173 OUString CreateBodyTag() const;
175 OUString ParagraphToHTMLString( SdrOutliner const * pOutliner, sal_Int32 nPara, const Color& rBackgroundColor );
176 OUString TextAttribToHTMLString( SfxItemSet const * pSet, HtmlState* pState, const Color& rBackgroundColor );
178 OUString CreateTextForTitle( SdrOutliner* pOutliner, SdPage* pPage, const Color& rBackgroundColor );
179 OUString CreateTextForPage( SdrOutliner* pOutliner, SdPage const * pPage, bool bHeadLine, const Color& rBackgroundColor );
180 OUString CreateTextForNotesPage( SdrOutliner* pOutliner, SdPage* pPage, const Color& rBackgroundColor );
182 static OUString CreateHTMLCircleArea( sal_uLong nRadius, sal_uLong nCenterX,
183 sal_uLong nCenterY, const OUString& rHRef );
184 static OUString CreateHTMLPolygonArea( const ::basegfx::B2DPolyPolygon& rPolyPoly, Size aShift, double fFactor, const OUString& rHRef );
185 static OUString CreateHTMLRectArea( const ::tools::Rectangle& rRect,
186 const OUString& rHRef );
188 OUString CreatePageURL( sal_uInt16 nPgNum );
190 OUString InsertSound( const OUString& rSoundFile );
191 bool CopyFile( const OUString& rSourceFile, const OUString& rDestFile );
192 bool CopyScript( const OUString& rPath, const OUString& rSource, const OUString& rDest, bool bUnix = false );
194 void InitProgress( sal_uInt16 nProgrCount );
195 void ResetProgress();
197 /// Output only the charset metadata, title etc. will be handled separately.
198 static OUString CreateMetaCharset();
200 /// Output document metadata.
201 OUString DocumentMetadata() const;
203 void InitExportParameters( const css::uno::Sequence< css::beans::PropertyValue >& rParams);
204 void ExportHtml();
205 void ExportKiosk();
206 void ExportWebCast();
207 void ExportSingleDocument();
209 bool WriteHtml( const OUString& rFileName, bool bAddExtension, const OUString& rHtmlData );
210 static OUString GetButtonName( int nButton );
212 void WriteOutlinerParagraph(OUStringBuffer& aStr, SdrOutliner* pOutliner,
213 OutlinerParaObject const * pOutlinerParagraphObject,
214 const Color& rBackgroundColor, bool bHeadLine);
216 void WriteObjectGroup(OUStringBuffer& aStr, SdrObjGroup const * pObjectGroup,
217 SdrOutliner* pOutliner, const Color& rBackgroundColor, bool bHeadLine);
219 void WriteTable(OUStringBuffer& aStr, sdr::table::SdrTableObj const * pTableObject,
220 SdrOutliner* pOutliner, const Color& rBackgroundColor);
222 public:
223 HtmlExport(const OUString& aPath,
224 const css::uno::Sequence<css::beans::PropertyValue>& rParams,
225 SdDrawDocument* pExpDoc,
226 sd::DrawDocShell* pDocShell);
228 ~HtmlExport();
230 static OUString ColorToHTMLString( Color aColor );
231 static OUString StringToHTMLString( const OUString& rString );
234 #endif // INCLUDED_SD_SOURCE_FILTER_HTML_HTMLEX_HXX
236 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */