Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include "resourcehelper.hxx"
31 : : #include "frm_resource.hxx"
32 : :
33 : : #include <rtl/ustring.hxx>
34 : : #include <tools/string.hxx>
35 : :
36 : : using rtl::OUString;
37 : :
38 : : #define OUSTRING(x) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(x))
39 : :
40 : : namespace xforms
41 : : {
42 : :
43 : 0 : OUString getResource( sal_uInt16 nResourceId )
44 : : {
45 [ # # ]: 0 : return getResource( nResourceId, OUString(), OUString(), OUString() );
46 : : }
47 : :
48 : 0 : OUString getResource( sal_uInt16 nResourceId,
49 : : const OUString& rInfo1 )
50 : : {
51 [ # # ]: 0 : return getResource( nResourceId, rInfo1, OUString(), OUString() );
52 : : }
53 : :
54 : 0 : OUString getResource( sal_uInt16 nResourceId,
55 : : const OUString& rInfo1,
56 : : const OUString& rInfo2 )
57 : : {
58 [ # # ]: 0 : return getResource( nResourceId, rInfo1, rInfo2, OUString() );
59 : : }
60 : :
61 : 0 : OUString getResource( sal_uInt16 nResourceId,
62 : : const OUString& rInfo1,
63 : : const OUString& rInfo2,
64 : : const OUString& rInfo3 )
65 : : {
66 [ # # ]: 0 : OUString sResource = frm::ResourceManager::loadString( nResourceId );
67 : : OSL_ENSURE( !sResource.isEmpty(), "resource not found?" );
68 : :
69 : : // use old style String class for search and replace, so we don't have to
70 : : // code this again.
71 [ # # ]: 0 : String sString( sResource );
72 [ # # ][ # # ]: 0 : sString.SearchAndReplaceAll( String(OUSTRING("$1")), String(rInfo1) );
[ # # ][ # # ]
[ # # ][ # # ]
73 [ # # ][ # # ]: 0 : sString.SearchAndReplaceAll( String(OUSTRING("$2")), String(rInfo2) );
[ # # ][ # # ]
[ # # ][ # # ]
74 [ # # ][ # # ]: 0 : sString.SearchAndReplaceAll( String(OUSTRING("$3")), String(rInfo3) );
[ # # ][ # # ]
[ # # ][ # # ]
75 [ # # ][ # # ]: 0 : return OUString( sString );
76 : : }
77 : :
78 : : } // namespace xforms
79 : :
80 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|