2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2001-05-14 12:36:17 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 14:46:09 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2001-05-14 12:36:17 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2001-05-14 12:36:17 +00:00
|
|
|
*
|
2008-04-10 14:46:09 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2001-05-14 12:36:17 +00:00
|
|
|
*
|
2008-04-10 14:46:09 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2001-05-14 12:36:17 +00:00
|
|
|
*
|
2008-04-10 14:46:09 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2001-05-14 12:36:17 +00:00
|
|
|
*
|
2008-04-10 14:46:09 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2001-05-14 12:36:17 +00:00
|
|
|
*
|
2008-04-10 14:46:09 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
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 =
|
2010-10-27 11:38:46 +01:00
|
|
|
rxMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
|
|
|
|
"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
|
2012-06-07 13:33:49 +02:00
|
|
|
rtl::OStringBuffer aMsg(RTL_CONSTASCII_STRINGPARAM("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
|
2012-06-07 13:33:49 +02:00
|
|
|
rtl::OStringBuffer aMsg(RTL_CONSTASCII_STRINGPARAM("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
|
2012-06-07 13:33:49 +02:00
|
|
|
rtl::OStringBuffer aMsg(RTL_CONSTASCII_STRINGPARAM("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
|
2012-06-07 13:33:49 +02:00
|
|
|
rtl::OStringBuffer aMsg(RTL_CONSTASCII_STRINGPARAM("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
|
2012-06-07 13:33:49 +02:00
|
|
|
rtl::OStringBuffer aMsg(RTL_CONSTASCII_STRINGPARAM("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
|
2012-06-07 13:33:49 +02:00
|
|
|
rtl::OStringBuffer aMsg(RTL_CONSTASCII_STRINGPARAM("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: */
|