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>
24
25using namespace ::com::sun::star;
26
28{
29 uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
30
31 try {
32 m_xIES = i18n::IndexEntrySupplier::create(xContext);
33 }
34 catch (const uno::Exception&)
35 {
36 TOOLS_WARN_EXCEPTION( "sw.core", "IndexEntrySupplierWrapper" );
37 }
38}
39
41{
42}
43
44OUString IndexEntrySupplierWrapper::GetIndexKey( const OUString& rText,
45 const OUString& rTextReading,
46 const css::lang::Locale& rLocale ) const
47{
48 OUString sRet;
49 try {
50 sRet = m_xIES->getIndexKey( rText, rTextReading, rLocale );
51 }
52 catch (const uno::Exception&)
53 {
54 TOOLS_WARN_EXCEPTION( "sw.core", "getIndexKey" );
55 }
56 return sRet;
57}
58
59OUString IndexEntrySupplierWrapper::GetFollowingText( bool bMorePages ) const
60{
61 OUString sRet;
62 try {
63 sRet = m_xIES->getIndexFollowPageWord( bMorePages, m_aLcl );
64 }
65 catch (const uno::Exception&)
66 {
67 TOOLS_WARN_EXCEPTION( "sw.core", "getIndexFollowPageWord" );
68 }
69 return sRet;
70}
71
72css::uno::Sequence< OUString > IndexEntrySupplierWrapper::GetAlgorithmList( const css::lang::Locale& rLcl ) const
73{
74 uno::Sequence< OUString > sRet;
75
76 try {
77 sRet = m_xIES->getAlgorithmList( rLcl );
78 }
79 catch (const uno::Exception&)
80 {
81 TOOLS_WARN_EXCEPTION( "sw.core", "getAlgorithmList" );
82 }
83 return sRet;
84}
85
87 const css::lang::Locale& rLcl,
88 const OUString& sSortAlgorithm, tools::Long nOptions ) const
89{
90 bool bRet = false;
91 try {
92 bRet = m_xIES->loadAlgorithm( rLcl, sSortAlgorithm, nOptions );
93 }
94 catch (const uno::Exception&)
95 {
96 TOOLS_WARN_EXCEPTION( "sw.core", "loadAlgorithm" );
97 }
98 return bRet;
99}
100
102 const OUString& rText1, const OUString& rTextReading1,
103 const css::lang::Locale& rLocale1,
104 const OUString& rText2, const OUString& rTextReading2,
105 const css::lang::Locale& rLocale2 ) const
106{
107 sal_Int16 nRet = 0;
108 try {
109 nRet = m_xIES->compareIndexEntry( rText1, rTextReading1, rLocale1,
110 rText2, rTextReading2, rLocale2 );
111 }
112 catch (const uno::Exception&)
113 {
114 TOOLS_WARN_EXCEPTION( "sw.core", "compareIndexEntry" );
115 }
116 return nRet;
117}
118
119/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Sequence< OUString > GetAlgorithmList(const css::lang::Locale &rLcl) const
Definition: toxhlp.cxx:72
css::lang::Locale m_aLcl
Definition: toxwrap.hxx:33
OUString GetFollowingText(bool bMorePages) const
Definition: toxhlp.cxx:59
css::uno::Reference< css::i18n::XExtendedIndexEntrySupplier > m_xIES
Definition: toxwrap.hxx:34
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:101
bool LoadAlgorithm(const css::lang::Locale &rLcl, const OUString &sSortAlgorithm, tools::Long nOptions) const
Definition: toxhlp.cxx:86
OUString GetIndexKey(const OUString &rText, const OUString &rTextReading, const css::lang::Locale &rLocale) const
Definition: toxhlp.cxx:44
#define TOOLS_WARN_EXCEPTION(area, stream)
long Long