LibreOffice Module sw (master)  1
toxhlp.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
21 #include <com/sun/star/i18n/IndexEntrySupplier.hpp>
22 #include <toxwrap.hxx>
23 #include <sal/log.hxx>
24 #include <tools/diagnose_ex.h>
25 
26 using namespace ::com::sun::star;
27 
29 {
30  uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
31 
32  try {
33  xIES = i18n::IndexEntrySupplier::create(xContext);
34  }
35  catch (const uno::Exception&)
36  {
37  TOOLS_WARN_EXCEPTION( "sw.core", "IndexEntrySupplierWrapper" );
38  }
39 }
40 
42 {
43 }
44 
45 OUString IndexEntrySupplierWrapper::GetIndexKey( const OUString& rText,
46  const OUString& rTextReading,
47  const css::lang::Locale& rLocale ) const
48 {
49  OUString sRet;
50  try {
51  sRet = xIES->getIndexKey( rText, rTextReading, rLocale );
52  }
53  catch (const uno::Exception&)
54  {
55  TOOLS_WARN_EXCEPTION( "sw.core", "getIndexKey" );
56  }
57  return sRet;
58 }
59 
60 OUString IndexEntrySupplierWrapper::GetFollowingText( bool bMorePages ) const
61 {
62  OUString sRet;
63  try {
64  sRet = xIES->getIndexFollowPageWord( bMorePages, aLcl );
65  }
66  catch (const uno::Exception&)
67  {
68  TOOLS_WARN_EXCEPTION( "sw.core", "getIndexFollowPageWord" );
69  }
70  return sRet;
71 }
72 
73 css::uno::Sequence< OUString > IndexEntrySupplierWrapper::GetAlgorithmList( const css::lang::Locale& rLcl ) const
74 {
75  uno::Sequence< OUString > sRet;
76 
77  try {
78  sRet = xIES->getAlgorithmList( rLcl );
79  }
80  catch (const uno::Exception&)
81  {
82  TOOLS_WARN_EXCEPTION( "sw.core", "getAlgorithmList" );
83  }
84  return sRet;
85 }
86 
88  const css::lang::Locale& rLcl,
89  const OUString& sSortAlgorithm, long nOptions ) const
90 {
91  bool bRet = false;
92  try {
93  bRet = xIES->loadAlgorithm( rLcl, sSortAlgorithm, nOptions );
94  }
95  catch (const uno::Exception&)
96  {
97  TOOLS_WARN_EXCEPTION( "sw.core", "loadAlgorithm" );
98  }
99  return bRet;
100 }
101 
103  const OUString& rText1, const OUString& rTextReading1,
104  const css::lang::Locale& rLocale1,
105  const OUString& rText2, const OUString& rTextReading2,
106  const css::lang::Locale& rLocale2 ) const
107 {
108  sal_Int16 nRet = 0;
109  try {
110  nRet = xIES->compareIndexEntry( rText1, rTextReading1, rLocale1,
111  rText2, rTextReading2, rLocale2 );
112  }
113  catch (const uno::Exception&)
114  {
115  TOOLS_WARN_EXCEPTION( "sw.core", "compareIndexEntry" );
116  }
117  return nRet;
118 }
119 
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::lang::Locale aLcl
Definition: toxwrap.hxx:35
OUString GetIndexKey(const OUString &rText, const OUString &rTextReading, const css::lang::Locale &rLocale) const
Definition: toxhlp.cxx:45
css::uno::Sequence< OUString > GetAlgorithmList(const css::lang::Locale &rLcl) const
Definition: toxhlp.cxx:73
css::uno::Reference< css::i18n::XExtendedIndexEntrySupplier > xIES
Definition: toxwrap.hxx:36
bool LoadAlgorithm(const css::lang::Locale &rLcl, const OUString &sSortAlgorithm, long nOptions) const
Definition: toxhlp.cxx:87
#define TOOLS_WARN_EXCEPTION(area, stream)
OUString GetFollowingText(bool bMorePages) const
Definition: toxhlp.cxx:60
sal_Int16 CompareIndexEntry(const OUString &rText1, const OUString &rTextReading1, const css::lang::Locale &rLcl1, const OUString &rText2, const OUString &rTextReading2, const css::lang::Locale &rLcl2) const
Definition: toxhlp.cxx:102