[PATCH] String=OUString part of linguistic
Norbert Thiebaud (via Code Review)
gerrit at gerrit.libreoffice.org
Thu Jun 13 06:20:24 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/4263
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/63/4263/1
String=OUString part of linguistic
Change-Id: I8e566956416bb191a4d28acb6c3dc2c1e1daad62
---
M include/linguistic/misc.hxx
M linguistic/source/convdic.cxx
M linguistic/source/convdic.hxx
M linguistic/source/misc.cxx
M linguistic/source/misc2.cxx
M sfx2/source/appl/appdde.cxx
6 files changed, 72 insertions(+), 73 deletions(-)
diff --git a/include/linguistic/misc.hxx b/include/linguistic/misc.hxx
index 8e7b4b1..f3a56c8 100644
--- a/include/linguistic/misc.hxx
+++ b/include/linguistic/misc.hxx
@@ -35,7 +35,6 @@
#include <cppuhelper/implbase1.hxx> // helper for implementations
#include <unotools/pathoptions.hxx>
#include <i18nlangtag/lang.h>
-#include <tools/string.hxx>
#include <unotools/charclass.hxx>
#include <osl/thread.h>
#include <osl/mutex.hxx>
@@ -117,10 +116,10 @@
// checks if file pointed to by rURL is readonly
// and may also check return if such a file exists or not
-sal_Bool IsReadOnly( const String &rURL, sal_Bool *pbExist = 0 );
+bool IsReadOnly( const OUString &rURL, bool *pbExist = 0 );
// checks if a file with the given URL exists
-sal_Bool FileExists( const String &rURL );
+bool FileExists( const OUString &rURL );
OUString GetDictionaryWriteablePath();
@@ -128,7 +127,7 @@
/// @returns an URL for a new and writable dictionary rDicName.
/// The URL will point to the path given by 'GetDictionaryWriteablePath'
-LNG_DLLPUBLIC String GetWritableDictionaryURL( const String &rDicName );
+LNG_DLLPUBLIC OUString GetWritableDictionaryURL( const OUString &rDicName );
LNG_DLLPUBLIC sal_Int32 GetPosInWordToCheck( const OUString &rTxt, sal_Int32 nPos );
@@ -139,14 +138,14 @@
::com::sun::star::linguistic2::XHyphenatedWord > &rxHyphWord );
-LNG_DLLPUBLIC sal_Bool IsUpper( const String &rText, xub_StrLen nPos, xub_StrLen nLen, sal_Int16 nLanguage );
+LNG_DLLPUBLIC bool IsUpper( const OUString &rText, sal_Int32 nPos, sal_Int32 nLen, sal_Int16 nLanguage );
-inline sal_Bool IsUpper( const String &rText, sal_Int16 nLanguage ) { return IsUpper( rText, 0, rText.Len(), nLanguage ); }
+inline bool IsUpper( const OUString &rText, sal_Int16 nLanguage ) { return IsUpper( rText, 0, rText.getLength(), nLanguage ); }
LNG_DLLPUBLIC CapType SAL_CALL capitalType(const OUString&, CharClass *);
-String ToLower( const String &rText, sal_Int16 nLanguage );
-LNG_DLLPUBLIC sal_Bool HasDigits( const OUString &rText );
-LNG_DLLPUBLIC sal_Bool IsNumeric( const String &rText );
+OUString ToLower( const OUString &rText, sal_Int16 nLanguage );
+LNG_DLLPUBLIC bool HasDigits( const OUString &rText );
+LNG_DLLPUBLIC bool IsNumeric( const OUString &rText );
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > GetOneInstanceService( const char *pServiceName );
@@ -155,11 +154,11 @@
::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > GetIgnoreAllList();
-sal_Bool IsUseDicList( const ::com::sun::star::beans::PropertyValues &rProperties,
+bool IsUseDicList( const ::com::sun::star::beans::PropertyValues &rProperties,
const ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet > &rxPropSet );
-sal_Bool IsIgnoreControlChars( const ::com::sun::star::beans::PropertyValues &rProperties,
+bool IsIgnoreControlChars( const ::com::sun::star::beans::PropertyValues &rProperties,
const ::com::sun::star::uno::Reference<
::com::sun::star::beans::XPropertySet > &rxPropSet );
@@ -168,15 +167,15 @@
SearchDicList(
const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList >& rDicList,
const OUString& rWord, sal_Int16 nLanguage,
- sal_Bool bSearchPosDics, sal_Bool bSearchSpellEntry );
+ bool bSearchPosDics, bool bSearchSpellEntry );
LNG_DLLPUBLIC sal_uInt8 AddEntryToDic(
::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > &rxDic,
- const OUString &rWord, sal_Bool bIsNeg,
+ const OUString &rWord, bool bIsNeg,
const OUString &rRplcTxt, sal_Int16 nRplcLang,
- sal_Bool bStripDot = sal_True );
+ bool bStripDot = true );
-LNG_DLLPUBLIC sal_Bool SaveDictionaries( const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > &xDicList );
+LNG_DLLPUBLIC bool SaveDictionaries( const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > &xDicList );
// AppExitLstnr:
// virtual base class that calls it AtExit function when the application
diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx
index c21df30..971a2ca 100644
--- a/linguistic/source/convdic.cxx
+++ b/linguistic/source/convdic.cxx
@@ -163,12 +163,11 @@
-ConvDic::ConvDic(
- const String &rName,
- sal_Int16 nLang,
- sal_Int16 nConvType,
- sal_Bool bBiDirectional,
- const String &rMainURL) :
+ConvDic::ConvDic( const OUString &rName,
+ sal_Int16 nLang,
+ sal_Int16 nConvType,
+ bool bBiDirectional,
+ const OUString &rMainURL) :
aFlushListeners( GetLinguMutex() )
{
aName = rName;
@@ -182,20 +181,20 @@
pConvPropType = std::auto_ptr< PropTypeMap >( new PropTypeMap );
nMaxLeftCharCount = nMaxRightCharCount = 0;
- bMaxCharCountIsValid = sal_True;
+ bMaxCharCountIsValid = true;
- bNeedEntries = sal_True;
- bIsModified = bIsActive = sal_False;
- bIsReadonly = sal_False;
+ bNeedEntries = true;
+ bIsModified = bIsActive = false;
+ bIsReadonly = false;
- if( rMainURL.Len() > 0 )
+ if( !rMainURL.isEmpty() )
{
- sal_Bool bExists = sal_False;
+ bool bExists = false;
bIsReadonly = IsReadOnly( rMainURL, &bExists );
if( !bExists ) // new empty dictionary
{
- bNeedEntries = sal_False;
+ bNeedEntries = false;
//! create physical representation of an **empty** dictionary
//! that could be found by the dictionary-list implementation
// (Note: empty dictionaries are not just empty files!)
@@ -205,7 +204,7 @@
}
else
{
- bNeedEntries = sal_False;
+ bNeedEntries = false;
}
}
diff --git a/linguistic/source/convdic.hxx b/linguistic/source/convdic.hxx
index 375acbb..7fd5c51 100644
--- a/linguistic/source/convdic.hxx
+++ b/linguistic/source/convdic.hxx
@@ -108,11 +108,11 @@
void Save();
public:
- ConvDic( const String &rName,
+ ConvDic( const OUString &rName,
sal_Int16 nLanguage,
sal_Int16 nConversionType,
- sal_Bool bBiDirectional,
- const String &rMainURL);
+ bool bBiDirectional,
+ const OUString &rMainURL);
virtual ~ConvDic();
// XConversionDictionary
diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index 91c59b5..a8eee76 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -18,7 +18,6 @@
*/
#include <sal/macros.h>
-#include <tools/string.hxx>
#include <tools/debug.hxx>
#include <unotools/pathoptions.hxx>
#include <svl/lngmisc.hxx>
@@ -200,7 +199,7 @@
}
-sal_Bool IsUseDicList( const PropertyValues &rProperties,
+bool IsUseDicList( const PropertyValues &rProperties,
const uno::Reference< XPropertySet > &rxProp )
{
sal_Bool bRes = sal_True;
@@ -224,12 +223,12 @@
xFast->getFastPropertyValue( UPH_IS_USE_DICTIONARY_LIST ) >>= bRes;
}
- return bRes;
+ return bRes ? true : false;
}
-sal_Bool IsIgnoreControlChars( const PropertyValues &rProperties,
- const uno::Reference< XPropertySet > &rxProp )
+bool IsIgnoreControlChars( const PropertyValues &rProperties,
+ const uno::Reference< XPropertySet > &rxProp )
{
sal_Bool bRes = sal_True;
@@ -256,7 +255,7 @@
}
-static sal_Bool lcl_HasHyphInfo( const uno::Reference<XDictionaryEntry> &xEntry )
+static bool lcl_HasHyphInfo( const uno::Reference<XDictionaryEntry> &xEntry )
{
sal_Bool bRes = sal_False;
if (xEntry.is())
@@ -266,14 +265,14 @@
sal_Int32 nIdx = xEntry->getDictionaryWord().indexOf( '=' );
bRes = nIdx != -1 && nIdx != 0;
}
- return bRes;
+ return bRes ? true: false;
}
uno::Reference< XDictionaryEntry > SearchDicList(
const uno::Reference< XSearchableDictionaryList > &xDicList,
const OUString &rWord, sal_Int16 nLanguage,
- sal_Bool bSearchPosDics, sal_Bool bSearchSpellEntry )
+ bool bSearchPosDics, bool bSearchSpellEntry )
{
MutexGuard aGuard( GetLinguMutex() );
@@ -319,12 +318,12 @@
}
-sal_Bool SaveDictionaries( const uno::Reference< XSearchableDictionaryList > &xDicList )
+bool SaveDictionaries( const uno::Reference< XSearchableDictionaryList > &xDicList )
{
if (!xDicList.is())
- return sal_True;
+ return true;
- sal_Bool bRet = sal_True;
+ bool bRet = true;
Sequence< uno::Reference< XDictionary > > aDics( xDicList->getDictionaries() );
const uno::Reference< XDictionary > *pDic = aDics.getConstArray();
@@ -342,7 +341,7 @@
}
catch(uno::Exception &)
{
- bRet = sal_False;
+ bRet = false;
}
}
@@ -352,9 +351,9 @@
sal_uInt8 AddEntryToDic(
uno::Reference< XDictionary > &rxDic,
- const OUString &rWord, sal_Bool bIsNeg,
+ const OUString &rWord, bool bIsNeg,
const OUString &rRplcTxt, sal_Int16 /* nRplcLang */,
- sal_Bool bStripDot )
+ bool bStripDot )
{
if (!rxDic.is())
return DIC_ERR_NOT_EXISTS;
@@ -408,12 +407,12 @@
}
-sal_Bool IsReadOnly( const String &rURL, sal_Bool *pbExist )
+bool IsReadOnly( const OUString &rURL, bool *pbExist )
{
- sal_Bool bRes = sal_False;
- sal_Bool bExists = sal_False;
+ bool bRes = false;
+ bool bExists = false;
- if (rURL.Len() > 0)
+ if (!rURL.isEmpty())
{
try
{
@@ -423,13 +422,15 @@
bExists = aContent.isDocument();
if (bExists)
{
+ sal_Bool bResStream;
Any aAny( aContent.getPropertyValue( "IsReadOnly" ) );
- aAny >>= bRes;
+ aAny >>= bResStream;
+ bRes = bResStream ? true : false;
}
}
catch (Exception &)
{
- bRes = sal_True;
+ bRes = true;
}
}
@@ -609,7 +610,7 @@
}
-sal_Bool IsUpper( const String &rText, xub_StrLen nPos, xub_StrLen nLen, sal_Int16 nLanguage )
+bool IsUpper( const OUString &rText, sal_Int32 nPos, sal_Int32 nLen, sal_Int16 nLanguage )
{
MutexGuard aGuard( lcl_GetCharClassMutex() );
@@ -625,7 +626,7 @@
sal_Int32 tlen = aTerm.getLength();
if ((pCC) && (tlen))
{
- String aStr(aTerm);
+ OUString aStr(aTerm);
sal_Int32 nc = 0;
for (sal_uInt16 tindex = 0; tindex < tlen; tindex++)
{
@@ -647,7 +648,7 @@
}
-String ToLower( const String &rText, sal_Int16 nLanguage )
+OUString ToLower( const OUString &rText, sal_Int16 nLanguage )
{
MutexGuard aGuard( lcl_GetCharClassMutex() );
@@ -696,7 +697,7 @@
0x0001D7CE //1D7FF ; Decimal # Nd [50] MATHEMATICAL BOLD DIGIT ZERO..MATHEMATICAL MONOSPACE DIGIT NINE
};
-sal_Bool HasDigits( const OUString &rText )
+bool HasDigits( const OUString &rText )
{
static const int nNumDigitZeroes = sizeof(the_aDigitZeroes) / sizeof(the_aDigitZeroes[0]);
const sal_Int32 nLen = rText.getLength();
@@ -711,27 +712,27 @@
if (nDigitZero > nCodePoint)
break;
if (/*nDigitZero <= nCodePoint &&*/ nCodePoint <= nDigitZero + 9)
- return sal_True;
+ return true;
}
}
- return sal_False;
+ return false;
}
-sal_Bool IsNumeric( const String &rText )
+bool IsNumeric( const OUString &rText )
{
- sal_Bool bRes = sal_False;
- xub_StrLen nLen = rText.Len();
+ bool bRes = false;
+ sal_Int32 nLen = rText.getLength();
if (nLen)
{
- bRes = sal_True;
- xub_StrLen i = 0;
+ bRes = true;
+ sal_Int32 i = 0;
while (i < nLen)
{
- sal_Unicode cChar = rText.GetChar( i++ );
+ sal_Unicode cChar = rText[ i++ ];
if ( !((sal_Unicode)'0' <= cChar && cChar <= (sal_Unicode)'9') )
{
- bRes = sal_False;
+ bRes = false;
break;
}
}
diff --git a/linguistic/source/misc2.cxx b/linguistic/source/misc2.cxx
index eab239d..d4d903d 100644
--- a/linguistic/source/misc2.cxx
+++ b/linguistic/source/misc2.cxx
@@ -41,10 +41,10 @@
{
-sal_Bool FileExists( const String &rMainURL )
+bool FileExists( const OUString &rMainURL )
{
- sal_Bool bExists = sal_False;
- if (rMainURL.Len())
+ bool bExists = sal_False;
+ if (!rMainURL.isEmpty())
{
try
{
@@ -134,7 +134,7 @@
return GetMultiPaths_Impl( "Dictionary", nPathFlags );
}
-String GetWritableDictionaryURL( const String &rDicName )
+OUString GetWritableDictionaryURL( const OUString &rDicName )
{
// new user writable dictionaries should be created in the 'writable' path
String aDirName( GetDictionaryWriteablePath() );
diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx
index 371f523..a718809 100644
--- a/sfx2/source/appl/appdde.cxx
+++ b/sfx2/source/appl/appdde.cxx
@@ -206,7 +206,7 @@
: DdeTopic( "TRIGGER" )
{}
- virtual sal_Bool Execute( const String* );
+ virtual sal_Bool Execute( const OUString* );
};
class SfxDdeDocTopic_Impl : public DdeTopic
@@ -222,7 +222,7 @@
virtual DdeData* Get( sal_uIntPtr );
virtual sal_Bool Put( const DdeData* );
- virtual sal_Bool Execute( const String* );
+ virtual sal_Bool Execute( const OUString* );
virtual sal_Bool StartAdviseLoop();
virtual sal_Bool MakeItem( const OUString& rItem );
};
@@ -622,7 +622,7 @@
//--------------------------------------------------------------------
-sal_Bool SfxDdeTriggerTopic_Impl::Execute( const String* )
+sal_Bool SfxDdeTriggerTopic_Impl::Execute( const OUString* )
{
return sal_True;
}
@@ -659,7 +659,7 @@
return bRet;
}
-sal_Bool SfxDdeDocTopic_Impl::Execute( const String* pStr )
+sal_Bool SfxDdeDocTopic_Impl::Execute( const OUString* pStr )
{
long nRet = pStr ? pSh->DdeExecute( *pStr ) : 0;
return 0 != nRet;
--
To view, visit https://gerrit.libreoffice.org/4263
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8e566956416bb191a4d28acb6c3dc2c1e1daad62
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Norbert Thiebaud <nthiebaud at gmail.com>
More information about the LibreOffice
mailing list