1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <comphelper/processfactory.hxx>
21 #include <com/sun/star/i18n/IndexEntrySupplier.hpp>
22 #include <toxwrap.hxx>
23 #include <comphelper/diagnose_ex.hxx>
25 using namespace ::com::sun::star
;
27 IndexEntrySupplierWrapper::IndexEntrySupplierWrapper()
29 uno::Reference
< uno::XComponentContext
> xContext
= ::comphelper::getProcessComponentContext();
32 m_xIES
= i18n::IndexEntrySupplier::create(xContext
);
34 catch (const uno::Exception
&)
36 TOOLS_WARN_EXCEPTION( "sw.core", "IndexEntrySupplierWrapper" );
40 IndexEntrySupplierWrapper::~IndexEntrySupplierWrapper()
44 OUString
IndexEntrySupplierWrapper::GetIndexKey( const OUString
& rText
,
45 const OUString
& rTextReading
,
46 const css::lang::Locale
& rLocale
) const
50 sRet
= m_xIES
->getIndexKey( rText
, rTextReading
, rLocale
);
52 catch (const uno::Exception
&)
54 TOOLS_WARN_EXCEPTION( "sw.core", "getIndexKey" );
59 OUString
IndexEntrySupplierWrapper::GetFollowingText( bool bMorePages
) const
63 sRet
= m_xIES
->getIndexFollowPageWord( bMorePages
, m_aLcl
);
65 catch (const uno::Exception
&)
67 TOOLS_WARN_EXCEPTION( "sw.core", "getIndexFollowPageWord" );
72 css::uno::Sequence
< OUString
> IndexEntrySupplierWrapper::GetAlgorithmList( const css::lang::Locale
& rLcl
) const
74 uno::Sequence
< OUString
> sRet
;
77 sRet
= m_xIES
->getAlgorithmList( rLcl
);
79 catch (const uno::Exception
&)
81 TOOLS_WARN_EXCEPTION( "sw.core", "getAlgorithmList" );
86 bool IndexEntrySupplierWrapper::LoadAlgorithm(
87 const css::lang::Locale
& rLcl
,
88 const OUString
& sSortAlgorithm
, tools::Long nOptions
) const
92 bRet
= m_xIES
->loadAlgorithm( rLcl
, sSortAlgorithm
, nOptions
);
94 catch (const uno::Exception
&)
96 TOOLS_WARN_EXCEPTION( "sw.core", "loadAlgorithm" );
101 sal_Int16
IndexEntrySupplierWrapper::CompareIndexEntry(
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
109 nRet
= m_xIES
->compareIndexEntry( rText1
, rTextReading1
, rLocale1
,
110 rText2
, rTextReading2
, rLocale2
);
112 catch (const uno::Exception
&)
114 TOOLS_WARN_EXCEPTION( "sw.core", "compareIndexEntry" );
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */