2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2011-03-31 10:05:04 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2001-05-14 12:36:17 +00:00
|
|
|
|
|
|
|
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
|
|
|
#include <comphelper/processfactory.hxx>
|
2013-03-19 15:43:18 +02:00
|
|
|
#include <com/sun/star/i18n/IndexEntrySupplier.hpp>
|
2001-05-14 12:36:17 +00:00
|
|
|
#include <tools/string.hxx>
|
2002-08-23 07:17:26 +00:00
|
|
|
#include <toxwrap.hxx>
|
2013-04-04 19:12:46 +02:00
|
|
|
#include <sal/log.hxx>
|
2001-05-14 12:36:17 +00:00
|
|
|
|
2007-09-27 08:22:53 +00:00
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
2001-05-14 12:36:17 +00:00
|
|
|
|
2002-08-23 07:17:26 +00:00
|
|
|
IndexEntrySupplierWrapper::IndexEntrySupplierWrapper()
|
2001-05-14 12:36:17 +00:00
|
|
|
{
|
2013-03-19 15:43:18 +02:00
|
|
|
uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
|
2002-08-23 07:17:26 +00:00
|
|
|
|
2001-05-14 12:36:17 +00:00
|
|
|
try {
|
2013-03-19 15:43:18 +02:00
|
|
|
xIES = i18n::IndexEntrySupplier::create(xContext);
|
2001-05-14 12:36:17 +00:00
|
|
|
}
|
2013-03-19 15:43:18 +02:00
|
|
|
catch (const uno::Exception& e)
|
2001-05-14 12:36:17 +00:00
|
|
|
{
|
2013-04-04 19:12:46 +02:00
|
|
|
SAL_WARN( "sw.core", "IndexEntrySupplierWrapper: Caught exception: " << e.Message );
|
2001-05-14 12:36:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
IndexEntrySupplierWrapper::~IndexEntrySupplierWrapper()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2002-06-26 08:32:38 +00:00
|
|
|
String IndexEntrySupplierWrapper::GetIndexKey( const String& rTxt,
|
|
|
|
const String& rTxtReading,
|
2012-02-20 17:29:44 +01:00
|
|
|
const ::com::sun::star::lang::Locale& rLocale ) const
|
2001-05-14 12:36:17 +00:00
|
|
|
{
|
|
|
|
String sRet;
|
|
|
|
try {
|
2002-06-26 08:32:38 +00:00
|
|
|
sRet = xIES->getIndexKey( rTxt, rTxtReading, rLocale );
|
2001-05-14 12:36:17 +00:00
|
|
|
}
|
2013-04-04 19:12:46 +02:00
|
|
|
catch (const uno::Exception& e)
|
2001-05-14 12:36:17 +00:00
|
|
|
{
|
2013-04-04 19:12:46 +02:00
|
|
|
SAL_WARN( "sw.core", "getIndexKey: Caught exception: " << e.Message );
|
2001-05-14 12:36:17 +00:00
|
|
|
}
|
|
|
|
return sRet;
|
|
|
|
}
|
|
|
|
|
2011-01-17 15:06:54 +01:00
|
|
|
String IndexEntrySupplierWrapper::GetFollowingText( sal_Bool bMorePages ) const
|
2001-05-14 12:36:17 +00:00
|
|
|
{
|
|
|
|
String sRet;
|
|
|
|
try {
|
|
|
|
sRet = xIES->getIndexFollowPageWord( bMorePages, aLcl );
|
|
|
|
}
|
2013-04-04 19:12:46 +02:00
|
|
|
catch (const uno::Exception& e)
|
2001-05-14 12:36:17 +00:00
|
|
|
{
|
2013-04-04 19:12:46 +02:00
|
|
|
SAL_WARN( "sw.core", "getIndexFollowPageWord: Caught exception: " << e.Message );
|
2001-05-14 12:36:17 +00:00
|
|
|
}
|
|
|
|
return sRet;
|
|
|
|
}
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
::com::sun::star::uno::Sequence< OUString >
|
2012-02-20 17:29:44 +01:00
|
|
|
IndexEntrySupplierWrapper::GetAlgorithmList( const ::com::sun::star::lang::Locale& rLcl ) const
|
2002-06-26 08:32:38 +00:00
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
uno::Sequence< OUString > sRet;
|
2001-05-14 12:36:17 +00:00
|
|
|
|
2002-06-26 08:32:38 +00:00
|
|
|
try {
|
|
|
|
sRet = xIES->getAlgorithmList( rLcl );
|
|
|
|
}
|
2013-04-04 19:12:46 +02:00
|
|
|
catch (const uno::Exception& e)
|
2002-06-26 08:32:38 +00:00
|
|
|
{
|
2013-04-04 19:12:46 +02:00
|
|
|
SAL_WARN( "sw.core", "getAlgorithmList: Caught exception: " << e.Message );
|
2002-06-26 08:32:38 +00:00
|
|
|
}
|
|
|
|
return sRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool IndexEntrySupplierWrapper::LoadAlgorithm(
|
2012-02-20 17:29:44 +01:00
|
|
|
const ::com::sun::star::lang::Locale& rLcl,
|
2002-06-26 08:32:38 +00:00
|
|
|
const String& sSortAlgorithm, long nOptions ) const
|
|
|
|
{
|
|
|
|
sal_Bool bRet = sal_False;
|
|
|
|
try {
|
|
|
|
bRet = xIES->loadAlgorithm( rLcl, sSortAlgorithm, nOptions );
|
|
|
|
}
|
2013-04-04 19:12:46 +02:00
|
|
|
catch (const uno::Exception& e)
|
2002-06-26 08:32:38 +00:00
|
|
|
{
|
2013-04-04 19:12:46 +02:00
|
|
|
SAL_WARN( "sw.core", "loadAlgorithm: Caught exception: " << e.Message );
|
2002-06-26 08:32:38 +00:00
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Int16 IndexEntrySupplierWrapper::CompareIndexEntry(
|
|
|
|
const String& rTxt1, const String& rTxtReading1,
|
2012-02-20 17:29:44 +01:00
|
|
|
const ::com::sun::star::lang::Locale& rLocale1,
|
2002-06-26 08:32:38 +00:00
|
|
|
const String& rTxt2, const String& rTxtReading2,
|
2012-02-20 17:29:44 +01:00
|
|
|
const ::com::sun::star::lang::Locale& rLocale2 ) const
|
2002-06-26 08:32:38 +00:00
|
|
|
{
|
|
|
|
sal_Int16 nRet = 0;
|
|
|
|
try {
|
|
|
|
nRet = xIES->compareIndexEntry( rTxt1, rTxtReading1, rLocale1,
|
|
|
|
rTxt2, rTxtReading2, rLocale2 );
|
|
|
|
}
|
2013-04-04 19:12:46 +02:00
|
|
|
catch (const uno::Exception& e)
|
2002-06-26 08:32:38 +00:00
|
|
|
{
|
2013-04-04 19:12:46 +02:00
|
|
|
SAL_WARN( "sw.core", "compareIndexEntry: Caught exception: " << e.Message );
|
2002-06-26 08:32:38 +00:00
|
|
|
}
|
|
|
|
return nRet;
|
|
|
|
}
|
2010-10-14 08:30:41 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|