diff options
Diffstat (limited to 'sax/inc/sax')
-rw-r--r-- | sax/inc/sax/dllapi.h | 42 | ||||
-rw-r--r-- | sax/inc/sax/fastattribs.hxx | 94 | ||||
-rw-r--r-- | sax/inc/sax/fshelper.hxx | 122 | ||||
-rw-r--r-- | sax/inc/sax/parser/saxparser.hxx | 151 | ||||
-rw-r--r-- | sax/inc/sax/tools/attributemap.hxx | 73 | ||||
-rw-r--r-- | sax/inc/sax/tools/converter.hxx | 211 | ||||
-rw-r--r-- | sax/inc/sax/tools/documenthandleradapter.hxx | 254 | ||||
-rw-r--r-- | sax/inc/sax/tools/saxobject.hxx | 53 | ||||
-rw-r--r-- | sax/inc/sax/tools/tokenmap.hxx | 68 |
9 files changed, 0 insertions, 1068 deletions
diff --git a/sax/inc/sax/dllapi.h b/sax/inc/sax/dllapi.h deleted file mode 100644 index 442fbdad7f..0000000000 --- a/sax/inc/sax/dllapi.h +++ /dev/null @@ -1,42 +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 INCLUDED_SAX_DLLAPI_H -#define INCLUDED_SAX_DLLAPI_H - -#include "sal/types.h" - -#if defined SAX_DLLIMPLEMENTATION -#define SAX_DLLPUBLIC SAL_DLLPUBLIC_EXPORT -#else -#define SAX_DLLPUBLIC SAL_DLLPUBLIC_IMPORT -#endif - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sax/inc/sax/fastattribs.hxx b/sax/inc/sax/fastattribs.hxx deleted file mode 100644 index 5704f005ba..0000000000 --- a/sax/inc/sax/fastattribs.hxx +++ /dev/null @@ -1,94 +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 _SAX_FASTATTRIBS_HXX_ -#define _SAX_FASTATTRIBS_HXX_ - -#include <com/sun/star/xml/sax/XFastAttributeList.hpp> -#include <com/sun/star/xml/sax/XFastTokenHandler.hpp> -#include <com/sun/star/xml/Attribute.hpp> -#include <com/sun/star/xml/FastAttribute.hpp> - -#include <cppuhelper/implbase1.hxx> -#include "sax/dllapi.h" - -#include <map> -#include <vector> - -namespace sax_fastparser -{ - -struct UnknownAttribute -{ - ::rtl::OUString maNamespaceURL; - ::rtl::OString maName; - ::rtl::OString maValue; - - UnknownAttribute( const ::rtl::OUString& rNamespaceURL, const ::rtl::OString& rName, const ::rtl::OString& rValue ); - - UnknownAttribute( const ::rtl::OString& rName, const ::rtl::OString& rValue ); - - void FillAttribute( ::com::sun::star::xml::Attribute* pAttrib ) const; -}; - -typedef std::map< sal_Int32, ::rtl::OString > FastAttributeMap; -typedef std::vector< UnknownAttribute > UnknownAttributeList; - -class SAX_DLLPUBLIC FastAttributeList : public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastAttributeList > -{ -public: - FastAttributeList( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler >& xTokenHandler ); - virtual ~FastAttributeList(); - - void clear(); - void add( sal_Int32 nToken, const ::rtl::OString& rValue ); - void addUnknown( const ::rtl::OUString& rNamespaceURL, const ::rtl::OString& rName, const ::rtl::OString& rValue ); - void addUnknown( const ::rtl::OString& rName, const ::rtl::OString& rValue ); - - // XFastAttributeList - virtual ::sal_Bool SAL_CALL hasAttribute( ::sal_Int32 Token ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getValueToken( ::sal_Int32 Token ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getOptionalValueToken( ::sal_Int32 Token, ::sal_Int32 Default ) throw (::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getValue( ::sal_Int32 Token ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getOptionalValue( ::sal_Int32 Token ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::xml::Attribute > SAL_CALL getUnknownAttributes( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::xml::FastAttribute > SAL_CALL getFastAttributes() throw (::com::sun::star::uno::RuntimeException); - -private: - FastAttributeMap maAttributes; - UnknownAttributeList maUnknownAttributes; - FastAttributeMap::iterator maLastIter; - ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler > mxTokenHandler; - -}; - -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sax/inc/sax/fshelper.hxx b/sax/inc/sax/fshelper.hxx deleted file mode 100644 index f6651fa8b6..0000000000 --- a/sax/inc/sax/fshelper.hxx +++ /dev/null @@ -1,122 +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 _SAX_FS_HELPER_HXX_ -#define _SAX_FS_HELPER_HXX_ - -#include <com/sun/star/uno/XReference.hpp> -#include <com/sun/star/io/XOutputStream.hpp> -#include <com/sun/star/xml/sax/XFastTokenHandler.hpp> -#include <stdarg.h> -#include <boost/shared_ptr.hpp> -#include <sax/fastattribs.hxx> -#include "sax/dllapi.h" - -#define FSNS(namespc, element) ((namespc << 16) | element) -const sal_Int32 FSEND = -1; // same as XML_TOKEN_INVALID - -namespace sax_fastparser { - -enum MergeMarksEnum { MERGE_MARKS_APPEND = 0, MERGE_MARKS_PREPEND = 1, MERGE_MARKS_POSTPONE = 2 }; - -typedef ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList > XFastAttributeListRef; - -class FastSaxSerializer; - -class SAX_DLLPUBLIC FastSerializerHelper -{ -public: - - FastSerializerHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutputStream, bool bWriteHeader = true ); - - ~FastSerializerHelper(); - - void startElement(const char* elementName, ...); - void singleElement(const char* elementName, ...); - void endElement(const char* elementName); - - void startElementV(sal_Int32 elementTokenId, va_list args); - void singleElementV(sal_Int32 elementTokenId, va_list args); - - inline void startElement(sal_Int32 elementTokenId, ...) - { va_list args; va_start( args, elementTokenId ); startElementV( elementTokenId, args ); va_end( args ); } - inline void singleElement(sal_Int32 elementTokenId, ...) - { va_list args; va_start( args, elementTokenId ); singleElementV( elementTokenId, args ); va_end( args ); } - inline void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, ...) - { va_list args; va_start( args, elementTokenId ); startElementV( FSNS( namespaceTokenId, elementTokenId), args ); va_end( args ); } - inline void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, ...) - { va_list args; va_start( args, elementTokenId ); singleElementV( FSNS( namespaceTokenId, elementTokenId), args ); va_end( args ); } - void endElement(sal_Int32 elementTokenId); - inline void endElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId) - { endElement( FSNS( namespaceTokenId, elementTokenId ) ); } - - void singleElement(const char* elementName, XFastAttributeListRef xAttrList); - inline void singleElement(sal_Int32 elementTokenId, XFastAttributeListRef xAttrList) - { singleElementV(elementTokenId, xAttrList); } - void singleElementV(sal_Int32 elementTokenId, XFastAttributeListRef xAttrList); - inline void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, XFastAttributeListRef xAttrList) - { singleElementV(FSNS( namespaceTokenId, elementTokenId), xAttrList); } - - void startElementV(sal_Int32 elementTokenId, XFastAttributeListRef xAttrList); - inline void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, XFastAttributeListRef xAttrList) - { startElementV( FSNS( namespaceTokenId, elementTokenId ), xAttrList ); } - - FastSerializerHelper* write(const char* value); - FastSerializerHelper* write(const rtl::OUString& value); - FastSerializerHelper* write(sal_Int32 value); - FastSerializerHelper* write(sal_Int64 value); - FastSerializerHelper* write(float value); - FastSerializerHelper* write(double value); - - FastSerializerHelper* writeEscaped(const char* value); - FastSerializerHelper* writeEscaped(const rtl::OUString& value); - - FastSerializerHelper* writeId(sal_Int32 tokenId); - - ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > getOutputStream(); - - FastAttributeList *createAttrList(); - - void mark( ::com::sun::star::uno::Sequence< sal_Int32 > aOrder = - ::com::sun::star::uno::Sequence< sal_Int32 >() ); - void mergeTopMarks( MergeMarksEnum eMergeType = MERGE_MARKS_APPEND ); - -private: - - FastSaxSerializer* mpSerializer; - com::sun::star::uno::Reference<com::sun::star::xml::sax::XFastTokenHandler> mxTokenHandler; - -}; - -typedef boost::shared_ptr< FastSerializerHelper > FSHelperPtr; - -} - -#endif // _SAX_FS_HELPER_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sax/inc/sax/parser/saxparser.hxx b/sax/inc/sax/parser/saxparser.hxx deleted file mode 100644 index 172294b521..0000000000 --- a/sax/inc/sax/parser/saxparser.hxx +++ /dev/null @@ -1,151 +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 _SAX_SAXPARSER_HXX_ -#define _SAX_SAXPARSER_HXX_ - -#include "sax/dllapi.h" -#include <com/sun/star/xml/sax/InputSource.hpp> -#include <com/sun/star/xml/sax/SAXException.hpp> -#include <rtl/ref.hxx> - -#include <boost/shared_ptr.hpp> - -#include <map> -#include <memory> -#include "sax/tools/saxobject.hxx" -#include "sax/tools/attributemap.hxx" - -#include <boost/scoped_ptr.hpp> - -namespace sax -{ - -// -------------------------------------------------------------------- - -class SaxParser; -class SaxContext; - -typedef rtl::Reference< SaxParser > SaxParserRef; -typedef rtl::Reference< SaxContext > SaxContextRef; - -/** base class for each implementation that handles all sax calls for an element */ -class SAX_DLLPUBLIC SaxContext : public SaxObject -{ -public: - SaxContext( const SaxParserRef& xParser ); - virtual ~SaxContext(); - - /** receives notification of the beginning of an element . - */ - virtual void StartElement( sal_uInt32 aElementToken, const AttributeMap& rAttributes ); - - /** receives notification of character data. - */ - virtual void Characters( const sal_Char *pCharacters, sal_uInt32 nLength ); - - /** receives notification of the end of an element. - */ - virtual void EndElement( sal_uInt32 aElementToken ); - - /** is called by the SaxParser for each child element inside this instances element */ - virtual SaxContextRef CreateContext( sal_uInt32 aElementToken, const AttributeMap& rAttributes ); - - const SaxParserRef& getParser() const { return mxParser; } -private: - SaxParserRef mxParser; -}; - -// -------------------------------------------------------------------- - -class SaxParserImpl; - -/** base class for loading a single xml stream. Derived classes must call - parseStream to start parsing and are notified through virtual methods - for sax events. */ -class SAX_DLLPUBLIC SaxParser : public SaxObject -{ -public: - SaxParser(); - virtual ~SaxParser(); - - /** returns the unicode representation of a token from the xml stream - that was unknown to the SaxTokenMap from the derived class. */ - rtl::OUString GetCustomToken( sal_uInt32 nToken ); - - /** returns the unicode representation of a namespace from the xml stream - that was unknown to the SaxTokenMap from the derived class. */ - rtl::OUString GetCustomNamespace( sal_uInt32 nToken ); - - /** returns the system id of the currently parsed stream */ - const rtl::OUString& GetSystemId() const; - - /** starts parsing of the source xml stream provided in the given sax InputSource */ - virtual void parseStream( const ::com::sun::star::xml::sax::InputSource& rInputSource ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - - /** is called once when parsing of the xml stream starts */ - virtual void StartDocument(); - - /** is called once for each element in the xml stream. - Default implementation calls StartElement() on the topmost contex. */ - virtual void StartElement( sal_uInt32 aElementToken, const AttributeMap& rAttributes ); - - /** is called for characters betwen elements in the xml stream. - Default implementation calls Characters() on the topmost contex. - @param pCharacters The characters in utf-8 encoding - @param nLength the size in bytes of the utf-8 string - */ - virtual void Characters( const sal_Char *pCharacters, sal_uInt32 nLength ); - - /** is called once at the end of each element in the xml stream. - Default implementation calls EndElement() on the topmost contex. */ - virtual void EndElement( sal_uInt32 aElementToken ); - - /** is called once after parsing the xml stream is finished */ - virtual void EndDocument(); - - /** is called once for each element in the xml stream and before StartElement() is called. - Default implementation calls CreateContext at the topmost context. - Returned contexts are pushed on a stack and removed after the corresponding EndElement call. */ - virtual SaxContextRef CreateContext( sal_uInt32 aElementToken, const AttributeMap& rAttributes ); - - /** must be implemented from derived classes. The returned SaxTokenMap is used to convert - element names and attribute names and values to tokens. */ - virtual const SaxTokenMapRef& getTokenMap() = 0; - -private: - void AddNamespace( sal_uInt32 nNamespaceId, sal_uInt32 nNamespaceURIToken ); - - boost::scoped_ptr< SaxParserImpl > mpImpl; -}; - -} - -#endif // _SAX_SAXPARSER_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sax/inc/sax/tools/attributemap.hxx b/sax/inc/sax/tools/attributemap.hxx deleted file mode 100644 index 4ab186f3d1..0000000000 --- a/sax/inc/sax/tools/attributemap.hxx +++ /dev/null @@ -1,73 +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 _SAX_ATTRIBUTEMAP_HXX_ -#define _SAX_ATTRIBUTEMAP_HXX_ - -#include "sax/dllapi.h" - -#include <map> -#include "sax/tools/tokenmap.hxx" - -namespace sax -{ - class SaxTokenMap; - - typedef std::map< sal_uInt32, rtl::OString > AttributeMapBase; - - /** a map for a set of xml attributes, identified with integer tokens. - Attribute values are stored in utf-8 encoding. */ - class SAX_DLLPUBLIC AttributeMap : public AttributeMapBase - { - public: - AttributeMap( const SaxTokenMap& rTokenMap ); - ~AttributeMap(); - - /** returns a unicode string, if the token does not exists the string is empty */ - ::rtl::OUString getString( SaxToken nToken ) const; - - /** returns true if the attribute with the token nToken is part of this map */ - bool has( SaxToken nToken ) const; - - /** converts the attribute with the token nToken to sal_Int32 or returns - nDefault if this attribute does not exists */ - sal_Int32 getInt32( SaxToken nToken, sal_Int32 nDefault = 0 ) const; - - /** converts the attribute with the token nToken to a token or returns - nDefault if this attribute does not exists */ - sal_uInt32 getToken( SaxToken nToken, SaxToken nDefault ) const; - - private: - const SaxTokenMap& mrTokenMap; - }; - -} - -#endif // _SAX_ATTRIBUTEMAP_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sax/inc/sax/tools/converter.hxx b/sax/inc/sax/tools/converter.hxx deleted file mode 100644 index b1801ac7ae..0000000000 --- a/sax/inc/sax/tools/converter.hxx +++ /dev/null @@ -1,211 +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 _SAX_CONVERTER_HXX -#define _SAX_CONVERTER_HXX - -#include "sax/dllapi.h" - -#include <sal/types.h> - -#include <com/sun/star/uno/Sequence.h> -#include <com/sun/star/util/MeasureUnit.hpp> - - -namespace rtl -{ -class OUString; -class OUStringBuffer; -} - -namespace com { namespace sun { namespace star { - namespace util { - struct Date; - struct DateTime; - struct Duration; - } -} } } - -namespace sax { - -/** the Converter converts values of various types from - their internal represantation to the textual form used in xml - and back. - - All unit types are expressed as com::sun::star::util::MeasureUnit -*/ - - -class SAX_DLLPUBLIC Converter -{ -public: - /** convert string to measure using optional min and max values*/ - static bool convertMeasure( sal_Int32& rValue, - const ::rtl::OUString& rString, - sal_Int16 nTargetUnit = ::com::sun::star::util::MeasureUnit::MM_100TH, - sal_Int32 nMin = SAL_MIN_INT32, - sal_Int32 nMax = SAL_MAX_INT32 ); - - /** convert measure to string */ - static void convertMeasure( ::rtl::OUStringBuffer& rBuffer, - sal_Int32 nMeasure, - sal_Int16 SourceUnit = ::com::sun::star::util::MeasureUnit::MM_100TH, - sal_Int16 nTargetUnit = ::com::sun::star::util::MeasureUnit::INCH ); - - /** convert string to boolean */ - static bool convertBool( bool& rBool, - const ::rtl::OUString& rString ); - - /** convert boolean to string */ - static void convertBool( ::rtl::OUStringBuffer& rBuffer, - bool bValue ); - - /** convert string to percent */ - static bool convertPercent( sal_Int32& rValue, - const ::rtl::OUString& rString ); - - /** convert percent to string */ - static void convertPercent( ::rtl::OUStringBuffer& rBuffer, - sal_Int32 nValue ); - - /** convert string to pixel measure unite */ - static bool convertMeasurePx( sal_Int32& rValue, - const ::rtl::OUString& rString ); - - /** convert pixel measure unit to string */ - static void convertMeasurePx( ::rtl::OUStringBuffer& rBuffer, - sal_Int32 nValue ); - - /** convert string to color */ - static bool convertColor( sal_Int32& rColor, - const ::rtl::OUString&rValue ); - - /** convert color to string */ - static void convertColor( ::rtl::OUStringBuffer &rBuffer, - sal_Int32 nColor ); - - /** convert number to string */ - static void convertNumber( ::rtl::OUStringBuffer& rBuffer, - sal_Int32 nNumber ); - - /** convert string to number with optional min and max values */ - static bool convertNumber( sal_Int32& rValue, - const ::rtl::OUString& rString, - sal_Int32 nMin = SAL_MIN_INT32, - sal_Int32 nMax = SAL_MAX_INT32 ); - - /** convert double number to string (using ::rtl::math) and - DO convert from source unit to target unit */ - static void convertDouble( ::rtl::OUStringBuffer& rBuffer, - double fNumber, - bool bWriteUnits, - sal_Int16 nSourceUnit, - sal_Int16 nTargetUnit ); - - /** convert double number to string (using ::rtl::math) without unit conversion */ - static void convertDouble( ::rtl::OUStringBuffer& rBuffer, double fNumber); - - /** convert string to double number (using ::rtl::math) and DO convert from - source unit to target unit. */ - static bool convertDouble( double& rValue, - const ::rtl::OUString& rString, - sal_Int16 nSourceUnit, - sal_Int16 nTargetUnit ); - - /** convert string to double number (using ::rtl::math) without unit conversion */ - static bool convertDouble(double& rValue, const ::rtl::OUString& rString); - - /** convert string to double number (using ::rtl::math) with unit conversion */ - static bool convertDouble(double& rValue, const ::rtl::OUString& rString, sal_Int16 nTargetUnit ); - - /** convert double to ISO "duration" string; negative durations allowed */ - static void convertDuration(::rtl::OUStringBuffer& rBuffer, - const double fTime); - - /** convert util::Duration to ISO "duration" string */ - static void convertDuration(::rtl::OUStringBuffer& rBuffer, - const ::com::sun::star::util::Duration& rDuration); - - /** convert ISO "duration" string to double; negative durations allowed */ - static bool convertDuration(double & rfTime, - const ::rtl::OUString& rString); - - /** convert ISO "duration" string to util::Duration */ - static bool convertDuration(::com::sun::star::util::Duration& rDuration, - const ::rtl::OUString& rString); - - /** convert util::Date to ISO "date" string */ - static void convertDate( ::rtl::OUStringBuffer& rBuffer, - const com::sun::star::util::Date& rDate ); - - /** convert util::DateTime to ISO "date" or "dateTime" string */ - static void convertDateTime( ::rtl::OUStringBuffer& rBuffer, - const com::sun::star::util::DateTime& rDateTime, - bool bAddTimeIf0AM = false ); - - /** convert ISO "date" or "dateTime" string to util::DateTime */ - static bool convertDateTime( com::sun::star::util::DateTime& rDateTime, - const ::rtl::OUString& rString ); - - /** convert ISO "date" or "dateTime" string to util::DateTime or - util::Date */ - static bool convertDateOrDateTime( - com::sun::star::util::Date & rDate, - com::sun::star::util::DateTime & rDateTime, - bool & rbDateTime, - const ::rtl::OUString & rString ); - - /** gets the position of the first comma after npos in the string - rStr. Commas inside '"' pairs are not matched */ - static sal_Int32 indexOfComma( const ::rtl::OUString& rStr, - sal_Int32 nPos ); - - /** encodes the given byte sequence into Base64 */ - static void encodeBase64(rtl::OUStringBuffer& aStrBuffer, const com::sun::star::uno::Sequence<sal_Int8>& aPass); - - // Decode a base 64 encoded string into a sequence of bytes. The first - // version can be used for attribute values only, bacause it does not - // return any chars left from conversion. - // For text submitted throgh the SAX characters call, the later method - // must be used! - static void decodeBase64(com::sun::star::uno::Sequence<sal_Int8>& aPass, const rtl::OUString& sBuffer); - - static sal_Int32 decodeBase64SomeChars(com::sun::star::uno::Sequence<sal_Int8>& aPass, const rtl::OUString& sBuffer); - - static void clearUndefinedChars(rtl::OUString& rTarget, const rtl::OUString& rSource); - - static double GetConversionFactor(::rtl::OUStringBuffer& rUnit, sal_Int16 nSourceUnit, sal_Int16 nTargetUnit); - static sal_Int16 GetUnitFromString(const ::rtl::OUString& rString, sal_Int16 nDefaultUnit); - -}; - -} - -#endif // _SAX_CONVERTER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sax/inc/sax/tools/documenthandleradapter.hxx b/sax/inc/sax/tools/documenthandleradapter.hxx deleted file mode 100644 index 3e8705c6f9..0000000000 --- a/sax/inc/sax/tools/documenthandleradapter.hxx +++ /dev/null @@ -1,254 +0,0 @@ -/* -*- 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. 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@guineapics.de> ] - * - * Portions created by the Initial Developer are Copyright (C) 2010 the - * Initial Developer. All Rights Reserved. - * - * Contributor(s): Peter Jentsch <pjotr@guineapics.de> - * - * 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. - */ - -#ifndef _DOCUMENTHANDLERADAPTER_H_ -#define _DOCUMENTHANDLERADAPTER_H_ - -#include <com/sun/star/xml/sax/SAXException.hpp> -#include <com/sun/star/xml/sax/XDocumentHandler.hpp> -#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> - -namespace sax -{ - /** - * DocumentHandlerAdapter provides a base class for simple decorators to XDocumentHandlers. - * It forwards all method calls to a delegate. An inheriting class only needs to override the - * methods it actually wants to modify. - * - * See filters/source/odfflatxml/FlatXml.cxx for an example. - */ - class DocumentHandlerAdapter : public ::com::sun::star::xml::sax::XDocumentHandler - { - public: - // XDocumentHandler - virtual void SAL_CALL - startDocument(void) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) - { - m_handler->startDocument(); - } - - virtual void SAL_CALL - endDocument(void) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) - { - m_handler->endDocument(); - } - - virtual void SAL_CALL - startElement(const ::rtl::OUString& aName, - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttribs) - throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) - { - m_handler->startElement(aName, xAttribs); - } - - virtual void SAL_CALL - endElement(const ::rtl::OUString& aName) throw (::com::sun::star::xml::sax::SAXException, - ::com::sun::star::uno::RuntimeException) - { - m_handler->endElement(aName); - } - - virtual void SAL_CALL - characters(const ::rtl::OUString& aChars) throw (::com::sun::star::xml::sax::SAXException, - ::com::sun::star::uno::RuntimeException) - { - m_handler->characters(aChars); - } - - virtual void SAL_CALL - ignorableWhitespace(const ::rtl::OUString& aWhitespaces) throw (::com::sun::star::xml::sax::SAXException, - ::com::sun::star::uno::RuntimeException) - { - m_handler->ignorableWhitespace(aWhitespaces); - } - virtual void SAL_CALL - processingInstruction(const ::rtl::OUString& aTarget, const ::rtl::OUString& aData) - throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) - { - m_handler->processingInstruction(aTarget, aData); - } - virtual void SAL_CALL - setDocumentLocator(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > & xLocator) - throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) - { - m_handler->setDocumentLocator(xLocator); - } - DocumentHandlerAdapter(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >& delegate); - DocumentHandlerAdapter() : - m_handler(::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > (0, ::com::sun::star::uno::UNO_QUERY)) - { - } - ; - - protected: - virtual void SAL_CALL - setDelegate(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >& delegate) - { - m_handler = delegate; - } - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > SAL_CALL - getDelegate() - { - return m_handler; - } - virtual - ~DocumentHandlerAdapter() - { - - } - - private: - ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_handler; - - }; - - /** - * ExtendedDocumentHandlerAdapter provides a base class for simple decorators to XExtendedDocumentHandlers. - * It forwards all method calls to a delegate. An inheriting class only needs to override the - * methods it actually wants to modify. - */ - class ExtendedDocumentHandlerAdapter : public ::com::sun::star::xml::sax::XExtendedDocumentHandler - - { - - public: - // XDocumentHandler - virtual void SAL_CALL - startDocument(void) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) - { - m_handler->startDocument(); - } - - virtual void SAL_CALL - endDocument(void) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) - { - m_handler->endDocument(); - } - - virtual void SAL_CALL - startElement(const ::rtl::OUString& aName, - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttribs) - throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) - { - m_handler->startElement(aName, xAttribs); - } - - virtual void SAL_CALL - endElement(const ::rtl::OUString& aName) throw (::com::sun::star::xml::sax::SAXException, - ::com::sun::star::uno::RuntimeException) - { - m_handler->endElement(aName); - } - - virtual void SAL_CALL - characters(const ::rtl::OUString& aChars) throw (::com::sun::star::xml::sax::SAXException, - ::com::sun::star::uno::RuntimeException) - { - m_handler->characters(aChars); - } - - virtual void SAL_CALL - ignorableWhitespace(const ::rtl::OUString& aWhitespaces) throw (::com::sun::star::xml::sax::SAXException, - ::com::sun::star::uno::RuntimeException) - { - m_handler->ignorableWhitespace(aWhitespaces); - } - virtual void SAL_CALL - processingInstruction(const ::rtl::OUString& aTarget, const ::rtl::OUString& aData) - throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) - { - m_handler->processingInstruction(aTarget, aData); - } - virtual void SAL_CALL - setDocumentLocator(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > & xLocator) - throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) - { - m_handler->setDocumentLocator(xLocator); - } - // XExtendedDocumentHandler - virtual void SAL_CALL - startCDATA(void) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) - { - m_handler->startCDATA(); - } - virtual void SAL_CALL - endCDATA(void) throw (::com::sun::star::uno::RuntimeException) - { - m_handler->endCDATA(); - } - virtual void SAL_CALL - comment(const ::rtl::OUString& sComment) throw (::com::sun::star::xml::sax::SAXException, - ::com::sun::star::uno::RuntimeException) - { - m_handler->comment(sComment); - } - virtual void SAL_CALL - unknown(const ::rtl::OUString& sString) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) - { - m_handler->unknown(sString); - } - virtual void SAL_CALL - allowLineBreak(void) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) - { - m_handler->allowLineBreak(); - } - protected: - ExtendedDocumentHandlerAdapter() : - m_handler(::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > (0, ::com::sun::star::uno::UNO_QUERY)) - { - } - ExtendedDocumentHandlerAdapter( - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > delegate) : - m_handler(delegate) - { - } - - virtual void SAL_CALL - setDelegate(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler >& delegate) - { - m_handler = delegate; - } - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > SAL_CALL - getDelegate() - { - return m_handler; - } - virtual - ~ExtendedDocumentHandlerAdapter() - { - - } - - private: - ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > m_handler; - }; -} -#endif /* _DOCUMENTHANDLERADAPTER_H_ */ -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sax/inc/sax/tools/saxobject.hxx b/sax/inc/sax/tools/saxobject.hxx deleted file mode 100644 index f5ebd21b59..0000000000 --- a/sax/inc/sax/tools/saxobject.hxx +++ /dev/null @@ -1,53 +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 _SAX_OBJECT_HXX_ -#define _SAX_OBJECT_HXX_ - -#include <sal/types.h> -#include "sax/dllapi.h" - -namespace sax -{ - - /** simple base class to allow refcounting with rtl::Reference or css::uno::Reference */ - class SAX_DLLPUBLIC SaxObject - { - public: - SaxObject(); - virtual ~SaxObject(); - virtual void SAL_CALL acquire() throw (); - virtual void SAL_CALL release() throw (); - private: - sal_uInt32 mnRefCount; - }; -} - -#endif // _SAX_OBJECT_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sax/inc/sax/tools/tokenmap.hxx b/sax/inc/sax/tools/tokenmap.hxx deleted file mode 100644 index 7aaef238c8..0000000000 --- a/sax/inc/sax/tools/tokenmap.hxx +++ /dev/null @@ -1,68 +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 _SAX_TOKENMAP_HXX_ -#define _SAX_TOKENMAP_HXX_ - -#include <rtl/ref.hxx> -#include <rtl/ustring.hxx> -#include "sax/dllapi.h" -#include "sax/tools/saxobject.hxx" - -namespace sax -{ - /** type for a token identifier */ - typedef sal_uInt32 SaxToken; - - /** this class maps a set of ascii/utf-8 strings to token identifier */ - class SAX_DLLPUBLIC SaxTokenMap : public SaxObject - { - public: - /** constant do indicate an unknown token */ - const static SaxToken InvalidToken = (SaxToken)-1; - - /** returns the token identifier for the given ascii string or SaxTokenMap::InvalidToken */ - virtual SaxToken GetToken( const sal_Char* pChar, sal_uInt32 nLength = 0 ) const = 0; - - /** returns the token identifier for the given unicode string or SaxTokenMap::InvalidToken */ - virtual SaxToken GetToken( const ::rtl::OUString& rToken ) const = 0; - - /** returns the unicode string for the given token identifier */ - virtual const ::rtl::OUString& GetToken( SaxToken nToken ) const = 0; - - /** returns if the given unicode string equals the given token identifier */ - bool IsToken( const ::rtl::OUString& rToken, SaxToken nToken ) const { return GetToken( rToken ) == nToken; } - }; - - /** reference type to a SaxTokenMap */ - typedef rtl::Reference< SaxTokenMap > SaxTokenMapRef; -} - -#endif // _SAX_TOKENMAP_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |