diff options
Diffstat (limited to 'linguistic')
65 files changed, 1092 insertions, 1223 deletions
diff --git a/linguistic/inc/iprcache.hxx b/linguistic/inc/iprcache.hxx index 06241d4cd2d6..06241d4cd2d6 100644..100755 --- a/linguistic/inc/iprcache.hxx +++ b/linguistic/inc/iprcache.hxx diff --git a/linguistic/inc/hyphdta.hxx b/linguistic/inc/linguistic/hyphdta.hxx index 76806a740fee..e88a0c6615a5 100644..100755 --- a/linguistic/inc/hyphdta.hxx +++ b/linguistic/inc/linguistic/hyphdta.hxx @@ -52,18 +52,18 @@ class HyphenatedWord : { ::rtl::OUString aWord; ::rtl::OUString aHyphenatedWord; - INT16 nHyphPos; - INT16 nHyphenationPos; - INT16 nLanguage; - BOOL bIsAltSpelling; + sal_Int16 nHyphPos; + sal_Int16 nHyphenationPos; + sal_Int16 nLanguage; + sal_Bool bIsAltSpelling; // disallow copy-constructor and assignment-operator for now HyphenatedWord(const HyphenatedWord &); HyphenatedWord & operator = (const HyphenatedWord &); public: - HyphenatedWord(const ::rtl::OUString &rWord, INT16 nLang, INT16 nHyphenationPos, - const ::rtl::OUString &rHyphenatedWord, INT16 nHyphenPos ); + HyphenatedWord(const ::rtl::OUString &rWord, sal_Int16 nLang, sal_Int16 nHyphenationPos, + const ::rtl::OUString &rHyphenatedWord, sal_Int16 nHyphenPos ); virtual ~HyphenatedWord(); // XHyphenatedWord @@ -88,10 +88,10 @@ public: ::rtl::OUString GetWord() { return aWord; } ::rtl::OUString GetHyphenatedWord() { return aHyphenatedWord; } - INT16 GetLanguage() { return nLanguage; } + sal_Int16 GetLanguage() { return nLanguage; } void SetWord( ::rtl::OUString &rTxt ) { aWord = rTxt; } void SetHyphenatedWord( ::rtl::OUString &rTxt ) { aHyphenatedWord = rTxt; } - void SetLanguage( INT16 nLang ) { nLanguage = nLang; } + void SetLanguage( sal_Int16 nLang ) { nLanguage = nLang; } }; @@ -105,17 +105,17 @@ class PossibleHyphens : { ::rtl::OUString aWord; ::rtl::OUString aWordWithHyphens; - ::com::sun::star::uno::Sequence< INT16 > aOrigHyphenPos; - INT16 nLanguage; + ::com::sun::star::uno::Sequence< sal_Int16 > aOrigHyphenPos; + sal_Int16 nLanguage; // disallow copy-constructor and assignment-operator for now PossibleHyphens(const PossibleHyphens &); PossibleHyphens & operator = (const PossibleHyphens &); public: - PossibleHyphens(const ::rtl::OUString &rWord, INT16 nLang, + PossibleHyphens(const ::rtl::OUString &rWord, sal_Int16 nLang, const ::rtl::OUString &rHyphWord, - const ::com::sun::star::uno::Sequence< INT16 > &rPositions); + const ::com::sun::star::uno::Sequence< sal_Int16 > &rPositions); virtual ~PossibleHyphens(); // XPossibleHyphens @@ -133,9 +133,9 @@ public: throw(::com::sun::star::uno::RuntimeException); ::rtl::OUString GetWord() { return aWord; } - INT16 GetLanguage() { return nLanguage; } + sal_Int16 GetLanguage() { return nLanguage; } void SetWord( ::rtl::OUString &rTxt ) { aWord = rTxt; } - void SetLanguage( INT16 nLang ) { nLanguage = nLang; } + void SetLanguage( sal_Int16 nLang ) { nLanguage = nLang; } }; diff --git a/linguistic/inc/lngprophelp.hxx b/linguistic/inc/linguistic/lngprophelp.hxx index 45dd77a7f876..543429758b82 100644..100755 --- a/linguistic/inc/lngprophelp.hxx +++ b/linguistic/inc/linguistic/lngprophelp.hxx @@ -81,12 +81,12 @@ class PropertyChgHelper : int nEvtFlags; // flags for event types allowed to be launched // default values - BOOL bIsIgnoreControlCharacters; - BOOL bIsUseDictionaryList; + sal_Bool bIsIgnoreControlCharacters; + sal_Bool bIsUseDictionaryList; // return values, will be set to default value or current temporary value - BOOL bResIsIgnoreControlCharacters; - BOOL bResIsUseDictionaryList; + sal_Bool bResIsIgnoreControlCharacters; + sal_Bool bResIsUseDictionaryList; // disallow use of copy-constructor and assignment-operator @@ -103,9 +103,9 @@ protected: ::com::sun::star::beans::XPropertySet > & GetPropSet() { return xPropSet; } - void AddPropNames( const char *pNewNames[], INT32 nCount ); + void AddPropNames( const char *pNewNames[], sal_Int32 nCount ); - virtual BOOL propertyChange_Impl( + virtual sal_Bool propertyChange_Impl( const ::com::sun::star::beans::PropertyChangeEvent& rEvt ); public: @@ -156,8 +156,8 @@ public: ::com::sun::star::uno::XInterface > & GetEvtObj() const { return xMyEvtObj; } - BOOL IsIgnoreControlCharacters() const { return bResIsIgnoreControlCharacters; } - BOOL IsUseDictionaryList() const { return bResIsUseDictionaryList; } + sal_Bool IsIgnoreControlCharacters() const { return bResIsIgnoreControlCharacters; } + sal_Bool IsUseDictionaryList() const { return bResIsUseDictionaryList; } }; @@ -190,15 +190,15 @@ class PropertyHelper_Spell : public PropertyChgHelper { // default values - BOOL bIsSpellUpperCase; - BOOL bIsSpellWithDigits; - BOOL bIsSpellCapitalization; + sal_Bool bIsSpellUpperCase; + sal_Bool bIsSpellWithDigits; + sal_Bool bIsSpellCapitalization; // return values, will be set to default value or current temporary value - INT16 nResMaxNumberOfSuggestions; // special value that is not part of the property set and thus needs to be handled differently - BOOL bResIsSpellUpperCase; - BOOL bResIsSpellWithDigits; - BOOL bResIsSpellCapitalization; + sal_Int16 nResMaxNumberOfSuggestions; // special value that is not part of the property set and thus needs to be handled differently + sal_Bool bResIsSpellUpperCase; + sal_Bool bResIsSpellWithDigits; + sal_Bool bResIsSpellCapitalization; // disallow use of copy-constructor and assignment-operator @@ -209,7 +209,7 @@ protected: // PropertyChgHelper virtual void SetDefaultValues(); virtual void GetCurrentValues(); - virtual BOOL propertyChange_Impl( + virtual sal_Bool propertyChange_Impl( const ::com::sun::star::beans::PropertyChangeEvent& rEvt ); public: @@ -227,12 +227,12 @@ public: propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvt ) throw(::com::sun::star::uno::RuntimeException); - virtual INT16 GetDefaultNumberOfSuggestions() const; + virtual sal_Int16 GetDefaultNumberOfSuggestions() const; - INT16 GetMaxNumberOfSuggestions() const { return nResMaxNumberOfSuggestions; } - BOOL IsSpellUpperCase() const { return bResIsSpellUpperCase; } - BOOL IsSpellWithDigits() const { return bResIsSpellWithDigits; } - BOOL IsSpellCapitalization() const { return bResIsSpellCapitalization; } + sal_Int16 GetMaxNumberOfSuggestions() const { return nResMaxNumberOfSuggestions; } + sal_Bool IsSpellUpperCase() const { return bResIsSpellUpperCase; } + sal_Bool IsSpellWithDigits() const { return bResIsSpellWithDigits; } + sal_Bool IsSpellCapitalization() const { return bResIsSpellCapitalization; } }; /////////////////////////////////////////////////////////////////////////// @@ -241,12 +241,12 @@ class PropertyHelper_Hyphen : public PropertyChgHelper { // default values - INT16 nHyphMinLeading, + sal_Int16 nHyphMinLeading, nHyphMinTrailing, nHyphMinWordLength; // return values, will be set to default value or current temporary value - INT16 nResHyphMinLeading, + sal_Int16 nResHyphMinLeading, nResHyphMinTrailing, nResHyphMinWordLength; @@ -258,7 +258,7 @@ protected: // PropertyChgHelper virtual void SetDefaultValues(); virtual void GetCurrentValues(); - virtual BOOL propertyChange_Impl( + virtual sal_Bool propertyChange_Impl( const ::com::sun::star::beans::PropertyChangeEvent& rEvt ); public: @@ -276,9 +276,9 @@ public: propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvt ) throw(::com::sun::star::uno::RuntimeException); - INT16 GetMinLeading() const { return nResHyphMinLeading; } - INT16 GetMinTrailing() const { return nResHyphMinTrailing; } - INT16 GetMinWordLength() const { return nResHyphMinWordLength; } + sal_Int16 GetMinLeading() const { return nResHyphMinLeading; } + sal_Int16 GetMinTrailing() const { return nResHyphMinTrailing; } + sal_Int16 GetMinWordLength() const { return nResHyphMinWordLength; } }; /////////////////////////////////////////////////////////////////////////// diff --git a/linguistic/inc/lngprops.hxx b/linguistic/inc/linguistic/lngprops.hxx index 2b611d530ef8..2b611d530ef8 100644..100755 --- a/linguistic/inc/lngprops.hxx +++ b/linguistic/inc/linguistic/lngprops.hxx diff --git a/linguistic/inc/misc.hxx b/linguistic/inc/linguistic/misc.hxx index 3a369e574217..3b6f1fa653c7 100644..100755 --- a/linguistic/inc/misc.hxx +++ b/linguistic/inc/linguistic/misc.hxx @@ -98,11 +98,11 @@ namespace linguistic ::osl::Mutex & GetLinguMutex(); -LocaleDataWrapper & GetLocaleDataWrapper( INT16 nLang ); +LocaleDataWrapper & GetLocaleDataWrapper( sal_Int16 nLang ); /////////////////////////////////////////////////////////////////////////// -rtl_TextEncoding GetTextEncoding( INT16 nLanguage ); +rtl_TextEncoding GetTextEncoding( sal_Int16 nLanguage ); inline ::rtl::OUString BS2OU(const ByteString &rText, rtl_TextEncoding nEnc) { @@ -132,9 +132,9 @@ LanguageType LanguageToLocale( ::com::sun::star::lang::Locale& rLocale, LanguageType eLang ); ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > - LangSeqToLocaleSeq( const ::com::sun::star::uno::Sequence< INT16 > &rLangSeq ); + LangSeqToLocaleSeq( const ::com::sun::star::uno::Sequence< sal_Int16 > &rLangSeq ); -::com::sun::star::uno::Sequence< INT16 > +::com::sun::star::uno::Sequence< sal_Int16 > LocaleSeqToLangSeq( ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > &rLocaleSeq ); @@ -142,10 +142,10 @@ LanguageType // checks if file pointed to by rURL is readonly // and may also check return if such a file exists or not -BOOL IsReadOnly( const String &rURL, BOOL *pbExist = 0 ); +sal_Bool IsReadOnly( const String &rURL, sal_Bool *pbExist = 0 ); // checks if a file with the given URL exists -BOOL FileExists( const String &rURL ); +sal_Bool FileExists( const String &rURL ); /////////////////////////////////////////////////////////////////////////// @@ -164,7 +164,7 @@ String SearchFileInPaths( const String &rFile, const ::com::sun::star::uno:: /////////////////////////////////////////////////////////////////////////// -INT32 GetPosInWordToCheck( const rtl::OUString &rTxt, INT32 nPos ); +sal_Int32 GetPosInWordToCheck( const rtl::OUString &rTxt, sal_Int32 nPos ); ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenatedWord > @@ -174,19 +174,19 @@ INT32 GetPosInWordToCheck( const rtl::OUString &rTxt, INT32 nPos ); /////////////////////////////////////////////////////////////////////////// -BOOL IsUpper( const String &rText, xub_StrLen nPos, xub_StrLen nLen, INT16 nLanguage ); -BOOL IsLower( const String &rText, xub_StrLen nPos, xub_StrLen nLen, INT16 nLanguage ); +sal_Bool IsUpper( const String &rText, xub_StrLen nPos, xub_StrLen nLen, sal_Int16 nLanguage ); +sal_Bool IsLower( const String &rText, xub_StrLen nPos, xub_StrLen nLen, sal_Int16 nLanguage ); -inline BOOL IsUpper( const String &rText, INT16 nLanguage ) { return IsUpper( rText, 0, rText.Len(), nLanguage ); } -inline BOOL IsLower( const String &rText, INT16 nLanguage ) { return IsLower( rText, 0, rText.Len(), nLanguage ); } +inline sal_Bool IsUpper( const String &rText, sal_Int16 nLanguage ) { return IsUpper( rText, 0, rText.Len(), nLanguage ); } +inline sal_Bool IsLower( const String &rText, sal_Int16 nLanguage ) { return IsLower( rText, 0, rText.Len(), nLanguage ); } -String ToLower( const String &rText, INT16 nLanguage ); -String ToUpper( const String &rText, INT16 nLanguage ); -String ToTitle( const String &rText, INT16 nLanguage ); -sal_Unicode ToLower( const sal_Unicode cChar, INT16 nLanguage ); -sal_Unicode ToUpper( const sal_Unicode cChar, INT16 nLanguage ); -BOOL HasDigits( const ::rtl::OUString &rText ); -BOOL IsNumeric( const String &rText ); +String ToLower( const String &rText, sal_Int16 nLanguage ); +String ToUpper( const String &rText, sal_Int16 nLanguage ); +String ToTitle( const String &rText, sal_Int16 nLanguage ); +sal_Unicode ToLower( const sal_Unicode cChar, sal_Int16 nLanguage ); +sal_Unicode ToUpper( const sal_Unicode cChar, sal_Int16 nLanguage ); +sal_Bool HasDigits( const ::rtl::OUString &rText ); +sal_Bool IsNumeric( const String &rText ); /////////////////////////////////////////////////////////////////////////// @@ -198,11 +198,11 @@ BOOL IsNumeric( const String &rText ); /////////////////////////////////////////////////////////////////////////// -BOOL IsUseDicList( const ::com::sun::star::beans::PropertyValues &rProperties, +sal_Bool IsUseDicList( const ::com::sun::star::beans::PropertyValues &rProperties, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &rxPropSet ); -BOOL IsIgnoreControlChars( const ::com::sun::star::beans::PropertyValues &rProperties, +sal_Bool IsIgnoreControlChars( const ::com::sun::star::beans::PropertyValues &rProperties, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &rxPropSet ); @@ -210,8 +210,8 @@ BOOL IsIgnoreControlChars( const ::com::sun::star::beans::PropertyValues &rPrope ::com::sun::star::linguistic2::XDictionaryEntry > SearchDicList( const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionaryList >& rDicList, - const ::rtl::OUString& rWord, INT16 nLanguage, - BOOL bSearchPosDics, BOOL bSearchSpellEntry ); + const ::rtl::OUString& rWord, sal_Int16 nLanguage, + sal_Bool bSearchPosDics, sal_Bool bSearchSpellEntry ); sal_uInt8 AddEntryToDic( ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > &rxDic, diff --git a/linguistic/inc/spelldta.hxx b/linguistic/inc/linguistic/spelldta.hxx index f91675fb0824..0e501ee0002e 100644..100755 --- a/linguistic/inc/spelldta.hxx +++ b/linguistic/inc/linguistic/spelldta.hxx @@ -62,21 +62,21 @@ namespace linguistic MergeProposalSeqs( ::com::sun::star::uno::Sequence< ::rtl::OUString > &rAlt1, ::com::sun::star::uno::Sequence< ::rtl::OUString > &rAlt2, - BOOL bAllowDuplicates ); + sal_Bool bAllowDuplicates ); void SeqRemoveNegEntries( ::com::sun::star::uno::Sequence< ::rtl::OUString > &rSeq, ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionaryList > &rxDicList, - INT16 nLanguage ); + sal_Int16 nLanguage ); -BOOL SeqHasEntry( +sal_Bool SeqHasEntry( const ::com::sun::star::uno::Sequence< ::rtl::OUString > &rSeq, const ::rtl::OUString &rTxt); /////////////////////////////////////////////////////////////////////////// -void SearchSimilarText( const rtl::OUString &rText, INT16 nLanguage, +void SearchSimilarText( const rtl::OUString &rText, sal_Int16 nLanguage, ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionaryList > &xDicList, std::vector< rtl::OUString > & rDicListProps ); @@ -93,8 +93,8 @@ class SpellAlternatives : { ::com::sun::star::uno::Sequence< ::rtl::OUString > aAlt; // list of alternatives, may be empty. ::rtl::OUString aWord; - INT16 nType; // type of failure - INT16 nLanguage; + sal_Int16 nType; // type of failure + sal_Int16 nLanguage; // disallow copy-constructor and assignment-operator for now SpellAlternatives(const SpellAlternatives &); @@ -102,9 +102,9 @@ class SpellAlternatives : public: SpellAlternatives(); - SpellAlternatives(const ::rtl::OUString &rWord, INT16 nLang, INT16 nFailureType, + SpellAlternatives(const ::rtl::OUString &rWord, sal_Int16 nLang, sal_Int16 nFailureType, const ::rtl::OUString &rRplcWord ); - SpellAlternatives(const ::rtl::OUString &rWord, INT16 nLang, INT16 nFailureType, + SpellAlternatives(const ::rtl::OUString &rWord, sal_Int16 nLang, sal_Int16 nFailureType, const ::com::sun::star::uno::Sequence< ::rtl::OUString > &rAlternatives ); virtual ~SpellAlternatives(); @@ -120,8 +120,8 @@ public: virtual void SAL_CALL setFailureType( ::sal_Int16 nFailureType ) throw (::com::sun::star::uno::RuntimeException); // non-interface specific functions - void SetWordLanguage(const ::rtl::OUString &rWord, INT16 nLang); - void SetFailureType(INT16 nTypeP); + void SetWordLanguage(const ::rtl::OUString &rWord, sal_Int16 nLang); + void SetFailureType(sal_Int16 nTypeP); void SetAlternatives( const ::com::sun::star::uno::Sequence< ::rtl::OUString > &rAlt ); }; diff --git a/linguistic/inc/makefile.mk b/linguistic/inc/makefile.mk index fa5aad7b0a40..fa5aad7b0a40 100644..100755 --- a/linguistic/inc/makefile.mk +++ b/linguistic/inc/makefile.mk diff --git a/linguistic/inc/pch/precompiled_linguistic.cxx b/linguistic/inc/pch/precompiled_linguistic.cxx index 0cf855ebe4f6..0cf855ebe4f6 100644..100755 --- a/linguistic/inc/pch/precompiled_linguistic.cxx +++ b/linguistic/inc/pch/precompiled_linguistic.cxx diff --git a/linguistic/inc/pch/precompiled_linguistic.hxx b/linguistic/inc/pch/precompiled_linguistic.hxx index e0e70ffb9bd9..e0e70ffb9bd9 100644..100755 --- a/linguistic/inc/pch/precompiled_linguistic.hxx +++ b/linguistic/inc/pch/precompiled_linguistic.hxx diff --git a/linguistic/inc/thesdta.hxx b/linguistic/inc/thesdta.hxx index ea4d7cc89991..8cfe95ac4789 100644..100755 --- a/linguistic/inc/thesdta.hxx +++ b/linguistic/inc/thesdta.hxx @@ -52,7 +52,7 @@ class ThesaurusMeaning : protected: ::rtl::OUString aText; // one of the found 'meanings' for the looked up text ::rtl::OUString aLookUpText; // text that was looked up in the thesaurus - INT16 nLookUpLanguage; // language of the text that was looked up + sal_Int16 nLookUpLanguage; // language of the text that was looked up // disallow copy-constructor and assignment-operator for now ThesaurusMeaning(const ThesaurusMeaning &); @@ -60,7 +60,7 @@ protected: public: ThesaurusMeaning(const ::rtl::OUString &rText, - const ::rtl::OUString &rLookUpText, INT16 nLookUpLang ); + const ::rtl::OUString &rLookUpText, sal_Int16 nLookUpLang ); virtual ~ThesaurusMeaning(); // XMeaning diff --git a/linguistic/prj/build.lst b/linguistic/prj/build.lst index 8b17240c316d..107a42fcedab 100644..100755 --- a/linguistic/prj/build.lst +++ b/linguistic/prj/build.lst @@ -1,6 +1,10 @@ -lg linguistic : svl xmloff ucbhelper comphelper ICU:icu NULL +lg linguistic : svl xmloff ucbhelper comphelper ICU:icu LIBXSLT:libxslt NULL lg linguistic usr1 - all lg_mkout NULL lg linguistic\prj get - all lg_prj NULL lg linguistic\inc nmake - all lg_inc NULL lg linguistic\source nmake - all lg_src lg_inc NULL + lg linguistic\qa\unoapi nmake - all lg_qa_unoapi NULL + +# could be we need a Japanese office version +# lg linguistic\qa\complex\linguistic nmake - all lg_qa_complex NULL diff --git a/linguistic/prj/d.lst b/linguistic/prj/d.lst index 01a755e53cc6..03237f925764 100644..100755 --- a/linguistic/prj/d.lst +++ b/linguistic/prj/d.lst @@ -7,4 +7,7 @@ ..\xml\*.xml %_DEST%\xml%_EXT%\*.xml mkdir: %_DEST%\inc%_EXT%\linguistic -..\inc\*.hxx %_DEST%\inc%_EXT%\linguistic\*.hxx +..\inc\linguistic\*.hxx %_DEST%\inc%_EXT%\linguistic\*.hxx + +..\%__SRC%\misc\lng.component %_DEST%\xml%_EXT%\lng.component + diff --git a/linguistic/qa/complex/linguistic/HangulHanjaConversion.java b/linguistic/qa/complex/linguistic/HangulHanjaConversion.java index 160a1b42fd78..63412254c29f 100644..100755 --- a/linguistic/qa/complex/linguistic/HangulHanjaConversion.java +++ b/linguistic/qa/complex/linguistic/HangulHanjaConversion.java @@ -43,56 +43,57 @@ import com.sun.star.linguistic2.XConversionDictionaryList; import com.sun.star.sheet.XSpreadsheet; import com.sun.star.sheet.XSpreadsheetDocument; import com.sun.star.table.XCell; -import com.sun.star.text.XTextCursor; -import com.sun.star.text.XTextDocument; -import com.sun.star.text.XWordCursor; + import com.sun.star.uno.UnoRuntime; -import complexlib.ComplexTestCase; -import java.io.PrintWriter; import util.DesktopTools; +// import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; -public class HangulHanjaConversion extends ComplexTestCase { +public class HangulHanjaConversion { XMultiServiceFactory xMSF = null; boolean disposed = false; Locale aLocale = new Locale("ko", "KR", ""); short dictType = ConversionDictionaryType.HANGUL_HANJA; - public String[] getTestMethodNames() { - return new String[] { "ConversionDictionaryList" }; - } +// public String[] getTestMethodNames() { +// return new String[] { "ConversionDictionaryList" }; +// } - public void before() { - xMSF = (XMultiServiceFactory) param.getMSF(); + @Before public void before() { + xMSF = getMSF(); } - public void ConversionDictionaryList() { + @Test public void ConversionDictionaryList() { Object ConversionDictionaryList = null; try { ConversionDictionaryList = xMSF.createInstance( "com.sun.star.linguistic2.ConversionDictionaryList"); } catch (com.sun.star.uno.Exception e) { - assure("Couldn't create ConversionDictionaryList", false); + fail("Couldn't create ConversionDictionaryList"); } if (ConversionDictionaryList == null) { - assure("Couldn't create ConversionDictionaryList", false); + fail("Couldn't create ConversionDictionaryList"); } boolean bList = checkXConversionDictionaryList( ConversionDictionaryList); - assure("XConversionDictionaryList doesnt work as expected", bList); + assertTrue("XConversionDictionaryList doesnt work as expected", bList); } private boolean checkXConversionDictionaryList(Object list) { boolean res = true; - XConversionDictionaryList xCList = (XConversionDictionaryList) UnoRuntime.queryInterface( - XConversionDictionaryList.class, - list); + XConversionDictionaryList xCList = UnoRuntime.queryInterface(XConversionDictionaryList.class, list); XConversionDictionary xDict = null; try { @@ -100,28 +101,30 @@ public class HangulHanjaConversion extends ComplexTestCase { dictType); } catch (com.sun.star.lang.NoSupportException e) { res = false; - assure("Couldn't add Dictionary", false); + fail("Couldn't add Dictionary"); } catch (com.sun.star.container.ElementExistException e) { res = false; - assure("Couldn't add Dictionary", false); + fail("Couldn't add Dictionary"); } try { xCList.addNewDictionary("addNewDictionary", aLocale, dictType); res = false; - assure("wrong exception while adding Dictionary again", false); + fail("wrong exception while adding Dictionary again"); } catch (com.sun.star.lang.NoSupportException e) { res = false; - assure("wrong exception while adding Dictionary again", false); + fail("wrong exception while adding Dictionary again"); } catch (com.sun.star.container.ElementExistException e) { } boolean localRes = checkNameContainer(xCList.getDictionaryContainer()); res &= localRes; - assure("getDictionaryContainer didn't work as expected", localRes); + assertTrue("getDictionaryContainer didn't work as expected", localRes); - String FileToLoad = util.utils.getFullTestURL("hangulhanja.sxc"); - XComponent xDoc = DesktopTools.loadDoc(xMSF, FileToLoad, + String FileToLoad = TestDocument.getUrl("hangulhanja.sxc"); + // String FileToLoad = util.utils.getFullTestURL(); + +XComponent xDoc = DesktopTools.loadDoc(xMSF, FileToLoad, new PropertyValue[] { }); XSpreadsheet xSheet = getSheet(xDoc); boolean done = false; @@ -145,7 +148,7 @@ public class HangulHanjaConversion extends ComplexTestCase { } catch (com.sun.star.lang.IllegalArgumentException e) { e.printStackTrace(); res = false; - assure("Exception while checking adding entry", false); + fail("Exception while checking adding entry"); } catch (com.sun.star.container.ElementExistException e) { //ignored } @@ -157,7 +160,7 @@ public class HangulHanjaConversion extends ComplexTestCase { } catch (com.sun.star.lang.IllegalArgumentException e) { e.printStackTrace(); res = false; - assure("Exception while checking adding entry", false); + fail("Exception while checking adding entry"); } catch (com.sun.star.container.ElementExistException e) { //ignored } @@ -165,7 +168,7 @@ public class HangulHanjaConversion extends ComplexTestCase { localRes = xCList.queryMaxCharCount(aLocale, dictType, ConversionDirection.FROM_LEFT) == 42; res &= localRes; - assure("queryMaxCharCount returned the wrong value", localRes); + assertTrue("queryMaxCharCount returned the wrong value", localRes); String[] conversion = null; @@ -177,37 +180,36 @@ public class HangulHanjaConversion extends ComplexTestCase { TextConversionOption.NONE); } catch (com.sun.star.lang.IllegalArgumentException e) { res = false; - assure("Exception while calling queryConversions", false); + fail("Exception while calling queryConversions"); } catch (com.sun.star.lang.NoSupportException e) { res = false; - assure("Exception while calling queryConversions", false); + fail("Exception while calling queryConversions"); } localRes = conversion[0].equals(expectedConversion); res &= localRes; - assure("queryConversions didn't work as expected", localRes); + assertTrue("queryConversions didn't work as expected", localRes); try { xCList.getDictionaryContainer().removeByName("addNewDictionary"); } catch (com.sun.star.container.NoSuchElementException e) { res = false; - assure("exception while removing Dictionary again", false); + fail("exception while removing Dictionary again"); } catch (com.sun.star.lang.WrappedTargetException e) { res = false; - assure("exception while removing Dictionary again", false); + fail("exception while removing Dictionary again"); } localRes = !xCList.getDictionaryContainer() .hasByName("addNewDictionary"); res &= localRes; - assure("Dictionary hasn't been removed properly", localRes); + assertTrue("Dictionary hasn't been removed properly", localRes); - XComponent dicList = (XComponent) UnoRuntime.queryInterface( - XComponent.class, xCList); + XComponent dicList = UnoRuntime.queryInterface(XComponent.class, xCList); XEventListener listen = new EventListener(); dicList.addEventListener(listen); dicList.dispose(); - assure("dispose didn't work", disposed); + assertTrue("dispose didn't work", disposed); dicList.removeEventListener(listen); DesktopTools.closeDoc(xDoc); @@ -244,23 +246,17 @@ public class HangulHanjaConversion extends ComplexTestCase { } private XSpreadsheet getSheet(XComponent xDoc) { - XSpreadsheetDocument xSheetDoc = (XSpreadsheetDocument) UnoRuntime.queryInterface( - XSpreadsheetDocument.class, - xDoc); + XSpreadsheetDocument xSheetDoc = UnoRuntime.queryInterface(XSpreadsheetDocument.class, xDoc); XSpreadsheet xSheet = null; try { - xSheet = (XSpreadsheet) UnoRuntime.queryInterface( - XSpreadsheet.class, - xSheetDoc.getSheets() - .getByName(xSheetDoc.getSheets() - .getElementNames()[0])); + xSheet = UnoRuntime.queryInterface(XSpreadsheet.class, xSheetDoc.getSheets().getByName(xSheetDoc.getSheets().getElementNames()[0])); } catch (com.sun.star.container.NoSuchElementException e) { - log.println("Couldn't get sheet"); - e.printStackTrace((PrintWriter) log); + System.out.println("Couldn't get sheet"); + e.printStackTrace(); } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Couldn't get sheet"); - e.printStackTrace((PrintWriter) log); + System.out.println("Couldn't get sheet"); + e.printStackTrace(); } return xSheet; @@ -280,8 +276,8 @@ public class HangulHanjaConversion extends ComplexTestCase { try { re = xSpreadsheet.getCellByPosition(x, y); } catch (com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Couldn't get word"); - e.printStackTrace((PrintWriter) log); + System.out.println("Couldn't get word"); + e.printStackTrace(); } return re; @@ -342,4 +338,26 @@ public class HangulHanjaConversion extends ComplexTestCase { disposed = true; } } -}
\ No newline at end of file + + private XMultiServiceFactory getMSF() + { + final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); + return xMSF1; + } + + // setup and close connections + @BeforeClass public static void setUpConnection() throws Exception { + System.out.println("setUpConnection()"); + connection.setUp(); + } + + @AfterClass public static void tearDownConnection() + throws InterruptedException, com.sun.star.uno.Exception + { + System.out.println("tearDownConnection()"); + connection.tearDown(); + } + + private static final OfficeConnection connection = new OfficeConnection(); + +} diff --git a/linguistic/qa/complex/linguistic/TestDocument.java b/linguistic/qa/complex/linguistic/TestDocument.java new file mode 100755 index 000000000000..575640662e5f --- /dev/null +++ b/linguistic/qa/complex/linguistic/TestDocument.java @@ -0,0 +1,41 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +package complex.linguistic; + +import java.io.File; +import org.openoffice.test.OfficeFileUrl; + +final class TestDocument +{ + public static String getUrl(String name) + { + return OfficeFileUrl.getAbsolute(new File("testdocuments", name)); + } + + private TestDocument() {} +} diff --git a/linguistic/qa/complex/linguistic/makefile.mk b/linguistic/qa/complex/linguistic/makefile.mk index 75330e3c5de0..43a88ee0a198 100644..100755 --- a/linguistic/qa/complex/linguistic/makefile.mk +++ b/linguistic/qa/complex/linguistic/makefile.mk @@ -25,49 +25,37 @@ # #************************************************************************* -PRJ = ..$/..$/.. -TARGET = HangulHanjaConversion -PRJNAME = linguistic -PACKAGE = complex$/linguistic +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - - -#----- compile .java files ----------------------------------------- - -JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar \ - OOoRunner.jar mysql.jar -JAVAFILES = HangulHanjaConversion.java -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - -#----- make a jar from compiled files ------------------------------ +PRJ = ../../.. +PRJNAME = sc +TARGET = qa_complex_linguistic -MAXLINELENGTH = 100000 +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = complex/linguistic -JARCLASSDIRS = $(PACKAGE) -JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE +# here store only Files which contain a @Test +JAVATESTFILES = \ + HangulHanjaConversion.java -# --- Parameters for the test -------------------------------------- +# put here all other files +JAVAFILES = $(JAVATESTFILES) \ + TestDocument.java -# test base is java complex -CT_TESTBASE = -tb java_complex +JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) -# test looks something like the.full.package.TestName -CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b) +# Sample how to debug +# JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y -# start the runner application -CT_APP = org.openoffice.Runner - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - -RUN: run - -run: - +java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_TEST) -tdoc $(PWD)$/testdocuments +.END +.INCLUDE: settings.mk +.INCLUDE: target.mk +.INCLUDE: installationtest.mk +ALLTAR : javatest +.END diff --git a/linguistic/qa/complex/linguistic/testdocuments/hangulhanja.sxc b/linguistic/qa/complex/linguistic/testdocuments/hangulhanja.sxc Binary files differindex 823ce57d3261..823ce57d3261 100644..100755 --- a/linguistic/qa/complex/linguistic/testdocuments/hangulhanja.sxc +++ b/linguistic/qa/complex/linguistic/testdocuments/hangulhanja.sxc diff --git a/linguistic/qa/unoapi/Test.java b/linguistic/qa/unoapi/Test.java index 4a96418255ff..4a96418255ff 100644..100755 --- a/linguistic/qa/unoapi/Test.java +++ b/linguistic/qa/unoapi/Test.java diff --git a/linguistic/qa/unoapi/knownissues.xcl b/linguistic/qa/unoapi/knownissues.xcl index e5bf99558ac6..e5bf99558ac6 100644..100755 --- a/linguistic/qa/unoapi/knownissues.xcl +++ b/linguistic/qa/unoapi/knownissues.xcl diff --git a/linguistic/qa/unoapi/lng.sce b/linguistic/qa/unoapi/lng.sce index fd412843865d..fd412843865d 100644..100755 --- a/linguistic/qa/unoapi/lng.sce +++ b/linguistic/qa/unoapi/lng.sce diff --git a/linguistic/qa/unoapi/makefile.mk b/linguistic/qa/unoapi/makefile.mk index bd330c6fbaca..bd330c6fbaca 100644..100755 --- a/linguistic/qa/unoapi/makefile.mk +++ b/linguistic/qa/unoapi/makefile.mk diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx index bcdf835364c0..1093b363314d 100644..100755 --- a/linguistic/source/convdic.cxx +++ b/linguistic/source/convdic.cxx @@ -67,7 +67,7 @@ #include "convdic.hxx" #include "convdicxml.hxx" -#include "misc.hxx" +#include "linguistic/misc.hxx" #include "defs.hxx" using namespace std; @@ -156,9 +156,9 @@ void ReadThroughDic( const String &rMainURL, ConvDicXMLImport &rImport ) } } -BOOL IsConvDic( const String &rFileURL, INT16 &nLang, sal_Int16 &nConvType ) +sal_Bool IsConvDic( const String &rFileURL, sal_Int16 &nLang, sal_Int16 &nConvType ) { - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if (rFileURL.Len() == 0) return bRes; @@ -199,9 +199,9 @@ BOOL IsConvDic( const String &rFileURL, INT16 &nLang, sal_Int16 &nConvType ) ConvDic::ConvDic( const String &rName, - INT16 nLang, + sal_Int16 nLang, sal_Int16 nConvType, - BOOL bBiDirectional, + sal_Bool bBiDirectional, const String &rMainURL) : aFlushListeners( GetLinguMutex() ) { @@ -216,30 +216,30 @@ ConvDic::ConvDic( pConvPropType = std::auto_ptr< PropTypeMap >( new PropTypeMap ); nMaxLeftCharCount = nMaxRightCharCount = 0; - bMaxCharCountIsValid = TRUE; + bMaxCharCountIsValid = sal_True; - bNeedEntries = TRUE; - bIsModified = bIsActive = FALSE; - bIsReadonly = FALSE; + bNeedEntries = sal_True; + bIsModified = bIsActive = sal_False; + bIsReadonly = sal_False; if( rMainURL.Len() > 0 ) { - BOOL bExists = FALSE; + sal_Bool bExists = sal_False; bIsReadonly = IsReadOnly( rMainURL, &bExists ); if( !bExists ) // new empty dictionary { - bNeedEntries = FALSE; + bNeedEntries = sal_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!) Save(); - bIsReadonly = IsReadOnly( rMainURL ); // will be FALSE if Save was succesfull + bIsReadonly = IsReadOnly( rMainURL ); // will be sal_False if Save was succesfull } } else { - bNeedEntries = FALSE; + bNeedEntries = sal_False; } } @@ -254,12 +254,12 @@ void ConvDic::Load() DBG_ASSERT( !bIsModified, "dictionary is modified. Really do 'Load'?" ); //!! prevent function from being called recursively via HasEntry, AddEntry - bNeedEntries = FALSE; + bNeedEntries = sal_False; ConvDicXMLImport *pImport = new ConvDicXMLImport( this, aMainURL ); //!! keep a first reference to ensure the lifetime of the object !! uno::Reference< XInterface > xRef( (document::XFilter *) pImport, UNO_QUERY ); ReadThroughDic( aMainURL, *pImport ); // will implicitly add the entries - bIsModified = FALSE; + bIsModified = sal_False; } @@ -320,7 +320,7 @@ void ConvDic::Save() sal_Bool bRet = pExport->Export(); // write entries to file DBG_ASSERT( !pStream->GetError(), "I/O error while writing to stream" ); if (bRet) - bIsModified = FALSE; + bIsModified = sal_False; } DBG_ASSERT( !bIsModified, "dictionary still modified after save. Save failed?" ); } @@ -342,7 +342,7 @@ ConvMap::iterator ConvDic::GetEntry( ConvMap &rMap, const rtl::OUString &rFirstT } -BOOL ConvDic::HasEntry( const OUString &rLeftText, const OUString &rRightText ) +sal_Bool ConvDic::HasEntry( const OUString &rLeftText, const OUString &rRightText ) { if (bNeedEntries) Load(); @@ -369,7 +369,7 @@ void ConvDic::AddEntry( const OUString &rLeftText, const OUString &rRightText ) nMaxRightCharCount = (sal_Int16) rRightText.getLength(); } - bIsModified = TRUE; + bIsModified = sal_True; } @@ -389,8 +389,8 @@ void ConvDic::RemoveEntry( const OUString &rLeftText, const OUString &rRightText pFromRight->erase( aRightIt ); } - bIsModified = TRUE; - bMaxCharCountIsValid = FALSE; + bIsModified = sal_True; + bMaxCharCountIsValid = sal_False; } @@ -441,11 +441,11 @@ void SAL_CALL ConvDic::clear( ) aFromLeft .clear(); if (pFromRight.get()) pFromRight->clear(); - bNeedEntries = FALSE; - bIsModified = TRUE; + bNeedEntries = sal_False; + bIsModified = sal_True; nMaxLeftCharCount = 0; nMaxRightCharCount = 0; - bMaxCharCountIsValid = TRUE; + bMaxCharCountIsValid = sal_True; } @@ -471,14 +471,14 @@ uno::Sequence< OUString > SAL_CALL ConvDic::getConversions( pair< ConvMap::iterator, ConvMap::iterator > aRange = rConvMap.equal_range( aLookUpText ); - INT32 nCount = 0; + sal_Int32 nCount = 0; ConvMap::iterator aIt; for (aIt = aRange.first; aIt != aRange.second; ++aIt) ++nCount; uno::Sequence< OUString > aRes( nCount ); OUString *pRes = aRes.getArray(); - INT32 i = 0; + sal_Int32 i = 0; for (aIt = aRange.first; aIt != aRange.second; ++aIt) pRes[i++] = (*aIt).second; @@ -486,19 +486,19 @@ uno::Sequence< OUString > SAL_CALL ConvDic::getConversions( } -static BOOL lcl_SeqHasEntry( +static sal_Bool lcl_SeqHasEntry( const OUString *pSeqStart, // first element to check - INT32 nToCheck, // number of elements to check + sal_Int32 nToCheck, // number of elements to check const OUString &rText) { - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if (pSeqStart && nToCheck > 0) { const OUString *pDone = pSeqStart + nToCheck; // one behind last to check while (!bRes && pSeqStart != pDone) { if (*pSeqStart++ == rText) - bRes = TRUE; + bRes = sal_True; } } return bRes; @@ -521,7 +521,7 @@ uno::Sequence< OUString > SAL_CALL ConvDic::getConversionEntries( uno::Sequence< OUString > aRes( rConvMap.size() ); OUString *pRes = aRes.getArray(); ConvMap::iterator aIt = rConvMap.begin(); - INT32 nIdx = 0; + sal_Int32 nIdx = 0; while (aIt != rConvMap.end()) { OUString aCurEntry( (*aIt).first ); @@ -606,7 +606,7 @@ sal_Int16 SAL_CALL ConvDic::getMaxCharCount( ConversionDirection eDirection ) } } - bMaxCharCountIsValid = TRUE; + bMaxCharCountIsValid = sal_True; } sal_Int16 nRes = eDirection == ConversionDirection_FROM_LEFT ? nMaxLeftCharCount : nMaxRightCharCount; diff --git a/linguistic/source/convdic.hxx b/linguistic/source/convdic.hxx index d3ef70feb386..ad7bb42be498 100644..100755 --- a/linguistic/source/convdic.hxx +++ b/linguistic/source/convdic.hxx @@ -39,7 +39,7 @@ #include <boost/unordered_map.hpp> #include <set> #include <memory> -#include "misc.hxx" +#include "linguistic/misc.hxx" #include "defs.hxx" // text conversion dictionary extension @@ -53,7 +53,7 @@ class SvStream; /////////////////////////////////////////////////////////////////////////// -BOOL IsConvDic( const String &rFileURL, INT16 &nLang, sal_Int16 &nConvType ); +sal_Bool IsConvDic( const String &rFileURL, sal_Int16 &nLang, sal_Int16 &nConvType ); /////////////////////////////////////////////////////////////////////////// @@ -105,15 +105,15 @@ protected: String aMainURL; // URL to file rtl::OUString aName; - INT16 nLanguage; + sal_Int16 nLanguage; sal_Int16 nConversionType; sal_Int16 nMaxLeftCharCount; sal_Int16 nMaxRightCharCount; - BOOL bMaxCharCountIsValid; - BOOL bNeedEntries; - BOOL bIsModified; - BOOL bIsActive; - BOOL bIsReadonly; + sal_Bool bMaxCharCountIsValid; + sal_Bool bNeedEntries; + sal_Bool bIsModified; + sal_Bool bIsActive; + sal_Bool bIsReadonly; // disallow copy-constructor and assignment-operator for now ConvDic(const ConvDic &); @@ -125,9 +125,9 @@ protected: public: ConvDic( const String &rName, - INT16 nLanguage, + sal_Int16 nLanguage, sal_Int16 nConversionType, - BOOL bBiDirectional, + sal_Bool bBiDirectional, const String &rMainURL); virtual ~ConvDic(); @@ -164,7 +164,7 @@ public: static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); - BOOL HasEntry( const rtl::OUString &rLeftText, const rtl::OUString &rRightText ); + sal_Bool HasEntry( const rtl::OUString &rLeftText, const rtl::OUString &rRightText ); void AddEntry( const rtl::OUString &rLeftText, const rtl::OUString &rRightText ); void RemoveEntry( const rtl::OUString &rLeftText, const rtl::OUString &rRightText ); }; diff --git a/linguistic/source/convdiclist.cxx b/linguistic/source/convdiclist.cxx index 7fdc001134b1..d4878227824d 100644..100755 --- a/linguistic/source/convdiclist.cxx +++ b/linguistic/source/convdiclist.cxx @@ -52,7 +52,7 @@ #include "convdiclist.hxx" #include "convdic.hxx" #include "hhconvdic.hxx" -#include "misc.hxx" +#include "linguistic/misc.hxx" #include "defs.hxx" using namespace osl; @@ -112,7 +112,7 @@ class ConvDicNameContainer : ConvDicNameContainer(const ConvDicNameContainer &); ConvDicNameContainer & operator = (const ConvDicNameContainer &); - INT32 GetIndexByName_Impl( const OUString& rName ); + sal_Int32 GetIndexByName_Impl( const OUString& rName ); public: ConvDicNameContainer( ConvDicList &rMyConvDicList ); @@ -142,10 +142,10 @@ public: // calls Flush for the dictionaries that support XFlushable void FlushDics() const; - INT32 GetCount() const { return aConvDics.getLength(); } + sal_Int32 GetCount() const { return aConvDics.getLength(); } uno::Reference< XConversionDictionary > GetByName( const OUString& rName ); - const uno::Reference< XConversionDictionary > GetByIndex( INT32 nIdx ) + const uno::Reference< XConversionDictionary > GetByIndex( sal_Int32 nIdx ) { return aConvDics.getConstArray()[nIdx]; } @@ -165,9 +165,9 @@ ConvDicNameContainer::~ConvDicNameContainer() void ConvDicNameContainer::FlushDics() const { - INT32 nLen = aConvDics.getLength(); + sal_Int32 nLen = aConvDics.getLength(); const uno::Reference< XConversionDictionary > *pDic = aConvDics.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) + for (sal_Int32 i = 0; i < nLen; ++i) { uno::Reference< util::XFlushable > xFlush( pDic[i] , UNO_QUERY ); if (xFlush.is()) @@ -185,13 +185,13 @@ void ConvDicNameContainer::FlushDics() const } -INT32 ConvDicNameContainer::GetIndexByName_Impl( +sal_Int32 ConvDicNameContainer::GetIndexByName_Impl( const OUString& rName ) { - INT32 nRes = -1; - INT32 nLen = aConvDics.getLength(); + sal_Int32 nRes = -1; + sal_Int32 nLen = aConvDics.getLength(); const uno::Reference< XConversionDictionary > *pDic = aConvDics.getConstArray(); - for (INT32 i = 0; i < nLen && nRes == -1; ++i) + for (sal_Int32 i = 0; i < nLen && nRes == -1; ++i) { if (rName == pDic[i]->getName()) nRes = i; @@ -204,7 +204,7 @@ uno::Reference< XConversionDictionary > ConvDicNameContainer::GetByName( const OUString& rName ) { uno::Reference< XConversionDictionary > xRes; - INT32 nIdx = GetIndexByName_Impl( rName ); + sal_Int32 nIdx = GetIndexByName_Impl( rName ); if ( nIdx != -1) xRes = aConvDics.getArray()[nIdx]; return xRes; @@ -243,11 +243,11 @@ uno::Sequence< OUString > SAL_CALL ConvDicNameContainer::getElementNames( ) { MutexGuard aGuard( GetLinguMutex() ); - INT32 nLen = aConvDics.getLength(); + sal_Int32 nLen = aConvDics.getLength(); uno::Sequence< OUString > aRes( nLen ); OUString *pName = aRes.getArray(); const uno::Reference< XConversionDictionary > *pDic = aConvDics.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) + for (sal_Int32 i = 0; i < nLen; ++i) pName[i] = pDic[i]->getName(); return aRes; } @@ -268,7 +268,7 @@ void SAL_CALL ConvDicNameContainer::replaceByName( { MutexGuard aGuard( GetLinguMutex() ); - INT32 nRplcIdx = GetIndexByName_Impl( rName ); + sal_Int32 nRplcIdx = GetIndexByName_Impl( rName ); if (nRplcIdx == -1) throw NoSuchElementException(); uno::Reference< XConversionDictionary > xNew; @@ -293,7 +293,7 @@ void SAL_CALL ConvDicNameContainer::insertByName( if (!xNew.is() || xNew->getName() != rName) throw IllegalArgumentException(); - INT32 nLen = aConvDics.getLength(); + sal_Int32 nLen = aConvDics.getLength(); aConvDics.realloc( nLen + 1 ); aConvDics.getArray()[ nLen ] = xNew; } @@ -304,7 +304,7 @@ void SAL_CALL ConvDicNameContainer::removeByName( const OUString& rName ) { MutexGuard aGuard( GetLinguMutex() ); - INT32 nRplcIdx = GetIndexByName_Impl( rName ); + sal_Int32 nRplcIdx = GetIndexByName_Impl( rName ); if (nRplcIdx == -1) throw NoSuchElementException(); @@ -332,9 +332,9 @@ void SAL_CALL ConvDicNameContainer::removeByName( const OUString& rName ) } } - INT32 nLen = aConvDics.getLength(); + sal_Int32 nLen = aConvDics.getLength(); uno::Reference< XConversionDictionary > *pDic = aConvDics.getArray(); - for (INT32 i = nRplcIdx; i < nLen - 1; ++i) + for (sal_Int32 i = nRplcIdx; i < nLen - 1; ++i) pDic[i] = pDic[i + 1]; aConvDics.realloc( nLen - 1 ); } @@ -345,11 +345,11 @@ void ConvDicNameContainer::AddConvDics( const String &rExtension ) { const Sequence< OUString > aDirCnt( - utl::LocalFileHelper::GetFolderContents( rSearchDirPathURL, FALSE ) ); + utl::LocalFileHelper::GetFolderContents( rSearchDirPathURL, sal_False ) ); const OUString *pDirCnt = aDirCnt.getConstArray(); - INT32 nEntries = aDirCnt.getLength(); + sal_Int32 nEntries = aDirCnt.getLength(); - for (INT32 i = 0; i < nEntries; ++i) + for (sal_Int32 i = 0; i < nEntries; ++i) { String aURL( pDirCnt[i] ); @@ -361,7 +361,7 @@ void ConvDicNameContainer::AddConvDics( if(aExt != aSearchExt) continue; // skip other files - INT16 nLang; + sal_Int16 nLang; sal_Int16 nConvType; if (IsConvDic( aURL, nLang, nConvType )) { @@ -380,7 +380,7 @@ void ConvDicNameContainer::AddConvDics( else if ((nLang == LANGUAGE_CHINESE_SIMPLIFIED || nLang == LANGUAGE_CHINESE_TRADITIONAL) && nConvType == ConversionDictionaryType::SCHINESE_TCHINESE) { - xDic = new ConvDic( aDicName, nLang, nConvType, FALSE, aURL ); + xDic = new ConvDic( aDicName, nLang, nConvType, sal_False, aURL ); } if (xDic.is()) @@ -416,7 +416,7 @@ ConvDicList::ConvDicList() : aEvtListeners( GetLinguMutex() ) { pNameContainer = 0; - bDisposing = FALSE; + bDisposing = sal_False; pExitListener = new MyAppExitListener( *this ); xExitListener = pExitListener; @@ -458,9 +458,9 @@ ConvDicNameContainer & ConvDicList::GetNameContainer() // access list of text conversion dictionaries to activate SvtLinguOptions aOpt; SvtLinguConfig().GetOptions( aOpt ); - INT32 nLen = aOpt.aActiveConvDics.getLength(); + sal_Int32 nLen = aOpt.aActiveConvDics.getLength(); const OUString *pActiveConvDics = aOpt.aActiveConvDics.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) + for (sal_Int32 i = 0; i < nLen; ++i) { uno::Reference< XConversionDictionary > xDic = pNameContainer->GetByName( pActiveConvDics[i] ); @@ -501,7 +501,7 @@ uno::Reference< XConversionDictionary > SAL_CALL ConvDicList::addNewDictionary( { MutexGuard aGuard( GetLinguMutex() ); - INT16 nLang = LocaleToLanguage( rLocale ); + sal_Int16 nLang = LocaleToLanguage( rLocale ); if (GetNameContainer().hasByName( rName )) throw ElementExistException(); @@ -516,7 +516,7 @@ uno::Reference< XConversionDictionary > SAL_CALL ConvDicList::addNewDictionary( else if ((nLang == LANGUAGE_CHINESE_SIMPLIFIED || nLang == LANGUAGE_CHINESE_TRADITIONAL) && nConvDicType == ConversionDictionaryType::SCHINESE_TCHINESE) { - xRes = new ConvDic( rName, nLang, nConvDicType, FALSE, aDicMainURL ); + xRes = new ConvDic( rName, nLang, nConvDicType, sal_False, aDicMainURL ); } if (!xRes.is()) @@ -544,13 +544,13 @@ uno::Sequence< OUString > SAL_CALL ConvDicList::queryConversions( { MutexGuard aGuard( GetLinguMutex() ); - INT32 nCount = 0; + sal_Int32 nCount = 0; uno::Sequence< OUString > aRes( 20 ); OUString *pRes = aRes.getArray(); sal_Bool bSupported = sal_False; - INT32 nLen = GetNameContainer().GetCount(); - for (INT32 i = 0; i < nLen; ++i) + sal_Int32 nLen = GetNameContainer().GetCount(); + for (sal_Int32 i = 0; i < nLen; ++i) { const uno::Reference< XConversionDictionary > xDic( GetNameContainer().GetByIndex(i) ); sal_Bool bMatch = xDic.is() && @@ -562,7 +562,7 @@ uno::Sequence< OUString > SAL_CALL ConvDicList::queryConversions( Sequence< OUString > aNewConv( xDic->getConversions( rText, nStartPos, nLength, eDirection, nTextConversionOptions ) ); - INT32 nNewLen = aNewConv.getLength(); + sal_Int32 nNewLen = aNewConv.getLength(); if (nNewLen > 0) { if (nCount + nNewLen > aRes.getLength()) @@ -571,7 +571,7 @@ uno::Sequence< OUString > SAL_CALL ConvDicList::queryConversions( pRes = aRes.getArray(); } const OUString *pNewConv = aNewConv.getConstArray(); - for (INT32 k = 0; k < nNewLen; ++k) + for (sal_Int32 k = 0; k < nNewLen; ++k) pRes[nCount++] = pNewConv[k]; } } @@ -595,8 +595,8 @@ sal_Int16 SAL_CALL ConvDicList::queryMaxCharCount( sal_Int16 nRes = 0; GetNameContainer(); - INT32 nLen = GetNameContainer().GetCount(); - for (INT32 i = 0; i < nLen; ++i) + sal_Int32 nLen = GetNameContainer().GetCount(); + for (sal_Int32 i = 0; i < nLen; ++i) { const uno::Reference< XConversionDictionary > xDic( GetNameContainer().GetByIndex(i) ); if (xDic.is() && @@ -618,7 +618,7 @@ void SAL_CALL ConvDicList::dispose( ) MutexGuard aGuard( GetLinguMutex() ); if (!bDisposing) { - bDisposing = TRUE; + bDisposing = sal_True; EventObject aEvtObj( (XConversionDictionaryList *) this ); aEvtListeners.disposeAndClear( aEvtObj ); @@ -689,31 +689,6 @@ uno::Reference< uno::XInterface > SAL_CALL ConvDicList_CreateInstance( return StaticConvDicList::get(); } - -sal_Bool SAL_CALL ConvDicList_writeInfo( - void * /*pServiceManager*/, registry::XRegistryKey * pRegistryKey ) -{ - try - { - String aImpl( '/' ); - aImpl += ConvDicList::getImplementationName_Static().getStr(); - aImpl.AppendAscii( "/UNO/SERVICES" ); - uno::Reference< registry::XRegistryKey > xNewKey = - pRegistryKey->createKey(aImpl ); - uno::Sequence< OUString > aServices = - ConvDicList::getSupportedServiceNames_Static(); - for( INT32 i = 0; i < aServices.getLength(); i++ ) - xNewKey->createKey( aServices.getConstArray()[i]); - - return sal_True; - } - catch(Exception &) - { - return sal_False; - } -} - - void * SAL_CALL ConvDicList_getFactory( const sal_Char * pImplName, XMultiServiceFactory * pServiceManager, void * ) diff --git a/linguistic/source/convdiclist.hxx b/linguistic/source/convdiclist.hxx index 3e9d282bad34..cd6f1b75b834 100644..100755 --- a/linguistic/source/convdiclist.hxx +++ b/linguistic/source/convdiclist.hxx @@ -37,7 +37,7 @@ #include <svl/svarray.hxx> #include <tools/debug.hxx> -#include "misc.hxx" +#include "linguistic/misc.hxx" #include "lngopt.hxx" @@ -74,7 +74,7 @@ class ConvDicList : ::com::sun::star::uno::Reference< ::com::sun::star::frame:: XTerminateListener > xExitListener; - BOOL bDisposing; + sal_Bool bDisposing; // disallow copy-constructor and assignment-operator for now ConvDicList( const ConvDicList & ); diff --git a/linguistic/source/convdicxml.cxx b/linguistic/source/convdicxml.cxx index b1ee8479f233..017f930a39cb 100644..100755 --- a/linguistic/source/convdicxml.cxx +++ b/linguistic/source/convdicxml.cxx @@ -57,7 +57,7 @@ #include "convdic.hxx" #include "convdicxml.hxx" -#include "misc.hxx" +#include "linguistic/misc.hxx" #include "defs.hxx" using namespace std; @@ -129,7 +129,7 @@ public: class ConvDicXMLDictionaryContext_Impl : public ConvDicXMLImportContext { - INT16 nLanguage; + sal_Int16 nLanguage; sal_Int16 nConversionType; public: @@ -145,7 +145,7 @@ public: virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); virtual SvXMLImportContext * CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > &rxAttrList ); - INT16 GetLanguage() const { return nLanguage; } + sal_Int16 GetLanguage() const { return nLanguage; } sal_Int16 GetConversionType() const { return nConversionType; } }; diff --git a/linguistic/source/convdicxml.hxx b/linguistic/source/convdicxml.hxx index 4d95d3dc4207..b9b280ccaf0f 100644..100755 --- a/linguistic/source/convdicxml.hxx +++ b/linguistic/source/convdicxml.hxx @@ -39,7 +39,7 @@ #include <cppuhelper/interfacecontainer.h> #include <tools/string.hxx> #include <rtl/ustring.hxx> -#include "misc.hxx" +#include "linguistic/misc.hxx" #include "defs.hxx" @@ -90,7 +90,7 @@ class ConvDicXMLImport : public SvXMLImport // but the language and conversion type will // still be determined! - INT16 nLanguage; // language of the dictionary + sal_Int16 nLanguage; // language of the dictionary sal_Int16 nConversionType; // conversion type the dictionary is used for sal_Bool bSuccess; @@ -121,11 +121,11 @@ public: const com::sun::star::uno::Reference < com::sun::star::xml::sax::XAttributeList > &rxAttrList ); ConvDic * GetDic() { return pDic; } - INT16 GetLanguage() const { return nLanguage; } + sal_Int16 GetLanguage() const { return nLanguage; } sal_Int16 GetConversionType() const { return nConversionType; } sal_Bool GetSuccess() const { return bSuccess; } - void SetLanguage( INT16 nLang ) { nLanguage = nLang; } + void SetLanguage( sal_Int16 nLang ) { nLanguage = nLang; } void SetConversionType( sal_Int16 nType ) { nConversionType = nType; } }; diff --git a/linguistic/source/defs.hxx b/linguistic/source/defs.hxx index a7af9e7ba6a1..a7af9e7ba6a1 100644..100755 --- a/linguistic/source/defs.hxx +++ b/linguistic/source/defs.hxx diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx index 0c2d3e4071cc..a00e52113b47 100644..100755 --- a/linguistic/source/dicimp.cxx +++ b/linguistic/source/dicimp.cxx @@ -76,32 +76,32 @@ static const sal_Char* pVerStr5 = "WBSWG5"; static const sal_Char* pVerStr6 = "WBSWG6"; static const sal_Char* pVerOOo7 = "OOoUserDict1"; -static const INT16 DIC_VERSION_DONTKNOW = -1; -static const INT16 DIC_VERSION_2 = 2; -static const INT16 DIC_VERSION_5 = 5; -static const INT16 DIC_VERSION_6 = 6; -static const INT16 DIC_VERSION_7 = 7; +static const sal_Int16 DIC_VERSION_DONTKNOW = -1; +static const sal_Int16 DIC_VERSION_2 = 2; +static const sal_Int16 DIC_VERSION_5 = 5; +static const sal_Int16 DIC_VERSION_6 = 6; +static const sal_Int16 DIC_VERSION_7 = 7; static sal_Bool getTag(const ByteString &rLine, const sal_Char *pTagName, ByteString &rTagValue) { xub_StrLen nPos = rLine.Search( pTagName ); if (nPos == STRING_NOTFOUND) - return FALSE; + return sal_False; rTagValue = rLine.Copy( nPos + sal::static_int_cast< xub_StrLen >(strlen( pTagName )) ).EraseLeadingAndTrailingChars(); - return TRUE; + return sal_True; } -INT16 ReadDicVersion( SvStreamPtr &rpStream, USHORT &nLng, BOOL &bNeg ) +sal_Int16 ReadDicVersion( SvStreamPtr &rpStream, sal_uInt16 &nLng, sal_Bool &bNeg ) { // Sniff the header - INT16 nDicVersion = DIC_VERSION_DONTKNOW; + sal_Int16 nDicVersion = DIC_VERSION_DONTKNOW; sal_Char pMagicHeader[MAX_HEADER_LENGTH]; nLng = LANGUAGE_NONE; - bNeg = FALSE; + bNeg = sal_False; if (!rpStream.get() || rpStream->GetError()) return -1; @@ -142,9 +142,9 @@ INT16 ReadDicVersion( SvStreamPtr &rpStream, USHORT &nLng, BOOL &bNeg ) if (getTag(aLine, "type: ", aTagValue)) { if (aTagValue == "negative") - bNeg = TRUE; + bNeg = sal_True; else - bNeg = FALSE; + bNeg = sal_False; } if (aLine.Search ("---") != STRING_NOTFOUND) // end of header @@ -155,7 +155,7 @@ INT16 ReadDicVersion( SvStreamPtr &rpStream, USHORT &nLng, BOOL &bNeg ) } else { - USHORT nLen; + sal_uInt16 nLen; rpStream->Seek (nSniffPos ); @@ -189,7 +189,7 @@ INT16 ReadDicVersion( SvStreamPtr &rpStream, USHORT &nLng, BOOL &bNeg ) // Negative Flag sal_Char nTmp; *rpStream >> nTmp; - bNeg = (BOOL)nTmp; + bNeg = (sal_Bool)nTmp; } } @@ -212,15 +212,15 @@ DictionaryNeo::DictionaryNeo() : { nCount = 0; nDicVersion = DIC_VERSION_DONTKNOW; - bNeedEntries = FALSE; - bIsModified = bIsActive = FALSE; - bIsReadonly = FALSE; + bNeedEntries = sal_False; + bIsModified = bIsActive = sal_False; + bIsReadonly = sal_False; } DictionaryNeo::DictionaryNeo(const OUString &rName, - INT16 nLang, DictionaryType eType, + sal_Int16 nLang, DictionaryType eType, const OUString &rMainURL, - BOOL bWriteable) : + sal_Bool bWriteable) : aDicEvtListeners( GetLinguMutex() ), aDicName (rName), aMainURL (rMainURL), @@ -229,13 +229,13 @@ DictionaryNeo::DictionaryNeo(const OUString &rName, { nCount = 0; nDicVersion = DIC_VERSION_DONTKNOW; - bNeedEntries = TRUE; - bIsModified = bIsActive = FALSE; + bNeedEntries = sal_True; + bIsModified = bIsActive = sal_False; bIsReadonly = !bWriteable; if( rMainURL.getLength() > 0 ) { - BOOL bExists = FileExists( rMainURL ); + sal_Bool bExists = FileExists( rMainURL ); if( !bExists ) { // save new dictionaries with in Format 7 (UTF8 plain text) @@ -248,14 +248,14 @@ DictionaryNeo::DictionaryNeo(const OUString &rName, "DictionaryNeo: dictionaries should be writeable if they are to be saved" ); if (!bIsReadonly) saveEntries( rMainURL ); - bNeedEntries = FALSE; + bNeedEntries = sal_False; } } else { // non persistent dictionaries (like IgnoreAllList) should always be writable - bIsReadonly = FALSE; - bNeedEntries = FALSE; + bIsReadonly = sal_False; + bNeedEntries = sal_False; } } @@ -263,16 +263,16 @@ DictionaryNeo::~DictionaryNeo() { } -ULONG DictionaryNeo::loadEntries(const OUString &rMainURL) +sal_uLong DictionaryNeo::loadEntries(const OUString &rMainURL) { MutexGuard aGuard( GetLinguMutex() ); - // counter check that it is safe to set bIsModified to FALSE at + // counter check that it is safe to set bIsModified to sal_False at // the end of the function DBG_ASSERT(!bIsModified, "lng : dictionary already modified!"); // function should only be called once in order to load entries from file - bNeedEntries = FALSE; + bNeedEntries = sal_False; if (rMainURL.getLength() == 0) return 0; @@ -293,15 +293,15 @@ ULONG DictionaryNeo::loadEntries(const OUString &rMainURL) (void) e; } if (!xStream.is()) - return static_cast< ULONG >(-1); + return static_cast< sal_uLong >(-1); SvStreamPtr pStream = SvStreamPtr( utl::UcbStreamHelper::CreateStream( xStream ) ); - ULONG nErr = sal::static_int_cast< ULONG >(-1); + sal_uLong nErr = sal::static_int_cast< sal_uLong >(-1); // read header - BOOL bNegativ; - USHORT nLang; + sal_Bool bNegativ; + sal_uInt16 nLang; nDicVersion = ReadDicVersion(pStream, nLang, bNegativ); if (0 != (nErr = pStream->GetError())) return nErr; @@ -319,7 +319,7 @@ ULONG DictionaryNeo::loadEntries(const OUString &rMainURL) DIC_VERSION_5 == nDicVersion || DIC_VERSION_2 == nDicVersion) { - USHORT nLen = 0; + sal_uInt16 nLen = 0; sal_Char aWordBuf[ BUFSIZE ]; // Read the first word @@ -347,7 +347,7 @@ ULONG DictionaryNeo::loadEntries(const OUString &rMainURL) String aText( aDummy, eEnc ); uno::Reference< XDictionaryEntry > xEntry = new DicEntry( aText, bNegativ ); - addEntry_Impl( xEntry , TRUE ); //! don't launch events here + addEntry_Impl( xEntry , sal_True ); //! don't launch events here } *pStream >> nLen; @@ -384,7 +384,7 @@ ULONG DictionaryNeo::loadEntries(const OUString &rMainURL) rtl::OUString aText = rtl::OStringToOUString (aLine, RTL_TEXTENCODING_UTF8); uno::Reference< XDictionaryEntry > xEntry = new DicEntry( aText, eDicType == DictionaryType_NEGATIVE ); - addEntry_Impl( xEntry , TRUE ); //! don't launch events here + addEntry_Impl( xEntry , sal_True ); //! don't launch events here } } @@ -393,7 +393,7 @@ ULONG DictionaryNeo::loadEntries(const OUString &rMainURL) // since this routine should be called only initialy (prior to any // modification to be saved) we reset the bIsModified flag here that // was implicitly set by addEntry_Impl - bIsModified = FALSE; + bIsModified = sal_False; return pStream->GetError(); } @@ -413,7 +413,7 @@ static ByteString formatForSave( } -ULONG DictionaryNeo::saveEntries(const OUString &rURL) +sal_uLong DictionaryNeo::saveEntries(const OUString &rURL) { MutexGuard aGuard( GetLinguMutex() ); @@ -437,107 +437,54 @@ ULONG DictionaryNeo::saveEntries(const OUString &rURL) (void) e; } if (!xStream.is()) - return static_cast< ULONG >(-1); + return static_cast< sal_uLong >(-1); SvStreamPtr pStream = SvStreamPtr( utl::UcbStreamHelper::CreateStream( xStream ) ); + sal_uLong nErr = sal::static_int_cast< sal_uLong >(-1); - ULONG nErr = sal::static_int_cast< ULONG >(-1); - - rtl_TextEncoding eEnc = osl_getThreadTextEncoding(); - if (nDicVersion >= DIC_VERSION_6) - eEnc = RTL_TEXTENCODING_UTF8; - - if (nDicVersion == DIC_VERSION_7) + // + // Always write as the latest version, i.e. DIC_VERSION_7 + // + rtl_TextEncoding eEnc = RTL_TEXTENCODING_UTF8; + pStream->WriteLine(ByteString (pVerOOo7)); + if (0 != (nErr = pStream->GetError())) + return nErr; + if (nLanguage == LANGUAGE_NONE) + pStream->WriteLine(ByteString("lang: <none>")); + else { - pStream->WriteLine(ByteString (pVerOOo7)); - if (0 != (nErr = pStream->GetError())) - return nErr; - - if (nLanguage == LANGUAGE_NONE) - pStream->WriteLine(ByteString("lang: <none>")); - else - { - ByteString aLine("lang: "); - aLine += ByteString( String( MsLangId::convertLanguageToIsoString( nLanguage ) ), eEnc); - pStream->WriteLine( aLine ); - } - if (0 != (nErr = pStream->GetError())) - return nErr; - - if (eDicType == DictionaryType_POSITIVE) - pStream->WriteLine(ByteString("type: positive")); - else - pStream->WriteLine(ByteString("type: negative")); - if (0 != (nErr = pStream->GetError())) - return nErr; - - pStream->WriteLine(ByteString("---")); - if (0 != (nErr = pStream->GetError())) - return nErr; - - const uno::Reference< XDictionaryEntry > *pEntry = aEntries.getConstArray(); - for (INT32 i = 0; i < nCount; i++) - { - ByteString aOutStr = formatForSave(pEntry[i], eEnc); - pStream->WriteLine (aOutStr); - if (0 != (nErr = pStream->GetError())) - return nErr; - } + ByteString aLine("lang: "); + aLine += ByteString( String( MsLangId::convertLanguageToIsoString( nLanguage ) ), eEnc); + pStream->WriteLine( aLine ); } + if (0 != (nErr = pStream->GetError())) + return nErr; + if (eDicType == DictionaryType_POSITIVE) + pStream->WriteLine(ByteString("type: positive")); else + pStream->WriteLine(ByteString("type: negative")); + if (0 != (nErr = pStream->GetError())) + return nErr; + pStream->WriteLine(ByteString("---")); + if (0 != (nErr = pStream->GetError())) + return nErr; + const uno::Reference< XDictionaryEntry > *pEntry = aEntries.getConstArray(); + for (sal_Int32 i = 0; i < nCount; i++) { - sal_Char aWordBuf[BUFSIZE]; - - // write version - const sal_Char *pVerStr = NULL; - if (DIC_VERSION_6 == nDicVersion) - pVerStr = pVerStr6; - else - pVerStr = eDicType == DictionaryType_POSITIVE ? pVerStr2 : pVerStr5; - strcpy( aWordBuf, pVerStr ); - USHORT nLen = sal::static_int_cast< USHORT >(strlen( aWordBuf )); - *pStream << nLen; + ByteString aOutStr = formatForSave(pEntry[i], eEnc); + pStream->WriteLine (aOutStr); if (0 != (nErr = pStream->GetError())) return nErr; - pStream->Write(aWordBuf, nLen); - if (0 != (nErr = pStream->GetError())) - return nErr; - - *pStream << nLanguage; - if (0 != (nErr = pStream->GetError())) - return nErr; - *pStream << (sal_Char) (eDicType == DictionaryType_NEGATIVE ? TRUE : FALSE); - if (0 != (nErr = pStream->GetError())) - return nErr; - - const uno::Reference< XDictionaryEntry > *pEntry = aEntries.getConstArray(); - for (INT32 i = 0; i < nCount; i++) - { - ByteString aOutStr = formatForSave(pEntry[i], eEnc); - - // the old format would fail (mis-calculation of nLen) and write - // uninitialized junk for combined len >= BUFSIZE - we truncate - // silently here, but BUFSIZE is large anyway. - nLen = aOutStr.Len(); - if (nLen >= BUFSIZE) - nLen = BUFSIZE - 1; - - *pStream << nLen; - if (0 != (nErr = pStream->GetError())) - return nErr; - pStream->Write(aOutStr.GetBuffer(), nLen); - if (0 != (nErr = pStream->GetError())) - return nErr; - } } - //! get return value before Stream is destroyed - ULONG nError = pStream->GetError(); + //If we are migrating from an older version, then on first successful + //write, we're now converted to the latest version, i.e. DIC_VERSION_7 + nDicVersion = DIC_VERSION_7; - return nError; + return nErr; } -void DictionaryNeo::launchEvent(INT16 nEvent, +void DictionaryNeo::launchEvent(sal_Int16 nEvent, uno::Reference< XDictionaryEntry > xEntry) { MutexGuard aGuard( GetLinguMutex() ); @@ -558,7 +505,7 @@ void DictionaryNeo::launchEvent(INT16 nEvent, int DictionaryNeo::cmpDicEntry(const OUString& rWord1, const OUString &rWord2, - BOOL bSimilarOnly) + sal_Bool bSimilarOnly) { MutexGuard aGuard( GetLinguMutex() ); @@ -570,7 +517,7 @@ int DictionaryNeo::cmpDicEntry(const OUString& rWord1, OUString aWord1( rWord1 ), aWord2( rWord2 ); - INT32 nLen1 = aWord1.getLength(), + sal_Int32 nLen1 = aWord1.getLength(), nLen2 = aWord2.getLength(); if (bSimilarOnly) { @@ -582,7 +529,7 @@ int DictionaryNeo::cmpDicEntry(const OUString& rWord1, } const sal_Unicode cIgnChar = '='; - INT32 nIdx1 = 0, + sal_Int32 nIdx1 = 0, nIdx2 = 0, nNumIgnChar1 = 0, nNumIgnChar2 = 0; @@ -633,17 +580,17 @@ int DictionaryNeo::cmpDicEntry(const OUString& rWord1, nNumIgnChar2++; } - nRes = ((INT32) nLen1 - nNumIgnChar1) - ((INT32) nLen2 - nNumIgnChar2); + nRes = ((sal_Int32) nLen1 - nNumIgnChar1) - ((sal_Int32) nLen2 - nNumIgnChar2); } return nRes; } -BOOL DictionaryNeo::seekEntry(const OUString &rWord, - INT32 *pPos, BOOL bSimilarOnly) +sal_Bool DictionaryNeo::seekEntry(const OUString &rWord, + sal_Int32 *pPos, sal_Bool bSimilarOnly) { // look for entry with binary search. - // return TRUE if found FALSE else. + // return sal_True if found sal_False else. // if pPos != NULL it will become the position of the found entry, or // if that was not found the position where it has to be inserted // to keep the entries sorted @@ -651,7 +598,7 @@ BOOL DictionaryNeo::seekEntry(const OUString &rWord, MutexGuard aGuard( GetLinguMutex() ); const uno::Reference< XDictionaryEntry > *pEntry = aEntries.getConstArray(); - INT32 nUpperIdx = getCount(), + sal_Int32 nUpperIdx = getCount(), nMidIdx, nLowerIdx = 0; if( nUpperIdx > 0 ) @@ -667,66 +614,66 @@ BOOL DictionaryNeo::seekEntry(const OUString &rWord, if(nCmp == 0) { if( pPos ) *pPos = nMidIdx; - return TRUE; + return sal_True; } else if(nCmp > 0) nLowerIdx = nMidIdx + 1; else if( nMidIdx == 0 ) { if( pPos ) *pPos = nLowerIdx; - return FALSE; + return sal_False; } else nUpperIdx = nMidIdx - 1; } } if( pPos ) *pPos = nLowerIdx; - return FALSE; + return sal_False; } -BOOL DictionaryNeo::isSorted() +sal_Bool DictionaryNeo::isSorted() { - BOOL bRes = TRUE; + sal_Bool bRes = sal_True; const uno::Reference< XDictionaryEntry > *pEntry = aEntries.getConstArray(); - INT32 nEntries = getCount(); - INT32 i; + sal_Int32 nEntries = getCount(); + sal_Int32 i; for (i = 1; i < nEntries; i++) { if (cmpDicEntry( pEntry[i-1]->getDictionaryWord(), pEntry[i]->getDictionaryWord() ) > 0) { - bRes = FALSE; + bRes = sal_False; break; } } return bRes; } -BOOL DictionaryNeo::addEntry_Impl(const uno::Reference< XDictionaryEntry > xDicEntry, - BOOL bIsLoadEntries) +sal_Bool DictionaryNeo::addEntry_Impl(const uno::Reference< XDictionaryEntry > xDicEntry, + sal_Bool bIsLoadEntries) { MutexGuard aGuard( GetLinguMutex() ); - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if ( bIsLoadEntries || (!bIsReadonly && xDicEntry.is()) ) { - BOOL bIsNegEntry = xDicEntry->isNegative(); - BOOL bAddEntry = !isFull() && + sal_Bool bIsNegEntry = xDicEntry->isNegative(); + sal_Bool bAddEntry = !isFull() && ( ( eDicType == DictionaryType_POSITIVE && !bIsNegEntry ) || ( eDicType == DictionaryType_NEGATIVE && bIsNegEntry ) || ( eDicType == DictionaryType_MIXED ) ); // look for position to insert entry at // if there is already an entry do not insert the new one - INT32 nPos = 0; - BOOL bFound = FALSE; + sal_Int32 nPos = 0; + sal_Bool bFound = sal_False; if (bAddEntry) { bFound = seekEntry( xDicEntry->getDictionaryWord(), &nPos ); if (bFound) - bAddEntry = FALSE; + bAddEntry = sal_False; } if (bAddEntry) @@ -738,7 +685,7 @@ BOOL DictionaryNeo::addEntry_Impl(const uno::Reference< XDictionaryEntry > xDicE uno::Reference< XDictionaryEntry > *pEntry = aEntries.getArray(); // shift old entries right - INT32 i; + sal_Int32 i; for (i = nCount - 1; i >= nPos; i--) pEntry[ i+1 ] = pEntry[ i ]; // insert new entry at specified position @@ -747,8 +694,8 @@ BOOL DictionaryNeo::addEntry_Impl(const uno::Reference< XDictionaryEntry > xDicE nCount++; - bIsModified = TRUE; - bRes = TRUE; + bIsModified = sal_True; + bRes = sal_True; if (!bIsLoadEntries) launchEvent( DictionaryEventFlags::ADD_ENTRY, xDicEntry ); @@ -803,13 +750,13 @@ void SAL_CALL DictionaryNeo::setActive( sal_Bool bActivate ) if (bIsActive != bActivate) { bIsActive = bActivate != 0; - INT16 nEvent = bIsActive ? + sal_Int16 nEvent = bIsActive ? DictionaryEventFlags::ACTIVATE_DIC : DictionaryEventFlags::DEACTIVATE_DIC; // remove entries from memory if dictionary is deactivated - if (bIsActive == FALSE) + if (bIsActive == sal_False) { - BOOL bIsEmpty = nCount == 0; + sal_Bool bIsEmpty = nCount == 0; // save entries first if necessary if (bIsModified && hasLocation() && !isReadonly()) @@ -857,11 +804,11 @@ void SAL_CALL DictionaryNeo::setLocale( const Locale& aLocale ) throw(RuntimeException) { MutexGuard aGuard( GetLinguMutex() ); - INT16 nLanguageP = LocaleToLanguage( aLocale ); + sal_Int16 nLanguageP = LocaleToLanguage( aLocale ); if (!bIsReadonly && nLanguage != nLanguageP) { nLanguage = nLanguageP; - bIsModified = TRUE; // new language needs to be saved with dictionary + bIsModified = sal_True; // new language needs to be saved with dictionary launchEvent( DictionaryEventFlags::CHG_LANGUAGE, NULL ); } @@ -876,8 +823,8 @@ uno::Reference< XDictionaryEntry > SAL_CALL DictionaryNeo::getEntry( if (bNeedEntries) loadEntries( aMainURL ); - INT32 nPos; - BOOL bFound = seekEntry( aWord, &nPos, TRUE ); + sal_Int32 nPos; + sal_Bool bFound = seekEntry( aWord, &nPos, sal_True ); DBG_ASSERT( nCount <= aEntries.getLength(), "lng : wrong number of entries"); DBG_ASSERT(!bFound || nPos < nCount, "lng : index out of range"); @@ -891,7 +838,7 @@ sal_Bool SAL_CALL DictionaryNeo::addEntry( { MutexGuard aGuard( GetLinguMutex() ); - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if (!bIsReadonly) { @@ -910,7 +857,7 @@ sal_Bool SAL_CALL { MutexGuard aGuard( GetLinguMutex() ); - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if (!bIsReadonly) { @@ -947,15 +894,15 @@ sal_Bool SAL_CALL DictionaryNeo::remove( const OUString& aWord ) { MutexGuard aGuard( GetLinguMutex() ); - BOOL bRemoved = FALSE; + sal_Bool bRemoved = sal_False; if (!bIsReadonly) { if (bNeedEntries) loadEntries( aMainURL ); - INT32 nPos; - BOOL bFound = seekEntry( aWord, &nPos ); + sal_Int32 nPos; + sal_Bool bFound = seekEntry( aWord, &nPos ); DBG_ASSERT( nCount < aEntries.getLength(), "lng : wrong number of entries"); DBG_ASSERT(!bFound || nPos < nCount, "lng : index out of range"); @@ -972,7 +919,7 @@ sal_Bool SAL_CALL DictionaryNeo::remove( const OUString& aWord ) //! the following call reduces the length of the sequence by 1 also lcl_SequenceRemoveElementAt( aEntries, nPos ); - bRemoved = bIsModified = TRUE; + bRemoved = bIsModified = sal_True; launchEvent( DictionaryEventFlags::DEL_ENTRY, xDicEntry ); } @@ -1017,8 +964,8 @@ void SAL_CALL DictionaryNeo::clear( ) aEntries = uno::Sequence< uno::Reference< XDictionaryEntry > > ( 32 ); nCount = 0; - bNeedEntries = FALSE; - bIsModified = TRUE; + bNeedEntries = sal_False; + bIsModified = sal_True; launchEvent( DictionaryEventFlags::ENTRIES_CLEARED , NULL ); } @@ -1030,10 +977,10 @@ sal_Bool SAL_CALL DictionaryNeo::addDictionaryEventListener( { MutexGuard aGuard( GetLinguMutex() ); - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if (xListener.is()) { - INT32 nLen = aDicEvtListeners.getLength(); + sal_Int32 nLen = aDicEvtListeners.getLength(); bRes = aDicEvtListeners.addInterface( xListener ) != nLen; } return bRes; @@ -1045,10 +992,10 @@ sal_Bool SAL_CALL DictionaryNeo::removeDictionaryEventListener( { MutexGuard aGuard( GetLinguMutex() ); - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if (xListener.is()) { - INT32 nLen = aDicEvtListeners.getLength(); + sal_Int32 nLen = aDicEvtListeners.getLength(); bRes = aDicEvtListeners.removeInterface( xListener ) != nLen; } return bRes; @@ -1091,7 +1038,7 @@ void SAL_CALL DictionaryNeo::store() #endif } else - bIsModified = FALSE; + bIsModified = sal_False; } } @@ -1111,7 +1058,7 @@ void SAL_CALL DictionaryNeo::storeAsURL( else { aMainURL = aURL; - bIsModified = FALSE; + bIsModified = sal_False; bIsReadonly = IsReadOnly( getLocation() ); } } @@ -1135,18 +1082,18 @@ void SAL_CALL DictionaryNeo::storeToURL( DicEntry::DicEntry() { - bIsNegativ = FALSE; + bIsNegativ = sal_False; } DicEntry::DicEntry(const OUString &rDicFileWord, - BOOL bIsNegativWord) + sal_Bool bIsNegativWord) { if (rDicFileWord.getLength()) splitDicFileWord( rDicFileWord, aDicWord, aReplacement ); bIsNegativ = bIsNegativWord; } -DicEntry::DicEntry(const OUString &rDicWord, BOOL bNegativ, +DicEntry::DicEntry(const OUString &rDicWord, sal_Bool bNegativ, const OUString &rRplcText) : aDicWord (rDicWord), aReplacement (rRplcText), diff --git a/linguistic/source/dicimp.hxx b/linguistic/source/dicimp.hxx index a4dcfc8772b8..288682e481ec 100644..100755 --- a/linguistic/source/dicimp.hxx +++ b/linguistic/source/dicimp.hxx @@ -41,14 +41,14 @@ #include <tools/stream.hxx> #include "defs.hxx" -#include "misc.hxx" +#include "linguistic/misc.hxx" /////////////////////////////////////////////////////////////////////////// #define DIC_MAX_ENTRIES 30000 -INT16 ReadDicVersion( SvStreamPtr &rpStream, USHORT &nLng, BOOL &bNeg ); +sal_Int16 ReadDicVersion( SvStreamPtr &rpStream, sal_uInt16 &nLng, sal_Bool &bNeg ); const String GetDicExtension(); /////////////////////////////////////////////////////////////////////////// @@ -68,41 +68,41 @@ class DictionaryNeo : ::rtl::OUString aDicName; ::rtl::OUString aMainURL; ::com::sun::star::linguistic2::DictionaryType eDicType; - INT16 nCount; - INT16 nLanguage; - INT16 nDicVersion; - BOOL bNeedEntries; - BOOL bIsModified; - BOOL bIsActive; - BOOL bIsReadonly; + sal_Int16 nCount; + sal_Int16 nLanguage; + sal_Int16 nDicVersion; + sal_Bool bNeedEntries; + sal_Bool bIsModified; + sal_Bool bIsActive; + sal_Bool bIsReadonly; // disallow copy-constructor and assignment-operator for now DictionaryNeo(const DictionaryNeo &); DictionaryNeo & operator = (const DictionaryNeo &); - void launchEvent(INT16 nEvent, + void launchEvent(sal_Int16 nEvent, ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionaryEntry > xEntry); - ULONG loadEntries(const ::rtl::OUString &rMainURL); - ULONG saveEntries(const ::rtl::OUString &rMainURL); + sal_uLong loadEntries(const ::rtl::OUString &rMainURL); + sal_uLong saveEntries(const ::rtl::OUString &rMainURL); int cmpDicEntry(const ::rtl::OUString &rWord1, const ::rtl::OUString &rWord2, - BOOL bSimilarOnly = FALSE); - BOOL seekEntry(const ::rtl::OUString &rWord, INT32 *pPos, - BOOL bSimilarOnly = FALSE); - BOOL isSorted(); + sal_Bool bSimilarOnly = sal_False); + sal_Bool seekEntry(const ::rtl::OUString &rWord, sal_Int32 *pPos, + sal_Bool bSimilarOnly = sal_False); + sal_Bool isSorted(); - BOOL addEntry_Impl(const ::com::sun::star::uno::Reference< + sal_Bool addEntry_Impl(const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionaryEntry > xDicEntry, - BOOL bIsLoadEntries = FALSE); + sal_Bool bIsLoadEntries = sal_False); public: DictionaryNeo(); - DictionaryNeo(const ::rtl::OUString &rName, INT16 nLang, + DictionaryNeo(const ::rtl::OUString &rName, sal_Int16 nLang, ::com::sun::star::linguistic2::DictionaryType eType, const ::rtl::OUString &rMainURL, - BOOL bWriteable ); + sal_Bool bWriteable ); virtual ~DictionaryNeo(); // XNamed @@ -206,7 +206,7 @@ class DicEntry : { ::rtl::OUString aDicWord, // including hyphen positions represented by "=" aReplacement; // including hyphen positions represented by "=" - BOOL bIsNegativ; + sal_Bool bIsNegativ; // disallow copy-constructor and assignment-operator for now DicEntry(const DicEntry &); @@ -218,8 +218,8 @@ class DicEntry : public: DicEntry(); - DicEntry(const ::rtl::OUString &rDicFileWord, BOOL bIsNegativ); - DicEntry(const ::rtl::OUString &rDicWord, BOOL bIsNegativ, + DicEntry(const ::rtl::OUString &rDicFileWord, sal_Bool bIsNegativ); + DicEntry(const ::rtl::OUString &rDicWord, sal_Bool bIsNegativ, const ::rtl::OUString &rRplcText); virtual ~DicEntry(); diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx index a0c533516d0e..14255d99d349 100644..100755 --- a/linguistic/source/dlistimp.cxx +++ b/linguistic/source/dlistimp.cxx @@ -71,7 +71,7 @@ using ::rtl::OUString; /////////////////////////////////////////////////////////////////////////// -static BOOL IsVers2OrNewer( const String& rFileURL, USHORT& nLng, BOOL& bNeg ); +static sal_Bool IsVers2OrNewer( const String& rFileURL, sal_uInt16& nLng, sal_Bool& bNeg ); static void AddInternal( const uno::Reference< XDictionary > &rDic, const rtl::OUString& rNew ); @@ -89,8 +89,8 @@ class DicEvtListenerHelper : uno::Sequence< DictionaryEvent > aCollectDicEvt; uno::Reference< XDictionaryList > xMyDicList; - INT16 nCondensedEvt; - INT16 nNumCollectEvtListeners, + sal_Int16 nCondensedEvt; + sal_Int16 nNumCollectEvtListeners, nNumVerboseListeners; public: @@ -110,14 +110,14 @@ public: // non-UNO functions void DisposeAndClear( const EventObject &rEvtObj ); - BOOL AddDicListEvtListener( + sal_Bool AddDicListEvtListener( const uno::Reference< XDictionaryListEventListener >& rxListener, - BOOL bReceiveVerbose ); - BOOL RemoveDicListEvtListener( + sal_Bool bReceiveVerbose ); + sal_Bool RemoveDicListEvtListener( const uno::Reference< XDictionaryListEventListener >& rxListener ); - INT16 BeginCollectEvents(); - INT16 EndCollectEvents(); - INT16 FlushEvents(); + sal_Int16 BeginCollectEvents(); + sal_Int16 EndCollectEvents(); + sal_Int16 FlushEvents(); void ClearEvents() { nCondensedEvt = 0; } }; @@ -220,7 +220,7 @@ void SAL_CALL DicEvtListenerHelper::processDictionaryEvent( // update list of collected events if needs to be if (nNumVerboseListeners > 0) { - INT32 nColEvts = aCollectDicEvt.getLength(); + sal_Int32 nColEvts = aCollectDicEvt.getLength(); aCollectDicEvt.realloc( nColEvts + 1 ); aCollectDicEvt.getArray()[ nColEvts ] = rDicEvent; } @@ -230,32 +230,32 @@ void SAL_CALL DicEvtListenerHelper::processDictionaryEvent( } -BOOL DicEvtListenerHelper::AddDicListEvtListener( +sal_Bool DicEvtListenerHelper::AddDicListEvtListener( const uno::Reference< XDictionaryListEventListener >& xListener, - BOOL /*bReceiveVerbose*/ ) + sal_Bool /*bReceiveVerbose*/ ) { DBG_ASSERT( xListener.is(), "empty reference" ); - INT32 nCount = aDicListEvtListeners.getLength(); + sal_Int32 nCount = aDicListEvtListeners.getLength(); return aDicListEvtListeners.addInterface( xListener ) != nCount; } -BOOL DicEvtListenerHelper::RemoveDicListEvtListener( +sal_Bool DicEvtListenerHelper::RemoveDicListEvtListener( const uno::Reference< XDictionaryListEventListener >& xListener ) { DBG_ASSERT( xListener.is(), "empty reference" ); - INT32 nCount = aDicListEvtListeners.getLength(); + sal_Int32 nCount = aDicListEvtListeners.getLength(); return aDicListEvtListeners.removeInterface( xListener ) != nCount; } -INT16 DicEvtListenerHelper::BeginCollectEvents() +sal_Int16 DicEvtListenerHelper::BeginCollectEvents() { return ++nNumCollectEvtListeners; } -INT16 DicEvtListenerHelper::EndCollectEvents() +sal_Int16 DicEvtListenerHelper::EndCollectEvents() { DBG_ASSERT(nNumCollectEvtListeners > 0, "lng: mismatched function call"); if (nNumCollectEvtListeners > 0) @@ -268,7 +268,7 @@ INT16 DicEvtListenerHelper::EndCollectEvents() } -INT16 DicEvtListenerHelper::FlushEvents() +sal_Int16 DicEvtListenerHelper::FlushEvents() { if (0 != nCondensedEvt) { @@ -310,8 +310,8 @@ DicList::DicList() : { pDicEvtLstnrHelper = new DicEvtListenerHelper( this ); xDicEvtLstnrHelper = pDicEvtLstnrHelper; - bDisposing = FALSE; - bInCreation = FALSE; + bDisposing = sal_False; + bInCreation = sal_False; pExitListener = new MyAppExitListener( *this ); xExitListener = pExitListener; @@ -327,22 +327,22 @@ DicList::~DicList() void DicList::SearchForDictionaries( DictionaryVec_t&rDicList, const String &rDicDirURL, - BOOL bIsWriteablePath ) + sal_Bool bIsWriteablePath ) { osl::MutexGuard aGuard( GetLinguMutex() ); const uno::Sequence< rtl::OUString > aDirCnt( utl::LocalFileHelper:: - GetFolderContents( rDicDirURL, FALSE ) ); + GetFolderContents( rDicDirURL, sal_False ) ); const rtl::OUString *pDirCnt = aDirCnt.getConstArray(); - INT32 nEntries = aDirCnt.getLength(); + sal_Int32 nEntries = aDirCnt.getLength(); String aDCN( String::CreateFromAscii( "dcn" ) ); String aDCP( String::CreateFromAscii( "dcp" ) ); - for (INT32 i = 0; i < nEntries; ++i) + for (sal_Int32 i = 0; i < nEntries; ++i) { String aURL( pDirCnt[i] ); - USHORT nLang = LANGUAGE_NONE; - BOOL bNeg = FALSE; + sal_uInt16 nLang = LANGUAGE_NONE; + sal_Bool bNeg = sal_False; if(!::IsVers2OrNewer( aURL, nLang, bNeg )) { @@ -352,16 +352,16 @@ void DicList::SearchForDictionaries( aExt.ToLowerAscii(); if(aExt == aDCN) // negativ - bNeg = TRUE; + bNeg = sal_True; else if(aExt == aDCP) // positiv - bNeg = FALSE; + bNeg = sal_False; else continue; // andere Files } // Record in the list of Dictoinaries // When it already exists don't record - INT16 nSystemLanguage = MsLangId::getSystemLanguage(); + sal_Int16 nSystemLanguage = MsLangId::getSystemLanguage(); String aTmp1 = ToLower( aURL, nSystemLanguage ); xub_StrLen nPos = aTmp1.SearchBackward( '/' ); if (STRING_NOTFOUND != nPos) @@ -395,11 +395,11 @@ void DicList::SearchForDictionaries( } -INT32 DicList::GetDicPos(const uno::Reference< XDictionary > &xDic) +sal_Int32 DicList::GetDicPos(const uno::Reference< XDictionary > &xDic) { osl::MutexGuard aGuard( GetLinguMutex() ); - INT32 nPos = -1; + sal_Int32 nPos = -1; DictionaryVec_t& rDicList = GetOrCreateDicList(); size_t n = rDicList.size(); for (size_t i = 0; i < n; i++) @@ -436,8 +436,8 @@ uno::Sequence< uno::Reference< XDictionary > > SAL_CALL uno::Sequence< uno::Reference< XDictionary > > aDics( rDicList.size() ); uno::Reference< XDictionary > *pDic = aDics.getArray(); - INT32 n = (USHORT) aDics.getLength(); - for (INT32 i = 0; i < n; i++) + sal_Int32 n = (sal_uInt16) aDics.getLength(); + for (sal_Int32 i = 0; i < n; i++) pDic[i] = rDicList[i]; return aDics; @@ -472,14 +472,14 @@ sal_Bool SAL_CALL DicList::addDictionary( osl::MutexGuard aGuard( GetLinguMutex() ); if (bDisposing) - return FALSE; + return sal_False; - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if (xDictionary.is()) { DictionaryVec_t& rDicList = GetOrCreateDicList(); rDicList.push_back( xDictionary ); - bRes = TRUE; + bRes = sal_True; // add listener helper to the dictionaries listener lists xDictionary->addDictionaryEventListener( xDicEvtLstnrHelper ); @@ -494,10 +494,10 @@ sal_Bool SAL_CALL osl::MutexGuard aGuard( GetLinguMutex() ); if (bDisposing) - return FALSE; + return sal_False; - BOOL bRes = FALSE; - INT32 nPos = GetDicPos( xDictionary ); + sal_Bool bRes = sal_False; + sal_Int32 nPos = GetDicPos( xDictionary ); if (nPos >= 0) { // remove dictionary list from the dictionaries listener lists @@ -507,14 +507,14 @@ sal_Bool SAL_CALL if (xDic.is()) { // deactivate dictionary if not already done - xDic->setActive( FALSE ); + xDic->setActive( sal_False ); xDic->removeDictionaryEventListener( xDicEvtLstnrHelper ); } // remove element at nPos rDicList.erase( rDicList.begin() + nPos ); - bRes = TRUE; + bRes = sal_True; } return bRes; } @@ -527,11 +527,11 @@ sal_Bool SAL_CALL DicList::addDictionaryListEventListener( osl::MutexGuard aGuard( GetLinguMutex() ); if (bDisposing) - return FALSE; + return sal_False; DBG_ASSERT(!bReceiveVerbose, "lng : not yet supported"); - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if (xListener.is()) //! don't add empty references { bRes = pDicEvtLstnrHelper-> @@ -547,9 +547,9 @@ sal_Bool SAL_CALL DicList::removeDictionaryListEventListener( osl::MutexGuard aGuard( GetLinguMutex() ); if (bDisposing) - return FALSE; + return sal_False; - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if(xListener.is()) { bRes = pDicEvtLstnrHelper->RemoveDicListEvtListener( xListener ); @@ -582,7 +582,7 @@ uno::Reference< XDictionary > SAL_CALL { osl::MutexGuard aGuard( GetLinguMutex() ); - INT16 nLanguage = LocaleToLanguage( rLocale ); + sal_Int16 nLanguage = LocaleToLanguage( rLocale ); bool bIsWriteablePath = rURL.match( GetDictionaryWriteablePath(), 0 ); return new DictionaryNeo( rName, nLanguage, eDicType, rURL, bIsWriteablePath ); } @@ -607,7 +607,7 @@ void SAL_CALL if (!bDisposing) { - bDisposing = TRUE; + bDisposing = sal_True; EventObject aEvtObj( (XDictionaryList *) this ); aEvtListeners.disposeAndClear( aEvtObj ); @@ -668,7 +668,7 @@ void SAL_CALL void DicList::_CreateDicList() { - bInCreation = TRUE; + bInCreation = sal_True; // look for dictionaries const rtl::OUString aWriteablePath( GetDictionaryWriteablePath() ); @@ -676,7 +676,7 @@ void DicList::_CreateDicList() const rtl::OUString *pPaths = aPaths.getConstArray(); for (sal_Int32 i = 0; i < aPaths.getLength(); ++i) { - const BOOL bIsWriteablePath = (pPaths[i] == aWriteablePath); + const sal_Bool bIsWriteablePath = (pPaths[i] == aWriteablePath); SearchForDictionaries( aDicList, pPaths[i], bIsWriteablePath ); } @@ -689,7 +689,7 @@ void DicList::_CreateDicList() if (xIgnAll.is()) { AddUserData( xIgnAll ); - xIgnAll->setActive( TRUE ); + xIgnAll->setActive( sal_True ); addDictionary( xIgnAll ); } @@ -703,14 +703,14 @@ void DicList::_CreateDicList() // const uno::Sequence< rtl::OUString > aActiveDics( aOpt.GetActiveDics() ); const rtl::OUString *pActiveDic = aActiveDics.getConstArray(); - INT32 nLen = aActiveDics.getLength(); - for (INT32 i = 0; i < nLen; ++i) + sal_Int32 nLen = aActiveDics.getLength(); + for (sal_Int32 i = 0; i < nLen; ++i) { if (pActiveDic[i].getLength()) { uno::Reference< XDictionary > xDic( getDictionaryByName( pActiveDic[i] ) ); if (xDic.is()) - xDic->setActive( TRUE ); + xDic->setActive( sal_True ); } } @@ -720,7 +720,7 @@ void DicList::_CreateDicList() pDicEvtLstnrHelper->EndCollectEvents(); - bInCreation = FALSE; + bInCreation = sal_False; } @@ -771,10 +771,10 @@ sal_Bool SAL_CALL DicList::supportsService( const rtl::OUString& ServiceName ) uno::Sequence< rtl::OUString > aSNL = getSupportedServiceNames(); const rtl::OUString * pArray = aSNL.getConstArray(); - for( INT32 i = 0; i < aSNL.getLength(); i++ ) + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) if( pArray[i] == ServiceName ) - return TRUE; - return FALSE; + return sal_True; + return sal_False; } @@ -795,31 +795,6 @@ uno::Sequence< rtl::OUString > DicList::getSupportedServiceNames_Static() throw( return aSNS; } - -sal_Bool SAL_CALL DicList_writeInfo( - void * /*pServiceManager*/, registry::XRegistryKey * pRegistryKey ) -{ - try - { - String aImpl( '/' ); - aImpl += DicList::getImplementationName_Static().getStr(); - aImpl.AppendAscii( "/UNO/SERVICES" ); - uno::Reference< registry::XRegistryKey > xNewKey = - pRegistryKey->createKey(aImpl ); - uno::Sequence< rtl::OUString > aServices = - DicList::getSupportedServiceNames_Static(); - for( INT32 i = 0; i < aServices.getLength(); i++ ) - xNewKey->createKey( aServices.getConstArray()[i]); - - return sal_True; - } - catch(Exception &) - { - return sal_False; - } -} - - void * SAL_CALL DicList_getFactory( const sal_Char * pImplName, XMultiServiceFactory * pServiceManager, void * ) { @@ -866,7 +841,7 @@ xub_StrLen lcl_GetToken( String &rToken, if (i >= rText.Len()) // delimeter not found rToken = rText.Copy( nPos ); else - rToken = rText.Copy( nPos, sal::static_int_cast< xub_StrLen >((INT32) i - nPos) ); + rToken = rText.Copy( nPos, sal::static_int_cast< xub_StrLen >((sal_Int32) i - nPos) ); nRes = i + 1; // continue after found delimeter } @@ -894,7 +869,7 @@ static void AddInternal( { if( aToken.Len() && !IsNumeric( aToken ) ) { - rDic->add( aToken, FALSE, rtl::OUString() ); + rDic->add( aToken, sal_False, rtl::OUString() ); } } } @@ -921,10 +896,10 @@ static void AddUserData( const uno::Reference< XDictionary > &rDic ) #pragma optimize("g",off) #endif -static BOOL IsVers2OrNewer( const String& rFileURL, USHORT& nLng, BOOL& bNeg ) +static sal_Bool IsVers2OrNewer( const String& rFileURL, sal_uInt16& nLng, sal_Bool& bNeg ) { if (rFileURL.Len() == 0) - return FALSE; + return sal_False; String aDIC( GetDicExtension() ); String aExt; xub_StrLen nPos = rFileURL.SearchBackward( '.' ); @@ -933,7 +908,7 @@ static BOOL IsVers2OrNewer( const String& rFileURL, USHORT& nLng, BOOL& bNeg ) aExt.ToLowerAscii(); if(aExt != aDIC) - return FALSE; + return sal_False; // get stream to be used uno::Reference< lang::XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() ); @@ -953,15 +928,15 @@ static BOOL IsVers2OrNewer( const String& rFileURL, USHORT& nLng, BOOL& bNeg ) } DBG_ASSERT( xStream.is(), "failed to get stream for read" ); if (!xStream.is()) - return FALSE; + return sal_False; SvStreamPtr pStream = SvStreamPtr( utl::UcbStreamHelper::CreateStream( xStream ) ); int nDicVersion = ReadDicVersion(pStream, nLng, bNeg); if (2 == nDicVersion || nDicVersion >= 5) - return TRUE; + return sal_True; - return FALSE; + return sal_False; } /////////////////////////////////////////////////////////////////////////// diff --git a/linguistic/source/dlistimp.hxx b/linguistic/source/dlistimp.hxx index 90bf1e6077ce..d81a2cbffc7f 100644..100755 --- a/linguistic/source/dlistimp.hxx +++ b/linguistic/source/dlistimp.hxx @@ -42,7 +42,7 @@ #include <vector> #include <memory> -#include "misc.hxx" +#include "linguistic/misc.hxx" #include "lngopt.hxx" class DicEvtListenerHelper; @@ -81,8 +81,8 @@ class DicList : XTerminateListener > xExitListener; MyAppExitListener *pExitListener; - BOOL bDisposing; - BOOL bInCreation; + sal_Bool bDisposing; + sal_Bool bInCreation; // disallow copy-constructor and assignment-operator for now DicList( const DicList & ); @@ -96,11 +96,11 @@ class DicList : return aDicList; } - void LaunchEvent(INT16 nEvent, com::sun::star::uno::Sequence< + void LaunchEvent(sal_Int16 nEvent, com::sun::star::uno::Sequence< ::com::sun::star::linguistic2::XDictionary > xDic); void SearchForDictionaries( DictionaryVec_t &rDicList, - const String &rDicDir, BOOL bIsWritePath ); - INT32 GetDicPos(const com::sun::star::uno::Reference< + const String &rDicDir, sal_Bool bIsWritePath ); + sal_Int32 GetDicPos(const com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > &xDic); public: diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx index 33c94d902d6d..a5ca694c678e 100644..100755 --- a/linguistic/source/gciterator.cxx +++ b/linguistic/source/gciterator.cxx @@ -60,16 +60,16 @@ #include <cppuhelper/implbase4.hxx> #include <cppuhelper/implementationentry.hxx> #include <cppuhelper/interfacecontainer.h> -#include <cppuhelper/extract.hxx> #include <cppuhelper/factory.hxx> #include <i18npool/mslangid.hxx> #include <unotools/processfactory.hxx> +#include <comphelper/extract.hxx> #include <deque> #include <map> #include <vector> -#include "misc.hxx" +#include "linguistic/misc.hxx" #include "defs.hxx" #include "lngopt.hxx" @@ -1222,10 +1222,10 @@ throw(uno::RuntimeException) { uno::Sequence< OUString > aSNL = getSupportedServiceNames(); const OUString * pArray = aSNL.getConstArray(); - for( INT32 i = 0; i < aSNL.getLength(); ++i ) + for( sal_Int32 i = 0; i < aSNL.getLength(); ++i ) if( pArray[i] == rServiceName ) - return TRUE; - return FALSE; + return sal_True; + return sal_False; } @@ -1336,27 +1336,4 @@ void * SAL_CALL GrammarCheckingIterator_getFactory( return pRet; } - -sal_Bool SAL_CALL GrammarCheckingIterator_writeInfo( - void * /*pServiceManager*/, - registry::XRegistryKey * pRegistryKey ) -{ - try - { - OUString aImpl( '/' ); - aImpl += GrammarCheckingIterator_getImplementationName().getStr(); - aImpl += A2OU( "/UNO/SERVICES" ); - uno::Reference< registry::XRegistryKey > xNewKey = pRegistryKey->createKey( aImpl ); - uno::Sequence< OUString > aServices = GrammarCheckingIterator_getSupportedServiceNames(); - for( sal_Int32 i = 0; i < aServices.getLength(); i++ ) - xNewKey->createKey( aServices.getConstArray()[i] ); - - return sal_True; - } - catch (uno::Exception &) - { - return sal_False; - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/linguistic/source/gciterator.hxx b/linguistic/source/gciterator.hxx index 4707088a7cfb..4707088a7cfb 100644..100755 --- a/linguistic/source/gciterator.hxx +++ b/linguistic/source/gciterator.hxx diff --git a/linguistic/source/grammarchecker.cxx b/linguistic/source/grammarchecker.cxx index 3837ceaa32e7..961df73e5a89 100644..100755 --- a/linguistic/source/grammarchecker.cxx +++ b/linguistic/source/grammarchecker.cxx @@ -35,7 +35,7 @@ #include <cppuhelper/implbase4.hxx> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> -#include "misc.hxx" +#include "linguistic/misc.hxx" #include "defs.hxx" #include <cppuhelper/factory.hxx> #include <com/sun/star/registry/XRegistryKey.hpp> @@ -48,7 +48,7 @@ #include <com/sun/star/linguistic2/SingleGrammarError.hpp> #include <com/sun/star/linguistic2/GrammarCheckingResult.hpp> #include "lngopt.hxx" -#include <cppuhelper/extract.hxx> +#include <comphelper/extract.hxx> #include <unotools/processfactory.hxx> #include <map> #include <com/sun/star/text/TextMarkupType.hpp> @@ -250,10 +250,10 @@ sal_Bool SAL_CALL GrammarChecker::supportsService( const OUString& ServiceName ) uno::Sequence< OUString > aSNL = getSupportedServiceNames(); const OUString * pArray = aSNL.getConstArray(); - for( INT32 i = 0; i < aSNL.getLength(); ++i ) + for( sal_Int32 i = 0; i < aSNL.getLength(); ++i ) if( pArray[i] == ServiceName ) - return TRUE; - return FALSE; + return sal_True; + return sal_False; } uno::Sequence< OUString > GrammarChecker::getSupportedServiceNames_Static( ) throw() @@ -277,27 +277,6 @@ OUString SAL_CALL GrammarChecker::getImplementationName( ) throw(uno::RuntimeEx return getImplementationName_Static(); } -sal_Bool SAL_CALL GrammarChecker_writeInfo( void * /*pServiceManager*/, registry::XRegistryKey * pRegistryKey ) -{ - try - { - String aImpl( '/' ); - aImpl += GrammarChecker::getImplementationName_Static().getStr(); - aImpl.AppendAscii( "/UNO/SERVICES" ); - uno::Reference< registry::XRegistryKey > xNewKey = - pRegistryKey->createKey( aImpl ); - uno::Sequence< OUString > aServices = GrammarChecker::getSupportedServiceNames_Static(); - for( INT32 i = 0; i < aServices.getLength(); ++i ) - xNewKey->createKey( aServices.getConstArray()[i] ); - - return sal_True; - } - catch(uno::Exception &) - { - return sal_False; - } -} - uno::Reference< uno::XInterface > SAL_CALL GrammarChecker_CreateInstance( const uno::Reference< lang::XMultiServiceFactory > & /*rSMgr*/ ) throw(uno::Exception) diff --git a/linguistic/source/grammarchecker.hxx b/linguistic/source/grammarchecker.hxx index e3f8ae352554..e3f8ae352554 100644..100755 --- a/linguistic/source/grammarchecker.hxx +++ b/linguistic/source/grammarchecker.hxx diff --git a/linguistic/source/hhconvdic.cxx b/linguistic/source/hhconvdic.cxx index a3b770d74b67..bebe9b8259e7 100644..100755 --- a/linguistic/source/hhconvdic.cxx +++ b/linguistic/source/hhconvdic.cxx @@ -47,7 +47,7 @@ #include <com/sun/star/registry/XRegistryKey.hpp> #include "hhconvdic.hxx" -#include "misc.hxx" +#include "linguistic/misc.hxx" #include "defs.hxx" using namespace utl; @@ -88,13 +88,13 @@ sal_Int16 SAL_CALL checkScriptType(sal_Unicode c) throw (RuntimeException) -BOOL TextIsAllScriptType( const OUString &rTxt, INT16 nScriptType ) +sal_Bool TextIsAllScriptType( const OUString &rTxt, sal_Int16 nScriptType ) { - BOOL bIsAll = TRUE; - for (INT32 i = 0; i < rTxt.getLength() && bIsAll; ++i) + sal_Bool bIsAll = sal_True; + for (sal_Int32 i = 0; i < rTxt.getLength() && bIsAll; ++i) { if (checkScriptType( rTxt.getStr()[i]) != nScriptType) - bIsAll = FALSE; + bIsAll = sal_False; } return bIsAll; } @@ -103,7 +103,7 @@ BOOL TextIsAllScriptType( const OUString &rTxt, INT16 nScriptType ) /////////////////////////////////////////////////////////////////////////// HHConvDic::HHConvDic( const String &rName, const String &rMainURL ) : - ConvDic( rName, LANGUAGE_KOREAN, ConversionDictionaryType::HANGUL_HANJA, TRUE, rMainURL ) + ConvDic( rName, LANGUAGE_KOREAN, ConversionDictionaryType::HANGUL_HANJA, sal_True, rMainURL ) { } diff --git a/linguistic/source/hhconvdic.hxx b/linguistic/source/hhconvdic.hxx index 8df55f635bbb..5ed6d554fdad 100644..100755 --- a/linguistic/source/hhconvdic.hxx +++ b/linguistic/source/hhconvdic.hxx @@ -36,7 +36,7 @@ #include <cppuhelper/interfacecontainer.h> #include <tools/string.hxx> -#include "misc.hxx" +#include "linguistic/misc.hxx" #include "defs.hxx" #include "convdic.hxx" diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx index 6015335fe4c8..65bdadfc5f59 100644..100755 --- a/linguistic/source/hyphdsp.cxx +++ b/linguistic/source/hyphdsp.cxx @@ -43,8 +43,8 @@ #include <osl/mutex.hxx> #include "hyphdsp.hxx" -#include "hyphdta.hxx" -#include "lngprops.hxx" +#include "linguistic/hyphdta.hxx" +#include "linguistic/lngprops.hxx" #include "lngsvcmgr.hxx" @@ -85,7 +85,7 @@ void HyphenatorDispatcher::ClearSvcList() Reference<XHyphenatedWord> HyphenatorDispatcher::buildHyphWord( const OUString rOrigWord, const Reference<XDictionaryEntry> &xEntry, - INT16 nLang, INT16 nMaxLeading ) + sal_Int16 nLang, sal_Int16 nMaxLeading ) { MutexGuard aGuard( GetLinguMutex() ); @@ -94,25 +94,25 @@ Reference<XHyphenatedWord> HyphenatorDispatcher::buildHyphWord( if (xEntry.is()) { OUString aText( xEntry->getDictionaryWord() ); - INT32 nTextLen = aText.getLength(); + sal_Int32 nTextLen = aText.getLength(); // trailing '=' means "hyphenation should not be possible" if (nTextLen > 0 && aText[ nTextLen - 1 ] != '=') { - INT16 nHyphenationPos = -1; + sal_Int16 nHyphenationPos = -1; OUStringBuffer aTmp( nTextLen ); - BOOL bSkip = FALSE; - INT32 nHyphIdx = -1; - INT32 nLeading = 0; - for (INT32 i = 0; i < nTextLen; i++) + sal_Bool bSkip = sal_False; + sal_Int32 nHyphIdx = -1; + sal_Int32 nLeading = 0; + for (sal_Int32 i = 0; i < nTextLen; i++) { sal_Unicode cTmp = aText[i]; if (cTmp != '=') { aTmp.append( cTmp ); nLeading++; - bSkip = FALSE; + bSkip = sal_False; nHyphIdx++; } else @@ -120,9 +120,9 @@ Reference<XHyphenatedWord> HyphenatorDispatcher::buildHyphWord( if (!bSkip && nHyphIdx >= 0) { if (nLeading <= nMaxLeading) - nHyphenationPos = (INT16) nHyphIdx; + nHyphenationPos = (sal_Int16) nHyphIdx; } - bSkip = TRUE; //! multiple '=' should count as one only + bSkip = sal_True; //! multiple '=' should count as one only } } @@ -172,7 +172,7 @@ Reference<XHyphenatedWord> HyphenatorDispatcher::buildHyphWord( Reference< XPossibleHyphens > HyphenatorDispatcher::buildPossHyphens( - const Reference< XDictionaryEntry > &xEntry, INT16 nLanguage ) + const Reference< XDictionaryEntry > &xEntry, sal_Int16 nLanguage ) { MutexGuard aGuard( GetLinguMutex() ); @@ -182,33 +182,33 @@ Reference< XPossibleHyphens > HyphenatorDispatcher::buildPossHyphens( { // text with hyphenation info OUString aText( xEntry->getDictionaryWord() ); - INT32 nTextLen = aText.getLength(); + sal_Int32 nTextLen = aText.getLength(); // trailing '=' means "hyphenation should not be possible" if (nTextLen > 0 && aText[ nTextLen - 1 ] != '=') { // sequence to hold hyphenation positions - Sequence< INT16 > aHyphPos( nTextLen ); - INT16 *pPos = aHyphPos.getArray(); - INT32 nHyphCount = 0; + Sequence< sal_Int16 > aHyphPos( nTextLen ); + sal_Int16 *pPos = aHyphPos.getArray(); + sal_Int32 nHyphCount = 0; OUStringBuffer aTmp( nTextLen ); - BOOL bSkip = FALSE; - INT32 nHyphIdx = -1; - for (INT32 i = 0; i < nTextLen; i++) + sal_Bool bSkip = sal_False; + sal_Int32 nHyphIdx = -1; + for (sal_Int32 i = 0; i < nTextLen; i++) { sal_Unicode cTmp = aText[i]; if (cTmp != '=') { aTmp.append( cTmp ); - bSkip = FALSE; + bSkip = sal_False; nHyphIdx++; } else { if (!bSkip && nHyphIdx >= 0) - pPos[ nHyphCount++ ] = (INT16) nHyphIdx; - bSkip = TRUE; //! multiple '=' should count as one only + pPos[ nHyphCount++ ] = (sal_Int16) nHyphIdx; + bSkip = sal_True; //! multiple '=' should count as one only } } @@ -267,8 +267,8 @@ Reference< XHyphenatedWord > SAL_CALL Reference< XHyphenatedWord > xRes; - INT32 nWordLen = rWord.getLength(); - INT16 nLanguage = LocaleToLanguage( rLocale ); + sal_Int32 nWordLen = rWord.getLength(); + sal_Int16 nLanguage = LocaleToLanguage( rLocale ); if (nLanguage == LANGUAGE_NONE || !nWordLen || nMaxLeading == 0 || nMaxLeading == nWordLen) return xRes; @@ -277,7 +277,7 @@ Reference< XHyphenatedWord > SAL_CALL HyphSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) ); LangSvcEntries_Hyph *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; - BOOL bWordModified = FALSE; + sal_Bool bWordModified = sal_False; if (!pEntry || (nMaxLeading < 0 || nMaxLeading > nWordLen)) { #ifdef LINGU_EXCEPTIONS @@ -299,7 +299,7 @@ Reference< XHyphenatedWord > SAL_CALL bWordModified |= RemoveHyphens( aChkWord ); if (IsIgnoreControlChars( rProperties, GetPropSet() )) bWordModified |= RemoveControlChars( aChkWord ); - INT16 nChkMaxLeading = (INT16) GetPosInWordToCheck( rWord, nMaxLeading ); + sal_Int16 nChkMaxLeading = (sal_Int16) GetPosInWordToCheck( rWord, nMaxLeading ); // check for results from (positive) dictionaries which have precedence! Reference< XDictionaryEntry > xEntry; @@ -307,7 +307,7 @@ Reference< XHyphenatedWord > SAL_CALL if (GetDicList().is() && IsUseDicList( rProperties, GetPropSet() )) { xEntry = GetDicList()->queryDictionaryEntry( aChkWord, rLocale, - TRUE, FALSE ); + sal_True, sal_False ); } if (xEntry.is()) @@ -321,11 +321,11 @@ Reference< XHyphenatedWord > SAL_CALL } else { - INT32 nLen = pEntry->aSvcImplNames.getLength() > 0 ? 1 : 0; + sal_Int32 nLen = pEntry->aSvcImplNames.getLength() > 0 ? 1 : 0; DBG_ASSERT( pEntry->nLastTriedSvcIndex < nLen, "lng : index out of range"); - INT32 i = 0; + sal_Int32 i = 0; Reference< XHyphenator > xHyph; if (pEntry->aSvcRefs.getLength() > 0) xHyph = pEntry->aSvcRefs[0]; @@ -376,7 +376,7 @@ Reference< XHyphenatedWord > SAL_CALL xRes = xHyph->hyphenate( aChkWord, rLocale, nChkMaxLeading, rProperties ); - pEntry->nLastTriedSvcIndex = (INT16) i; + pEntry->nLastTriedSvcIndex = (sal_Int16) i; ++i; // if language is not supported by the services @@ -412,8 +412,8 @@ Reference< XHyphenatedWord > SAL_CALL Reference< XHyphenatedWord > xRes; - INT32 nWordLen = rWord.getLength(); - INT16 nLanguage = LocaleToLanguage( rLocale ); + sal_Int32 nWordLen = rWord.getLength(); + sal_Int16 nLanguage = LocaleToLanguage( rLocale ); if (nLanguage == LANGUAGE_NONE || !nWordLen) return xRes; @@ -421,7 +421,7 @@ Reference< XHyphenatedWord > SAL_CALL HyphSvcByLangMap_t::iterator aIt( aSvcMap.find( nLanguage ) ); LangSvcEntries_Hyph *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; - BOOL bWordModified = FALSE; + sal_Bool bWordModified = sal_False; if (!pEntry || !(0 <= nIndex && nIndex <= nWordLen - 2)) { #ifdef LINGU_EXCEPTIONS @@ -443,7 +443,7 @@ Reference< XHyphenatedWord > SAL_CALL bWordModified |= RemoveHyphens( aChkWord ); if (IsIgnoreControlChars( rProperties, GetPropSet() )) bWordModified |= RemoveControlChars( aChkWord ); - INT16 nChkIndex = (INT16) GetPosInWordToCheck( rWord, nIndex ); + sal_Int16 nChkIndex = (sal_Int16) GetPosInWordToCheck( rWord, nIndex ); // check for results from (positive) dictionaries which have precedence! Reference< XDictionaryEntry > xEntry; @@ -451,7 +451,7 @@ Reference< XHyphenatedWord > SAL_CALL if (GetDicList().is() && IsUseDicList( rProperties, GetPropSet() )) { xEntry = GetDicList()->queryDictionaryEntry( aChkWord, rLocale, - TRUE, FALSE ); + sal_True, sal_False ); } if (xEntry.is()) @@ -460,11 +460,11 @@ Reference< XHyphenatedWord > SAL_CALL } else { - INT32 nLen = pEntry->aSvcImplNames.getLength() > 0 ? 1 : 0; + sal_Int32 nLen = pEntry->aSvcImplNames.getLength() > 0 ? 1 : 0; DBG_ASSERT( pEntry->nLastTriedSvcIndex < nLen, "lng : index out of range"); - INT32 i = 0; + sal_Int32 i = 0; Reference< XHyphenator > xHyph; if (pEntry->aSvcRefs.getLength() > 0) xHyph = pEntry->aSvcRefs[0]; @@ -515,7 +515,7 @@ Reference< XHyphenatedWord > SAL_CALL xRes = xHyph->queryAlternativeSpelling( aChkWord, rLocale, nChkIndex, rProperties ); - pEntry->nLastTriedSvcIndex = (INT16) i; + pEntry->nLastTriedSvcIndex = (sal_Int16) i; ++i; // if language is not supported by the services @@ -551,7 +551,7 @@ Reference< XPossibleHyphens > SAL_CALL Reference< XPossibleHyphens > xRes; - INT16 nLanguage = LocaleToLanguage( rLocale ); + sal_Int16 nLanguage = LocaleToLanguage( rLocale ); if (nLanguage == LANGUAGE_NONE || !rWord.getLength()) return xRes; @@ -585,7 +585,7 @@ Reference< XPossibleHyphens > SAL_CALL if (GetDicList().is() && IsUseDicList( rProperties, GetPropSet() )) { xEntry = GetDicList()->queryDictionaryEntry( aChkWord, rLocale, - TRUE, FALSE ); + sal_True, sal_False ); } if (xEntry.is()) @@ -594,11 +594,11 @@ Reference< XPossibleHyphens > SAL_CALL } else { - INT32 nLen = pEntry->aSvcImplNames.getLength() > 0 ? 1 : 0; + sal_Int32 nLen = pEntry->aSvcImplNames.getLength() > 0 ? 1 : 0; DBG_ASSERT( pEntry->nLastTriedSvcIndex < nLen, "lng : index out of range"); - INT32 i = 0; + sal_Int32 i = 0; Reference< XHyphenator > xHyph; if (pEntry->aSvcRefs.getLength() > 0) xHyph = pEntry->aSvcRefs[0]; @@ -649,7 +649,7 @@ Reference< XPossibleHyphens > SAL_CALL xRes = xHyph->createPossibleHyphens( aChkWord, rLocale, rProperties ); - pEntry->nLastTriedSvcIndex = (INT16) i; + pEntry->nLastTriedSvcIndex = (sal_Int16) i; ++i; // if language is not supported by the services @@ -677,9 +677,9 @@ void HyphenatorDispatcher::SetServiceList( const Locale &rLocale, { MutexGuard aGuard( GetLinguMutex() ); - INT16 nLanguage = LocaleToLanguage( rLocale ); + sal_Int16 nLanguage = LocaleToLanguage( rLocale ); - INT32 nLen = rSvcImplNames.getLength(); + sal_Int32 nLen = rSvcImplNames.getLength(); if (0 == nLen) // remove entry aSvcMap.erase( nLanguage ); @@ -714,7 +714,7 @@ Sequence< OUString > Sequence< OUString > aRes; // search for entry with that language and use data from that - INT16 nLanguage = LocaleToLanguage( rLocale ); + sal_Int16 nLanguage = LocaleToLanguage( rLocale ); HyphenatorDispatcher *pThis = (HyphenatorDispatcher *) this; const HyphSvcByLangMap_t::iterator aIt( pThis->aSvcMap.find( nLanguage ) ); const LangSvcEntries_Hyph *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; diff --git a/linguistic/source/hyphdsp.hxx b/linguistic/source/hyphdsp.hxx index 490291874b19..75c1976a26eb 100644..100755 --- a/linguistic/source/hyphdsp.hxx +++ b/linguistic/source/hyphdsp.hxx @@ -46,7 +46,7 @@ #include <map> #include "lngopt.hxx" -#include "misc.hxx" +#include "linguistic/misc.hxx" #include "defs.hxx" class LngSvcMgr; @@ -89,13 +89,13 @@ class HyphenatorDispatcher : buildHyphWord( const rtl::OUString rOrigWord, const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionaryEntry> &xEntry, - INT16 nLang, INT16 nMaxLeading ); + sal_Int16 nLang, sal_Int16 nMaxLeading ); com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XPossibleHyphens > buildPossHyphens( const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionaryEntry > &xEntry, - INT16 nLanguage ); + sal_Int16 nLanguage ); public: HyphenatorDispatcher( LngSvcMgr &rLngSvcMgr ); diff --git a/linguistic/source/hyphdta.cxx b/linguistic/source/hyphdta.cxx index a6d9b5ee5dd6..ed6b4e169b7b 100644..100755 --- a/linguistic/source/hyphdta.cxx +++ b/linguistic/source/hyphdta.cxx @@ -29,9 +29,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_linguistic.hxx" -#include "hyphdta.hxx" -#include "lngprops.hxx" -#include "misc.hxx" +#include "linguistic/hyphdta.hxx" +#include "linguistic/lngprops.hxx" +#include "linguistic/misc.hxx" #include <osl/mutex.hxx> @@ -53,8 +53,8 @@ namespace linguistic /////////////////////////////////////////////////////////////////////////// -HyphenatedWord::HyphenatedWord(const OUString &rWord, INT16 nLang, INT16 nHPos, - const OUString &rHyphWord, INT16 nPos ) : +HyphenatedWord::HyphenatedWord(const OUString &rWord, sal_Int16 nLang, sal_Int16 nHPos, + const OUString &rHyphWord, sal_Int16 nPos ) : aWord (rWord), aHyphenatedWord (rHyphWord), nHyphPos (nPos), @@ -136,9 +136,9 @@ sal_Bool SAL_CALL HyphenatedWord::isAlternativeSpelling() /////////////////////////////////////////////////////////////////////////// -PossibleHyphens::PossibleHyphens(const OUString &rWord, INT16 nLang, +PossibleHyphens::PossibleHyphens(const OUString &rWord, sal_Int16 nLang, const OUString &rHyphWord, - const Sequence< INT16 > &rPositions) : + const Sequence< sal_Int16 > &rPositions) : aWord (rWord), aWordWithHyphens(rHyphWord), aOrigHyphenPos (rPositions), diff --git a/linguistic/source/iprcache.cxx b/linguistic/source/iprcache.cxx index c6bd020a10ad..6b4e28c96607 100644..100755 --- a/linguistic/source/iprcache.cxx +++ b/linguistic/source/iprcache.cxx @@ -32,13 +32,13 @@ #include <string.h> #include "iprcache.hxx" -#include "misc.hxx" +#include "linguistic/misc.hxx" #include <com/sun/star/linguistic2/DictionaryListEventFlags.hpp> #include <tools/debug.hxx> #include <osl/mutex.hxx> #include <unotools/processfactory.hxx> -#include <lngprops.hxx> +#include <linguistic/lngprops.hxx> using namespace utl; using namespace osl; @@ -60,7 +60,7 @@ namespace linguistic static const struct { const char *pPropName; - INT32 nPropHdl; + sal_Int32 nPropHdl; } aFlushProperties[ NUM_FLUSH_PROPS ] = { { UPN_IS_USE_DICTIONARY_LIST, UPH_IS_USE_DICTIONARY_LIST }, @@ -101,7 +101,7 @@ static void lcl_RemoveAsPropertyChangeListener( } -static BOOL lcl_IsFlushProperty( INT32 nHandle ) +static sal_Bool lcl_IsFlushProperty( sal_Int32 nHandle ) { int i; for (i = 0; i < NUM_FLUSH_PROPS; ++i) @@ -135,7 +135,7 @@ void FlushListener::SetDicList( Reference<XDictionaryList> &rDL ) xDicList = rDL; if (xDicList.is()) - xDicList->addDictionaryListEventListener( this, FALSE ); + xDicList->addDictionaryListEventListener( this, sal_False ); } } @@ -182,13 +182,13 @@ void SAL_CALL FlushListener::processDictionaryListEvent( if (rDicListEvent.Source == xDicList) { - INT16 nEvt = rDicListEvent.nCondensedEvent; - INT16 nFlushFlags = + sal_Int16 nEvt = rDicListEvent.nCondensedEvent; + sal_Int16 nFlushFlags = DictionaryListEventFlags::ADD_NEG_ENTRY | DictionaryListEventFlags::DEL_POS_ENTRY | DictionaryListEventFlags::ACTIVATE_NEG_DIC | DictionaryListEventFlags::DEACTIVATE_POS_DIC; - BOOL bFlush = 0 != (nEvt & nFlushFlags); + sal_Bool bFlush = 0 != (nEvt & nFlushFlags); DBG_ASSERT( pFlushObj, "missing object (NULL pointer)" ); if (bFlush && pFlushObj != NULL) @@ -205,7 +205,7 @@ void SAL_CALL FlushListener::propertyChange( if (rEvt.Source == xPropSet) { - BOOL bFlush = lcl_IsFlushProperty( rEvt.PropertyHandle ); + sal_Bool bFlush = lcl_IsFlushProperty( rEvt.PropertyHandle ); DBG_ASSERT( pFlushObj, "missing object (NULL pointer)" ); if (bFlush && pFlushObj != NULL) diff --git a/linguistic/source/lng.component b/linguistic/source/lng.component new file mode 100755 index 000000000000..f4f3ca603a88 --- /dev/null +++ b/linguistic/source/lng.component @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.lingu2.ConvDicList"> + <service name="com.sun.star.linguistic2.ConversionDictionaryList"/> + </implementation> + <implementation name="com.sun.star.lingu2.DicList"> + <service name="com.sun.star.linguistic2.DictionaryList"/> + </implementation> + <implementation name="com.sun.star.lingu2.LinguProps"> + <service name="com.sun.star.linguistic2.LinguProperties"/> + </implementation> + <implementation name="com.sun.star.lingu2.LngSvcMgr"> + <service name="com.sun.star.linguistic2.LinguServiceManager"/> + </implementation> + <implementation name="com.sun.star.lingu2.ProofreadingIterator"> + <service name="com.sun.star.linguistic2.ProofreadingIterator"/> + </implementation> +</component> diff --git a/linguistic/source/lngopt.cxx b/linguistic/source/lngopt.cxx index f29a940f2153..57e91251de1b 100644..100755 --- a/linguistic/source/lngopt.cxx +++ b/linguistic/source/lngopt.cxx @@ -31,8 +31,8 @@ #include <sal/macros.h> #include "lngopt.hxx" -#include "lngprops.hxx" -#include "misc.hxx" +#include "linguistic/lngprops.hxx" +#include "linguistic/misc.hxx" #include <tools/debug.hxx> #include <unotools/lingucfg.hxx> @@ -101,33 +101,33 @@ LinguOptions::~LinguOptions() } -BOOL LinguOptions::SetLocale_Impl( INT16 &rLanguage, Any &rOld, const Any &rVal, sal_Int16 nType) +sal_Bool LinguOptions::SetLocale_Impl( sal_Int16 &rLanguage, Any &rOld, const Any &rVal, sal_Int16 nType) { - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; Locale aNew; rVal >>= aNew; - INT16 nNew = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aNew), nType); + sal_Int16 nNew = MsLangId::resolveSystemLanguageByScriptType(MsLangId::convertLocaleToLanguage(aNew), nType); if (nNew != rLanguage) { Locale aLocale( CreateLocale( rLanguage ) ); rOld.setValue( &aLocale, ::getCppuType((Locale*)0 )); rLanguage = nNew; - bRes = TRUE; + bRes = sal_True; } return bRes; } -BOOL LinguOptions::SetValue( Any &rOld, const Any &rVal, INT32 nWID ) +sal_Bool LinguOptions::SetValue( Any &rOld, const Any &rVal, sal_Int32 nWID ) { MutexGuard aGuard( GetLinguMutex() ); - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; - INT16 *pnVal = 0; - BOOL *pbVal = 0; + sal_Int16 *pnVal = 0; + sal_Bool *pbVal = 0; switch( nWID ) { @@ -166,30 +166,30 @@ BOOL LinguOptions::SetValue( Any &rOld, const Any &rVal, INT32 nWID ) default : { DBG_ASSERT( 0,"lng : unknown WID"); - bRes = FALSE; + bRes = sal_False; } } if (pbVal) { - BOOL bNew = FALSE; + sal_Bool bNew = sal_False; rVal >>= bNew; if (bNew != *pbVal) { rOld <<= *pbVal; *pbVal = bNew; - bRes = TRUE; + bRes = sal_True; } } if (pnVal) { - INT16 nNew = 0; + sal_Int16 nNew = 0; rVal >>= nNew; if (nNew != *pnVal) { rOld <<= *pnVal; *pnVal = nNew; - bRes = TRUE; + bRes = sal_True; } } @@ -199,13 +199,13 @@ BOOL LinguOptions::SetValue( Any &rOld, const Any &rVal, INT32 nWID ) return bRes; } -void LinguOptions::GetValue( Any &rVal, INT32 nWID ) const +void LinguOptions::GetValue( Any &rVal, sal_Int32 nWID ) const { MutexGuard aGuard( GetLinguMutex() ); - INT16 *pnVal = 0; - BOOL *pbVal = 0; - BOOL bDummy = FALSE; + sal_Int16 *pnVal = 0; + sal_Bool *pbVal = 0; + sal_Bool bDummy = sal_False; switch( nWID ) { @@ -259,7 +259,7 @@ void LinguOptions::GetValue( Any &rVal, INT32 nWID ) const struct WID_Name { - INT32 nWID; + sal_Int32 nWID; const char *pPropertyName; }; @@ -294,13 +294,13 @@ WID_Name aWID_Name[] = }; -OUString LinguOptions::GetName( INT32 nWID ) +OUString LinguOptions::GetName( sal_Int32 nWID ) { MutexGuard aGuard( GetLinguMutex() ); OUString aRes; - INT32 nLen = SAL_N_ELEMENTS( aWID_Name ); + sal_Int32 nLen = SAL_N_ELEMENTS( aWID_Name ); if (0 <= nWID && nWID < nLen && aWID_Name[ nWID ].nWID == nWID) aRes = OUString::createFromAscii(aWID_Name[nWID].pPropertyName); else @@ -366,7 +366,7 @@ LinguProps::LinguProps() : aPropListeners (GetLinguMutex()), aPropertyMap(lcl_GetLinguProps()) { - bDisposing = FALSE; + bDisposing = sal_False; } void LinguProps::launchEvent( const PropertyChangeEvent &rEvt ) const @@ -417,7 +417,7 @@ void SAL_CALL LinguProps::setPropertyValue( if (aOld != rValue && aConfig.SetProperty( pCur->nWID, rValue )) { PropertyChangeEvent aChgEvt( (XPropertySet *) this, rPropertyName, - FALSE, pCur->nWID, aOld, rValue ); + sal_False, pCur->nWID, aOld, rValue ); launchEvent( aChgEvt ); } } @@ -520,7 +520,7 @@ void SAL_CALL LinguProps::setFastPropertyValue( sal_Int32 nHandle, const Any& rV if (aOld != rValue && aConfig.SetProperty( nHandle, rValue )) { PropertyChangeEvent aChgEvt( (XPropertySet *) this, - LinguOptions::GetName( nHandle ), FALSE, nHandle, aOld, rValue ); + LinguOptions::GetName( nHandle ), sal_False, nHandle, aOld, rValue ); launchEvent( aChgEvt ); } } @@ -542,12 +542,12 @@ Sequence< PropertyValue > SAL_CALL { MutexGuard aGuard( GetLinguMutex() ); - INT32 nLen = aPropertyMap.getSize(); + sal_Int32 nLen = aPropertyMap.getSize(); Sequence< PropertyValue > aProps( nLen ); PropertyValue *pProp = aProps.getArray(); PropertyEntryVector_t aPropEntries = aPropertyMap.getPropertyEntries(); PropertyEntryVector_t::const_iterator aIt = aPropEntries.begin(); - for (INT32 i = 0; i < nLen; ++i, ++aIt) + for (sal_Int32 i = 0; i < nLen; ++i, ++aIt) { PropertyValue &rVal = pProp[i]; Any aAny( aConfig.GetProperty( aIt->nWID ) ); @@ -567,9 +567,9 @@ void SAL_CALL { MutexGuard aGuard( GetLinguMutex() ); - INT32 nLen = rProps.getLength(); + sal_Int32 nLen = rProps.getLength(); const PropertyValue *pVal = rProps.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) + for (sal_Int32 i = 0; i < nLen; ++i) { const PropertyValue &rVal = pVal[i]; setPropertyValue( rVal.Name, rVal.Value ); @@ -584,7 +584,7 @@ void SAL_CALL if (!bDisposing) { - bDisposing = TRUE; + bDisposing = sal_True; //! its too late to save the options here! // (see AppExitListener for saving) @@ -637,10 +637,10 @@ sal_Bool SAL_CALL LinguProps::supportsService( const OUString& ServiceName ) uno::Sequence< OUString > aSNL = getSupportedServiceNames(); const OUString * pArray = aSNL.getConstArray(); - for( INT32 i = 0; i < aSNL.getLength(); i++ ) + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) if( pArray[i] == ServiceName ) - return TRUE; - return FALSE; + return sal_True; + return sal_False; } // XServiceInfo @@ -662,29 +662,6 @@ uno::Sequence< OUString > LinguProps::getSupportedServiceNames_Static() return aSNS; } - -sal_Bool SAL_CALL LinguProps_writeInfo( void * /*pServiceManager*/, - XRegistryKey * pRegistryKey ) -{ - try - { - String aImpl( '/' ); - aImpl += LinguProps::getImplementationName_Static().getStr(); - aImpl.AppendAscii( "/UNO/SERVICES" ); - Reference< XRegistryKey > xNewKey = - pRegistryKey->createKey(aImpl ); - uno::Sequence< OUString > aServices = LinguProps::getSupportedServiceNames_Static(); - for( INT32 i = 0; i < aServices.getLength(); i++ ) - xNewKey->createKey( aServices.getConstArray()[i]); - - return sal_True; - } - catch(Exception &) - { - return sal_False; - } -} - void * SAL_CALL LinguProps_getFactory( const sal_Char * pImplName, XMultiServiceFactory *pServiceManager, void * ) { diff --git a/linguistic/source/lngopt.hxx b/linguistic/source/lngopt.hxx index abb7a5a6ea19..295483a8914d 100644..100755 --- a/linguistic/source/lngopt.hxx +++ b/linguistic/source/lngopt.hxx @@ -46,7 +46,7 @@ #include <tools/solar.h> #include <svl/itemprop.hxx> -#include "misc.hxx" +#include "linguistic/misc.hxx" #include "defs.hxx" namespace com { namespace sun { namespace star { @@ -72,7 +72,7 @@ class LinguOptions //! uses default assignment-operator - BOOL SetLocale_Impl( INT16 &rLanguage, + sal_Bool SetLocale_Impl( sal_Int16 &rLanguage, ::com::sun::star::uno::Any &rOld, const ::com::sun::star::uno::Any &rVal, sal_Int16 nType ); @@ -81,11 +81,11 @@ public: LinguOptions(const LinguOptions &rOpt); ~LinguOptions(); - BOOL SetValue( ::com::sun::star::uno::Any &rOld, - const ::com::sun::star::uno::Any &rVal, INT32 nWID ); - void GetValue( ::com::sun::star::uno::Any &rVal, INT32 nWID ) const; + sal_Bool SetValue( ::com::sun::star::uno::Any &rOld, + const ::com::sun::star::uno::Any &rVal, sal_Int32 nWID ); + void GetValue( ::com::sun::star::uno::Any &rVal, sal_Int32 nWID ) const; - static ::rtl::OUString GetName( INT32 nWID ); + static ::rtl::OUString GetName( sal_Int32 nWID ); const ::com::sun::star::uno::Sequence< rtl::OUString > GetActiveDics() const { return pData->aActiveDics; } @@ -103,14 +103,14 @@ public: // helper function call class struct PropHashType_Impl { - size_t operator()(const INT32 &s) const { return s; } + size_t operator()(const sal_Int32 &s) const { return s; } }; typedef cppu::OMultiTypeInterfaceContainerHelperVar < - INT32, + sal_Int32, PropHashType_Impl, - std::equal_to< INT32 > + std::equal_to< sal_Int32 > > OPropertyListenerContainerHelper; /////////////////////////////////////////////////////////////////////////// @@ -132,7 +132,7 @@ class LinguProps : SfxItemPropertyMap aPropertyMap; SvtLinguConfig aConfig; - BOOL bDisposing; + sal_Bool bDisposing; // disallow copy-constructor and assignment-operator for now LinguProps(const LinguProps &); diff --git a/linguistic/source/lngprophelp.cxx b/linguistic/source/lngprophelp.cxx index bdee5286bdf7..e9a27ac81bac 100644..100755 --- a/linguistic/source/lngprophelp.cxx +++ b/linguistic/source/lngprophelp.cxx @@ -38,10 +38,10 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <osl/mutex.hxx> -#include <misc.hxx> -#include <lngprops.hxx> +#include <linguistic/misc.hxx> +#include <linguistic/lngprops.hxx> -#include <lngprophelp.hxx> +#include <linguistic/lngprophelp.hxx> using namespace osl; using namespace com::sun::star; @@ -79,7 +79,7 @@ PropertyChgHelper::PropertyChgHelper( nEvtFlags (nAllowedEvents) { OUString *pName = aPropNames.getArray(); - for (INT32 i = 0; i < nCHCount; ++i) + for (sal_Int32 i = 0; i < nCHCount; ++i) { pName[i] = ::rtl::OUString::createFromAscii( aCH[i] ); } @@ -109,14 +109,14 @@ PropertyChgHelper::~PropertyChgHelper() } -void PropertyChgHelper::AddPropNames( const char *pNewNames[], INT32 nCount ) +void PropertyChgHelper::AddPropNames( const char *pNewNames[], sal_Int32 nCount ) { if (pNewNames && nCount) { - INT32 nLen = GetPropNames().getLength(); + sal_Int32 nLen = GetPropNames().getLength(); GetPropNames().realloc( nLen + nCount ); OUString *pName = GetPropNames().getArray(); - for (INT32 i = 0; i < nCount; ++i) + for (sal_Int32 i = 0; i < nCount; ++i) { pName[ nLen + i ] = ::rtl::OUString::createFromAscii( pNewNames[ i ] ); @@ -127,20 +127,20 @@ void PropertyChgHelper::AddPropNames( const char *pNewNames[], INT32 nCount ) void PropertyChgHelper::SetDefaultValues() { - bResIsIgnoreControlCharacters = bIsIgnoreControlCharacters = TRUE; - bResIsUseDictionaryList = bIsUseDictionaryList = TRUE; + bResIsIgnoreControlCharacters = bIsIgnoreControlCharacters = sal_True; + bResIsUseDictionaryList = bIsUseDictionaryList = sal_True; } void PropertyChgHelper::GetCurrentValues() { - INT32 nLen = GetPropNames().getLength(); + sal_Int32 nLen = GetPropNames().getLength(); if (GetPropSet().is() && nLen) { const OUString *pPropName = GetPropNames().getConstArray(); - for (INT32 i = 0; i < nLen; ++i) + for (sal_Int32 i = 0; i < nLen; ++i) { - BOOL *pbVal = NULL, + sal_Bool *pbVal = NULL, *pbResVal = NULL; if (pPropName[i].equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( UPN_IS_IGNORE_CONTROL_CHARACTERS ) )) @@ -171,13 +171,13 @@ void PropertyChgHelper::SetTmpPropVals( const PropertyValues &rPropVals ) bResIsIgnoreControlCharacters = bIsIgnoreControlCharacters; bResIsUseDictionaryList = bIsUseDictionaryList; // - INT32 nLen = rPropVals.getLength(); + sal_Int32 nLen = rPropVals.getLength(); if (nLen) { const PropertyValue *pVal = rPropVals.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) + for (sal_Int32 i = 0; i < nLen; ++i) { - BOOL *pbResVal = NULL; + sal_Bool *pbResVal = NULL; switch (pVal[i].Handle) { case UPH_IS_IGNORE_CONTROL_CHARACTERS : @@ -195,18 +195,18 @@ void PropertyChgHelper::SetTmpPropVals( const PropertyValues &rPropVals ) } -BOOL PropertyChgHelper::propertyChange_Impl( const PropertyChangeEvent& rEvt ) +sal_Bool PropertyChgHelper::propertyChange_Impl( const PropertyChangeEvent& rEvt ) { - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if (GetPropSet().is() && rEvt.Source == GetPropSet()) { - INT16 nLngSvcFlags = (nEvtFlags & AE_HYPHENATOR) ? + sal_Int16 nLngSvcFlags = (nEvtFlags & AE_HYPHENATOR) ? LinguServiceEventFlags::HYPHENATE_AGAIN : 0; - BOOL bSCWA = FALSE, // SPELL_CORRECT_WORDS_AGAIN ? - bSWWA = FALSE; // SPELL_WRONG_WORDS_AGAIN ? + sal_Bool bSCWA = sal_False, // SPELL_CORRECT_WORDS_AGAIN ? + bSWWA = sal_False; // SPELL_WRONG_WORDS_AGAIN ? - BOOL *pbVal = NULL; + sal_Bool *pbVal = NULL; switch (rEvt.PropertyHandle) { case UPH_IS_IGNORE_CONTROL_CHARACTERS : @@ -218,12 +218,12 @@ BOOL PropertyChgHelper::propertyChange_Impl( const PropertyChangeEvent& rEvt ) case UPH_IS_USE_DICTIONARY_LIST : { pbVal = &bIsUseDictionaryList; - bSCWA = bSWWA = TRUE; + bSCWA = bSWWA = sal_True; break; } default: { - bRes = FALSE; + bRes = sal_False; //DBG_ASSERT( 0, "unknown property" ); } } @@ -233,7 +233,7 @@ BOOL PropertyChgHelper::propertyChange_Impl( const PropertyChangeEvent& rEvt ) bRes = 0 != pbVal; // sth changed? if (bRes) { - BOOL bSpellEvts = (nEvtFlags & AE_SPELLCHECKER) ? TRUE : FALSE; + sal_Bool bSpellEvts = (nEvtFlags & AE_SPELLCHECKER) ? sal_True : sal_False; if (bSCWA && bSpellEvts) nLngSvcFlags |= LinguServiceEventFlags::SPELL_CORRECT_WORDS_AGAIN; if (bSWWA && bSpellEvts) @@ -263,9 +263,9 @@ void PropertyChgHelper::AddAsPropListener() { if (xPropSet.is()) { - INT32 nLen = aPropNames.getLength(); + sal_Int32 nLen = aPropNames.getLength(); const OUString *pPropName = aPropNames.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) + for (sal_Int32 i = 0; i < nLen; ++i) { if (pPropName[i].getLength()) xPropSet->addPropertyChangeListener( pPropName[i], this ); @@ -277,9 +277,9 @@ void PropertyChgHelper::RemoveAsPropListener() { if (xPropSet.is()) { - INT32 nLen = aPropNames.getLength(); + sal_Int32 nLen = aPropNames.getLength(); const OUString *pPropName = aPropNames.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) + for (sal_Int32 i = 0; i < nLen; ++i) { if (pPropName[i].getLength()) xPropSet->removePropertyChangeListener( pPropName[i], this ); @@ -320,10 +320,10 @@ sal_Bool SAL_CALL { MutexGuard aGuard( GetLinguMutex() ); - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if (rxListener.is()) { - INT32 nCount = aLngSvcEvtListeners.getLength(); + sal_Int32 nCount = aLngSvcEvtListeners.getLength(); bRes = aLngSvcEvtListeners.addInterface( rxListener ) != nCount; } return bRes; @@ -337,10 +337,10 @@ sal_Bool SAL_CALL { MutexGuard aGuard( GetLinguMutex() ); - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if (rxListener.is()) { - INT32 nCount = aLngSvcEvtListeners.getLength(); + sal_Int32 nCount = aLngSvcEvtListeners.getLength(); bRes = aLngSvcEvtListeners.removeInterface( rxListener ) != nCount; } return bRes; @@ -407,9 +407,9 @@ void PropertyHelper_Spell::SetDefaultValues() { PropertyChgHelper::SetDefaultValues(); - bResIsSpellUpperCase = bIsSpellUpperCase = FALSE; - bResIsSpellWithDigits = bIsSpellWithDigits = FALSE; - bResIsSpellCapitalization = bIsSpellCapitalization = TRUE; + bResIsSpellUpperCase = bIsSpellUpperCase = sal_False; + bResIsSpellWithDigits = bIsSpellWithDigits = sal_False; + bResIsSpellCapitalization = bIsSpellCapitalization = sal_True; } @@ -417,13 +417,13 @@ void PropertyHelper_Spell::GetCurrentValues() { PropertyChgHelper::GetCurrentValues(); - INT32 nLen = GetPropNames().getLength(); + sal_Int32 nLen = GetPropNames().getLength(); if (GetPropSet().is() && nLen) { const OUString *pPropName = GetPropNames().getConstArray(); - for (INT32 i = 0; i < nLen; ++i) + for (sal_Int32 i = 0; i < nLen; ++i) { - BOOL *pbVal = NULL, + sal_Bool *pbVal = NULL, *pbResVal = NULL; if (pPropName[i].equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( UPN_IS_SPELL_UPPER_CASE ) )) @@ -452,38 +452,38 @@ void PropertyHelper_Spell::GetCurrentValues() } -BOOL PropertyHelper_Spell::propertyChange_Impl( const PropertyChangeEvent& rEvt ) +sal_Bool PropertyHelper_Spell::propertyChange_Impl( const PropertyChangeEvent& rEvt ) { - BOOL bRes = PropertyChgHelper::propertyChange_Impl( rEvt ); + sal_Bool bRes = PropertyChgHelper::propertyChange_Impl( rEvt ); if (!bRes && GetPropSet().is() && rEvt.Source == GetPropSet()) { - INT16 nLngSvcFlags = 0; - BOOL bSCWA = FALSE, // SPELL_CORRECT_WORDS_AGAIN ? - bSWWA = FALSE; // SPELL_WRONG_WORDS_AGAIN ? + sal_Int16 nLngSvcFlags = 0; + sal_Bool bSCWA = sal_False, // SPELL_CORRECT_WORDS_AGAIN ? + bSWWA = sal_False; // SPELL_WRONG_WORDS_AGAIN ? - BOOL *pbVal = NULL; + sal_Bool *pbVal = NULL; switch (rEvt.PropertyHandle) { case UPH_IS_SPELL_UPPER_CASE : { pbVal = &bIsSpellUpperCase; - bSCWA = FALSE == *pbVal; // FALSE->TRUE change? - bSWWA = !bSCWA; // TRUE->FALSE change? + bSCWA = sal_False == *pbVal; // sal_False->sal_True change? + bSWWA = !bSCWA; // sal_True->sal_False change? break; } case UPH_IS_SPELL_WITH_DIGITS : { pbVal = &bIsSpellWithDigits; - bSCWA = FALSE == *pbVal; // FALSE->TRUE change? - bSWWA = !bSCWA; // TRUE->FALSE change? + bSCWA = sal_False == *pbVal; // sal_False->sal_True change? + bSWWA = !bSCWA; // sal_True->sal_False change? break; } case UPH_IS_SPELL_CAPITALIZATION : { pbVal = &bIsSpellCapitalization; - bSCWA = FALSE == *pbVal; // FALSE->TRUE change? - bSWWA = !bSCWA; // TRUE->FALSE change? + bSCWA = sal_False == *pbVal; // sal_False->sal_True change? + bSWWA = !bSCWA; // sal_True->sal_False change? break; } default: @@ -530,11 +530,11 @@ void PropertyHelper_Spell::SetTmpPropVals( const PropertyValues &rPropVals ) bResIsSpellWithDigits = bIsSpellWithDigits; bResIsSpellCapitalization = bIsSpellCapitalization; - INT32 nLen = rPropVals.getLength(); + sal_Int32 nLen = rPropVals.getLength(); if (nLen) { const PropertyValue *pVal = rPropVals.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) + for (sal_Int32 i = 0; i < nLen; ++i) { if (pVal[i].Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(UPN_MAX_NUMBER_OF_SUGGESTIONS))) { @@ -542,7 +542,7 @@ void PropertyHelper_Spell::SetTmpPropVals( const PropertyValues &rPropVals ) } else { - BOOL *pbResVal = NULL; + sal_Bool *pbResVal = NULL; switch (pVal[i].Handle) { case UPH_IS_SPELL_UPPER_CASE : pbResVal = &bResIsSpellUpperCase; break; @@ -558,7 +558,7 @@ void PropertyHelper_Spell::SetTmpPropVals( const PropertyValues &rPropVals ) } } -INT16 PropertyHelper_Spell::GetDefaultNumberOfSuggestions() const +sal_Int16 PropertyHelper_Spell::GetDefaultNumberOfSuggestions() const { return 16; } @@ -603,13 +603,13 @@ void PropertyHelper_Hyphen::GetCurrentValues() { PropertyChgHelper::GetCurrentValues(); - INT32 nLen = GetPropNames().getLength(); + sal_Int32 nLen = GetPropNames().getLength(); if (GetPropSet().is() && nLen) { const OUString *pPropName = GetPropNames().getConstArray(); - for (INT32 i = 0; i < nLen; ++i) + for (sal_Int32 i = 0; i < nLen; ++i) { - INT16 *pnVal = NULL, + sal_Int16 *pnVal = NULL, *pnResVal = NULL; if (pPropName[i].equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( UPN_HYPH_MIN_LEADING ) )) @@ -638,15 +638,15 @@ void PropertyHelper_Hyphen::GetCurrentValues() } -BOOL PropertyHelper_Hyphen::propertyChange_Impl( const PropertyChangeEvent& rEvt ) +sal_Bool PropertyHelper_Hyphen::propertyChange_Impl( const PropertyChangeEvent& rEvt ) { - BOOL bRes = PropertyChgHelper::propertyChange_Impl( rEvt ); + sal_Bool bRes = PropertyChgHelper::propertyChange_Impl( rEvt ); if (!bRes && GetPropSet().is() && rEvt.Source == GetPropSet()) { - INT16 nLngSvcFlags = LinguServiceEventFlags::HYPHENATE_AGAIN; + sal_Int16 nLngSvcFlags = LinguServiceEventFlags::HYPHENATE_AGAIN; - INT16 *pnVal = NULL; + sal_Int16 *pnVal = NULL; switch (rEvt.PropertyHandle) { case UPH_HYPH_MIN_LEADING : pnVal = &nHyphMinLeading; break; @@ -692,13 +692,13 @@ void PropertyHelper_Hyphen::SetTmpPropVals( const PropertyValues &rPropVals ) nResHyphMinTrailing = nHyphMinTrailing; nResHyphMinWordLength = nHyphMinWordLength; - INT32 nLen = rPropVals.getLength(); + sal_Int32 nLen = rPropVals.getLength(); if (nLen) { const PropertyValue *pVal = rPropVals.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) + for (sal_Int32 i = 0; i < nLen; ++i) { - INT16 *pnResVal = NULL; + sal_Int16 *pnResVal = NULL; switch (pVal[i].Handle) { case UPH_HYPH_MIN_LEADING : pnResVal = &nResHyphMinLeading; break; diff --git a/linguistic/source/lngreg.cxx b/linguistic/source/lngreg.cxx index 51c536061a06..24c60b87cc7f 100644..100755 --- a/linguistic/source/lngreg.cxx +++ b/linguistic/source/lngreg.cxx @@ -39,42 +39,6 @@ using namespace com::sun::star::lang; using namespace com::sun::star::registry; -//////////////////////////////////////// -// declaration of external RegEntry-functions defined by the service objects -// - -extern sal_Bool SAL_CALL LngSvcMgr_writeInfo -( - void * /*pServiceManager*/, - XRegistryKey * pRegistryKey -); - -extern sal_Bool SAL_CALL DicList_writeInfo -( - void * /*pServiceManager*/, XRegistryKey * pRegistryKey -); - -extern sal_Bool SAL_CALL LinguProps_writeInfo -( - void * /*pServiceManager*/, - XRegistryKey * pRegistryKey -); - -extern sal_Bool SAL_CALL ConvDicList_writeInfo -( - void * /*pServiceManager*/, XRegistryKey * pRegistryKey -); - -extern sal_Bool SAL_CALL GrammarCheckingIterator_writeInfo -( - void * /*pServiceManager*/, XRegistryKey * pRegistryKey -); - -//extern sal_Bool SAL_CALL GrammarChecker_writeInfo -//( -// void * /*pServiceManager*/, XRegistryKey * pRegistryKey -//); - extern void * SAL_CALL LngSvcMgr_getFactory ( const sal_Char * pImplName, @@ -130,28 +94,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -sal_Bool SAL_CALL component_writeInfo -( - void * pServiceManager, - XRegistryKey * pRegistryKey -) -{ - sal_Bool bRet = LngSvcMgr_writeInfo( pServiceManager, pRegistryKey ); - if(bRet) - bRet = LinguProps_writeInfo( pServiceManager, pRegistryKey ); - if(bRet) - bRet = DicList_writeInfo( pServiceManager, pRegistryKey ); - if(bRet) - bRet = ConvDicList_writeInfo( pServiceManager, pRegistryKey ); - if(bRet) - bRet = GrammarCheckingIterator_writeInfo( pServiceManager, pRegistryKey ); -/* - if(bRet) - bRet = GrammarChecker_writeInfo( pServiceManager, pRegistryKey ); -*/ - return bRet; -} - void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx index 8bdfd2d3dada..fa1d72fe1385 100644..100755 --- a/linguistic/source/lngsvcmgr.cxx +++ b/linguistic/source/lngsvcmgr.cxx @@ -43,12 +43,14 @@ #include <i18npool/lang.h> #include <i18npool/mslangid.hxx> #include <cppuhelper/factory.hxx> -#include <cppuhelper/extract.hxx> +#include <comphelper/extract.hxx> #include <rtl/logfile.hxx> +#include <boost/checked_delete.hpp> + #include "lngsvcmgr.hxx" #include "lngopt.hxx" -#include "misc.hxx" +#include "linguistic/misc.hxx" #include "spelldsp.hxx" #include "hyphdsp.hxx" #include "thesdsp.hxx" @@ -65,19 +67,19 @@ uno::Sequence< OUString > static GetLangSvc( const uno::Any &rVal ); /////////////////////////////////////////////////////////////////////////// -static BOOL lcl_SeqHasString( const uno::Sequence< OUString > &rSeq, const OUString &rText ) +static sal_Bool lcl_SeqHasString( const uno::Sequence< OUString > &rSeq, const OUString &rText ) { - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; - INT32 nLen = rSeq.getLength(); + sal_Int32 nLen = rSeq.getLength(); if (nLen == 0 || rText.getLength() == 0) return bRes; const OUString *pSeq = rSeq.getConstArray(); - for (INT32 i = 0; i < nLen && !bRes; ++i) + for (sal_Int32 i = 0; i < nLen && !bRes; ++i) { if (rText == pSeq[i]) - bRes = TRUE; + bRes = sal_True; } return bRes; } @@ -90,7 +92,7 @@ static uno::Sequence< lang::Locale > GetAvailLocales( uno::Sequence< lang::Locale > aRes; uno::Reference< lang::XMultiServiceFactory > xFac( utl::getProcessServiceFactory() ); - INT32 nNames = rSvcImplNames.getLength(); + sal_Int32 nNames = rSvcImplNames.getLength(); if (nNames && xFac.is()) { std::set< LanguageType > aLanguages; @@ -103,7 +105,7 @@ static uno::Sequence< lang::Locale > GetAvailLocales( // check all services for the supported languages and new // languages to the result const OUString *pImplNames = rSvcImplNames.getConstArray(); - INT32 i; + sal_Int32 i; for (i = 0; i < nNames; ++i) { @@ -121,8 +123,8 @@ static uno::Sequence< lang::Locale > GetAvailLocales( if (xSuppLoc.is()) { uno::Sequence< lang::Locale > aLoc( xSuppLoc->getLocales() ); - INT32 nLoc = aLoc.getLength(); - for (INT32 k = 0; k < nLoc; ++k) + sal_Int32 nLoc = aLoc.getLength(); + for (sal_Int32 k = 0; k < nLoc; ++k) { const lang::Locale *pLoc = aLoc.getConstArray(); LanguageType nLang = LocaleToLanguage( pLoc[k] ); @@ -139,7 +141,7 @@ static uno::Sequence< lang::Locale > GetAvailLocales( } // build return sequence - INT32 nLanguages = static_cast< INT32 >(aLanguages.size()); + sal_Int32 nLanguages = static_cast< sal_Int32 >(aLanguages.size()); aRes.realloc( nLanguages ); lang::Locale *pRes = aRes.getArray(); std::set< LanguageType >::const_iterator aIt( aLanguages.begin() ); @@ -158,24 +160,24 @@ static uno::Sequence< lang::Locale > GetAvailLocales( struct SvcInfo { const OUString aSvcImplName; - const uno::Sequence< INT16 > aSuppLanguages; + const uno::Sequence< sal_Int16 > aSuppLanguages; SvcInfo( const OUString &rSvcImplName, - const uno::Sequence< INT16 > &rSuppLanguages ) : + const uno::Sequence< sal_Int16 > &rSuppLanguages ) : aSvcImplName (rSvcImplName), aSuppLanguages (rSuppLanguages) { } - BOOL HasLanguage( INT16 nLanguage ) const; + sal_Bool HasLanguage( sal_Int16 nLanguage ) const; }; -BOOL SvcInfo::HasLanguage( INT16 nLanguage ) const +sal_Bool SvcInfo::HasLanguage( sal_Int16 nLanguage ) const { - INT32 nCnt = aSuppLanguages.getLength(); - const INT16 *pLang = aSuppLanguages.getConstArray(); - INT32 i; + sal_Int32 nCnt = aSuppLanguages.getLength(); + const sal_Int16 *pLang = aSuppLanguages.getConstArray(); + sal_Int32 i; for ( i = 0; i < nCnt; ++i) { @@ -194,15 +196,15 @@ void LngSvcMgr::SetAvailableCfgServiceLists( LinguDispatcher &rDispatcher, { // get list of nodenames to look at for their service list const char *pEntryName = 0; - BOOL bHasLangSvcList = TRUE; + sal_Bool bHasLangSvcList = sal_True; switch (rDispatcher.GetDspType()) { case LinguDispatcher::DSP_SPELL : pEntryName = "ServiceManager/SpellCheckerList"; break; case LinguDispatcher::DSP_GRAMMAR : pEntryName = "ServiceManager/GrammarCheckerList"; - bHasLangSvcList = FALSE; + bHasLangSvcList = sal_False; break; case LinguDispatcher::DSP_HYPH : pEntryName = "ServiceManager/HyphenatorList"; - bHasLangSvcList = FALSE; + bHasLangSvcList = sal_False; break; case LinguDispatcher::DSP_THES : pEntryName = "ServiceManager/ThesaurusList"; break; default : @@ -212,9 +214,9 @@ void LngSvcMgr::SetAvailableCfgServiceLists( LinguDispatcher &rDispatcher, uno::Sequence < OUString > aNodeNames( /*aCfg.*/GetNodeNames( aNode ) ); - INT32 nLen = aNodeNames.getLength(); + sal_Int32 nLen = aNodeNames.getLength(); const OUString *pNodeNames = aNodeNames.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) + for (sal_Int32 i = 0; i < nLen; ++i) { uno::Sequence< OUString > aSvcImplNames; @@ -237,7 +239,7 @@ void LngSvcMgr::SetAvailableCfgServiceLists( LinguDispatcher &rDispatcher, else aSvcImplNames = GetLangSvc( rValue ); - INT32 nSvcs = aSvcImplNames.getLength(); + sal_Int32 nSvcs = aSvcImplNames.getLength(); if (nSvcs) { const OUString *pImplNames = aSvcImplNames.getConstArray(); @@ -245,10 +247,10 @@ void LngSvcMgr::SetAvailableCfgServiceLists( LinguDispatcher &rDispatcher, LanguageType nLang = MsLangId::convertIsoStringToLanguage( pNodeNames[i] ); // build list of available services from those - INT32 nCnt = 0; + sal_Int32 nCnt = 0; uno::Sequence< OUString > aAvailSvcs( nSvcs ); OUString *pAvailSvcs = aAvailSvcs.getArray(); - for (INT32 k = 0; k < nSvcs; ++k) + for (sal_Int32 k = 0; k < nSvcs; ++k) { // check for availability of the service size_t nAvailSvcs = rAvailSvcs.size(); @@ -294,13 +296,13 @@ class LngSvcMgrListenerHelper : uno::Reference< linguistic2::XDictionaryList > xDicList; uno::Reference< uno::XInterface > xMyEvtObj; - INT16 nCombinedLngSvcEvt; + sal_Int16 nCombinedLngSvcEvt; // disallow copy-constructor and assignment-operator for now LngSvcMgrListenerHelper(const LngSvcMgrListenerHelper &); LngSvcMgrListenerHelper & operator = (const LngSvcMgrListenerHelper &); - void LaunchEvent( INT16 nLngSvcEvtFlags ); + void LaunchEvent( sal_Int16 nLngSvcEvtFlags ); // DECL_LINK( TimeOut, Timer* ); long Timeout(); @@ -326,17 +328,17 @@ public: const linguistic2::DictionaryListEvent& rDicListEvent ) throw(uno::RuntimeException); - inline BOOL AddLngSvcMgrListener( + inline sal_Bool AddLngSvcMgrListener( const uno::Reference< lang::XEventListener >& rxListener ); - inline BOOL RemoveLngSvcMgrListener( + inline sal_Bool RemoveLngSvcMgrListener( const uno::Reference< lang::XEventListener >& rxListener ); void DisposeAndClear( const lang::EventObject &rEvtObj ); - BOOL AddLngSvcEvtBroadcaster( + sal_Bool AddLngSvcEvtBroadcaster( const uno::Reference< linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster ); - BOOL RemoveLngSvcEvtBroadcaster( + sal_Bool RemoveLngSvcEvtBroadcaster( const uno::Reference< linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster ); - void AddLngSvcEvt( INT16 nLngSvcEvt ); + void AddLngSvcEvt( sal_Int16 nLngSvcEvt ); }; @@ -353,7 +355,7 @@ LngSvcMgrListenerHelper::LngSvcMgrListenerHelper( if (xDicList.is()) { xDicList->addDictionaryListEventListener( - (linguistic2::XDictionaryListEventListener *) this, FALSE ); + (linguistic2::XDictionaryListEventListener *) this, sal_False ); } //! The timer is used to 'sum up' different events in order to reduce the @@ -413,7 +415,7 @@ long LngSvcMgrListenerHelper::Timeout() } -void LngSvcMgrListenerHelper::AddLngSvcEvt( INT16 nLngSvcEvt ) +void LngSvcMgrListenerHelper::AddLngSvcEvt( sal_Int16 nLngSvcEvt ) { nCombinedLngSvcEvt |= nLngSvcEvt; // aLaunchTimer.Start(); @@ -438,7 +440,7 @@ void SAL_CALL { osl::MutexGuard aGuard( GetLinguMutex() ); - INT16 nDlEvt = rDicListEvent.nCondensedEvent; + sal_Int16 nDlEvt = rDicListEvent.nCondensedEvent; if (0 == nDlEvt) return; @@ -456,9 +458,9 @@ void SAL_CALL // // "translate" DictionaryList event into linguistic2::LinguServiceEvent // - INT16 nLngSvcEvt = 0; + sal_Int16 nLngSvcEvt = 0; // - INT16 nSpellCorrectFlags = + sal_Int16 nSpellCorrectFlags = linguistic2::DictionaryListEventFlags::ADD_NEG_ENTRY | linguistic2::DictionaryListEventFlags::DEL_POS_ENTRY | linguistic2::DictionaryListEventFlags::ACTIVATE_NEG_DIC | @@ -466,7 +468,7 @@ void SAL_CALL if (0 != (nDlEvt & nSpellCorrectFlags)) nLngSvcEvt |= linguistic2::LinguServiceEventFlags::SPELL_CORRECT_WORDS_AGAIN; // - INT16 nSpellWrongFlags = + sal_Int16 nSpellWrongFlags = linguistic2::DictionaryListEventFlags::ADD_POS_ENTRY | linguistic2::DictionaryListEventFlags::DEL_NEG_ENTRY | linguistic2::DictionaryListEventFlags::ACTIVATE_POS_DIC | @@ -474,7 +476,7 @@ void SAL_CALL if (0 != (nDlEvt & nSpellWrongFlags)) nLngSvcEvt |= linguistic2::LinguServiceEventFlags::SPELL_WRONG_WORDS_AGAIN; // - INT16 nHyphenateFlags = + sal_Int16 nHyphenateFlags = linguistic2::DictionaryListEventFlags::ADD_POS_ENTRY | linguistic2::DictionaryListEventFlags::DEL_POS_ENTRY | linguistic2::DictionaryListEventFlags::ACTIVATE_POS_DIC | @@ -489,7 +491,7 @@ void SAL_CALL } -void LngSvcMgrListenerHelper::LaunchEvent( INT16 nLngSvcEvtFlags ) +void LngSvcMgrListenerHelper::LaunchEvent( sal_Int16 nLngSvcEvtFlags ) { linguistic2::LinguServiceEvent aEvt( xMyEvtObj, nLngSvcEvtFlags ); @@ -504,19 +506,19 @@ void LngSvcMgrListenerHelper::LaunchEvent( INT16 nLngSvcEvtFlags ) } -inline BOOL LngSvcMgrListenerHelper::AddLngSvcMgrListener( +inline sal_Bool LngSvcMgrListenerHelper::AddLngSvcMgrListener( const uno::Reference< lang::XEventListener >& rxListener ) { aLngSvcMgrListeners.addInterface( rxListener ); - return TRUE; + return sal_True; } -inline BOOL LngSvcMgrListenerHelper::RemoveLngSvcMgrListener( +inline sal_Bool LngSvcMgrListenerHelper::RemoveLngSvcMgrListener( const uno::Reference< lang::XEventListener >& rxListener ) { aLngSvcMgrListeners.removeInterface( rxListener ); - return TRUE; + return sal_True; } @@ -544,10 +546,10 @@ void LngSvcMgrListenerHelper::DisposeAndClear( const lang::EventObject &rEvtObj } -BOOL LngSvcMgrListenerHelper::AddLngSvcEvtBroadcaster( +sal_Bool LngSvcMgrListenerHelper::AddLngSvcEvtBroadcaster( const uno::Reference< linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster ) { - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if (rxBroadcaster.is()) { aLngSvcEvtBroadcasters.addInterface( rxBroadcaster ); @@ -558,10 +560,10 @@ BOOL LngSvcMgrListenerHelper::AddLngSvcEvtBroadcaster( } -BOOL LngSvcMgrListenerHelper::RemoveLngSvcEvtBroadcaster( +sal_Bool LngSvcMgrListenerHelper::RemoveLngSvcEvtBroadcaster( const uno::Reference< linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster ) { - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if (rxBroadcaster.is()) { aLngSvcEvtBroadcasters.removeInterface( rxBroadcaster ); @@ -579,7 +581,7 @@ LngSvcMgr::LngSvcMgr() : utl::ConfigItem( String::CreateFromAscii( "Office.Linguistic" ) ), aEvtListeners ( GetLinguMutex() ) { - bDisposing = FALSE; + bDisposing = sal_False; pSpellDsp = 0; pGrammarDsp = 0; @@ -602,6 +604,14 @@ LngSvcMgr::LngSvcMgr() : EnableNotification( aNames ); } +void LngSvcMgr::clearSvcInfoArray(SvcInfoArray* pInfo) +{ + if (pInfo) + { + std::for_each(pInfo->begin(), pInfo->end(), boost::checked_deleter<SvcInfo>()); + delete pInfo; + } +} LngSvcMgr::~LngSvcMgr() { @@ -609,10 +619,10 @@ LngSvcMgr::~LngSvcMgr() // will be freed in the destructor of the respective Reference's // xSpellDsp, xGrammarDsp, xHyphDsp, xThesDsp - delete pAvailSpellSvcs; - delete pAvailGrammarSvcs; - delete pAvailHyphSvcs; - delete pAvailThesSvcs; + clearSvcInfoArray(pAvailSpellSvcs); + clearSvcInfoArray(pAvailGrammarSvcs); + clearSvcInfoArray(pAvailHyphSvcs); + clearSvcInfoArray(pAvailThesSvcs); } @@ -649,7 +659,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames ) if (0 == rName.compareTo( aSpellCheckerList, aSpellCheckerList.getLength() )) { // delete old cached data, needs to be acquired new on demand - delete pAvailSpellSvcs; pAvailSpellSvcs = 0; + clearSvcInfoArray(pAvailSpellSvcs); pAvailSpellSvcs = 0; OUString aNode( aSpellCheckerList ); if (lcl_SeqHasString( aSpellCheckerListEntries, aKeyText )) @@ -674,7 +684,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames ) else if (0 == rName.compareTo( aGrammarCheckerList, aGrammarCheckerList.getLength() )) { // delete old cached data, needs to be acquired new on demand - delete pAvailGrammarSvcs; pAvailGrammarSvcs = 0; + clearSvcInfoArray(pAvailGrammarSvcs); pAvailGrammarSvcs = 0; OUString aNode( aGrammarCheckerList ); if (lcl_SeqHasString( aGrammarCheckerListEntries, aKeyText )) @@ -702,7 +712,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames ) else if (0 == rName.compareTo( aHyphenatorList, aHyphenatorList.getLength() )) { // delete old cached data, needs to be acquired new on demand - delete pAvailHyphSvcs; pAvailHyphSvcs = 0; + clearSvcInfoArray(pAvailHyphSvcs); pAvailHyphSvcs = 0; OUString aNode( aHyphenatorList ); if (lcl_SeqHasString( aHyphenatorListEntries, aKeyText )) @@ -727,7 +737,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames ) else if (0 == rName.compareTo( aThesaurusList, aThesaurusList.getLength() )) { // delete old cached data, needs to be acquired new on demand - delete pAvailThesSvcs; pAvailThesSvcs = 0; + clearSvcInfoArray(pAvailThesSvcs); pAvailThesSvcs = 0; OUString aNode( aThesaurusList ); if (lcl_SeqHasString( aThesaurusListEntries, aKeyText )) @@ -887,7 +897,7 @@ void LngSvcMgr::GetAvailableSpellSvcs_Impl() if (xSvc.is()) { OUString aImplName; - uno::Sequence< INT16 > aLanguages; + uno::Sequence< sal_Int16 > aLanguages; uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY ); if (xInfo.is()) aImplName = xInfo->getImplementationName(); @@ -953,7 +963,7 @@ void LngSvcMgr::GetAvailableGrammarSvcs_Impl() if (xSvc.is()) { OUString aImplName; - uno::Sequence< INT16 > aLanguages; + uno::Sequence< sal_Int16 > aLanguages; uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY ); if (xInfo.is()) aImplName = xInfo->getImplementationName(); @@ -1018,7 +1028,7 @@ void LngSvcMgr::GetAvailableHyphSvcs_Impl() if (xSvc.is()) { OUString aImplName; - uno::Sequence< INT16 > aLanguages; + uno::Sequence< sal_Int16 > aLanguages; uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY ); if (xInfo.is()) aImplName = xInfo->getImplementationName(); @@ -1085,7 +1095,7 @@ void LngSvcMgr::GetAvailableThesSvcs_Impl() if (xSvc.is()) { OUString aImplName; - uno::Sequence< INT16 > aLanguages; + uno::Sequence< sal_Int16 > aLanguages; uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY ); if (xInfo.is()) aImplName = xInfo->getImplementationName(); @@ -1114,7 +1124,7 @@ void LngSvcMgr::SetCfgServiceLists( SpellCheckerDispatcher &rSpellDsp ) String aNode( String::CreateFromAscii( "ServiceManager/SpellCheckerList" ) ); uno::Sequence< OUString > aNames( /*aCfg.*/GetNodeNames( aNode ) ); OUString *pNames = aNames.getArray(); - INT32 nLen = aNames.getLength(); + sal_Int32 nLen = aNames.getLength(); // append path prefix need for 'GetProperties' call below String aPrefix( aNode ); @@ -1130,13 +1140,13 @@ void LngSvcMgr::SetCfgServiceLists( SpellCheckerDispatcher &rSpellDsp ) if (nLen && nLen == aValues.getLength()) { const uno::Any *pValues = aValues.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) + for (sal_Int32 i = 0; i < nLen; ++i) { uno::Sequence< OUString > aSvcImplNames; if (pValues[i] >>= aSvcImplNames) { #if OSL_DEBUG_LEVEL > 1 -// INT32 nSvcs = aSvcImplNames.getLength(); +// sal_Int32 nSvcs = aSvcImplNames.getLength(); // const OUString *pSvcImplNames = aSvcImplNames.getConstArray(); #endif String aLocaleStr( pNames[i] ); @@ -1157,7 +1167,7 @@ void LngSvcMgr::SetCfgServiceLists( GrammarCheckingIterator &rGrammarDsp ) String aNode( String::CreateFromAscii( "ServiceManager/GrammarCheckerList" ) ); uno::Sequence< OUString > aNames( /*aCfg.*/GetNodeNames( aNode ) ); OUString *pNames = aNames.getArray(); - INT32 nLen = aNames.getLength(); + sal_Int32 nLen = aNames.getLength(); // append path prefix need for 'GetProperties' call below String aPrefix( aNode ); @@ -1173,7 +1183,7 @@ void LngSvcMgr::SetCfgServiceLists( GrammarCheckingIterator &rGrammarDsp ) if (nLen && nLen == aValues.getLength()) { const uno::Any *pValues = aValues.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) + for (sal_Int32 i = 0; i < nLen; ++i) { uno::Sequence< OUString > aSvcImplNames; if (pValues[i] >>= aSvcImplNames) @@ -1183,7 +1193,7 @@ void LngSvcMgr::SetCfgServiceLists( GrammarCheckingIterator &rGrammarDsp ) aSvcImplNames.realloc(1); #if OSL_DEBUG_LEVEL > 1 -// INT32 nSvcs = aSvcImplNames.getLength(); +// sal_Int32 nSvcs = aSvcImplNames.getLength(); // const OUString *pSvcImplNames = aSvcImplNames.getConstArray(); #endif String aLocaleStr( pNames[i] ); @@ -1204,7 +1214,7 @@ void LngSvcMgr::SetCfgServiceLists( HyphenatorDispatcher &rHyphDsp ) String aNode( String::CreateFromAscii( "ServiceManager/HyphenatorList" ) ); uno::Sequence< OUString > aNames( /*aCfg.*/GetNodeNames( aNode ) ); OUString *pNames = aNames.getArray(); - INT32 nLen = aNames.getLength(); + sal_Int32 nLen = aNames.getLength(); // append path prefix need for 'GetProperties' call below String aPrefix( aNode ); @@ -1220,7 +1230,7 @@ void LngSvcMgr::SetCfgServiceLists( HyphenatorDispatcher &rHyphDsp ) if (nLen && nLen == aValues.getLength()) { const uno::Any *pValues = aValues.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) + for (sal_Int32 i = 0; i < nLen; ++i) { uno::Sequence< OUString > aSvcImplNames; if (pValues[i] >>= aSvcImplNames) @@ -1230,7 +1240,7 @@ void LngSvcMgr::SetCfgServiceLists( HyphenatorDispatcher &rHyphDsp ) aSvcImplNames.realloc(1); #if OSL_DEBUG_LEVEL > 1 -// INT32 nSvcs = aSvcImplNames.getLength(); +// sal_Int32 nSvcs = aSvcImplNames.getLength(); // const OUString *pSvcImplNames = aSvcImplNames.getConstArray(); #endif String aLocaleStr( pNames[i] ); @@ -1251,7 +1261,7 @@ void LngSvcMgr::SetCfgServiceLists( ThesaurusDispatcher &rThesDsp ) String aNode( String::CreateFromAscii( "ServiceManager/ThesaurusList" ) ); uno::Sequence< OUString > aNames( /*aCfg.*/GetNodeNames( aNode ) ); OUString *pNames = aNames.getArray(); - INT32 nLen = aNames.getLength(); + sal_Int32 nLen = aNames.getLength(); // append path prefix need for 'GetProperties' call below String aPrefix( aNode ); @@ -1267,13 +1277,13 @@ void LngSvcMgr::SetCfgServiceLists( ThesaurusDispatcher &rThesDsp ) if (nLen && nLen == aValues.getLength()) { const uno::Any *pValues = aValues.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) + for (sal_Int32 i = 0; i < nLen; ++i) { uno::Sequence< OUString > aSvcImplNames; if (pValues[i] >>= aSvcImplNames) { #if OSL_DEBUG_LEVEL > 1 -// INT32 nSvcs = aSvcImplNames.getLength(); +// sal_Int32 nSvcs = aSvcImplNames.getLength(); // const OUString *pSvcImplNames = aSvcImplNames.getConstArray(); #endif String aLocaleStr( pNames[i] ); @@ -1354,7 +1364,7 @@ sal_Bool SAL_CALL { osl::MutexGuard aGuard( GetLinguMutex() ); - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if (!bDisposing && xListener.is()) { if (!pListenerHelper) @@ -1372,7 +1382,7 @@ sal_Bool SAL_CALL { osl::MutexGuard aGuard( GetLinguMutex() ); - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if (!bDisposing && xListener.is()) { DBG_ASSERT( pListenerHelper, "listener removed without being added" ); @@ -1399,7 +1409,7 @@ uno::Sequence< OUString > SAL_CALL { // don't used cached data here (force re-evaluation in order to have downloaded dictionaries // already found without the need to restart the office - delete pAvailSpellSvcs; pAvailSpellSvcs = 0; + clearSvcInfoArray(pAvailSpellSvcs); pAvailSpellSvcs = 0; GetAvailableSpellSvcs_Impl(); pInfoArray = pAvailSpellSvcs; } @@ -1407,7 +1417,7 @@ uno::Sequence< OUString > SAL_CALL { // don't used cached data here (force re-evaluation in order to have downloaded dictionaries // already found without the need to restart the office - delete pAvailGrammarSvcs; pAvailGrammarSvcs = 0; + clearSvcInfoArray(pAvailGrammarSvcs); pAvailGrammarSvcs = 0; GetAvailableGrammarSvcs_Impl(); pInfoArray = pAvailGrammarSvcs; } @@ -1415,7 +1425,7 @@ uno::Sequence< OUString > SAL_CALL { // don't used cached data here (force re-evaluation in order to have downloaded dictionaries // already found without the need to restart the office - delete pAvailHyphSvcs; pAvailHyphSvcs = 0; + clearSvcInfoArray(pAvailHyphSvcs); pAvailHyphSvcs = 0; GetAvailableHyphSvcs_Impl(); pInfoArray = pAvailHyphSvcs; } @@ -1423,7 +1433,7 @@ uno::Sequence< OUString > SAL_CALL { // don't used cached data here (force re-evaluation in order to have downloaded dictionaries // already found without the need to restart the office - delete pAvailThesSvcs; pAvailThesSvcs = 0; + clearSvcInfoArray(pAvailThesSvcs); pAvailThesSvcs = 0; GetAvailableThesSvcs_Impl(); pInfoArray = pAvailThesSvcs; } @@ -1435,7 +1445,7 @@ uno::Sequence< OUString > SAL_CALL aRes.realloc( nMaxCnt ); OUString *pImplName = aRes.getArray(); - USHORT nCnt = 0; + sal_uInt16 nCnt = 0; LanguageType nLanguage = LocaleToLanguage( rLocale ); for (size_t i = 0; i < nMaxCnt; ++i) { @@ -1487,22 +1497,22 @@ uno::Sequence< lang::Locale > SAL_CALL return aRes; } -static BOOL IsEqSvcList( const uno::Sequence< OUString > &rList1, +static sal_Bool IsEqSvcList( const uno::Sequence< OUString > &rList1, const uno::Sequence< OUString > &rList2 ) { - // returns TRUE iff both sequences are equal + // returns sal_True iff both sequences are equal - BOOL bRes = FALSE; - INT32 nLen = rList1.getLength(); + sal_Bool bRes = sal_False; + sal_Int32 nLen = rList1.getLength(); if (rList2.getLength() == nLen) { const OUString *pStr1 = rList1.getConstArray(); const OUString *pStr2 = rList2.getConstArray(); - bRes = TRUE; - for (INT32 i = 0; i < nLen && bRes; ++i) + bRes = sal_True; + for (sal_Int32 i = 0; i < nLen && bRes; ++i) { if (*pStr1++ != *pStr2++) - bRes = FALSE; + bRes = sal_False; } } return bRes; @@ -1531,7 +1541,7 @@ void SAL_CALL { if (!xSpellDsp.is()) GetSpellCheckerDsp_Impl(); - BOOL bChanged = !IsEqSvcList( rServiceImplNames, + sal_Bool bChanged = !IsEqSvcList( rServiceImplNames, pSpellDsp->GetServiceList( rLocale ) ); if (bChanged) { @@ -1548,7 +1558,7 @@ void SAL_CALL { if (!xGrammarDsp.is()) GetGrammarCheckerDsp_Impl(); - BOOL bChanged = !IsEqSvcList( rServiceImplNames, + sal_Bool bChanged = !IsEqSvcList( rServiceImplNames, pGrammarDsp->GetServiceList( rLocale ) ); if (bChanged) { @@ -1564,7 +1574,7 @@ void SAL_CALL { if (!xHyphDsp.is()) GetHyphenatorDsp_Impl(); - BOOL bChanged = !IsEqSvcList( rServiceImplNames, + sal_Bool bChanged = !IsEqSvcList( rServiceImplNames, pHyphDsp->GetServiceList( rLocale ) ); if (bChanged) { @@ -1580,7 +1590,7 @@ void SAL_CALL { if (!xThesDsp.is()) GetThesaurusDsp_Impl(); - BOOL bChanged = !IsEqSvcList( rServiceImplNames, + sal_Bool bChanged = !IsEqSvcList( rServiceImplNames, pThesDsp->GetServiceList( rLocale ) ); if (bChanged) { @@ -1592,11 +1602,11 @@ void SAL_CALL } -BOOL LngSvcMgr::SaveCfgSvcs( const String &rServiceName ) +sal_Bool LngSvcMgr::SaveCfgSvcs( const String &rServiceName ) { RTL_LOGFILE_CONTEXT( aLog, "linguistic: LngSvcMgr::SaveCfgSvcs" ); - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; LinguDispatcher *pDsp = 0; uno::Sequence< lang::Locale > aLocales; @@ -1632,7 +1642,7 @@ BOOL LngSvcMgr::SaveCfgSvcs( const String &rServiceName ) if (pDsp && aLocales.getLength()) { - INT32 nLen = aLocales.getLength(); + sal_Int32 nLen = aLocales.getLength(); const lang::Locale *pLocale = aLocales.getConstArray(); uno::Sequence< beans::PropertyValue > aValues( nLen ); @@ -1655,15 +1665,15 @@ BOOL LngSvcMgr::SaveCfgSvcs( const String &rServiceName ) } OUString aNodeName( ::rtl::OUString::createFromAscii(pNodeName) ); - for (INT32 i = 0; i < nLen; ++i) + for (sal_Int32 i = 0; i < nLen; ++i) { uno::Sequence< OUString > aSvcImplNames; aSvcImplNames = pDsp->GetServiceList( pLocale[i] ); #if OSL_DEBUG_LEVEL > 1 - INT32 nSvcs = aSvcImplNames.getLength(); + sal_Int32 nSvcs = aSvcImplNames.getLength(); const OUString *pSvcImplName = aSvcImplNames.getConstArray(); - for (INT32 j = 0; j < nSvcs; ++j) + for (sal_Int32 j = 0; j < nSvcs; ++j) { OUString aImplName( pSvcImplName[j] ); } @@ -1702,11 +1712,11 @@ static uno::Sequence< OUString > GetLangSvcList( const uno::Any &rVal ) { rVal >>= aRes; #if OSL_DEBUG_LEVEL > 1 - INT32 nSvcs = aRes.getLength(); + sal_Int32 nSvcs = aRes.getLength(); if (nSvcs) { const OUString *pSvcName = aRes.getConstArray(); - for (INT32 j = 0; j < nSvcs; ++j) + for (sal_Int32 j = 0; j < nSvcs; ++j) { OUString aImplName( pSvcName[j] ); DBG_ASSERT( aImplName.getLength(), "service impl-name missing" ); @@ -1848,7 +1858,7 @@ void SAL_CALL if (!bDisposing) { - bDisposing = TRUE; + bDisposing = sal_True; // require listeners to release this object lang::EventObject aEvtObj( (XLinguServiceManager *) this ); @@ -1888,10 +1898,10 @@ void SAL_CALL } -BOOL LngSvcMgr::AddLngSvcEvtBroadcaster( +sal_Bool LngSvcMgr::AddLngSvcEvtBroadcaster( const uno::Reference< linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster ) { - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if (rxBroadcaster.is()) { if (!pListenerHelper) @@ -1902,10 +1912,10 @@ BOOL LngSvcMgr::AddLngSvcEvtBroadcaster( } -BOOL LngSvcMgr::RemoveLngSvcEvtBroadcaster( +sal_Bool LngSvcMgr::RemoveLngSvcEvtBroadcaster( const uno::Reference< linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster ) { - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if (rxBroadcaster.is()) { DBG_ASSERT( pListenerHelper, "pListenerHelper non existent" ); @@ -1934,10 +1944,10 @@ sal_Bool SAL_CALL uno::Sequence< OUString > aSNL = getSupportedServiceNames(); const OUString * pArray = aSNL.getConstArray(); - for( INT32 i = 0; i < aSNL.getLength(); i++ ) + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) if( pArray[i] == ServiceName ) - return TRUE; - return FALSE; + return sal_True; + return sal_False; } @@ -1969,31 +1979,6 @@ uno::Reference< uno::XInterface > SAL_CALL LngSvcMgr_CreateInstance( return xService; } - - -sal_Bool SAL_CALL LngSvcMgr_writeInfo( - void * /*pServiceManager*/, - registry::XRegistryKey * pRegistryKey ) -{ - try - { - String aImpl( '/' ); - aImpl += LngSvcMgr::getImplementationName_Static().getStr(); - aImpl.AppendAscii( "/UNO/SERVICES" ); - uno::Reference< registry::XRegistryKey > xNewKey = - pRegistryKey->createKey( aImpl ); - uno::Sequence< OUString > aServices = LngSvcMgr::getSupportedServiceNames_Static(); - for( INT32 i = 0; i < aServices.getLength(); i++ ) - xNewKey->createKey( aServices.getConstArray()[i] ); - - return sal_True; - } - catch(uno::Exception &) - { - return sal_False; - } -} - void * SAL_CALL LngSvcMgr_getFactory( const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager, diff --git a/linguistic/source/lngsvcmgr.hxx b/linguistic/source/lngsvcmgr.hxx index a7057daf079f..a23cd326409d 100644..100755 --- a/linguistic/source/lngsvcmgr.hxx +++ b/linguistic/source/lngsvcmgr.hxx @@ -41,7 +41,7 @@ #include <com/sun/star/linguistic2/XAvailableLocales.hpp> #include <unotools/configitem.hxx> -#include "misc.hxx" +#include "linguistic/misc.hxx" #include "defs.hxx" class SpellCheckerDispatcher; @@ -111,7 +111,7 @@ class LngSvcMgr : SvcInfoArray * pAvailHyphSvcs; SvcInfoArray * pAvailThesSvcs; - BOOL bDisposing; + sal_Bool bDisposing; // disallow copy-constructor and assignment-operator for now LngSvcMgr(const LngSvcMgr &); @@ -133,11 +133,13 @@ class LngSvcMgr : void SetCfgServiceLists( HyphenatorDispatcher &rHyphDsp ); void SetCfgServiceLists( ThesaurusDispatcher &rThesDsp ); - BOOL SaveCfgSvcs( const String &rServiceName ); + sal_Bool SaveCfgSvcs( const String &rServiceName ); void SetAvailableCfgServiceLists( LinguDispatcher &rDispatcher, const SvcInfoArray &rAvailSvcs ); + static void clearSvcInfoArray(SvcInfoArray *pInfo); + // utl::ConfigItem (to allow for listening of changes of relevant properties) virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString > &rPropertyNames ); virtual void Commit(); @@ -173,10 +175,10 @@ public: static inline ::rtl::OUString getImplementationName_Static(); static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw(); - BOOL AddLngSvcEvtBroadcaster( + sal_Bool AddLngSvcEvtBroadcaster( const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster ); - BOOL RemoveLngSvcEvtBroadcaster( + sal_Bool RemoveLngSvcEvtBroadcaster( const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster ); }; diff --git a/linguistic/source/makefile.mk b/linguistic/source/makefile.mk index da6277db15d8..c69985405888 100644..100755 --- a/linguistic/source/makefile.mk +++ b/linguistic/source/makefile.mk @@ -29,7 +29,7 @@ PRJ=.. PRJNAME=linguistic TARGET=lng -ENABLE_EXCEPTIONS=TRUE +ENABLE_EXCEPTIONS=sal_True #----- Settings --------------------------------------------------------- @@ -88,9 +88,8 @@ DEF1DES =Linguistic main DLL .IF "$(GUI)"=="WNT" -DEF1EXPORT1 = component_writeInfo -DEF1EXPORT2 = component_getFactory -DEF1EXPORT3 = component_getImplementationEnvironment +DEF1EXPORT1 = component_getFactory +DEF1EXPORT2 = component_getImplementationEnvironment .ENDIF # --- Targets ------------------------------------------------------ @@ -105,3 +104,11 @@ $(MISC)$/$(SHL1TARGET).flt: makefile.mk @echo component >> $@ @echo __CT >> $@ + +ALLTAR : $(MISC)/lng.component + +$(MISC)/lng.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + lng.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt lng.component diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index d73d9a034ada..73a19fe6d466 100644..100755 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -55,10 +55,10 @@ #include <rtl/instance.hxx> -#include "misc.hxx" +#include "linguistic/misc.hxx" #include "defs.hxx" -#include "lngprops.hxx" -#include "hyphdta.hxx" +#include "linguistic/lngprops.hxx" +#include "linguistic/hyphdta.hxx" #include <i18npool/mslangid.hxx> using namespace utl; @@ -89,7 +89,7 @@ osl::Mutex & GetLinguMutex() /////////////////////////////////////////////////////////////////////////// -LocaleDataWrapper & GetLocaleDataWrapper( INT16 nLang ) +LocaleDataWrapper & GetLocaleDataWrapper( sal_Int16 nLang ) { static LocaleDataWrapper aLclDtaWrp( getProcessServiceFactory(), @@ -109,10 +109,10 @@ LocaleDataWrapper & GetLocaleDataWrapper( INT16 nLang ) /** returns text-encoding used for ByteString unicode String conversion */ -rtl_TextEncoding GetTextEncoding( INT16 nLanguage ) +rtl_TextEncoding GetTextEncoding( sal_Int16 nLanguage ) { DBG_ASSERT( nLanguage != LANGUAGE_NONE, "invalid language argument" ); - static INT16 nLastLanguage = LANGUAGE_NONE; + static sal_Int16 nLastLanguage = LANGUAGE_NONE; // set default value for unknown languages static rtl_TextEncoding nEncoding = RTL_TEXTENCODING_DONTKNOW; @@ -268,14 +268,14 @@ sal_Int32 LevDistance( const OUString &rTxt1, const OUString &rTxt2 ) /////////////////////////////////////////////////////////////////////////// -BOOL IsUseDicList( const PropertyValues &rProperties, +sal_Bool IsUseDicList( const PropertyValues &rProperties, const uno::Reference< XPropertySet > &rxProp ) { - BOOL bRes = TRUE; + sal_Bool bRes = sal_True; - INT32 nLen = rProperties.getLength(); + sal_Int32 nLen = rProperties.getLength(); const PropertyValue *pVal = rProperties.getConstArray(); - INT32 i; + sal_Int32 i; for ( i = 0; i < nLen; ++i) { @@ -296,14 +296,14 @@ BOOL IsUseDicList( const PropertyValues &rProperties, } -BOOL IsIgnoreControlChars( const PropertyValues &rProperties, +sal_Bool IsIgnoreControlChars( const PropertyValues &rProperties, const uno::Reference< XPropertySet > &rxProp ) { - BOOL bRes = TRUE; + sal_Bool bRes = sal_True; - INT32 nLen = rProperties.getLength(); + sal_Int32 nLen = rProperties.getLength(); const PropertyValue *pVal = rProperties.getConstArray(); - INT32 i; + sal_Int32 i; for ( i = 0; i < nLen; ++i) { @@ -324,9 +324,9 @@ BOOL IsIgnoreControlChars( const PropertyValues &rProperties, } -static BOOL lcl_HasHyphInfo( const uno::Reference<XDictionaryEntry> &xEntry ) +static sal_Bool lcl_HasHyphInfo( const uno::Reference<XDictionaryEntry> &xEntry ) { - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; if (xEntry.is()) { // there has to be (at least one) '=' denoting a hyphenation position @@ -340,8 +340,8 @@ static BOOL lcl_HasHyphInfo( const uno::Reference<XDictionaryEntry> &xEntry ) uno::Reference< XDictionaryEntry > SearchDicList( const uno::Reference< XDictionaryList > &xDicList, - const OUString &rWord, INT16 nLanguage, - BOOL bSearchPosDics, BOOL bSearchSpellEntry ) + const OUString &rWord, sal_Int16 nLanguage, + sal_Bool bSearchPosDics, sal_Bool bSearchSpellEntry ) { MutexGuard aGuard( GetLinguMutex() ); @@ -354,15 +354,15 @@ uno::Reference< XDictionaryEntry > SearchDicList( aDics( xDicList->getDictionaries() ); const uno::Reference< XDictionary > *pDic = aDics.getConstArray(); - INT32 nDics = xDicList->getCount(); + sal_Int32 nDics = xDicList->getCount(); - INT32 i; + sal_Int32 i; for (i = 0; i < nDics; i++) { uno::Reference< XDictionary > axDic( pDic[i], UNO_QUERY ); DictionaryType eType = axDic->getDictionaryType(); - INT16 nLang = LocaleToLanguage( axDic->getLocale() ); + sal_Int16 nLang = LocaleToLanguage( axDic->getLocale() ); if ( axDic.is() && axDic->isActive() && (nLang == nLanguage || nLang == LANGUAGE_NONE) ) @@ -396,8 +396,8 @@ sal_Bool SaveDictionaries( const uno::Reference< XDictionaryList > &xDicList ) Sequence< uno::Reference< XDictionary > > aDics( xDicList->getDictionaries() ); const uno::Reference< XDictionary > *pDic = aDics.getConstArray(); - INT32 nCount = aDics.getLength(); - for (INT32 i = 0; i < nCount; i++) + sal_Int32 nCount = aDics.getLength(); + for (sal_Int32 i = 0; i < nCount; i++) { try { @@ -488,14 +488,14 @@ Locale CreateLocale( LanguageType eLang ) return aLocale; } -uno::Sequence< Locale > LangSeqToLocaleSeq( const uno::Sequence< INT16 > &rLangSeq ) +uno::Sequence< Locale > LangSeqToLocaleSeq( const uno::Sequence< sal_Int16 > &rLangSeq ) { - const INT16 *pLang = rLangSeq.getConstArray(); - INT32 nCount = rLangSeq.getLength(); + const sal_Int16 *pLang = rLangSeq.getConstArray(); + sal_Int32 nCount = rLangSeq.getLength(); uno::Sequence< Locale > aLocales( nCount ); Locale *pLocale = aLocales.getArray(); - for (INT32 i = 0; i < nCount; ++i) + for (sal_Int32 i = 0; i < nCount; ++i) { LanguageToLocale( pLocale[i], pLang[ i ] ); } @@ -503,15 +503,15 @@ uno::Sequence< Locale > LangSeqToLocaleSeq( const uno::Sequence< INT16 > &rLangS return aLocales; } -uno::Sequence< INT16 > +uno::Sequence< sal_Int16 > LocaleSeqToLangSeq( uno::Sequence< Locale > &rLocaleSeq ) { const Locale *pLocale = rLocaleSeq.getConstArray(); - INT32 nCount = rLocaleSeq.getLength(); + sal_Int32 nCount = rLocaleSeq.getLength(); - uno::Sequence< INT16 > aLangs( nCount ); - INT16 *pLang = aLangs.getArray(); - for (INT32 i = 0; i < nCount; ++i) + uno::Sequence< sal_Int16 > aLangs( nCount ); + sal_Int16 *pLang = aLangs.getArray(); + for (sal_Int32 i = 0; i < nCount; ++i) { pLang[i] = LocaleToLanguage( pLocale[i] ); } @@ -521,10 +521,10 @@ uno::Sequence< INT16 > /////////////////////////////////////////////////////////////////////////// -BOOL IsReadOnly( const String &rURL, BOOL *pbExist ) +sal_Bool IsReadOnly( const String &rURL, sal_Bool *pbExist ) { - BOOL bRes = FALSE; - BOOL bExists = FALSE; + sal_Bool bRes = sal_False; + sal_Bool bExists = sal_False; if (rURL.Len() > 0) { @@ -542,7 +542,7 @@ BOOL IsReadOnly( const String &rURL, BOOL *pbExist ) } catch (Exception &) { - bRes = TRUE; + bRes = sal_True; } } @@ -554,16 +554,16 @@ BOOL IsReadOnly( const String &rURL, BOOL *pbExist ) /////////////////////////////////////////////////////////////////////////// -static BOOL GetAltSpelling( INT16 &rnChgPos, INT16 &rnChgLen, OUString &rRplc, +static sal_Bool GetAltSpelling( sal_Int16 &rnChgPos, sal_Int16 &rnChgLen, OUString &rRplc, uno::Reference< XHyphenatedWord > &rxHyphWord ) { - BOOL bRes = rxHyphWord->isAlternativeSpelling(); + sal_Bool bRes = rxHyphWord->isAlternativeSpelling(); if (bRes) { OUString aWord( rxHyphWord->getWord() ), aHyphenatedWord( rxHyphWord->getHyphenatedWord() ); - INT16 nHyphenationPos = rxHyphWord->getHyphenationPos(); - /*INT16 nHyphenPos = rxHyphWord->getHyphenPos()*/; + sal_Int16 nHyphenationPos = rxHyphWord->getHyphenationPos(); + /*sal_Int16 nHyphenPos = rxHyphWord->getHyphenPos()*/; const sal_Unicode *pWord = aWord.getStr(), *pAltWord = aHyphenatedWord.getStr(); @@ -577,7 +577,7 @@ static BOOL GetAltSpelling( INT16 &rnChgPos, INT16 &rnChgLen, OUString &rRplc, // find first different char from left sal_Int32 nPosL = 0, nAltPosL = 0; - for (INT16 i = 0 ; pWord[ nPosL ] == pAltWord[ nAltPosL ]; nPosL++, nAltPosL++, i++) + for (sal_Int16 i = 0 ; pWord[ nPosL ] == pAltWord[ nAltPosL ]; nPosL++, nAltPosL++, i++) { // restrict changes area beginning to the right to // the char immediately following the hyphen. @@ -595,8 +595,8 @@ static BOOL GetAltSpelling( INT16 &rnChgPos, INT16 &rnChgLen, OUString &rRplc, nPosR--, nAltPosR--) ; - rnChgPos = sal::static_int_cast< INT16 >(nPosL); - rnChgLen = sal::static_int_cast< INT16 >(nPosR - nPosL + 1); + rnChgPos = sal::static_int_cast< sal_Int16 >(nPosL); + rnChgLen = sal::static_int_cast< sal_Int16 >(nPosR - nPosL + 1); DBG_ASSERT( rnChgLen >= 0, "nChgLen < 0"); sal_Int32 nTxtStart = nPosL; @@ -607,32 +607,32 @@ static BOOL GetAltSpelling( INT16 &rnChgPos, INT16 &rnChgLen, OUString &rRplc, } -static INT16 GetOrigWordPos( const OUString &rOrigWord, INT16 nPos ) +static sal_Int16 GetOrigWordPos( const OUString &rOrigWord, sal_Int16 nPos ) { - INT32 nLen = rOrigWord.getLength(); - INT32 i = -1; + sal_Int32 nLen = rOrigWord.getLength(); + sal_Int32 i = -1; while (nPos >= 0 && i++ < nLen) { sal_Unicode cChar = rOrigWord[i]; - BOOL bSkip = IsHyphen( cChar ) || IsControlChar( cChar ); + sal_Bool bSkip = IsHyphen( cChar ) || IsControlChar( cChar ); if (!bSkip) --nPos; } - return sal::static_int_cast< INT16 >((0 <= i && i < nLen) ? i : -1); + return sal::static_int_cast< sal_Int16 >((0 <= i && i < nLen) ? i : -1); } -INT32 GetPosInWordToCheck( const OUString &rTxt, INT32 nPos ) +sal_Int32 GetPosInWordToCheck( const OUString &rTxt, sal_Int32 nPos ) { - INT32 nRes = -1; - INT32 nLen = rTxt.getLength(); + sal_Int32 nRes = -1; + sal_Int32 nLen = rTxt.getLength(); if (0 <= nPos && nPos < nLen) { nRes = 0; - for (INT32 i = 0; i < nPos; ++i) + for (sal_Int32 i = 0; i < nPos; ++i) { sal_Unicode cChar = rTxt[i]; - BOOL bSkip = IsHyphen( cChar ) || IsControlChar( cChar ); + sal_Bool bSkip = IsHyphen( cChar ) || IsControlChar( cChar ); if (!bSkip) ++nRes; } @@ -648,17 +648,17 @@ uno::Reference< XHyphenatedWord > RebuildHyphensAndControlChars( uno::Reference< XHyphenatedWord > xRes; if (rOrigWord.getLength() && rxHyphWord.is()) { - INT16 nChgPos = 0, + sal_Int16 nChgPos = 0, nChgLen = 0; OUString aRplc; - BOOL bAltSpelling = GetAltSpelling( nChgPos, nChgLen, aRplc, rxHyphWord ); + sal_Bool bAltSpelling = GetAltSpelling( nChgPos, nChgLen, aRplc, rxHyphWord ); #if OSL_DEBUG_LEVEL > 1 OUString aWord( rxHyphWord->getWord() ); #endif OUString aOrigHyphenatedWord; - INT16 nOrigHyphenPos = -1; - INT16 nOrigHyphenationPos = -1; + sal_Int16 nOrigHyphenPos = -1; + sal_Int16 nOrigHyphenationPos = -1; if (!bAltSpelling) { aOrigHyphenatedWord = rOrigWord; @@ -671,10 +671,10 @@ uno::Reference< XHyphenatedWord > RebuildHyphensAndControlChars( //! B�-c-k-er and Sc-hif-fah-rt OUString aLeft, aRight; - INT16 nPos = GetOrigWordPos( rOrigWord, nChgPos ); + sal_Int16 nPos = GetOrigWordPos( rOrigWord, nChgPos ); // get words like Sc-hif-fah-rt to work correct - INT16 nHyphenationPos = rxHyphWord->getHyphenationPos(); + sal_Int16 nHyphenationPos = rxHyphWord->getHyphenationPos(); if (nChgPos > nHyphenationPos) --nPos; @@ -685,7 +685,7 @@ uno::Reference< XHyphenatedWord > RebuildHyphensAndControlChars( aOrigHyphenatedWord += aRplc; aOrigHyphenatedWord += aRight; - nOrigHyphenPos = sal::static_int_cast< INT16 >(aLeft.getLength() + + nOrigHyphenPos = sal::static_int_cast< sal_Int16 >(aLeft.getLength() + rxHyphWord->getHyphenPos() - nChgPos); nOrigHyphenationPos = GetOrigWordPos( rOrigWord, nHyphenationPos ); } @@ -696,7 +696,7 @@ uno::Reference< XHyphenatedWord > RebuildHyphensAndControlChars( } else { - INT16 nLang = LocaleToLanguage( rxHyphWord->getLocale() ); + sal_Int16 nLang = LocaleToLanguage( rxHyphWord->getLocale() ); xRes = new HyphenatedWord( rOrigWord, nLang, nOrigHyphenationPos, aOrigHyphenatedWord, nOrigHyphenPos ); @@ -724,7 +724,7 @@ osl::Mutex & lcl_GetCharClassMutex() } -BOOL IsUpper( const String &rText, xub_StrLen nPos, xub_StrLen nLen, INT16 nLanguage ) +sal_Bool IsUpper( const String &rText, xub_StrLen nPos, xub_StrLen nLen, sal_Int16 nLanguage ) { MutexGuard aGuard( lcl_GetCharClassMutex() ); @@ -736,7 +736,7 @@ BOOL IsUpper( const String &rText, xub_StrLen nPos, xub_StrLen nLen, INT16 nLang } -BOOL IsLower( const String &rText, xub_StrLen nPos, xub_StrLen nLen, INT16 nLanguage ) +sal_Bool IsLower( const String &rText, xub_StrLen nPos, xub_StrLen nLen, sal_Int16 nLanguage ) { MutexGuard aGuard( lcl_GetCharClassMutex() ); @@ -748,7 +748,7 @@ BOOL IsLower( const String &rText, xub_StrLen nPos, xub_StrLen nLen, INT16 nLang } -String ToLower( const String &rText, INT16 nLanguage ) +String ToLower( const String &rText, sal_Int16 nLanguage ) { MutexGuard aGuard( lcl_GetCharClassMutex() ); @@ -758,7 +758,7 @@ String ToLower( const String &rText, INT16 nLanguage ) } -String ToUpper( const String &rText, INT16 nLanguage ) +String ToUpper( const String &rText, sal_Int16 nLanguage ) { MutexGuard aGuard( lcl_GetCharClassMutex() ); @@ -768,7 +768,7 @@ String ToUpper( const String &rText, INT16 nLanguage ) } -String ToTitle( const String &rText, INT16 nLanguage ) +String ToTitle( const String &rText, sal_Int16 nLanguage ) { MutexGuard aGuard( lcl_GetCharClassMutex() ); @@ -778,7 +778,7 @@ String ToTitle( const String &rText, INT16 nLanguage ) } -sal_Unicode ToLower( const sal_Unicode cChar, INT16 nLanguage ) +sal_Unicode ToLower( const sal_Unicode cChar, sal_Int16 nLanguage ) { MutexGuard aGuard( lcl_GetCharClassMutex() ); @@ -788,7 +788,7 @@ sal_Unicode ToLower( const sal_Unicode cChar, INT16 nLanguage ) } -sal_Unicode ToUpper( const sal_Unicode cChar, INT16 nLanguage ) +sal_Unicode ToUpper( const sal_Unicode cChar, sal_Int16 nLanguage ) { MutexGuard aGuard( lcl_GetCharClassMutex() ); @@ -836,7 +836,7 @@ static const sal_uInt32 the_aDigitZeroes [] = 0x0001D7CE //1D7FF ; Decimal # Nd [50] MATHEMATICAL BOLD DIGIT ZERO..MATHEMATICAL MONOSPACE DIGIT NINE }; -BOOL HasDigits( const OUString &rText ) +sal_Bool HasDigits( const OUString &rText ) { static const int nNumDigitZeroes = SAL_N_ELEMENTS(the_aDigitZeroes); const sal_Int32 nLen = rText.getLength(); @@ -851,27 +851,27 @@ BOOL HasDigits( const OUString &rText ) if (nDigitZero > nCodePoint) break; if (/*nDigitZero <= nCodePoint &&*/ nCodePoint <= nDigitZero + 9) - return TRUE; + return sal_True; } } - return FALSE; + return sal_False; } -BOOL IsNumeric( const String &rText ) +sal_Bool IsNumeric( const String &rText ) { - BOOL bRes = FALSE; + sal_Bool bRes = sal_False; xub_StrLen nLen = rText.Len(); if (nLen) { - bRes = TRUE; + bRes = sal_True; xub_StrLen i = 0; while (i < nLen) { sal_Unicode cChar = rText.GetChar( i++ ); if ( !((sal_Unicode)'0' <= cChar && cChar <= (sal_Unicode)'9') ) { - bRes = FALSE; + bRes = sal_False; break; } } diff --git a/linguistic/source/misc2.cxx b/linguistic/source/misc2.cxx index d6b83a9ceca2..b8c0e1727b09 100644..100755 --- a/linguistic/source/misc2.cxx +++ b/linguistic/source/misc2.cxx @@ -45,7 +45,7 @@ #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/uno/Reference.h> -#include "misc.hxx" +#include "linguistic/misc.hxx" using namespace com::sun::star; @@ -54,9 +54,9 @@ namespace linguistic /////////////////////////////////////////////////////////////////////////// -BOOL FileExists( const String &rMainURL ) +sal_Bool FileExists( const String &rMainURL ) { - BOOL bExists = FALSE; + sal_Bool bExists = sal_False; if (rMainURL.Len()) { try @@ -187,7 +187,10 @@ String GetWritableDictionaryURL( const String &rDicName ) aURLObj.Append( rDicName, INetURLObject::ENCODE_ALL ); DBG_ASSERT(!aURLObj.HasError(), "lng : invalid URL"); - return aURLObj.GetMainURL( INetURLObject::DECODE_TO_IURI ); + // NO_DECODE preserves the escape sequences that might be included in aDirName + // depending on the characters used in the path string. (Needed when comparing + // the dictionary URL with GetDictionaryWriteablePath in DicList::createDictionary.) + return aURLObj.GetMainURL( INetURLObject::NO_DECODE ); } @@ -203,11 +206,11 @@ String SearchFileInPaths( const sal_Int32 nPaths = rPaths.getLength(); for (sal_Int32 k = 0; k < nPaths; ++k) { - BOOL bIsURL = TRUE; + sal_Bool bIsURL = sal_True; INetURLObject aObj( rPaths[k] ); if ( aObj.HasError() ) { - bIsURL = FALSE; + bIsURL = sal_False; String aURL; if ( utl::LocalFileHelper::ConvertPhysicalNameToURL( rPaths[k], aURL ) ) aObj.SetURL( aURL ); diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx index 8e13434d0d2f..3ab2eeb3a0bd 100644..100755 --- a/linguistic/source/spelldsp.cxx +++ b/linguistic/source/spelldsp.cxx @@ -44,9 +44,9 @@ #include <vector> #include "spelldsp.hxx" -#include "spelldta.hxx" +#include "linguistic/spelldta.hxx" #include "lngsvcmgr.hxx" -#include "lngprops.hxx" +#include "linguistic/lngprops.hxx" using namespace utl; @@ -73,7 +73,7 @@ class ProposalList { std::vector< OUString > aVec; - BOOL HasEntry( const OUString &rText ) const; + sal_Bool HasEntry( const OUString &rText ) const; // make copy c-tor and assignment operator private ProposalList( const ProposalList & ); @@ -93,14 +93,14 @@ public: }; -BOOL ProposalList::HasEntry( const OUString &rText ) const +sal_Bool ProposalList::HasEntry( const OUString &rText ) const { - BOOL bFound = FALSE; + sal_Bool bFound = sal_False; size_t nCnt = aVec.size(); for (size_t i = 0; !bFound && i < nCnt; ++i) { if (aVec[i] == rText) - bFound = TRUE; + bFound = sal_True; } return bFound; } @@ -130,9 +130,9 @@ void ProposalList::Append( const std::vector< OUString > &rNew ) void ProposalList::Append( const Sequence< OUString > &rNew ) { - INT32 nLen = rNew.getLength(); + sal_Int32 nLen = rNew.getLength(); const OUString *pNew = rNew.getConstArray(); - for (INT32 i = 0; i < nLen; ++i) + for (sal_Int32 i = 0; i < nLen; ++i) { const OUString &rText = pNew[i]; if (!HasEntry( rText )) @@ -156,12 +156,12 @@ size_t ProposalList::Count() const Sequence< OUString > ProposalList::GetSequence() const { - INT32 nCount = Count(); - INT32 nIdx = 0; + sal_Int32 nCount = Count(); + sal_Int32 nIdx = 0; Sequence< OUString > aRes( nCount ); OUString *pRes = aRes.getArray(); - INT32 nLen = aVec.size(); - for (INT32 i = 0; i < nLen; ++i) + sal_Int32 nLen = aVec.size(); + for (sal_Int32 i = 0; i < nLen; ++i) { const OUString &rText = aVec[i]; DBG_ASSERT( nIdx < nCount, "index our of range" ); @@ -188,16 +188,16 @@ void ProposalList::Remove( const OUString &rText ) /////////////////////////////////////////////////////////////////////////// -BOOL SvcListHasLanguage( +sal_Bool SvcListHasLanguage( const LangSvcEntries_Spell &rEntry, LanguageType nLanguage ) { - BOOL bHasLanguage = FALSE; + sal_Bool bHasLanguage = sal_False; Locale aTmpLocale; const Reference< XSpellChecker > *pRef = rEntry.aSvcRefs .getConstArray(); sal_Int32 nLen = rEntry.aSvcRefs.getLength(); - for (INT32 k = 0; k < nLen && !bHasLanguage; ++k) + for (sal_Int32 k = 0; k < nLen && !bHasLanguage; ++k) { if (pRef[k].is()) { @@ -266,7 +266,7 @@ sal_Bool SAL_CALL throw(IllegalArgumentException, RuntimeException) { MutexGuard aGuard( GetLinguMutex() ); - return isValid_Impl( rWord, LocaleToLanguage( rLocale ), rProperties, TRUE ); + return isValid_Impl( rWord, LocaleToLanguage( rLocale ), rProperties, sal_True ); } @@ -276,7 +276,7 @@ Reference< XSpellAlternatives > SAL_CALL throw(IllegalArgumentException, RuntimeException) { MutexGuard aGuard( GetLinguMutex() ); - return spell_Impl( rWord, LocaleToLanguage( rLocale ), rProperties, TRUE ); + return spell_Impl( rWord, LocaleToLanguage( rLocale ), rProperties, sal_True ); } @@ -298,13 +298,13 @@ static Reference< XDictionaryEntry > lcl_GetRulingDictionaryEntry( { Reference< XDictionaryList > xDList( GetDictionaryList() ); Reference< XDictionaryEntry > xNegEntry( SearchDicList( xDList, - rWord, nLanguage, FALSE, TRUE ) ); + rWord, nLanguage, sal_False, sal_True ) ); if (xNegEntry.is()) xRes = xNegEntry; else { Reference< XDictionaryEntry > xPosEntry( SearchDicList( xDList, - rWord, nLanguage, TRUE, TRUE ) ); + rWord, nLanguage, sal_True, sal_True ) ); if (xPosEntry.is()) xRes = xPosEntry; } @@ -314,16 +314,16 @@ static Reference< XDictionaryEntry > lcl_GetRulingDictionaryEntry( } -BOOL SpellCheckerDispatcher::isValid_Impl( +sal_Bool SpellCheckerDispatcher::isValid_Impl( const OUString& rWord, LanguageType nLanguage, const PropertyValues& rProperties, - BOOL bCheckDics) + sal_Bool bCheckDics) throw( RuntimeException, IllegalArgumentException ) { MutexGuard aGuard( GetLinguMutex() ); - BOOL bRes = TRUE; + sal_Bool bRes = sal_True; if (nLanguage == LANGUAGE_NONE || !rWord.getLength()) return bRes; @@ -353,24 +353,24 @@ BOOL SpellCheckerDispatcher::isValid_Impl( if (IsIgnoreControlChars( rProperties, GetPropSet() )) RemoveControlChars( aChkWord ); - INT32 nLen = pEntry->aSvcRefs.getLength(); + sal_Int32 nLen = pEntry->aSvcRefs.getLength(); DBG_ASSERT( nLen == pEntry->aSvcImplNames.getLength(), "lng : sequence length mismatch"); DBG_ASSERT( pEntry->nLastTriedSvcIndex < nLen, "lng : index out of range"); - INT32 i = 0; - BOOL bTmpRes = TRUE; - BOOL bTmpResValid = FALSE; + sal_Int32 i = 0; + sal_Bool bTmpRes = sal_True; + sal_Bool bTmpResValid = sal_False; // try already instantiated services first { const Reference< XSpellChecker > *pRef = pEntry->aSvcRefs.getConstArray(); while (i <= pEntry->nLastTriedSvcIndex - && (!bTmpResValid || FALSE == bTmpRes)) + && (!bTmpResValid || sal_False == bTmpRes)) { - bTmpResValid = TRUE; + bTmpResValid = sal_True; if (pRef[i].is() && pRef[i]->hasLocale( aLocale )) { bTmpRes = GetCache().CheckWord( aChkWord, nLanguage ); @@ -386,7 +386,7 @@ BOOL SpellCheckerDispatcher::isValid_Impl( } } else - bTmpResValid = FALSE; + bTmpResValid = sal_False; if (bTmpResValid) bRes = bTmpRes; @@ -396,7 +396,7 @@ BOOL SpellCheckerDispatcher::isValid_Impl( } // if still no result instantiate new services and try those - if ((!bTmpResValid || FALSE == bTmpRes) + if ((!bTmpResValid || sal_False == bTmpRes) && pEntry->nLastTriedSvcIndex < nLen - 1) { const OUString *pImplNames = pEntry->aSvcImplNames.getConstArray(); @@ -412,7 +412,7 @@ BOOL SpellCheckerDispatcher::isValid_Impl( //! thus the service needs not to now about it //aArgs.getArray()[1] <<= GetDicList(); - while (i < nLen && (!bTmpResValid || FALSE == bTmpRes)) + while (i < nLen && (!bTmpResValid || sal_False == bTmpRes)) { // create specific service via it's implementation name Reference< XSpellChecker > xSpell; @@ -433,7 +433,7 @@ BOOL SpellCheckerDispatcher::isValid_Impl( if (xBroadcaster.is()) rMgr.AddLngSvcEvtBroadcaster( xBroadcaster ); - bTmpResValid = TRUE; + bTmpResValid = sal_True; if (xSpell.is() && xSpell->hasLocale( aLocale )) { bTmpRes = GetCache().CheckWord( aChkWord, nLanguage ); @@ -449,12 +449,12 @@ BOOL SpellCheckerDispatcher::isValid_Impl( } } else - bTmpResValid = FALSE; + bTmpResValid = sal_False; if (bTmpResValid) bRes = bTmpRes; - pEntry->nLastTriedSvcIndex = (INT16) i; + pEntry->nLastTriedSvcIndex = (sal_Int16) i; ++i; } @@ -486,7 +486,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl( const OUString& rWord, LanguageType nLanguage, const PropertyValues& rProperties, - BOOL bCheckDics ) + sal_Bool bCheckDics ) throw(IllegalArgumentException, RuntimeException) { MutexGuard aGuard( GetLinguMutex() ); @@ -521,15 +521,15 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl( if (IsIgnoreControlChars( rProperties, GetPropSet() )) RemoveControlChars( aChkWord ); - INT32 nLen = pEntry->aSvcRefs.getLength(); + sal_Int32 nLen = pEntry->aSvcRefs.getLength(); DBG_ASSERT( nLen == pEntry->aSvcImplNames.getLength(), "lng : sequence length mismatch"); DBG_ASSERT( pEntry->nLastTriedSvcIndex < nLen, "lng : index out of range"); - INT32 i = 0; + sal_Int32 i = 0; Reference< XSpellAlternatives > xTmpRes; - BOOL bTmpResValid = FALSE; + sal_Bool bTmpResValid = sal_False; // try already instantiated services first { @@ -538,10 +538,10 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl( while (i <= pEntry->nLastTriedSvcIndex && (!bTmpResValid || xTmpRes.is()) ) { - bTmpResValid = TRUE; + bTmpResValid = sal_True; if (pRef[i].is() && pRef[i]->hasLocale( aLocale )) { - BOOL bOK = GetCache().CheckWord( aChkWord, nLanguage ); + sal_Bool bOK = GetCache().CheckWord( aChkWord, nLanguage ); if (bOK) xTmpRes = NULL; else @@ -556,7 +556,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl( } } else - bTmpResValid = FALSE; + bTmpResValid = sal_False; // return first found result if the word is not known by any checker. // But if that result has no suggestions use the first one that does @@ -620,10 +620,10 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl( if (xBroadcaster.is()) rMgr.AddLngSvcEvtBroadcaster( xBroadcaster ); - bTmpResValid = TRUE; + bTmpResValid = sal_True; if (xSpell.is() && xSpell->hasLocale( aLocale )) { - BOOL bOK = GetCache().CheckWord( aChkWord, nLanguage ); + sal_Bool bOK = GetCache().CheckWord( aChkWord, nLanguage ); if (bOK) xTmpRes = NULL; else @@ -638,7 +638,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl( } } else - bTmpResValid = FALSE; + bTmpResValid = sal_False; // return first found result if the word is not known by any checker. // But if that result has no suggestions use the first one that does @@ -659,7 +659,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl( nNumSugestions = nTmpNumSugestions; } - pEntry->nLastTriedSvcIndex = (INT16) i; + pEntry->nLastTriedSvcIndex = (sal_Int16) i; ++i; } @@ -682,7 +682,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl( // neagtive dictionaries) ProposalList aProposalList; // Sequence< OUString > aProposals; - INT16 eFailureType = -1; // no failure + sal_Int16 eFailureType = -1; // no failure if (xRes.is()) { aProposalList.Append( xRes->getAlternatives() ); @@ -708,7 +708,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl( // replacement text must not be in negative dictionary itself if (aAddRplcTxt.getLength() && - !SearchDicList( xDList, aAddRplcTxt, nLanguage, FALSE, TRUE ).is()) + !SearchDicList( xDList, aAddRplcTxt, nLanguage, sal_False, sal_True ).is()) { aProposalList.Prepend( aAddRplcTxt ); } @@ -766,7 +766,7 @@ throw (uno::RuntimeException) { MutexGuard aGuard( GetLinguMutex() ); uno::Sequence< Locale > aTmp( getLocales() ); - uno::Sequence< INT16 > aRes( LocaleSeqToLangSeq( aTmp ) ); + uno::Sequence< sal_Int16 > aRes( LocaleSeqToLangSeq( aTmp ) ); return aRes; } @@ -813,9 +813,9 @@ void SpellCheckerDispatcher::SetServiceList( const Locale &rLocale, if (pCache) pCache->Flush(); // new services may spell differently... - INT16 nLanguage = LocaleToLanguage( rLocale ); + sal_Int16 nLanguage = LocaleToLanguage( rLocale ); - INT32 nLen = rSvcImplNames.getLength(); + sal_Int32 nLen = rSvcImplNames.getLength(); if (0 == nLen) // remove entry aSvcMap.erase( nLanguage ); @@ -847,7 +847,7 @@ Sequence< OUString > Sequence< OUString > aRes; // search for entry with that language and use data from that - INT16 nLanguage = LocaleToLanguage( rLocale ); + sal_Int16 nLanguage = LocaleToLanguage( rLocale ); SpellCheckerDispatcher *pThis = (SpellCheckerDispatcher *) this; const SpellSvcByLangMap_t::iterator aIt( pThis->aSvcMap.find( nLanguage ) ); const LangSvcEntries_Spell *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; diff --git a/linguistic/source/spelldsp.hxx b/linguistic/source/spelldsp.hxx index 25643d0f9567..5b50b5d621d7 100644..100755 --- a/linguistic/source/spelldsp.hxx +++ b/linguistic/source/spelldsp.hxx @@ -30,7 +30,7 @@ #define _LINGUISTIC_SPELLDSP_HXX_ #include "lngopt.hxx" -#include "misc.hxx" +#include "linguistic/misc.hxx" #include "iprcache.hxx" #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type @@ -91,16 +91,16 @@ class SpellCheckerDispatcher : void ClearSvcList(); - BOOL isValid_Impl(const ::rtl::OUString& aWord, LanguageType nLanguage, + sal_Bool isValid_Impl(const ::rtl::OUString& aWord, LanguageType nLanguage, const ::com::sun::star::beans::PropertyValues& aProperties, - BOOL bCheckDics) + sal_Bool bCheckDics) throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException ); ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellAlternatives > spell_Impl(const ::rtl::OUString& aWord, LanguageType nLanguage, const ::com::sun::star::beans::PropertyValues& aProperties, - BOOL bCheckDics) + sal_Bool bCheckDics) throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException ); public: diff --git a/linguistic/source/spelldta.cxx b/linguistic/source/spelldta.cxx index c89426b8d3d3..fce7a4fea03f 100644..100755 --- a/linguistic/source/spelldta.cxx +++ b/linguistic/source/spelldta.cxx @@ -38,7 +38,7 @@ #include <vector> -#include "spelldta.hxx" +#include "linguistic/spelldta.hxx" #include "lngsvcmgr.hxx" @@ -72,23 +72,23 @@ Reference< XSpellAlternatives > MergeProposals( xMerged = rxAlt1; else { - INT32 nAltCount1 = rxAlt1->getAlternativesCount(); + sal_Int32 nAltCount1 = rxAlt1->getAlternativesCount(); Sequence< OUString > aAlt1( rxAlt1->getAlternatives() ); const OUString *pAlt1 = aAlt1.getConstArray(); - INT32 nAltCount2 = rxAlt2->getAlternativesCount(); + sal_Int32 nAltCount2 = rxAlt2->getAlternativesCount(); Sequence< OUString > aAlt2( rxAlt2->getAlternatives() ); const OUString *pAlt2 = aAlt2.getConstArray(); - INT32 nCountNew = Min( nAltCount1 + nAltCount2, (INT32) MAX_PROPOSALS ); + sal_Int32 nCountNew = Min( nAltCount1 + nAltCount2, (sal_Int32) MAX_PROPOSALS ); Sequence< OUString > aAltNew( nCountNew ); OUString *pAltNew = aAltNew.getArray(); - INT32 nIndex = 0; - INT32 i = 0; + sal_Int32 nIndex = 0; + sal_Int32 i = 0; for (int j = 0; j < 2; j++) { - INT32 nCount = j == 0 ? nAltCount1 : nAltCount2; + sal_Int32 nCount = j == 0 ? nAltCount1 : nAltCount2; const OUString *pAlt = j == 0 ? pAlt1 : pAlt2; for (i = 0; i < nCount && nIndex < MAX_PROPOSALS; i++) { @@ -110,23 +110,23 @@ Reference< XSpellAlternatives > MergeProposals( } -BOOL SeqHasEntry( +sal_Bool SeqHasEntry( const Sequence< OUString > &rSeq, const OUString &rTxt) { - BOOL bRes = FALSE; - INT32 nLen = rSeq.getLength(); + sal_Bool bRes = sal_False; + sal_Int32 nLen = rSeq.getLength(); const OUString *pEntry = rSeq.getConstArray(); - for (INT32 i = 0; i < nLen && !bRes; ++i) + for (sal_Int32 i = 0; i < nLen && !bRes; ++i) { if (rTxt == pEntry[i]) - bRes = TRUE; + bRes = sal_True; } return bRes; } -void SearchSimilarText( const OUString &rText, INT16 nLanguage, +void SearchSimilarText( const OUString &rText, sal_Int16 nLanguage, Reference< XDictionaryList > &xDicList, std::vector< OUString > & rDicListProps ) { @@ -137,13 +137,13 @@ void SearchSimilarText( const OUString &rText, INT16 nLanguage, aDics( xDicList->getDictionaries() ); const Reference< XDictionary > *pDic = aDics.getConstArray(); - INT32 nDics = xDicList->getCount(); + sal_Int32 nDics = xDicList->getCount(); - for (INT32 i = 0; i < nDics; i++) + for (sal_Int32 i = 0; i < nDics; i++) { Reference< XDictionary > xDic( pDic[i], UNO_QUERY ); - INT16 nLang = LocaleToLanguage( xDic->getLocale() ); + sal_Int16 nLang = LocaleToLanguage( xDic->getLocale() ); if ( xDic.is() && xDic->isActive() && (nLang == nLanguage || nLang == LANGUAGE_NONE) ) @@ -155,8 +155,8 @@ void SearchSimilarText( const OUString &rText, INT16 nLanguage, #endif const Sequence< Reference< XDictionaryEntry > > aEntries = xDic->getEntries(); const Reference< XDictionaryEntry > *pEntries = aEntries.getConstArray(); - INT32 nLen = aEntries.getLength(); - for (INT32 k = 0; k < nLen; ++k) + sal_Int32 nLen = aEntries.getLength(); + for (sal_Int32 k = 0; k < nLen; ++k) { String aEntryTxt; if (pEntries[k].is()) @@ -175,27 +175,27 @@ void SearchSimilarText( const OUString &rText, INT16 nLanguage, void SeqRemoveNegEntries( Sequence< OUString > &rSeq, Reference< XDictionaryList > &rxDicList, - INT16 nLanguage ) + sal_Int16 nLanguage ) { static const OUString aEmpty; - BOOL bSthRemoved = FALSE; - INT32 nLen = rSeq.getLength(); + sal_Bool bSthRemoved = sal_False; + sal_Int32 nLen = rSeq.getLength(); OUString *pEntries = rSeq.getArray(); - for (INT32 i = 0; i < nLen; ++i) + for (sal_Int32 i = 0; i < nLen; ++i) { Reference< XDictionaryEntry > xNegEntry( SearchDicList( rxDicList, - pEntries[i], nLanguage, FALSE, TRUE ) ); + pEntries[i], nLanguage, sal_False, sal_True ) ); if (xNegEntry.is()) { pEntries[i] = aEmpty; - bSthRemoved = TRUE; + bSthRemoved = sal_True; } } if (bSthRemoved) { Sequence< OUString > aNew; // merge sequence without duplicates and empty strings in new empty sequence - aNew = MergeProposalSeqs( aNew, rSeq, FALSE ); + aNew = MergeProposalSeqs( aNew, rSeq, sal_False ); rSeq = aNew; } } @@ -204,7 +204,7 @@ void SeqRemoveNegEntries( Sequence< OUString > &rSeq, Sequence< OUString > MergeProposalSeqs( Sequence< OUString > &rAlt1, Sequence< OUString > &rAlt2, - BOOL bAllowDuplicates ) + sal_Bool bAllowDuplicates ) { Sequence< OUString > aMerged; @@ -214,20 +214,20 @@ Sequence< OUString > MergeProposalSeqs( aMerged = rAlt1; else { - INT32 nAltCount1 = rAlt1.getLength(); + sal_Int32 nAltCount1 = rAlt1.getLength(); const OUString *pAlt1 = rAlt1.getConstArray(); - INT32 nAltCount2 = rAlt2.getLength(); + sal_Int32 nAltCount2 = rAlt2.getLength(); const OUString *pAlt2 = rAlt2.getConstArray(); - INT32 nCountNew = Min( nAltCount1 + nAltCount2, (INT32) MAX_PROPOSALS ); + sal_Int32 nCountNew = Min( nAltCount1 + nAltCount2, (sal_Int32) MAX_PROPOSALS ); aMerged.realloc( nCountNew ); OUString *pMerged = aMerged.getArray(); - INT32 nIndex = 0; - INT32 i = 0; + sal_Int32 nIndex = 0; + sal_Int32 i = 0; for (int j = 0; j < 2; j++) { - INT32 nCount = j == 0 ? nAltCount1 : nAltCount2; + sal_Int32 nCount = j == 0 ? nAltCount1 : nAltCount2; const OUString *pAlt = j == 0 ? pAlt1 : pAlt2; for (i = 0; i < nCount && nIndex < MAX_PROPOSALS; i++) { @@ -254,8 +254,8 @@ SpellAlternatives::SpellAlternatives() SpellAlternatives::SpellAlternatives( - const OUString &rWord, INT16 nLang, - INT16 nFailureType, const OUString &rRplcWord ) : + const OUString &rWord, sal_Int16 nLang, + sal_Int16 nFailureType, const OUString &rRplcWord ) : aAlt ( Sequence< OUString >(1) ), aWord (rWord), nType (nFailureType), @@ -269,7 +269,7 @@ SpellAlternatives::SpellAlternatives( SpellAlternatives::SpellAlternatives( - const OUString &rWord, INT16 nLang, INT16 nFailureType, + const OUString &rWord, sal_Int16 nLang, sal_Int16 nFailureType, const Sequence< OUString > &rAlternatives ) : aAlt (rAlternatives), aWord (rWord), @@ -312,7 +312,7 @@ sal_Int16 SAL_CALL SpellAlternatives::getAlternativesCount() throw(RuntimeException) { MutexGuard aGuard( GetLinguMutex() ); - return (INT16) aAlt.getLength(); + return (sal_Int16) aAlt.getLength(); } @@ -340,7 +340,7 @@ throw (uno::RuntimeException) } -void SpellAlternatives::SetWordLanguage(const OUString &rWord, INT16 nLang) +void SpellAlternatives::SetWordLanguage(const OUString &rWord, sal_Int16 nLang) { MutexGuard aGuard( GetLinguMutex() ); aWord = rWord; @@ -348,7 +348,7 @@ void SpellAlternatives::SetWordLanguage(const OUString &rWord, INT16 nLang) } -void SpellAlternatives::SetFailureType(INT16 nTypeP) +void SpellAlternatives::SetFailureType(sal_Int16 nTypeP) { MutexGuard aGuard( GetLinguMutex() ); nType = nTypeP; diff --git a/linguistic/source/thesdsp.cxx b/linguistic/source/thesdsp.cxx index 0ffc4cae15b2..9cd6f0854cc9 100644..100755 --- a/linguistic/source/thesdsp.cxx +++ b/linguistic/source/thesdsp.cxx @@ -39,7 +39,7 @@ #include <osl/mutex.hxx> #include "thesdsp.hxx" -#include "lngprops.hxx" +#include "linguistic/lngprops.hxx" using namespace utl; using namespace osl; @@ -54,15 +54,15 @@ using ::rtl::OUString; /////////////////////////////////////////////////////////////////////////// -static BOOL SvcListHasLanguage( +static sal_Bool SvcListHasLanguage( const Sequence< Reference< XThesaurus > > &rRefs, const Locale &rLocale ) { - BOOL bHasLanguage = FALSE; + sal_Bool bHasLanguage = sal_False; const Reference< XThesaurus > *pRef = rRefs.getConstArray(); - INT32 nLen = rRefs.getLength(); - for (INT32 k = 0; k < nLen && !bHasLanguage; ++k) + sal_Int32 nLen = rRefs.getLength(); + for (sal_Int32 k = 0; k < nLen && !bHasLanguage; ++k) { if (pRef[k].is()) bHasLanguage = pRef[k]->hasLocale( rLocale ); @@ -130,7 +130,7 @@ Sequence< Reference< XMeaning > > SAL_CALL Sequence< Reference< XMeaning > > aMeanings; - INT16 nLanguage = LocaleToLanguage( rLocale ); + sal_Int16 nLanguage = LocaleToLanguage( rLocale ); if (nLanguage == LANGUAGE_NONE || !rTerm.getLength()) return aMeanings; @@ -152,13 +152,13 @@ Sequence< Reference< XMeaning > > SAL_CALL if (IsIgnoreControlChars( rProperties, GetPropSet() )) RemoveControlChars( aChkWord ); - INT32 nLen = pEntry->aSvcRefs.getLength(); + sal_Int32 nLen = pEntry->aSvcRefs.getLength(); DBG_ASSERT( nLen == pEntry->aSvcImplNames.getLength(), "lng : sequence length mismatch"); DBG_ASSERT( pEntry->nLastTriedSvcIndex < nLen, "lng : index out of range"); - INT32 i = 0; + sal_Int32 i = 0; // try already instantiated services first { @@ -205,7 +205,7 @@ Sequence< Reference< XMeaning > > SAL_CALL if (xThes.is() && xThes->hasLocale( rLocale )) aMeanings = xThes->queryMeanings( aChkWord, rLocale, rProperties ); - pEntry->nLastTriedSvcIndex = (INT16) i; + pEntry->nLastTriedSvcIndex = (sal_Int16) i; ++i; } @@ -229,9 +229,9 @@ void ThesaurusDispatcher::SetServiceList( const Locale &rLocale, { MutexGuard aGuard( GetLinguMutex() ); - INT16 nLanguage = LocaleToLanguage( rLocale ); + sal_Int16 nLanguage = LocaleToLanguage( rLocale ); - INT32 nLen = rSvcImplNames.getLength(); + sal_Int32 nLen = rSvcImplNames.getLength(); if (0 == nLen) // remove entry aSvcMap.erase( nLanguage ); @@ -263,7 +263,7 @@ Sequence< OUString > Sequence< OUString > aRes; // search for entry with that language and use data from that - INT16 nLanguage = LocaleToLanguage( rLocale ); + sal_Int16 nLanguage = LocaleToLanguage( rLocale ); ThesaurusDispatcher *pThis = (ThesaurusDispatcher *) this; const ThesSvcByLangMap_t::iterator aIt( pThis->aSvcMap.find( nLanguage ) ); const LangSvcEntries_Thes *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL; diff --git a/linguistic/source/thesdsp.hxx b/linguistic/source/thesdsp.hxx index 48a8e0e65c60..48a8e0e65c60 100644..100755 --- a/linguistic/source/thesdsp.hxx +++ b/linguistic/source/thesdsp.hxx diff --git a/linguistic/source/thesdta.cxx b/linguistic/source/thesdta.cxx index a90afac17841..bed6421fb0a7 100644..100755 --- a/linguistic/source/thesdta.cxx +++ b/linguistic/source/thesdta.cxx @@ -31,7 +31,7 @@ #include <tools/debug.hxx> #include <osl/mutex.hxx> -#include <misc.hxx> +#include <linguistic/misc.hxx> #include "thesdta.hxx" @@ -52,7 +52,7 @@ namespace linguistic ThesaurusMeaning::ThesaurusMeaning(const OUString &rText, - const OUString &rLookUpText, INT16 nLookUpLang ) : + const OUString &rLookUpText, sal_Int16 nLookUpLang ) : aText (rText), aLookUpText (rLookUpText), nLookUpLanguage (nLookUpLang) diff --git a/linguistic/workben/exports.dxp b/linguistic/workben/exports.dxp index b0f85bf7bebf..b0f85bf7bebf 100644..100755 --- a/linguistic/workben/exports.dxp +++ b/linguistic/workben/exports.dxp diff --git a/linguistic/workben/makefile.mk b/linguistic/workben/makefile.mk index 6c04929d7b73..6c04929d7b73 100644..100755 --- a/linguistic/workben/makefile.mk +++ b/linguistic/workben/makefile.mk diff --git a/linguistic/workben/sprophelp.cxx b/linguistic/workben/sprophelp.cxx index 43ee38080b7a..f9b3441889d2 100644..100755 --- a/linguistic/workben/sprophelp.cxx +++ b/linguistic/workben/sprophelp.cxx @@ -30,10 +30,10 @@ #include "precompiled_linguistic.hxx" #include <sal/macros.h> -#include "misc.hxx" +#include "linguistic/misc.hxx" #include "sprophelp.hxx" -#include "lngprops.hxx" +#include "linguistic/lngprops.hxx" #include <tools/debug.hxx> #include <com/sun/star/linguistic2/LinguServiceEvent.hpp> diff --git a/linguistic/workben/sprophelp.hxx b/linguistic/workben/sprophelp.hxx index fc8798bff215..fc8798bff215 100644..100755 --- a/linguistic/workben/sprophelp.hxx +++ b/linguistic/workben/sprophelp.hxx diff --git a/linguistic/workben/sreg.cxx b/linguistic/workben/sreg.cxx index 1fb80047fa11..1fb80047fa11 100644..100755 --- a/linguistic/workben/sreg.cxx +++ b/linguistic/workben/sreg.cxx diff --git a/linguistic/workben/sspellimp.cxx b/linguistic/workben/sspellimp.cxx index f452cd0bfe5f..992e545b12a0 100644..100755 --- a/linguistic/workben/sspellimp.cxx +++ b/linguistic/workben/sspellimp.cxx @@ -40,8 +40,8 @@ #include <sspellimp.hxx> -#include "lngprops.hxx" -#include "spelldta.hxx" +#include "linguistic/lngprops.hxx" +#include "linguistic/spelldta.hxx" using namespace utl; using namespace osl; diff --git a/linguistic/workben/sspellimp.hxx b/linguistic/workben/sspellimp.hxx index ebded3b83905..d15a57d34c08 100644..100755 --- a/linguistic/workben/sspellimp.hxx +++ b/linguistic/workben/sspellimp.hxx @@ -43,7 +43,7 @@ #include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp> #include <tools/table.hxx> -#include "misc.hxx" +#include "linguistic/misc.hxx" #include "sprophelp.hxx" using namespace ::rtl; diff --git a/linguistic/xml/linguistic.xml b/linguistic/xml/linguistic.xml index 83aaaeb0c1e0..83aaaeb0c1e0 100644..100755 --- a/linguistic/xml/linguistic.xml +++ b/linguistic/xml/linguistic.xml |