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_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>
33 class SvNumberFormatter
;
37 const sal_Char
*pBasicName
;
38 const sal_Char
*pJavaName
;
39 SvMacroItemId
const nEvent
;
42 struct SVT_DLLPUBLIC HTMLOutContext
44 rtl_TextEncoding m_eDestEnc
;
45 rtl_TextToUnicodeConverter m_hConv
;
46 rtl_TextToUnicodeContext m_hContext
;
48 HTMLOutContext( rtl_TextEncoding eDestEnc
);
54 SVT_DLLPUBLIC
static OString
ConvertStringToHTML( const OUString
& sSrc
,
55 rtl_TextEncoding eDestEnc
,
56 OUString
*pNonConvertableChars
);
58 SVT_DLLPUBLIC
static SvStream
& Out_AsciiTag( SvStream
&, const OString
& rStr
,
60 SVT_DLLPUBLIC
static SvStream
& Out_Char( SvStream
&, sal_uInt32 cChar
,
61 HTMLOutContext
& rContext
,
62 OUString
*pNonConvertableChars
);
63 SVT_DLLPUBLIC
static SvStream
& Out_String( SvStream
&, const OUString
&,
64 rtl_TextEncoding eDestEnc
,
65 OUString
*pNonConvertableChars
= nullptr );
66 SVT_DLLPUBLIC
static SvStream
& Out_Hex( SvStream
&, sal_uLong nHex
, sal_uInt8 nLen
);
67 SVT_DLLPUBLIC
static SvStream
& Out_Color( SvStream
&, const Color
&, bool bXHTML
= false );
68 SVT_DLLPUBLIC
static SvStream
& Out_ImageMap( SvStream
&, const OUString
&, const ImageMap
&, const OUString
&,
69 const HTMLOutEvent
*pEventTable
,
71 const sal_Char
*pDelim
,
72 const sal_Char
*pIndentArea
,
73 const sal_Char
*pIndentMap
,
74 rtl_TextEncoding eDestEnc
= RTL_TEXTENCODING_MS_1252
,
75 OUString
*pNonConvertableChars
= nullptr );
76 SVT_DLLPUBLIC
static SvStream
& FlushToAscii( SvStream
&, HTMLOutContext
& rContext
);
78 SVT_DLLPUBLIC
static SvStream
& OutScript( SvStream
& rStrm
,
79 const OUString
& rBaseURL
,
80 const OUString
& rSource
,
81 const OUString
& rLanguage
,
82 ScriptType eScriptType
,
84 const OUString
*pSBLibrary
,
85 const OUString
*pSBModule
,
86 rtl_TextEncoding eDestEnc
= RTL_TEXTENCODING_MS_1252
,
87 OUString
*pNonConvertableChars
= nullptr );
89 // the 3rd parameter is an array of HTMLOutEvents which is terminated
90 // by an entry that consists only of 0s
91 SVT_DLLPUBLIC
static SvStream
& Out_Events( SvStream
&, const SvxMacroTableDtor
&,
92 const HTMLOutEvent
*, bool bOutStarBasic
,
93 rtl_TextEncoding eDestEnc
,
94 OUString
*pNonConvertableChars
);
96 // <TD SDVAL="..." SDNUM="...">
97 SVT_DLLPUBLIC
static OString
CreateTableDataOptionsValNum(
98 bool bValue
, double fVal
, sal_uLong nFormat
,
99 SvNumberFormatter
& rFormatter
,
100 rtl_TextEncoding eDestEnc
= RTL_TEXTENCODING_MS_1252
,
101 OUString
*pNonConvertableChars
= nullptr);
102 SVT_DLLPUBLIC
static bool PrivateURLToInternalImg( OUString
& rURL
);
105 struct HtmlWriterHelper
107 SVT_DLLPUBLIC
static void applyColor( HtmlWriter
& rHtmlWriter
, const OString
&aAttributeName
, const Color
& rColor
);
108 SVT_DLLPUBLIC
static void applyEvents(HtmlWriter
& rHtmlWriter
, const SvxMacroTableDtor
& rMacroTable
, const HTMLOutEvent
* pEventTable
, bool bOutStarBasic
);
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */