1*24acc546SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*24acc546SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*24acc546SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*24acc546SAndrew Rist * distributed with this work for additional information
6*24acc546SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*24acc546SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*24acc546SAndrew Rist * "License"); you may not use this file except in compliance
9*24acc546SAndrew Rist * with the License. You may obtain a copy of the License at
10*24acc546SAndrew Rist *
11*24acc546SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*24acc546SAndrew Rist *
13*24acc546SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*24acc546SAndrew Rist * software distributed under the License is distributed on an
15*24acc546SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*24acc546SAndrew Rist * KIND, either express or implied. See the License for the
17*24acc546SAndrew Rist * specific language governing permissions and limitations
18*24acc546SAndrew Rist * under the License.
19*24acc546SAndrew Rist *
20*24acc546SAndrew Rist *************************************************************/
21*24acc546SAndrew Rist
22*24acc546SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_forms.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include "resourcehelper.hxx"
28cdf0e10cSrcweir #include "frm_resource.hxx"
29cdf0e10cSrcweir
30cdf0e10cSrcweir #include <rtl/ustring.hxx>
31cdf0e10cSrcweir #include <tools/string.hxx>
32cdf0e10cSrcweir
33cdf0e10cSrcweir using rtl::OUString;
34cdf0e10cSrcweir
35cdf0e10cSrcweir #define OUSTRING(x) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(x))
36cdf0e10cSrcweir
37cdf0e10cSrcweir namespace xforms
38cdf0e10cSrcweir {
39cdf0e10cSrcweir
getResource(sal_uInt16 nResourceId)40cdf0e10cSrcweir OUString getResource( sal_uInt16 nResourceId )
41cdf0e10cSrcweir {
42cdf0e10cSrcweir return getResource( nResourceId, OUString(), OUString(), OUString() );
43cdf0e10cSrcweir }
44cdf0e10cSrcweir
getResource(sal_uInt16 nResourceId,const OUString & rInfo1)45cdf0e10cSrcweir OUString getResource( sal_uInt16 nResourceId,
46cdf0e10cSrcweir const OUString& rInfo1 )
47cdf0e10cSrcweir {
48cdf0e10cSrcweir return getResource( nResourceId, rInfo1, OUString(), OUString() );
49cdf0e10cSrcweir }
50cdf0e10cSrcweir
getResource(sal_uInt16 nResourceId,const OUString & rInfo1,const OUString & rInfo2)51cdf0e10cSrcweir OUString getResource( sal_uInt16 nResourceId,
52cdf0e10cSrcweir const OUString& rInfo1,
53cdf0e10cSrcweir const OUString& rInfo2 )
54cdf0e10cSrcweir {
55cdf0e10cSrcweir return getResource( nResourceId, rInfo1, rInfo2, OUString() );
56cdf0e10cSrcweir }
57cdf0e10cSrcweir
getResource(sal_uInt16 nResourceId,const OUString & rInfo1,const OUString & rInfo2,const OUString & rInfo3)58cdf0e10cSrcweir OUString getResource( sal_uInt16 nResourceId,
59cdf0e10cSrcweir const OUString& rInfo1,
60cdf0e10cSrcweir const OUString& rInfo2,
61cdf0e10cSrcweir const OUString& rInfo3 )
62cdf0e10cSrcweir {
63cdf0e10cSrcweir OUString sResource = frm::ResourceManager::loadString( nResourceId );
64cdf0e10cSrcweir OSL_ENSURE( sResource.getLength() > 0, "resource not found?" );
65cdf0e10cSrcweir
66cdf0e10cSrcweir // use old style String class for search and replace, so we don't have to
67cdf0e10cSrcweir // code this again.
68cdf0e10cSrcweir String sString( sResource );
69cdf0e10cSrcweir sString.SearchAndReplaceAll( String(OUSTRING("$1")), String(rInfo1) );
70cdf0e10cSrcweir sString.SearchAndReplaceAll( String(OUSTRING("$2")), String(rInfo2) );
71cdf0e10cSrcweir sString.SearchAndReplaceAll( String(OUSTRING("$3")), String(rInfo3) );
72cdf0e10cSrcweir return OUString( sString );
73cdf0e10cSrcweir }
74cdf0e10cSrcweir
75cdf0e10cSrcweir } // namespace xforms
76