summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xRepository.mk2
-rw-r--r--writerfilter/Library_writerfilter_uno.mk64
-rw-r--r--writerfilter/Module_writerfilter.mk1
-rw-r--r--writerfilter/unocomponent/component.cxx63
-rw-r--r--writerfilter/unocomponent/debugservices/doctok/DocTokAnalyzeService.cxx253
-rw-r--r--writerfilter/unocomponent/debugservices/doctok/DocTokAnalyzeService.hxx64
-rw-r--r--writerfilter/unocomponent/debugservices/doctok/DocTokTestService.cxx107
-rw-r--r--writerfilter/unocomponent/debugservices/doctok/DocTokTestService.hxx63
-rw-r--r--writerfilter/unocomponent/debugservices/ooxml/OOXMLAnalyzeService.cxx247
-rw-r--r--writerfilter/unocomponent/debugservices/ooxml/OOXMLAnalyzeService.hxx64
-rw-r--r--writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx126
-rw-r--r--writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.hxx63
-rw-r--r--writerfilter/unocomponent/debugservices/rtftok/ScannerTestService.cxx416
-rw-r--r--writerfilter/unocomponent/debugservices/rtftok/ScannerTestService.hxx64
-rw-r--r--writerfilter/unocomponent/debugservices/rtftok/XMLScanner.cxx306
-rw-r--r--writerfilter/unocomponent/debugservices/rtftok/XMLScanner.hxx64
16 files changed, 0 insertions, 1967 deletions
diff --git a/Repository.mk b/Repository.mk
index f01ee7395e0a..9389bbf7d74d 100755
--- a/Repository.mk
+++ b/Repository.mk
@@ -585,8 +585,6 @@ $(eval $(call gb_Helper_register_libraries,UNOLIBS_OOO, \
vbaobj \
vbaswobj \
vclcanvas \
- writerfilter_uno \
- writerfilter_debug \
$(if $(filter $(GUIBASE),aqua), \
fps_aqua \
) \
diff --git a/writerfilter/Library_writerfilter_uno.mk b/writerfilter/Library_writerfilter_uno.mk
deleted file mode 100644
index 7c98491a81b4..000000000000
--- a/writerfilter/Library_writerfilter_uno.mk
+++ /dev/null
@@ -1,64 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-# Version: MPL 1.1 / GPLv3+ / LGPLv3+
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License or as specified alternatively below. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# Major Contributor(s):
-# Copyright (C) 2010 Red Hat, Inc., David Tardon <dtardon@redhat.com>
-# (initial developer)
-#
-# All Rights Reserved.
-#
-# For minor contributions see the git repository.
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
-# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
-# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
-# instead of those above.
-
-$(eval $(call gb_Library_Library,writerfilter_uno))
-
-$(eval $(call gb_Library_set_include,writerfilter_uno,\
- $$(INCLUDE) \
- -I$(SRCDIR)/writerfilter/inc \
-))
-
-$(eval $(call gb_Library_add_defs,writerfilter_uno,\
- -DWRITERFILTER_WRITERFILTER_UNO_DLLIMPLEMENTATION \
-))
-
-$(eval $(call gb_Library_use_sdk_api,writerfilter_uno))
-
-$(eval $(call gb_Library_use_libraries,writerfilter_uno,\
- comphelper \
- cppu \
- cppuhelper \
- sal \
- writerfilter \
- $(gb_UWINAPI) \
-))
-
-$(eval $(call gb_Library_use_external,writerfilter_uno,libxml2))
-
-$(eval $(call gb_Library_add_exception_objects,writerfilter_uno,\
- writerfilter/unocomponent/component \
- writerfilter/unocomponent/debugservices/doctok/DocTokAnalyzeService \
- writerfilter/unocomponent/debugservices/doctok/DocTokTestService \
- writerfilter/unocomponent/debugservices/ooxml/OOXMLAnalyzeService \
- writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService \
-))
-
-# not used
- # writerfilter/unocomponent/debugservices/rtftok/ScannerTestService \
- # writerfilter/unocomponent/debugservices/rtftok/XMLScanner \
-
-# vim: set noet sw=4 ts=4:
diff --git a/writerfilter/Module_writerfilter.mk b/writerfilter/Module_writerfilter.mk
index 0b33587ba1b5..301e120948c8 100644
--- a/writerfilter/Module_writerfilter.mk
+++ b/writerfilter/Module_writerfilter.mk
@@ -30,7 +30,6 @@ $(eval $(call gb_Module_Module,writerfilter))
$(eval $(call gb_Module_add_targets,writerfilter,\
CustomTarget_source \
Library_writerfilter \
- Library_writerfilter_uno \
Package_sprmids \
))
diff --git a/writerfilter/unocomponent/component.cxx b/writerfilter/unocomponent/component.cxx
deleted file mode 100644
index 6de4fd83b432..000000000000
--- a/writerfilter/unocomponent/component.cxx
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * 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 .
- */
-
-#ifndef _CPPUHELPTER_FACTORY_
-#include <cppuhelper/factory.hxx>
-#endif
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-
-#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_
-#include <cppuhelper/implementationentry.hxx>
-#endif
-#include <debugservices/doctok/DocTokTestService.hxx>
-#include <debugservices/doctok/DocTokAnalyzeService.hxx>
-#include <debugservices/ooxml/OOXMLTestService.hxx>
-#include <debugservices/ooxml/OOXMLAnalyzeService.hxx>
-
-#include <stdio.h>
-
-using namespace com::sun::star;
-
-
-extern "C"
-{
-/* shared lib exports implemented with helpers */
-static struct ::cppu::ImplementationEntry s_component_entries [] =
-{//uno -l writerfilter.uno.dll -c debugservices.rtftok.ScannerTestService -- a b c
- DOCTOK_SCANNERTESTSERVICE_COMPONENT_ENTRY, /* debugservices.doctok.ScannerTestService */
- DOCTOK_ANALYZESERVICE_COMPONENT_ENTRY, /* debugservices.doctok.AnalyzeService */
- OOXML_SCANNERTESTSERVICE_COMPONENT_ENTRY, /* debugservices.ooxml.ScannerTestService */
- OOXML_ANALYZESERVICE_COMPONENT_ENTRY, /* debugservices.ooxml.AnalyzeService */
- { 0, 0, 0, 0, 0, 0 } // terminate with NULL
-};
-
-SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(sal_Char const * implName, ::com::sun::star::lang::XMultiServiceFactory * xMgr, ::com::sun::star::registry::XRegistryKey * xRegistry )
-{
- fprintf(stderr, "Loading service: %s: ", implName);
-
- void * pResult = ::cppu::component_getFactoryHelper(implName, xMgr, xRegistry, s_component_entries );
-
- fprintf(stderr, "%p\n", pResult);
-
- return pResult;
-}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/unocomponent/debugservices/doctok/DocTokAnalyzeService.cxx b/writerfilter/unocomponent/debugservices/doctok/DocTokAnalyzeService.cxx
deleted file mode 100644
index 352bdc7b3f54..000000000000
--- a/writerfilter/unocomponent/debugservices/doctok/DocTokAnalyzeService.cxx
+++ /dev/null
@@ -1,253 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * 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 .
- */
-
-#include "DocTokAnalyzeService.hxx"
-#include <stdio.h>
-#include <wchar.h>
-#include <com/sun/star/io/XStream.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-#include <com/sun/star/io/XTruncate.hpp>
-#include <com/sun/star/task/XStatusIndicator.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/ucb/SimpleFileAccess.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
-#include <osl/process.h>
-#include <rtl/string.hxx>
-#include <boost/unordered_set.hpp>
-#include <assert.h>
-#include <cppuhelper/implbase2.hxx>
-#include <com/sun/star/embed/XTransactedObject.hpp>
-#include <com/sun/star/embed/XStorage.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <comphelper/storagehelper.hxx>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <comphelper/seqstream.hxx>
-#include <resourcemodel/WW8ResourceModel.hxx>
-#include <resourcemodel/exceptions.hxx>
-#include <doctok/WW8Document.hxx>
-
-#include <ctype.h>
-
-using namespace ::com::sun::star;
-
-namespace writerfilter { namespace doctoktest {
-
-const sal_Char AnalyzeService::SERVICE_NAME[40] = "debugservices.doctok.AnalyzeService";
-const sal_Char AnalyzeService::IMPLEMENTATION_NAME[40] = "debugservices.doctok.AnalyzeService";
-
-class URLLister
-{
- uno::Reference<io::XInputStream> xInputStream;
- OUString mString;
- OUString mCRLF;
- OUString mLF;
-
- sal_uInt32 getEOLIndex()
- {
- sal_Int32 nIndex = mString.indexOf(mCRLF);
-
- if (nIndex == -1)
- {
- nIndex = mString.indexOf(mLF);
- }
-
- return nIndex;
- }
-
-public:
- URLLister(uno::Reference<com::sun::star::uno::XComponentContext> xContext,
- OUString absFileUrl)
- {
- uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
- xInputStream = xFileAccess->openFileRead(absFileUrl) ;
-
- mLF = OUString("\n");
- mCRLF = OUString("\r\n");
- }
-
- OUString getURL()
- {
- OUString aResult;
-
- sal_Int32 nIndex = getEOLIndex();
-
- while (nIndex == -1)
- {
- uno::Sequence<sal_Int8> aSeq;
- sal_uInt32 nCount = xInputStream->readBytes(aSeq, 1024);
-
- if (nCount > 0)
- {
- rtl_String * pNew = 0;
- rtl_string_newFromStr_WithLength
- (&pNew, reinterpret_cast<const sal_Char *>(&aSeq[0]),
- nCount);
-
- OString aTmp(pNew);
- OUString aTail(OStringToOUString
- (aTmp, RTL_TEXTENCODING_ASCII_US));
- mString = mString.concat(aTail);
- }
-
- nIndex = getEOLIndex();
-
- if (nCount != 1024)
- break;
- }
-
- if (nIndex > 0)
- {
- aResult = mString.copy(0, nIndex);
-
- if (mString.match(mCRLF, nIndex))
- mString = mString.copy(nIndex + 2);
- else
- mString = mString.copy(nIndex + 1);
- }
-
- return aResult;
- }
-};
-
-AnalyzeService::AnalyzeService(const uno::Reference< uno::XComponentContext > &xContext_) :
-xContext( xContext_ )
-{
-}
-
-sal_Int32 SAL_CALL AnalyzeService::run
-( const uno::Sequence< OUString >& aArguments )
- throw (uno::RuntimeException)
-{
- OUString arg=aArguments[0];
-
- rtl_uString *dir=NULL;
- osl_getProcessWorkingDir(&dir);
-
- OUString absFileUrlUrls;
- osl_getAbsoluteFileURL(dir, arg.pData, &absFileUrlUrls.pData);
-
- URLLister aLister(xContext, absFileUrlUrls);
-
- fprintf(stdout, "<analyze>\n");
-
- OUString aURL = aLister.getURL();
-
- while (!aURL.isEmpty())
- {
- uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
-
- OString aStr;
- aURL.convertToString(&aStr, RTL_TEXTENCODING_ASCII_US,
- OUSTRING_TO_OSTRING_CVTFLAGS);
-
- fprintf(stdout, "<file><name>%s</name>\n", aStr.getStr());
- fprintf(stderr, "%s\n", aStr.getStr());
- fflush(stderr);
-
- bool bStatus = true;
- try
- {
- try
- {
- uno::Reference<io::XInputStream> xInputStream =
- xFileAccess->openFileRead(aURL);
- {
- doctok::WW8Stream::Pointer_t pDocStream =
- doctok::WW8DocumentFactory::createStream
- (xContext, xInputStream);
-
- if (pDocStream.get() != NULL)
- {
- doctok::WW8Document::Pointer_t pDocument
- (doctok::WW8DocumentFactory::createDocument
- (pDocStream));
-
- Stream::Pointer_t pAnalyzer =
- writerfilter::createAnalyzer();
- pDocument->resolve(*pAnalyzer);
- }
- else
- {
- fprintf(stdout,
- "<exception>file open failed</exception>\n");
- bStatus = false;
- }
- fprintf(stderr, "done\n");
- }
-
- xInputStream->closeInput();
- }
- catch (const Exception &e)
- {
- fprintf(stdout, "<exception>%s</exception>\n",
- e.getText().c_str());
- bStatus = false;
- }
- }
- catch (...)
- {
- fprintf(stdout, "<exception>unknown</exception>\n");
- bStatus = false;
- }
-
- if (bStatus)
- fprintf(stdout, "<status>ok</status>\n");
- else
- fprintf(stdout, "<status>failed</status>\n");
-
- aURL = aLister.getURL();
-
- fprintf(stdout, "</file>\n");
- fflush(stdout);
- }
-
- fprintf(stdout, "</analyze>\n");
-
- rtl_uString_release(dir);
-
- return 0;
-}
-
-OUString AnalyzeService_getImplementationName ()
-{
- return OUString(AnalyzeService::IMPLEMENTATION_NAME );
-}
-
-sal_Bool SAL_CALL AnalyzeService_supportsService( const OUString& ServiceName )
-{
- return ServiceName == AnalyzeService::SERVICE_NAME;
-}
-uno::Sequence< OUString > SAL_CALL AnalyzeService_getSupportedServiceNames( ) throw (uno::RuntimeException)
-{
- uno::Sequence < OUString > aRet(1);
- OUString* pArray = aRet.getArray();
- pArray[0] = OUString(AnalyzeService::SERVICE_NAME );
- return aRet;
-}
-
-uno::Reference< uno::XInterface > SAL_CALL AnalyzeService_createInstance( const uno::Reference< uno::XComponentContext > & xContext) throw( uno::Exception )
-{
- return (cppu::OWeakObject*) new AnalyzeService( xContext );
-}
-
-} } /* end namespace writerfilter::doctok */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/unocomponent/debugservices/doctok/DocTokAnalyzeService.hxx b/writerfilter/unocomponent/debugservices/doctok/DocTokAnalyzeService.hxx
deleted file mode 100644
index 03039913c570..000000000000
--- a/writerfilter/unocomponent/debugservices/doctok/DocTokAnalyzeService.hxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * 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 .
- */
-
-#ifndef INCLUDED_DOCTOK_ANALYZESERVICE_HXX
-#define INCLUDED_DOCTOK_ANALYZESERVICE_HXX
-
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/lang/XMain.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-namespace writerfilter { namespace doctoktest {
-
-class AnalyzeService : public cppu::WeakImplHelper1 < ::com::sun::star::lang::XMain >
-{
-private:
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext;
-
-public:
- AnalyzeService(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &xContext);
-
- virtual ::sal_Int32 SAL_CALL run( const ::com::sun::star::uno::Sequence< OUString >& aArguments ) throw (::com::sun::star::uno::RuntimeException);
-
-public:
- const static sal_Char SERVICE_NAME[40];
- const static sal_Char IMPLEMENTATION_NAME[40];
-
-};
-
-OUString AnalyzeService_getImplementationName ();
-sal_Bool SAL_CALL AnalyzeService_supportsService( const OUString& ServiceName );
-::com::sun::star::uno::Sequence< OUString > SAL_CALL AnalyzeService_getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL AnalyzeService_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &xContext) throw( ::com::sun::star::uno::Exception );
-
-} } /* end namespace writerfilter::rtftok */
-
-#define DOCTOK_ANALYZESERVICE_COMPONENT_ENTRY \
-{\
- writerfilter::doctoktest::AnalyzeService_createInstance,\
- writerfilter::doctoktest::AnalyzeService_getImplementationName,\
- writerfilter::doctoktest::AnalyzeService_getSupportedServiceNames,\
- ::cppu::createSingleComponentFactory,\
- 0, 0\
-}
-
-
-#endif /* INCLUDED_RTFTOK_ANALYZESERVICE_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/unocomponent/debugservices/doctok/DocTokTestService.cxx b/writerfilter/unocomponent/debugservices/doctok/DocTokTestService.cxx
deleted file mode 100644
index 56d2c003f26e..000000000000
--- a/writerfilter/unocomponent/debugservices/doctok/DocTokTestService.cxx
+++ /dev/null
@@ -1,107 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * 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 .
- */
-
-#include "DocTokTestService.hxx"
-#include <stdio.h>
-#include <wchar.h>
-#include <com/sun/star/io/XStream.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-#include <com/sun/star/io/XTruncate.hpp>
-#include <com/sun/star/task/XStatusIndicator.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/ucb/SimpleFileAccess.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
-#include <osl/process.h>
-#include <rtl/string.hxx>
-#include <boost/unordered_set.hpp>
-#include <assert.h>
-#include <cppuhelper/implbase2.hxx>
-#include <com/sun/star/embed/XTransactedObject.hpp>
-#include <com/sun/star/embed/XStorage.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <comphelper/storagehelper.hxx>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <comphelper/seqstream.hxx>
-#include <resourcemodel/WW8ResourceModel.hxx>
-#include <resourcemodel/exceptions.hxx>
-#include <doctok/WW8Document.hxx>
-
-#include <ctype.h>
-
-using namespace ::com::sun::star;
-
-namespace writerfilter { namespace doctoktest {
-
-const sal_Char ScannerTestService::SERVICE_NAME[40] = "debugservices.doctok.ScannerTestService";
-const sal_Char ScannerTestService::IMPLEMENTATION_NAME[40] = "debugservices.doctok.ScannerTestService";
-
-
-
-
-ScannerTestService::ScannerTestService(const uno::Reference< uno::XComponentContext > &xContext_) :
-xContext( xContext_ )
-{
-}
-
-sal_Int32 SAL_CALL ScannerTestService::run( const uno::Sequence< OUString >& aArguments ) throw (uno::RuntimeException)
-{
- OUString arg=aArguments[0];
-
- uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
-
- rtl_uString *dir=NULL;
- osl_getProcessWorkingDir(&dir);
- OUString absFileUrl;
- osl_getAbsoluteFileURL(dir, arg.pData, &absFileUrl.pData);
- rtl_uString_release(dir);
-
- uno::Reference<io::XInputStream> xInputStream = xFileAccess->openFileRead(absFileUrl);
- doctok::WW8Stream::Pointer_t pDocStream = doctok::WW8DocumentFactory::createStream(xContext, xInputStream);
-
- doctok::WW8Document::Pointer_t pDocument(doctok::WW8DocumentFactory::createDocument(pDocStream));
-
- Stream::Pointer_t pStream = createStreamHandler();
- pDocument->resolve(*pStream);
-
- return 0;
-}
-
-OUString ScannerTestService_getImplementationName ()
-{
- return OUString(ScannerTestService::IMPLEMENTATION_NAME );
-}
-
-uno::Sequence< OUString > SAL_CALL ScannerTestService_getSupportedServiceNames( ) throw (uno::RuntimeException)
-{
- uno::Sequence < OUString > aRet(1);
- OUString* pArray = aRet.getArray();
- pArray[0] = OUString(ScannerTestService::SERVICE_NAME );
- return aRet;
-}
-
-uno::Reference< uno::XInterface > SAL_CALL ScannerTestService_createInstance( const uno::Reference< uno::XComponentContext > & xContext) throw( uno::Exception )
-{
- return (cppu::OWeakObject*) new ScannerTestService( xContext );
-}
-
-} } /* end namespace writerfilter::doctok */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/unocomponent/debugservices/doctok/DocTokTestService.hxx b/writerfilter/unocomponent/debugservices/doctok/DocTokTestService.hxx
deleted file mode 100644
index 1310c6bfbf44..000000000000
--- a/writerfilter/unocomponent/debugservices/doctok/DocTokTestService.hxx
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * 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 .
- */
-
-#ifndef INCLUDED_DOCTOK_SCANNERTESTSERVICE_HXX
-#define INCLUDED_DOCTOK_SCANNERTESTSERVICE_HXX
-
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/lang/XMain.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-namespace writerfilter { namespace doctoktest {
-
-class ScannerTestService : public cppu::WeakImplHelper1 < ::com::sun::star::lang::XMain >
-{
-private:
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext;
-
-public:
- ScannerTestService(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &xContext);
-
- virtual ::sal_Int32 SAL_CALL run( const ::com::sun::star::uno::Sequence< OUString >& aArguments ) throw (::com::sun::star::uno::RuntimeException);
-
-public:
- const static sal_Char SERVICE_NAME[40];
- const static sal_Char IMPLEMENTATION_NAME[40];
-
-};
-
-OUString ScannerTestService_getImplementationName ();
-::com::sun::star::uno::Sequence< OUString > SAL_CALL ScannerTestService_getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ScannerTestService_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &xContext) throw( ::com::sun::star::uno::Exception );
-
-} } /* end namespace writerfilter::rtftok */
-
-#define DOCTOK_SCANNERTESTSERVICE_COMPONENT_ENTRY \
-{\
- writerfilter::doctoktest::ScannerTestService_createInstance,\
- writerfilter::doctoktest::ScannerTestService_getImplementationName,\
- writerfilter::doctoktest::ScannerTestService_getSupportedServiceNames,\
- ::cppu::createSingleComponentFactory,\
- 0, 0\
-}
-
-
-#endif /* INCLUDED_RTFTOK_SCANNERTESTSERVICE_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/unocomponent/debugservices/ooxml/OOXMLAnalyzeService.cxx b/writerfilter/unocomponent/debugservices/ooxml/OOXMLAnalyzeService.cxx
deleted file mode 100644
index b8fd2428b565..000000000000
--- a/writerfilter/unocomponent/debugservices/ooxml/OOXMLAnalyzeService.cxx
+++ /dev/null
@@ -1,247 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * 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 .
- */
-
-#include "OOXMLAnalyzeService.hxx"
-#include <stdio.h>
-#include <wchar.h>
-#include <com/sun/star/io/XStream.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-#include <com/sun/star/io/XTruncate.hpp>
-#include <com/sun/star/task/XStatusIndicator.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/ucb/SimpleFileAccess.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
-#include <osl/process.h>
-#include <rtl/string.hxx>
-#include <boost/unordered_set.hpp>
-#include <assert.h>
-#include <cppuhelper/implbase2.hxx>
-#include <com/sun/star/embed/XTransactedObject.hpp>
-#include <com/sun/star/embed/XStorage.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <comphelper/storagehelper.hxx>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <comphelper/seqstream.hxx>
-#include <resourcemodel/WW8ResourceModel.hxx>
-#include <ooxml/OOXMLDocument.hxx>
-
-#include <ctype.h>
-
-using namespace ::com::sun::star;
-
-namespace writerfilter { namespace ooxmltest {
-
-const sal_Char AnalyzeService::SERVICE_NAME[40] = "debugservices.ooxml.AnalyzeService";
-const sal_Char AnalyzeService::IMPLEMENTATION_NAME[40] = "debugservices.ooxml.AnalyzeService";
-
-class URLLister
-{
- uno::Reference<io::XInputStream> xInputStream;
- OUString mString;
- OUString mCRLF;
- OUString mLF;
-
- sal_uInt32 getEOLIndex()
- {
- sal_Int32 nIndex = mString.indexOf(mCRLF);
-
- if (nIndex == -1)
- {
- nIndex = mString.indexOf(mLF);
- }
-
- return nIndex;
- }
-
-public:
- URLLister(uno::Reference<com::sun::star::uno::XComponentContext> xContext,
- OUString absFileUrl)
- {
- uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
- xInputStream = xFileAccess->openFileRead(absFileUrl) ;
-
- mLF = OUString("\n");
- mCRLF = OUString("\r\n");
- }
-
- OUString getURL()
- {
- OUString aResult;
-
- sal_Int32 nIndex = getEOLIndex();
-
- while (nIndex == -1)
- {
- uno::Sequence<sal_Int8> aSeq;
- sal_uInt32 nCount = xInputStream->readBytes(aSeq, 1024);
-
- if (nCount > 0)
- {
- rtl_String * pNew = 0;
- rtl_string_newFromStr_WithLength
- (&pNew, reinterpret_cast<const sal_Char *>(&aSeq[0]),
- nCount);
-
- OString aTmp(pNew);
- OUString aTail(OStringToOUString
- (aTmp, RTL_TEXTENCODING_ASCII_US));
- mString = mString.concat(aTail);
- }
-
- nIndex = getEOLIndex();
-
- if (nCount != 1024)
- break;
- }
-
- if (nIndex > 0)
- {
- aResult = mString.copy(0, nIndex);
-
- if (mString.match(mCRLF, nIndex))
- mString = mString.copy(nIndex + 2);
- else
- mString = mString.copy(nIndex + 1);
- }
-
- return aResult;
- }
-};
-
-AnalyzeService::AnalyzeService(const uno::Reference< uno::XComponentContext > &xContext_) :
-xContext( xContext_ )
-{
-}
-
-sal_Int32 SAL_CALL AnalyzeService::run
-( const uno::Sequence< OUString >& aArguments )
- throw (uno::RuntimeException)
-{
- OUString arg=aArguments[0];
-
- rtl_uString *dir=NULL;
- osl_getProcessWorkingDir(&dir);
-
- OUString absFileUrlUrls;
- osl_getAbsoluteFileURL(dir, arg.pData, &absFileUrlUrls.pData);
-
- URLLister aLister(xContext, absFileUrlUrls);
-
- fprintf(stdout, "<analyze>\n");
-
- writerfilter::analyzerIds();
-
- OUString aURL = aLister.getURL();
-
- while (!aURL.isEmpty())
- {
- uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
-
- OString aStr;
- aURL.convertToString(&aStr, RTL_TEXTENCODING_ASCII_US,
- OUSTRING_TO_OSTRING_CVTFLAGS);
-
- fprintf(stdout, "<file><name>%s</name>\n", aStr.getStr());
- fprintf(stderr, "%s\n", aStr.getStr());
- fflush(stderr);
-
- bool bStatus = true;
- try
- {
- uno::Reference<io::XInputStream> xInputStream =
- xFileAccess->openFileRead(aURL);
-
- if (xInputStream.is())
- {
- ooxml::OOXMLStream::Pointer_t pDocStream =
- ooxml::OOXMLDocumentFactory::createStream
- (xContext, xInputStream, false);
-
- if (pDocStream.get() != NULL)
- {
- ooxml::OOXMLDocument::Pointer_t pDocument
- (ooxml::OOXMLDocumentFactory::createDocument
- (pDocStream));
-
- Stream::Pointer_t pAnalyzer =
- writerfilter::createAnalyzer();
- pDocument->resolve(*pAnalyzer);
- }
- else
- {
- fprintf(stdout,
- "<exception>file open failed</exception>\n");
- bStatus = false;
- }
- fprintf(stderr, "done\n");
- }
-
- xInputStream->closeInput();
- }
- catch (...)
- {
- fprintf(stdout, "<exception>unknown</exception>\n");
- bStatus = false;
- }
-
- if (bStatus)
- fprintf(stdout, "<status>ok</status>\n");
- else
- fprintf(stdout, "<status>failed</status>\n");
-
- aURL = aLister.getURL();
-
- fprintf(stdout, "</file>\n");
- fflush(stdout);
- }
-
- fprintf(stdout, "</analyze>\n");
-
- rtl_uString_release(dir);
-
- return 0;
-}
-
-OUString AnalyzeService_getImplementationName ()
-{
- return OUString(AnalyzeService::IMPLEMENTATION_NAME );
-}
-
-sal_Bool SAL_CALL AnalyzeService_supportsService( const OUString& ServiceName )
-{
- return ServiceName == AnalyzeService::SERVICE_NAME;
-}
-uno::Sequence< OUString > SAL_CALL AnalyzeService_getSupportedServiceNames( ) throw (uno::RuntimeException)
-{
- uno::Sequence < OUString > aRet(1);
- OUString* pArray = aRet.getArray();
- pArray[0] = OUString(AnalyzeService::SERVICE_NAME );
- return aRet;
-}
-
-uno::Reference< uno::XInterface > SAL_CALL AnalyzeService_createInstance( const uno::Reference< uno::XComponentContext > & xContext) throw( uno::Exception )
-{
- return (cppu::OWeakObject*) new AnalyzeService( xContext );
-}
-
-} } /* end namespace writerfilter::doctok */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/unocomponent/debugservices/ooxml/OOXMLAnalyzeService.hxx b/writerfilter/unocomponent/debugservices/ooxml/OOXMLAnalyzeService.hxx
deleted file mode 100644
index 36038dcbaf1a..000000000000
--- a/writerfilter/unocomponent/debugservices/ooxml/OOXMLAnalyzeService.hxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * 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 .
- */
-
-#ifndef INCLUDED_OOXML_ANALYZE_SERVICE_HXX
-#define INCLUDED_OOXML_ANALYZE_SERVICE_HXX
-
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/lang/XMain.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-namespace writerfilter { namespace ooxmltest {
-
-class AnalyzeService : public cppu::WeakImplHelper1 < ::com::sun::star::lang::XMain >
-{
-private:
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext;
-
-public:
- AnalyzeService(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &xContext);
-
- virtual ::sal_Int32 SAL_CALL run( const ::com::sun::star::uno::Sequence< OUString >& aArguments ) throw (::com::sun::star::uno::RuntimeException);
-
-public:
- const static sal_Char SERVICE_NAME[40];
- const static sal_Char IMPLEMENTATION_NAME[40];
-
-};
-
-OUString AnalyzeService_getImplementationName ();
-sal_Bool SAL_CALL AnalyzeService_supportsService( const OUString& ServiceName );
-::com::sun::star::uno::Sequence< OUString > SAL_CALL AnalyzeService_getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL AnalyzeService_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &xContext) throw( ::com::sun::star::uno::Exception );
-
-} } /* end namespace writerfilter::rtftok */
-
-#define OOXML_ANALYZESERVICE_COMPONENT_ENTRY \
-{\
- writerfilter::ooxmltest::AnalyzeService_createInstance,\
- writerfilter::ooxmltest::AnalyzeService_getImplementationName,\
- writerfilter::ooxmltest::AnalyzeService_getSupportedServiceNames,\
- ::cppu::createSingleComponentFactory,\
- 0, 0\
-}
-
-
-#endif /* INCLUDED_OOXML_ANALYZE_SERVICE_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx b/writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx
deleted file mode 100644
index 4d1335b749bd..000000000000
--- a/writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.cxx
+++ /dev/null
@@ -1,126 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * 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 .
- */
-
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/lang/XMain.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-#include "OOXMLTestService.hxx"
-#include <stdio.h>
-#include <wchar.h>
-#include <com/sun/star/io/XStream.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-#include <com/sun/star/io/XTruncate.hpp>
-#include <com/sun/star/task/XStatusIndicator.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/ucb/SimpleFileAccess.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
-#include <osl/process.h>
-#include <rtl/string.hxx>
-#include <boost/unordered_set.hpp>
-#include <assert.h>
-#include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/bootstrap.hxx>
-#include <com/sun/star/embed/XTransactedObject.hpp>
-#include <com/sun/star/embed/XStorage.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <comphelper/storagehelper.hxx>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <comphelper/seqstream.hxx>
-#include <com/sun/star/text/XTextDocument.hpp>
-#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
-#include <ooxml/OOXMLDocument.hxx>
-#include <resourcemodel/TagLogger.hxx>
-
-#include <ctype.h>
-
-using namespace ::com::sun::star;
-
-namespace writerfilter { namespace ooxmltest {
-
-const sal_Char ScannerTestService::SERVICE_NAME[40] = "debugservices.ooxml.ScannerTestService";
-const sal_Char ScannerTestService::IMPLEMENTATION_NAME[40] = "debugservices.ooxml.ScannerTestService";
-
-
-
-
-ScannerTestService::ScannerTestService(const uno::Reference< uno::XComponentContext > &xContext_) :
-xContext( xContext_ )
-{
-}
-
-sal_Int32 SAL_CALL ScannerTestService::run( const uno::Sequence< OUString >& aArguments ) throw (uno::RuntimeException)
-{
-#ifdef DEBUG_ELEMENT
- writerfilter::TagLogger::Pointer_t debugLogger
- (writerfilter::TagLogger::getInstance("DEBUG"));
- debugLogger->startDocument();
-#endif
-
- OUString arg=aArguments[0];
-
- uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
-
- rtl_uString *dir=NULL;
- osl_getProcessWorkingDir(&dir);
- OUString absFileUrl;
- osl_getAbsoluteFileURL(dir, arg.pData, &absFileUrl.pData);
- rtl_uString_release(dir);
-
- uno::Reference<io::XInputStream> xInputStream =
- xFileAccess->openFileRead(absFileUrl);
- ooxml::OOXMLStream::Pointer_t pDocStream =
- ooxml::OOXMLDocumentFactory::createStream(xContext, xInputStream, false);
-
- ooxml::OOXMLDocument::Pointer_t pDocument
- (ooxml::OOXMLDocumentFactory::createDocument(pDocStream));
-
- Stream::Pointer_t pStream = createStreamHandler();
- pDocument->resolve(*pStream);
-
-#ifdef DEBUG_ELEMENT
- debugLogger->endDocument();
-#endif
-
- return 0;
-}
-
-OUString ScannerTestService_getImplementationName ()
-{
- return OUString(ScannerTestService::IMPLEMENTATION_NAME );
-}
-
-uno::Sequence< OUString > SAL_CALL ScannerTestService_getSupportedServiceNames( ) throw (uno::RuntimeException)
-{
- uno::Sequence < OUString > aRet(1);
- OUString* pArray = aRet.getArray();
- pArray[0] = OUString(ScannerTestService::SERVICE_NAME );
- return aRet;
-}
-
-uno::Reference< uno::XInterface > SAL_CALL ScannerTestService_createInstance( const uno::Reference< uno::XComponentContext > & xContext) throw( uno::Exception )
-{
- return (cppu::OWeakObject*) new ScannerTestService( xContext );
-}
-
-} } /* end namespace writerfilter::ooxml */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.hxx b/writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.hxx
deleted file mode 100644
index a2de044e4730..000000000000
--- a/writerfilter/unocomponent/debugservices/ooxml/OOXMLTestService.hxx
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * 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 .
- */
-
-#ifndef INCLUDED_OOXML_SCANNERTESTSERVICE_HXX
-#define INCLUDED_OOXML_SCANNERTESTSERVICE_HXX
-
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/lang/XMain.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-namespace writerfilter { namespace ooxmltest {
-
-class ScannerTestService : public cppu::WeakImplHelper1 < ::com::sun::star::lang::XMain >
-{
-private:
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext;
-
-public:
- ScannerTestService(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &xContext);
-
- virtual ::sal_Int32 SAL_CALL run( const ::com::sun::star::uno::Sequence< OUString >& aArguments ) throw (::com::sun::star::uno::RuntimeException);
-
-public:
- const static sal_Char SERVICE_NAME[40];
- const static sal_Char IMPLEMENTATION_NAME[40];
-
-};
-
-OUString ScannerTestService_getImplementationName ();
-::com::sun::star::uno::Sequence< OUString > SAL_CALL ScannerTestService_getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ScannerTestService_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &xContext) throw( ::com::sun::star::uno::Exception );
-
-} } /* end namespace writerfilter::ooxml */
-
-#define OOXML_SCANNERTESTSERVICE_COMPONENT_ENTRY \
-{\
- writerfilter::ooxmltest::ScannerTestService_createInstance,\
- writerfilter::ooxmltest::ScannerTestService_getImplementationName,\
- writerfilter::ooxmltest::ScannerTestService_getSupportedServiceNames,\
- ::cppu::createSingleComponentFactory,\
- 0, 0\
-}
-
-
-#endif /* INCLUDED_OOXML_SCANNERTESTSERVICE_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/unocomponent/debugservices/rtftok/ScannerTestService.cxx b/writerfilter/unocomponent/debugservices/rtftok/ScannerTestService.cxx
deleted file mode 100644
index 43ec23d4c28f..000000000000
--- a/writerfilter/unocomponent/debugservices/rtftok/ScannerTestService.cxx
+++ /dev/null
@@ -1,416 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * 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 .
- */
-
-#include "ScannerTestService.hxx"
-#include <stdio.h>
-#include <string.h>
-#include <wchar.h>
-#include <rtftok/RTFScanner.hxx>
-#include <rtftok/RTFScannerHandler.hxx>
-#include <com/sun/star/io/XStream.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-#include <com/sun/star/io/XTruncate.hpp>
-#include <com/sun/star/task/XStatusIndicator.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <ucbhelper/contentbroker.hxx>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-#include <osl/process.h>
-#include <rtl/string.hxx>
-#include <boost/unordered_set.hpp>
-#include <assert.h>
-#include <cppuhelper/implbase2.hxx>
-#include <com/sun/star/embed/XTransactedObject.hpp>
-#include <com/sun/star/embed/XStorage.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <comphelper/storagehelper.hxx>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <comphelper/seqstream.hxx>
-
-#include <ctype.h>
-
-using namespace ::com::sun::star;
-
-namespace writerfilter { namespace rtftok {
-
-const sal_Char ScannerTestService::SERVICE_NAME[40] = "debugservices.rtftok.ScannerTestService";
-const sal_Char ScannerTestService::IMPLEMENTATION_NAME[40] = "debugservices.rtftok.ScannerTestService";
-
-struct ScannerTestServiceHelper
-{
- size_t operator()(const OString &str) const
- {
- return str.hashCode();
- }
- bool operator()(const OString &str1, const OString &str2) const
- {
- return str1.compareTo(str2)==0;
- }
-};
-
-typedef ::boost::unordered_set< OString, ScannerTestServiceHelper, ScannerTestServiceHelper > ScannerTestServiceTokenMap;
-
-class MyRtfScannerHandler : public writerfilter::rtftok::RTFScannerHandler
-{
- ScannerTestServiceTokenMap destMap;
- ScannerTestServiceTokenMap ctrlMap;
- std::vector<unsigned char> binBuffer;
- int objDataLevel;
- int numOfOLEs;
- unsigned char hb;
- int numOfOLEChars;
- uno::Reference<lang::XMultiServiceFactory> xServiceFactory;
- uno::Reference<com::sun::star::ucb::XSimpleFileAccess> xFileAccess;
- uno::Reference<embed::XStorage> xStorage;
-
- void dest(char* token, char* /*value*/)
- {
- destMap.insert(OString(token));
- if (strcmp(token, "objdata")==0)
- {
- binBuffer.clear();
- objDataLevel=1;
- numOfOLEChars=0;
- }
- }
- void ctrl(char*token, char* /*value*/)
- {
- ctrlMap.insert(OString(token));
- }
- void lbrace(void)
- {
- }
- void rbrace(void)
- {
-#ifndef LINUX
- unsigned char * binBufferStr = ((unsigned char*)&(*binBuffer.begin()));
-
- if (objDataLevel)
- {
- int o=0;
- unsigned int type=((unsigned int)binBuffer[o]) | ((unsigned int)binBuffer[o+1])<<8 | ((unsigned int)binBuffer[o+2])<<16 | ((unsigned int)binBuffer[o+3]<<24); o+=4;
- unsigned int recType=((unsigned int)binBuffer[o]) | ((unsigned int)binBuffer[o+1])<<8 | ((unsigned int)binBuffer[o+2])<<16 | ((unsigned int)binBuffer[o+3]<<24); o+=4;
- unsigned int strLen=((unsigned int)binBuffer[o]) | ((unsigned int)binBuffer[o+1])<<8 | ((unsigned int)binBuffer[o+2])<<16 | ((unsigned int)binBuffer[o+3]<<24); o+=4;
- unsigned char *str=binBufferStr+o;
- o+=strLen;
- o+=4; // dummy1
- o+=4; // dummy2
- unsigned int binLen=((unsigned int)binBuffer[o]) | ((unsigned int)binBuffer[o+1])<<8 | ((unsigned int)binBuffer[o+2])<<16 | ((unsigned int)binBuffer[o+3]<<24); o+=4;
- printf("OLE%i \"%s\" type=%i recType=%i binBuffer.size()=%u len=%u\n", numOfOLEs, str, type, recType, (unsigned int)(binBuffer.size()), o+binLen);
- char buf[100];
- sprintf(buf, "ole%02i.ole", numOfOLEs);
-
- comphelper::ByteSequence seq(binLen);
- unsigned char *data0=binBufferStr;
- memcpy(seq.getArray(), data0+o, binLen);
- uno::Reference<io::XInputStream> myStream=new comphelper::SequenceInputStream(seq);
- uno::Sequence< uno::Any > aArgs0( 1 );
- aArgs0[0] <<= myStream;
- uno::Reference< container::XNameContainer > xNameContainer(
- xServiceFactory->createInstanceWithArguments(
- OUString("com.sun.star.embed.OLESimpleStorage"),
- aArgs0 ),
- uno::UNO_QUERY_THROW );
- try {
- printf("TRY\n");
- ::com::sun::star::uno::Sequence< OUString > names=xNameContainer->getElementNames();
- printf("OK\n");
-
- for(int i=0;i<names.getLength();i++)
- {
- OUString &name=names[i];
- wprintf(L"name=%s\n", name.getStr());
- }
- {
- uno::Reference< io::XStream > xContentStream = xStorage->openStreamElement(
- OUString::createFromAscii(buf), embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
- uno::Reference<beans::XPropertySet> xContentStreamPropSet(xContentStream, uno::UNO_QUERY_THROW);
- xContentStreamPropSet->setPropertyValue(OUString("MediaType"), uno::makeAny(OUString("application/vnd.sun.star.oleobject")));
- uno::Reference<io::XOutputStream> myOutStream=xContentStream->getOutputStream();
- uno::Sequence< ::sal_Int8 > seq1(binLen);
- unsigned char *data1=binBufferStr;
- memcpy(seq1.getArray(), data1+o, binLen);
- myOutStream->writeBytes(seq1);
- myOutStream->closeOutput();
- }
-
- } catch(com::sun::star::uno::RuntimeException &)
- {
- printf("NOT OK\n");
- comphelper::ByteSequence seq2(4+binLen);
- seq2[0]= sal::static_int_cast<sal_Int8>(binLen&0xFF);
- seq2[1]= sal::static_int_cast<sal_Int8>((binLen>>8)&0xFF);
- seq2[2]= sal::static_int_cast<sal_Int8>((binLen>>16)&0xFF);
- seq2[3]= sal::static_int_cast<sal_Int8>((binLen>>24)&0xFF);
- unsigned char *data2=binBufferStr;
- memcpy(seq2.getArray()+4, data2+o, binLen);
- uno::Reference<io::XInputStream> myInStream=new comphelper::SequenceInputStream(seq2);
- printf("SEQ OK\n");
-
- uno::Reference< io::XStream > xContentStream = xStorage->openStreamElement(
- OUString::createFromAscii(buf), embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
- uno::Reference<beans::XPropertySet> xContentStreamPropSet(xContentStream, uno::UNO_QUERY_THROW);
- xContentStreamPropSet->setPropertyValue(OUString("MediaType"), uno::makeAny(OUString("application/vnd.sun.star.oleobject")));
- printf("CONTENT STREAM OK\n");
-
- uno::Sequence< uno::Any > aArgs1( 1 );
- aArgs1[0] <<= xContentStream;
- uno::Reference< container::XNameContainer > xNameContainer2(
- xServiceFactory->createInstanceWithArguments(
- OUString("com.sun.star.embed.OLESimpleStorage"),
- aArgs1 ),
- uno::UNO_QUERY_THROW );
- printf("OLE STORAGE OK\n");
-
- uno::Any anyStream;
- anyStream <<= myInStream;
- xNameContainer2->insertByName(OUString("\1Ole10Native"), anyStream);
- printf("INSERT OK\n");
-
- uno::Reference<embed::XTransactedObject> xTransact(xNameContainer2, uno::UNO_QUERY);
- xTransact->commit();
- }
- objDataLevel--;
- numOfOLEs++;
- }
-#endif
- }
- void addSpaces(int /*count*/)
- {
- }
- void addBinData(unsigned char /*data*/)
- {
- }
- void addChar(char ch)
- {
- if (objDataLevel)
- {
- if (numOfOLEChars%2==0)
- {
- char c=sal::static_int_cast<char>(toupper(ch));
- assert((c<='F' && c>='A') || (c<='9' && c>='0'));
- if(c>='A') hb=(unsigned char)(c-'A'+10); else hb=(unsigned char)(c-'0');
- }
- else
- {
- unsigned char lb;
- char c=sal::static_int_cast<char>(toupper(ch));
- assert((c<='F' && c>='A') || (c<='9' && c>='0'));
- if(c>='A') lb=(unsigned char)(c-'A'+10); else lb=(unsigned char)(c-'0');
- unsigned char r=(hb<<4)|lb;
- binBuffer.push_back(r);
- }
- numOfOLEChars++;
- }
- }
- void addCharU(sal_Unicode /*ch*/)
- {
- }
- void addHexChar(char* /*hexch*/)
- {
- }
-
-
-public:
- MyRtfScannerHandler(uno::Reference<lang::XMultiServiceFactory> &xServiceFactory_, uno::Reference<com::sun::star::ucb::XSimpleFileAccess> &xFileAccess_, uno::Reference<embed::XStorage> &xStorage_) :
- objDataLevel(0), numOfOLEs(0),hb(0), numOfOLEChars(0),
- xServiceFactory(xServiceFactory_),
- xFileAccess(xFileAccess_),
- xStorage(xStorage_)
- {
- }
-
- virtual ~MyRtfScannerHandler() {}
-
- void dump()
- {
- printf("Destinations:\n");
- for(ScannerTestServiceTokenMap::iterator i=destMap.begin();i!=destMap.end();++i)
- {
- printf(" %s\n", i->getStr());
- }
- printf("Ctrls:\n");
- for(ScannerTestServiceTokenMap::iterator i=ctrlMap.begin();i!=ctrlMap.end();++i)
- {
- printf(" %s\n", i->getStr());
- }
- }
-};
-
-class RtfInputSourceImpl : public rtftok::RTFInputSource
-{
-private:
- uno::Reference< io::XInputStream > xInputStream;
- uno::Reference< io::XSeekable > xSeekable;
- uno::Reference< task::XStatusIndicator > xStatusIndicator;
- sal_Int64 bytesTotal;
- sal_Int64 bytesRead;
-public:
- RtfInputSourceImpl(uno::Reference< io::XInputStream > &xInputStream_, uno::Reference< task::XStatusIndicator > &xStatusIndicator_) :
- xInputStream(xInputStream_),
- xStatusIndicator(xStatusIndicator_),
- bytesRead(0)
- {
- xSeekable=uno::Reference< io::XSeekable >(xInputStream, uno::UNO_QUERY);
- if (xSeekable.is())
- bytesTotal=xSeekable->getLength();
- if (xStatusIndicator.is() && xSeekable.is())
- {
- xStatusIndicator->start(OUString("Converting"), 100);
- }
- }
-
- virtual ~RtfInputSourceImpl() {}
-
- int read(void *buf, int maxlen)
- {
- uno::Sequence< sal_Int8 > buffer;
- int len=xInputStream->readSomeBytes(buffer,maxlen);
- if (len>0)
- {
- sal_Int8 *_buffer=buffer.getArray();
- memcpy(buf, _buffer, len);
- bytesRead+=len;
- if (xStatusIndicator.is())
- {
- if (xSeekable.is())
- {
- xStatusIndicator->setValue((int)(bytesRead*100/bytesTotal));
- }
- else
- {
- char buf1[100];
- sprintf(buf1, "Converted %" SAL_PRIdINT64 " KB", bytesRead/1024);
- xStatusIndicator->start(OUString::createFromAscii(buf1), 0);
- }
- }
- return len;
- }
- else
- {
- if (xStatusIndicator.is())
- {
- xStatusIndicator->end();
- }
- return 0;
- }
- }
-};
-
-ScannerTestService::ScannerTestService(const uno::Reference< uno::XComponentContext > &xContext_) :
-xContext( xContext_ )
-{
-}
-
-sal_Int32 SAL_CALL ScannerTestService::run( const uno::Sequence< OUString >& aArguments ) throw (uno::RuntimeException)
-{
-
- printf("TEST\n");
-
- uno::Sequence<uno::Any> aUcbInitSequence(2);
- aUcbInitSequence[0] <<= OUString("Local");
- aUcbInitSequence[1] <<= OUString("Office");
- uno::Reference<lang::XMultiServiceFactory> xServiceFactory(xContext->getServiceManager(), uno::UNO_QUERY_THROW);
- printf("A\n");
- uno::Reference<lang::XMultiComponentFactory> xFactory(xContext->getServiceManager(), uno::UNO_QUERY_THROW );
- printf("B\n");
- if (::ucbhelper::ContentBroker::initialize(xServiceFactory, aUcbInitSequence))
- {
- printf("C\n");
- OUString arg=aArguments[0];
-
- uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
-
- rtl_uString *dir=NULL;
- osl_getProcessWorkingDir(&dir);
- OUString absFileUrl;
- osl_getAbsoluteFileURL(dir, arg.pData, &absFileUrl.pData);
- rtl_uString_release(dir);
-
- uno::Reference <lang::XSingleServiceFactory> xStorageFactory(
- xServiceFactory->createInstance (OUString("com.sun.star.embed.StorageFactory")), uno::UNO_QUERY_THROW);
-
- OUString outFileUrl;
- {
- rtl_uString *dir1=NULL;
- osl_getProcessWorkingDir(&dir1);
- osl_getAbsoluteFileURL(dir1, aArguments[1].pData, &outFileUrl.pData);
- rtl_uString_release(dir1);
- }
-
- uno::Sequence< uno::Any > aArgs2( 2 );
- aArgs2[0] <<= outFileUrl;
- aArgs2[1] <<= embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE;
- uno::Reference<embed::XStorage> xStorage(xStorageFactory->createInstanceWithArguments(aArgs2), uno::UNO_QUERY_THROW);
- uno::Reference<beans::XPropertySet> xPropSet(xStorage, uno::UNO_QUERY_THROW);
- xPropSet->setPropertyValue(OUString("MediaType"), uno::makeAny(OUString("application/vnd.oasis.opendocument.text")));
- uno::Reference<io::XInputStream> xInputStream = xFileAccess->openFileRead(absFileUrl);
- uno::Reference< task::XStatusIndicator > xStatusIndicator;
-
- TimeValue t1; osl_getSystemTime(&t1);
-
- RtfInputSourceImpl rtfInputSource(xInputStream, xStatusIndicator);
- MyRtfScannerHandler eventHandler(xServiceFactory, xFileAccess, xStorage);
- writerfilter::rtftok::RTFScanner *rtfScanner=writerfilter::rtftok::RTFScanner::createRTFScanner(rtfInputSource, eventHandler);
-
- rtfScanner->yylex();
- delete rtfScanner;
-
- TimeValue t2; osl_getSystemTime(&t2);
- printf("time=%" SAL_PRIuUINT32 "s\n", t2.Seconds-t1.Seconds);
-
- uno::Reference<embed::XTransactedObject> xTransact(xStorage, uno::UNO_QUERY);
- xTransact->commit();
-
-
- ::ucbhelper::ContentBroker::deinitialize();
- }
- else
- {
- fprintf(stderr, "can't initialize UCB");
- }
- return 0;
-}
-
-OUString ScannerTestService_getImplementationName ()
-{
- return OUString(ScannerTestService::IMPLEMENTATION_NAME );
-}
-
-sal_Bool SAL_CALL ScannerTestService_supportsService( const OUString& ServiceName )
-{
- return ServiceName == ScannerTestService::SERVICE_NAME;
-}
-uno::Sequence< OUString > SAL_CALL ScannerTestService_getSupportedServiceNames( ) throw (uno::RuntimeException)
-{
- uno::Sequence < OUString > aRet(1);
- OUString* pArray = aRet.getArray();
- pArray[0] = OUString(ScannerTestService::SERVICE_NAME );
- return aRet;
-}
-
-uno::Reference< uno::XInterface > SAL_CALL ScannerTestService_createInstance( const uno::Reference< uno::XComponentContext > & xContext) throw( uno::Exception )
-{
- return (cppu::OWeakObject*) new ScannerTestService( xContext );
-}
-
-} } /* end namespace writerfilter::rtftok */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/unocomponent/debugservices/rtftok/ScannerTestService.hxx b/writerfilter/unocomponent/debugservices/rtftok/ScannerTestService.hxx
deleted file mode 100644
index 61d4ed1bba70..000000000000
--- a/writerfilter/unocomponent/debugservices/rtftok/ScannerTestService.hxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * 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 .
- */
-
-#ifndef INCLUDED_RTFTOK_SCANNERTESTSERVICE_HXX
-#define INCLUDED_RTFTOK_SCANNERTESTSERVICE_HXX
-
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/lang/XMain.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-namespace writerfilter { namespace rtftok {
-
-class ScannerTestService : public cppu::WeakImplHelper1 < ::com::sun::star::lang::XMain >
-{
-private:
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext;
-
-public:
- ScannerTestService(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &xContext);
-
- virtual ::sal_Int32 SAL_CALL run( const ::com::sun::star::uno::Sequence< OUString >& aArguments ) throw (::com::sun::star::uno::RuntimeException);
-
-public:
- const static sal_Char SERVICE_NAME[40];
- const static sal_Char IMPLEMENTATION_NAME[40];
-
-};
-
-OUString ScannerTestService_getImplementationName ();
-sal_Bool SAL_CALL ScannerTestService_supportsService( const OUString& ServiceName );
-::com::sun::star::uno::Sequence< OUString > SAL_CALL ScannerTestService_getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ScannerTestService_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &xContext) throw( ::com::sun::star::uno::Exception );
-
-} } /* end namespace writerfilter::rtftok */
-
-#define RTFTOK_SCANNERTESTSERVICE_COMPONENT_ENTRY \
-{\
- writerfilter::rtftok::ScannerTestService_createInstance,\
- writerfilter::rtftok::ScannerTestService_getImplementationName,\
- writerfilter::rtftok::ScannerTestService_getSupportedServiceNames,\
- ::cppu::createSingleComponentFactory,\
- 0, 0\
-}
-
-
-#endif /* INCLUDED_RTFTOK_SCANNERTESTSERVICE_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/unocomponent/debugservices/rtftok/XMLScanner.cxx b/writerfilter/unocomponent/debugservices/rtftok/XMLScanner.cxx
deleted file mode 100644
index 819e92fa272e..000000000000
--- a/writerfilter/unocomponent/debugservices/rtftok/XMLScanner.cxx
+++ /dev/null
@@ -1,306 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * 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 .
- */
-
-#include "XMLScanner.hxx"
-#include <stdio.h>
-#include <string.h>
-#include <wchar.h>
-#include <rtftok/RTFScanner.hxx>
-#include <rtftok/RTFScannerHandler.hxx>
-#include <com/sun/star/io/XStream.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-#include <com/sun/star/io/XTruncate.hpp>
-#include <com/sun/star/task/XStatusIndicator.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <ucbhelper/contentbroker.hxx>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-#include <osl/process.h>
-#include <rtl/string.hxx>
-#include <boost/unordered_set.hpp>
-#include <assert.h>
-#include <string>
-#include <cppuhelper/implbase2.hxx>
-#include <com/sun/star/embed/XTransactedObject.hpp>
-#include <com/sun/star/embed/XStorage.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <comphelper/storagehelper.hxx>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <comphelper/seqstream.hxx>
-
-#include <ctype.h>
-#include <iostream>
-
-using namespace ::com::sun::star;
-using namespace ::std;
-
-namespace writerfilter { namespace rtftok {
-
-const sal_Char XMLScanner::SERVICE_NAME[40] = "debugservices.rtftok.XMLScanner";
-const sal_Char XMLScanner::IMPLEMENTATION_NAME[40] = "debugservices.rtftok.XMLScanner";
-
-class XmlRtfScannerHandler : public writerfilter::rtftok::RTFScannerHandler
-{
- std::vector<unsigned char> binBuffer;
- int objDataLevel;
- int numOfOLEs;
- unsigned char hb;
- int numOfOLEChars;
- uno::Reference<lang::XMultiServiceFactory> xServiceFactory;
- uno::Reference<com::sun::star::ucb::XSimpleFileAccess> xFileAccess;
- string charBuffer;
- string ucharBuffer;
- vector<string> vCloseTags;
-
- void xmlout(const string & str)
- {
- for (size_t n = 0; n < str.length(); ++n)
- {
- char c = str[n];
-
- switch (c)
- {
- case '<': cout << "&lt;"; break;
- case '>': cout << "&gt;"; break;
- case '&': cout << "&amp;"; break;
- default:
- cout << c;
-
- break;
- }
- }
- }
-
- void clearBuffers()
- {
- if (charBuffer.length() > 0)
- {
- cout << "<text>";
- xmlout(charBuffer);
- cout << "</text>" << endl;
- }
-
- charBuffer = "";
-
- if (ucharBuffer.length() > 0)
- {
- cout << "<utext>";
- xmlout(ucharBuffer);
- cout << ucharBuffer << "</utext>" << endl;
- }
-
- ucharBuffer = "";
- }
-
- void dest(char* token, char* value)
- {
- clearBuffers();
- cout << "<dest name=\"" << token << "\" value=\""<< value << "\">" << endl;
- vCloseTags.push_back("</dest>");
- }
- void ctrl(char*token, char* value)
- {
- clearBuffers();
- cout << "<" << token << ">" << value << "</" << token << ">"
- << endl;
- }
- void lbrace(void)
- {
- clearBuffers();
- cout << "<brace>" << endl;
- vCloseTags.push_back("</brace>");
- }
- void rbrace(void)
- {
- clearBuffers();
- cout << vCloseTags.back() << endl;
- vCloseTags.pop_back();
- }
- void addSpaces(int count)
- {
- clearBuffers();
- cout << "<spaces count=\"" << count << "\"/>" << endl;
- }
- void addBinData(unsigned char /*data*/)
- {
- clearBuffers();
- cout << "<bindata/>" << endl;
- }
- void addChar(char ch)
- {
- charBuffer += ch;
- }
- void addCharU(sal_Unicode ch)
- {
- ucharBuffer += sal_Char(ch < 128 ? ch : '.');
- }
- void addHexChar(char* hexch)
- {
- clearBuffers();
- cout << "<hexchar value=\"" << hexch << "\"/>" << endl;
- }
-
-public:
- XmlRtfScannerHandler(uno::Reference<lang::XMultiServiceFactory> &xServiceFactory_, uno::Reference<com::sun::star::ucb::XSimpleFileAccess> &xFileAccess_) :
- objDataLevel(0), numOfOLEs(0),hb(0),numOfOLEChars(0),
- xServiceFactory(xServiceFactory_),
- xFileAccess(xFileAccess_)
- {
- }
-
- virtual ~XmlRtfScannerHandler() {}
-
- void dump()
- {
- }
-};
-
-class RtfInputSourceImpl : public rtftok::RTFInputSource
-{
-private:
- uno::Reference< io::XInputStream > xInputStream;
- uno::Reference< io::XSeekable > xSeekable;
- uno::Reference< task::XStatusIndicator > xStatusIndicator;
- sal_Int64 bytesTotal;
- sal_Int64 bytesRead;
-public:
- RtfInputSourceImpl(uno::Reference< io::XInputStream > &xInputStream_, uno::Reference< task::XStatusIndicator > &xStatusIndicator_) :
- xInputStream(xInputStream_),
- xStatusIndicator(xStatusIndicator_),
- bytesRead(0)
- {
- xSeekable=uno::Reference< io::XSeekable >(xInputStream, uno::UNO_QUERY);
- if (xSeekable.is())
- bytesTotal=xSeekable->getLength();
- if (xStatusIndicator.is() && xSeekable.is())
- {
- xStatusIndicator->start(OUString("Converting"), 100);
- }
- }
-
- virtual ~RtfInputSourceImpl() {}
-
- int read(void *buf, int maxlen)
- {
- uno::Sequence< sal_Int8 > buffer;
- int len=xInputStream->readSomeBytes(buffer,maxlen);
- if (len>0)
- {
- sal_Int8 *_buffer=buffer.getArray();
- memcpy(buf, _buffer, len);
- bytesRead+=len;
- if (xStatusIndicator.is())
- {
- if (xSeekable.is())
- {
- xStatusIndicator->setValue((int)(bytesRead*100/bytesTotal));
- }
- else
- {
- char buf1[100];
- sprintf(buf1, "Converted %" SAL_PRIdINT64 " KB", bytesRead/1024);
- xStatusIndicator->start(OUString::createFromAscii(buf1), 0);
- }
- }
- return len;
- }
- else
- {
- if (xStatusIndicator.is())
- {
- xStatusIndicator->end();
- }
- return 0;
- }
- }
-};
-
-XMLScanner::XMLScanner(const uno::Reference< uno::XComponentContext > &xContext_) :
-xContext( xContext_ )
-{
-}
-
-sal_Int32 SAL_CALL XMLScanner::run( const uno::Sequence< OUString >& aArguments ) throw (uno::RuntimeException)
-{
- uno::Sequence<uno::Any> aUcbInitSequence(2);
- aUcbInitSequence[0] <<= OUString("Local");
- aUcbInitSequence[1] <<= OUString("Office");
- uno::Reference<lang::XMultiServiceFactory> xServiceFactory(xContext->getServiceManager(), uno::UNO_QUERY_THROW);
- if (::ucbhelper::ContentBroker::initialize(xServiceFactory, aUcbInitSequence))
- {
- OUString arg=aArguments[0];
-
- uno::Reference<ucb::XSimpleFileAccess2> xFileAccess(ucb::SimpleFileAccess::create(xContext));
-
- rtl_uString *dir=NULL;
- osl_getProcessWorkingDir(&dir);
- OUString absFileUrl;
- osl_getAbsoluteFileURL(dir, arg.pData, &absFileUrl.pData);
- rtl_uString_release(dir);
-
- uno::Reference <lang::XSingleServiceFactory> xStorageFactory(
- xServiceFactory->createInstance (OUString("com.sun.star.embed.StorageFactory")), uno::UNO_QUERY_THROW);
-
- uno::Reference<io::XInputStream> xInputStream = xFileAccess->openFileRead(absFileUrl);
- uno::Reference< task::XStatusIndicator > xStatusIndicator;
-
- RtfInputSourceImpl rtfInputSource(xInputStream, xStatusIndicator);
- XmlRtfScannerHandler eventHandler(xServiceFactory, xFileAccess);
- writerfilter::rtftok::RTFScanner *rtfScanner=writerfilter::rtftok::RTFScanner::createRTFScanner(rtfInputSource, eventHandler);
-
- cout << "<out>" << endl;
- rtfScanner->yylex();
- cout << "</out>" << endl;
- delete rtfScanner;
-
- ::ucbhelper::ContentBroker::deinitialize();
- }
- else
- {
- fprintf(stderr, "can't initialize UCB");
- }
- return 0;
-}
-
-OUString XMLScanner_getImplementationName ()
-{
- return OUString(XMLScanner::IMPLEMENTATION_NAME );
-}
-
-sal_Bool SAL_CALL XMLScanner_supportsService( const OUString& ServiceName )
-{
- return ServiceName == XMLScanner::SERVICE_NAME;
-}
-uno::Sequence< OUString > SAL_CALL XMLScanner_getSupportedServiceNames( ) throw (uno::RuntimeException)
-{
- uno::Sequence < OUString > aRet(1);
- OUString* pArray = aRet.getArray();
- pArray[0] = OUString(XMLScanner::SERVICE_NAME );
- return aRet;
-}
-
-uno::Reference< uno::XInterface > SAL_CALL XMLScanner_createInstance( const uno::Reference< uno::XComponentContext > & xContext) throw( uno::Exception )
-{
- return (cppu::OWeakObject*) new XMLScanner( xContext );
-}
-
-} } /* end namespace writerfilter::rtftok */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/unocomponent/debugservices/rtftok/XMLScanner.hxx b/writerfilter/unocomponent/debugservices/rtftok/XMLScanner.hxx
deleted file mode 100644
index 10be77462aaf..000000000000
--- a/writerfilter/unocomponent/debugservices/rtftok/XMLScanner.hxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * 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 .
- */
-
-#ifndef INCLUDED_RTFTOK_XMLSCANNER_HXX
-#define INCLUDED_RTFTOK_XMLSCANNER_HXX
-
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/lang/XMain.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-namespace writerfilter { namespace rtftok {
-
-class XMLScanner : public cppu::WeakImplHelper1 < ::com::sun::star::lang::XMain >
-{
-private:
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext;
-
-public:
- XMLScanner(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &xContext);
-
- virtual ::sal_Int32 SAL_CALL run( const ::com::sun::star::uno::Sequence< OUString >& aArguments ) throw (::com::sun::star::uno::RuntimeException);
-
-public:
- const static sal_Char SERVICE_NAME[40];
- const static sal_Char IMPLEMENTATION_NAME[40];
-
-};
-
-OUString XMLScanner_getImplementationName ();
-sal_Bool SAL_CALL XMLScanner_supportsService( const OUString& ServiceName );
-::com::sun::star::uno::Sequence< OUString > SAL_CALL XMLScanner_getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL XMLScanner_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &xContext) throw( ::com::sun::star::uno::Exception );
-
-} } /* end namespace writerfilter::rtftok */
-
-#define RTFTOK_XMLSCANNER_COMPONENT_ENTRY \
-{\
- writerfilter::rtftok::XMLScanner_createInstance,\
- writerfilter::rtftok::XMLScanner_getImplementationName,\
- writerfilter::rtftok::XMLScanner_getSupportedServiceNames,\
- ::cppu::createSingleComponentFactory,\
- 0, 0\
-}
-
-
-#endif /* INCLUDED_RTFTOK_SCANNERTESTSERVICE_HXX */
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */