Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / svtools / htmlout.hxx
blob979741af0f854b25b6660d1b2a3d2c16a4e75fd3
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_SVTOOLS_HTMLOUT_HXX
21 #define INCLUDED_SVTOOLS_HTMLOUT_HXX
23 #include <svtools/svtdllapi.h>
24 #include <tools/solar.h>
25 #include <rtl/textenc.h>
26 #include <rtl/string.hxx>
27 #include <svl/macitem.hxx>
29 #include "HtmlWriter.hxx"
31 class Color;
32 class ImageMap;
33 class SvStream;
34 class SvxMacroTableDtor;
35 class SvNumberFormatter;
37 struct HTMLOutEvent
39 const sal_Char *pBasicName;
40 const sal_Char *pJavaName;
41 sal_uInt16 nEvent;
44 struct SVT_DLLPUBLIC HTMLOutContext
46 rtl_TextEncoding m_eDestEnc;
47 rtl_TextToUnicodeConverter m_hConv;
48 rtl_TextToUnicodeContext m_hContext;
50 HTMLOutContext( rtl_TextEncoding eDestEnc );
51 ~HTMLOutContext();
54 struct HTMLOutFuncs
56 SVT_DLLPUBLIC static OString ConvertStringToHTML( const OUString& sSrc,
57 rtl_TextEncoding eDestEnc,
58 OUString *pNonConvertableChars );
60 SVT_DLLPUBLIC static SvStream& Out_AsciiTag( SvStream&, const sal_Char* pStr,
61 bool bOn = true,
62 rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252);
63 SVT_DLLPUBLIC static SvStream& Out_Char( SvStream&, sal_uInt32 cChar,
64 HTMLOutContext& rContext,
65 OUString *pNonConvertableChars );
66 SVT_DLLPUBLIC static SvStream& Out_String( SvStream&, const OUString&,
67 rtl_TextEncoding eDestEnc,
68 OUString *pNonConvertableChars = nullptr );
69 SVT_DLLPUBLIC static SvStream& Out_Hex( SvStream&, sal_uLong nHex, sal_uInt8 nLen,
70 rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252 );
71 SVT_DLLPUBLIC static SvStream& Out_Color( SvStream&, const Color& );
72 SVT_DLLPUBLIC static SvStream& Out_ImageMap( SvStream&, const OUString&, const ImageMap&, const OUString&,
73 const HTMLOutEvent *pEventTable,
74 bool bOutStarBasic,
75 const sal_Char *pDelim,
76 const sal_Char *pIndentArea,
77 const sal_Char *pIndentMap = nullptr,
78 rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
79 OUString *pNonConvertableChars = nullptr );
80 SVT_DLLPUBLIC static SvStream& FlushToAscii( SvStream&, HTMLOutContext& rContext );
82 SVT_DLLPUBLIC static SvStream& OutScript( SvStream& rStrm,
83 const OUString& rBaseURL,
84 const OUString& rSource,
85 const OUString& rLanguage,
86 ScriptType eScriptType,
87 const OUString& rSrc,
88 const OUString *pSBLibrary,
89 const OUString *pSBModule,
90 rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
91 OUString *pNonConvertableChars = nullptr );
93 // the 3rd parameter is an array of HTMLOutEvents which is terminated
94 // by an entry that consists only of 0s
95 SVT_DLLPUBLIC static SvStream& Out_Events( SvStream&, const SvxMacroTableDtor&,
96 const HTMLOutEvent*, bool bOutStarBasic,
97 rtl_TextEncoding eDestEnc,
98 OUString *pNonConvertableChars );
100 // <TD SDVAL="..." SDNUM="...">
101 SVT_DLLPUBLIC static OString CreateTableDataOptionsValNum(
102 bool bValue, double fVal, sal_uLong nFormat,
103 SvNumberFormatter& rFormatter,
104 rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
105 OUString *pNonConvertableChars = nullptr);
106 SVT_DLLPUBLIC static bool PrivateURLToInternalImg( OUString& rURL );
109 struct HtmlWriterHelper
111 SVT_DLLPUBLIC static void applyColor( HtmlWriter& rHtmlWriter, const OString &aAttributeName, const Color& rColor);
112 SVT_DLLPUBLIC static void applyEvents(HtmlWriter& rHtmlWriter, const SvxMacroTableDtor& rMacroTable, const HTMLOutEvent* pEventTable, bool bOutStarBasic);
115 #endif
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */