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>
|
2003-04-24 09:54:23 +00:00
|
|
|
#include <com/sun/star/i18n/XExtendedIndexEntrySupplier.hpp>
|
2011-11-04 12:23:59 +01:00
|
|
|
#include <rtl/strbuf.hxx>
|
2001-05-14 12:36:17 +00:00
|
|
|
#include <tools/string.hxx>
|
2002-08-23 07:17:26 +00:00
|
|
|
#include <toxwrap.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
|
|
|
{
|
2007-09-27 08:22:53 +00:00
|
|
|
uno::Reference<
|
|
|
|
lang::XMultiServiceFactory > rxMSF =
|
2002-08-23 07:17:26 +00:00
|
|
|
::comphelper::getProcessServiceFactory();
|
|
|
|
|
2001-05-14 12:36:17 +00:00
|
|
|
try {
|
2012-02-20 20:45:25 +01:00
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xI =
|
2013-03-18 23:17:03 +01:00
|
|
|
rxMSF->createInstance( ::rtl::OUString(
|
|
|
|
"com.sun.star.i18n.IndexEntrySupplier") );
|
2001-05-14 12:36:17 +00:00
|
|
|
if( xI.is() )
|
|
|
|
{
|
2012-02-20 17:32:53 +01:00
|
|
|
::com::sun::star::uno::Any x = xI->queryInterface( ::getCppuType(
|
2007-09-27 08:22:53 +00:00
|
|
|
(const uno::Reference< i18n::XExtendedIndexEntrySupplier>*)0) );
|
2001-05-14 12:36:17 +00:00
|
|
|
x >>= xIES;
|
|
|
|
}
|
|
|
|
}
|
2012-02-20 17:32:53 +01:00
|
|
|
catch (const ::com::sun::star::uno::Exception&
|
2011-11-24 00:52:07 +01:00
|
|
|
#if OSL_DEBUG_LEVEL > 0
|
2007-09-27 08:22:53 +00:00
|
|
|
e
|
|
|
|
#endif
|
|
|
|
)
|
2001-05-14 12:36:17 +00:00
|
|
|
{
|
2011-11-24 00:52:07 +01:00
|
|
|
#if OSL_DEBUG_LEVEL > 0
|
2013-03-18 23:17:03 +01:00
|
|
|
rtl::OStringBuffer aMsg("IndexEntrySupplierWrapper: Caught exception\n");
|
2011-11-01 22:38:51 +00:00
|
|
|
aMsg.append(rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8));
|
|
|
|
OSL_FAIL( aMsg.getStr() );
|
2001-05-14 12:36:17 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|
2012-02-20 17:32:53 +01:00
|
|
|
catch (const ::com::sun::star::uno::Exception&
|
2011-11-24 00:52:07 +01:00
|
|
|
#if OSL_DEBUG_LEVEL > 0
|
2007-09-27 08:22:53 +00:00
|
|
|
e
|
|
|
|
#endif
|
|
|
|
)
|
2001-05-14 12:36:17 +00:00
|
|
|
{
|
2011-11-24 00:52:07 +01:00
|
|
|
#if OSL_DEBUG_LEVEL > 0
|
2013-03-18 23:17:03 +01:00
|
|
|
rtl::OStringBuffer aMsg("getIndexKey: Caught exception\n");
|
2011-11-01 22:38:51 +00:00
|
|
|
aMsg.append(rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8));
|
|
|
|
OSL_FAIL( aMsg.getStr() );
|
2001-05-14 12:36:17 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
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 );
|
|
|
|
}
|
2012-02-20 17:32:53 +01:00
|
|
|
catch (const ::com::sun::star::uno::Exception&
|
2011-11-24 00:52:07 +01:00
|
|
|
#if OSL_DEBUG_LEVEL > 0
|
2007-09-27 08:22:53 +00:00
|
|
|
e
|
|
|
|
#endif
|
|
|
|
)
|
2001-05-14 12:36:17 +00:00
|
|
|
{
|
2011-11-24 00:52:07 +01:00
|
|
|
#if OSL_DEBUG_LEVEL > 0
|
2013-03-18 23:17:03 +01:00
|
|
|
rtl::OStringBuffer aMsg("getIndexFollowPageWord: Caught exception\n");
|
2011-11-01 22:38:51 +00:00
|
|
|
aMsg.append(rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8));
|
|
|
|
OSL_FAIL( aMsg.getStr() );
|
2001-05-14 12:36:17 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
return sRet;
|
|
|
|
}
|
|
|
|
|
2012-02-20 17:29:44 +01:00
|
|
|
::com::sun::star::uno::Sequence< ::rtl::OUString >
|
|
|
|
IndexEntrySupplierWrapper::GetAlgorithmList( const ::com::sun::star::lang::Locale& rLcl ) const
|
2002-06-26 08:32:38 +00:00
|
|
|
{
|
2007-09-27 08:22:53 +00:00
|
|
|
uno::Sequence< ::rtl::OUString > sRet;
|
2001-05-14 12:36:17 +00:00
|
|
|
|
2002-06-26 08:32:38 +00:00
|
|
|
try {
|
|
|
|
sRet = xIES->getAlgorithmList( rLcl );
|
|
|
|
}
|
2012-02-20 17:32:53 +01:00
|
|
|
catch (const ::com::sun::star::uno::Exception&
|
2011-11-24 00:52:07 +01:00
|
|
|
#if OSL_DEBUG_LEVEL > 0
|
2007-09-27 08:22:53 +00:00
|
|
|
e
|
|
|
|
#endif
|
|
|
|
)
|
2002-06-26 08:32:38 +00:00
|
|
|
{
|
2011-11-24 00:52:07 +01:00
|
|
|
#if OSL_DEBUG_LEVEL > 0
|
2013-03-18 23:17:03 +01:00
|
|
|
rtl::OStringBuffer aMsg("getAlgorithmList: Caught exception\n");
|
2011-11-01 22:38:51 +00:00
|
|
|
aMsg.append(rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8));
|
|
|
|
OSL_FAIL( aMsg.getStr() );
|
2002-06-26 08:32:38 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
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 );
|
|
|
|
}
|
2012-02-20 17:32:53 +01:00
|
|
|
catch (const ::com::sun::star::uno::Exception&
|
2011-11-24 00:52:07 +01:00
|
|
|
#if OSL_DEBUG_LEVEL > 0
|
2007-09-27 08:22:53 +00:00
|
|
|
e
|
|
|
|
#endif
|
|
|
|
)
|
2002-06-26 08:32:38 +00:00
|
|
|
{
|
2011-11-24 00:52:07 +01:00
|
|
|
#if OSL_DEBUG_LEVEL > 0
|
2013-03-18 23:17:03 +01:00
|
|
|
rtl::OStringBuffer aMsg("loadAlgorithm: Caught exception\n");
|
2011-11-01 22:38:51 +00:00
|
|
|
aMsg.append(rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8));
|
|
|
|
OSL_FAIL( aMsg.getStr() );
|
2002-06-26 08:32:38 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
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 );
|
|
|
|
}
|
2012-02-20 17:32:53 +01:00
|
|
|
catch (const ::com::sun::star::uno::Exception&
|
2011-11-24 00:52:07 +01:00
|
|
|
#if OSL_DEBUG_LEVEL > 0
|
2007-09-27 08:22:53 +00:00
|
|
|
e
|
|
|
|
#endif
|
|
|
|
)
|
2002-06-26 08:32:38 +00:00
|
|
|
{
|
2011-11-24 00:52:07 +01:00
|
|
|
#if OSL_DEBUG_LEVEL > 0
|
2013-03-18 23:17:03 +01:00
|
|
|
rtl::OStringBuffer aMsg("compareIndexEntry: Caught exception\n");
|
2011-11-01 22:38:51 +00:00
|
|
|
aMsg.append(rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8));
|
|
|
|
OSL_FAIL( aMsg.getStr() );
|
2002-06-26 08:32:38 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
return nRet;
|
|
|
|
}
|
2010-10-14 08:30:41 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|