diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2007-04-11 12:22:50 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2007-04-11 12:22:50 +0000 |
commit | 7595f8db5819fd52a09bfaddd5b9c357c899a08a (patch) | |
tree | 64f04d20ff457f52ab3bbe21e384dfb0a0a3d462 /xmloff | |
parent | 8a719e6110e64b0234ded886671ad9143bdb9040 (diff) |
INTEGRATION: CWS hedaburemove01 (1.1.2); FILE ADDED
2007/02/09 16:08:54 vg 1.1.2.1: #72503# get rid of hedabu procedure: Moving headers to xmloff/inc/xmloff and correspondent necessary changes
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/inc/xmloff/SinglePropertySetInfoCache.hxx | 92 | ||||
-rw-r--r-- | xmloff/inc/xmloff/XMLBase64ImportContext.hxx | 83 | ||||
-rw-r--r-- | xmloff/inc/xmloff/XMLConstantsPropertyHandler.hxx | 88 | ||||
-rw-r--r-- | xmloff/inc/xmloff/XMLEventExport.hxx | 159 |
4 files changed, 422 insertions, 0 deletions
diff --git a/xmloff/inc/xmloff/SinglePropertySetInfoCache.hxx b/xmloff/inc/xmloff/SinglePropertySetInfoCache.hxx new file mode 100644 index 000000000000..fec5ae2eae60 --- /dev/null +++ b/xmloff/inc/xmloff/SinglePropertySetInfoCache.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: SinglePropertySetInfoCache.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: vg $ $Date: 2007-04-11 13:22:14 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _XMLOFF_SINGEPROPERTYSETINFOCACHE_HXX +#define _XMLOFF_SINGEPROPERTYSETINFOCACHE_HXX + +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif + +#include <hash_map> + +#ifndef _XMLOFF_PROPERTYSETINFOHASH_HXX +#include <xmloff/PropertySetInfoHash.hxx> +#endif + +typedef std::hash_map +< + PropertySetInfoKey, + sal_Bool, + PropertySetInfoHash, + PropertySetInfoHash +> +SinglePropertySetInfoMap_Impl; + +class SinglePropertySetInfoCache : private SinglePropertySetInfoMap_Impl +{ + ::rtl::OUString sName; + +public: + + inline SinglePropertySetInfoCache( const ::rtl::OUString& rName ); + ~SinglePropertySetInfoCache() {}; + + sal_Bool hasProperty( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& rPropSet, + ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySetInfo >& rPropSetInfo ); + inline sal_Bool hasProperty( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet>& rPropSet ); +}; + +inline SinglePropertySetInfoCache::SinglePropertySetInfoCache( + const ::rtl::OUString& rName ) : + sName( rName ) +{ +} + +inline sal_Bool SinglePropertySetInfoCache::hasProperty( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet>& rPropSet ) +{ + ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySetInfo > xInfo; + return hasProperty( rPropSet, xInfo ); +} + +#endif diff --git a/xmloff/inc/xmloff/XMLBase64ImportContext.hxx b/xmloff/inc/xmloff/XMLBase64ImportContext.hxx new file mode 100644 index 000000000000..a214b576b1cc --- /dev/null +++ b/xmloff/inc/xmloff/XMLBase64ImportContext.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XMLBase64ImportContext.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: vg $ $Date: 2007-04-11 13:22:27 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _XMLOFF_XMLBASE64IMPORTCONTEXT_HXX +#define _XMLOFF_XMLBASE64IMPORTCONTEXT_HXX + +#ifndef _SAL_CONFIG_H_ +#include "sal/config.h" +#endif + +#ifndef INCLUDED_XMLOFF_DLLAPI_H +#include "xmloff/dllapi.h" +#endif + +#ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_ +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#endif + +#ifndef _XMLOFF_XMLICTXT_HXX +#include <xmloff/xmlictxt.hxx> +#endif + +namespace com { namespace sun { namespace star { namespace io { + class XOutputStream; } } } } + +class XMLOFF_DLLPUBLIC XMLBase64ImportContext : public SvXMLImportContext +{ + ::com::sun::star::uno::Reference< + ::com::sun::star::io::XOutputStream > xOut; + ::rtl::OUString sBase64CharsLeft; + +public: + TYPEINFO(); + + XMLBase64ImportContext( SvXMLImport& rImport, USHORT nPrfx, + const ::rtl::OUString& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList >& xAttrList, + const ::com::sun::star::uno::Reference< + ::com::sun::star::io::XOutputStream >& rOut ); + + virtual ~XMLBase64ImportContext(); + + virtual void EndElement(); + + virtual void Characters( const ::rtl::OUString& rChars ); + +}; + +#endif // _XMLOFF_XMLBASE64IMPORTCONTEXT_HXX + diff --git a/xmloff/inc/xmloff/XMLConstantsPropertyHandler.hxx b/xmloff/inc/xmloff/XMLConstantsPropertyHandler.hxx new file mode 100644 index 000000000000..105d5f80fae4 --- /dev/null +++ b/xmloff/inc/xmloff/XMLConstantsPropertyHandler.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XMLConstantsPropertyHandler.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: vg $ $Date: 2007-04-11 13:22:39 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _XMLOFF_XMLCONSTANTSPROPERTYHANDLER_HXX +#define _XMLOFF_XMLCONSTANTSPROPERTYHANDLER_HXX + +#ifndef _SAL_CONFIG_H_ +#include "sal/config.h" +#endif + +#ifndef INCLUDED_XMLOFF_DLLAPI_H +#include "xmloff/dllapi.h" +#endif + +#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX +#include <xmloff/xmlprhdl.hxx> +#endif + +#ifndef _XMLOFF_XMLTOKEN_HXX +#include <xmloff/xmltoken.hxx> +#endif + +struct SvXMLEnumMapEntry; + +/////////////////////////////////////////////////////////////////////////// +// +/** Abstract base-class for different XML-types. Derivations of this class + knows how to compare, im/export a special XML-type +*/ +class XMLOFF_DLLPUBLIC XMLConstantsPropertyHandler: public XMLPropertyHandler +{ + const SvXMLEnumMapEntry *pMap; + const enum ::xmloff::token::XMLTokenEnum eDefault; + +public: + + XMLConstantsPropertyHandler( const SvXMLEnumMapEntry *pM, + enum ::xmloff::token::XMLTokenEnum eDflt); + + // Just needed for virtual destruction + virtual ~XMLConstantsPropertyHandler(); + + /// Imports the given value in cas of the given XML-data-type + virtual sal_Bool importXML( + const ::rtl::OUString& rStrImpValue, + ::com::sun::star::uno::Any& rValue, + const SvXMLUnitConverter& rUnitConverter ) const; + + /// Exports the given value in cas of the given XML-data-type + virtual sal_Bool exportXML( + ::rtl::OUString& rStrExpValue, + const ::com::sun::star::uno::Any& rValue, + const SvXMLUnitConverter& rUnitConverter ) const; +}; + +#endif // _XMLOFF_XMLCONSTANTSPROPERTYHANDLER_HXX diff --git a/xmloff/inc/xmloff/XMLEventExport.hxx b/xmloff/inc/xmloff/XMLEventExport.hxx new file mode 100644 index 000000000000..5ae7ae520ed0 --- /dev/null +++ b/xmloff/inc/xmloff/XMLEventExport.hxx @@ -0,0 +1,159 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: XMLEventExport.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: vg $ $Date: 2007-04-11 13:22:50 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef _XMLOFF_XMLEVENTEXPORT_HXX +#define _XMLOFF_XMLEVENTEXPORT_HXX + +#ifndef _SAL_CONFIG_H_ +#include "sal/config.h" +#endif + +#ifndef INCLUDED_XMLOFF_DLLAPI_H +#include "xmloff/dllapi.h" +#endif + +#ifndef _SAL_TYPES_H_ +#include "sal/types.h" +#endif + +#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_ +#include <com/sun/star/uno/Sequence.hxx> +#endif + +#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_ +#include <com/sun/star/uno/Reference.hxx> +#endif + +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif + +#ifndef _XMLOFF_XMLEVENT_HXX +#include <xmloff/xmlevent.hxx> +#endif + +#include <map> + +class SvXMLExport; +namespace com { namespace sun { namespace star { + namespace document { class XEventsSupplier; } + namespace container { class XNameReplace; } + namespace container { class XNameAccess; } + namespace beans { struct PropertyValue; } +} } } + +typedef ::std::map< ::rtl::OUString, XMLEventExportHandler* > HandlerMap; +typedef ::std::map< ::rtl::OUString, XMLEventName > NameMap; + +/** + * Export instances of EventsSupplier services. To use this class you + * must fulfill two conditions: + * + * 1) provide a translation from the API event names to XML event + * names + * 2) Register XMLEventExportHandler instances for all script types + * that you would like to export. + * + * The Export()-Methods all have a bUseWhitespace parameter that + * causes the exported elements to be surrounded by whitespace, which + * in turn causes the elements to be indented properly. By default, + * whitespace is used, but it may not be called for in all cases (e.g + * events attached to hyperlink within a paragraph.) + */ +class XMLOFF_DLLPUBLIC XMLEventExport +{ + const ::rtl::OUString sEventType; + + SvXMLExport& rExport; + + HandlerMap aHandlerMap; + NameMap aNameTranslationMap; + +public: + XMLEventExport(SvXMLExport& rExport, + const XMLEventNameTranslation* pTranslationTable = NULL); + ~XMLEventExport(); + + /// register an EventExportHandler for a particular script type + /// + /// The handlers will be deleted when the object is destroyed, hence + /// no pointers to a handler registered with AddHandler() should be + /// held by anyone. + void AddHandler( const ::rtl::OUString& rName, + XMLEventExportHandler* rHandler ); + + /// register additional event names + void AddTranslationTable( const XMLEventNameTranslation* pTransTable ); + + /// export the events (calls EventExport::Export(Reference<XNameAcess>) ) + void Export( ::com::sun::star::uno::Reference< + ::com::sun::star::document::XEventsSupplier> & xAccess, + sal_Bool bUseWhitespace = sal_True); + + /// export the events (calls EventExport::Export(Reference<XNameAcess>) ) + void Export( ::com::sun::star::uno::Reference< + ::com::sun::star::container::XNameReplace> & xAccess, + sal_Bool bUseWhitespace = sal_True); + + /// export the events (writes <office:events> element) + void Export( ::com::sun::star::uno::Reference< + ::com::sun::star::container::XNameAccess> & xAccess, + sal_Bool bUseWhitespace = sal_True); + + /// export a single event (writes <office:events> element) + void ExportSingleEvent( + ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue>& rEventValues, + const ::rtl::OUString& rApiEventName, + sal_Bool bUseWhitespace = sal_True ); + +private: + + /// export one event (start container-element if necessary) + SAL_DLLPRIVATE void ExportEvent( + ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue>& rEventValues, + const XMLEventName& rXmlEventName, + sal_Bool bUseWhitespace, + sal_Bool& rExported); + + /// export the start element + SAL_DLLPRIVATE void StartElement(sal_Bool bUseWhitespace); + + /// export the end element + SAL_DLLPRIVATE void EndElement(sal_Bool bUseWhitespace); +}; + +#endif |