1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _HTMLOUT_HXX 25 #define _HTMLOUT_HXX 26 27 #include "svtools/svtdllapi.h" 28 #include <tools/solar.h> 29 #include <rtl/textenc.h> 30 #include <svl/macitem.hxx> 31 32 class Color; 33 class ImageMap; 34 class String; 35 class SvStream; 36 class SvxMacroTableDtor; 37 class SvNumberFormatter; 38 class SvDataObject; 39 40 struct HTMLOutEvent 41 { 42 const sal_Char *pBasicName; 43 const sal_Char *pJavaName; 44 sal_uInt16 nEvent; 45 }; 46 47 struct SVT_DLLPUBLIC HTMLOutContext 48 { 49 rtl_TextEncoding m_eDestEnc; 50 rtl_TextToUnicodeConverter m_hConv; 51 rtl_TextToUnicodeContext m_hContext; 52 53 HTMLOutContext( rtl_TextEncoding eDestEnc ); 54 ~HTMLOutContext(); 55 }; 56 57 struct HTMLOutFuncs 58 { 59 #if defined(UNX) 60 static const sal_Char sNewLine; // nur \012 oder \015 61 #else 62 static const sal_Char __FAR_DATA sNewLine[]; // \015\012 63 #endif 64 65 SVT_DLLPUBLIC static void ConvertStringToHTML( const String& sSrc, ByteString& rDest, 66 rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252, 67 String *pNonConvertableChars = 0); 68 69 SVT_DLLPUBLIC static SvStream& Out_AsciiTag( SvStream&, const sal_Char* pStr, 70 sal_Bool bOn = sal_True, 71 rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252); 72 SVT_DLLPUBLIC static SvStream& Out_Char( SvStream&, sal_Unicode cChar, 73 HTMLOutContext& rContext, 74 String *pNonConvertableChars = 0 ); 75 SVT_DLLPUBLIC static SvStream& Out_String( SvStream&, const String&, 76 rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252, 77 String *pNonConvertableChars = 0 ); 78 SVT_DLLPUBLIC static SvStream& Out_Hex( SvStream&, sal_uLong nHex, sal_uInt8 nLen, 79 rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252 ); 80 SVT_DLLPUBLIC static SvStream& Out_Color( SvStream&, const Color&, 81 rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252 ); 82 SVT_DLLPUBLIC static SvStream& Out_ImageMap( SvStream&, const String&, const ImageMap&, const String&, 83 const HTMLOutEvent *pEventTable, 84 sal_Bool bOutStarBasic, 85 const sal_Char *pDelim = 0, 86 const sal_Char *pIndentArea = 0, 87 const sal_Char *pIndentMap = 0, 88 rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252, 89 String *pNonConvertableChars = 0 ); 90 SVT_DLLPUBLIC static SvStream& FlushToAscii( SvStream&, HTMLOutContext& rContext ); 91 92 SVT_DLLPUBLIC static SvStream& OutScript( SvStream& rStrm, 93 const String& rBaseURL, 94 const String& rSource, 95 const String& rLanguage, 96 ScriptType eScriptType, 97 const String& rSrc, 98 const String *pSBLibrary = 0, 99 const String *pSBModule = 0, 100 rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252, 101 String *pNonConvertableChars = 0 ); 102 103 // der 3. Parameter ist ein Array von HTMLOutEvents, das mit einem 104 // nur aus 0 bestehen Eintrag terminiert ist. 105 SVT_DLLPUBLIC static SvStream& Out_Events( SvStream&, const SvxMacroTableDtor&, 106 const HTMLOutEvent*, sal_Bool bOutStarBasic, 107 rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252, 108 String *pNonConvertableChars = 0 ); 109 110 // <TD SDVAL="..." SDNUM="..."> 111 SVT_DLLPUBLIC static ByteString& CreateTableDataOptionsValNum( ByteString& aStrTD, 112 sal_Bool bValue, double fVal, sal_uLong nFormat, 113 SvNumberFormatter& rFormatter, 114 rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252, 115 String *pNonConvertableChars = 0 ); 116 117 SVT_DLLPUBLIC static sal_Bool PrivateURLToInternalImg( String& rURL ); 118 }; 119 120 #endif 121 122