1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef CONNECTIVITY_SHAREDRESOURCES_HXX 29*cdf0e10cSrcweir #define CONNECTIVITY_SHAREDRESOURCES_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir /** === begin UNO includes === **/ 32*cdf0e10cSrcweir /** === end UNO includes === **/ 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir #include <rtl/ustring.hxx> 35*cdf0e10cSrcweir #include <list> 36*cdf0e10cSrcweir #include "connectivity/dbtoolsdllapi.hxx" 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir //........................................................................ 39*cdf0e10cSrcweir namespace connectivity 40*cdf0e10cSrcweir { 41*cdf0e10cSrcweir //........................................................................ 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir typedef sal_uInt16 ResourceId; 44*cdf0e10cSrcweir //==================================================================== 45*cdf0e10cSrcweir //= SharedResources 46*cdf0e10cSrcweir //==================================================================== 47*cdf0e10cSrcweir /** helper class for accessing resources shared by different libraries 48*cdf0e10cSrcweir in the connectivity module 49*cdf0e10cSrcweir */ 50*cdf0e10cSrcweir class OOO_DLLPUBLIC_DBTOOLS SharedResources 51*cdf0e10cSrcweir { 52*cdf0e10cSrcweir public: 53*cdf0e10cSrcweir SharedResources(); 54*cdf0e10cSrcweir ~SharedResources(); 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir /** loads a string from the shared resource file 57*cdf0e10cSrcweir @param _nResId 58*cdf0e10cSrcweir the resource ID of the string 59*cdf0e10cSrcweir @return 60*cdf0e10cSrcweir the string from the resource file 61*cdf0e10cSrcweir */ 62*cdf0e10cSrcweir ::rtl::OUString 63*cdf0e10cSrcweir getResourceString( 64*cdf0e10cSrcweir ResourceId _nResId 65*cdf0e10cSrcweir ) const; 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir /** loads a string from the shared resource file, and replaces 68*cdf0e10cSrcweir a given ASCII pattern with a given string 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir @param _nResId 71*cdf0e10cSrcweir the resource ID of the string to load 72*cdf0e10cSrcweir @param _pAsciiPatternToReplace 73*cdf0e10cSrcweir the ASCII string which is to search in the string. Must not be <NULL/>. 74*cdf0e10cSrcweir @param _rStringToSubstitute 75*cdf0e10cSrcweir the String which should substitute the ASCII pattern. 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir @return 78*cdf0e10cSrcweir the string from the resource file, with applied string substitution 79*cdf0e10cSrcweir */ 80*cdf0e10cSrcweir ::rtl::OUString 81*cdf0e10cSrcweir getResourceStringWithSubstitution( 82*cdf0e10cSrcweir ResourceId _nResId, 83*cdf0e10cSrcweir const sal_Char* _pAsciiPatternToReplace, 84*cdf0e10cSrcweir const ::rtl::OUString& _rStringToSubstitute 85*cdf0e10cSrcweir ) const; 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir /** loads a string from the shared resource file, and replaces 88*cdf0e10cSrcweir a given ASCII pattern with a given string 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir @param _nResId 91*cdf0e10cSrcweir the resource ID of the string to load 92*cdf0e10cSrcweir @param _pAsciiPatternToReplace1 93*cdf0e10cSrcweir the ASCII string (1) which is to search in the string. Must not be <NULL/>. 94*cdf0e10cSrcweir @param _rStringToSubstitute1 95*cdf0e10cSrcweir the String which should substitute the ASCII pattern (1) 96*cdf0e10cSrcweir @param _pAsciiPatternToReplace2 97*cdf0e10cSrcweir the ASCII string (2) which is to search in the string. Must not be <NULL/>. 98*cdf0e10cSrcweir @param _rStringToSubstitute2 99*cdf0e10cSrcweir the String which should substitute the ASCII pattern (2) 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir @return 102*cdf0e10cSrcweir the string from the resource file, with applied string substitution 103*cdf0e10cSrcweir */ 104*cdf0e10cSrcweir ::rtl::OUString 105*cdf0e10cSrcweir getResourceStringWithSubstitution( 106*cdf0e10cSrcweir ResourceId _nResId, 107*cdf0e10cSrcweir const sal_Char* _pAsciiPatternToReplace1, 108*cdf0e10cSrcweir const ::rtl::OUString& _rStringToSubstitute1, 109*cdf0e10cSrcweir const sal_Char* _pAsciiPatternToReplace2, 110*cdf0e10cSrcweir const ::rtl::OUString& _rStringToSubstitute2 111*cdf0e10cSrcweir ) const; 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir /** loads a string from the shared resource file, and replaces 114*cdf0e10cSrcweir a given ASCII pattern with a given string 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir @param _nResId 117*cdf0e10cSrcweir the resource ID of the string to load 118*cdf0e10cSrcweir @param _pAsciiPatternToReplace1 119*cdf0e10cSrcweir the ASCII string (1) which is to search in the string. Must not be <NULL/>. 120*cdf0e10cSrcweir @param _rStringToSubstitute1 121*cdf0e10cSrcweir the String which should substitute the ASCII pattern (1) 122*cdf0e10cSrcweir @param _pAsciiPatternToReplace2 123*cdf0e10cSrcweir the ASCII string (2) which is to search in the string. Must not be <NULL/>. 124*cdf0e10cSrcweir @param _rStringToSubstitute2 125*cdf0e10cSrcweir the String which should substitute the ASCII pattern (2) 126*cdf0e10cSrcweir @param _pAsciiPatternToReplace3 127*cdf0e10cSrcweir the ASCII string (3) which is to search in the string. Must not be <NULL/>. 128*cdf0e10cSrcweir @param _rStringToSubstitute3 129*cdf0e10cSrcweir the String which should substitute the ASCII pattern (3) 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir @return 132*cdf0e10cSrcweir the string from the resource file, with applied string substitution 133*cdf0e10cSrcweir */ 134*cdf0e10cSrcweir ::rtl::OUString 135*cdf0e10cSrcweir getResourceStringWithSubstitution( 136*cdf0e10cSrcweir ResourceId _nResId, 137*cdf0e10cSrcweir const sal_Char* _pAsciiPatternToReplace1, 138*cdf0e10cSrcweir const ::rtl::OUString& _rStringToSubstitute1, 139*cdf0e10cSrcweir const sal_Char* _pAsciiPatternToReplace2, 140*cdf0e10cSrcweir const ::rtl::OUString& _rStringToSubstitute2, 141*cdf0e10cSrcweir const sal_Char* _pAsciiPatternToReplace3, 142*cdf0e10cSrcweir const ::rtl::OUString& _rStringToSubstitute3 143*cdf0e10cSrcweir ) const; 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir /** loads a string from the shared resource file, and replaces a given ASCII pattern with a given string 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir @param _nResId 148*cdf0e10cSrcweir the resource ID of the string to load 149*cdf0e10cSrcweir @param _aStringToSubstitutes 150*cdf0e10cSrcweir A list of substitutions. 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir @return 153*cdf0e10cSrcweir the string from the resource file, with applied string substitution 154*cdf0e10cSrcweir */ 155*cdf0e10cSrcweir ::rtl::OUString getResourceStringWithSubstitution( ResourceId _nResId, 156*cdf0e10cSrcweir const ::std::list< ::std::pair<const sal_Char* , ::rtl::OUString > > _aStringToSubstitutes) const; 157*cdf0e10cSrcweir }; 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir //........................................................................ 160*cdf0e10cSrcweir } // namespace connectivity 161*cdf0e10cSrcweir //........................................................................ 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir #endif // CONNECTIVITY_SHAREDRESOURCES_HXX 164*cdf0e10cSrcweir 165