Line data Source code
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 :
20 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
21 : #include <comphelper/processfactory.hxx>
22 : #include <com/sun/star/i18n/IndexEntrySupplier.hpp>
23 : #include <toxwrap.hxx>
24 : #include <sal/log.hxx>
25 :
26 : using namespace ::com::sun::star;
27 :
28 0 : IndexEntrySupplierWrapper::IndexEntrySupplierWrapper()
29 : {
30 0 : uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
31 :
32 : try {
33 0 : xIES = i18n::IndexEntrySupplier::create(xContext);
34 : }
35 0 : catch (const uno::Exception& e)
36 : {
37 : SAL_WARN( "sw.core", "IndexEntrySupplierWrapper: Caught exception: " << e.Message );
38 0 : }
39 0 : }
40 :
41 0 : IndexEntrySupplierWrapper::~IndexEntrySupplierWrapper()
42 : {
43 0 : }
44 :
45 0 : OUString IndexEntrySupplierWrapper::GetIndexKey( const OUString& rTxt,
46 : const OUString& rTxtReading,
47 : const ::com::sun::star::lang::Locale& rLocale ) const
48 : {
49 0 : OUString sRet;
50 : try {
51 0 : sRet = xIES->getIndexKey( rTxt, rTxtReading, rLocale );
52 : }
53 0 : catch (const uno::Exception& e)
54 : {
55 : SAL_WARN( "sw.core", "getIndexKey: Caught exception: " << e.Message );
56 : }
57 0 : return sRet;
58 : }
59 :
60 0 : OUString IndexEntrySupplierWrapper::GetFollowingText( sal_Bool bMorePages ) const
61 : {
62 0 : OUString sRet;
63 : try {
64 0 : sRet = xIES->getIndexFollowPageWord( bMorePages, aLcl );
65 : }
66 0 : catch (const uno::Exception& e)
67 : {
68 : SAL_WARN( "sw.core", "getIndexFollowPageWord: Caught exception: " << e.Message );
69 : }
70 0 : return sRet;
71 : }
72 :
73 : ::com::sun::star::uno::Sequence< OUString >
74 0 : IndexEntrySupplierWrapper::GetAlgorithmList( const ::com::sun::star::lang::Locale& rLcl ) const
75 : {
76 0 : uno::Sequence< OUString > sRet;
77 :
78 : try {
79 0 : sRet = xIES->getAlgorithmList( rLcl );
80 : }
81 0 : catch (const uno::Exception& e)
82 : {
83 : SAL_WARN( "sw.core", "getAlgorithmList: Caught exception: " << e.Message );
84 : }
85 0 : return sRet;
86 : }
87 :
88 0 : sal_Bool IndexEntrySupplierWrapper::LoadAlgorithm(
89 : const ::com::sun::star::lang::Locale& rLcl,
90 : const OUString& sSortAlgorithm, long nOptions ) const
91 : {
92 0 : sal_Bool bRet = sal_False;
93 : try {
94 0 : bRet = xIES->loadAlgorithm( rLcl, sSortAlgorithm, nOptions );
95 : }
96 0 : catch (const uno::Exception& e)
97 : {
98 : SAL_WARN( "sw.core", "loadAlgorithm: Caught exception: " << e.Message );
99 : }
100 0 : return bRet;
101 : }
102 :
103 0 : sal_Int16 IndexEntrySupplierWrapper::CompareIndexEntry(
104 : const OUString& rTxt1, const OUString& rTxtReading1,
105 : const ::com::sun::star::lang::Locale& rLocale1,
106 : const OUString& rTxt2, const OUString& rTxtReading2,
107 : const ::com::sun::star::lang::Locale& rLocale2 ) const
108 : {
109 0 : sal_Int16 nRet = 0;
110 : try {
111 0 : nRet = xIES->compareIndexEntry( rTxt1, rTxtReading1, rLocale1,
112 0 : rTxt2, rTxtReading2, rLocale2 );
113 : }
114 0 : catch (const uno::Exception& e)
115 : {
116 : SAL_WARN( "sw.core", "compareIndexEntry: Caught exception: " << e.Message );
117 : }
118 0 : return nRet;
119 : }
120 :
121 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|