Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 :
21 : #include "resourcehelper.hxx"
22 : #include "frm_resource.hxx"
23 :
24 : #include <rtl/ustring.hxx>
25 : #include <tools/string.hxx>
26 :
27 : using rtl::OUString;
28 :
29 : #define OUSTRING(x) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(x))
30 :
31 : namespace xforms
32 : {
33 :
34 0 : OUString getResource( sal_uInt16 nResourceId )
35 : {
36 0 : return getResource( nResourceId, OUString(), OUString(), OUString() );
37 : }
38 :
39 0 : OUString getResource( sal_uInt16 nResourceId,
40 : const OUString& rInfo1 )
41 : {
42 0 : return getResource( nResourceId, rInfo1, OUString(), OUString() );
43 : }
44 :
45 0 : OUString getResource( sal_uInt16 nResourceId,
46 : const OUString& rInfo1,
47 : const OUString& rInfo2 )
48 : {
49 0 : return getResource( nResourceId, rInfo1, rInfo2, OUString() );
50 : }
51 :
52 0 : OUString getResource( sal_uInt16 nResourceId,
53 : const OUString& rInfo1,
54 : const OUString& rInfo2,
55 : const OUString& rInfo3 )
56 : {
57 0 : OUString sResource = frm::ResourceManager::loadString( nResourceId );
58 : OSL_ENSURE( !sResource.isEmpty(), "resource not found?" );
59 :
60 : // use old style String class for search and replace, so we don't have to
61 : // code this again.
62 0 : String sString( sResource );
63 0 : sString.SearchAndReplaceAll( String(OUSTRING("$1")), String(rInfo1) );
64 0 : sString.SearchAndReplaceAll( String(OUSTRING("$2")), String(rInfo2) );
65 0 : sString.SearchAndReplaceAll( String(OUSTRING("$3")), String(rInfo3) );
66 0 : return OUString( sString );
67 : }
68 :
69 : } // namespace xforms
70 :
71 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|