From 87c7f609cced4e74ab27739cf28d5f21b46c6a7a Mon Sep 17 00:00:00 2001 From: Matúš Kukan Date: Sat, 1 Sep 2012 21:10:06 +0200 Subject: filtertracer seems to be unused MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It has no .component file anyway. Change-Id: Ia6f609a237cb4268161fe1f139b1f5c0d1d6fc5e Reviewed-on: https://gerrit.libreoffice.org/528 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara --- filter/Library_filtertracer.mk | 42 ---- filter/Module_filter.mk | 1 - filter/source/filtertracer/filtertracer.cxx | 260 ------------------------- filter/source/filtertracer/filtertracer.hxx | 183 ----------------- filter/source/filtertracer/filtertraceruno.cxx | 71 ------- 5 files changed, 557 deletions(-) delete mode 100644 filter/Library_filtertracer.mk delete mode 100644 filter/source/filtertracer/filtertracer.cxx delete mode 100644 filter/source/filtertracer/filtertracer.hxx delete mode 100644 filter/source/filtertracer/filtertraceruno.cxx diff --git a/filter/Library_filtertracer.mk b/filter/Library_filtertracer.mk deleted file mode 100644 index efd029a6c765..000000000000 --- a/filter/Library_filtertracer.mk +++ /dev/null @@ -1,42 +0,0 @@ -# -# 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 . -# - -$(eval $(call gb_Library_Library,filtertracer)) - -$(eval $(call gb_Library_use_sdk_api,filtertracer)) - -$(eval $(call gb_Library_set_include,filtertracer,\ - $$(INCLUDE) \ -)) - -$(eval $(call gb_Library_use_libraries,filtertracer,\ - utl \ - tl \ - comphelper \ - cppuhelper \ - cppu \ - sal \ - $(gb_STDLIBS) \ -)) - -$(eval $(call gb_Library_add_exception_objects,filtertracer,\ - filter/source/filtertracer/filtertracer \ - filter/source/filtertracer/filtertraceruno \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/filter/Module_filter.mk b/filter/Module_filter.mk index d764301391e5..2a3ef798faca 100644 --- a/filter/Module_filter.mk +++ b/filter/Module_filter.mk @@ -38,7 +38,6 @@ $(eval $(call gb_Module_add_targets,filter,\ Library_eti \ Library_exp \ Library_filterconfig \ - Library_filtertracer \ Library_flash \ Library_icd \ Library_icg \ diff --git a/filter/source/filtertracer/filtertracer.cxx b/filter/source/filtertracer/filtertracer.cxx deleted file mode 100644 index 2b7ec476f254..000000000000 --- a/filter/source/filtertracer/filtertracer.cxx +++ /dev/null @@ -1,260 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include "filtertracer.hxx" -#include -#include -#include -#include -#include -// ---------------- -// - FILTERTRACER - -// ---------------- - -using namespace ::com::sun::star; - -rtl::OUString FilterTracer_getImplementationName() - throw( NMSP_UNO::RuntimeException ) -{ - return B2UCONST( "com.sun.star.util.FilterTracer" ); -} -sal_Bool SAL_CALL FilterTracer_supportsService( const rtl::OUString& ServiceName ) - throw( NMSP_UNO::RuntimeException ) -{ - return ServiceName == "com.sun.star.util.logging.Logger"; -} -SEQ( rtl::OUString ) SAL_CALL FilterTracer_getSupportedServiceNames() - throw( NMSP_UNO::RuntimeException ) -{ - SEQ( rtl::OUString ) aRet(1); - rtl::OUString* pArray = aRet.getArray(); - pArray[0] = B2UCONST( "com.sun.star.util.logging.Logger" ); - return aRet; -} - -// ----------------------------------------------------------------------------- - -FilterTracer::FilterTracer( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr ) : - xFact ( rxMgr ), - mpStream ( NULL ), - mnLogLevel ( NMSP_LOGGING::LogLevel::ALL ) -{ - uno::Reference< uno::XComponentContext > xContext( comphelper::ComponentContext(rxMgr).getUNOContext() ); - mxTextSearch = com::sun::star::util::TextSearch::create(xContext); -} -FilterTracer::~FilterTracer() -{ - if ( mpStream ) - { - mxOutputStream = NULL; - delete mpStream; - } -} - -// ----------------------------------------------------------------------------- - -// XInterface -void SAL_CALL FilterTracer::acquire() throw() -{ - OWeakObject::acquire(); -} -void SAL_CALL FilterTracer::release() throw() -{ - OWeakObject::release(); -} - -// ----------------------------------------------------------------------------- - -// checks if the tokens of rFilter can be found in rString -sal_Bool FilterTracer::ImplFilter( const rtl::OUString& rFilter, const rtl::OUString& rString ) -{ - sal_Bool bFilter = sal_False; - if ( mxTextSearch.is() ) - { - maSearchOptions.searchString = rFilter; - mxTextSearch->setOptions( maSearchOptions ); - NMSP_UTIL::SearchResult aSearchResult = mxTextSearch->searchForward( rString, 0, rString.getLength() ); - bFilter = aSearchResult.subRegExpressions != 0; - } - return bFilter; -} - -// ----------------------------------------------------------------------------- - -// XInitialization -void SAL_CALL FilterTracer::initialize( const SEQ( NMSP_UNO::Any )& aArguments ) - throw ( NMSP_UNO::Exception, NMSP_UNO::RuntimeException ) -{ - sal_Int32 i; - SEQ( NMSP_BEANS::PropertyValue ) aParameter; - for ( i = 0; i < aArguments.getLength(); i++ ) - { - if ( aArguments[ i ] >>= aParameter ) - break; - } - for ( i = 0; i < aParameter.getLength(); i++ ) - { - const NMSP_BEANS::PropertyValue& rProp = aParameter[ i ]; - if ( rProp.Name == "LogLevel" ) - rProp.Value >>= mnLogLevel; - else if ( rProp.Name == "ClassFilter" ) - rProp.Value >>= msClassFilter; - else if ( rProp.Name == "MethodFilter" ) - rProp.Value >>= msMethodFilter; - else if ( rProp.Name == "MessageFilter" ) - rProp.Value >>= msMessageFilter; - else if ( rProp.Name == "OutputStream" ) - rProp.Value >>= mxOutputStream; - else if ( rProp.Name == "URL" ) - rProp.Value >>= msURL; - else if ( rProp.Name == "DocumentHandler" ) - rProp.Value >>= mxDocumentHandler; - } - - // check if we have to create the XOutputStream - if ( !(mxOutputStream.is() || msURL.isEmpty()) ) - { - mpStream = ::utl::UcbStreamHelper::CreateStream( msURL, STREAM_WRITE | STREAM_TRUNC | STREAM_SHARE_DENYNONE ); - if ( mpStream ) - { - ::utl::OOutputStreamWrapper* pHelper = new ::utl::OOutputStreamWrapper( *mpStream ); - mxOutputStream = pHelper; - } - } -} - -// ----------------------------------------------------------------------------- - -// XServiceInfo -rtl::OUString SAL_CALL FilterTracer::getImplementationName() - throw( NMSP_UNO::RuntimeException ) -{ - return FilterTracer_getImplementationName(); -} -sal_Bool SAL_CALL FilterTracer::supportsService( const rtl::OUString& rServiceName ) - throw( NMSP_UNO::RuntimeException ) -{ - return FilterTracer_supportsService( rServiceName ); -} -SEQ( rtl::OUString ) SAL_CALL FilterTracer::getSupportedServiceNames() - throw ( NMSP_UNO::RuntimeException ) -{ - return FilterTracer_getSupportedServiceNames(); -} - -// ----------------------------------------------------------------------------- - -// XLogger -REF( NMSP_LOGGING::XLogger ) SAL_CALL FilterTracer::getLogger( const rtl::OUString& /* rName */ ) - throw (::com::sun::star::uno::RuntimeException) -{ - REF( NMSP_LOGGING::XLogger ) xLog( this ); - return xLog; -} -sal_Int32 SAL_CALL FilterTracer::getLevel() throw (::com::sun::star::uno::RuntimeException) -{ - return mnLogLevel; -} -rtl::OUString SAL_CALL FilterTracer::getName() throw (::com::sun::star::uno::RuntimeException) -{ - rtl::OUString aName; - return aName; -} -sal_Bool SAL_CALL FilterTracer::isLoggable( sal_Int32 nLevel ) - throw (::com::sun::star::uno::RuntimeException) -{ - return mnLogLevel <= nLevel; -} -void SAL_CALL FilterTracer::logp( sal_Int32 /* nLevel */, const rtl::OUString& rSourceClass, - const rtl::OUString& rSourceMethod, const rtl::OUString& rMessage ) - throw (::com::sun::star::uno::RuntimeException) -{ - if ( mxOutputStream.is() || mxDocumentHandler.is() ) - { - if ( ! ( ImplFilter( msClassFilter, rSourceClass ) || ImplFilter( msMethodFilter, rSourceMethod ) - || ImplFilter( msMessageFilter, rMessage ) ) ) - { - rtl::OString sClass( rtl::OUStringToOString( rSourceClass, RTL_TEXTENCODING_UTF8 ) ); - rtl::OString sMethod( rtl::OUStringToOString( rSourceMethod, RTL_TEXTENCODING_UTF8 ) ); - rtl::OString sMessage( rtl::OUStringToOString( rMessage, RTL_TEXTENCODING_UTF8 ) ); - try - { - SEQ( sal_Int8 ) aData( sClass.getLength() + sMethod.getLength() + sMessage.getLength() ); - sal_Int8* pPtr = aData.getArray(); - memcpy( pPtr, sClass.getStr(), sClass.getLength() ); - pPtr += sClass.getLength(); - memcpy( pPtr, sMethod.getStr(), sMethod.getLength() ); - pPtr += sMethod.getLength(); - memcpy( pPtr, sMessage.getStr(), sMessage.getLength() ); - pPtr += sMessage.getLength(); - if ( mxOutputStream.is() ) - mxOutputStream->writeBytes( aData ); - if ( mxDocumentHandler.is() ) - mxDocumentHandler->characters( ::rtl::OUString( (sal_Char*)aData.getArray(), aData.getLength(), RTL_TEXTENCODING_UTF8 ) ); - } - catch ( ... ) - { - - } - } - } -} - -// ----------------------------------------------------------------------------- - -// XTextSearch -void SAL_CALL FilterTracer::setOptions( const NMSP_UTIL::SearchOptions& rSearchOptions ) - throw (::com::sun::star::uno::RuntimeException) -{ - maSearchOptions = rSearchOptions; -} - -// ----------------------------------------------------------------------------- - -NMSP_UTIL::SearchResult SAL_CALL FilterTracer::searchForward( const rtl::OUString& rSearchStr, - sal_Int32 nStartPos, sal_Int32 nEndPos ) throw (::com::sun::star::uno::RuntimeException) -{ - NMSP_UTIL::SearchResult nSearchResult; - if ( mxTextSearch.is() ) - mxTextSearch->searchForward( rSearchStr, nStartPos, nEndPos ); - return nSearchResult; -} - -// ----------------------------------------------------------------------------- - -NMSP_UTIL::SearchResult SAL_CALL FilterTracer::searchBackward( const rtl::OUString& rSearchStr, - sal_Int32 nStartPos, sal_Int32 nEndPos ) throw (::com::sun::star::uno::RuntimeException) -{ - NMSP_UTIL::SearchResult nSearchResult; - if ( mxTextSearch.is() ) - mxTextSearch->searchBackward( rSearchStr, nStartPos, nEndPos ); - return nSearchResult; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/filtertracer/filtertracer.hxx b/filter/source/filtertracer/filtertracer.hxx deleted file mode 100644 index 5b9f83bf716a..000000000000 --- a/filter/source/filtertracer/filtertracer.hxx +++ /dev/null @@ -1,183 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _FILTERTRACER_HXX -#define _FILTERTRACER_HXX - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class SvStream; - -// ----------------------------------------------------------------------------- - -#define NMSP_IO com::sun::star::io -#define NMSP_UNO com::sun::star::uno -#define NMSP_BEANS com::sun::star::beans -#define NMSP_LANG com::sun::star::lang -#define NMSP_UTIL com::sun::star::util -#define NMSP_SAX com::sun::star::xml::sax -#define NMSP_LOGGING NMSP_UTIL::logging - - -#define REF( _def_Obj ) NMSP_UNO::Reference< _def_Obj > -#define SEQ( _def_Obj ) NMSP_UNO::Sequence< _def_Obj > -#define B2UCONST( _def_pChar ) (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(_def_pChar ))) - -// ---------------- -// - FILTERTRACER - -// ---------------- -// - -/** Some options of the FilterTracer can be initialized - via XInitialization interface. - - Therefore the first sequence of PropertyValues that - is given in the argument list is used. - - Following Properties are supported: - - OutputStream com.sun.star.io.XOutputStream Defines the output stream. Optional it is possible to provide - the URL property, then the corresponding output stream will - be generated automatically. - - URL string Defines the URL, which is used to create an output stream. - This property is used only, if there is no valid - OutputStream property available. - - DocumentHandler com.sun.star.xml.sax.XDocumentHandler The output can also be written to a DocumentHandler, - then the "characters" method of the handler is used. - - LogLevel long Defines the LogLevel for the FilterTracer. - Using logp with a LogLevel that is higher as the LogLevel - for the FilterTracer component will generate no output. - LogLevel constants are defined in sun::star::util::logging::LogLevel - The default LogLevel com::sun::star::logging::LogLevel::ALL - - ClassFilter string This property defines a filter for the SourceClass string of logp. - The ClassFilter string can be separated into multiple tokens using - a semicolon. If one of the ClassFilter token is part of the - SourceClass string of the logp method then there will be no output. - - MethodFilter string This property defines a filter for the SourceMethod string of logp. - The MethodFilter string can be separated into multiple tokens using - a semicolon. If one of the MethodFilter token is part of the - SourceMethod string of the logp method then there will be no output. - - MessageFilter string This property defines a filter for the Message string of logp. - The MessageFilter string can be separated into multiple tokens using - a semicolon. If one of the MessageFilter token is part of the - Message string of the logp method then there will be no output. - -*/ - -class FilterTracer : public cppu::WeakImplHelper4 -< - NMSP_LOGGING::XLogger, - NMSP_LANG::XInitialization, - NMSP_LANG::XServiceInfo, - NMSP_UTIL::XTextSearch -> -{ - REF( NMSP_LANG::XMultiServiceFactory ) xFact; - SvStream* mpStream; - - sal_Int32 mnLogLevel; - rtl::OUString msClassFilter; - rtl::OUString msMethodFilter; - rtl::OUString msMessageFilter; - rtl::OUString msURL; - - REF( NMSP_IO::XOutputStream ) mxOutputStream; - REF( NMSP_SAX::XDocumentHandler) mxDocumentHandler; - - REF( NMSP_UTIL::XTextSearch ) mxTextSearch; - NMSP_UTIL::SearchOptions maSearchOptions; - - sal_Bool ImplFilter( const rtl::OUString& rFilter, const rtl::OUString& rString ); - -public: - FilterTracer( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr ); - virtual ~FilterTracer(); - - // XInterface - virtual void SAL_CALL acquire() throw(); - virtual void SAL_CALL release() throw(); - - // XInitialization - virtual void SAL_CALL initialize( const SEQ( NMSP_UNO::Any )& aArguments ) - throw ( NMSP_UNO::Exception, NMSP_UNO::RuntimeException ); - - // XServiceInfo - virtual rtl::OUString SAL_CALL getImplementationName() - throw ( NMSP_UNO::RuntimeException ); - virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& rServiceName ) - throw ( NMSP_UNO::RuntimeException ); - virtual SEQ( rtl::OUString ) SAL_CALL getSupportedServiceNames() - throw ( NMSP_UNO::RuntimeException ); - - // XLogger - virtual REF( NMSP_LOGGING::XLogger ) SAL_CALL getLogger( const rtl::OUString& rName ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getLevel() throw (::com::sun::star::uno::RuntimeException); - virtual rtl::OUString SAL_CALL getName() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isLoggable( sal_Int32 nLevel ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL logp( sal_Int32 nLevel, const rtl::OUString& rSourceClass, - const rtl::OUString& rSourceMethod, const rtl::OUString& rMessage ) throw (::com::sun::star::uno::RuntimeException); - - // XTextSearch - virtual void SAL_CALL setOptions( const NMSP_UTIL::SearchOptions& ) throw (::com::sun::star::uno::RuntimeException); - virtual NMSP_UTIL::SearchResult SAL_CALL searchForward( const rtl::OUString& rSearchStr, - sal_Int32 nStartPos, sal_Int32 nEndPos ) throw (::com::sun::star::uno::RuntimeException); - virtual NMSP_UTIL::SearchResult SAL_CALL searchBackward( const rtl::OUString& rSearchStr, - sal_Int32 nStartPos, sal_Int32 nEndPos ) throw (::com::sun::star::uno::RuntimeException); -}; - -rtl::OUString FilterTracer_getImplementationName() - throw ( NMSP_UNO::RuntimeException ); -sal_Bool SAL_CALL FilterTracer_supportsService( const rtl::OUString& rServiceName ) - throw( NMSP_UNO::RuntimeException ); -SEQ( rtl::OUString ) SAL_CALL FilterTracer_getSupportedServiceNames() - throw( NMSP_UNO::RuntimeException ); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/filtertracer/filtertraceruno.cxx b/filter/source/filtertracer/filtertraceruno.cxx deleted file mode 100644 index 8d7a4fd83790..000000000000 --- a/filter/source/filtertracer/filtertraceruno.cxx +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * 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. - * - * 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). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -#include "filtertracer.hxx" - -#include -#include - -// ------------------- -// - factory methods - -// ------------------- - -static REF( NMSP_UNO::XInterface ) SAL_CALL create_FilterTracer( const REF( NMSP_LANG::XMultiServiceFactory )& rxFact ) -{ - return REF( NMSP_UNO::XInterface )( *new FilterTracer( rxFact ) ); -} - -// ------------------------ -// - component_getFactory - -// ------------------------ - -extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ ) -{ - REF( NMSP_LANG::XSingleServiceFactory ) xFactory; - void* pRet = 0; - - if( rtl_str_compare( pImplName, "com.sun.star.util.FilterTracer" ) == 0 ) - { - const rtl::OUString aServiceName( B2UCONST( "com.sun.star.util.FilterTracer" ) ); - - xFactory = REF( NMSP_LANG::XSingleServiceFactory )( cppu::createSingleFactory( - reinterpret_cast< NMSP_LANG::XMultiServiceFactory* >( pServiceManager ), - B2UCONST( "com.sun.star.util.FilterTracer" ), - create_FilterTracer, SEQ( rtl::OUString )( &aServiceName, 1 ) ) ); - } - if( xFactory.is() ) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - - return pRet; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit