1*caf5cd79SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*caf5cd79SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*caf5cd79SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*caf5cd79SAndrew Rist * distributed with this work for additional information 6*caf5cd79SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*caf5cd79SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*caf5cd79SAndrew Rist * "License"); you may not use this file except in compliance 9*caf5cd79SAndrew Rist * with the License. You may obtain a copy of the License at 10*caf5cd79SAndrew Rist * 11*caf5cd79SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*caf5cd79SAndrew Rist * 13*caf5cd79SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*caf5cd79SAndrew Rist * software distributed under the License is distributed on an 15*caf5cd79SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*caf5cd79SAndrew Rist * KIND, either express or implied. See the License for the 17*caf5cd79SAndrew Rist * specific language governing permissions and limitations 18*caf5cd79SAndrew Rist * under the License. 19*caf5cd79SAndrew Rist * 20*caf5cd79SAndrew Rist *************************************************************/ 21*caf5cd79SAndrew Rist 22*caf5cd79SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef CONNECTIVITY_SHAREDRESOURCES_HXX 25cdf0e10cSrcweir #define CONNECTIVITY_SHAREDRESOURCES_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir /** === begin UNO includes === **/ 28cdf0e10cSrcweir /** === end UNO includes === **/ 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include <rtl/ustring.hxx> 31cdf0e10cSrcweir #include <list> 32cdf0e10cSrcweir #include "connectivity/dbtoolsdllapi.hxx" 33cdf0e10cSrcweir 34cdf0e10cSrcweir //........................................................................ 35cdf0e10cSrcweir namespace connectivity 36cdf0e10cSrcweir { 37cdf0e10cSrcweir //........................................................................ 38cdf0e10cSrcweir 39cdf0e10cSrcweir typedef sal_uInt16 ResourceId; 40cdf0e10cSrcweir //==================================================================== 41cdf0e10cSrcweir //= SharedResources 42cdf0e10cSrcweir //==================================================================== 43cdf0e10cSrcweir /** helper class for accessing resources shared by different libraries 44cdf0e10cSrcweir in the connectivity module 45cdf0e10cSrcweir */ 46cdf0e10cSrcweir class OOO_DLLPUBLIC_DBTOOLS SharedResources 47cdf0e10cSrcweir { 48cdf0e10cSrcweir public: 49cdf0e10cSrcweir SharedResources(); 50cdf0e10cSrcweir ~SharedResources(); 51cdf0e10cSrcweir 52cdf0e10cSrcweir /** loads a string from the shared resource file 53cdf0e10cSrcweir @param _nResId 54cdf0e10cSrcweir the resource ID of the string 55cdf0e10cSrcweir @return 56cdf0e10cSrcweir the string from the resource file 57cdf0e10cSrcweir */ 58cdf0e10cSrcweir ::rtl::OUString 59cdf0e10cSrcweir getResourceString( 60cdf0e10cSrcweir ResourceId _nResId 61cdf0e10cSrcweir ) const; 62cdf0e10cSrcweir 63cdf0e10cSrcweir /** loads a string from the shared resource file, and replaces 64cdf0e10cSrcweir a given ASCII pattern with a given string 65cdf0e10cSrcweir 66cdf0e10cSrcweir @param _nResId 67cdf0e10cSrcweir the resource ID of the string to load 68cdf0e10cSrcweir @param _pAsciiPatternToReplace 69cdf0e10cSrcweir the ASCII string which is to search in the string. Must not be <NULL/>. 70cdf0e10cSrcweir @param _rStringToSubstitute 71cdf0e10cSrcweir the String which should substitute the ASCII pattern. 72cdf0e10cSrcweir 73cdf0e10cSrcweir @return 74cdf0e10cSrcweir the string from the resource file, with applied string substitution 75cdf0e10cSrcweir */ 76cdf0e10cSrcweir ::rtl::OUString 77cdf0e10cSrcweir getResourceStringWithSubstitution( 78cdf0e10cSrcweir ResourceId _nResId, 79cdf0e10cSrcweir const sal_Char* _pAsciiPatternToReplace, 80cdf0e10cSrcweir const ::rtl::OUString& _rStringToSubstitute 81cdf0e10cSrcweir ) const; 82cdf0e10cSrcweir 83cdf0e10cSrcweir /** loads a string from the shared resource file, and replaces 84cdf0e10cSrcweir a given ASCII pattern with a given string 85cdf0e10cSrcweir 86cdf0e10cSrcweir @param _nResId 87cdf0e10cSrcweir the resource ID of the string to load 88cdf0e10cSrcweir @param _pAsciiPatternToReplace1 89cdf0e10cSrcweir the ASCII string (1) which is to search in the string. Must not be <NULL/>. 90cdf0e10cSrcweir @param _rStringToSubstitute1 91cdf0e10cSrcweir the String which should substitute the ASCII pattern (1) 92cdf0e10cSrcweir @param _pAsciiPatternToReplace2 93cdf0e10cSrcweir the ASCII string (2) which is to search in the string. Must not be <NULL/>. 94cdf0e10cSrcweir @param _rStringToSubstitute2 95cdf0e10cSrcweir the String which should substitute the ASCII pattern (2) 96cdf0e10cSrcweir 97cdf0e10cSrcweir @return 98cdf0e10cSrcweir the string from the resource file, with applied string substitution 99cdf0e10cSrcweir */ 100cdf0e10cSrcweir ::rtl::OUString 101cdf0e10cSrcweir getResourceStringWithSubstitution( 102cdf0e10cSrcweir ResourceId _nResId, 103cdf0e10cSrcweir const sal_Char* _pAsciiPatternToReplace1, 104cdf0e10cSrcweir const ::rtl::OUString& _rStringToSubstitute1, 105cdf0e10cSrcweir const sal_Char* _pAsciiPatternToReplace2, 106cdf0e10cSrcweir const ::rtl::OUString& _rStringToSubstitute2 107cdf0e10cSrcweir ) const; 108cdf0e10cSrcweir 109cdf0e10cSrcweir /** loads a string from the shared resource file, and replaces 110cdf0e10cSrcweir a given ASCII pattern with a given string 111cdf0e10cSrcweir 112cdf0e10cSrcweir @param _nResId 113cdf0e10cSrcweir the resource ID of the string to load 114cdf0e10cSrcweir @param _pAsciiPatternToReplace1 115cdf0e10cSrcweir the ASCII string (1) which is to search in the string. Must not be <NULL/>. 116cdf0e10cSrcweir @param _rStringToSubstitute1 117cdf0e10cSrcweir the String which should substitute the ASCII pattern (1) 118cdf0e10cSrcweir @param _pAsciiPatternToReplace2 119cdf0e10cSrcweir the ASCII string (2) which is to search in the string. Must not be <NULL/>. 120cdf0e10cSrcweir @param _rStringToSubstitute2 121cdf0e10cSrcweir the String which should substitute the ASCII pattern (2) 122cdf0e10cSrcweir @param _pAsciiPatternToReplace3 123cdf0e10cSrcweir the ASCII string (3) which is to search in the string. Must not be <NULL/>. 124cdf0e10cSrcweir @param _rStringToSubstitute3 125cdf0e10cSrcweir the String which should substitute the ASCII pattern (3) 126cdf0e10cSrcweir 127cdf0e10cSrcweir @return 128cdf0e10cSrcweir the string from the resource file, with applied string substitution 129cdf0e10cSrcweir */ 130cdf0e10cSrcweir ::rtl::OUString 131cdf0e10cSrcweir getResourceStringWithSubstitution( 132cdf0e10cSrcweir ResourceId _nResId, 133cdf0e10cSrcweir const sal_Char* _pAsciiPatternToReplace1, 134cdf0e10cSrcweir const ::rtl::OUString& _rStringToSubstitute1, 135cdf0e10cSrcweir const sal_Char* _pAsciiPatternToReplace2, 136cdf0e10cSrcweir const ::rtl::OUString& _rStringToSubstitute2, 137cdf0e10cSrcweir const sal_Char* _pAsciiPatternToReplace3, 138cdf0e10cSrcweir const ::rtl::OUString& _rStringToSubstitute3 139cdf0e10cSrcweir ) const; 140cdf0e10cSrcweir 141cdf0e10cSrcweir /** loads a string from the shared resource file, and replaces a given ASCII pattern with a given string 142cdf0e10cSrcweir 143cdf0e10cSrcweir @param _nResId 144cdf0e10cSrcweir the resource ID of the string to load 145cdf0e10cSrcweir @param _aStringToSubstitutes 146cdf0e10cSrcweir A list of substitutions. 147cdf0e10cSrcweir 148cdf0e10cSrcweir @return 149cdf0e10cSrcweir the string from the resource file, with applied string substitution 150cdf0e10cSrcweir */ 151cdf0e10cSrcweir ::rtl::OUString getResourceStringWithSubstitution( ResourceId _nResId, 152cdf0e10cSrcweir const ::std::list< ::std::pair<const sal_Char* , ::rtl::OUString > > _aStringToSubstitutes) const; 153cdf0e10cSrcweir }; 154cdf0e10cSrcweir 155cdf0e10cSrcweir //........................................................................ 156cdf0e10cSrcweir } // namespace connectivity 157cdf0e10cSrcweir //........................................................................ 158cdf0e10cSrcweir 159cdf0e10cSrcweir #endif // CONNECTIVITY_SHAREDRESOURCES_HXX 160cdf0e10cSrcweir 161