[Libreoffice-commits] .: 4 commits - filter/inc filter/source
Jan Holesovsky
kendy at kemper.freedesktop.org
Thu Feb 3 08:56:53 PST 2011
filter/inc/registration.hxx | 217 ++++++++++
filter/source/config/cache/registration.hxx | 217 ----------
filter/source/config/fragments/filters/ODG_FlatXML.xcu | 2
filter/source/config/fragments/filters/ODP_FlatXML.xcu | 2
filter/source/config/fragments/filters/ODS_FlatXML.xcu | 2
filter/source/config/fragments/filters/ODT_FlatXML.xcu | 2
filter/source/odfflatxml/FlatXml.cxx | 365 -----------------
filter/source/odfflatxml/FlatXml.hxx | 144 ------
filter/source/odfflatxml/OdfFlatXml.cxx | 255 +++++++++++
filter/source/odfflatxml/makefile.mk | 2
filter/source/odfflatxml/odfflatxmlexport.xsl | 16
filter/source/odfflatxml/odfflatxmlimport.xsl | 10
filter/source/odfflatxml/split-long-lines.xsl | 98 ----
13 files changed, 477 insertions(+), 855 deletions(-)
New commits:
commit 15aec6083b990c3c4a4b9d3ccacf0d33ddf24d0a
Author: Peter Jentsch <pjotr at guineapics.de>
Date: Wed Feb 2 01:22:45 2011 +0100
fixed flat xml export service name in configuration files
diff --git a/filter/source/config/fragments/filters/ODG_FlatXML.xcu b/filter/source/config/fragments/filters/ODG_FlatXML.xcu
index f528248..0e386ad 100644
--- a/filter/source/config/fragments/filters/ODG_FlatXML.xcu
+++ b/filter/source/config/fragments/filters/ODG_FlatXML.xcu
@@ -3,7 +3,7 @@
<prop oor:name="Type"><value>draw_ODG_FlatXML</value></prop>
<prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
<prop oor:name="UIComponent"/>
- <prop oor:name="UserData"><value oor:separator=",">com.sun.star.comp.filter.FlatXmlCpp,,com.sun.star.comp.Draw.XMLOasisImporter,com.sun.star.comp.Draw.XMLOasisExporter,,,true</value></prop>
+ <prop oor:name="UserData"><value oor:separator=",">com.sun.star.comp.filter.OdfFlatXml,,com.sun.star.comp.Draw.XMLOasisImporter,com.sun.star.comp.Draw.XMLOasisExporter,,,true</value></prop>
<prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
<prop oor:name="TemplateName"/>
<prop oor:name="UIName">
diff --git a/filter/source/config/fragments/filters/ODP_FlatXML.xcu b/filter/source/config/fragments/filters/ODP_FlatXML.xcu
index 8f15d7c..121cb2d 100644
--- a/filter/source/config/fragments/filters/ODP_FlatXML.xcu
+++ b/filter/source/config/fragments/filters/ODP_FlatXML.xcu
@@ -3,7 +3,7 @@
<prop oor:name="Type"><value>impress_ODP_FlatXML</value></prop>
<prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
<prop oor:name="UIComponent"/>
- <prop oor:name="UserData"><value oor:separator=",">com.sun.star.comp.filter.FlatXmlCpp,,com.sun.star.comp.Impress.XMLOasisImporter,com.sun.star.comp.Impress.XMLOasisExporter,,,true</value></prop>
+ <prop oor:name="UserData"><value oor:separator=",">com.sun.star.comp.filter.OdfFlatXml,,com.sun.star.comp.Impress.XMLOasisImporter,com.sun.star.comp.Impress.XMLOasisExporter,,,true</value></prop>
<prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
<prop oor:name="TemplateName"/>
<prop oor:name="UIName">
diff --git a/filter/source/config/fragments/filters/ODS_FlatXML.xcu b/filter/source/config/fragments/filters/ODS_FlatXML.xcu
index df8e856..7ae34aa 100644
--- a/filter/source/config/fragments/filters/ODS_FlatXML.xcu
+++ b/filter/source/config/fragments/filters/ODS_FlatXML.xcu
@@ -3,7 +3,7 @@
<prop oor:name="Type"><value>calc_ODS_FlatXML</value></prop>
<prop oor:name="DocumentService"><value>com.sun.star.sheet.SpreadsheetDocument</value></prop>
<prop oor:name="UIComponent"/>
- <prop oor:name="UserData"><value oor:separator=",">com.sun.star.comp.filter.FlatXmlCpp,,com.sun.star.comp.Calc.XMLOasisImporter,com.sun.star.comp.Calc.XMLOasisExporter,,,true</value></prop>
+ <prop oor:name="UserData"><value oor:separator=",">com.sun.star.comp.filter.OdfFlatXml,,com.sun.star.comp.Calc.XMLOasisImporter,com.sun.star.comp.Calc.XMLOasisExporter,,,true</value></prop>
<prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
<prop oor:name="TemplateName"/>
<prop oor:name="UIName">
diff --git a/filter/source/config/fragments/filters/ODT_FlatXML.xcu b/filter/source/config/fragments/filters/ODT_FlatXML.xcu
index cf764ec..e08d39d 100644
--- a/filter/source/config/fragments/filters/ODT_FlatXML.xcu
+++ b/filter/source/config/fragments/filters/ODT_FlatXML.xcu
@@ -3,7 +3,7 @@
<prop oor:name="Type"><value>writer_ODT_FlatXML</value></prop>
<prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
<prop oor:name="UIComponent"/>
- <prop oor:name="UserData"><value oor:separator=",">com.sun.star.comp.filter.FlatXmlCpp,,com.sun.star.comp.Writer.XMLOasisImporter,com.sun.star.comp.Writer.XMLOasisExporter,,,true</value></prop>
+ <prop oor:name="UserData"><value oor:separator=",">com.sun.star.comp.filter.OdfFlatXml,,com.sun.star.comp.Writer.XMLOasisImporter,com.sun.star.comp.Writer.XMLOasisExporter,,,true</value></prop>
<prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
<prop oor:name="TemplateName"/>
<prop oor:name="UIName">
commit f020554ea2d682a45b6a7500a0a4fbee5e86d88b
Author: Peter Jentsch <pjotr at guineapics.de>
Date: Wed Feb 2 23:12:36 2011 +0100
Simplified implementation of the flat xml import/export.
It still lacks the line-wrapping provided by the xslt script
"split-long-lines.xsl", will be provided later.
diff --git a/filter/source/odfflatxml/FlatXml.cxx b/filter/source/odfflatxml/FlatXml.cxx
deleted file mode 100644
index 6bf7c60..0000000
--- a/filter/source/odfflatxml/FlatXml.cxx
+++ /dev/null
@@ -1,365 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * The Contents of this file are made available subject to the terms of
- * the BSD license.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *************************************************************************/
-
-#include <cppuhelper/factory.hxx>
-#include <cppuhelper/servicefactory.hxx>
-#include <cppuhelper/implbase1.hxx>
-#include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/implbase3.hxx>
-#include <cppuhelper/implbase.hxx>
-
-#include <com/sun/star/lang/XComponent.hpp>
-
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Type.hxx>
-
-#include <com/sun/star/beans/PropertyValue.hpp>
-
-#include <com/sun/star/xml/sax/XParser.hpp>
-#include <com/sun/star/xml/sax/InputSource.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
-#include <com/sun/star/xml/sax/SAXException.hpp>
-#include <com/sun/star/xml/XImportFilter.hpp>
-#include <com/sun/star/xml/XExportFilter.hpp>
-
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XOutputStream.hpp>
-#include <com/sun/star/io/XActiveDataSource.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-
-#include "FlatXml.hxx"
-
-using namespace ::rtl;
-using namespace ::cppu;
-using namespace ::osl;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::io;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::registry;
-using namespace ::com::sun::star::xml;
-using namespace ::com::sun::star::xml::sax;
-
-namespace XFlatXml
-{
-
- sal_Bool
- XFlatXml::importer(const Sequence<PropertyValue>& aSourceData,
- const Reference<XDocumentHandler>& xHandler, const Sequence<
- OUString>& /* msUserData */) throw (RuntimeException)
- {
- // get information from media descriptor
- // the imput stream that represents the imported file
- // is most important here since we need to supply it to
- // the sax parser that drives the supplied document handler
- sal_Int32 nLength = aSourceData.getLength();
- OUString aName, aFileName, aURL;
- Reference<XInputStream> xInputStream;
- for (sal_Int32 i = 0; i < nLength; i++)
- {
- aName = aSourceData[i].Name;
- if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("InputStream")))
- aSourceData[i].Value >>= xInputStream;
- else if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("FileName")))
- aSourceData[i].Value >>= aFileName;
- else if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("URL")))
- aSourceData[i].Value >>= aURL;
- }
-
- // we need an input stream
- OSL_ASSERT(xInputStream.is());
- if (!xInputStream.is())
- return sal_False;
-
- // rewind seekable stream
- Reference<XSeekable> xSeek(xInputStream, UNO_QUERY);
- if (xSeek.is())
- xSeek->seek(0);
-
- // create SAX parser that will read the document file
- // and provide events to xHandler passed to this call
- Reference<XParser>
- xSaxParser(
- m_rServiceFactory->createInstance(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser"))),
- UNO_QUERY);
- OSL_ASSERT(xSaxParser.is());
- if (!xSaxParser.is())
- return sal_False;
-
- // let the parser try to send the sax event to the document handler
- try
- {
- InputSource aInput;
- aInput.sSystemId = aURL;
- aInput.sPublicId = aURL;
- aInput.aInputStream = xInputStream;
- xSaxParser->setDocumentHandler(xHandler);
- xSaxParser->parseStream(aInput);
- }
- catch (Exception &exc)
- {
- // something went wrong
- OString msg = OUStringToOString(exc.Message,
- RTL_TEXTENCODING_ASCII_US);
- OSL_ENSURE(0, msg);
- return sal_False;
- }
-
- // done
- return sal_True;
- }
-
- sal_Bool
- XFlatXml::exporter(const Sequence<PropertyValue>& aSourceData,
- const Sequence<OUString>& /*msUserData*/) throw (RuntimeException)
- {
-
- // read source data
- // we are especialy interested in the output stream
- // since that is where our xml-writer will push the data
- // from it's data-source interface
- OUString aName, sURL;
- Reference<XOutputStream> rOutputStream;
- sal_Int32 nLength = aSourceData.getLength();
- for (sal_Int32 i = 0; i < nLength; i++)
- {
- aName = aSourceData[i].Name;
- if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("OutputStream")))
- aSourceData[i].Value >>= rOutputStream;
- else if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("URL")))
- aSourceData[i].Value >>= sURL;
- }
-
- if (!m_rDocumentHandler.is())
- {
- // get the document writer
- m_rDocumentHandler
- = Reference<XExtendedDocumentHandler> (
- m_rServiceFactory->createInstance(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer"))),
- UNO_QUERY);
- OSL_ASSERT(m_rDocumentHandler.is());
- if (!m_rDocumentHandler.is())
- return sal_False;
- }
- // get data source interface ...
- Reference<XActiveDataSource> rDataSource(m_rDocumentHandler, UNO_QUERY);
- OSL_ASSERT(rDataSource.is());
- if (!rDataSource.is())
- return sal_False;
- OSL_ASSERT(rOutputStream.is());
- if (!rOutputStream.is())
- return sal_False;
- // ... and set output stream
- rDataSource->setOutputStream(rOutputStream);
-
- return sal_True;
- }
-
- // for the DocumentHandler implementation, we just proxy the the
- // events to the XML writer that we created upon the output stream
- // that was provided by the XMLFilterAdapter
- void
- XFlatXml::startDocument() throw (SAXException, RuntimeException)
- {
- OSL_ASSERT(m_rDocumentHandler.is());
- m_rDocumentHandler->startDocument();
- }
-
- void
- XFlatXml::endDocument() throw (SAXException, RuntimeException)
- {
- OSL_ASSERT(m_rDocumentHandler.is());
- m_rDocumentHandler->endDocument();
- }
-
- void
- XFlatXml::startElement(const OUString& str,
- const Reference<XAttributeList>& attriblist) throw (SAXException,
- RuntimeException)
- {
- OSL_ASSERT(m_rDocumentHandler.is());
- m_rDocumentHandler->startElement(str, attriblist);
- }
-
- void
- XFlatXml::endElement(const OUString& str) throw (SAXException,
- RuntimeException)
- {
- OSL_ASSERT(m_rDocumentHandler.is());
- m_rDocumentHandler->endElement(str);
- }
-
- void
- XFlatXml::characters(const OUString& str) throw (SAXException,
- RuntimeException)
- {
- OSL_ASSERT(m_rDocumentHandler.is());
- m_rDocumentHandler->characters(str);
- }
-
- void
- XFlatXml::ignorableWhitespace(const OUString& str) throw (SAXException,
- RuntimeException)
- {
- OSL_ASSERT(m_rDocumentHandler.is());
- if (!m_bPrettyPrint)
- return;
- m_rDocumentHandler->ignorableWhitespace(str);
- }
-
- void
- XFlatXml::processingInstruction(const OUString& str, const OUString& str2)
- throw (SAXException, RuntimeException)
- {
- OSL_ASSERT(m_rDocumentHandler.is());
- m_rDocumentHandler->processingInstruction(str, str2);
- }
-
- void
- XFlatXml::setDocumentLocator(const Reference<XLocator>& doclocator)
- throw (SAXException, RuntimeException)
- {
- OSL_ASSERT(m_rDocumentHandler.is());
- m_rDocumentHandler->setDocumentLocator(doclocator);
- }
-
- // --------------------------------------
- // Component management
- // --------------------------------------
- Reference<XInterface> SAL_CALL
- CreateInstance(const Reference<XMultiServiceFactory> &r)
- {
- return Reference<XInterface> ((OWeakObject *) new XFlatXml(r));
- }
-
- Sequence<OUString>
- getSupportedServiceNames()
- {
- static Sequence<OUString> *pNames = 0;
- if (!pNames)
- {
- MutexGuard guard(Mutex::getGlobalMutex());
- if (!pNames)
- {
- static Sequence<OUString> seqNames(2);
- seqNames.getArray()[0] = OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.document.ImportFilter"));
- seqNames.getArray()[1] = OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.document.ExportFilter"));
- pNames = &seqNames;
- }
- }
- return *pNames;
- }
-
-}
-
-using namespace XFlatXml;
-#define IMPLEMENTATION_NAME "com.sun.star.comp.filter.FlatXmlCpp"
-
-extern "C"
-{
- void SAL_CALL
- component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,
- uno_Environment ** /* ppEnv */)
- {
- *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
- }
-
- sal_Bool SAL_CALL
- component_writeInfo(void * /* pServiceManager */, void * pRegistryKey)
- {
- if (pRegistryKey)
- {
- try
- {
- Reference<XRegistryKey>
- xNewKey(
- reinterpret_cast<XRegistryKey *> (pRegistryKey)->createKey(
- OUString(
- RTL_CONSTASCII_USTRINGPARAM( "/" IMPLEMENTATION_NAME "/UNO/SERVICES" ))));
-
- const Sequence<OUString> & rSNL =
- getSupportedServiceNames();
- const OUString * pArray = rSNL.getConstArray();
- for (sal_Int32 nPos = rSNL.getLength(); nPos--;)
- xNewKey->createKey(pArray[nPos]);
-
- return sal_True;
- }
- catch (InvalidRegistryException &)
- {
- OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
- }
- }
- return sal_False;
- }
-
- void *
- SAL_CALL component_getFactory(const sal_Char * pImplName,
- void * pServiceManager, void * /* pRegistryKey */)
- {
- void * pRet = 0;
-
- if (pServiceManager && rtl_str_compare(pImplName, IMPLEMENTATION_NAME)
- == 0)
- {
- Reference<XSingleServiceFactory>
- xFactory(
- createSingleFactory(
- reinterpret_cast<XMultiServiceFactory *> (pServiceManager),
- OUString::createFromAscii(pImplName),
- CreateInstance,
- getSupportedServiceNames()));
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
- return pRet;
- }
-
-} // extern "C"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/odfflatxml/FlatXml.hxx b/filter/source/odfflatxml/FlatXml.hxx
deleted file mode 100644
index 8b72f1e..0000000
--- a/filter/source/odfflatxml/FlatXml.hxx
+++ /dev/null
@@ -1,144 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * The Contents of this file are made available subject to the terms of
- * the BSD license.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *************************************************************************/
-#ifndef __XFLATXML_HXX__
-#define __XFLATXML_HXX__
-
-#include <cppuhelper/factory.hxx>
-#include <cppuhelper/servicefactory.hxx>
-#include <cppuhelper/implbase1.hxx>
-#include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/implbase3.hxx>
-#include <cppuhelper/implbase.hxx>
-
-#include <com/sun/star/lang/XComponent.hpp>
-
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Type.hxx>
-
-#include <com/sun/star/beans/PropertyValue.hpp>
-
-#include <com/sun/star/xml/sax/XParser.hpp>
-#include <com/sun/star/xml/sax/InputSource.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
-#include <com/sun/star/xml/sax/SAXException.hpp>
-#include <com/sun/star/xml/XImportFilter.hpp>
-#include <com/sun/star/xml/XExportFilter.hpp>
-
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XOutputStream.hpp>
-#include <com/sun/star/io/XActiveDataSource.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-
-using namespace ::rtl;
-using namespace ::cppu;
-using namespace ::osl;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::io;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::registry;
-using namespace ::com::sun::star::xml;
-using namespace ::com::sun::star::xml::sax;
-
-namespace XFlatXml
-{
-
- /*
- * XFlatXml export and imports ODF flat XML documents by plumbing a pass-through
- * filter implementation to XmlFilterAdaptor.
- *
- * XXX: Currently, this code adds nothing to the flat XML filter implementation
- * provided with the ODK.
- */
- class XFlatXml : public WeakImplHelper3<XImportFilter, XExportFilter,
- XDocumentHandler>
- {
- private:
- // the UNO ServiceFactory
- Reference<XMultiServiceFactory> m_rServiceFactory;
-
- // DocumentHandler interface of the css::xml::sax::Writer service
- Reference<XExtendedDocumentHandler> m_rDocumentHandler;
-
- // controls pretty-printing
- sal_Bool m_bPrettyPrint;
-
- public:
-
- // ctor...
- XFlatXml(const Reference<XMultiServiceFactory> &r) :
- m_rServiceFactory(r), m_bPrettyPrint(sal_True)
- {
- }
-
- // XImportFilter
- virtual sal_Bool SAL_CALL
- importer(const Sequence<PropertyValue>& aSourceData, const Reference<
- XDocumentHandler>& xHandler,
- const Sequence<OUString>& msUserData) throw (RuntimeException);
-
- // XExportFilter
- virtual sal_Bool SAL_CALL
- exporter(const Sequence<PropertyValue>& aSourceData, const Sequence<
- OUString>& msUserData) throw (RuntimeException);
-
- // XDocumentHandler
- virtual void SAL_CALL
- startDocument() throw (SAXException, RuntimeException);
- virtual void SAL_CALL
- endDocument() throw (SAXException, RuntimeException);
- virtual void SAL_CALL
- startElement(const OUString& str,
- const Reference<XAttributeList>& attriblist)
- throw (SAXException, RuntimeException);
- virtual void SAL_CALL
- endElement(const OUString& str) throw (SAXException, RuntimeException);
- virtual void SAL_CALL
- characters(const OUString& str) throw (SAXException, RuntimeException);
- virtual void SAL_CALL
- ignorableWhitespace(const OUString& str) throw (SAXException,
- RuntimeException);
- virtual void SAL_CALL
- processingInstruction(const OUString& str, const OUString& str2)
- throw (com::sun::star::xml::sax::SAXException,
- RuntimeException);
- virtual void SAL_CALL
- setDocumentLocator(const Reference<XLocator>& doclocator)
- throw (SAXException, RuntimeException);
- };
-}
-#endif // __XFLATXML_HXX__
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/odfflatxml/OdfFlatXml.cxx b/filter/source/odfflatxml/OdfFlatXml.cxx
new file mode 100644
index 0000000..43574aa
--- /dev/null
+++ b/filter/source/odfflatxml/OdfFlatXml.cxx
@@ -0,0 +1,255 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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.
+ *
+ * The Initial Developer of the Original Code is
+ * Peter Jentsch <pjotr at guineapics.de>
+ *
+ * Portions created by the Initial Developer are Copyright (C) 2011 the
+ * 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.
+ */
+
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/servicefactory.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase.hxx>
+
+#include <sax/tools/documenthandleradapter.hxx>
+
+#include <com/sun/star/lang/XComponent.hpp>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Type.hxx>
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+#include <com/sun/star/xml/XImportFilter.hpp>
+#include <com/sun/star/xml/XExportFilter.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/SAXException.hpp>
+
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+
+#include <registration.hxx>
+
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::osl;
+using namespace ::sax;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+using namespace ::com::sun::star::xml;
+using namespace ::com::sun::star::xml::sax;
+
+namespace filter {
+ namespace odfflatxml {
+ /*
+ * OdfFlatXml export and imports ODF flat XML documents by plugging a pass-through
+ * filter implementation into XmlFilterAdaptor.
+ */
+ class OdfFlatXml : public WeakImplHelper3<XImportFilter,
+ XExportFilter, DocumentHandlerAdapter>
+ {
+ private:
+ Reference< XMultiServiceFactory > m_rServiceFactory;
+
+ public:
+
+ OdfFlatXml(const Reference<XMultiServiceFactory> &r) :
+ m_rServiceFactory(r)
+ {
+ }
+
+ // XImportFilter
+ virtual sal_Bool SAL_CALL
+ importer(const Sequence< PropertyValue >& sourceData,
+ const Reference< XDocumentHandler >& docHandler,
+ const Sequence< OUString >& userData)
+ throw (IllegalArgumentException, RuntimeException);
+
+ // XExportFilter
+ virtual sal_Bool SAL_CALL
+ exporter(
+ const Sequence< PropertyValue >& sourceData,
+ const Sequence< OUString >& userData)
+ throw (IllegalArgumentException,
+ RuntimeException);
+
+ // UNO component helper methods
+
+ static OUString impl_getImplementationName();
+
+ static Sequence< OUString > impl_getSupportedServiceNames();
+
+ static Reference< XInterface > impl_createInstance(const Reference< XMultiServiceFactory >& fact);
+ };
+ }
+}
+
+using namespace ::filter::odfflatxml;
+
+sal_Bool
+OdfFlatXml::importer(
+ const Sequence< PropertyValue >& sourceData,
+ const Reference< XDocumentHandler >& docHandler,
+ const Sequence< OUString >& /* userData */)
+ throw (IllegalArgumentException, RuntimeException)
+{
+ // Read InputStream to read from and an URL used for the system id
+ // of the InputSource we create from the given sourceData sequence
+ Reference<XInputStream> inputStream;
+ OUString paramName;
+ OUString url;
+
+ sal_Int32 paramCount = sourceData.getLength();
+ for (sal_Int32 paramIdx = 0; paramIdx < paramCount; paramIdx++)
+ {
+ paramName = sourceData[paramIdx].Name;
+ if (paramName.equalsAscii("InputStream"))
+ sourceData[paramIdx].Value >>= inputStream;
+ else if (paramName.equalsAscii("URL"))
+ sourceData[paramIdx].Value >>= url;
+ }
+
+ OSL_ASSERT(inputStream.is());
+ if (!inputStream.is())
+ return sal_False;
+
+ OUString SAX_PARSER_SERVICE(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser"));
+ Reference<XParser> saxParser(m_rServiceFactory->createInstance(
+ SAX_PARSER_SERVICE), UNO_QUERY);
+
+ OSL_ASSERT(saxParser.is());
+ if (!saxParser.is())
+ return sal_False;
+
+ InputSource inputSource;
+ inputSource.sSystemId = url;
+ inputSource.sPublicId = url;
+ inputSource.aInputStream = inputStream;
+ saxParser->setDocumentHandler(docHandler);
+ try
+ {
+ saxParser->parseStream(inputSource);
+ }
+ catch (Exception &exc)
+ {
+ OString msg = OUStringToOString(exc.Message,
+ RTL_TEXTENCODING_ASCII_US);
+ OSL_ENSURE(0, msg);
+ return sal_False;
+ }
+ return sal_True;
+}
+
+sal_Bool
+OdfFlatXml::exporter(const Sequence< PropertyValue >& sourceData,
+ const Sequence< OUString >& /*msUserData*/)
+ throw (IllegalArgumentException, RuntimeException)
+{
+ OUString paramName;
+ OUString targetURL;
+ Reference<XOutputStream> outputStream;
+
+ // Read output stream and target URL from the parameters given in sourceData.
+ sal_Int32 paramCount = sourceData.getLength();
+ for (sal_Int32 paramIdx = 0; paramIdx < paramCount; paramIdx++)
+ {
+ paramName = sourceData[paramIdx].Name;
+ if (paramName.equalsAscii("OutputStream"))
+ sourceData[paramIdx].Value >>= outputStream;
+ else if (paramName.equalsAscii("URL"))
+ sourceData[paramIdx].Value >>= targetURL;
+ }
+
+ if (!getDelegate().is())
+ {
+ OUString SAX_WRITER_SERVICE(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer"));
+ Reference< XDocumentHandler > saxWriter(m_rServiceFactory->createInstance(SAX_WRITER_SERVICE),
+ UNO_QUERY);
+ setDelegate(saxWriter);
+ if (!getDelegate().is())
+ return sal_False;
+ }
+ // get data source interface ...
+ Reference<XActiveDataSource> dataSource(getDelegate(), UNO_QUERY);
+ OSL_ASSERT(dataSource.is());
+ if (!dataSource.is())
+ return sal_False;
+ OSL_ASSERT(outputStream.is());
+ if (!outputStream.is())
+ return sal_False;
+ dataSource->setOutputStream(outputStream);
+
+ return sal_True;
+}
+
+
+OUString OdfFlatXml::impl_getImplementationName()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.filter.OdfFlatXml"));
+}
+
+Sequence< OUString > OdfFlatXml::impl_getSupportedServiceNames()
+{
+ Sequence< OUString > lServiceNames(2);
+ lServiceNames[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.ImportFilter" ));
+ lServiceNames[1] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.ExportFilter" ));
+ return lServiceNames;
+}
+
+Reference< XInterface > SAL_CALL OdfFlatXml::impl_createInstance(const Reference< XMultiServiceFactory >& fact)
+{
+ return Reference<XInterface> ((OWeakObject *) new OdfFlatXml(fact));
+
+}
+
+_COMPHELPER_COMPONENT_GETIMPLEMENTATIONENVIRONMENT
+
+// extern "C" component_writeInfo()
+
+_COMPHELPER_COMPONENT_WRITEINFO
+(
+ _COMPHELPER_COMPONENTINFO( OdfFlatXml,
+ OdfFlatXml::impl_getImplementationName(),
+ OdfFlatXml::impl_getSupportedServiceNames())
+)
+// extern "C" component_getFactory()
+_COMPHELPER_COMPONENT_GETFACTORY
+(
+ {},
+ _COMPHELPER_ONEINSTANCEFACTORY( OdfFlatXml::impl_getImplementationName(),
+ OdfFlatXml::impl_getSupportedServiceNames(),
+ OdfFlatXml::impl_createInstance)
+
+)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/odfflatxml/makefile.mk b/filter/source/odfflatxml/makefile.mk
index ee56789..aaffb35 100644
--- a/filter/source/odfflatxml/makefile.mk
+++ b/filter/source/odfflatxml/makefile.mk
@@ -34,7 +34,7 @@ LIBTARGET=NO
.INCLUDE: settings.mk
-SLOFILES=$(SLO)$/FlatXml.obj
+SLOFILES=$(SLO)$/OdfFlatXml.obj
LIBNAME=odfflatxml
SHL1TARGETDEPN=makefile.mk
SHL1OBJS=$(SLOFILES)
diff --git a/filter/source/odfflatxml/odfflatxmlexport.xsl b/filter/source/odfflatxml/odfflatxmlexport.xsl
deleted file mode 100644
index 2c1ea97..0000000
--- a/filter/source/odfflatxml/odfflatxmlexport.xsl
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version='1.0' encoding="UTF-8"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0">
- <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
-
- <xsl:template match="@*|node()">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
- </xsl:template>
-
- <xsl:template match="@office:mimetype[string(.)='application/vnd.oasis.opendocument.drawing']">
- <xsl:attribute name="office:mimetype">application/vnd.oasis.opendocument.graphics</xsl:attribute>
- </xsl:template>
-
- <xsl:include href="split-long-lines.xsl"/>
-</xsl:stylesheet>
diff --git a/filter/source/odfflatxml/odfflatxmlimport.xsl b/filter/source/odfflatxml/odfflatxmlimport.xsl
deleted file mode 100644
index 802ff53..0000000
--- a/filter/source/odfflatxml/odfflatxmlimport.xsl
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version='1.0' encoding="UTF-8"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
-
- <xsl:template match="@*|node()">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
- </xsl:template>
-</xsl:stylesheet>
diff --git a/filter/source/odfflatxml/split-long-lines.xsl b/filter/source/odfflatxml/split-long-lines.xsl
deleted file mode 100644
index 0e9d310..0000000
--- a/filter/source/odfflatxml/split-long-lines.xsl
+++ /dev/null
@@ -1,98 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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. 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.
-
-The Initial Developer of the Original Code is
- Gioele Barabucci <gioele at svario.it>
-Portions created by the Initial Developer are Copyright (C) 2010 the
-Initial Developer. All Rights Reserved.
-
-Contributor(s): Gioele Barabucci <gioele at svario.it>
-
-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.
--->
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
- version="1.0">
- <xsl:param name="num-max-spaces">5</xsl:param>
- <xsl:param name="sep"><xsl:text xml:space="preserve"> </xsl:text></xsl:param>
- <xsl:param name="newline"><xsl:text xml:space="preserve"> </xsl:text></xsl:param>
-
- <xsl:template match="text:p/text()">
- <xsl:call-template name="split-current-text-node"/>
- </xsl:template>
-
- <xsl:template match="text:p/text:span/text()">
- <xsl:call-template name="split-current-text-node"/>
- </xsl:template>
-
- <xsl:template name="split-current-text-node">
- <xsl:call-template name="split-text">
- <xsl:with-param name="num-prec-spaces">0</xsl:with-param>
- <xsl:with-param name="text" select="."/>
- </xsl:call-template>
- </xsl:template>
-
- <xsl:template name="split-text">
- <xsl:param name="num-prec-spaces"/>
- <xsl:param name="text"/>
-
- <xsl:variable name="contains-space" select="contains($text, $sep)"/>
- <xsl:variable name="text-before">
- <xsl:choose>
- <xsl:when test="$contains-space"><xsl:value-of select="substring-before($text, $sep)"/></xsl:when>
- <xsl:when test="$text = $sep"><xsl:value-of select="$text"/></xsl:when>
- <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="text-after">
- <xsl:choose>
- <xsl:when test="$contains-space"><xsl:value-of select="substring-after($text, $sep)"/></xsl:when>
- <xsl:otherwise></xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="finished" select="string-length($text-after) = 0"/>
- <xsl:variable name="is-empty" select="string-length($text-before) = 0"/>
-
- <xsl:value-of select="$text-before"/>
-
- <xsl:choose>
- <xsl:when test="$num-prec-spaces = $num-max-spaces">
- <xsl:value-of select="$newline"/>
- <xsl:call-template name="split-text">
- <xsl:with-param name="text" select="$text-after"/>
- <xsl:with-param name="num-prec-spaces">0</xsl:with-param>
- </xsl:call-template>
- </xsl:when>
-
- <xsl:otherwise>
- <xsl:if test="$contains-space">
- <xsl:value-of select="$sep"/>
- </xsl:if>
-
- <xsl:if test="not($finished)">
- <xsl:variable name="incr" select="number(not($is-empty))"/>
-
- <xsl:call-template name="split-text">
- <xsl:with-param name="text" select="$text-after"/>
- <xsl:with-param name="num-prec-spaces" select="$num-prec-spaces + $incr"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-</xsl:stylesheet>
commit 56c6159df31ae968d6c7b00c79c0352e8604cea2
Author: Jan Holesovsky <kendy at suse.cz>
Date: Wed Feb 2 23:08:19 2011 +0100
css -> ::com::sun::star; this is a header file.
diff --git a/filter/inc/registration.hxx b/filter/inc/registration.hxx
index 2c1ff3f..76c54cf 100644
--- a/filter/inc/registration.hxx
+++ b/filter/inc/registration.hxx
@@ -81,7 +81,7 @@ namespace comphelper{
@param SERVICENAME
a list of supported uno service names from type
- [css::uno::Sequence< ::rtl::OUString >]
+ [::com::sun::star::uno::Sequence< ::rtl::OUString >]
or any possible method call, which returns such
list.
*/
@@ -96,12 +96,12 @@ namespace comphelper{
::rtl::OUString sKey = sKeyBuf.makeStringAndClear(); \
\
/* try to register this service ... thrown exception will be catched by COMPONENT_WRITEINFO! */ \
- css::uno::Reference< css::registry::XRegistryKey > xKey = xRoot->createKey(sKey); \
+ ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > xKey = xRoot->createKey(sKey); \
if (!xKey.is()) \
- throw css::registry::InvalidRegistryException(sKey, css::uno::Reference< css::uno::XInterface >()); \
+ throw ::com::sun::star::registry::InvalidRegistryException(sKey, ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >()); \
\
/* dont optimize it! it must work for simple types and function calls! */ \
- const css::uno::Sequence< ::rtl::OUString > lServiceNames = SERVICENAMES; \
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString > lServiceNames = SERVICENAMES; \
const ::rtl::OUString* pServiceNames = lServiceNames.getConstArray(); \
sal_Int32 nCount = lServiceNames.getLength(); \
\
@@ -131,7 +131,7 @@ namespace comphelper{
if (!pServiceManager || !pRegistryKey) \
return sal_False; \
\
- css::uno::Reference< css::registry::XRegistryKey > xRoot = reinterpret_cast< css::registry::XRegistryKey* >(pRegistryKey); \
+ ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > xRoot = reinterpret_cast< ::com::sun::star::registry::XRegistryKey* >(pRegistryKey); \
\
/*if one of following registration will fail ... an exception is thrown! */ \
try \
@@ -142,7 +142,7 @@ namespace comphelper{
/* _COMPHELPER_COMPONENTINFO(n) */ \
INFOLIST \
} \
- catch(const css::registry::InvalidRegistryException&) \
+ catch(const ::com::sun::star::registry::InvalidRegistryException&) \
{ \
return sal_False; \
} \
@@ -188,8 +188,8 @@ namespace comphelper{
\
STATIC_INIT \
\
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = reinterpret_cast< css::lang::XMultiServiceFactory* >(pServiceManager); \
- css::uno::Reference< css::lang::XSingleServiceFactory > xFactory ; \
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMGR = reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >(pServiceManager); \
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > xFactory ; \
rtl::OUString sImplName = ::rtl::OUString::createFromAscii(pImplementationName); \
\
/* This parameter will expand to: */ \
commit 940a87870fdbdee2032f90f00ca32b1ab9f709b9
Author: Peter Jentsch <pjotr at guineapics.de>
Date: Wed Feb 2 22:34:59 2011 +0100
Move a header providing useful macros, for broader use.
diff --git a/filter/inc/registration.hxx b/filter/inc/registration.hxx
new file mode 100644
index 0000000..2c1ff3f
--- /dev/null
+++ b/filter/inc/registration.hxx
@@ -0,0 +1,217 @@
+/* -*- 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
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __COMPHELPER_REGISTRATION_HXX_
+#define __COMPHELPER_REGISTRATION_HXX_
+
+//_______________________________________________
+// includes
+
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/registry/InvalidRegistryException.hpp>
+#include <rtl/ustrbuf.hxx>
+#include <cppuhelper/factory.hxx>
+
+//_______________________________________________
+// namespace
+
+namespace comphelper{
+
+//_______________________________________________
+// declaration
+
+//_______________________________________________
+
+/** TODO doc
+ */
+#define _COMPHELPER_COMPONENT_GETIMPLEMENTATIONENVIRONMENT \
+ extern "C" void SAL_CALL component_getImplementationEnvironment(const sal_Char** ppEnvironmentTypeName, \
+ uno_Environment** /* ppEnvironment */ ) \
+ { \
+ *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; \
+ }
+
+//_______________________________________________
+
+/** @short creates a new key inside component registry.
+
+ @descr using: a) _COMPHELPER_COMPONENTINFO( MyClass,
+ MyClass::st_getImplName(),
+ MyClass::st_getServNames())
+
+ b) _COMPHELPER_COMPONENTINFO( MyClass,
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "css.MyClass" )),
+ lServiceNames)
+
+ @param CLASS
+ must be the class name of the implementation
+ of an uno service, which should be registered here.
+
+ @param IMPLEMENTATIONNAME
+ can be an uno implementation name from type [::rtl::OUString]
+ directly or any possible method call, which returns such
+ name.
+
+ @param SERVICENAME
+ a list of supported uno service names from type
+ [css::uno::Sequence< ::rtl::OUString >]
+ or any possible method call, which returns such
+ list.
+ */
+#define _COMPHELPER_COMPONENTINFO(CLASS, IMPLEMENTATIONNAME, SERVICENAMES) \
+ /*define new scope to prevent multiple using of the same variables ... */ \
+ { \
+ /* build new key name */ \
+ ::rtl::OUStringBuffer sKeyBuf(256); \
+ sKeyBuf.appendAscii("/" ); \
+ sKeyBuf.append (IMPLEMENTATIONNAME); \
+ sKeyBuf.appendAscii("/UNO/SERVICES" ); \
+ ::rtl::OUString sKey = sKeyBuf.makeStringAndClear(); \
+ \
+ /* try to register this service ... thrown exception will be catched by COMPONENT_WRITEINFO! */ \
+ css::uno::Reference< css::registry::XRegistryKey > xKey = xRoot->createKey(sKey); \
+ if (!xKey.is()) \
+ throw css::registry::InvalidRegistryException(sKey, css::uno::Reference< css::uno::XInterface >()); \
+ \
+ /* dont optimize it! it must work for simple types and function calls! */ \
+ const css::uno::Sequence< ::rtl::OUString > lServiceNames = SERVICENAMES; \
+ const ::rtl::OUString* pServiceNames = lServiceNames.getConstArray(); \
+ sal_Int32 nCount = lServiceNames.getLength(); \
+ \
+ for (sal_Int32 i=0; i<nCount; ++i) \
+ xKey->createKey(pServiceNames[i]); \
+ }
+
+//_______________________________________________
+
+/** @short implments extern C function component_writeInfo
+
+ @descr using: _COMPHELPER_COMPONENT_WRITEINFO
+ (
+ _COMPHELPER_COMPONENTINFO(...)
+ ..
+ _COMPHELPER_COMPONENTINFO(...)
+ )
+
+ @param INFOLIST
+ list of macros of type COMPONENTINFO without(!) any
+ seperator signs between two elements.
+ */
+#define _COMPHELPER_COMPONENT_WRITEINFO(INFOLIST) \
+ extern "C" sal_Bool SAL_CALL component_writeInfo(void* pServiceManager, \
+ void* pRegistryKey ) \
+ { \
+ if (!pServiceManager || !pRegistryKey) \
+ return sal_False; \
+ \
+ css::uno::Reference< css::registry::XRegistryKey > xRoot = reinterpret_cast< css::registry::XRegistryKey* >(pRegistryKey); \
+ \
+ /*if one of following registration will fail ... an exception is thrown! */ \
+ try \
+ { \
+ /* This parameter will expand to: */ \
+ /* _COMPHELPER_COMPONENTINFO(1) */ \
+ /* ... */ \
+ /* _COMPHELPER_COMPONENTINFO(n) */ \
+ INFOLIST \
+ } \
+ catch(const css::registry::InvalidRegistryException&) \
+ { \
+ return sal_False; \
+ } \
+ return sal_True; \
+ }
+
+//_______________________________________________
+
+/** TODO doc
+ */
+#define _COMPHELPER_MULTIINSTANCEFACTORY(IMPLEMENTATIONNAME, SERVICENAMES, FACTORYMETHOD) \
+ if (IMPLEMENTATIONNAME == sImplName) \
+ xFactory = ::cppu::createSingleFactory(xSMGR , \
+ IMPLEMENTATIONNAME, \
+ FACTORYMETHOD , \
+ SERVICENAMES );
+
+//_______________________________________________
+
+/** TODO doc
+ */
+#define _COMPHELPER_ONEINSTANCEFACTORY(IMPLEMENTATIONNAME, SERVICENAMES, FACTORYMETHOD) \
+ if (IMPLEMENTATIONNAME == sImplName) \
+ xFactory = ::cppu::createOneInstanceFactory(xSMGR , \
+ IMPLEMENTATIONNAME, \
+ FACTORYMETHOD , \
+ SERVICENAMES );
+
+//_______________________________________________
+
+/** TODO doc
+ */
+#define _COMPHELPER_COMPONENT_GETFACTORY(STATIC_INIT,FACTORYLIST) \
+ extern "C" void* SAL_CALL component_getFactory(const sal_Char* pImplementationName, \
+ void* pServiceManager , \
+ void* /* pRegistryKey */ ) \
+ { \
+ if ( \
+ (!pImplementationName) || \
+ (!pServiceManager ) \
+ ) \
+ return NULL; \
+ \
+ STATIC_INIT \
+ \
+ css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = reinterpret_cast< css::lang::XMultiServiceFactory* >(pServiceManager); \
+ css::uno::Reference< css::lang::XSingleServiceFactory > xFactory ; \
+ rtl::OUString sImplName = ::rtl::OUString::createFromAscii(pImplementationName); \
+ \
+ /* This parameter will expand to: */ \
+ /* _COMPHELPER_xxxFACTORY(1) */ \
+ /* else */ \
+ /* ... */ \
+ /* else */ \
+ /* _COMPHELPER_xxxFACTORY(n) */ \
+ FACTORYLIST \
+ \
+ /* And if one of these checks was successfully => xFactory was set! */ \
+ if (xFactory.is()) \
+ { \
+ xFactory->acquire(); \
+ return xFactory.get(); \
+ } \
+ \
+ return NULL; \
+ }
+
+} // namespace comphelper
+
+#endif // #ifndef __COMPHELPER_REGISTRATION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/config/cache/registration.hxx b/filter/source/config/cache/registration.hxx
deleted file mode 100644
index 4f7bf20..0000000
--- a/filter/source/config/cache/registration.hxx
+++ /dev/null
@@ -1,217 +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
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef __COMPHELPER_REGISTRATION_HXX_
-#define __COMPHELPER_REGISTRATION_HXX_
-
-//_______________________________________________
-// includes
-
-#include <com/sun/star/registry/XRegistryKey.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/registry/InvalidRegistryException.hpp>
-#include <rtl/ustrbuf.hxx>
-#include <cppuhelper/factory.hxx>
-
-//_______________________________________________
-// namespace
-
-namespace comphelper{
-
-//_______________________________________________
-// declaration
-
-//_______________________________________________
-
-/** TODO doc
- */
-#define _COMPHELPER_COMPONENT_GETIMPLEMENTATIONENVIRONMENT \
- extern "C" void SAL_CALL component_getImplementationEnvironment(const sal_Char** ppEnvironmentTypeName, \
- uno_Environment** /* ppEnvironment */ ) \
- { \
- *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; \
- }
-
-//_______________________________________________
-
-/** @short creates a new key inside component registry.
-
- @descr using: a) _COMPHELPER_COMPONENTINFO( MyClass,
- MyClass::st_getImplName(),
- MyClass::st_getServNames())
-
- b) _COMPHELPER_COMPONENTINFO( MyClass,
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "css.MyClass" )),
- lServiceNames)
-
- @param CLASS
- must be the class name of the implementation
- of an uno service, which should be registered here.
-
- @param IMPLEMENTATIONNAME
- can be an uno implementation name from type [::rtl::OUString]
- directly or any possible method call, which returns such
- name.
-
- @param SERVICENAME
- a list of supported uno service names from type
- [css::uno::Sequence< ::rtl::OUString >]
- or any possible method call, which returns such
- list.
- */
-#define _COMPHELPER_COMPONENTINFO(CLASS, IMPLEMENTATIONNAME, SERVICENAMES) \
- /*define new scope to prevent multiple using of the same variables ... */ \
- { \
- /* build new key name */ \
- ::rtl::OUStringBuffer sKeyBuf(256); \
- sKeyBuf.appendAscii("/" ); \
- sKeyBuf.append (IMPLEMENTATIONNAME); \
- sKeyBuf.appendAscii("/UNO/SERVICES" ); \
- ::rtl::OUString sKey = sKeyBuf.makeStringAndClear(); \
- \
- /* try to register this service ... thrown exception will be catched by COMPONENT_WRITEINFO! */ \
- css::uno::Reference< css::registry::XRegistryKey > xKey = xRoot->createKey(sKey); \
- if (!xKey.is()) \
- throw css::registry::InvalidRegistryException(sKey, css::uno::Reference< css::uno::XInterface >()); \
- \
- /* dont optimize it! it must work for simple types and function calls! */ \
- const css::uno::Sequence< ::rtl::OUString > lServiceNames = SERVICENAMES; \
- const ::rtl::OUString* pServiceNames = lServiceNames.getConstArray(); \
- sal_Int32 nCount = lServiceNames.getLength(); \
- \
- for (sal_Int32 i=0; i<nCount; ++i) \
- xKey->createKey(pServiceNames[i]); \
- }
-
-//_______________________________________________
-
-/** @short implments extern C function component_writeInfo
-
- @descr using: _COMPHELPER_COMPONENT_WRITEINFO
- (
- _COMPHELPER_COMPONENTINFO(...)
- ..
- _COMPHELPER_COMPONENTINFO(...)
- )
-
- @param INFOLIST
- list of macros of type COMPONENTINFO without(!) any
- seperator signs between two elements.
- */
-#define _COMPHELPER_COMPONENT_WRITEINFO(INFOLIST) \
- extern "C" sal_Bool SAL_CALL component_writeInfo(void* pServiceManager, \
- void* pRegistryKey ) \
- { \
- if (!pServiceManager || !pRegistryKey) \
- return sal_False; \
- \
- css::uno::Reference< css::registry::XRegistryKey > xRoot = reinterpret_cast< css::registry::XRegistryKey* >(pRegistryKey); \
- \
- /*if one of following registration will fail ... an exception is thrown! */ \
- try \
- { \
- /* This parameter will expand to: */ \
- /* _COMPHELPER_COMPONENTINFO(1) */ \
- /* ... */ \
- /* _COMPHELPER_COMPONENTINFO(n) */ \
- INFOLIST \
- } \
- catch(const css::registry::InvalidRegistryException&) \
- { \
- return sal_False; \
- } \
- return sal_True; \
- }
-
-//_______________________________________________
-
-/** TODO doc
- */
-#define _COMPHELPER_MULTIINSTANCEFACTORY(IMPLEMENTATIONNAME, SERVICENAMES, FACTORYMETHOD) \
- if (IMPLEMENTATIONNAME == sImplName) \
- xFactory = ::cppu::createSingleFactory(xSMGR , \
- IMPLEMENTATIONNAME, \
- FACTORYMETHOD , \
- SERVICENAMES );
-
-//_______________________________________________
-
-/** TODO doc
- */
-#define _COMPHELPER_ONEINSTANCEFACTORY(IMPLEMENTATIONNAME, SERVICENAMES, FACTORYMETHOD) \
- if (IMPLEMENTATIONNAME == sImplName) \
- xFactory = ::cppu::createOneInstanceFactory(xSMGR , \
- IMPLEMENTATIONNAME, \
- FACTORYMETHOD , \
- SERVICENAMES );
-
-//_______________________________________________
-
-/** TODO doc
- */
-#define _COMPHELPER_COMPONENT_GETFACTORY(STATIC_INIT,FACTORYLIST) \
- extern "C" void* SAL_CALL component_getFactory(const sal_Char* pImplementationName, \
- void* pServiceManager , \
- void* /* pRegistryKey */ ) \
- { \
- if ( \
- (!pImplementationName) || \
- (!pServiceManager ) \
- ) \
- return NULL; \
- \
- STATIC_INIT \
- \
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = reinterpret_cast< css::lang::XMultiServiceFactory* >(pServiceManager); \
- css::uno::Reference< css::lang::XSingleServiceFactory > xFactory ; \
- rtl::OUString sImplName = ::rtl::OUString::createFromAscii(pImplementationName); \
- \
- /* This parameter will expand to: */ \
- /* _COMPHELPER_xxxFACTORY(1) */ \
- /* else */ \
- /* ... */ \
- /* else */ \
- /* _COMPHELPER_xxxFACTORY(n) */ \
- FACTORYLIST \
- \
- /* And if one of these checks was successfully => xFactory was set! */ \
- if (xFactory.is()) \
- { \
- xFactory->acquire(); \
- return xFactory.get(); \
- } \
- \
- return NULL; \
- }
-
-} // namespace comphelper
-
-#endif // #ifndef __COMPHELPER_REGISTRATION_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list