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 _SD_HTMLEX_HXX
21 #define _SD_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>
27 #include "resltn.hxx" // enum PublishingResolution
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_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
50 #define PUB_THUMBNAIL_WIDTH 256
51 #define PUB_THUMBNAIL_HEIGHT 192
62 class HtmlErrorContext
: public ErrorContext
70 HtmlErrorContext(Window
*pWin
=0);
71 ~HtmlErrorContext() {};
73 virtual sal_Bool
GetString( sal_uLong nErrId
, OUString
& rCtxStr
);
75 void SetContext( sal_uInt16 nResId
, const String
& rURL
);
76 void SetContext( sal_uInt16 nResId
, const String
& rURL1
, const String
& rURL2
);
79 /// this class exports an Impress Document as a HTML Presentation.
82 std::vector
< SdPage
* > maPages
;
83 std::vector
< SdPage
* > maNotesPages
;
87 SdDrawDocument
* mpDoc
;
88 ::sd::DrawDocShell
* mpDocSh
;
90 HtmlErrorContext meEC
;
92 HtmlPublishMode meMode
;
93 SfxProgress
* mpProgress
;
95 sal_uInt16 mnSdPageCount
;
96 sal_uInt16 mnPagesWritten
;
98 sal_Int16 mnButtonThema
;
99 sal_uInt16 mnWidthPixel
;
100 sal_uInt16 mnHeightPixel
;
101 PublishingFormat meFormat
;
110 sal_Int16 mnCompression
;
111 String maDocFileName
;
117 double mfSlideDuration
;
123 Color maTextColor
; ///< The following colors are used for the <body> tag if mbUserAttr is true.
128 Color maFirstPageColor
;
131 String maHTMLExtension
;
132 String
** mpHTMLFiles
;
133 String
** mpImageFiles
;
134 String
** mpThumbnailFiles
;
135 String
** mpPageNames
;
136 String
** mpTextFiles
;
138 String maExportPath
; ///< output directory or URL.
142 PublishingScript meScript
;
144 const String maHTMLHeader
;
146 boost::scoped_ptr
< ButtonSet
> mpButtonSet
;
148 SdrTextObj
* GetLayoutTextObject(SdrPage
* pPage
);
150 void SetDocColors( SdPage
* pPage
= NULL
);
152 bool CreateImagesForPresPages( bool bThumbnails
= false );
153 bool CreateHtmlTextForPresPages();
154 bool CreateHtmlForPresPages();
155 bool CreateContentPage();
156 void CreateFileNames();
157 bool CreateBitmaps();
158 bool CreateOutlinePages();
160 bool CreateNotesPages();
161 bool CreateNavBarFrames();
163 bool CreateASPScripts();
164 bool CreatePERLScripts();
165 bool CreateImageFileList();
166 bool CreateImageNumberFile();
168 bool checkForExistingFiles();
169 bool checkFileExists( ::com::sun::star::uno::Reference
< ::com::sun::star::ucb::XSimpleFileAccess3
>& xFileAccess
, String
const & aFileName
);
171 String
getDocumentTitle();
172 bool SavePresentation();
174 String
CreateLink( const String
& aLink
, const String
& aText
,
175 const String
& aTarget
= String()) const;
176 String
CreateImage( const String
& aImage
, const String
& aAltText
, sal_Int16 nWidth
= -1, sal_Int16 nHeight
= -1 ) const;
177 String
CreateNavBar( sal_uInt16 nSdPage
, bool bIsText
) const;
178 String
CreateBodyTag() const;
180 String
ParagraphToHTMLString( SdrOutliner
* pOutliner
, sal_Int32 nPara
, const Color
& rBackgroundColor
);
181 String
TextAttribToHTMLString( SfxItemSet
* pSet
, HtmlState
* pState
, const Color
& rBackgroundColor
);
183 String
CreateTextForTitle( SdrOutliner
* pOutliner
, SdPage
* pPage
, const Color
& rBackgroundColor
);
184 String
CreateTextForPage( SdrOutliner
* pOutliner
, SdPage
* pPage
, bool bHeadLine
, const Color
& rBackgroundColor
);
185 String
CreateTextForNotesPage( SdrOutliner
* pOutliner
, SdPage
* pPage
, bool bHeadLine
, const Color
& rBackgroundColor
);
187 String
CreateHTMLCircleArea( sal_uLong nRadius
, sal_uLong nCenterX
,
188 sal_uLong nCenterY
, const String
& rHRef
) const;
189 String
CreateHTMLPolygonArea( const ::basegfx::B2DPolyPolygon
& rPolyPoly
, Size aShift
, double fFactor
, const String
& rHRef
) const;
190 String
CreateHTMLRectArea( const Rectangle
& rRect
,
191 const String
& rHRef
) const;
193 String
CreatePageURL( sal_uInt16 nPgNum
);
195 String
InsertSound( const String
& rSoundFile
);
196 bool CopyFile( const OUString
& rSourceFile
, const OUString
& rDestFile
);
197 bool CopyScript( const String
& rPath
, const String
& rSource
, const String
& rDest
, bool bUnix
= false );
199 void InitProgress( sal_uInt16 nProgrCount
);
200 void ResetProgress();
202 String
WriteMetaCharset() const;
204 void InitExportParameters( const com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
>& rParams
);
207 void ExportWebCast();
209 bool WriteHtml( const String
& rFileName
, bool bAddExtension
, const String
& rHtmlData
);
210 String
GetButtonName( int nButton
) const;
213 HtmlExport( OUString aPath
, const com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
>& rParams
, SdDrawDocument
* pExpDoc
, ::sd::DrawDocShell
* pDocShell
);
214 virtual ~HtmlExport();
216 static String
ColorToHTMLString( Color aColor
);
217 static String
StringToHTMLString( const String
& rString
);
218 static String
StringToURL( const String
& rURL
);
221 #endif // _SD_HTMLEX_HXX
223 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */