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
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>
28 #include <svtools/colrdlg.hxx>
29 #include <svtools/ehdl.hxx>
31 #include "strings.hrc"
32 #include "DrawDocShell.hxx"
34 #include "ViewShell.hxx"
35 #include "assclass.hxx"
37 #include "sdresid.hxx"
38 #include "htmlpublishmode.hxx"
41 #include <boost/scoped_ptr.hpp>
43 #define PUB_LOWRES_WIDTH 640
44 #define PUB_MEDRES_WIDTH 800
45 #define PUB_HIGHRES_WIDTH 1024
47 #define PUB_THUMBNAIL_WIDTH 256
48 #define PUB_THUMBNAIL_HEIGHT 192
56 namespace sdr
{ namespace table
{ class SdrTableObj
; } }
61 class HtmlErrorContext
: public ErrorContext
69 HtmlErrorContext(vcl::Window
*pWin
=0);
70 virtual ~HtmlErrorContext() {};
72 virtual bool GetString( sal_uLong nErrId
, OUString
& rCtxStr
) SAL_OVERRIDE
;
74 void SetContext( sal_uInt16 nResId
, const OUString
& rURL
);
75 void SetContext( sal_uInt16 nResId
, const OUString
& rURL1
, const OUString
& rURL2
);
78 /// this class exports an Impress Document as a HTML Presentation.
81 std::vector
< SdPage
* > maPages
;
82 std::vector
< SdPage
* > maNotesPages
;
86 SdDrawDocument
* mpDoc
;
87 ::sd::DrawDocShell
* mpDocSh
;
89 HtmlErrorContext meEC
;
91 HtmlPublishMode meMode
;
92 SfxProgress
* mpProgress
;
94 sal_uInt16 mnSdPageCount
;
95 sal_uInt16 mnPagesWritten
;
97 sal_Int16 mnButtonThema
;
98 sal_uInt16 mnWidthPixel
;
99 sal_uInt16 mnHeightPixel
;
100 PublishingFormat meFormat
;
109 sal_Int16 mnCompression
;
110 OUString maDocFileName
;
111 OUString maFramePage
;
116 double mfSlideDuration
;
122 Color maTextColor
; ///< The following colors are used for the <body> tag if mbUserAttr is true.
127 Color maFirstPageColor
;
130 OUString maHTMLExtension
;
131 std::vector
<OUString
> maHTMLFiles
;
132 std::vector
<OUString
> maImageFiles
;
133 std::vector
<OUString
> maThumbnailFiles
;
134 std::vector
<OUString
> maPageNames
;
135 std::vector
<OUString
> maTextFiles
;
137 OUString maExportPath
; ///< output directory or URL.
141 PublishingScript meScript
;
143 const OUString maHTMLHeader
;
145 boost::scoped_ptr
< ButtonSet
> mpButtonSet
;
147 static SdrTextObj
* GetLayoutTextObject(SdrPage
* pPage
);
149 void SetDocColors( SdPage
* pPage
= NULL
);
151 bool CreateImagesForPresPages( bool bThumbnails
= false );
152 bool CreateHtmlTextForPresPages();
153 bool CreateHtmlForPresPages();
154 bool CreateContentPage();
155 void CreateFileNames();
156 bool CreateBitmaps();
157 bool CreateOutlinePages();
159 bool CreateNotesPages();
160 bool CreateNavBarFrames();
162 bool CreateASPScripts();
163 bool CreatePERLScripts();
164 bool CreateImageFileList();
165 bool CreateImageNumberFile();
167 bool checkForExistingFiles();
168 bool checkFileExists( ::com::sun::star::uno::Reference
< ::com::sun::star::ucb::XSimpleFileAccess3
>& xFileAccess
, OUString
const & aFileName
);
170 OUString
getDocumentTitle();
171 bool SavePresentation();
173 static OUString
CreateLink( const OUString
& aLink
, const OUString
& aText
,
174 const OUString
& aTarget
= OUString());
175 static OUString
CreateImage( const OUString
& aImage
, const OUString
& aAltText
, sal_Int16 nWidth
= -1, sal_Int16 nHeight
= -1 );
176 OUString
CreateNavBar( sal_uInt16 nSdPage
, bool bIsText
) const;
177 OUString
CreateBodyTag() const;
179 OUString
ParagraphToHTMLString( SdrOutliner
* pOutliner
, sal_Int32 nPara
, const Color
& rBackgroundColor
);
180 OUString
TextAttribToHTMLString( SfxItemSet
* pSet
, HtmlState
* pState
, const Color
& rBackgroundColor
);
182 OUString
CreateTextForTitle( SdrOutliner
* pOutliner
, SdPage
* pPage
, const Color
& rBackgroundColor
);
183 OUString
CreateTextForPage( SdrOutliner
* pOutliner
, SdPage
* pPage
, bool bHeadLine
, const Color
& rBackgroundColor
);
184 OUString
CreateTextForNotesPage( SdrOutliner
* pOutliner
, SdPage
* pPage
, bool bHeadLine
, const Color
& rBackgroundColor
);
186 static OUString
CreateHTMLCircleArea( sal_uLong nRadius
, sal_uLong nCenterX
,
187 sal_uLong nCenterY
, const OUString
& rHRef
);
188 static OUString
CreateHTMLPolygonArea( const ::basegfx::B2DPolyPolygon
& rPolyPoly
, Size aShift
, double fFactor
, const OUString
& rHRef
);
189 static OUString
CreateHTMLRectArea( const Rectangle
& rRect
,
190 const OUString
& rHRef
);
192 OUString
CreatePageURL( sal_uInt16 nPgNum
);
194 OUString
InsertSound( const OUString
& rSoundFile
);
195 bool CopyFile( const OUString
& rSourceFile
, const OUString
& rDestFile
);
196 bool CopyScript( const OUString
& rPath
, const OUString
& rSource
, const OUString
& rDest
, bool bUnix
= false );
198 void InitProgress( sal_uInt16 nProgrCount
);
199 void ResetProgress();
201 /// Output only the charset metadata, title etc. will be handled separately.
202 static OUString
CreateMetaCharset();
204 /// Output document metadata.
205 OUString
DocumentMetadata() const;
207 void InitExportParameters( const com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
>& rParams
);
210 void ExportWebCast();
211 void ExportSingleDocument();
213 bool WriteHtml( const OUString
& rFileName
, bool bAddExtension
, const OUString
& rHtmlData
);
214 static OUString
GetButtonName( int nButton
);
216 void WriteOutlinerParagraph(OUStringBuffer
& aStr
, SdrOutliner
* pOutliner
,
217 OutlinerParaObject
* pOutlinerParagraphObject
,
218 const Color
& rBackgroundColor
, bool bHeadLine
);
220 void WriteObjectGroup(OUStringBuffer
& aStr
, SdrObjGroup
* pObjectGroup
,
221 SdrOutliner
* pOutliner
, const Color
& rBackgroundColor
, bool bHeadLine
);
223 void WriteTable(OUStringBuffer
& aStr
, sdr::table::SdrTableObj
* pTableObject
,
224 SdrOutliner
* pOutliner
, const Color
& rBackgroundColor
);
227 HtmlExport(const OUString
& aPath
,
228 const css::uno::Sequence
<css::beans::PropertyValue
>& rParams
,
229 SdDrawDocument
* pExpDoc
,
230 sd::DrawDocShell
* pDocShell
);
232 virtual ~HtmlExport();
234 static OUString
ColorToHTMLString( Color aColor
);
235 static OUString
StringToHTMLString( const OUString
& rString
);
238 #endif // INCLUDED_SD_SOURCE_FILTER_HTML_HTMLEX_HXX
240 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */