xref: /aoo41x/main/basic/inc/basic/ttstrhlp.hxx (revision 234bd5c5)
1 *234bd5c5SAndrew Rist /**************************************************************
2 cdf0e10cSrcweir  *
3 *234bd5c5SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4 *234bd5c5SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5 *234bd5c5SAndrew Rist  * distributed with this work for additional information
6 *234bd5c5SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7 *234bd5c5SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8 *234bd5c5SAndrew Rist  * "License"); you may not use this file except in compliance
9 *234bd5c5SAndrew Rist  * with the License.  You may obtain a copy of the License at
10 *234bd5c5SAndrew Rist  *
11 *234bd5c5SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12 *234bd5c5SAndrew Rist  *
13 *234bd5c5SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14 *234bd5c5SAndrew Rist  * software distributed under the License is distributed on an
15 *234bd5c5SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 *234bd5c5SAndrew Rist  * KIND, either express or implied.  See the License for the
17 *234bd5c5SAndrew Rist  * specific language governing permissions and limitations
18 *234bd5c5SAndrew Rist  * under the License.
19 *234bd5c5SAndrew Rist  *
20 *234bd5c5SAndrew Rist  *************************************************************/
21 *234bd5c5SAndrew Rist 
22 *234bd5c5SAndrew Rist 
23 cdf0e10cSrcweir #ifndef _BASIC_TTSTRHLP_HXX
24 cdf0e10cSrcweir #define _BASIC_TTSTRHLP_HXX
25 cdf0e10cSrcweir 
26 cdf0e10cSrcweir #include <tools/string.hxx>
27 cdf0e10cSrcweir 
28 cdf0e10cSrcweir #define CByteString( constAsciiStr ) ByteString( RTL_CONSTASCII_STRINGPARAM ( constAsciiStr ) )
29 cdf0e10cSrcweir #define CUniString( constAsciiStr ) UniString( RTL_CONSTASCII_USTRINGPARAM ( constAsciiStr ) )
30 cdf0e10cSrcweir #define Str2Id( Str ) rtl::OUStringToOString( Str, RTL_TEXTENCODING_ASCII_US )
31 cdf0e10cSrcweir #define Id2Str( Id ) String( rtl::OStringToOUString( Id, RTL_TEXTENCODING_ASCII_US ) )
32 cdf0e10cSrcweir 
33 cdf0e10cSrcweir #define StartKenn			CUniString("%")
34 cdf0e10cSrcweir #define EndKenn				CUniString("%")
35 cdf0e10cSrcweir #define UIdKenn				( StartKenn.AppendAscii("UId") )
36 cdf0e10cSrcweir #define MethodKenn			( StartKenn.AppendAscii("Method") )
37 cdf0e10cSrcweir #define TypeKenn			( StartKenn.AppendAscii("RType") )
38 cdf0e10cSrcweir #define SlotKenn			( StartKenn.AppendAscii("SlotId") )
39 cdf0e10cSrcweir #define RcKenn				( StartKenn.AppendAscii("RCommand") )
40 cdf0e10cSrcweir #define TabKenn				( StartKenn.AppendAscii("Tab") )
41 cdf0e10cSrcweir #define MakeStringParam(Type,aText)	( Type.AppendAscii("=").Append( aText ).Append( EndKenn ) )
42 cdf0e10cSrcweir #define MakeStringNumber(Type,nNumber)	MakeStringParam (Type, UniString::CreateFromInt32(nNumber))
43 cdf0e10cSrcweir #define UIdString(aID) MakeStringParam(UIdKenn,String(rtl::OStringToOUString( aID, RTL_TEXTENCODING_ASCII_US )))
44 cdf0e10cSrcweir #define MethodString(nNumber) MakeStringNumber(MethodKenn,nNumber)
45 cdf0e10cSrcweir #define TypeString(nNumber) MakeStringNumber(TypeKenn,nNumber)
46 cdf0e10cSrcweir #define SlotString(nNumber) MakeStringNumber(SlotKenn,nNumber)
47 cdf0e10cSrcweir #define RcString(nNumber) MakeStringNumber(RcKenn,nNumber)
48 cdf0e10cSrcweir #define TabString(nNumber) MakeStringNumber(TabKenn,nNumber)
49 cdf0e10cSrcweir 
50 cdf0e10cSrcweir #define ResKenn				( StartKenn.AppendAscii("ResId") )
51 cdf0e10cSrcweir #define BaseArgKenn			( StartKenn.AppendAscii("Arg") )
52 cdf0e10cSrcweir #define ArgKenn(nNumber)	( BaseArgKenn.Append( UniString::CreateFromInt32(nNumber) ) )
53 cdf0e10cSrcweir #define ResString(nNumber) MakeStringNumber(ResKenn,nNumber)
54 cdf0e10cSrcweir #define ArgString(nNumber, aText) MakeStringParam(ArgKenn(nNumber),aText)
55 cdf0e10cSrcweir 
56 cdf0e10cSrcweir UniString GEN_RES_STR0( sal_uIntPtr nResId );
57 cdf0e10cSrcweir UniString GEN_RES_STR1( sal_uIntPtr nResId, const String &Text1 );
58 cdf0e10cSrcweir UniString GEN_RES_STR2( sal_uIntPtr nResId, const String &Text1, const String &Text2 );
59 cdf0e10cSrcweir UniString GEN_RES_STR3( sal_uIntPtr nResId, const String &Text1, const String &Text2, const String &Text3 );
60 cdf0e10cSrcweir 
61 cdf0e10cSrcweir #define GEN_RES_STR1c( nResId, Text1 ) GEN_RES_STR1( nResId, CUniString(Text1) )
62 cdf0e10cSrcweir #define GEN_RES_STR2c2( nResId, Text1, Text2 ) GEN_RES_STR2( nResId, Text1, CUniString(Text2) )
63 cdf0e10cSrcweir #define GEN_RES_STR3c3( nResId, Text1, Text2, Text3 ) GEN_RES_STR3( nResId, Text1, Text2, CUniString(Text3) )
64 cdf0e10cSrcweir 
65 cdf0e10cSrcweir #define IMPL_GEN_RES_STR \
66 cdf0e10cSrcweir UniString GEN_RES_STR0( sal_uIntPtr nResId ) { return ResString( nResId ); } \
67 cdf0e10cSrcweir UniString GEN_RES_STR1( sal_uIntPtr nResId, const UniString &Text1 ) { return GEN_RES_STR0( nResId ).Append( ArgString( 1, Text1 ) ); } \
68 cdf0e10cSrcweir UniString GEN_RES_STR2( sal_uIntPtr nResId, const UniString &Text1, const UniString &Text2 ) { return GEN_RES_STR1( nResId, Text1 ).Append( ArgString( 2, Text2 ) ); } \
69 cdf0e10cSrcweir 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 ) );}
70 cdf0e10cSrcweir 
71 cdf0e10cSrcweir #endif
72 cdf0e10cSrcweir 
73