Branch libreoffice-5-0-4
[LibreOffice.git] / include / svtools / htmlout.hxx
blob671565ff6826d36b295102aabea4d85ffa812495
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 = RTL_TEXTENCODING_MS_1252,
58 OUString *pNonConvertableChars = 0 );
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_Unicode cChar,
64 HTMLOutContext& rContext,
65 OUString *pNonConvertableChars = 0 );
66 SVT_DLLPUBLIC static SvStream& Out_String( SvStream&, const OUString&,
67 rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
68 OUString *pNonConvertableChars = 0 );
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 rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252 );
73 SVT_DLLPUBLIC static SvStream& Out_ImageMap( SvStream&, const OUString&, const ImageMap&, const OUString&,
74 const HTMLOutEvent *pEventTable,
75 bool bOutStarBasic,
76 const sal_Char *pDelim = 0,
77 const sal_Char *pIndentArea = 0,
78 const sal_Char *pIndentMap = 0,
79 rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
80 OUString *pNonConvertableChars = 0 );
81 SVT_DLLPUBLIC static SvStream& FlushToAscii( SvStream&, HTMLOutContext& rContext );
83 SVT_DLLPUBLIC static SvStream& OutScript( SvStream& rStrm,
84 const OUString& rBaseURL,
85 const OUString& rSource,
86 const OUString& rLanguage,
87 ScriptType eScriptType,
88 const OUString& rSrc,
89 const OUString *pSBLibrary = 0,
90 const OUString *pSBModule = 0,
91 rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
92 OUString *pNonConvertableChars = 0 );
94 // the 3rd parameter is an array of HTMLOutEvents which is terminated
95 // by an entry that consists only of 0s
96 SVT_DLLPUBLIC static SvStream& Out_Events( SvStream&, const SvxMacroTableDtor&,
97 const HTMLOutEvent*, bool bOutStarBasic,
98 rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
99 OUString *pNonConvertableChars = 0 );
101 // <TD SDVAL="..." SDNUM="...">
102 SVT_DLLPUBLIC static OString CreateTableDataOptionsValNum(
103 bool bValue, double fVal, sal_uLong nFormat,
104 SvNumberFormatter& rFormatter,
105 rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
106 OUString *pNonConvertableChars = 0);
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: */