PageRenderTime 31ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/libreoffice-3.6.0.2/lingucomponent/source/thesaurus/libnth/nthesimp.hxx

#
C++ Header | 170 lines | 91 code | 36 blank | 43 comment | 0 complexity | 8afc25715814ce7b60709517c765edbf MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, LGPL-2.1, AGPL-1.0, BSD-3-Clause-No-Nuclear-License-2014, GPL-3.0, LGPL-3.0
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /*************************************************************************
  3. *
  4. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  5. *
  6. * Copyright 2000, 2010 Oracle and/or its affiliates.
  7. *
  8. * OpenOffice.org - a multi-platform office productivity suite
  9. *
  10. * This file is part of OpenOffice.org.
  11. *
  12. * OpenOffice.org is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Lesser General Public License version 3
  14. * only, as published by the Free Software Foundation.
  15. *
  16. * OpenOffice.org is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Lesser General Public License version 3 for more details
  20. * (a copy is included in the LICENSE file that accompanied this code).
  21. *
  22. * You should have received a copy of the GNU Lesser General Public License
  23. * version 3 along with OpenOffice.org. If not, see
  24. * <http://www.openoffice.org/license.html>
  25. * for a copy of the LGPLv3 License.
  26. *
  27. ************************************************************************/
  28. #ifndef _LINGU2_THESIMP_HXX_
  29. #define _LINGU2_THESIMP_HXX_
  30. #include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
  31. #include <cppuhelper/implbase1.hxx> // helper for implementations
  32. #include <cppuhelper/implbase5.hxx> // helper for implementations
  33. #include <com/sun/star/uno/Reference.h>
  34. #include <com/sun/star/uno/Sequence.h>
  35. #include <com/sun/star/lang/XComponent.hpp>
  36. #include <com/sun/star/lang/XInitialization.hpp>
  37. #include <com/sun/star/lang/XServiceDisplayName.hpp>
  38. #include <com/sun/star/beans/XPropertySet.hpp>
  39. #include <com/sun/star/beans/PropertyValues.hpp>
  40. #include <com/sun/star/lang/XServiceInfo.hpp>
  41. #include <com/sun/star/linguistic2/XMeaning.hpp>
  42. #include <com/sun/star/linguistic2/XThesaurus.hpp>
  43. #include <com/sun/star/linguistic2/XLinguServiceManager.hpp>
  44. #include <com/sun/star/linguistic2/XSpellChecker1.hpp>
  45. #include <unotools/charclass.hxx>
  46. #include <lingutil.hxx>
  47. #include <linguistic/misc.hxx>
  48. #include <linguistic/lngprophelp.hxx>
  49. #include <osl/file.hxx>
  50. #include "mythes.hxx"
  51. using namespace ::rtl;
  52. using namespace ::com::sun::star::uno;
  53. using namespace ::com::sun::star::beans;
  54. using namespace ::com::sun::star::lang;
  55. using namespace ::com::sun::star::linguistic2;
  56. namespace com { namespace sun { namespace star { namespace beans {
  57. class XPropertySet;
  58. }}}}
  59. ///////////////////////////////////////////////////////////////////////////
  60. class Thesaurus :
  61. public cppu::WeakImplHelper5
  62. <
  63. XThesaurus,
  64. XInitialization,
  65. XComponent,
  66. XServiceInfo,
  67. XServiceDisplayName
  68. >
  69. {
  70. Sequence< Locale > aSuppLocales;
  71. ::cppu::OInterfaceContainerHelper aEvtListeners;
  72. linguistic::PropertyHelper_Thesaurus* pPropHelper;
  73. sal_Bool bDisposing;
  74. CharClass ** aCharSetInfo;
  75. MyThes ** aThes;
  76. rtl_TextEncoding * aTEncs;
  77. Locale * aTLocs;
  78. OUString * aTNames;
  79. sal_Int32 numthes;
  80. // cache for the Thesaurus dialog
  81. Sequence < Reference < ::com::sun::star::linguistic2::XMeaning > > prevMeanings;
  82. OUString prevTerm;
  83. sal_Int16 prevLocale;
  84. // disallow copy-constructor and assignment-operator for now
  85. Thesaurus(const Thesaurus &);
  86. Thesaurus & operator = (const Thesaurus &);
  87. linguistic::PropertyHelper_Thesaurus& GetPropHelper_Impl();
  88. linguistic::PropertyHelper_Thesaurus& GetPropHelper()
  89. {
  90. return pPropHelper ? *pPropHelper : GetPropHelper_Impl();
  91. }
  92. public:
  93. Thesaurus();
  94. virtual ~Thesaurus();
  95. // XSupportedLocales (for XThesaurus)
  96. virtual Sequence< Locale > SAL_CALL getLocales() throw(RuntimeException);
  97. virtual sal_Bool SAL_CALL hasLocale( const Locale& rLocale ) throw(RuntimeException);
  98. // XThesaurus
  99. virtual Sequence< Reference < ::com::sun::star::linguistic2::XMeaning > > SAL_CALL queryMeanings( const OUString& rTerm, const Locale& rLocale, const PropertyValues& rProperties ) throw(IllegalArgumentException, RuntimeException);
  100. // XServiceDisplayName
  101. virtual OUString SAL_CALL getServiceDisplayName( const Locale& rLocale ) throw(RuntimeException);
  102. // XInitialization
  103. virtual void SAL_CALL initialize( const Sequence< Any >& rArguments ) throw(Exception, RuntimeException);
  104. // XComponent
  105. virtual void SAL_CALL dispose() throw(RuntimeException);
  106. virtual void SAL_CALL addEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException);
  107. virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException);
  108. // XServiceInfo
  109. virtual OUString SAL_CALL getImplementationName() throw(RuntimeException);
  110. virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw(RuntimeException);
  111. virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(RuntimeException);
  112. static inline OUString
  113. getImplementationName_Static() throw();
  114. static Sequence< OUString >
  115. getSupportedServiceNames_Static() throw();
  116. private:
  117. sal_uInt16 SAL_CALL capitalType(const OUString&, CharClass *);
  118. OUString SAL_CALL makeLowerCase(const OUString&, CharClass *);
  119. OUString SAL_CALL makeUpperCase(const OUString&, CharClass *);
  120. OUString SAL_CALL makeInitCap(const OUString&, CharClass *);
  121. /* static ::com::sun::star::uno::Reference<
  122. ::com::sun::star::linguistic2::XLinguServiceManager > xLngSvcMgr;
  123. static ::com::sun::star::uno::Reference<
  124. ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
  125. */
  126. static ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLinguServiceManager > GetLngSvcMgr();
  127. };
  128. inline OUString Thesaurus::getImplementationName_Static() throw()
  129. {
  130. return A2OU( "org.openoffice.lingu.new.Thesaurus" );
  131. }
  132. ///////////////////////////////////////////////////////////////////////////
  133. #endif
  134. /* vim:set shiftwidth=4 softtabstop=4 expandtab: */