1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _SVTOOLS_LNGMISC_HXX_ 25 #define _SVTOOLS_LNGMISC_HXX_ 26 27 #include "svl/svldllapi.h" 28 #include <tools/solar.h> 29 #include <sal/types.h> 30 #include <rtl/ustring.hxx> 31 #include <tools/string.hxx> 32 33 /////////////////////////////////////////////////////////////////////////// 34 35 #define SVT_SOFT_HYPHEN ((sal_Unicode) 0x00AD) 36 #define SVT_HARD_HYPHEN ((sal_Unicode) 0x2011) 37 38 // the non-breaking space 39 #define SVT_HARD_SPACE ((sal_Unicode) 0x00A0) 40 41 namespace linguistic 42 { 43 IsHyphen(sal_Unicode cChar)44inline sal_Bool IsHyphen( sal_Unicode cChar ) 45 { 46 return cChar == SVT_SOFT_HYPHEN || cChar == SVT_HARD_HYPHEN; 47 } 48 49 IsControlChar(sal_Unicode cChar)50inline sal_Bool IsControlChar( sal_Unicode cChar ) 51 { 52 return cChar < (sal_Unicode) ' '; 53 } 54 55 HasHyphens(const rtl::OUString & rTxt)56inline sal_Bool HasHyphens( const rtl::OUString &rTxt ) 57 { 58 return rTxt.indexOf( SVT_SOFT_HYPHEN ) != -1 || 59 rTxt.indexOf( SVT_HARD_HYPHEN ) != -1; 60 } 61 62 SVL_DLLPUBLIC sal_Int32 GetNumControlChars( const rtl::OUString &rTxt ); 63 SVL_DLLPUBLIC sal_Bool RemoveHyphens( rtl::OUString &rTxt ); 64 SVL_DLLPUBLIC sal_Bool RemoveControlChars( rtl::OUString &rTxt ); 65 66 SVL_DLLPUBLIC sal_Bool ReplaceControlChars( rtl::OUString &rTxt, sal_Char aRplcChar = ' ' ); 67 68 SVL_DLLPUBLIC String GetThesaurusReplaceText( const String &rText ); 69 70 } // namespace linguistic 71 72 #endif 73