1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
24 #include <tools/color.hxx>
25 #include <tools/solar.h>
26 #include <vcl/errinf.hxx>
28 #include "htmlpublishmode.hxx"
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
47 class OutlinerParaObject
;
56 namespace sdr
{ namespace table
{ class SdrTableObj
; } }
61 class HtmlErrorContext
: public ErrorContext
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
;
93 sal_uInt16 mnSdPageCount
;
94 sal_uInt16 mnPagesWritten
;
96 sal_Int16 mnButtonThema
;
97 sal_uInt16 mnWidthPixel
;
98 sal_uInt16 mnHeightPixel
;
99 PublishingFormat meFormat
;
108 sal_Int16 mnCompression
;
109 OUString maDocFileName
;
110 OUString maFramePage
;
115 double mfSlideDuration
;
121 Color maTextColor
; ///< The following colors are used for the <body> tag if mbUserAttr is true.
126 Color maFirstPageColor
;
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.
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();
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
);
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
);
223 HtmlExport(const OUString
& aPath
,
224 const css::uno::Sequence
<css::beans::PropertyValue
>& rParams
,
225 SdDrawDocument
* pExpDoc
,
226 sd::DrawDocShell
* pDocShell
);
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: */