1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _BASIC_TTSTRHLP_HXX 28 #define _BASIC_TTSTRHLP_HXX 29 30 #include <tools/string.hxx> 31 32 #define CByteString( constAsciiStr ) ByteString( RTL_CONSTASCII_STRINGPARAM ( constAsciiStr ) ) 33 #define CUniString( constAsciiStr ) UniString( RTL_CONSTASCII_USTRINGPARAM ( constAsciiStr ) ) 34 #define Str2Id( Str ) rtl::OUStringToOString( Str, RTL_TEXTENCODING_ASCII_US ) 35 #define Id2Str( Id ) String( rtl::OStringToOUString( Id, RTL_TEXTENCODING_ASCII_US ) ) 36 37 #define StartKenn CUniString("%") 38 #define EndKenn CUniString("%") 39 #define UIdKenn ( StartKenn.AppendAscii("UId") ) 40 #define MethodKenn ( StartKenn.AppendAscii("Method") ) 41 #define TypeKenn ( StartKenn.AppendAscii("RType") ) 42 #define SlotKenn ( StartKenn.AppendAscii("SlotId") ) 43 #define RcKenn ( StartKenn.AppendAscii("RCommand") ) 44 #define TabKenn ( StartKenn.AppendAscii("Tab") ) 45 #define MakeStringParam(Type,aText) ( Type.AppendAscii("=").Append( aText ).Append( EndKenn ) ) 46 #define MakeStringNumber(Type,nNumber) MakeStringParam (Type, UniString::CreateFromInt32(nNumber)) 47 #define UIdString(aID) MakeStringParam(UIdKenn,String(rtl::OStringToOUString( aID, RTL_TEXTENCODING_ASCII_US ))) 48 #define MethodString(nNumber) MakeStringNumber(MethodKenn,nNumber) 49 #define TypeString(nNumber) MakeStringNumber(TypeKenn,nNumber) 50 #define SlotString(nNumber) MakeStringNumber(SlotKenn,nNumber) 51 #define RcString(nNumber) MakeStringNumber(RcKenn,nNumber) 52 #define TabString(nNumber) MakeStringNumber(TabKenn,nNumber) 53 54 #define ResKenn ( StartKenn.AppendAscii("ResId") ) 55 #define BaseArgKenn ( StartKenn.AppendAscii("Arg") ) 56 #define ArgKenn(nNumber) ( BaseArgKenn.Append( UniString::CreateFromInt32(nNumber) ) ) 57 #define ResString(nNumber) MakeStringNumber(ResKenn,nNumber) 58 #define ArgString(nNumber, aText) MakeStringParam(ArgKenn(nNumber),aText) 59 60 UniString GEN_RES_STR0( sal_uIntPtr nResId ); 61 UniString GEN_RES_STR1( sal_uIntPtr nResId, const String &Text1 ); 62 UniString GEN_RES_STR2( sal_uIntPtr nResId, const String &Text1, const String &Text2 ); 63 UniString GEN_RES_STR3( sal_uIntPtr nResId, const String &Text1, const String &Text2, const String &Text3 ); 64 65 #define GEN_RES_STR1c( nResId, Text1 ) GEN_RES_STR1( nResId, CUniString(Text1) ) 66 #define GEN_RES_STR2c2( nResId, Text1, Text2 ) GEN_RES_STR2( nResId, Text1, CUniString(Text2) ) 67 #define GEN_RES_STR3c3( nResId, Text1, Text2, Text3 ) GEN_RES_STR3( nResId, Text1, Text2, CUniString(Text3) ) 68 69 #define IMPL_GEN_RES_STR \ 70 UniString GEN_RES_STR0( sal_uIntPtr nResId ) { return ResString( nResId ); } \ 71 UniString GEN_RES_STR1( sal_uIntPtr nResId, const UniString &Text1 ) { return GEN_RES_STR0( nResId ).Append( ArgString( 1, Text1 ) ); } \ 72 UniString GEN_RES_STR2( sal_uIntPtr nResId, const UniString &Text1, const UniString &Text2 ) { return GEN_RES_STR1( nResId, Text1 ).Append( ArgString( 2, Text2 ) ); } \ 73 UniString GEN_RES_STR3( sal_uIntPtr nResId, const UniString &Text1, const UniString &Text2, const UniString &Text3 ) { return GEN_RES_STR2( nResId, Text1, Text2 ).Append( ArgString( 3, Text3 ) );} 74 75 #endif 76 77