diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2013-04-18 18:26:28 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2013-04-23 22:20:31 +0200 |
commit | b9337e22ce1dbf2eba0e8c8db294ae99f4111f91 (patch) | |
tree | 53ee1bd3dfd213815a21579151983cb997922b05 /include/xmloff | |
parent | f4e1642a1761d5eab6ccdd89928869c2b2f1528a (diff) |
execute move of global headers
see https://gerrit.libreoffice.org/#/c/3367/
and Change-Id: I00c96fa77d04b33a6f8c8cd3490dfcd9bdc9e84a for details
Change-Id: I199a75bc4042af20817265d5ef85b1134a96ff5a
Diffstat (limited to 'include/xmloff')
100 files changed, 15478 insertions, 0 deletions
diff --git a/include/xmloff/DashStyle.hxx b/include/xmloff/DashStyle.hxx new file mode 100644 index 000000000000..576414bb7135 --- /dev/null +++ b/include/xmloff/DashStyle.hxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_DASHSTYLE_HXX +#define _XMLOFF_DASHSTYLE_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <sal/types.h> + +class SvXMLImport; +class SvXMLExport; +namespace com { namespace sun { namespace star { + namespace uno { template<class A> class Reference; } + namespace xml { namespace sax { class XAttributeList; } } + namespace uno { class Any; } +} } } + + +class XMLOFF_DLLPUBLIC XMLDashStyleImport +{ + SvXMLImport& rImport; + +public: + XMLDashStyleImport( SvXMLImport& rImport ); + ~XMLDashStyleImport(); + + sal_Bool importXML( + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList >& xAttrList, + ::com::sun::star::uno::Any& rValue, + OUString& rStrName ); +}; + + +class XMLOFF_DLLPUBLIC XMLDashStyleExport +{ + SvXMLExport& rExport; + +public: + XMLDashStyleExport( SvXMLExport& rExport ); + ~XMLDashStyleExport(); + + sal_Bool exportXML( const OUString& rStrName, + const ::com::sun::star::uno::Any& rValue ); +}; + +#endif // _XMLOFF_DASHSTYLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/DocumentSettingsContext.hxx b/include/xmloff/DocumentSettingsContext.hxx new file mode 100644 index 000000000000..a9277946ca9a --- /dev/null +++ b/include/xmloff/DocumentSettingsContext.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_DOCUMENTSETTINGSCONTEXT_HXX +#define _XMLOFF_DOCUMENTSETTINGSCONTEXT_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <xmloff/xmlictxt.hxx> +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/beans/PropertyValue.hpp> + +#include <memory> + +struct XMLDocumentSettingsContext_Data; + +class XMLOFF_DLLPUBLIC XMLDocumentSettingsContext : public SvXMLImportContext +{ + ::std::auto_ptr< XMLDocumentSettingsContext_Data > m_pData; + +public: + XMLDocumentSettingsContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList); + virtual ~XMLDocumentSettingsContext(); + + virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); + virtual void EndElement(); + +private: + XMLDocumentSettingsContext(); // never implemented + XMLDocumentSettingsContext( const XMLDocumentSettingsContext& ); // never implemented + XMLDocumentSettingsContext& operator=( const XMLDocumentSettingsContext& ); // never implemented +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/EnumPropertyHdl.hxx b/include/xmloff/EnumPropertyHdl.hxx new file mode 100644 index 000000000000..f2ef26d4c974 --- /dev/null +++ b/include/xmloff/EnumPropertyHdl.hxx @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_ENUMPROPERTYHANDLER_HXX +#define _XMLOFF_ENUMPROPERTYHANDLER_HXX + +#include <xmloff/xmlprhdl.hxx> +#include <com/sun/star/uno/Type.h> +#include <xmloff/xmlement.hxx> + +/** + PropertyHandler for a generic xml enumeration type: +*/ +class XMLOFF_DLLPUBLIC XMLEnumPropertyHdl : public XMLPropertyHandler +{ +private: + const SvXMLEnumMapEntry* mpEnumMap; + const ::com::sun::star::uno::Type & mrType; + +public: + XMLEnumPropertyHdl( const SvXMLEnumMapEntry* pEnumMap, const ::com::sun::star::uno::Type & rType ) : mpEnumMap( pEnumMap ), mrType( rType ) {} + virtual ~XMLEnumPropertyHdl(); + + virtual sal_Bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const; + virtual sal_Bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const; +}; + +#endif // _XMLOFF_ENUMPROPERTYHANDLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/GradientStyle.hxx b/include/xmloff/GradientStyle.hxx new file mode 100644 index 000000000000..145ba554505d --- /dev/null +++ b/include/xmloff/GradientStyle.hxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_GRADIENTSTYLE_HXX +#define _XMLOFF_GRADIENTSTYLE_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <sal/types.h> +#include <rtl/ustring.hxx> + +class SvXMLImport; +class SvXMLExport; +namespace com { namespace sun { namespace star { + namespace uno { template<class A> class Reference; } + namespace xml { namespace sax { class XAttributeList; } } + namespace uno { class Any; } +} } } + + +class XMLOFF_DLLPUBLIC XMLGradientStyleImport +{ + SvXMLImport& rImport; + +public: + XMLGradientStyleImport( SvXMLImport& rImport ); + ~XMLGradientStyleImport(); + + sal_Bool importXML( + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList >& xAttrList, + ::com::sun::star::uno::Any& rValue, + OUString& rStrName ); +}; + + +class XMLOFF_DLLPUBLIC XMLGradientStyleExport +{ + SvXMLExport& rExport; + +public: + XMLGradientStyleExport( SvXMLExport& rExport ); + ~XMLGradientStyleExport(); + + sal_Bool exportXML( + const OUString& rStrName, + const ::com::sun::star::uno::Any& rValue ); +}; + +#endif // _XMLOFF_GRADIENTSTYLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/HatchStyle.hxx b/include/xmloff/HatchStyle.hxx new file mode 100644 index 000000000000..6cdceb618f10 --- /dev/null +++ b/include/xmloff/HatchStyle.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_HATCHSTYLE_HXX +#define _XMLOFF_HATCHSTYLE_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <sal/types.h> +#include <rtl/ustring.hxx> + +class SvXMLImport; +class SvXMLExport; +namespace com { namespace sun { namespace star { + namespace uno { template<class A> class Reference; } + namespace xml { namespace sax { class XAttributeList; } } + namespace uno { class Any; } +} } } + + +class XMLOFF_DLLPUBLIC XMLHatchStyleImport +{ + SvXMLImport& rImport; + +public: + XMLHatchStyleImport( SvXMLImport& rImport ); + ~XMLHatchStyleImport(); + + sal_Bool importXML( + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList, + ::com::sun::star::uno::Any& rValue, + OUString& rStrName ); +}; + +class XMLOFF_DLLPUBLIC XMLHatchStyleExport +{ + SvXMLExport& rExport; + +public: + XMLHatchStyleExport( SvXMLExport& rExport ); + ~XMLHatchStyleExport(); + + sal_Bool exportXML( const OUString& rStrName, const ::com::sun::star::uno::Any& rValue ); +}; + +#endif // _XMLOFF_HATCHELEMENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/ImageStyle.hxx b/include/xmloff/ImageStyle.hxx new file mode 100644 index 000000000000..5c0dfd6ff820 --- /dev/null +++ b/include/xmloff/ImageStyle.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_IMAGESTYLE_HXX +#define _XMLOFF_IMAGESTYLE_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include "sal/types.h" +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> + +class SvXMLNamespaceMap; +class SvXMLAttributeList; +class SvXMLUnitConverter; +class SvXMLExport; +class SvXMLImport; + +class XMLOFF_DLLPUBLIC XMLImageStyle +{ +public: + XMLImageStyle(); + ~XMLImageStyle(); + + sal_Bool exportXML( const OUString& rStrName, const ::com::sun::star::uno::Any& rValue, SvXMLExport& rExport ); + sal_Bool importXML( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList, ::com::sun::star::uno::Any& rValue, OUString& rStrName, SvXMLImport& rImport ); + +private: + + SAL_DLLPRIVATE sal_Bool ImpExportXML( const OUString& rStrName, const ::com::sun::star::uno::Any& rValue, + SvXMLExport& rExport ); + SAL_DLLPRIVATE sal_Bool ImpImportXML( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList, + ::com::sun::star::uno::Any& rValue, OUString& rStrName, + SvXMLImport& rImport ); +}; + +#endif // _XMLOFF_IMAGESTYLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/MarkerStyle.hxx b/include/xmloff/MarkerStyle.hxx new file mode 100644 index 000000000000..5cff7cb23745 --- /dev/null +++ b/include/xmloff/MarkerStyle.hxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_MARKERSTYLE_HXX +#define _XMLOFF_MARKERSTYLE_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <sal/types.h> +#include <rtl/ustring.hxx> + +class SvXMLImport; +class SvXMLExport; +namespace com { namespace sun { namespace star { + namespace uno { template<class A> class Reference; } + namespace xml { namespace sax { class XAttributeList; } } + namespace uno { class Any; } +} } } + + +class XMLOFF_DLLPUBLIC XMLMarkerStyleImport +{ + SvXMLImport& rImport; + +public: + XMLMarkerStyleImport( SvXMLImport& rImport ); + ~XMLMarkerStyleImport(); + + sal_Bool importXML( + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList >& xAttrList, + ::com::sun::star::uno::Any& rValue, + OUString& rStrName ); +}; + +class XMLOFF_DLLPUBLIC XMLMarkerStyleExport +{ + SvXMLExport& rExport; + +public: + XMLMarkerStyleExport( SvXMLExport& rExport ); + ~XMLMarkerStyleExport(); + + sal_Bool exportXML( + const OUString& rStrName, + const ::com::sun::star::uno::Any& rValue ); +}; + +#endif // _XMLOFF_MARKERSTYLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/NamedBoolPropertyHdl.hxx b/include/xmloff/NamedBoolPropertyHdl.hxx new file mode 100644 index 000000000000..e6dc49c20fff --- /dev/null +++ b/include/xmloff/NamedBoolPropertyHdl.hxx @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_NAMEDBOOLPROPERTYHANDLER_HXX +#define _XMLOFF_NAMEDBOOLPROPERTYHANDLER_HXX + +#include <xmloff/xmlprhdl.hxx> +#include <xmloff/xmltoken.hxx> +#include <com/sun/star/uno/Type.h> +#include <xmloff/xmlement.hxx> + +/** + PropertyHandler for a named xml bool type: +*/ +class XMLNamedBoolPropertyHdl : public XMLPropertyHandler +{ +private: + const OUString maTrueStr; + const OUString maFalseStr; + +public: + XMLNamedBoolPropertyHdl( const OUString& rTrueStr, const OUString& rFalseStr ) : maTrueStr( rTrueStr ), maFalseStr( rFalseStr ) {} + + XMLNamedBoolPropertyHdl( + ::xmloff::token::XMLTokenEnum eTrue, + ::xmloff::token::XMLTokenEnum eFalse + ) : + maTrueStr( ::xmloff::token::GetXMLToken( eTrue ) ), + maFalseStr( ::xmloff::token::GetXMLToken( eFalse ) ) + {} + + virtual ~XMLNamedBoolPropertyHdl(); + + virtual sal_Bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const; + virtual sal_Bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const; +}; + +#endif // _XMLOFF_NAMEDBOOLPROPERTYHANDLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/PageMasterStyleMap.hxx b/include/xmloff/PageMasterStyleMap.hxx new file mode 100644 index 000000000000..c3a83922ec14 --- /dev/null +++ b/include/xmloff/PageMasterStyleMap.hxx @@ -0,0 +1,168 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_PAGEMASTERSTYLEMAP_HXX_ +#define _XMLOFF_PAGEMASTERSTYLEMAP_HXX_ + +#include <xmloff/maptype.hxx> +#include <xmloff/xmltypes.hxx> +#include <xmloff/contextid.hxx> + +//______________________________________________________________________________ + +#define XML_PM_TYPE_PAGESTYLELAYOUT (XML_PM_TYPES_START + 0) +#define XML_PM_TYPE_NUMFORMAT (XML_PM_TYPES_START + 1) +#define XML_PM_TYPE_NUMLETTERSYNC (XML_PM_TYPES_START + 2) +#define XML_PM_TYPE_PAPERTRAYNUMBER (XML_PM_TYPES_START + 3) +#define XML_PM_TYPE_PRINTORIENTATION (XML_PM_TYPES_START + 4) +#define XML_PM_TYPE_PRINTANNOTATIONS (XML_PM_TYPES_START + 5) +#define XML_PM_TYPE_PRINTCHARTS (XML_PM_TYPES_START + 6) +#define XML_PM_TYPE_PRINTDRAWING (XML_PM_TYPES_START + 7) +#define XML_PM_TYPE_PRINTFORMULAS (XML_PM_TYPES_START + 8) +#define XML_PM_TYPE_PRINTGRID (XML_PM_TYPES_START + 9) +#define XML_PM_TYPE_PRINTHEADERS (XML_PM_TYPES_START + 10) +#define XML_PM_TYPE_PRINTOBJECTS (XML_PM_TYPES_START + 11) +#define XML_PM_TYPE_PRINTZEROVALUES (XML_PM_TYPES_START + 12) +#define XML_PM_TYPE_PRINTPAGEORDER (XML_PM_TYPES_START + 13) +#define XML_PM_TYPE_FIRSTPAGENUMBER (XML_PM_TYPES_START + 14) +#define XML_PM_TYPE_CENTER_HORIZONTAL (XML_PM_TYPES_START + 15) +#define XML_PM_TYPE_CENTER_VERTICAL (XML_PM_TYPES_START + 16) + +// control flags +#define CTF_PM_FLAGMASK (XML_PM_CTF_START + 0x0F00) +#define CTF_PM_HEADERFLAG (XML_PM_CTF_START + 0x0100) +#define CTF_PM_FOOTERFLAG (XML_PM_CTF_START + 0x0200) +#define CTF_PM_PRINTMASK (XML_PM_CTF_START + 0x1000) +// page master +#define CTF_PM_BORDERALL (XML_PM_CTF_START + 0x0001) +#define CTF_PM_BORDERTOP (XML_PM_CTF_START + 0x0002) +#define CTF_PM_BORDERBOTTOM (XML_PM_CTF_START + 0x0003) +#define CTF_PM_BORDERLEFT (XML_PM_CTF_START + 0x0004) +#define CTF_PM_BORDERRIGHT (XML_PM_CTF_START + 0x0005) +#define CTF_PM_BORDERWIDTHALL (XML_PM_CTF_START + 0x0006) +#define CTF_PM_BORDERWIDTHTOP (XML_PM_CTF_START + 0x0007) +#define CTF_PM_BORDERWIDTHBOTTOM (XML_PM_CTF_START + 0x0008) +#define CTF_PM_BORDERWIDTHLEFT (XML_PM_CTF_START + 0x0009) +#define CTF_PM_BORDERWIDTHRIGHT (XML_PM_CTF_START + 0x000A) +#define CTF_PM_PADDINGALL (XML_PM_CTF_START + 0x000B) +#define CTF_PM_PADDINGTOP (XML_PM_CTF_START + 0x000C) +#define CTF_PM_PADDINGBOTTOM (XML_PM_CTF_START + 0x000D) +#define CTF_PM_PADDINGLEFT (XML_PM_CTF_START + 0x000E) +#define CTF_PM_PADDINGRIGHT (XML_PM_CTF_START + 0x000F) +#define CTF_PM_TEXTCOLUMNS (XML_PM_CTF_START + 0x0010) +#define CTF_PM_REGISTER_STYLE (XML_PM_CTF_START + 0x0011) +#define CTF_PM_PRINT_ANNOTATIONS (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0012)) +#define CTF_PM_PRINT_CHARTS (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0013)) +#define CTF_PM_PRINT_DRAWING (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0014)) +#define CTF_PM_PRINT_FORMULAS (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0015)) +#define CTF_PM_PRINT_GRID (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0016)) +#define CTF_PM_PRINT_HEADERS (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0017)) +#define CTF_PM_PRINT_OBJECTS (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0018)) +#define CTF_PM_PRINT_ZEROVALUES (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0019)) +#define CTF_PM_MARGINALL (XML_PM_CTF_START + 0x001A) +#define CTF_PM_MARGINTOP (XML_PM_CTF_START + 0x001B) +#define CTF_PM_MARGINBOTTOM (XML_PM_CTF_START + 0x001C) +#define CTF_PM_MARGINLEFT (XML_PM_CTF_START + 0x001D) +#define CTF_PM_MARGINRIGHT (XML_PM_CTF_START + 0x001E) + +#define CTF_PM_PAGEUSAGE (XML_PM_CTF_START + 0x0031) +#define CTF_PM_GRAPHICPOSITION (XML_PM_CTF_START + 0x0032) +#define CTF_PM_GRAPHICFILTER (XML_PM_CTF_START + 0x0033) +#define CTF_PM_GRAPHICURL (XML_PM_CTF_START + 0x0034) + +#define CTF_PM_SCALETO (XML_PM_CTF_START + 0x0051) // calc specific +#define CTF_PM_SCALETOPAGES (XML_PM_CTF_START + 0x0052) +#define CTF_PM_SCALETOX (XML_PM_CTF_START + 0x0053) +#define CTF_PM_SCALETOY (XML_PM_CTF_START + 0x0054) +#define CTF_PM_STANDARD_MODE (XML_PM_CTF_START + 0x0055) +#define CTP_PM_GRID_BASE_WIDTH (XML_PM_CTF_START + 0x0056) +#define CTP_PM_GRID_SNAP_TO_CHARS (XML_PM_CTF_START + 0x0057) +#define CTP_PM_GRID_SNAP_TO (XML_PM_CTF_START + 0x0058) +// header +#define CTF_PM_HEADERBORDERALL (CTF_PM_HEADERFLAG|CTF_PM_BORDERALL) +#define CTF_PM_HEADERBORDERTOP (CTF_PM_HEADERFLAG|CTF_PM_BORDERTOP) +#define CTF_PM_HEADERBORDERBOTTOM (CTF_PM_HEADERFLAG|CTF_PM_BORDERBOTTOM) +#define CTF_PM_HEADERBORDERLEFT (CTF_PM_HEADERFLAG|CTF_PM_BORDERLEFT) +#define CTF_PM_HEADERBORDERRIGHT (CTF_PM_HEADERFLAG|CTF_PM_BORDERRIGHT) +#define CTF_PM_HEADERBORDERWIDTHALL (CTF_PM_HEADERFLAG|CTF_PM_BORDERWIDTHALL) +#define CTF_PM_HEADERBORDERWIDTHTOP (CTF_PM_HEADERFLAG|CTF_PM_BORDERWIDTHTOP) +#define CTF_PM_HEADERBORDERWIDTHBOTTOM (CTF_PM_HEADERFLAG|CTF_PM_BORDERWIDTHBOTTOM) +#define CTF_PM_HEADERBORDERWIDTHLEFT (CTF_PM_HEADERFLAG|CTF_PM_BORDERWIDTHLEFT) +#define CTF_PM_HEADERBORDERWIDTHRIGHT (CTF_PM_HEADERFLAG|CTF_PM_BORDERWIDTHRIGHT) +#define CTF_PM_HEADERPADDINGALL (CTF_PM_HEADERFLAG|CTF_PM_PADDINGALL) +#define CTF_PM_HEADERPADDINGTOP (CTF_PM_HEADERFLAG|CTF_PM_PADDINGTOP) +#define CTF_PM_HEADERPADDINGBOTTOM (CTF_PM_HEADERFLAG|CTF_PM_PADDINGBOTTOM) +#define CTF_PM_HEADERPADDINGLEFT (CTF_PM_HEADERFLAG|CTF_PM_PADDINGLEFT) +#define CTF_PM_HEADERPADDINGRIGHT (CTF_PM_HEADERFLAG|CTF_PM_PADDINGRIGHT) +#define CTF_PM_HEADERHEIGHT (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0031)) +#define CTF_PM_HEADERMINHEIGHT (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0032)) +#define CTF_PM_HEADERDYNAMIC (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0033)) +#define CTF_PM_HEADERGRAPHICPOSITION (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0034)) +#define CTF_PM_HEADERGRAPHICFILTER (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0035)) +#define CTF_PM_HEADERGRAPHICURL (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0036)) +#define CTF_PM_HEADERMARGINALL (CTF_PM_HEADERFLAG|CTF_PM_MARGINALL) +#define CTF_PM_HEADERMARGINTOP (CTF_PM_HEADERFLAG|CTF_PM_MARGINTOP) +#define CTF_PM_HEADERMARGINBOTTOM (CTF_PM_HEADERFLAG|CTF_PM_MARGINBOTTOM) +#define CTF_PM_HEADERMARGINLEFT (CTF_PM_HEADERFLAG|CTF_PM_MARGINLEFT) +#define CTF_PM_HEADERMARGINRIGHT (CTF_PM_HEADERFLAG|CTF_PM_MARGINRIGHT) + +// footer +#define CTF_PM_FOOTERBORDERALL (CTF_PM_FOOTERFLAG|CTF_PM_BORDERALL) +#define CTF_PM_FOOTERBORDERTOP (CTF_PM_FOOTERFLAG|CTF_PM_BORDERTOP) +#define CTF_PM_FOOTERBORDERBOTTOM (CTF_PM_FOOTERFLAG|CTF_PM_BORDERBOTTOM) +#define CTF_PM_FOOTERBORDERLEFT (CTF_PM_FOOTERFLAG|CTF_PM_BORDERLEFT) +#define CTF_PM_FOOTERBORDERRIGHT (CTF_PM_FOOTERFLAG|CTF_PM_BORDERRIGHT) +#define CTF_PM_FOOTERBORDERWIDTHALL (CTF_PM_FOOTERFLAG|CTF_PM_BORDERWIDTHALL) +#define CTF_PM_FOOTERBORDERWIDTHTOP (CTF_PM_FOOTERFLAG|CTF_PM_BORDERWIDTHTOP) +#define CTF_PM_FOOTERBORDERWIDTHBOTTOM (CTF_PM_FOOTERFLAG|CTF_PM_BORDERWIDTHBOTTOM) +#define CTF_PM_FOOTERBORDERWIDTHLEFT (CTF_PM_FOOTERFLAG|CTF_PM_BORDERWIDTHLEFT) +#define CTF_PM_FOOTERBORDERWIDTHRIGHT (CTF_PM_FOOTERFLAG|CTF_PM_BORDERWIDTHRIGHT) +#define CTF_PM_FOOTERPADDINGALL (CTF_PM_FOOTERFLAG|CTF_PM_PADDINGALL) +#define CTF_PM_FOOTERPADDINGTOP (CTF_PM_FOOTERFLAG|CTF_PM_PADDINGTOP) +#define CTF_PM_FOOTERPADDINGBOTTOM (CTF_PM_FOOTERFLAG|CTF_PM_PADDINGBOTTOM) +#define CTF_PM_FOOTERPADDINGLEFT (CTF_PM_FOOTERFLAG|CTF_PM_PADDINGLEFT) +#define CTF_PM_FOOTERPADDINGRIGHT (CTF_PM_FOOTERFLAG|CTF_PM_PADDINGRIGHT) +#define CTF_PM_FOOTERHEIGHT (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0031)) +#define CTF_PM_FOOTERMINHEIGHT (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0032)) +#define CTF_PM_FOOTERDYNAMIC (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0033)) +#define CTF_PM_FOOTERGRAPHICPOSITION (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0034)) +#define CTF_PM_FOOTERGRAPHICFILTER (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0035)) +#define CTF_PM_FOOTERGRAPHICURL (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0036)) +#define CTF_PM_FOOTERMARGINALL (CTF_PM_FOOTERFLAG|CTF_PM_MARGINALL) +#define CTF_PM_FOOTERMARGINTOP (CTF_PM_FOOTERFLAG|CTF_PM_MARGINTOP) +#define CTF_PM_FOOTERMARGINBOTTOM (CTF_PM_FOOTERFLAG|CTF_PM_MARGINBOTTOM) +#define CTF_PM_FOOTERMARGINLEFT (CTF_PM_FOOTERFLAG|CTF_PM_MARGINLEFT) +#define CTF_PM_FOOTERMARGINRIGHT (CTF_PM_FOOTERFLAG|CTF_PM_MARGINRIGHT) + +#define CTF_PM_FTN_HEIGHT (XML_PM_CTF_START + 0x0060) +#define CTF_PM_FTN_LINE_WEIGHT (XML_PM_CTF_START + 0x0061) +#define CTF_PM_FTN_LINE_COLOR (XML_PM_CTF_START + 0x0062) +#define CTF_PM_FTN_LINE_WIDTH (XML_PM_CTF_START + 0x0063) +#define CTF_PM_FTN_LINE_ADJUST (XML_PM_CTF_START + 0x0064) +#define CTF_PM_FTN_LINE_DISTANCE (XML_PM_CTF_START + 0x0065) +#define CTF_PM_FTN_DISTANCE (XML_PM_CTF_START + 0x0066) +#define CTF_PM_FTN_LINE_STYLE (XML_PM_CTF_START + 0x0067) + +extern const XMLPropertyMapEntry aXMLPageMasterStyleMap[]; +extern const XMLPropertyMapEntry aXMLPageMasterHeaderImportStyleMap[]; +extern const XMLPropertyMapEntry aXMLPageMasterFooterImportStyleMap[]; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/ProgressBarHelper.hxx b/include/xmloff/ProgressBarHelper.hxx new file mode 100644 index 000000000000..e34e6a07919d --- /dev/null +++ b/include/xmloff/ProgressBarHelper.hxx @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_PROGRESSBARHELPER_HXX +#define _XMLOFF_PROGRESSBARHELPER_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <com/sun/star/task/XStatusIndicator.hpp> +#include <com/sun/star/frame/XModel.hpp> + +#define XML_PROGRESSRANGE "ProgressRange" +#define XML_PROGRESSMAX "ProgressMax" +#define XML_PROGRESSCURRENT "ProgressCurrent" +#define XML_PROGRESSREPEAT "ProgressRepeat" + +class XMLOFF_DLLPUBLIC ProgressBarHelper +{ + ::com::sun::star::uno::Reference < ::com::sun::star::task::XStatusIndicator > xStatusIndicator; + sal_Int32 nRange; + sal_Int32 nReference; + sal_Int32 nValue; + sal_Bool bStrict; + // #96469#; if the value goes over the Range the progressbar starts again + sal_Bool bRepeat; + +#ifdef DBG_UTIL + sal_Bool bFailure; +#endif +public: + ProgressBarHelper(const ::com::sun::star::uno::Reference < ::com::sun::star::task::XStatusIndicator>& xStatusIndicator, + const sal_Bool bStrict); + ~ProgressBarHelper(); + + void SetText(OUString& rText) { if (xStatusIndicator.is()) xStatusIndicator->setText(rText); } + void SetRange(sal_Int32 nVal) { nRange = nVal; } + void SetReference(sal_Int32 nVal) { nReference = nVal; } + void SetValue(sal_Int32 nValue); + void SetRepeat(sal_Bool bValue) { bRepeat = bValue; } + inline void Increment(sal_Int32 nInc = 1) { SetValue( nValue+nInc ); } + void End() { if (xStatusIndicator.is()) xStatusIndicator->end(); } + + // set the new reference and returns the new value which gives the + // Progress Bar the sam position as before + sal_Int32 ChangeReference(sal_Int32 nNewReference); + + sal_Int32 GetReference() { return nReference; } + sal_Int32 GetValue() { return nValue; } + sal_Bool GetRepeat() { return bRepeat; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/PropertySetInfoHash.hxx b/include/xmloff/PropertySetInfoHash.hxx new file mode 100644 index 000000000000..8d9705b68afb --- /dev/null +++ b/include/xmloff/PropertySetInfoHash.hxx @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _XMLOFF_PROPERTYSETINFOHASH_HXX +#define _XMLOFF_PROPERTYSETINFOHASH_HXX + +#include <xmloff/PropertySetInfoKey.hxx> + +#include <string.h> +#include <memory> + +struct PropertySetInfoHash +{ + inline size_t operator()( const PropertySetInfoKey& r ) const; + inline bool operator()( const PropertySetInfoKey& r1, + const PropertySetInfoKey& r2 ) const; +}; + +inline size_t PropertySetInfoHash::operator()( + const PropertySetInfoKey& r ) const +{ + const sal_Int32* pBytesAsInt32Array = + (const sal_Int32*)r.aImplementationId.getConstArray(); + sal_Int32 nId32 = pBytesAsInt32Array[0] ^ + pBytesAsInt32Array[1] ^ + pBytesAsInt32Array[2] ^ + pBytesAsInt32Array[3]; + return (size_t)nId32 ^ (size_t)r.xPropInfo.get(); +} + +inline bool PropertySetInfoHash::operator()( + const PropertySetInfoKey& r1, + const PropertySetInfoKey& r2 ) const +{ + if( r1.xPropInfo != r2.xPropInfo ) + return sal_False; + + const sal_Int8* pId1 = r1.aImplementationId.getConstArray(); + const sal_Int8* pId2 = r2.aImplementationId.getConstArray(); + return memcmp( pId1, pId2, 16 * sizeof( sal_Int8 ) ) == 0; +} +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/PropertySetInfoKey.hxx b/include/xmloff/PropertySetInfoKey.hxx new file mode 100644 index 000000000000..79e49d8568aa --- /dev/null +++ b/include/xmloff/PropertySetInfoKey.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _XMLOFF_PROPERTYSETINFOKEY_HXX +#define _XMLOFF_PROPERTYSETINFOKEY_HXX + +#include <osl/diagnose.h> +#include <com/sun/star/uno/Sequence.hxx> + +namespace com { namespace sun { namespace star { + namespace beans { class XPropertySetInfo; } +} } } + + +struct PropertySetInfoKey +{ + ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySetInfo > xPropInfo; + ::com::sun::star::uno::Sequence < sal_Int8 > aImplementationId; + + inline PropertySetInfoKey(); + inline PropertySetInfoKey( + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySetInfo >& rPropInfo, + const ::com::sun::star::uno::Sequence < sal_Int8 >& rImplId ); +}; + +inline PropertySetInfoKey::PropertySetInfoKey() +{ + OSL_ENSURE( aImplementationId.getLength()==16, "illegal constructor call" ); +} + +inline PropertySetInfoKey::PropertySetInfoKey( + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySetInfo >& rPropInfo, + const ::com::sun::star::uno::Sequence < sal_Int8 >& rImplId ) : + xPropInfo( rPropInfo ), + aImplementationId( rImplId ) +{ + OSL_ENSURE( rPropInfo.is(), "prop info missing" ); + OSL_ENSURE( aImplementationId.getLength()==16, "invalid implementation id" ); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/SchXMLExportHelper.hxx b/include/xmloff/SchXMLExportHelper.hxx new file mode 100644 index 000000000000..7413438fe8f7 --- /dev/null +++ b/include/xmloff/SchXMLExportHelper.hxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _XMLOFF_SCH_XMLEXPORTHELPER_HXX_ +#define _XMLOFF_SCH_XMLEXPORTHELPER_HXX_ + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include "sal/types.h" +#include <xmloff/uniref.hxx> +#include <rtl/ustrbuf.hxx> +#include <com/sun/star/util/XStringMapping.hpp> +#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/awt/Point.hpp> +#include <xmloff/xmlprmap.hxx> + +#include <queue> +#include <vector> + +class SvXMLAutoStylePoolP; +class SvXMLExport; +class SchXMLExportHelper_Impl; + +/** With this class you can export a <chart:chart> element containing + its data as <table:table> element or without internal table. In + the latter case you have to provide a table address mapper if the + cell addressing set at the document is not in XML format. + */ +class XMLOFF_DLLPUBLIC SchXMLExportHelper : public UniRefBase +{ +public: + SchXMLExportHelper( SvXMLExport& rExport, + SvXMLAutoStylePoolP& rASPool ); + + virtual ~SchXMLExportHelper(); + + /// returns the string corresponding to the current FileFormat CLSID for Chart + const OUString& getChartCLSID(); + +private: + SchXMLExportHelper(); // not defined + SchXMLExportHelper(SchXMLExportHelper &); // not defined + void operator =(SchXMLExportHelper &); // not defined + +private: + SchXMLExportHelper_Impl* m_pImpl; + friend class SchXMLExport; +}; + +#endif // _XMLOFF_SCH_XMLEXPORTHELPER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/SchXMLImportHelper.hxx b/include/xmloff/SchXMLImportHelper.hxx new file mode 100644 index 000000000000..5981597c68bd --- /dev/null +++ b/include/xmloff/SchXMLImportHelper.hxx @@ -0,0 +1,153 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _XMLOFF_SCH_XMLIMPORTHELPER_HXX_ +#define _XMLOFF_SCH_XMLIMPORTHELPER_HXX_ + +#include <xmloff/uniref.hxx> +#include <xmloff/families.hxx> +#include <com/sun/star/util/XStringMapping.hpp> +#include <com/sun/star/chart/XChartDocument.hpp> + +namespace com { namespace sun { namespace star { + namespace frame { + class XModel; + } + namespace task { + class XStatusIndicator; + } + namespace xml { + namespace sax { + class XAttributeList; + } + } + namespace chart2 { + namespace data { + class XDataProvider; + class XLabeledDataSequence; + } + class XChartDocument; + class XDataSeries; + } +}}} + +class SvXMLUnitConverter; +class SvXMLStylesContext; +class XMLChartImportPropertyMapper; +class SvXMLTokenMap; +class SvXMLImportContext; +class SvXMLImport; + +// ======================================== + +/** With this class you can import a <chart:chart> element containing + its data as <table:table> element or without internal table. In + the latter case you have to provide a table address mapper that + converts table addresses in XML format to the appropriate application + format. + */ +class SchXMLImportHelper : public UniRefBase +{ +private: + com::sun::star::uno::Reference< com::sun::star::chart::XChartDocument > mxChartDoc; + SvXMLStylesContext* mpAutoStyles; + + SvXMLTokenMap* mpChartDocElemTokenMap; + SvXMLTokenMap* mpTableElemTokenMap; + SvXMLTokenMap* mpChartElemTokenMap; + SvXMLTokenMap* mpPlotAreaElemTokenMap; + SvXMLTokenMap* mpSeriesElemTokenMap; + + SvXMLTokenMap* mpChartAttrTokenMap; + SvXMLTokenMap* mpPlotAreaAttrTokenMap; + SvXMLTokenMap* mpAutoStyleAttrTokenMap; + SvXMLTokenMap* mpCellAttrTokenMap; + SvXMLTokenMap* mpSeriesAttrTokenMap; + SvXMLTokenMap* mpRegEquationAttrTokenMap; + +public: + + SchXMLImportHelper(); + ~SchXMLImportHelper(); + + /** get the context for reading the <chart:chart> element with subelements. + The result is stored in the XModel given if it also implements + XChartDocument + */ + SvXMLImportContext* CreateChartContext( + SvXMLImport& rImport, + sal_uInt16 nPrefix, const OUString& rLocalName, + const com::sun::star::uno::Reference< + com::sun::star::frame::XModel > xChartModel, + const com::sun::star::uno::Reference< + com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + /** set the auto-style context that will be used to retrieve auto-styles + used inside the following <chart:chart> element to parse + */ + void SetAutoStylesContext( SvXMLStylesContext* pAutoStyles ) { mpAutoStyles = pAutoStyles; } + SvXMLStylesContext* GetAutoStylesContext() const { return mpAutoStyles; } + + const com::sun::star::uno::Reference< + com::sun::star::chart::XChartDocument >& GetChartDocument() + { return mxChartDoc; } + + const SvXMLTokenMap& GetDocElemTokenMap(); + const SvXMLTokenMap& GetTableElemTokenMap(); + const SvXMLTokenMap& GetChartElemTokenMap(); + const SvXMLTokenMap& GetPlotAreaElemTokenMap(); + const SvXMLTokenMap& GetSeriesElemTokenMap(); + + const SvXMLTokenMap& GetChartAttrTokenMap(); + const SvXMLTokenMap& GetPlotAreaAttrTokenMap(); + const SvXMLTokenMap& GetCellAttrTokenMap(); + const SvXMLTokenMap& GetSeriesAttrTokenMap(); + const SvXMLTokenMap& GetRegEquationAttrTokenMap(); + + static sal_uInt16 GetChartFamilyID() { return XML_STYLE_FAMILY_SCH_CHART_ID; } + + /** @param bPushLastChartType If </sal_False>, in case a new chart type has to + be added (because it does not exist yet), it is appended at the + end of the chart-type container. When </sal_True>, a new chart type + is added at one position before the last one, i.e. the formerly + last chart type is pushed back, so that it remains the last one. + + This is needed when the global chart type is set to type A, but + the first series has type B. Then B should appear before A (done + by passing true). Once a series of type A has been read, + following new chart types are again be added at the end (by + passing false). + */ + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > GetNewDataSeries( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument > & xDoc, + sal_Int32 nCoordinateSystemIndex, + const OUString & rChartTypeName, + bool bPushLastChartType = false ); + + static void DeleteDataSeries( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xSeries, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument > & xDoc ); +}; + +#endif // _XMLOFF_SCH_XMLIMPORTHELPER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/SchXMLSeriesHelper.hxx b/include/xmloff/SchXMLSeriesHelper.hxx new file mode 100644 index 000000000000..7f47295eb71c --- /dev/null +++ b/include/xmloff/SchXMLSeriesHelper.hxx @@ -0,0 +1,73 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_SCH_XML_SERIESHELPER_HXX +#define _XMLOFF_SCH_XML_SERIESHELPER_HXX + +#include <com/sun/star/chart2/data/XDataSequence.hpp> +#include <com/sun/star/chart2/data/XDataSource.hpp> +#include <com/sun/star/chart2/XDataSeries.hpp> +#include <com/sun/star/chart2/XDiagram.hpp> +#include <com/sun/star/frame/XModel.hpp> + +#include "xmloff/dllapi.h" + +#include <vector> +#include <map> +#include <iterator> + +class XMLOFF_DLLPUBLIC SchXMLSeriesHelper +{ +public: + static ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > > + getDataSeriesFromDiagram( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram ); + static ::std::map< ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >, sal_Int32 > + getDataSeriesIndexMapFromDiagram( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram ); + + static bool isCandleStickSeries( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xSeries + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > createOldAPISeriesPropertySet( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xSeries + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > createOldAPIDataPointPropertySet( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xSeries + , sal_Int32 nPointIndex + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel ); +}; + +// _XMLOFF_SCH_XML_SERIESHELPER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/SettingsExportHelper.hxx b/include/xmloff/SettingsExportHelper.hxx new file mode 100644 index 000000000000..e790e09860da --- /dev/null +++ b/include/xmloff/SettingsExportHelper.hxx @@ -0,0 +1,104 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_SETTINGSEXPORTHELPER_HXX +#define _XMLOFF_SETTINGSEXPORTHELPER_HXX + +#include "xmloff/dllapi.h" + +#include <com/sun/star/awt/Rectangle.hpp> +#include <com/sun/star/formula/SymbolDescriptor.hpp> +#include <com/sun/star/util/XStringSubstitution.hpp> +#include <xmloff/xmlexp.hxx> + +namespace com +{ + namespace sun { namespace star { + namespace container { class XNameAccess; class XIndexAccess; } + namespace util { struct DateTime; } + } } +} + +namespace xmloff +{ + class XMLSettingsExportContext; +} + +class XMLOFF_DLLPUBLIC XMLSettingsExportHelper +{ + ::xmloff::XMLSettingsExportContext& m_rContext; + + ::com::sun::star::uno::Reference< ::com::sun::star::util::XStringSubstitution > mxStringSubsitution; + + const OUString msPrinterIndependentLayout; + const OUString msColorTableURL; + const OUString msLineEndTableURL; + const OUString msHatchTableURL; + const OUString msDashTableURL; + const OUString msGradientTableURL; + const OUString msBitmapTableURL; + + void ManipulateSetting( com::sun::star::uno::Any& rAny, const OUString& rName ) const; + + void CallTypeFunction(const com::sun::star::uno::Any& rAny, + const OUString& rName) const; + + void exportBool(const sal_Bool bValue, const OUString& rName) const; + void exportByte(const sal_Int8 nValue, const OUString& rName) const; + void exportShort(const sal_Int16 nValue, const OUString& rName) const; + void exportInt(const sal_Int32 nValue, const OUString& rName) const; + void exportLong(const sal_Int64 nValue, const OUString& rName) const; + void exportDouble(const double fValue, const OUString& rName) const; + void exportString(const OUString& sValue, const OUString& rName) const; + void exportDateTime(const com::sun::star::util::DateTime& aValue, const OUString& rName) const; + void exportSequencePropertyValue( + const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps, + const OUString& rName) const; + void exportbase64Binary( + const com::sun::star::uno::Sequence<sal_Int8>& aProps, + const OUString& rName) const; + void exportMapEntry(const com::sun::star::uno::Any& rAny, + const OUString& rName, + const sal_Bool bNameAccess) const; + void exportNameAccess( + const com::sun::star::uno::Reference<com::sun::star::container::XNameAccess>& aNamed, + const OUString& rName) const; + void exportIndexAccess( + const com::sun::star::uno::Reference<com::sun::star::container::XIndexAccess> aIndexed, + const OUString rName) const; + + void exportSymbolDescriptors( + const com::sun::star::uno::Sequence < com::sun::star::formula::SymbolDescriptor > &rProps, + const OUString rName) const; + void exportForbiddenCharacters( + const com::sun::star::uno::Any &rAny, + const OUString rName) const; + +public: + XMLSettingsExportHelper( ::xmloff::XMLSettingsExportContext& i_rContext ); + ~XMLSettingsExportHelper(); + + void exportAllSettings( + const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps, + const OUString& rName) const; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/SinglePropertySetInfoCache.hxx b/include/xmloff/SinglePropertySetInfoCache.hxx new file mode 100644 index 000000000000..576339d9c9de --- /dev/null +++ b/include/xmloff/SinglePropertySetInfoCache.hxx @@ -0,0 +1,73 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_SINGEPROPERTYSETINFOCACHE_HXX +#define _XMLOFF_SINGEPROPERTYSETINFOCACHE_HXX + +#include <com/sun/star/beans/XPropertySet.hpp> + +#include <boost/unordered_map.hpp> +#include <xmloff/PropertySetInfoHash.hxx> + +typedef boost::unordered_map +< + PropertySetInfoKey, + sal_Bool, + PropertySetInfoHash, + PropertySetInfoHash +> +SinglePropertySetInfoMap_Impl; + +class SinglePropertySetInfoCache : private SinglePropertySetInfoMap_Impl +{ + OUString sName; + +public: + + inline SinglePropertySetInfoCache( const 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 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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/WordWrapPropertyHdl.hxx b/include/xmloff/WordWrapPropertyHdl.hxx new file mode 100644 index 000000000000..6430b8258c6e --- /dev/null +++ b/include/xmloff/WordWrapPropertyHdl.hxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_WORDWRAPPROPERTYHANDLER_HXX +#define _XMLOFF_WORDWRAPPROPERTYHANDLER_HXX + +#include <xmloff/xmlprhdl.hxx> +#include <xmloff/xmltoken.hxx> +#include <com/sun/star/uno/Type.h> +#include <xmloff/xmlement.hxx> + +/** + PropertyHandler for a named xml bool type: +*/ +class SvXMLImport; +class XMLWordWrapPropertyHdl : public XMLPropertyHandler +{ +private: + SvXMLImport* mpImport; + +public: + XMLWordWrapPropertyHdl( SvXMLImport* pImport ); + virtual ~XMLWordWrapPropertyHdl(); + + virtual sal_Bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const; + virtual sal_Bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const; +}; + +#endif // _XMLOFF_NAMEDBOOLPROPERTYHANDLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLBase64ImportContext.hxx b/include/xmloff/XMLBase64ImportContext.hxx new file mode 100644 index 000000000000..d2804928a324 --- /dev/null +++ b/include/xmloff/XMLBase64ImportContext.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLBASE64IMPORTCONTEXT_HXX +#define _XMLOFF_XMLBASE64IMPORTCONTEXT_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <xmloff/xmlictxt.hxx> + +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; + OUString sBase64CharsLeft; + +public: + TYPEINFO(); + + XMLBase64ImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx, + const 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 OUString& rChars ); + +}; + +#endif // _XMLOFF_XMLBASE64IMPORTCONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLCharContext.hxx b/include/xmloff/XMLCharContext.hxx new file mode 100644 index 000000000000..644b03877d64 --- /dev/null +++ b/include/xmloff/XMLCharContext.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED__XMLOFF_CHARCONTEXT_HXX +#define INCLUDED__XMLOFF_CHARCONTEXT_HXX + +#include "xmloff/dllapi.h" +#include <com/sun/star/uno/Reference.h> +#include "xmlictxt.hxx" + +class XMLOFF_DLLPUBLIC XMLCharContext : public SvXMLImportContext +{ + XMLCharContext(const XMLCharContext&); + void operator =(const XMLCharContext&); +protected: + sal_Int16 m_nControl; + sal_uInt16 m_nCount; + sal_Unicode m_c; +public: + + TYPEINFO(); + + XMLCharContext( + SvXMLImport& rImport, + sal_uInt16 nPrfx, + const OUString& rLName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList, + sal_Unicode c, + sal_Bool bCount ); + XMLCharContext( + SvXMLImport& rImport, + sal_uInt16 nPrfx, + const OUString& rLName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList, + sal_Int16 nControl ); + + virtual ~XMLCharContext(); + + // EndElement is called before a context will be destructed, but + // after a elements context has been parsed. It may be used for actions + // that require virtual methods. The default is to do nothing. + virtual void EndElement(); + + virtual void InsertControlCharacter(sal_Int16 _nControl); + virtual void InsertString(const OUString& _sString); +}; +// --------------------------------------------------------------------- +#endif // INCLUDED__XMLOFF_CHARCONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLConstantsPropertyHandler.hxx b/include/xmloff/XMLConstantsPropertyHandler.hxx new file mode 100644 index 000000000000..cad125159d11 --- /dev/null +++ b/include/xmloff/XMLConstantsPropertyHandler.hxx @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLCONSTANTSPROPERTYHANDLER_HXX +#define _XMLOFF_XMLCONSTANTSPROPERTYHANDLER_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <xmloff/xmlprhdl.hxx> +#include <xmloff/xmltoken.hxx> + +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 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( + OUString& rStrExpValue, + const ::com::sun::star::uno::Any& rValue, + const SvXMLUnitConverter& rUnitConverter ) const; +}; + +#endif // _XMLOFF_XMLCONSTANTSPROPERTYHANDLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLEmbeddedObjectExportFilter.hxx b/include/xmloff/XMLEmbeddedObjectExportFilter.hxx new file mode 100644 index 000000000000..40f42b6be202 --- /dev/null +++ b/include/xmloff/XMLEmbeddedObjectExportFilter.hxx @@ -0,0 +1,85 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLEMBEDDEDOBJECTEXPORTFILTER_HXX +#define _XMLOFF_XMLEMBEDDEDOBJECTEXPORTFILTER_HXX + +#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/implbase3.hxx> + +class XMLEmbeddedObjectExportFilter : public ::cppu::WeakImplHelper3< + ::com::sun::star::xml::sax::XExtendedDocumentHandler, + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::lang::XInitialization> +{ + ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XDocumentHandler > xHandler; + ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XExtendedDocumentHandler > xExtHandler; + +public: + XMLEmbeddedObjectExportFilter( const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XDocumentHandler > & rHandler ) throw(); + virtual ~XMLEmbeddedObjectExportFilter () throw(); + + // ::com::sun::star::xml::sax::XDocumentHandler + virtual void SAL_CALL startDocument(void) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL endDocument(void) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL startElement(const 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 ); + virtual void SAL_CALL endElement(const OUString& aName) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL characters(const OUString& aChars) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL ignorableWhitespace(const OUString& aWhitespaces) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL processingInstruction(const OUString& aTarget, + const OUString& aData) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + 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 ); + + // ::com::sun::star::xml::sax::XExtendedDocumentHandler + virtual void SAL_CALL startCDATA(void) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL endCDATA(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL comment(const OUString& sComment) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL allowLineBreak(void) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL unknown(const OUString& sString) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + +}; + +#endif // _XMLOFF_XMLEMBEDDEDOBJECTEXPORTFILTER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLEventExport.hxx b/include/xmloff/XMLEventExport.hxx new file mode 100644 index 000000000000..52b77daa8764 --- /dev/null +++ b/include/xmloff/XMLEventExport.hxx @@ -0,0 +1,133 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLEVENTEXPORT_HXX +#define _XMLOFF_XMLEVENTEXPORT_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include "sal/types.h" +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <rtl/ustring.hxx> +#include <xmloff/xmlevent.hxx> + +#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< OUString, XMLEventExportHandler* > HandlerMap; +typedef ::std::map< 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 OUString sEventType; + + SvXMLExport& rExport; + + HandlerMap aHandlerMap; + NameMap aNameTranslationMap; + + bool bExtNamespace; + +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 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 the events, but write <officeooo:events> element + /// (for new file format additions) + void ExportExt( ::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 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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLEventsImportContext.hxx b/include/xmloff/XMLEventsImportContext.hxx new file mode 100644 index 000000000000..8f7da79b4fb8 --- /dev/null +++ b/include/xmloff/XMLEventsImportContext.hxx @@ -0,0 +1,131 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLEVENTSIMPORTCONTEXT_HXX +#define _XMLOFF_XMLEVENTSIMPORTCONTEXT_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <xmloff/xmlictxt.hxx> +#include <xmloff/xmlevent.hxx> + +#include <map> +#include <vector> + +namespace com { namespace sun { namespace star { + namespace xml { namespace sax { class XAttributeList; } } + namespace beans { struct PropertyValue; } + namespace container { class XNameReplace; } + namespace document { class XEventsSupplier; } +} } } + +typedef ::std::pair< + OUString, + ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue> > EventNameValuesPair; + +typedef ::std::vector< EventNameValuesPair > EventsVector; + +/** + * Import <script:events> element. + * + * The import context usually sets the events immediately at the event + * XNameReplace. If none was given on construction, it operates in + * delayed mode: All events are collected and may then be set + * with the setEvents() method. + */ +class XMLOFF_DLLPUBLIC XMLEventsImportContext : public SvXMLImportContext +{ +protected: + // the event XNameReplace; may be empty + ::com::sun::star::uno::Reference< + ::com::sun::star::container::XNameReplace> xEvents; + + // if no XNameReplace is given, use this vector to collect events + EventsVector aCollectEvents; + +public: + + TYPEINFO(); + + XMLEventsImportContext( + SvXMLImport& rImport, + sal_uInt16 nPrfx, + const OUString& rLocalName); + + XMLEventsImportContext( + SvXMLImport& rImport, + sal_uInt16 nPrfx, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::document::XEventsSupplier> & xEventsSupplier); + + XMLEventsImportContext( + SvXMLImport& rImport, + sal_uInt16 nPrfx, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XNameReplace> & xNameRepl); + + ~XMLEventsImportContext(); + + void AddEventValues( + const OUString& rEventName, + const ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue> & rValues); + + /// if the import operates in delayed mode, you can use this method + /// to set all events that have been read on the XEventsSupplier + void SetEvents( + const ::com::sun::star::uno::Reference< + ::com::sun::star::document::XEventsSupplier> & xEventsSupplier); + + /// if the import operates in delayed mode, you can use this method + /// to set all events that have been read on the XNameReplace + void SetEvents( + const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XNameReplace> & xNameRepl); + + /// if the import operates indelayed mode, you can use this method + /// to obtain the value sequence for a specific event + sal_Bool GetEventSequence( + const OUString& rName, + ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue> & rSequence ); + +protected: + + virtual void StartElement( + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList> & xAttrList); + + virtual void EndElement(); + + virtual SvXMLImportContext *CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList> & xAttrList ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLFilterServiceNames.h b/include/xmloff/XMLFilterServiceNames.h new file mode 100644 index 000000000000..332935228e08 --- /dev/null +++ b/include/xmloff/XMLFilterServiceNames.h @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLFILTERSERVICENAMES_H +#define _XMLOFF_XMLFILTERSERVICENAMES_H + + +#define XML_IMPORT_FILTER_WRITER "com.sun.star.comp.Writer.XMLOasisImporter" +#define XML_IMPORT_FILTER_CALC "com.sun.star.comp.Calc.XMLOasisImporter" +#define XML_IMPORT_FILTER_DRAW "com.sun.star.comp.Draw.XMLOasisImporter" +#define XML_IMPORT_FILTER_IMPRESS "com.sun.star.comp.Impress.XMLOasisImporter" +#define XML_IMPORT_FILTER_MATH "com.sun.star.comp.Math.XMLImporter" +#define XML_IMPORT_FILTER_CHART "com.sun.star.comp.Chart.XMLOasisImporter" + +#define XML_EXPORT_FILTER_WRITER "com.sun.star.comp.Writer.XMLOasisExporter" +#define XML_EXPORT_FILTER_CALC "com.sun.star.comp.Calc.XMLOasisExporter" +#define XML_EXPORT_FILTER_DRAW "com.sun.star.comp.Draw.XMLOasisExporter" +#define XML_EXPORT_FILTER_IMPRESS "com.sun.star.comp.Impress.XMLOasisExporter" +#define XML_EXPORT_FILTER_MATH "com.sun.star.comp.Math.XMLExporter" +#define XML_EXPORT_FILTER_CHART "com.sun.star.comp.Chart.XMLOasisExporter" + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLFontAutoStylePool.hxx b/include/xmloff/XMLFontAutoStylePool.hxx new file mode 100644 index 000000000000..8ee84d8686df --- /dev/null +++ b/include/xmloff/XMLFontAutoStylePool.hxx @@ -0,0 +1,73 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLFONTAUTOSTYLEPOOL_HXX +#define _XMLOFF_XMLFONTAUTOSTYLEPOOL_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <rtl/ustring.hxx> +#include <tools/fontenum.hxx> +#include <xmloff/uniref.hxx> +#include <set> + +class XMLFontAutoStylePool_Impl; +typedef std::set<OUString> XMLFontAutoStylePoolNames_Impl; +class SvXMLExport; + +class XMLOFF_DLLPUBLIC XMLFontAutoStylePool : public UniRefBase +{ + SvXMLExport& rExport; + + XMLFontAutoStylePool_Impl *pPool; + XMLFontAutoStylePoolNames_Impl m_aNames; + bool tryToEmbedFonts; + + OUString embedFontFile( const OUString& fontUrl ); + +protected: + + SvXMLExport& GetExport() { return rExport; } + +public: + + XMLFontAutoStylePool( SvXMLExport& rExport, bool tryToEmbedFonts = false ); + ~XMLFontAutoStylePool(); + + OUString Add( + const OUString& rFamilyName, + const OUString& rStyleName, + FontFamily nFamily, + FontPitch nPitch, + rtl_TextEncoding eEnc ); + + OUString Find( + const OUString& rFamilyName, + const OUString& rStyleName, + FontFamily nFamily, + FontPitch nPitch, + rtl_TextEncoding eEnc )const; + OUString Find( const OUString& rInternalName ) const; + + void exportXML(); +}; + +#endif // _XMLOFF_XMLFONTAUTOSTYLEPOOL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLFontStylesContext.hxx b/include/xmloff/XMLFontStylesContext.hxx new file mode 100644 index 000000000000..c04d5c12230a --- /dev/null +++ b/include/xmloff/XMLFontStylesContext.hxx @@ -0,0 +1,89 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _XMLOFF_XMLFONTSTYLESCONTEXT_HXX_ +#define _XMLOFF_XMLFONTSTYLESCONTEXT_HXX_ + +#include "sal/config.h" +#include "xmloff/dllapi.h" + +#include <vector> + +#include <xmloff/xmlstyle.hxx> + +struct XMLPropertyState; +class SvXMLTokenMap; +class XMLFontFamilyNamePropHdl; +class XMLFontFamilyPropHdl; +class XMLFontPitchPropHdl; +class XMLFontEncodingPropHdl; + +class XMLOFF_DLLPUBLIC XMLFontStylesContext : public SvXMLStylesContext +{ + XMLFontFamilyNamePropHdl *pFamilyNameHdl; + XMLFontFamilyPropHdl *pFamilyHdl; + XMLFontPitchPropHdl *pPitchHdl; + XMLFontEncodingPropHdl *pEncHdl; + + SvXMLTokenMap *pFontStyleAttrTokenMap; + + rtl_TextEncoding eDfltEncoding; + +protected: + + virtual SvXMLStyleContext *CreateStyleChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + +public: + + TYPEINFO(); + + XMLFontStylesContext( SvXMLImport& rImport, sal_uInt16 nPrfx, + const OUString& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList, + rtl_TextEncoding eDfltEnc ); + virtual ~XMLFontStylesContext(); + + const SvXMLTokenMap& GetFontStyleAttrTokenMap() const + { + return *pFontStyleAttrTokenMap; + } + + sal_Bool FillProperties( const OUString& rName, + ::std::vector< XMLPropertyState > &rProps, + sal_Int32 nFamilyNameIdx, + sal_Int32 nStyleNameIdx, + sal_Int32 nFamilyIdx, + sal_Int32 nPitchIdx, + sal_Int32 nCharsetIdx ) const; + + rtl_TextEncoding GetDfltCharset() const { return eDfltEncoding; } + + XMLFontFamilyNamePropHdl& GetFamilyNameHdl() const { return *pFamilyNameHdl; } + XMLFontFamilyPropHdl& GetFamilyHdl() const { return *pFamilyHdl; } + XMLFontPitchPropHdl& GetPitchHdl() const { return *pPitchHdl; } + XMLFontEncodingPropHdl& GetEncodingHdl() const { return *pEncHdl; } + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLGraphicsDefaultStyle.hxx b/include/xmloff/XMLGraphicsDefaultStyle.hxx new file mode 100644 index 000000000000..06fee705d04d --- /dev/null +++ b/include/xmloff/XMLGraphicsDefaultStyle.hxx @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLGRAPHICSDEFAULTSTYLE_HXX +#define _XMLOFF_XMLGRAPHICSDEFAULTSTYLE_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <xmloff/prstylei.hxx> + +namespace com { namespace sun { namespace star { namespace container +{ + class XNameContainer; +} } } } + +class XMLOFF_DLLPUBLIC XMLGraphicsDefaultStyle : public XMLPropStyleContext +{ +public: + TYPEINFO(); + + XMLGraphicsDefaultStyle( SvXMLImport& rImport, sal_uInt16 nPrfx, + const OUString& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList >& xAttrList, + SvXMLStylesContext& rStyles); + + virtual ~XMLGraphicsDefaultStyle(); + + virtual SvXMLImportContext *CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + + // This method is called for every default style + virtual void SetDefaults(); +}; + +#endif // _XMLOFF_XMLGRAPHICSDEFAULTSTYLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLPageExport.hxx b/include/xmloff/XMLPageExport.hxx new file mode 100644 index 000000000000..c30dbe43d786 --- /dev/null +++ b/include/xmloff/XMLPageExport.hxx @@ -0,0 +1,105 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLPAGEEXPORT_HXX +#define _XMLOFF_XMLPAGEEXPORT_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include "sal/types.h" +#include <rtl/ustring.hxx> +#include <vector> +#include <xmloff/attrlist.hxx> +#include <xmloff/uniref.hxx> +#include <com/sun/star/container/XIndexAccess.hpp> + +namespace com { namespace sun { namespace star { + namespace style { class XStyle; } + namespace container { class XIndexReplace; class XNameAccess;} + namespace beans { class XPropertySet; } +} } } + +class SvXMLExport; +class XMLPropertyHandlerFactory; +class XMLPropertySetMapper; +class SvXMLExportPropertyMapper; + +//______________________________________________________________________________ + +struct XMLPageExportNameEntry +{ + OUString sPageMasterName; + OUString sStyleName; +}; + +//______________________________________________________________________________ + +class XMLOFF_DLLPUBLIC XMLPageExport : public UniRefBase +{ + SvXMLExport& rExport; + + const OUString sIsPhysical; + const OUString sFollowStyle; + + ::com::sun::star::uno::Reference< + ::com::sun::star::container::XNameAccess > xPageStyles; + + ::std::vector< XMLPageExportNameEntry > aNameVector; + SAL_DLLPRIVATE sal_Bool findPageMasterName( const OUString& rStyleName, OUString& rPMName ) const; + + UniReference < XMLPropertyHandlerFactory > xPageMasterPropHdlFactory; + UniReference < XMLPropertySetMapper > xPageMasterPropSetMapper; + UniReference < SvXMLExportPropertyMapper > xPageMasterExportPropMapper; + +protected: + + SvXMLExport& GetExport() { return rExport; } + + virtual void collectPageMasterAutoStyle( + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > & rPropSet, + OUString& rPageMasterName ); + + virtual void exportMasterPageContent( + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > & rPropSet, + sal_Bool bAutoStyles ); + + sal_Bool exportStyle( + const ::com::sun::star::uno::Reference< + ::com::sun::star::style::XStyle >& rStyle, + sal_Bool bAutoStyles ); + + void exportStyles( sal_Bool bUsed, sal_Bool bAutoStyles ); + +public: + XMLPageExport( SvXMLExport& rExp ); + ~XMLPageExport(); + + void collectAutoStyles( sal_Bool bUsed ) { exportStyles( bUsed, sal_True ); } + void exportAutoStyles(); + void exportMasterStyles( sal_Bool bUsed ) { exportStyles( bUsed, sal_False ); } + + //text grid enhancement for better CJK support + void exportDefaultStyle(); +}; + +#endif // _XMLOFF_XMLTEXTMASTERPAGEEXPORT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLSettingsExportContext.hxx b/include/xmloff/XMLSettingsExportContext.hxx new file mode 100644 index 000000000000..819da2b41d77 --- /dev/null +++ b/include/xmloff/XMLSettingsExportContext.hxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef XML_SETTINGS_EXPORT_CONTEXT_HXX +#define XML_SETTINGS_EXPORT_CONTEXT_HXX + +#include <com/sun/star/uno/XComponentContext.hpp> + +#include "xmloff/xmltoken.hxx" + +//........................................................................ +namespace xmloff +{ +//........................................................................ + + //==================================================================== + //= XMLExporter + //==================================================================== + class SAL_NO_VTABLE XMLSettingsExportContext + { + public: + virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, + const OUString& i_rValue ) = 0; + virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, + enum ::xmloff::token::XMLTokenEnum i_eValue ) = 0; + + virtual void StartElement( enum ::xmloff::token::XMLTokenEnum i_eName, + const sal_Bool i_bIgnoreWhitespace ) = 0; + virtual void EndElement( const sal_Bool i_bIgnoreWhitespace ) = 0; + + virtual void Characters( const OUString& i_rCharacters ) = 0; + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + GetComponentContext() const = 0; + + protected: + ~XMLSettingsExportContext() {} + }; + +//........................................................................ +} // namespace xmloff +//........................................................................ + +#endif // XML_SETTINGS_EXPORT_CONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLShapeStyleContext.hxx b/include/xmloff/XMLShapeStyleContext.hxx new file mode 100644 index 000000000000..2f39eee0e08f --- /dev/null +++ b/include/xmloff/XMLShapeStyleContext.hxx @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLSHAPESTYLECONTEXT_HXX +#define _XMLOFF_XMLSHAPESTYLECONTEXT_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <xmloff/prstylei.hxx> +#include <xmloff/families.hxx> + +class SvXMLImport; + +////////////////////////////////////////////////////////////////////////////// +// style:style context + +class XMLOFF_DLLPUBLIC XMLShapeStyleContext: public XMLPropStyleContext +{ +protected: + OUString m_sControlDataStyleName; + OUString m_sListStyleName; + sal_Bool m_bIsNumRuleAlreadyConverted; + +protected: + virtual void SetAttribute( sal_uInt16 nPrefixKey, + const OUString& rLocalName, + const OUString& rValue ); +public: + TYPEINFO(); + + XMLShapeStyleContext( + SvXMLImport& rImport, + sal_uInt16 nPrfx, + const OUString& rLName, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList, + SvXMLStylesContext& rStyles, + sal_uInt16 nFamily = XML_STYLE_FAMILY_SD_GRAPHICS_ID); + virtual ~XMLShapeStyleContext(); + + SvXMLImportContext * CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + + virtual void Finish( sal_Bool bOverwrite ); + + virtual void FillPropertySet( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > & rPropSet ); +}; + +#endif // _XMLOFF_XMLSHAPESTYLECONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLStringVector.hxx b/include/xmloff/XMLStringVector.hxx new file mode 100644 index 000000000000..863ec7aa4d3e --- /dev/null +++ b/include/xmloff/XMLStringVector.hxx @@ -0,0 +1,32 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLSTRINGVECTOR_HXX +#define _XMLOFF_XMLSTRINGVECTOR_HXX + +#include <rtl/ustring.hxx> + +#include <vector> + +typedef ::std::vector < OUString> XMLStringVector; + + +#endif // _XMLOFF_XMLSTRINGVECTOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLTextListAutoStylePool.hxx b/include/xmloff/XMLTextListAutoStylePool.hxx new file mode 100644 index 000000000000..f3768da8ab40 --- /dev/null +++ b/include/xmloff/XMLTextListAutoStylePool.hxx @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLTEXTLISTAUTOSTYLEPOOL_HXX +#define _XMLOFF_XMLTEXTLISTAUTOSTYLEPOOL_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include "sal/types.h" +#include <rtl/ustring.hxx> +#include <com/sun/star/ucb/XAnyCompare.hpp> +#include <set> + +namespace com { namespace sun { namespace star { namespace container { + class XIndexReplace; } } } } + + +class XMLTextListAutoStylePool_Impl; +typedef std::set<OUString> XMLTextListAutoStylePoolNames_Impl; +class XMLTextListAutoStylePoolEntry_Impl; +class SvXMLExport; + +class XMLOFF_DLLPUBLIC XMLTextListAutoStylePool +{ + SvXMLExport& rExport; + + OUString sPrefix; + + XMLTextListAutoStylePool_Impl *pPool; + XMLTextListAutoStylePoolNames_Impl m_aNames; + sal_uInt32 nName; + + /** this is an optional NumRule compare component for applications where + the NumRules don't have names */ + ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompare > mxNumRuleCompare; + + SAL_DLLPRIVATE sal_uInt32 Find( XMLTextListAutoStylePoolEntry_Impl* pEntry ) + const; +public: + + XMLTextListAutoStylePool( SvXMLExport& rExport ); + ~XMLTextListAutoStylePool(); + + void RegisterName( const OUString& rName ); + + OUString Add( + const ::com::sun::star::uno::Reference < + ::com::sun::star::container::XIndexReplace > & rNumRules ); + + OUString Find( + const ::com::sun::star::uno::Reference < + ::com::sun::star::container::XIndexReplace > & rNumRules ) const; + OUString Find( const OUString& rInternalName ) const; + + void exportXML() const; +}; + + +#endif // _XMLOFF_XMLTEXTLISTAUTOSTYLEPOOL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLTextMasterPageContext.hxx b/include/xmloff/XMLTextMasterPageContext.hxx new file mode 100644 index 000000000000..c0965e7564f9 --- /dev/null +++ b/include/xmloff/XMLTextMasterPageContext.hxx @@ -0,0 +1,89 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _XMLOFF_TEXTMASTERPAGECONTEXT_HXX_ +#define _XMLOFF_TEXTMASTERPAGECONTEXT_HXX_ + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include "sal/types.h" + +#include <xmloff/xmlstyle.hxx> + +namespace com { namespace sun { namespace star { + namespace style { class XStyle; } +} } } + +class XMLOFF_DLLPUBLIC XMLTextMasterPageContext : public SvXMLStyleContext +{ + const OUString sIsPhysical; + const OUString sPageStyleLayout; + const OUString sFollowStyle; + OUString sFollow; + OUString sPageMasterName; + + ::com::sun::star::uno::Reference < ::com::sun::star::style::XStyle > xStyle; + + sal_Bool bInsertHeader; + sal_Bool bInsertFooter; + sal_Bool bInsertHeaderLeft; + sal_Bool bInsertFooterLeft; + sal_Bool bInsertHeaderFirst; + sal_Bool bInsertFooterFirst; + sal_Bool bHeaderInserted; + sal_Bool bFooterInserted; + sal_Bool bHeaderLeftInserted; + sal_Bool bFooterLeftInserted; + sal_Bool bHeaderFirstInserted; + sal_Bool bFooterFirstInserted; + + SAL_DLLPRIVATE ::com::sun::star::uno::Reference < + ::com::sun::star::style::XStyle > Create(); +protected: + ::com::sun::star::uno::Reference < + ::com::sun::star::style::XStyle > GetStyle() { return xStyle; } +public: + + TYPEINFO(); + + XMLTextMasterPageContext( SvXMLImport& rImport, sal_uInt16 nPrfx, + const OUString& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList, + sal_Bool bOverwrite ); + virtual ~XMLTextMasterPageContext(); + + virtual SvXMLImportContext *CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + + virtual SvXMLImportContext *CreateHeaderFooterContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList, + const sal_Bool bFooter, + const sal_Bool bLeft, + const sal_Bool bFirst ); + + virtual void Finish( sal_Bool bOverwrite ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLTextMasterPageExport.hxx b/include/xmloff/XMLTextMasterPageExport.hxx new file mode 100644 index 000000000000..8ef0dcaef6a6 --- /dev/null +++ b/include/xmloff/XMLTextMasterPageExport.hxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLTEXTMASTERPAGEEXPORT_HXX +#define _XMLOFF_XMLTEXTMASTERPAGEEXPORT_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <rtl/ustring.hxx> +#include <xmloff/attrlist.hxx> +#include <xmloff/XMLPageExport.hxx> + +namespace com { namespace sun { namespace star { + namespace text { class XText; } +} } } + +class XMLOFF_DLLPUBLIC XMLTextMasterPageExport : public XMLPageExport +{ + const OUString sHeaderText; + const OUString sHeaderOn; + const OUString sHeaderShareContent; + const OUString sHeaderTextFirst; + const OUString sHeaderTextLeft; + + const OUString sFirstShareContent; + + const OUString sFooterText; + const OUString sFooterOn; + const OUString sFooterShareContent; + const OUString sFooterTextFirst; + const OUString sFooterTextLeft; + +protected: + + virtual void exportHeaderFooterContent( + const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XText >& rText, + sal_Bool bAutoStyles, sal_Bool bExportParagraph = sal_True ); + + virtual void exportMasterPageContent( + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > & rPropSet, + sal_Bool bAutoStyles ); + +public: + XMLTextMasterPageExport( SvXMLExport& rExp ); + ~XMLTextMasterPageExport(); +}; + +#endif // _XMLOFF_XMLTEXTMASTERPAGEEXPORT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLTextMasterStylesContext.hxx b/include/xmloff/XMLTextMasterStylesContext.hxx new file mode 100644 index 000000000000..9d03c401b900 --- /dev/null +++ b/include/xmloff/XMLTextMasterStylesContext.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLTEXTMASTERSTYLESCONTEXT_HXX +#define _XMLOFF_XMLTEXTMASTERSTYLESCONTEXT_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <xmloff/xmlstyle.hxx> + +class XMLOFF_DLLPUBLIC XMLTextMasterStylesContext : public SvXMLStylesContext +{ +protected: + virtual SvXMLStyleContext *CreateStyleChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + + virtual SvXMLStyleContext *CreateStyleStyleChildContext( sal_uInt16 nFamily, + sal_uInt16 nPrefix, const OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + + virtual sal_Bool InsertStyleFamily( sal_uInt16 nFamily ) const; + +public: + TYPEINFO(); + + XMLTextMasterStylesContext( SvXMLImport& rImport, sal_uInt16 nPrfx, + const OUString& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList); + + virtual ~XMLTextMasterStylesContext(); +}; + +#endif // _XMLOFF_XMLTEXTMASTERSTYLECONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLTextShapeImportHelper.hxx b/include/xmloff/XMLTextShapeImportHelper.hxx new file mode 100644 index 000000000000..46d77a487297 --- /dev/null +++ b/include/xmloff/XMLTextShapeImportHelper.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLTEXTSHAPEIMPORTHELPER_HXX +#define _XMLTEXTSHAPEIMPORTHELPER_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <xmloff/shapeimport.hxx> + +class XMLOFF_DLLPUBLIC XMLTextShapeImportHelper : public XMLShapeImportHelper +{ + SvXMLImport& rImport; + + const OUString sAnchorType; + const OUString sAnchorPageNo; + const OUString sVertOrientPosition; + +public: + + XMLTextShapeImportHelper( SvXMLImport& rImp ); + ~XMLTextShapeImportHelper(); + + virtual void addShape( + ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XShape >& rShape, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList >& xAttrList, + ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XShapes >& rShapes ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLTextShapeStyleContext.hxx b/include/xmloff/XMLTextShapeStyleContext.hxx new file mode 100644 index 000000000000..922153a9188a --- /dev/null +++ b/include/xmloff/XMLTextShapeStyleContext.hxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _XMLOFF_XMLTEXTSHAPESTYLECONTEXT_HXX_ +#define _XMLOFF_XMLTEXTSHAPESTYLECONTEXT_HXX_ + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <xmloff/XMLShapeStyleContext.hxx> + +class XMLOFF_DLLPUBLIC XMLTextShapeStyleContext : public XMLShapeStyleContext +{ + const OUString sIsAutoUpdate; + + sal_Bool bAutoUpdate : 1; + + SvXMLImportContextRef xEventContext; + +protected: + + virtual void SetAttribute( sal_uInt16 nPrefixKey, + const OUString& rLocalName, + const OUString& rValue ); + +public: + + TYPEINFO(); + + XMLTextShapeStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, + const OUString& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList, + SvXMLStylesContext& rStyles, sal_uInt16 nFamily, + sal_Bool bDefaultStyle = sal_False ); + virtual ~XMLTextShapeStyleContext(); + + virtual SvXMLImportContext *CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + + sal_Bool IsAutoUpdate() const { return bAutoUpdate; } + + virtual void CreateAndInsert( sal_Bool bOverwrite ); + + virtual void Finish( sal_Bool bOverwrite ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLTextTableContext.hxx b/include/xmloff/XMLTextTableContext.hxx new file mode 100644 index 000000000000..c0a3df1aa88c --- /dev/null +++ b/include/xmloff/XMLTextTableContext.hxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLTEXTTABLECONTEXT_HXX +#define _XMLTEXTTABLECONTEXT_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <xmloff/xmlictxt.hxx> +#include <com/sun/star/uno/Reference.h> + +namespace com { namespace sun { namespace star { + namespace text { class XTextContent; } +} } } + +#define XML_TEXT_FRAME_TEXTBOX 1 +#define XML_TEXT_FRAME_GRAPHIC 2 + +class XMLOFF_DLLPUBLIC XMLTextTableContext : public SvXMLImportContext +{ + +public: + + TYPEINFO(); + + XMLTextTableContext( SvXMLImport& rImport, + sal_uInt16 nPrfx, + const OUString& rLName ); + virtual ~XMLTextTableContext(); + + virtual ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextContent > GetXTextContent() const = 0; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/animationexport.hxx b/include/xmloff/animationexport.hxx new file mode 100644 index 000000000000..1ab8e0f9dcd6 --- /dev/null +++ b/include/xmloff/animationexport.hxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_ANIMATIONEXPORT_HXX +#define _XMLOFF_ANIMATIONEXPORT_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include "sal/types.h" + +#include <com/sun/star/animations/XAnimationNode.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <xmloff/uniref.hxx> + +class SvXMLExport; + +namespace xmloff +{ +class AnimationsExporterImpl; + +class XMLOFF_DLLPUBLIC AnimationsExporter : public UniRefBase +{ + AnimationsExporterImpl* mpImpl; + +public: + AnimationsExporter( SvXMLExport& rExport, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xPageProps ); + virtual ~AnimationsExporter(); + + void prepare( ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > xRootNode ); + void exportAnimations( ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > xRootNode ); +}; + +} + +#endif // _XMLOFF_ANIMATIONEXPORT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/animexp.hxx b/include/xmloff/animexp.hxx new file mode 100644 index 000000000000..694433780c5f --- /dev/null +++ b/include/xmloff/animexp.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_ANIMEXP_HXX +#define _XMLOFF_ANIMEXP_HXX + +#include <com/sun/star/drawing/XShape.hpp> +#include <xmloff/uniref.hxx> + +class AnimExpImpl; +class SvXMLExport; +class XMLShapeExport; + +class XMLAnimationsExporter : public UniRefBase +{ + AnimExpImpl* mpImpl; + +public: + XMLAnimationsExporter( XMLShapeExport* pShapeExp ); + virtual ~XMLAnimationsExporter(); + + void prepare( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape, SvXMLExport& rExport ); + void collect( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape, SvXMLExport& rExport ); + void exportAnimations( SvXMLExport& rExport ); +}; + +#endif // _XMLOFF_ANIMEXP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/attrlist.hxx b/include/xmloff/attrlist.hxx new file mode 100644 index 000000000000..cc0d6aa14f65 --- /dev/null +++ b/include/xmloff/attrlist.hxx @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_ATTRLIST_HXX +#define _XMLOFF_ATTRLIST_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/xml/sax/SAXParseException.hpp> +#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> +#include <com/sun/star/xml/sax/SAXException.hpp> +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <com/sun/star/xml/sax/XLocator.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> + +#include <cppuhelper/implbase3.hxx> + +struct SvXMLAttributeList_Impl; + +class XMLOFF_DLLPUBLIC SvXMLAttributeList : public ::cppu::WeakImplHelper3< + ::com::sun::star::xml::sax::XAttributeList, + ::com::sun::star::util::XCloneable, + ::com::sun::star::lang::XUnoTunnel> +{ + SvXMLAttributeList_Impl *m_pImpl; + +public: + SvXMLAttributeList(); + SvXMLAttributeList( const SvXMLAttributeList& ); + SvXMLAttributeList( const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList> & rAttrList ); + ~SvXMLAttributeList(); + + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); + static SvXMLAttributeList* getImplementation( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > ) throw(); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::xml::sax::XAttributeList + virtual sal_Int16 SAL_CALL getLength(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual OUString SAL_CALL getNameByIndex(sal_Int16 i) throw( ::com::sun::star::uno::RuntimeException ); + virtual OUString SAL_CALL getTypeByIndex(sal_Int16 i) throw( ::com::sun::star::uno::RuntimeException ); + virtual OUString SAL_CALL getTypeByName(const OUString& aName) throw( ::com::sun::star::uno::RuntimeException ); + virtual OUString SAL_CALL getValueByIndex(sal_Int16 i) throw( ::com::sun::star::uno::RuntimeException ); + virtual OUString SAL_CALL getValueByName(const OUString& aName) throw( ::com::sun::star::uno::RuntimeException ); + + // ::com::sun::star::util::XCloneable + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() throw( ::com::sun::star::uno::RuntimeException ); + + // methods that are not contained in any interface + void AddAttribute( const OUString &sName , const OUString &sValue ); + void Clear(); + void RemoveAttribute( const OUString sName ); + void AppendAttributeList( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & ); + void SetValueByIndex( sal_Int16 i, const OUString& rValue ); + void RemoveAttributeByIndex( sal_Int16 i ); + void RenameAttributeByIndex( sal_Int16 i, const OUString& rNewName ); + sal_Int16 GetIndexByName( const OUString& rName ) const; + + private: + const OUString sType; // "CDATA" +}; + + +#endif // _XMLOFF_ATTRLIST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/contextid.hxx b/include/xmloff/contextid.hxx new file mode 100644 index 000000000000..fd0123d33ac3 --- /dev/null +++ b/include/xmloff/contextid.hxx @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _XMLOFF_CONTEXTID_HXX_ +#define _XMLOFF_CONTEXTID_HXX_ + +/** These defines determine the unique ids for XML style-context-id's + used in the SvXMLAutoStylePoolP. + */ + +#define XML_SC_CTF_START 0x00001000 +#define XML_SD_CTF_START 0x00002000 +#define XML_TEXT_CTF_START 0x00003000 +#define XML_SCH_CTF_START 0x00004000 +#define XML_PM_CTF_START 0x00005000 // page master +#define XML_FORM_CTF_START 0x00006000 +#define XML_DB_CTF_START 0x00007000 + + +#define CTF_SD_CONTROL_SHAPE_DATA_STYLE ( XML_SD_CTF_START + 1 ) +#define CTF_SD_NUMBERINGRULES_NAME ( XML_SD_CTF_START + 2 ) +#define CTF_SD_SHAPE_PARA_ADJUST ( XML_SD_CTF_START + 3 ) + +#define CTF_FORMS_DATA_STYLE ( XML_FORM_CTF_START + 0 ) + +/** use together with MID_FLAG_NO_PROPERTY to import the specified + attribute into the alien attribute container */ + +#define CTF_ALIEN_ATTRIBUTE_IMPORT 0x00007fff + +#endif // _XMLOFF_CONTEXTID_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/controlpropertyhdl.hxx b/include/xmloff/controlpropertyhdl.hxx new file mode 100644 index 000000000000..3e2cbfd51e23 --- /dev/null +++ b/include/xmloff/controlpropertyhdl.hxx @@ -0,0 +1,136 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_FORMS_CONTROLPROPERTYHDL_HXX_ +#define _XMLOFF_FORMS_CONTROLPROPERTYHDL_HXX_ + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <xmloff/prhdlfac.hxx> +#include <rtl/ref.hxx> +#include <rtl/ustring.hxx> +#include <xmloff/xmlexppr.hxx> +#include <xmloff/XMLConstantsPropertyHandler.hxx> + +struct SvXMLEnumMapEntry; +class Color; +//......................................................................... +namespace xmloff +{ +//......................................................................... + + class IFormsExportContext; + class OFormLayerXMLImport_Impl; + + //===================================================================== + //= ORotationAngleHandler + //===================================================================== + class ORotationAngleHandler : public XMLPropertyHandler + { + public: + ORotationAngleHandler(); + + virtual sal_Bool importXML( const OUString& _rStrImpValue, ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const; + virtual sal_Bool exportXML( OUString& _rStrExpValue, const ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const; + }; + + //===================================================================== + //= OFontWidthHandler + //===================================================================== + class OFontWidthHandler : public XMLPropertyHandler + { + public: + OFontWidthHandler(); + + virtual sal_Bool importXML( const OUString& _rStrImpValue, ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const; + virtual sal_Bool exportXML( OUString& _rStrExpValue, const ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const; + }; + + //===================================================================== + //= OControlBorderHandlerBase + //===================================================================== + class OControlBorderHandler : public XMLPropertyHandler + { + public: + enum BorderFacet + { + STYLE, + COLOR + }; + + OControlBorderHandler( const BorderFacet _eFacet ); + + virtual sal_Bool importXML( const OUString& _rStrImpValue, ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const; + virtual sal_Bool exportXML( OUString& _rStrExpValue, const ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const; + + private: + BorderFacet m_eFacet; + }; + + //===================================================================== + //= OControlTextEmphasisHandler + //===================================================================== + class OControlTextEmphasisHandler : public XMLPropertyHandler + { + public: + OControlTextEmphasisHandler(); + + virtual sal_Bool importXML( const OUString& _rStrImpValue, ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const; + virtual sal_Bool exportXML( OUString& _rStrExpValue, const ::com::sun::star::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const; + }; + + //===================================================================== + //= ImageScaleModeHandler + //===================================================================== + class XMLOFF_DLLPUBLIC ImageScaleModeHandler : public XMLConstantsPropertyHandler + { + public: + ImageScaleModeHandler(); + }; + + //===================================================================== + //= OControlPropertyHandlerFactory + //===================================================================== + class XMLOFF_DLLPUBLIC OControlPropertyHandlerFactory : public XMLPropertyHandlerFactory + { + protected: + mutable XMLConstantsPropertyHandler* m_pTextAlignHandler; + mutable OControlBorderHandler* m_pControlBorderStyleHandler; + mutable OControlBorderHandler* m_pControlBorderColorHandler; + mutable ORotationAngleHandler* m_pRotationAngleHandler; + mutable OFontWidthHandler* m_pFontWidthHandler; + mutable XMLConstantsPropertyHandler* m_pFontEmphasisHandler; + mutable XMLConstantsPropertyHandler* m_pFontReliefHandler; + + protected: + virtual ~OControlPropertyHandlerFactory(); + + public: + OControlPropertyHandlerFactory(); + + virtual const XMLPropertyHandler* GetPropertyHandler(sal_Int32 _nType) const; + }; + +//......................................................................... +} // namespace xmloff +//......................................................................... + +#endif // _XMLOFF_FORMS_CONTROLPROPERTYHDL_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/dllapi.h b/include/xmloff/dllapi.h new file mode 100644 index 000000000000..3fcc7b6d1ef2 --- /dev/null +++ b/include/xmloff/dllapi.h @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_XMLOFF_DLLAPI_H +#define INCLUDED_XMLOFF_DLLAPI_H + +#include "sal/config.h" +#include "sal/types.h" + +#if defined XMLOFF_DLLIMPLEMENTATION +#define XMLOFF_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define XMLOFF_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/families.hxx b/include/xmloff/families.hxx new file mode 100644 index 000000000000..1a16eaa98c62 --- /dev/null +++ b/include/xmloff/families.hxx @@ -0,0 +1,110 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _XMLOFF_FAMILIES_HXX_ +#define _XMLOFF_FAMILIES_HXX_ + +/** These defines determine the unique ids for XML style-families + used in the SvXMLAutoStylePoolP. + */ + +// Misc (Pool) +// reserved: 0..99 +#define XML_STYLE_FAMILY_DATA_STYLE 0 +#define XML_STYLE_FAMILY_DATA_STYLE_NAME "data-style" +#define XML_STYLE_FAMILY_PAGE_MASTER 1 +#define XML_STYLE_FAMILY_PAGE_MASTER_NAME "page-layout" +#define XML_STYLE_FAMILY_PAGE_MASTER_PREFIX "pm" +#define XML_STYLE_FAMILY_MASTER_PAGE 2 + +// Text +// reserved: 100..199 +#define XML_STYLE_FAMILY_TEXT_PARAGRAPH 100 +#define XML_STYLE_FAMILY_TEXT_TEXT 101 +#define XML_STYLE_FAMILY_TEXT_LIST 102 +#define XML_STYLE_FAMILY_TEXT_OUTLINE 103 +#define XML_STYLE_FAMILY_TEXT_FOOTNOTECONFIG 105 +#define XML_STYLE_FAMILY_TEXT_ENDNOTECONFIG 106 +#define XML_STYLE_FAMILY_TEXT_SECTION 107 +#define XML_STYLE_FAMILY_TEXT_FRAME 108 // export only +#define XML_STYLE_FAMILY_TEXT_RUBY 109 +#define XML_STYLE_FAMILY_TEXT_BIBLIOGRAPHYCONFIG 110 +#define XML_STYLE_FAMILY_TEXT_LINENUMBERINGCONFIG 111 + +// Table +// reserved: 200..299 +#define XML_STYLE_FAMILY_TABLE_TABLE 200 +#define XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME "table" +#define XML_STYLE_FAMILY_TABLE_TABLE_STYLES_PREFIX "ta" +#define XML_STYLE_FAMILY_TABLE_COLUMN 202 +#define XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME "table-column" +#define XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_PREFIX "co" +#define XML_STYLE_FAMILY_TABLE_ROW 203 +#define XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME "table-row" +#define XML_STYLE_FAMILY_TABLE_ROW_STYLES_PREFIX "ro" +#define XML_STYLE_FAMILY_TABLE_CELL 204 +#define XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME "table-cell" +#define XML_STYLE_FAMILY_TABLE_CELL_STYLES_PREFIX "ce" +#define XML_STYLE_FAMILY_TABLE_TEMPLATE_ID 205 + +// Impress/Draw +// reserved: 300..399 +#define XML_STYLE_FAMILY_SD_GRAPHICS_ID 300 +#define XML_STYLE_FAMILY_SD_GRAPHICS_NAME "graphic" +#define XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX "gr" + +#define XML_STYLE_FAMILY_SD_PRESENTATION_ID 301 +#define XML_STYLE_FAMILY_SD_PRESENTATION_NAME "presentation" +#define XML_STYLE_FAMILY_SD_PRESENTATION_PREFIX "pr" +// families for derived from SvXMLStyleContext +#define XML_STYLE_FAMILY_SD_PAGEMASTERCONEXT_ID 302 +#define XML_STYLE_FAMILY_SD_PAGEMASTERSTYLECONEXT_ID 306 +#define XML_STYLE_FAMILY_SD_PRESENTATIONPAGELAYOUT_ID 303 +// family for draw pool +#define XML_STYLE_FAMILY_SD_POOL_ID 304 +#define XML_STYLE_FAMILY_SD_POOL_NAME "default" +// family for presentation drawpage properties +#define XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID 305 +#define XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME "drawing-page" +#define XML_STYLE_FAMILY_SD_DRAWINGPAGE_PREFIX "dp" + +#define XML_STYLE_FAMILY_SD_GRADIENT_ID 306 +#define XML_STYLE_FAMILY_SD_HATCH_ID 307 +#define XML_STYLE_FAMILY_SD_FILL_IMAGE_ID 308 +#define XML_STYLE_FAMILY_SD_MARKER_ID 309 +#define XML_STYLE_FAMILY_SD_STROKE_DASH_ID 310 + +// Chart +// reserved: 400..499 +#define XML_STYLE_FAMILY_SCH_CHART_ID 400 +#define XML_STYLE_FAMILY_SCH_CHART_NAME "chart" +#define XML_STYLE_FAMILY_SCH_CHART_PREFIX "ch" + +// Math +// reserved: 500..599 + + +// Forms/Controls +// reserved 600..649 +#define XML_STYLE_FAMILY_CONTROL_ID 600 +#define XML_STYLE_FAMILY_CONTROL_NAME "control" +#define XML_STYLE_FAMILY_CONTROL_PREFIX "ctrl" + +#endif // _XMLOFF_FAMILIES_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/formlayerexport.hxx b/include/xmloff/formlayerexport.hxx new file mode 100644 index 000000000000..5774988f42d8 --- /dev/null +++ b/include/xmloff/formlayerexport.hxx @@ -0,0 +1,189 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_FORMLAYEREXPORT_HXX_ +#define _XMLOFF_FORMLAYEREXPORT_HXX_ + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <com/sun/star/drawing/XDrawPage.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <rtl/ref.hxx> +#include <salhelper/simplereferenceobject.hxx> +#include <xmloff/xmlexppr.hxx> + +namespace com { namespace sun { namespace star { namespace awt { + class XControlModel; +} } } } + +class SvXMLExport; +//......................................................................... +namespace xmloff +{ +//......................................................................... + + class OFormLayerXMLExport_Impl; + class OFormsRootExport; + + //===================================================================== + //= OFormLayerXMLExport + //===================================================================== + /** provides functionallity for exporting a complete form layer. + */ + class XMLOFF_DLLPUBLIC OFormLayerXMLExport + :public ::salhelper::SimpleReferenceObject + { + protected: + /// our export context + SvXMLExport& m_rContext; + // impl class + OFormLayerXMLExport_Impl* m_pImpl; + + protected: + ~OFormLayerXMLExport(); + + public: + OFormLayerXMLExport(SvXMLExport& _rContext); + + /** initializes some internal structures for fast access to the given page + + <p>This method has to be called before you use getControlId for controls on the given page. + This way a performance optimization can be done for faster access to the control ids</p> + + @return + <TRUE/> if the page has been examined before. If <FALSE/> is returned, this is a serious error. + + @see getControlId + @see examineForms + */ + sal_Bool seekPage( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage); + + /** get the id for the given control + + <p>The page the control belongs to must have been examined and sought to.</p> + + @param _rxControl + the control which's id should be retrieved. Must not be <NULL/>. + + @see examineForms + @see seekPage + + */ + OUString getControlId( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControl); + + /** retrieves the style name for the control's number style. + + <p>For performance reasons, this method is allowed to be called for any controls, even those which + do not have a number style. In this case, an empty string is returned.</p> + + @param _rxControl + the control which's id should be retrieved. Must not be <NULL/>. + + @see examineForms + @see seekPage + */ + OUString getControlNumberStyle( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControl ); + + /** examines the forms collection given. + + <p>This method will collect all form layer related data of the given draw page</p> + + @param _rxDrawPage + the draw page to examine. The object will be queried for a <type scope="com.sun.star.form">XFormsSupplier</type> + interface to obtain the forms container. + */ + void examineForms(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage); + + /** exports the structure of a form layer + + <p>This method does not export styles (e.g. font properties of the controls), or any references + external instances may have to the control models contained in the form layer (e.g. uno control + shapes in the drawing layer may have such references)</p> + + <p>No top level element describing the whole collection is inserted. I.e. if within your document, you + expect the forms collection to be stored like + <listing> + <Forms> + .... // all the forms stuff here + </Forms> + </listing> + you have to start the Forms element yourself.</p> + + @param _rxDrawPage + the draw page to examine. The object will be queried for a <type scope="com.sun.star.form">XFormsSupplier</type> + interface to obtain the forms container. + */ + void exportForms(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage); + + /** exports the XForms model data + */ + void exportXForms() const; + + /** determines whether the given page contains logical forms + */ + bool pageContainsForms( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage ) const; + + /** determines whether the given page contains XForm instances + */ + bool documentContainsXForms() const; + + /** exports the automatic controls number styles + */ + void exportAutoControlNumberStyles(); + + /** exports the auto-styles collected during the examineForms calls + */ + void exportAutoStyles(); + + /** exclude the given control (model) from export. + + <p>If your document contains form controls which are not to be exported for whatever reason, + you need to announce the models of these controls (can be retrieved from XControlShape::getControl) + to the form layer exporter.<br/> + Of course you have to do this before calling <member>exportForms</member></p> + */ + void excludeFromExport( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > _rxControl ); + }; + + //========================================================================= + //= OOfficeFormsExport + //========================================================================= + /// export helper for the office::forms element + class XMLOFF_DLLPUBLIC OOfficeFormsExport + { + private: + OFormsRootExport* m_pImpl; + + public: + OOfficeFormsExport( SvXMLExport& _rExp ); + ~OOfficeFormsExport(); + }; + +//......................................................................... +} // namespace xmloff +//......................................................................... + +#endif // _XMLOFF_FORMLAYEREXPORT_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/formlayerimport.hxx b/include/xmloff/formlayerimport.hxx new file mode 100644 index 000000000000..9a05b73c9ec0 --- /dev/null +++ b/include/xmloff/formlayerimport.hxx @@ -0,0 +1,136 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_FORMLAYERIMPORT_HXX_ +#define _XMLOFF_FORMLAYERIMPORT_HXX_ + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <com/sun/star/drawing/XDrawPage.hpp> +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <rtl/ref.hxx> +#include <salhelper/simplereferenceobject.hxx> +#include <xmloff/xmlimppr.hxx> + +class SvXMLImport; +class SvXMLImportContext; +class SvXMLStylesContext; +class XMLPropStyleContext; + +//......................................................................... +namespace xmloff +{ +//......................................................................... + + //===================================================================== + //= OFormLayerXMLImport + //===================================================================== + class OFormLayerXMLImport_Impl; + /** allows you to import a <form:form> element + */ + class XMLOFF_DLLPUBLIC OFormLayerXMLImport + :public ::salhelper::SimpleReferenceObject + { + OFormLayerXMLImport_Impl* m_pImpl; + + public: + OFormLayerXMLImport(SvXMLImport& _rImporter); + ~OFormLayerXMLImport(); + + /** start importing the forms of the given page + + <p>starting the import of a new page (by using this method) invalidates the current page position.</p> + + @see endPage + */ + void startPage( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& _rxDrawPage); + + /** creates an import context for the office:forms element + */ + SvXMLImportContext* createOfficeFormsContext( + SvXMLImport& _rImport, + sal_uInt16 _nPrefix, + const OUString& _rLocalName); + + /** create an <type>SvXMLImportContext</type> instance which is able to import the <form:form> + element. + + <p>You must have called <method>startPage</method> before you can create such an import context.</p> + + @see startPage + @see endPage + */ + SvXMLImportContext* createContext( + const sal_uInt16 _nPrefix, + const OUString& _rLocalName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& _rxAttribs); + + /** lookup a control given by id. + + <p>The control must be part of the page which is currently beeing imported.</p> + + <p>(And, of course, the control must have been imported already at the moment you call this.)</p> + + @see startPage + */ + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > + lookupControl(const OUString& _rId); + + /** end importing the forms of the current page + + <p>You must call this method if you want the import to be finished correctly. Without calling + it, you will lose information.</p> + + @see startPage + */ + void endPage(); + + /** announces the auto-style context to the form importer + */ + void setAutoStyleContext(SvXMLStylesContext* _pNewContext); + + /** sets the given number style on the given control + @param _rxControlModel + the control model which's style is to be set + @param _rControlNumerStyleName + the style name for the control's number style + */ + void applyControlNumberStyle( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxControlModel, + const OUString& _rControlNumerStyleName + ); + + /** to be called when the document has been completely imported + + <p>For some documents (currently: only some spreadsheet documents) it's necessary + do to a post processing, since not all information from the file can be processed + if the document is not completed, yet.</p> + */ + void documentDone( ); + }; + +//......................................................................... +} // namespace xmloff +//......................................................................... + +#endif // _XMLOFF_FORMLAYERIMPORT_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/i18nmap.hxx b/include/xmloff/i18nmap.hxx new file mode 100644 index 000000000000..22b8ad862a29 --- /dev/null +++ b/include/xmloff/i18nmap.hxx @@ -0,0 +1,73 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_I18NMAP_HXX +#define _XMLOFF_I18NMAP_HXX + +#include <sal/config.h> +#include "xmloff/dllapi.h" +#include <rtl/ustring.hxx> +#include <tools/solar.h> +#include <map> + +class SvI18NMapEntry_Key +{ + sal_uInt16 nKind; + OUString aName; +public: + SvI18NMapEntry_Key( sal_uInt16 nKnd, const OUString& rName ) : + nKind( nKnd ), + aName( rName ) + { + } + + sal_Bool operator==( const SvI18NMapEntry_Key& r ) const + { + return nKind == r.nKind && + aName == r.aName; + } + + sal_Bool operator<( const SvI18NMapEntry_Key& r ) const + { + return nKind < r.nKind || + ( nKind == r.nKind && + aName < r.aName); + } +}; + +typedef std::map<SvI18NMapEntry_Key, OUString> SvI18NMap_Impl; + +class XMLOFF_DLLPUBLIC SvI18NMap +{ + SvI18NMap_Impl m_aMap; + +public: + // Add a name mapping + bool Add( sal_uInt16 nKind, const OUString& rName, + const OUString& rNewName ); + + // Return a mapped name. If the name could not be found, return the + // original name. + const OUString& Get( sal_uInt16 nKind, + const OUString& rName ) const; +}; + +#endif // _XMLOFF_I18NMAP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/maptype.hxx b/include/xmloff/maptype.hxx new file mode 100644 index 000000000000..1f19ad464d60 --- /dev/null +++ b/include/xmloff/maptype.hxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_PROPMAPPINGTYPES_HXX +#define _XMLOFF_PROPMAPPINGTYPES_HXX + +#include <tools/solar.h> +#include <com/sun/star/uno/Any.hxx> +#include <xmloff/xmltoken.hxx> +#include <unotools/saveopt.hxx> + +/////////////////////////////////////////////////////////////////////////// +// +/** Represents a property with its API-name, its XML-name and the type of + its value. +*/ +struct XMLPropertyMapEntry +{ + const sal_Char* msApiName; /// Property-Name + sal_Int32 nApiNameLength; /// length of property name + sal_uInt16 mnNameSpace; /** declares the Namespace in wich this + property exists */ + enum ::xmloff::token::XMLTokenEnum meXMLName; /// XML-Name + sal_uInt32 mnType; /** Bit 0..23 : XML-Type of its value + Bit 24..31: The flags specifies + additional rules how + to im/export the porperty */ + sal_Int16 mnContextId; /// User defined id for context filtering + SvtSaveOptions::ODFDefaultVersion mnEarliestODFVersionForExport;// no export when the used ODF version is lower than this +}; + +/////////////////////////////////////////////////////////////////////////// +// +/** Smart struct to transport an Any with an index to the appropriate + property-name +*/ +struct XMLPropertyState +{ + sal_Int32 mnIndex; + ::com::sun::star::uno::Any maValue; + + XMLPropertyState( sal_Int32 nIndex ) + : mnIndex( nIndex ) {} + XMLPropertyState( sal_Int32 nIndex, const ::com::sun::star::uno::Any& rValue ) + : mnIndex( nIndex ), maValue( rValue ) {} + XMLPropertyState( const XMLPropertyState& rPropState ) + : mnIndex( rPropState.mnIndex ), maValue( rPropState.maValue ) {} +}; + +#endif // _XMLOFF_PROPMAPPINGTYPES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/nmspmap.hxx b/include/xmloff/nmspmap.hxx new file mode 100644 index 000000000000..fe7492cf5e75 --- /dev/null +++ b/include/xmloff/nmspmap.hxx @@ -0,0 +1,170 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_NMSPMAP_HXX +#define _XMLOFF_NMSPMAP_HXX + +#include "sal/config.h" + +#include <map> +#include <utility> + +#include "xmloff/dllapi.h" +#include "sal/types.h" +#include <rtl/ustring.hxx> +#include <boost/unordered_map.hpp> +#include <rtl/ref.hxx> +#include <cppuhelper/weak.hxx> + +#include <limits.h> + +const sal_uInt16 XML_NAMESPACE_XMLNS = (USHRT_MAX-2); +const sal_uInt16 XML_NAMESPACE_NONE = (USHRT_MAX-1); +const sal_uInt16 XML_NAMESPACE_UNKNOWN = (USHRT_MAX); +const sal_uInt16 XML_NAMESPACE_UNKNOWN_FLAG = 0x8000; + +class NameSpaceEntry : public cppu::OWeakObject +{ +public: + // sName refers to the full namespace name + OUString sName; + // sPrefix is the prefix used to declare a given item to be from a given namespace + OUString sPrefix; + // nKey is the unique identifier of a namespace + sal_uInt16 nKey; +}; + +struct OUStringEqFunc +{ + sal_Bool operator()( const OUString &r1, + const OUString &r2) const + { + return r1 == r2; + } +}; + +struct uInt32lt +{ + sal_Bool operator()( const sal_uInt32 &r1, + const sal_uInt32 &r2) const + { + return r1 < r2; + } +}; +typedef ::std::pair < sal_uInt16, OUString > QNamePair; + +struct QNamePairHash +{ + size_t operator()( const QNamePair &r1 ) const + { + return (size_t) r1.second.hashCode() + r1.first; + } +}; + +typedef ::boost::unordered_map < QNamePair, OUString, QNamePairHash > QNameCache; +typedef ::boost::unordered_map < OUString, ::rtl::Reference <NameSpaceEntry >, OUStringHash, OUStringEqFunc > NameSpaceHash; +typedef ::std::map < sal_uInt16, ::rtl::Reference < NameSpaceEntry >, uInt32lt > NameSpaceMap; + +class XMLOFF_DLLPUBLIC SvXMLNamespaceMap +{ + const OUString sXMLNS; + const OUString sEmpty; + + NameSpaceHash aNameHash; + mutable NameSpaceHash aNameCache; + NameSpaceMap aNameMap; + mutable QNameCache aQNameCache; + SAL_DLLPRIVATE sal_uInt16 _Add( const OUString& rPrefix, const OUString &rName, sal_uInt16 nKey ); + +public: + + SvXMLNamespaceMap(); + ~SvXMLNamespaceMap(); + + SvXMLNamespaceMap( const SvXMLNamespaceMap& ); + + void operator =( const SvXMLNamespaceMap& rCmp ); + int operator ==( const SvXMLNamespaceMap& rCmp ) const; + + sal_uInt16 Add( const OUString& rPrefix, + const OUString& rName, + sal_uInt16 nKey = XML_NAMESPACE_UNKNOWN ); + sal_uInt16 AddIfKnown( const OUString& rPrefix, + const OUString& rName ); + + sal_uInt16 GetKeyByName( const OUString& rName ) const; + const OUString& GetNameByKey( sal_uInt16 nKey ) const; + + sal_uInt16 GetKeyByPrefix( const OUString& rPrefix ) const; + const OUString& GetPrefixByKey( sal_uInt16 nKey ) const; + + OUString GetQNameByKey( sal_uInt16 nKey, + const OUString& rLocalName, + sal_Bool bCache = sal_True) const; + + OUString GetAttrNameByKey( sal_uInt16 nKey ) const; + + /* This will replace the version with the unused 5th default parameter */ + sal_uInt16 _GetKeyByAttrName( const OUString& rAttrName, + OUString *pPrefix, + OUString *pLocalName, + OUString *pNamespace = 0, + sal_Bool bCache = sal_True) const; + + /* This will replace the version with the unused 3rd default parameter */ + sal_uInt16 _GetKeyByAttrName( const OUString& rAttrName, + OUString *pLocalName = 0, + sal_Bool bCache = sal_True) const; + + sal_uInt16 GetFirstKey() const; + sal_uInt16 GetNextKey( sal_uInt16 nOldKey ) const; + + /* Give access to all namespace definitions, including multiple entries + for the same key (needed for saving sheets separately in Calc). + This might be replaced by a better interface later. */ + const NameSpaceHash& GetAllEntries() const { return aNameHash; } + + static sal_Bool NormalizeOasisURN( OUString& rName ); + static sal_Bool NormalizeW3URI( OUString& rName ); + static sal_Bool NormalizeURI( OUString& rName ); + +/* deprecated */ sal_Bool AddAtIndex( sal_uInt16 nIdx, const OUString& rPrefix, + const OUString& rName, sal_uInt16 nKey = XML_NAMESPACE_UNKNOWN ); +/* deprecated */ sal_uInt16 GetIndexByKey( sal_uInt16 nKey ) const; +/* deprecated */ sal_uInt16 GetIndexByPrefix( const OUString& rPrefix ) const; +/* deprecated */ sal_uInt16 GetFirstIndex() const; +/* deprecated */ sal_uInt16 GetNextIndex( sal_uInt16 nOldIdx ) const; +/* deprecated */ const OUString& GetPrefixByIndex( sal_uInt16 nIdx ) const; +/* deprecated */ const OUString& GetNameByIndex( sal_uInt16 nIdx ) const; +/* deprecated */ OUString GetAttrNameByIndex( sal_uInt16 nIdx ) const; +/* deprecated */ OUString GetQNameByIndex( sal_uInt16 nIdx, + const OUString& rLocalName ) const; +/* deprecated */ sal_uInt16 GetKeyByAttrName( const OUString& rAttrName, + OUString *pPrefix, + OUString *pLocalName, + OUString *pNamespace=0, + sal_uInt16 nIdxGuess = USHRT_MAX ) const; +/* deprecated */ sal_uInt16 GetKeyByAttrName( const OUString& rAttrName, + OUString *pLocalName = 0, + sal_uInt16 nIdxGuess = USHRT_MAX ) const; +}; + +#endif // _XMLOFF_NMSPMAP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/numehelp.hxx b/include/xmloff/numehelp.hxx new file mode 100644 index 000000000000..9f0bac4f9e4b --- /dev/null +++ b/include/xmloff/numehelp.hxx @@ -0,0 +1,116 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef XMLOFF_NUMEHELP_HXX +#define XMLOFF_NUMEHELP_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <sal/types.h> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/util/XNumberFormatsSupplier.hpp> + +#include <set> + +class SvXMLExport; + +struct XMLNumberFormat +{ + OUString sCurrency; + sal_Int32 nNumberFormat; + sal_Int16 nType; + sal_Bool bIsStandard : 1; + XMLNumberFormat() : nNumberFormat(0), nType(0) {} + XMLNumberFormat(const OUString& sTempCurrency, sal_Int32 nTempFormat, + sal_Int16 nTempType) : sCurrency(sTempCurrency), nNumberFormat(nTempFormat), + nType(nTempType) {} +}; + +struct LessNumberFormat +{ + sal_Bool operator() (const XMLNumberFormat& rValue1, const XMLNumberFormat& rValue2) const + { + return rValue1.nNumberFormat < rValue2.nNumberFormat; + } +}; + +typedef std::set<XMLNumberFormat, LessNumberFormat> XMLNumberFormatSet; + +class XMLOFF_DLLPUBLIC XMLNumberFormatAttributesExportHelper +{ + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats > xNumberFormats; + SvXMLExport* pExport; + const OUString sEmpty; + const OUString sStandardFormat; + const OUString sType; + const OUString sAttrValueType; + const OUString sAttrValue; + const OUString sAttrDateValue; + const OUString sAttrTimeValue; + const OUString sAttrBooleanValue; + const OUString sAttrStringValue; + const OUString sAttrCurrency; + const OUString msCurrencySymbol; + const OUString msCurrencyAbbreviation; + XMLNumberFormatSet aNumberFormats; +public : + XMLNumberFormatAttributesExportHelper(::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier); + XMLNumberFormatAttributesExportHelper(::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier, + SvXMLExport& rExport ); + ~XMLNumberFormatAttributesExportHelper(); + void SetExport(SvXMLExport* pExp) { this->pExport = pExp; } + + sal_Int16 GetCellType(const sal_Int32 nNumberFormat, OUString& sCurrency, bool& bIsStandard); + static void WriteAttributes(SvXMLExport& rXMLExport, + const sal_Int16 nTypeKey, + const double& rValue, + const OUString& rCurrencySymbol, + sal_Bool bExportValue = sal_True); + static sal_Bool GetCurrencySymbol(const sal_Int32 nNumberFormat, OUString& rCurrencySymbol, + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xNumberFormatsSupplier); + static sal_Int16 GetCellType(const sal_Int32 nNumberFormat, sal_Bool& bIsStandard, + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & xNumberFormatsSupplier); + static void SetNumberFormatAttributes(SvXMLExport& rXMLExport, + const sal_Int32 nNumberFormat, + const double& rValue, + sal_Bool bExportValue = sal_True); + static void SetNumberFormatAttributes(SvXMLExport& rXMLExport, + const OUString& rValue, + const OUString& rCharacters, + sal_Bool bExportValue = sal_True, + sal_Bool bExportTypeAttribute = sal_True); + + sal_Bool GetCurrencySymbol(const sal_Int32 nNumberFormat, OUString& rCurrencySymbol); + sal_Int16 GetCellType(const sal_Int32 nNumberFormat, bool& bIsStandard); + void WriteAttributes(const sal_Int16 nTypeKey, + const double& rValue, + const OUString& rCurrencySymbol, + sal_Bool bExportValue = sal_True); + void SetNumberFormatAttributes(const sal_Int32 nNumberFormat, + const double& rValue, + sal_Bool bExportValue = sal_True); + void SetNumberFormatAttributes(const OUString& rValue, + const OUString& rCharacters, + sal_Bool bExportValue = sal_True, + sal_Bool bExportTypeAttribute = sal_True); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/odffields.hxx b/include/xmloff/odffields.hxx new file mode 100644 index 000000000000..a116350db999 --- /dev/null +++ b/include/xmloff/odffields.hxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +/* + * Copyright 2008 by Novell, Inc. + */ + +#ifndef _ODFFIELDS_HXX +#define _ODFFIELDS_HXX + + +#define ODF_FORMTEXT "vnd.oasis.opendocument.field.FORMTEXT" + +#define ODF_FORMCHECKBOX "vnd.oasis.opendocument.field.FORMCHECKBOX" +#define ODF_FORMCHECKBOX_HELPTEXT "Checkbox_HelpText" +#define ODF_FORMCHECKBOX_NAME "Checkbox_Name" +#define ODF_FORMCHECKBOX_RESULT "Checkbox_Checked" + +#define ODF_FORMDROPDOWN "vnd.oasis.opendocument.field.FORMDROPDOWN" +#define ODF_FORMDROPDOWN_LISTENTRY "Dropdown_ListEntry" +#define ODF_FORMDROPDOWN_RESULT "Dropdown_Selected" + +#define ODF_TOC "vnd.oasis.opendocument.field.TOC" + +#define ODF_HYPERLINK "vnd.oasis.opendocument.field.HYPERLINK" + +#define ODF_PAGEREF "vnd.oasis.opendocument.field.PAGEREF" + +#define ODF_UNHANDLED "vnd.oasis.opendocument.field.UNHANDLED" +#define ODF_OLE_PARAM "vnd.oasis.opendocument.field.ole" +#define ODF_ID_PARAM "vnd.oasis.opendocument.field.id" +#define ODF_CODE_PARAM "vnd.oasis.opendocument.field.code" +#define ODF_COMMENTRANGE "vnd.oasis.opendocument.field.COMMENTRANGE" + +#endif /* _ODFFIELDS_HXX */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/prhdlfac.hxx b/include/xmloff/prhdlfac.hxx new file mode 100644 index 000000000000..afd3472d111c --- /dev/null +++ b/include/xmloff/prhdlfac.hxx @@ -0,0 +1,103 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_PROPERTYHANDLERFACTORY_HXX +#define _XMLOFF_PROPERTYHANDLERFACTORY_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include "sal/types.h" + +#include <map> +#include <xmloff/uniref.hxx> +#include <xmloff/xmlprhdl.hxx> + +/** + This class is a base-class to create XMLPropertyHandler. + It creates PropertyHandler for given XML-types and store + them in an internal cache. They'll be deleted at destruction- + time. + For create your own PropertyHandler for specific XML-types + you have to override the virtual method GetPropertyHandler + ( see below ). +*/ +class XMLOFF_DLLPUBLIC XMLPropertyHandlerFactory : public UniRefBase +{ +public: + virtual ~XMLPropertyHandlerFactory(); + + /** + This method retrieves a PropertyHandler for the given XML-type. + To extend this method for more XML-types override this method + like the example below. If you call the method of the base-class + you get propertyhandler for basic-XML-types ( e.g. for color, percent, ... ). + Afetr that you could create your new XML-types. After creating a new type + you have to put the pointer into the cache via the method + PutHdlCache( sal_Int32 , XMLPropertyHandler* ). + + virtual const XMLPropertyHandler* GetPropertyHandler( sal_Int32 nType ) const + { + XMLPropertyHandler* pHdl = XMLPropertyHandlerFactory::GetPropertyHandler( nType ); + + if( !pHdl ) + { + switch( nType ) + { + case XML_TYPE_XYZ : + pHdl = new XML_xyz_PropHdl; + break; + case ... + : + : + } + + if( pHdl ) + PutHdlCache( nType, pHdl ); + } + + return pHdl; + } + */ + virtual const XMLPropertyHandler* GetPropertyHandler( sal_Int32 nType ) const; + + /** helper method to statically create a property handler; this will not + * use the handler cache. This method should only be called in special + * circumstances; calling GetPropertyHandler is almost always + * preferable. */ + static const XMLPropertyHandler* CreatePropertyHandler( sal_Int32 nType ); + +protected: + /** Retrieves a PropertyHandler from the internal cache */ + XMLPropertyHandler* GetHdlCache( sal_Int32 nType ) const; + /** Puts a PropertyHandler into the internal cache */ + void PutHdlCache( sal_Int32 nType, const XMLPropertyHandler* pHdl ) const; + +private: + /** Retrieves ( creates if necessary ) PropertyHandler for + basic XML-types */ + SAL_DLLPRIVATE const XMLPropertyHandler* GetBasicHandler( sal_Int32 nType ) + const; + + typedef ::std::map< sal_Int32, XMLPropertyHandler* > CacheMap; + CacheMap maHandlerCache; +}; + +#endif // _XMLOFF_PROPERTYHANDLERFACTORY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/prstylei.hxx b/include/xmloff/prstylei.hxx new file mode 100644 index 000000000000..3ec8114c6507 --- /dev/null +++ b/include/xmloff/prstylei.hxx @@ -0,0 +1,99 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _XMLOFF_PRSTYLEI_HXX_ +#define _XMLOFF_PRSTYLEI_HXX_ + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include "sal/types.h" +#include <com/sun/star/style/XStyle.hpp> +#include <vector> +#include <xmloff/xmlstyle.hxx> + +struct XMLPropertyState; +class SvXMLStylesContext; + +namespace com { namespace sun { namespace star { + namespace beans { class XPropertySet; } +} } } + +class XMLOFF_DLLPUBLIC XMLPropStyleContext : public SvXMLStyleContext +{ + const OUString msIsPhysical; + const OUString msFollowStyle; + ::std::vector< XMLPropertyState > maProperties; + ::com::sun::star::uno::Reference < ::com::sun::star::style::XStyle > mxStyle; + SvXMLImportContextRef mxStyles; + + SAL_DLLPRIVATE XMLPropStyleContext(XMLPropStyleContext &); // not defined + SAL_DLLPRIVATE void operator =(XMLPropStyleContext &); // not defined + +protected: + + virtual void SetAttribute( sal_uInt16 nPrefixKey, + const OUString& rLocalName, + const OUString& rValue ); + SvXMLStylesContext *GetStyles() { return (SvXMLStylesContext *)&mxStyles; } + ::std::vector< XMLPropertyState > & GetProperties() { return maProperties; } + + // This methos my be overloaded to create a new style. Its called by + // CreateInsert to create a style if a style with the requested family and + // name couldn't be found. The st + virtual ::com::sun::star::uno::Reference < + ::com::sun::star::style::XStyle > Create(); + +public: + + TYPEINFO(); + + XMLPropStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, + const OUString& rLName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList, + SvXMLStylesContext& rStyles, sal_uInt16 nFamily = 0, + sal_Bool bDefaultStyle=sal_False ); + virtual ~XMLPropStyleContext(); + + virtual SvXMLImportContext *CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + + virtual void FillPropertySet( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > & rPropSet ); + + const SvXMLStylesContext *GetStyles() const { return (const SvXMLStylesContext *)&mxStyles; } + const ::std::vector< XMLPropertyState > & GetProperties() const { return maProperties; } + + const ::com::sun::star::uno::Reference < + ::com::sun::star::style::XStyle >& + GetStyle() const { return mxStyle; } + void SetStyle( + const ::com::sun::star::uno::Reference< + ::com::sun::star::style::XStyle >& xStl) { mxStyle = xStl; } + + virtual void SetDefaults(); + + virtual void CreateAndInsert( sal_Bool bOverwrite ); + virtual void Finish( sal_Bool bOverwrite ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/settingsstore.hxx b/include/xmloff/settingsstore.hxx new file mode 100644 index 000000000000..b9f5f04c45bd --- /dev/null +++ b/include/xmloff/settingsstore.hxx @@ -0,0 +1,59 @@ +/* -*- 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. + * + * Major Contributor(s): + * Copyright (C) 2011 Novell, Inc. <michael.meeks@novell.com> (initial developer) + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +// Simple interface to allow serialization of document settings + +#ifndef _XMLOFF_SETTINGS_STORE_HXX +#define _XMLOFF_SETTINGS_STORE_HXX + +#include <vector> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/embed/XStorage.hpp> + +// Scans list of properties for certain URL properties that could refer +// to internal objects, and initializes from these. +class DocumentSettingsSerializer { +public: + // Import objects and update properties (eliding URLs) + virtual com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> + filterStreamsFromStorage( + const com::sun::star::uno::Reference< com::sun::star::embed::XStorage > &xStorage, + const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aConfigProps ) = 0; + // Export objects and update properties with relative URLs into this storage + virtual com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> + filterStreamsToStorage( + const com::sun::star::uno::Reference< com::sun::star::embed::XStorage > &xStorage, + const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aConfigProps ) = 0; + +protected: + ~DocumentSettingsSerializer() {} +}; + +#endif // _XMLOFF_SETTINGS_STORE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/shapeexport.hxx b/include/xmloff/shapeexport.hxx new file mode 100644 index 000000000000..8dfaa0f89d5e --- /dev/null +++ b/include/xmloff/shapeexport.hxx @@ -0,0 +1,331 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _XMLOFF_SHAPEEXPORT_HXX_ +#define _XMLOFF_SHAPEEXPORT_HXX_ + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include "sal/types.h" + +#include <rtl/ref.hxx> +#include <rtl/ustring.hxx> +#include <rtl/ustrbuf.hxx> +#include <xmloff/uniref.hxx> + +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/drawing/XShapes.hpp> +#include <com/sun/star/awt/Point.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> + +#include <map> +#include <xmloff/xmlprmap.hxx> +#include <xmloff/xmlexppr.hxx> +#include <xmloff/animexp.hxx> +#include <xmloff/families.hxx> + +#include "xmloff/table/XMLTableExport.hxx" + +// shape export features are bits used for the nFeature +// parameter of XMLShapeExport::exportShape + +#define SEF_EXPORT_X 0x0001 +#define SEF_EXPORT_Y 0x0002 +#define SEF_EXPORT_POSITION 0x0003 + +#define SEF_EXPORT_WIDTH 0x0004 +#define SEF_EXPORT_HEIGHT 0x0008 +#define SEF_EXPORT_SIZE 0x000c + +// when you set this flag a chart does NOT export its own data as table element +#define SEF_EXPORT_NO_CHART_DATA 0x0010 + +// When setting the flag below no ignorableWhiteSpace will be called around +// the drawing object elements +#define SEF_EXPORT_NO_WS 0x0020 + +// When setting the flag below a callout shape is exported as office:annotation +#define SEF_EXPORT_ANNOTATION 0x0040 + +#define SEF_DEFAULT SEF_EXPORT_POSITION|SEF_EXPORT_SIZE + +enum XmlShapeType +{ + XmlShapeTypeUnknown, // not known + + XmlShapeTypeDrawRectangleShape, // "com.sun.star.drawing.RectangleShape" + XmlShapeTypeDrawEllipseShape, // "com.sun.star.drawing.EllipseShape" + XmlShapeTypeDrawControlShape, // "com.sun.star.drawing.ControlShape" + XmlShapeTypeDrawConnectorShape, // "com.sun.star.drawing.ConnectorShape" + XmlShapeTypeDrawMeasureShape, // "com.sun.star.drawing.MeasureShape" + XmlShapeTypeDrawLineShape, // "com.sun.star.drawing.LineShape" + XmlShapeTypeDrawPolyPolygonShape, // "com.sun.star.drawing.PolyPolygonShape" + XmlShapeTypeDrawPolyLineShape, // "com.sun.star.drawing.PolyLineShape" + XmlShapeTypeDrawOpenBezierShape, // "com.sun.star.drawing.OpenBezierShape" + XmlShapeTypeDrawClosedBezierShape, // "com.sun.star.drawing.ClosedBezierShape" + XmlShapeTypeDrawGraphicObjectShape, // "com.sun.star.drawing.GraphicObjectShape" + XmlShapeTypeDrawGroupShape, // "com.sun.star.drawing.GroupShape" + XmlShapeTypeDrawTextShape, // "com.sun.star.drawing.TextShape" + XmlShapeTypeDrawOLE2Shape, // "com.sun.star.drawing.OLE2Shape" + XmlShapeTypeDrawChartShape, // embedded com.sun.star.chart + XmlShapeTypeDrawSheetShape, // embedded com.sun.star.sheet + XmlShapeTypeDrawPageShape, // "com.sun.star.drawing.PageShape" + XmlShapeTypeDrawFrameShape, // "com.sun.star.drawing.FrameShape" + XmlShapeTypeDrawCaptionShape, // "com.sun.star.drawing.CaptionShape" + XmlShapeTypeDrawAppletShape, // "com.sun.star.drawing.AppletShape" + XmlShapeTypeDrawPluginShape, // "com.sun.star.drawing.PlugginShape" + + XmlShapeTypeDraw3DSceneObject, // "com.sun.star.drawing.Shape3DSceneObject" + XmlShapeTypeDraw3DCubeObject, // "com.sun.star.drawing.Shape3DCubeObject" + XmlShapeTypeDraw3DSphereObject, // "com.sun.star.drawing.Shape3DSphereObject" + XmlShapeTypeDraw3DLatheObject, // "com.sun.star.drawing.Shape3DLatheObject" + XmlShapeTypeDraw3DExtrudeObject, // "com.sun.star.drawing.Shape3DExtrudeObject" + + XmlShapeTypePresTitleTextShape, // "com.sun.star.presentation.TitleTextShape" + XmlShapeTypePresOutlinerShape, // "com.sun.star.presentation.OutlinerShape" + XmlShapeTypePresSubtitleShape, // "com.sun.star.presentation.SubtitleShape" + XmlShapeTypePresGraphicObjectShape, // "com.sun.star.presentation.GraphicObjectShape" + XmlShapeTypePresPageShape, // "com.sun.star.presentation.PageShape" + XmlShapeTypePresOLE2Shape, // "com.sun.star.presentation.OLE2Shape" + XmlShapeTypePresChartShape, // "com.sun.star.presentation.ChartShape" + XmlShapeTypePresSheetShape, // "com.sun.star.presentation.CalcShape" + XmlShapeTypePresTableShape, // "com.sun.star.presentation.TableShape" + XmlShapeTypePresOrgChartShape, // "com.sun.star.presentation.OrgChartShape" + XmlShapeTypePresNotesShape, // "com.sun.star.presentation.NotesShape" + XmlShapeTypeHandoutShape, // "com.sun.star.presentation.HandoutShape" + + XmlShapeTypePresHeaderShape, // "com.sun.star.presentation.HeaderShape" + XmlShapeTypePresFooterShape, // "com.sun.star.presentation.FooterShape" + XmlShapeTypePresSlideNumberShape, // "com.sun.star.presentation.SlideNumberShape" + XmlShapeTypePresDateTimeShape, // "com.sun.star.presentation.DateTimeShape" + + XmlShapeTypeDrawCustomShape, // "com.sun.star.drawing.CustomShape" + XmlShapeTypeDrawMediaShape, // "com.sun.star.drawing.MediaShape" + XmlShapeTypePresMediaShape, // "com.sun.star.presentation.MediaShape" + + XmlShapeTypeDrawTableShape, // "com.sun.star.drawing.TableShape" + + XmlShapeTypeNotYetSet +}; + +/** caches style and type info after a collectShapeAutostyle for later use in exportShape */ +struct ImplXMLShapeExportInfo +{ + OUString msStyleName; + OUString msTextStyleName; + sal_Int32 mnFamily; + XmlShapeType meShapeType; + + com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xCustomShapeReplacement; + + ImplXMLShapeExportInfo() : mnFamily( XML_STYLE_FAMILY_SD_GRAPHICS_ID ), meShapeType( XmlShapeTypeNotYetSet ) {} +}; + +/** a vector for shape style and type cache information */ +typedef std::vector< ImplXMLShapeExportInfo > ImplXMLShapeExportInfoVector; + +/** a map to store all cache data for already collected XShapes */ +typedef std::map< com::sun::star::uno::Reference < com::sun::star::drawing::XShapes >, ImplXMLShapeExportInfoVector > ShapesInfos; + +////////////////////////////////////////////////////////////////////////////// +// predeclarations + +class SvXMLExport; +class SvXMLExportPropertyMapper; + +namespace basegfx +{ + class B2DTuple; + class B2DHomMatrix; +} // end of namespace basegfx + +class XMLOFF_DLLPUBLIC XMLShapeExport : public UniRefBase +{ +private: + + SvXMLExport& mrExport; + UniReference< XMLPropertyHandlerFactory > mxSdPropHdlFactory; + UniReference< SvXMLExportPropertyMapper > mxPropertySetMapper; + UniReference< XMLAnimationsExporter > mxAnimationsExporter; + sal_Int32 mnNextUniqueShapeId; + ShapesInfos maShapesInfos; + ShapesInfos::iterator maCurrentShapesIter; + sal_Bool mbExportLayer; + ImplXMLShapeExportInfoVector maShapeInfos; + ImplXMLShapeExportInfoVector::iterator maCurrentInfo; + OUString msPresentationStylePrefix; + + // #88546# possibility to swich progress bar handling on/off + sal_Bool mbHandleProgressBar; + + rtl::Reference< XMLTableExport > mxShapeTableExport; + +protected: + SvXMLExport& GetExport() { return mrExport; } + const SvXMLExport& GetExport() const { return mrExport; } +private: + + SAL_DLLPRIVATE UniReference< SvXMLExportPropertyMapper > GetPropertySetMapper() const { return mxPropertySetMapper; } + + const OUString msZIndex; + const OUString msPrintable; + const OUString msVisible; + + const OUString msEmptyPres; + const OUString msModel; + const OUString msStartShape; + const OUString msEndShape; + const OUString msOnClick; + const OUString msEventType; + const OUString msPresentation; + const OUString msMacroName; + const OUString msScript; + const OUString msLibrary; + const OUString msClickAction; + const OUString msBookmark; + const OUString msEffect; + const OUString msPlayFull; + const OUString msVerb; + const OUString msSoundURL; + const OUString msSpeed; + const OUString msStarBasic; + + OUStringBuffer msBuffer; + + SAL_DLLPRIVATE void ImpCalcShapeType(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType& eShapeType); + + SAL_DLLPRIVATE void ImpExportNewTrans(const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint); + SAL_DLLPRIVATE void ImpExportNewTrans_GetB2DHomMatrix(::basegfx::B2DHomMatrix& rMatrix, const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet); + SAL_DLLPRIVATE void ImpExportNewTrans_DecomposeAndRefPoint(const ::basegfx::B2DHomMatrix& rMat, ::basegfx::B2DTuple& rTRScale, double& fTRShear, double& fTRRotate, ::basegfx::B2DTuple& rTRTranslate, com::sun::star::awt::Point* pRefPoint); + SAL_DLLPRIVATE void ImpExportNewTrans_FeaturesAndWrite(::basegfx::B2DTuple& rTRScale, double fTRShear, double fTRRotate, ::basegfx::B2DTuple& rTRTranslate, const sal_Int32 nFeatures); + SAL_DLLPRIVATE sal_Bool ImpExportPresentationAttributes( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet, const OUString& rClass ); + SAL_DLLPRIVATE void ImpExportText( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape ); + SAL_DLLPRIVATE void ImpExportEvents( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape ); + SAL_DLLPRIVATE void ImpExportDescription( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape ); // #i68101# + SAL_DLLPRIVATE void ImpExportGluePoints( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape ); + + // single shape exporters + SAL_DLLPRIVATE void ImpExportGroupShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL ); + SAL_DLLPRIVATE void ImpExport3DSceneShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL ); + SAL_DLLPRIVATE void ImpExportRectangleShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL ); + SAL_DLLPRIVATE void ImpExportLineShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL ); + SAL_DLLPRIVATE void ImpExportEllipseShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL ); + SAL_DLLPRIVATE void ImpExportPolygonShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL ); + SAL_DLLPRIVATE void ImpExportTextBoxShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL ); + SAL_DLLPRIVATE void ImpExportGraphicObjectShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL ); + SAL_DLLPRIVATE void ImpExportChartShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL, SvXMLAttributeList* pAttrList = NULL ); + SAL_DLLPRIVATE void ImpExportControlShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL ); + SAL_DLLPRIVATE void ImpExportConnectorShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL ); + SAL_DLLPRIVATE void ImpExportMeasureShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL ); + SAL_DLLPRIVATE void ImpExportOLE2Shape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL, SvXMLAttributeList* pAttrList = NULL ); + SAL_DLLPRIVATE void ImpExportPageShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL ); + SAL_DLLPRIVATE void ImpExportCaptionShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL ); + SAL_DLLPRIVATE void ImpExport3DShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL ); + SAL_DLLPRIVATE void ImpExportFrameShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL ); + SAL_DLLPRIVATE void ImpExportPluginShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL ); + SAL_DLLPRIVATE void ImpExportAppletShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL ); + SAL_DLLPRIVATE void ImpExportCustomShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL ); + SAL_DLLPRIVATE void ImpExportMediaShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL ); + SAL_DLLPRIVATE void ImpExportTableShape(const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures = SEF_DEFAULT, com::sun::star::awt::Point* pRefPoint = NULL ); +public: + XMLShapeExport(SvXMLExport& rExp, SvXMLExportPropertyMapper *pExtMapper=0 ); + virtual ~XMLShapeExport(); + + // This method collects all automatic styles for the given XShape + void collectShapeAutoStyles( + const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape); + + // This method exports the given XShape + void exportShape( + const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape, + sal_Int32 nFeatures = SEF_DEFAULT, + com::sun::star::awt::Point* pRefPoint = NULL, + SvXMLAttributeList* pAttrList = NULL + ); + + // This method collects all automatic styles for the shapes inside the given XShapes collection + void collectShapesAutoStyles( + const com::sun::star::uno::Reference < com::sun::star::drawing::XShapes >& xShapes); + + // This method exports all XShape inside the given XShapes collection + void exportShapes( + const com::sun::star::uno::Reference < com::sun::star::drawing::XShapes >& xShapes, + sal_Int32 nFeatures = SEF_DEFAULT, + com::sun::star::awt::Point* pRefPoint = NULL + ); + + /** initializes some internal structures for fast access to the given XShapes collection + + <p>This method has to be called before you use exportShape or collectShapeAutoStyles. + It is automaticly called if you use collectShapesAutoStyles and exportShapes. + + @see collectShapeAutoStyles + @see exportShape + @see collectShapesAutoStyles + @see exportShapes + */ + void seekShapes( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes ) throw(); + + void exportAutoStyles(); + + /** sets a new reference to an XMLAnimationExporter. + If this is a non NULL reference, the animation information from all shapes given to exportShape() + from now on are collected. + */ + void setAnimationsExporter( UniReference< XMLAnimationsExporter > xAnimExport ) { mxAnimationsExporter = xAnimExport; } + + /** returns the last set XMLAnimationExport */ + UniReference< XMLAnimationsExporter > getAnimationsExporter() const { return mxAnimationsExporter; } + + /// returns the export property mapper for external chaining + static SvXMLExportPropertyMapper* CreateShapePropMapper( SvXMLExport& rExport ); + + void enableLayerExport( sal_Bool bEnable = sal_True ) { mbExportLayer = bEnable; } + sal_Bool IsLayerExportEnabled() const { return mbExportLayer; } + + // #88546# + /** defines if the export should increment the progress bar or not */ + void enableHandleProgressBar( sal_Bool bEnable = sal_True ) { mbHandleProgressBar = bEnable; } + sal_Bool IsHandleProgressBarEnabled() const { return mbHandleProgressBar; } + + void setPresentationStylePrefix( const OUString& rPrefix ) { msPresentationStylePrefix = rPrefix; } + + /** helper for chart that adds all attributes of a 3d scene element to the export */ + void export3DSceneAttributes( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet ); + + /** helper for chart that exports all lamps from the propertyset */ + void export3DLamps( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet ); + + /** sj: replacing CustomShapes with standard objects that are also supported in OpenOffice.org format */ + com::sun::star::uno::Reference < com::sun::star::drawing::XShape > checkForCustomShapeReplacement( + const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& ); + + /** helper to export the style for graphic defaults */ + void ExportGraphicDefaults(); + + /** is called before a shape element for the given XShape is exported */ + virtual void onExport( const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape ); + + const rtl::Reference< XMLTableExport >& GetShapeTableExport(); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/shapeimport.hxx b/include/xmloff/shapeimport.hxx new file mode 100644 index 000000000000..6de02130f243 --- /dev/null +++ b/include/xmloff/shapeimport.hxx @@ -0,0 +1,426 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_SHAPEIMPORT_HXX_ +#define _XMLOFF_SHAPEIMPORT_HXX_ + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <com/sun/star/drawing/XShapes.hpp> +#include <com/sun/star/drawing/HomogenMatrix.hpp> +#include <com/sun/star/drawing/ProjectionMode.hpp> +#include <com/sun/star/drawing/ShadeMode.hpp> +#include <xmloff/uniref.hxx> +#include <xmloff/xmlictxt.hxx> + +#include "xmloff/table/XMLTableImport.hxx" +#include <basegfx/vector/b3dvector.hxx> +#include <vector> + +class SvXMLImport; +class SvXMLImportContext; +class SvXMLTokenMap; +class SvXMLStylesContext; +class XMLSdPropHdlFactory; +class XMLPropertySetMapper; +class SvXMLImportPropertyMapper; + +////////////////////////////////////////////////////////////////////////////// + +enum SdXMLGroupShapeElemTokenMap +{ + XML_TOK_GROUP_GROUP, + XML_TOK_GROUP_RECT, + XML_TOK_GROUP_LINE, + XML_TOK_GROUP_CIRCLE, + XML_TOK_GROUP_ELLIPSE, + XML_TOK_GROUP_POLYGON, + XML_TOK_GROUP_POLYLINE, + XML_TOK_GROUP_PATH, + + XML_TOK_GROUP_CONTROL, + XML_TOK_GROUP_CONNECTOR, + XML_TOK_GROUP_MEASURE, + XML_TOK_GROUP_PAGE, + XML_TOK_GROUP_CAPTION, + + XML_TOK_GROUP_CHART, + XML_TOK_GROUP_3DSCENE, + + XML_TOK_GROUP_FRAME, + + XML_TOK_GROUP_CUSTOM_SHAPE, + + XML_TOK_GROUP_ANNOTATION, + + XML_TOK_GROUP_A, + + XML_TOK_GROUP_LAST +}; + +enum SdXMLFrameShapeElemTokenMap +{ + XML_TOK_FRAME_TEXT_BOX, + XML_TOK_FRAME_IMAGE, + XML_TOK_FRAME_OBJECT, + XML_TOK_FRAME_OBJECT_OLE, + XML_TOK_FRAME_PLUGIN, + XML_TOK_FRAME_FRAME, + XML_TOK_FRAME_FLOATING_FRAME, + XML_TOK_FRAME_APPLET, + XML_TOK_FRAME_TABLE, + + XML_TOK_FRAME_LAST +}; + +enum SdXML3DSceneShapeElemTokenMap +{ + XML_TOK_3DSCENE_3DSCENE, + XML_TOK_3DSCENE_3DCUBE, + XML_TOK_3DSCENE_3DSPHERE, + XML_TOK_3DSCENE_3DLATHE, + XML_TOK_3DSCENE_3DEXTRUDE, + + XML_TOK_3DSCENE_LAST +}; + +enum SdXMLShapeAttrTokenMap +{ + XML_TOK_SHAPE_NAME, + XML_TOK_SHAPE_DRAWSTYLE_NAME_GRAPHICS, + XML_TOK_SHAPE_PRESENTATION_CLASS, + XML_TOK_SHAPE_DRAWSTYLE_NAME_PRESENTATION, + XML_TOK_SHAPE_TRANSFORM, + XML_TOK_SHAPE_IS_PLACEHOLDER, + XML_TOK_SHAPE_IS_USER_TRANSFORMED +}; + +enum SdXML3DObjectAttrTokenMap +{ + XML_TOK_3DOBJECT_DRAWSTYLE_NAME, + XML_TOK_3DOBJECT_TRANSFORM +}; + +enum SdXML3DPolygonBasedAttrTokenMap +{ + XML_TOK_3DPOLYGONBASED_VIEWBOX, + XML_TOK_3DPOLYGONBASED_D +}; + +enum SdXML3DCubeObjectAttrTokenMap +{ + XML_TOK_3DCUBEOBJ_MINEDGE, + XML_TOK_3DCUBEOBJ_MAXEDGE +}; + +enum SdXML3DSphereObjectAttrTokenMap +{ + XML_TOK_3DSPHEREOBJ_CENTER, + XML_TOK_3DSPHEREOBJ_SIZE +}; + +enum SdXMLPolygonShapeAttrTokenMap +{ + XML_TOK_POLYGONSHAPE_VIEWBOX, + XML_TOK_POLYGONSHAPE_POINTS +}; + +enum SdXMLPathShapeAttrTokenMap +{ + XML_TOK_PATHSHAPE_VIEWBOX, + XML_TOK_PATHSHAPE_D +}; + +enum SdXML3DSceneShapeAttrTokenMap +{ + XML_TOK_3DSCENESHAPE_TRANSFORM, + XML_TOK_3DSCENESHAPE_VRP, + XML_TOK_3DSCENESHAPE_VPN, + XML_TOK_3DSCENESHAPE_VUP, + XML_TOK_3DSCENESHAPE_PROJECTION, + XML_TOK_3DSCENESHAPE_DISTANCE, + XML_TOK_3DSCENESHAPE_FOCAL_LENGTH, + XML_TOK_3DSCENESHAPE_SHADOW_SLANT, + XML_TOK_3DSCENESHAPE_SHADE_MODE, + XML_TOK_3DSCENESHAPE_AMBIENT_COLOR, + XML_TOK_3DSCENESHAPE_LIGHTING_MODE +}; + +enum SdXML3DLightAttrTokenMap +{ + XML_TOK_3DLIGHT_DIFFUSE_COLOR, + XML_TOK_3DLIGHT_DIRECTION, + XML_TOK_3DLIGHT_ENABLED, + XML_TOK_3DLIGHT_SPECULAR +}; + +////////////////////////////////////////////////////////////////////////////// +// dr3d:3dlight context + +class SdXML3DLightContext: public SvXMLImportContext +{ + // local parameters which need to be read + sal_Int32 maDiffuseColor; + ::basegfx::B3DVector maDirection; + bool mbEnabled; + bool mbSpecular; + +public: + SdXML3DLightContext( + SvXMLImport& rImport, + sal_uInt16 nPrfx, + const OUString& rLName, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList); + virtual ~SdXML3DLightContext(); + + sal_Int32 GetDiffuseColor() { return maDiffuseColor; } + const ::basegfx::B3DVector& GetDirection() { return maDirection; } + sal_Bool GetEnabled() { return mbEnabled; } + sal_Bool GetSpecular() { return mbSpecular; } +}; + +////////////////////////////////////////////////////////////////////////////// + +typedef ::std::vector< SdXML3DLightContext* > Imp3DLightList; + +class SdXML3DSceneAttributesHelper +{ +protected: + SvXMLImport& mrImport; + + // list for local light contexts + Imp3DLightList maList; + + // local parameters which need to be read + com::sun::star::drawing::HomogenMatrix mxHomMat; + sal_Bool mbSetTransform; + + com::sun::star::drawing::ProjectionMode mxPrjMode; + sal_Int32 mnDistance; + sal_Int32 mnFocalLength; + sal_Int32 mnShadowSlant; + com::sun::star::drawing::ShadeMode mxShadeMode; + sal_Int32 maAmbientColor; + bool mbLightingMode; + + ::basegfx::B3DVector maVRP; + ::basegfx::B3DVector maVPN; + ::basegfx::B3DVector maVUP; + sal_Bool mbVRPUsed; + sal_Bool mbVPNUsed; + sal_Bool mbVUPUsed; + +public: + SdXML3DSceneAttributesHelper( SvXMLImport& rImporter ); + ~SdXML3DSceneAttributesHelper(); + + /** creates a 3d ligth context and adds it to the internal list for later processing */ + SvXMLImportContext * create3DLightContext( sal_uInt16 nPrfx, const OUString& rLName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList); + + /** this should be called for each scene attribute */ + void processSceneAttribute( sal_uInt16 nPrefix, const OUString& rLocalName, const OUString& rValue ); + + /** this sets the scene attributes at this propertyset */ + void setSceneAttributes( const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xPropSet ); +}; + +////////////////////////////////////////////////////////////////////////////// + +class SvXMLShapeContext : public SvXMLImportContext +{ +protected: + com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxShape; + sal_Bool mbTemporaryShape; + OUString msHyperlink; + +public: + SvXMLShapeContext( SvXMLImport& rImp, sal_uInt16 nPrfx, + const OUString& rLName, sal_Bool bTemporaryShape ) : SvXMLImportContext( rImp, nPrfx, rLName ), mbTemporaryShape(bTemporaryShape) {} + + TYPEINFO(); + + const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& getShape() const { return mxShape; } + + void setHyperlink( const OUString& rHyperlink ); +}; + +////////////////////////////////////////////////////////////////////////////// + +class ShapeSortContext; +struct XMLShapeImportHelperImpl; +struct XMLShapeImportPageContextImpl; + +class XMLOFF_DLLPUBLIC XMLShapeImportHelper : public UniRefBase +{ + XMLShapeImportHelperImpl* mpImpl; + + XMLShapeImportPageContextImpl* mpPageContext; + + com::sun::star::uno::Reference< com::sun::star::frame::XModel > mxModel; + + // PropertySetMappers and factory + XMLSdPropHdlFactory* mpSdPropHdlFactory; + SvXMLImportPropertyMapper* mpPropertySetMapper; + SvXMLImportPropertyMapper* mpPresPagePropsMapper; + + // contexts for Style and AutoStyle import + SvXMLStylesContext* mpStylesContext; + SvXMLStylesContext* mpAutoStylesContext; + + // contexts for xShape contents TokenMaps + SvXMLTokenMap* mpGroupShapeElemTokenMap; + SvXMLTokenMap* mpFrameShapeElemTokenMap; + SvXMLTokenMap* mp3DSceneShapeElemTokenMap; + SvXMLTokenMap* mp3DObjectAttrTokenMap; + SvXMLTokenMap* mp3DPolygonBasedAttrTokenMap; + SvXMLTokenMap* mp3DCubeObjectAttrTokenMap; + SvXMLTokenMap* mp3DSphereObjectAttrTokenMap; + SvXMLTokenMap* mp3DSceneShapeAttrTokenMap; + SvXMLTokenMap* mp3DLightAttrTokenMap; + SvXMLTokenMap* mpPathShapeAttrTokenMap; + SvXMLTokenMap* mpPolygonShapeAttrTokenMap; + + const OUString msStartShape; + const OUString msEndShape; + const OUString msStartGluePointIndex; + const OUString msEndGluePointIndex; + + rtl::Reference< XMLTableImport > mxShapeTableImport; + +protected: + SvXMLImport& mrImporter; + +public: + XMLShapeImportHelper( SvXMLImport& rImporter, + const com::sun::star::uno::Reference< com::sun::star::frame::XModel>& rModel, + SvXMLImportPropertyMapper *pExtMapper=0 ); + + ~XMLShapeImportHelper(); + + SvXMLShapeContext* CreateGroupChildContext( + SvXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLocalName, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList, + com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, + sal_Bool bTemporaryShape = sal_False); + + SvXMLShapeContext* CreateFrameChildContext( + SvXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLocalName, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList, + com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xFrameAttrList); + SvXMLImportContext* CreateFrameChildContext( + SvXMLImportContext *pThisContext, sal_uInt16 nPrefix, const OUString& rLocalName, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + SvXMLShapeContext* Create3DSceneChildContext( + SvXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLocalName, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList, + com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes); + + const SvXMLTokenMap& GetGroupShapeElemTokenMap(); + const SvXMLTokenMap& GetFrameShapeElemTokenMap(); + const SvXMLTokenMap& Get3DSceneShapeElemTokenMap(); + const SvXMLTokenMap& Get3DObjectAttrTokenMap(); + const SvXMLTokenMap& Get3DPolygonBasedAttrTokenMap(); + const SvXMLTokenMap& Get3DCubeObjectAttrTokenMap(); + const SvXMLTokenMap& Get3DSphereObjectAttrTokenMap(); + const SvXMLTokenMap& Get3DLightAttrTokenMap(); + + // Styles and AutoStyles contexts + SvXMLStylesContext* GetStylesContext() const { return mpStylesContext; } + void SetStylesContext(SvXMLStylesContext* pNew); + SvXMLStylesContext* GetAutoStylesContext() const { return mpAutoStylesContext; } + void SetAutoStylesContext(SvXMLStylesContext* pNew); + + // get factories and mappers + SvXMLImportPropertyMapper* GetPropertySetMapper() const { return mpPropertySetMapper; } + SvXMLImportPropertyMapper* GetPresPagePropsMapper() const { return mpPresPagePropsMapper; } + + // this function is called whenever the implementation classes like to add this new + // shape to the given XShapes. + virtual void addShape( + com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rShape, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList, + com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes); + + // this function is called whenever the implementation classes have finished importing + // a shape to the given XShapes. The shape is already inserted into its XShapes and + // all properties and styles are set. + virtual void finishShape( + com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rShape, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList, + com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes); + + // helper functions for z-order sorting + void pushGroupForSorting( com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes ); + void popGroupAndSort(); + + void shapeWithZIndexAdded( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rShape, + sal_Int32 nZIndex ); + + void addShapeConnection( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rConnectorShape, + sal_Bool bStart, + const OUString& rDestShapeId, + sal_Int32 nDestGlueId ); + + /** adds a mapping for a glue point identifier from an xml file to the identifier created after inserting + the new glue point into the core. The saved mappings can be retrieved by getGluePointId() */ + void addGluePointMapping( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, + sal_Int32 nSourceId, sal_Int32 nDestinnationId ); + + /** moves all current DestinationId's for rXShape by n */ + void moveGluePointMapping( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, const sal_Int32 n ); + + /** retrieves a mapping for a glue point identifier from the current xml file to the identifier created after + inserting the new glue point into the core. The mapping must be initialized first with addGluePointMapping() */ + sal_Int32 getGluePointId( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, sal_Int32 nSourceId ); + + /** this method must be calling before the first shape is imported for the given page. + Calls to this method can be nested */ + void startPage( com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes ); + + /** this method must be calling after the last shape is imported for the given page + Calls to this method can be nested */ + void endPage( com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes ); + + void restoreConnections(); + + /** creates a property mapper for external chaining */ + static SvXMLImportPropertyMapper* CreateShapePropMapper( + const com::sun::star::uno::Reference< com::sun::star::frame::XModel>& rModel, SvXMLImport& rImport ); + + // #88546# + /** defines if the import should increment the progress bar or not */ + void enableHandleProgressBar( sal_Bool bEnable = sal_True ); + sal_Bool IsHandleProgressBarEnabled() const; + + /** queries the capability of the current model to create presentation shapes */ + sal_Bool IsPresentationShapesSupported(); + + XMLSdPropHdlFactory* GetSdPropHdlFactory() const { return mpSdPropHdlFactory; } + + const rtl::Reference< XMLTableImport >& GetShapeTableImport(); +}; + +#endif // _XMLOFF_SHAPEIMPORT_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/styleexp.hxx b/include/xmloff/styleexp.hxx new file mode 100644 index 000000000000..367c6d44b402 --- /dev/null +++ b/include/xmloff/styleexp.hxx @@ -0,0 +1,127 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _XMLOFF_STYLEEXP_HXX_ +#define _XMLOFF_STYLEEXP_HXX_ + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/Reference.h> + +#include <xmloff/uniref.hxx> + +namespace com { namespace sun { namespace star +{ + namespace style + { + class XStyle; + } + namespace beans + { + class XPropertySet; + } + namespace container + { + class XNameAccess; + } + +} } } + +class XMLPropertySetMapper; +class SvXMLExportPropertyMapper; +class SvXMLAutoStylePoolP; +class SvXMLExport; + +class XMLOFF_DLLPUBLIC XMLStyleExport : public UniRefBase +{ + SvXMLExport& rExport; +protected: + const OUString sIsPhysical; + const OUString sIsAutoUpdate; + const OUString sFollowStyle; + const OUString sNumberingStyleName; + const OUString sOutlineLevel; + + SvXMLExport& GetExport() { return rExport; } + const SvXMLExport& GetExport() const { return rExport; } + +private: + + const OUString sPoolStyleName; + + SvXMLAutoStylePoolP *pAutoStylePool; + +protected: + + virtual sal_Bool exportStyle( + const ::com::sun::star::uno::Reference< + ::com::sun::star::style::XStyle > & rStyle, + const OUString& rXMLFamily, + const UniReference < SvXMLExportPropertyMapper >& rPropMapper, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & xStyles, + const OUString* pPrefix = 0L ); + + virtual void exportStyleAttributes( + const ::com::sun::star::uno::Reference< + ::com::sun::star::style::XStyle > & rStyle ); + + virtual void exportStyleContent( + const ::com::sun::star::uno::Reference< + ::com::sun::star::style::XStyle > & rStyle ); +public: + XMLStyleExport( + SvXMLExport& rExp, + const OUString& rPoolStyleName, + SvXMLAutoStylePoolP *pAutoStyleP=0 ); + virtual ~XMLStyleExport(); + +// void exportStyleFamily( +// const OUString& rFamily, const OUString& rXMLFamily, +// const UniReference < XMLPropertySetMapper >& rPropMapper, +// sal_Bool bUsed, sal_uInt16 nFamily = 0, +// const OUString* pPrefix = 0L); + +// void exportStyleFamily( +// const sal_Char *pFamily, const OUString& rXMLFamily, +// const UniReference < XMLPropertySetMapper >& rPropMapper, +// sal_Bool bUsed, sal_uInt16 nFamily = 0, +// const OUString* pPrefix = 0L); + + virtual sal_Bool exportDefaultStyle( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > & xPropSet, + const OUString& rXMLFamily, + const UniReference < SvXMLExportPropertyMapper >& rPropMapper ); + + void exportStyleFamily( + const OUString& rFamily, const OUString& rXMLFamily, + const UniReference < SvXMLExportPropertyMapper >& rPropMapper, + sal_Bool bUsed, sal_uInt16 nFamily = 0, + const OUString* pPrefix = 0L); + + void exportStyleFamily( + const sal_Char *pFamily, const OUString& rXMLFamily, + const UniReference < SvXMLExportPropertyMapper >& rPropMapper, + sal_Bool bUsed, sal_uInt16 nFamily = 0, + const OUString* pPrefix = 0L); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/table/XMLTableExport.hxx b/include/xmloff/table/XMLTableExport.hxx new file mode 100644 index 000000000000..e93c0a244a51 --- /dev/null +++ b/include/xmloff/table/XMLTableExport.hxx @@ -0,0 +1,106 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _XMLOFF_XMLTABLEEXPORT_HXX +#define _XMLOFF_XMLTABLEEXPORT_HXX + +#include "sal/config.h" + +#include <sal/types.h> +#include <rtl/ustring.hxx> +#include <rtl/ustrbuf.hxx> + +#include <boost/shared_ptr.hpp> +#include <map> +#include <vector> + +#include <com/sun/star/table/XTableColumns.hpp> +#include <com/sun/star/table/XColumnRowRange.hpp> +#include <com/sun/star/table/XCell.hpp> +#include <com/sun/star/text/XText.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> + +#include <rtl/ref.hxx> + +#include "xmloff/dllapi.h" +#include "xmloff/uniref.hxx" +#include "xmloff/xmlprmap.hxx" +#include "xmloff/xmlexppr.hxx" + + +////////////////////////////////////////////////////////////////////////////// +// predeclarations + +class SvXMLExport; +class SvXMLExportPropertyMapper; + +typedef ::std::map< const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >, OUString > TableStyleMap; + +struct XMLTableInfo +{ + TableStyleMap maColumnStyleMap; + TableStyleMap maRowStyleMap; + TableStyleMap maCellStyleMap; + std::vector< OUString > maDefaultRowCellStyles; +}; + +typedef ::std::map< const ::com::sun::star::uno::Reference< com::sun::star::table::XColumnRowRange >, boost::shared_ptr< XMLTableInfo > > TableInfoMap; + +class XMLOFF_DLLPUBLIC XMLTableExport : public UniRefBase +{ +public: + XMLTableExport(SvXMLExport& rExp, const rtl::Reference< SvXMLExportPropertyMapper >& xCellExportPropertySetMapper, const rtl::Reference< XMLPropertyHandlerFactory >& xFactoryRef ); + virtual ~XMLTableExport(); + + // This method collects all automatic styles for the given table + void collectTableAutoStyles(const com::sun::star::uno::Reference < com::sun::star::table::XColumnRowRange >& xColumnRowRange); + + // This method exports the given table + void exportTable(const com::sun::star::uno::Reference < com::sun::star::table::XColumnRowRange >& xColumnRowRange); + + // export the styles from the cell style family + void exportTableStyles(); + + // Export the collected automatic styles + void exportAutoStyles(); + +private: + void exportTableTemplates(); + + SvXMLExport& mrExport; + rtl::Reference< SvXMLExportPropertyMapper > mxCellExportPropertySetMapper; + rtl::Reference< SvXMLExportPropertyMapper > mxRowExportPropertySetMapper; + rtl::Reference< SvXMLExportPropertyMapper > mxColumnExportPropertySetMapper; + TableInfoMap maTableInfoMap; + bool mbExportTables; + +protected: + SvXMLExport& GetExport() { return mrExport; } + const SvXMLExport& GetExport() const { return mrExport; } +private: + + SAL_DLLPRIVATE void ImpExportText( const com::sun::star::uno::Reference < com::sun::star::table::XCell >& xCell ); + + void ExportCell( const com::sun::star::uno::Reference < com::sun::star::table::XCell >& xCell, const boost::shared_ptr< XMLTableInfo >& pTableInfo, const OUString& sDefaultCellStyle ); + void ExportTableColumns( const com::sun::star::uno::Reference < com::sun::star::container::XIndexAccess >& xtableColumns, const boost::shared_ptr< XMLTableInfo >& pTableInfo ); + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/table/XMLTableImport.hxx b/include/xmloff/table/XMLTableImport.hxx new file mode 100644 index 000000000000..fec6b37e0eaa --- /dev/null +++ b/include/xmloff/table/XMLTableImport.hxx @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef XMLTABLEIMPORT_HXX_ +#define XMLTABLEIMPORT_HXX_ + +#include <com/sun/star/table/XColumnRowRange.hpp> + +#include "xmloff/dllapi.h" +#include "xmloff/xmlictxt.hxx" +#include "xmloff/uniref.hxx" +#include "xmloff/xmlimppr.hxx" +#include "xmloff/prhdlfac.hxx" + +#include <rtl/ref.hxx> + +#include <boost/shared_ptr.hpp> +#include <map> + +class SvXMLStyleContext; + +typedef std::map< OUString, OUString > XMLTableTemplate; +typedef std::map < OUString, boost::shared_ptr< XMLTableTemplate > > XMLTableTemplateMap; + +class XMLTableImport : public UniRefBase +{ + friend class XMLTableImportContext; + +public: + XMLTableImport( SvXMLImport& rImport, const rtl::Reference< XMLPropertySetMapper >& xCellPropertySetMapper, const rtl::Reference< XMLPropertyHandlerFactory >& xFactoryRef ); + virtual ~XMLTableImport(); + + SvXMLImportContext* CreateTableContext( sal_uInt16 nPrfx, const OUString& rLName, + ::com::sun::star::uno::Reference< ::com::sun::star::table::XColumnRowRange >& xColumnRowRange ); + + SvXMLStyleContext* CreateTableTemplateContext( sal_uInt16 nPrfx, const OUString& rLName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + rtl::Reference< SvXMLImportPropertyMapper > GetCellImportPropertySetMapper() const { return mxCellImportPropertySetMapper; } + rtl::Reference< SvXMLImportPropertyMapper > GetRowImportPropertySetMapper() const { return mxRowImportPropertySetMapper; } + rtl::Reference< SvXMLImportPropertyMapper > GetColumnImportPropertySetMapper() const { return mxColumnImportPropertySetMapper; } + + void addTableTemplate( const OUString& rsStyleName, XMLTableTemplate& xTableTemplate ); + void finishStyles(); + +private: + SvXMLImport& mrImport; + rtl::Reference< SvXMLImportPropertyMapper > mxCellImportPropertySetMapper; + rtl::Reference< SvXMLImportPropertyMapper > mxRowImportPropertySetMapper; + rtl::Reference< SvXMLImportPropertyMapper > mxColumnImportPropertySetMapper; + + XMLTableTemplateMap maTableTemplates; +}; + +#endif /*XMLTABLEIMPORT_HXX_*/ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/txtimp.hxx b/include/xmloff/txtimp.hxx new file mode 100644 index 000000000000..2ac668de2d5a --- /dev/null +++ b/include/xmloff/txtimp.hxx @@ -0,0 +1,725 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef XMLOFF_TEXTIMP_HXX +#define XMLOFF_TEXTIMP_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include "sal/types.h" +#include <com/sun/star/uno/Reference.h> + +#include <map> +#include <boost/utility.hpp> +#include <boost/shared_ptr.hpp> +#include <boost/scoped_ptr.hpp> + +#include <xmloff/xmltkmap.hxx> +#include <comphelper/stl_types.hxx> +#include <xmloff/uniref.hxx> + +class XMLTextListsHelper; +class SvXMLImportContext; +class SvXMLTokenMap; +class SvXMLImportPropertyMapper; +class SvXMLNamespaceMap; +class SvXMLImport; +class SvXMLStylesContext; +class XMLTextListBlockContext; +class SvxXMLListStyleContext; +class XMLPropStyleContext; +class SvI18NMap; +class XMLSectionImportContext; +class XMLFontStylesContext; +template<class A> class XMLPropertyBackpatcher; +class XMLEventsImportContext; + +namespace xmloff { + struct ParsedRDFaAttributes; +} + +namespace com { namespace sun { namespace star { +namespace text { + class XText; + class XTextCursor; + class XTextRange; + class XTextContent; + class XFormField; +} +namespace frame { class XModel; } +namespace container { class XNameContainer; class XIndexReplace; class XNameAccess; } +namespace beans { class XPropertySet; } +namespace xml { namespace sax { class XAttributeList; } } +namespace util { struct DateTime; } +namespace lang { class XMultiServiceFactory; } +} } } + +enum SwXMLTextElemTokens +{ + XML_TOK_TEXT_P, + XML_TOK_TEXT_H, + XML_TOK_TEXT_LIST, + XML_TOK_TEXT_FRAME_PAGE, + XML_TOK_TABLE_TABLE, + XML_TOK_TEXT_VARFIELD_DECLS, + XML_TOK_TEXT_USERFIELD_DECLS, + XML_TOK_TEXT_SEQUENCE_DECLS, + XML_TOK_TEXT_DDE_DECLS, + XML_TOK_DRAW_A_PAGE, + XML_TOK_TEXT_SECTION, + XML_TOK_TEXT_TOC, + XML_TOK_TEXT_OBJECT_INDEX, + XML_TOK_TEXT_TABLE_INDEX, + XML_TOK_TEXT_ILLUSTRATION_INDEX, + XML_TOK_TEXT_USER_INDEX, + XML_TOK_TEXT_ALPHABETICAL_INDEX, + XML_TOK_TEXT_BIBLIOGRAPHY_INDEX, + XML_TOK_TEXT_INDEX_TITLE, + XML_TOK_TEXT_TRACKED_CHANGES, + XML_TOK_TEXT_CHANGE_START, + XML_TOK_TEXT_CHANGE_END, + XML_TOK_TEXT_CHANGE, + XML_TOK_TEXT_FORMS, + XML_TOK_TEXT_CALCULATION_SETTINGS, + XML_TOK_TEXT_AUTOMARK, + XML_TOK_TEXT_NUMBERED_PARAGRAPH, + XML_TOK_TEXT_ELEM_END=XML_TOK_UNKNOWN +}; + +enum XMLTextPElemTokens +{ + XML_TOK_TEXT_SPAN, + XML_TOK_TEXT_TAB_STOP, + XML_TOK_TEXT_LINE_BREAK, + XML_TOK_TEXT_SOFT_PAGE_BREAK, + XML_TOK_TEXT_S, + XML_TOK_TEXT_FRAME, + XML_TOK_TEXT_HYPERLINK, + XML_TOK_TEXT_RUBY, + + XML_TOK_TEXT_NOTE, + XML_TOK_TEXT_BOOKMARK, + XML_TOK_TEXT_BOOKMARK_START, + XML_TOK_TEXT_BOOKMARK_END, + XML_TOK_TEXT_REFERENCE, + XML_TOK_TEXT_REFERENCE_START, + XML_TOK_TEXT_REFERENCE_END, + + XML_TOK_TEXT_TOC_MARK, // index marks + XML_TOK_TEXT_TOC_MARK_START, + XML_TOK_TEXT_TOC_MARK_END, + XML_TOK_TEXT_USER_INDEX_MARK, + XML_TOK_TEXT_USER_INDEX_MARK_START, + XML_TOK_TEXT_USER_INDEX_MARK_END, + XML_TOK_TEXT_ALPHA_INDEX_MARK, + XML_TOK_TEXT_ALPHA_INDEX_MARK_START, + XML_TOK_TEXT_ALPHA_INDEX_MARK_END, + + XML_TOK_TEXT_SENDER_FIRSTNAME, // sender fields + XML_TOK_TEXT_SENDER_LASTNAME, + XML_TOK_TEXT_SENDER_INITIALS, + XML_TOK_TEXT_SENDER_TITLE, + XML_TOK_TEXT_SENDER_POSITION, + XML_TOK_TEXT_SENDER_EMAIL, + XML_TOK_TEXT_SENDER_PHONE_PRIVATE, + XML_TOK_TEXT_SENDER_FAX, + XML_TOK_TEXT_SENDER_COMPANY, + XML_TOK_TEXT_SENDER_PHONE_WORK, + XML_TOK_TEXT_SENDER_STREET, + XML_TOK_TEXT_SENDER_CITY, + XML_TOK_TEXT_SENDER_POSTAL_CODE, + XML_TOK_TEXT_SENDER_COUNTRY, + XML_TOK_TEXT_SENDER_STATE_OR_PROVINCE, + + XML_TOK_TEXT_AUTHOR_NAME, // author fields + XML_TOK_TEXT_AUTHOR_INITIALS, + + XML_TOK_TEXT_DATE, // date & time fields + XML_TOK_TEXT_TIME, + + XML_TOK_TEXT_PAGE_NUMBER, // page number fields + XML_TOK_TEXT_PAGE_CONTINUATION_STRING, + + XML_TOK_TEXT_VARIABLE_SET, // variable fields + XML_TOK_TEXT_VARIABLE_GET, + XML_TOK_TEXT_VARIABLE_INPUT, + XML_TOK_TEXT_USER_FIELD_GET, + XML_TOK_TEXT_USER_FIELD_INPUT, + XML_TOK_TEXT_SEQUENCE, + XML_TOK_TEXT_EXPRESSION, + XML_TOK_TEXT_TEXT_INPUT, + + XML_TOK_TEXT_DATABASE_DISPLAY, // database fields + XML_TOK_TEXT_DATABASE_NEXT, + XML_TOK_TEXT_DATABASE_SELECT, + XML_TOK_TEXT_DATABASE_ROW_NUMBER, + XML_TOK_TEXT_DATABASE_NAME, + + XML_TOK_TEXT_DOCUMENT_CREATION_AUTHOR, //document info fields + XML_TOK_TEXT_DOCUMENT_CREATION_DATE, + XML_TOK_TEXT_DOCUMENT_CREATION_TIME, + XML_TOK_TEXT_DOCUMENT_DESCRIPTION, + XML_TOK_TEXT_DOCUMENT_PRINT_AUTHOR, + XML_TOK_TEXT_DOCUMENT_PRINT_DATE, + XML_TOK_TEXT_DOCUMENT_PRINT_TIME, + XML_TOK_TEXT_DOCUMENT_TITLE, + XML_TOK_TEXT_DOCUMENT_SUBJECT, + XML_TOK_TEXT_DOCUMENT_KEYWORDS, + XML_TOK_TEXT_DOCUMENT_REVISION, + XML_TOK_TEXT_DOCUMENT_EDIT_DURATION, + XML_TOK_TEXT_DOCUMENT_SAVE_AUTHOR, + XML_TOK_TEXT_DOCUMENT_SAVE_DATE, + XML_TOK_TEXT_DOCUMENT_SAVE_TIME, + XML_TOK_TEXT_DOCUMENT_USER_DEFINED, + + XML_TOK_TEXT_PLACEHOLDER, // misc. fields + XML_TOK_TEXT_CONDITIONAL_TEXT, + XML_TOK_TEXT_HIDDEN_TEXT, + XML_TOK_TEXT_HIDDEN_PARAGRAPH, + XML_TOK_TEXT_FILENAME, + XML_TOK_TEXT_CHAPTER, + XML_TOK_TEXT_TEMPLATENAME, + XML_TOK_TEXT_WORD_COUNT, // statistics/count fields + XML_TOK_TEXT_PARAGRAPH_COUNT, + XML_TOK_TEXT_TABLE_COUNT, + XML_TOK_TEXT_CHARACTER_COUNT, + XML_TOK_TEXT_IMAGE_COUNT, + XML_TOK_TEXT_OBJECT_COUNT, + XML_TOK_TEXT_PAGE_COUNT, + XML_TOK_TEXT_GET_PAGE_VAR, + XML_TOK_TEXT_SET_PAGE_VAR, + XML_TOK_TEXT_MACRO, + XML_TOK_TEXT_DDE, + XML_TOK_TEXT_REFERENCE_REF, + XML_TOK_TEXT_BOOKMARK_REF, + XML_TOK_TEXT_SEQUENCE_REF, + XML_TOK_TEXT_NOTE_REF, + XML_TOK_TEXT_SHEET_NAME, + XML_TOK_TEXT_BIBLIOGRAPHY_MARK, + XML_TOK_TEXT_ANNOTATION, + XML_TOK_TEXT_ANNOTATION_END, + XML_TOK_TEXT_NAME, + XML_TOK_TEXT_SCRIPT, + XML_TOK_TEXT_TABLE_FORMULA, + XML_TOK_TEXT_DROPDOWN, + + // RDF metadata + XML_TOK_TEXT_META, + XML_TOK_TEXT_META_FIELD, + + // misc + XML_TOK_TEXTP_CHANGE_START, // TEXTP avoids clash with SwXMLTextElemTokens + XML_TOK_TEXTP_CHANGE_END, + XML_TOK_TEXTP_CHANGE, + XML_TOK_DRAW_A, + XML_TOK_TEXT_MEASURE, + + XML_TOK_DRAW_HEADER, + XML_TOK_DRAW_FOOTER, + XML_TOK_DRAW_DATE_TIME, + XML_TOK_TEXT_PAGE_CONTINUATION, + + XML_TOK_TEXT_FIELDMARK, + XML_TOK_TEXT_FIELDMARK_START, + XML_TOK_TEXT_FIELDMARK_END, + + XML_TOK_TEXT_P_ELEM_END=XML_TOK_UNKNOWN +}; + +enum XMLTextPAttrTokens +{ + XML_TOK_TEXT_P_XMLID, + XML_TOK_TEXT_P_ABOUT, + XML_TOK_TEXT_P_PROPERTY, + XML_TOK_TEXT_P_CONTENT, + XML_TOK_TEXT_P_DATATYPE, + XML_TOK_TEXT_P_TEXTID, + XML_TOK_TEXT_P_STYLE_NAME, + XML_TOK_TEXT_P_COND_STYLE_NAME, + XML_TOK_TEXT_P_LEVEL, + XML_TOK_TEXT_P_CLASS_NAMES, + XML_TOK_TEXT_P_IS_LIST_HEADER, + XML_TOK_TEXT_P_RESTART_NUMBERING, + XML_TOK_TEXT_P_START_VALUE, + XML_TOK_TEXT_P_END=XML_TOK_UNKNOWN +}; + +enum XMLTextNumberedParagraphAttrTokens +{ + XML_TOK_TEXT_NUMBERED_PARAGRAPH_XMLID, + XML_TOK_TEXT_NUMBERED_PARAGRAPH_LIST_ID, + XML_TOK_TEXT_NUMBERED_PARAGRAPH_LEVEL, + XML_TOK_TEXT_NUMBERED_PARAGRAPH_STYLE_NAME, + XML_TOK_TEXT_NUMBERED_PARAGRAPH_CONTINUE_NUMBERING, + XML_TOK_TEXT_NUMBERED_PARAGRAPH_START_VALUE, + XML_TOK_TEXT_NUMBERED_PARAGRAPH_END=XML_TOK_UNKNOWN +}; + +enum XMLTextListBlockAttrTokens +{ + XML_TOK_TEXT_LIST_BLOCK_XMLID, + XML_TOK_TEXT_LIST_BLOCK_STYLE_NAME, + XML_TOK_TEXT_LIST_BLOCK_CONTINUE_NUMBERING, + XML_TOK_TEXT_LIST_BLOCK_ID, + XML_TOK_TEXT_LIST_BLOCK_CONTINUE_LIST, + XML_TOK_TEXT_LIST_BLOCK_END=XML_TOK_UNKNOWN +}; + +enum XMLTextListBlockElemTokens +{ + XML_TOK_TEXT_LIST_HEADER, + XML_TOK_TEXT_LIST_ITEM, + XML_TOK_TEXT_LIST_BLOCK_ELEM_END=XML_TOK_UNKNOWN +}; + +enum XMLTextFrameAttrTokens +{ + XML_TOK_TEXT_FRAME_STYLE_NAME, + XML_TOK_TEXT_FRAME_NAME, + XML_TOK_TEXT_FRAME_ANCHOR_TYPE, + XML_TOK_TEXT_FRAME_ANCHOR_PAGE_NUMBER, + XML_TOK_TEXT_FRAME_X, + XML_TOK_TEXT_FRAME_Y, + XML_TOK_TEXT_FRAME_WIDTH, + XML_TOK_TEXT_FRAME_REL_WIDTH, + XML_TOK_TEXT_FRAME_HEIGHT, + XML_TOK_TEXT_FRAME_MIN_HEIGHT, + XML_TOK_TEXT_FRAME_REL_HEIGHT, + XML_TOK_TEXT_FRAME_NEXT_CHAIN_NAME, + XML_TOK_TEXT_FRAME_HREF, + XML_TOK_TEXT_FRAME_FILTER_NAME, + XML_TOK_TEXT_FRAME_Z_INDEX, + XML_TOK_TEXT_FRAME_TRANSFORM, + XML_TOK_TEXT_FRAME_CLASS_ID, + XML_TOK_TEXT_FRAME_CODE, + XML_TOK_TEXT_FRAME_OBJECT, + XML_TOK_TEXT_FRAME_ARCHIVE, + XML_TOK_TEXT_FRAME_MAY_SCRIPT, + XML_TOK_TEXT_FRAME_MIME_TYPE, + XML_TOK_TEXT_FRAME_APPLET_NAME, + XML_TOK_TEXT_FRAME_FRAME_NAME, + XML_TOK_TEXT_FRAME_NOTIFY_ON_UPDATE, + XML_TOK_TEXT_FRAME_MIN_WIDTH, + XML_TOK_TEXT_FRAME_END=XML_TOK_UNKNOWN +}; + +enum XMLTextHyperlinkAttrTokens +{ + XML_TOK_TEXT_HYPERLINK_HREF, + XML_TOK_TEXT_HYPERLINK_NAME, + XML_TOK_TEXT_HYPERLINK_TARGET_FRAME, + XML_TOK_TEXT_HYPERLINK_SHOW, + XML_TOK_TEXT_HYPERLINK_STYLE_NAME, + XML_TOK_TEXT_HYPERLINK_VIS_STYLE_NAME, + XML_TOK_TEXT_HYPERLINK_SERVER_MAP, + XML_TOK_TEXT_HYPERLINK_END=XML_TOK_UNKNOWN +}; + +enum XMLTextPageMasterElemTokens +{ + XML_TOK_TEXT_MP_HEADER, + XML_TOK_TEXT_MP_FOOTER, + XML_TOK_TEXT_MP_HEADER_LEFT, + XML_TOK_TEXT_MP_FOOTER_LEFT, + XML_TOK_TEXT_MP_HEADER_FIRST, + XML_TOK_TEXT_MP_FOOTER_FIRST, + XML_TOK_TEXT_MP_END=XML_TOK_UNKNOWN +}; + +enum XMLTextContourAttrTokens +{ + XML_TOK_TEXT_CONTOUR_WIDTH, + XML_TOK_TEXT_CONTOUR_HEIGHT, + XML_TOK_TEXT_CONTOUR_VIEWBOX, + XML_TOK_TEXT_CONTOUR_POINTS, + XML_TOK_TEXT_CONTOUR_D, + XML_TOK_TEXT_CONTOUR_AUTO, + XML_TOK_TEXT_CONTOUR_END=XML_TOK_UNKNOWN +}; +enum XMLTextType +{ + XML_TEXT_TYPE_BODY, + XML_TEXT_TYPE_CELL, + XML_TEXT_TYPE_SHAPE, + XML_TEXT_TYPE_TEXTBOX, + XML_TEXT_TYPE_HEADER_FOOTER, + XML_TEXT_TYPE_SECTION, + XML_TEXT_TYPE_FOOTNOTE, + XML_TEXT_TYPE_CHANGED_REGION +}; + +#define XML_TEXT_RENAME_TYPE_FRAME 10 +#define XML_TEXT_RENAME_TYPE_TABLE 20 + +class XMLOFF_DLLPUBLIC XMLTextImportHelper : public UniRefBase, + private boost::noncopyable +{ +private: + struct Impl; + boost::scoped_ptr<Impl> m_pImpl; + /// ugly, but implementation of this is in XMLPropertyBackpatcher.cxx + struct BackpatcherImpl; + ::boost::shared_ptr<BackpatcherImpl> m_pBackpatcherImpl; + ::boost::shared_ptr<BackpatcherImpl> MakeBackpatcherImpl(); + +protected: + virtual SvXMLImportContext *CreateTableChildContext( + SvXMLImport& rImport, + sal_uInt16 nPrefix, const OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + + // access, lazy initialization and destruction of backpatchers + // Code is implemented in XMLPropertyBackpatcher.cxx + inline XMLPropertyBackpatcher<sal_Int16>& GetFootnoteBP(); + inline XMLPropertyBackpatcher<sal_Int16>& GetSequenceIdBP(); + inline XMLPropertyBackpatcher< OUString> & GetSequenceNameBP(); + +public: + + XMLTextImportHelper( + ::com::sun::star::uno::Reference < + ::com::sun::star::frame::XModel> const& rModel, + SvXMLImport& rImport, + bool const bInsertMode = false, bool const bStylesOnlyMode = false, + bool const bProgress = false, bool const bBlockMode = false, + bool const bOrganizerMode = false); + + ~XMLTextImportHelper(); + + void SetCursor( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextCursor >& rCursor ); + void ResetCursor(); + + void SetAutoStyles( SvXMLStylesContext *pStyles ); + + void SetFontDecls( XMLFontStylesContext *pFontDecls ); + const XMLFontStylesContext *GetFontDecls() const; + + SvXMLImportContext *CreateTextChildContext( + SvXMLImport& rImport, + sal_uInt16 nPrefix, const OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList, + XMLTextType eType = XML_TEXT_TYPE_SHAPE ); + + SvXMLTokenMap const& GetTextElemTokenMap(); + SvXMLTokenMap const& GetTextPElemTokenMap(); + SvXMLTokenMap const& GetTextPAttrTokenMap(); + SvXMLTokenMap const& GetTextFrameAttrTokenMap(); + SvXMLTokenMap const& GetTextContourAttrTokenMap(); + SvXMLTokenMap const& GetTextHyperlinkAttrTokenMap(); + SvXMLTokenMap const& GetTextMasterPageElemTokenMap(); + + const SvXMLTokenMap& GetTextNumberedParagraphAttrTokenMap(); + const SvXMLTokenMap& GetTextListBlockAttrTokenMap(); + const SvXMLTokenMap& GetTextListBlockElemTokenMap(); + const SvXMLTokenMap& GetTextFieldAttrTokenMap(); // impl: txtfldi.cxx + + ::com::sun::star::uno::Reference< + ::com::sun::star::text::XText > & GetText(); + ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextCursor > & GetCursor(); + ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange > & GetCursorAsRange(); + + bool IsInsertMode() const; + bool IsStylesOnlyMode() const; + bool IsBlockMode() const; + bool IsOrganizerMode() const; + bool IsProgress() const; + + OUString ConvertStarFonts( const OUString& rChars, + const OUString& rStyleName, + sal_uInt8& rFlags, + sal_Bool bPara, + SvXMLImport& rImport ) const; + // insert a string without special whitespace processing enabled + void InsertString( const OUString& rChars ); + // insert a string with special whitespace processing enabled + void InsertString( const OUString& rChars, + sal_Bool& rIgnoreLeadingSpace ); + // Delete current paragraph + void DeleteParagraph(); + + void InsertControlCharacter( sal_Int16 nControl ); + void InsertTextContent( ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextContent > & xContent); + + // Add parameter <bOutlineLevelAttrFound> (#i73509#) + // Add parameter <bSetListAttrs> in order to suppress the handling of the list attributes (#i80724#) + OUString SetStyleAndAttrs( + SvXMLImport& rImport, + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextCursor >& rCursor, + const OUString& rStyleName, + sal_Bool bPara, + sal_Bool bOutlineLevelAttrFound = sal_False, + sal_Int8 nOutlineLevel = -1, + sal_Bool bSetListAttrs = sal_True ); + + /** Find a suitable name for the given outline level. + * If rStyleName is empty, change it to a previously used or default style + * name for that level. Otherwise, leave rStyleName unmodified. + */ + // Adjust 2nd parameter (#i69629#) + void FindOutlineStyleName( OUString& rStyleName, + sal_Int8 nOutlineLevel ); + + // Change method name to reflect change of data structure (#i69629#) + void AddOutlineStyleCandidate( const sal_Int8 nOutlineLevel, + const OUString& rStyleName ); + + void SetOutlineStyles( sal_Bool bSetEmpty ); + + void SetHyperlink( + SvXMLImport& rImport, + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextCursor >& rCursor, + const OUString& rHRef, + const OUString& rName, + const OUString& rTargetFrameName, + const OUString& rStyleName, + const OUString& rVisitedStyleName, + XMLEventsImportContext* pEvents = NULL); + void SetRuby( + SvXMLImport& rImport, + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextCursor >& rCursor, + const OUString& rStyleName, + const OUString& rTextStyleName, + const OUString& rText ); + + /// return key appropriate for use with NumberFormat property + /// return -1 if style is not found + /// (may return whether data style uses the system language) + sal_Int32 GetDataStyleKey( const OUString& sStyleName, + sal_Bool* pIsSystemLanguage = NULL ); + + const SvxXMLListStyleContext *FindAutoListStyle( + const OUString& rName ) const; + XMLPropStyleContext *FindAutoFrameStyle( + const OUString& rName ) const; + XMLPropStyleContext* FindSectionStyle( + const OUString& rName ) const; + XMLPropStyleContext* FindPageMaster( + const OUString& rName ) const; + + const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XNameContainer> & GetParaStyles() const; + + const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XNameContainer> & GetTextStyles() const; + + const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XNameContainer> & + GetNumberingStyles() const; + + const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XNameContainer> & GetFrameStyles() const; + + const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XNameContainer> & GetPageStyles() const; + + const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XIndexReplace > & + GetChapterNumbering() const; + + sal_Bool HasFrameByName( const OUString& rName ) const; + void ConnectFrameChains( const OUString& rFrmName, + const OUString& rNextFrmName, + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet >& rFrmPropSet ); + + UniReference< SvXMLImportPropertyMapper > const& + GetParaImportPropertySetMapper() const; + UniReference< SvXMLImportPropertyMapper > const& + GetTextImportPropertySetMapper() const; + UniReference< SvXMLImportPropertyMapper > const& + GetSectionImportPropertySetMapper() const; + UniReference< SvXMLImportPropertyMapper > const& + GetRubyImportPropertySetMapper() const; + + static SvXMLImportPropertyMapper *CreateShapeExtPropMapper(SvXMLImport&); + static SvXMLImportPropertyMapper *CreateParaExtPropMapper(SvXMLImport&, XMLFontStylesContext *pFontDecls = NULL); + static SvXMLImportPropertyMapper* CreateParaDefaultExtPropMapper(SvXMLImport&, XMLFontStylesContext* pFontDecls = NULL); + static SvXMLImportPropertyMapper* CreateTableDefaultExtPropMapper(SvXMLImport&, XMLFontStylesContext* pFontDecls = NULL); + static SvXMLImportPropertyMapper* CreateTableRowDefaultExtPropMapper(SvXMLImport&, XMLFontStylesContext* pFontDecls = NULL); + + SvI18NMap& GetRenameMap(); + + /// save the start of a range reference + void InsertBookmarkStartRange( + const OUString & sName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange> & rRange, + OUString const& i_rXmlId, + ::boost::shared_ptr< ::xmloff::ParsedRDFaAttributes > & + i_rpRDFaAttributes); + + /// process the start of a range reference + sal_Bool FindAndRemoveBookmarkStartRange( + const OUString & sName, + ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange> & o_rRange, + OUString & o_rXmlId, + ::boost::shared_ptr< ::xmloff::ParsedRDFaAttributes > & + o_rpRDFaAttributes); + + OUString FindActiveBookmarkName(); + + void pushFieldCtx( OUString name, OUString type ); + void popFieldCtx(); + void addFieldParam( OUString name, OUString value ); + void setCurrentFieldParamsTo(::com::sun::star::uno::Reference< ::com::sun::star::text::XFormField> &xFormField); + OUString getCurrentFieldType(); + bool hasCurrentFieldCtx(); + + + /// insert new footnote ID. + /// Also fixup open references from the backpatch list to this ID. + // Code is implemented in XMLPropertyBackpatcher.cxx + void InsertFootnoteID(const OUString& sXMLId, sal_Int16 nAPIId); + + /// set the proper footnote reference ID, + /// or put into backpatch list if ID is unknown + // Code is implemented in XMLPropertyBackpatcher.cxx + void ProcessFootnoteReference( + const OUString& sXMLId, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> & xPropSet); + + /// insert new sequence ID + /// Also fixup open references from backpatch list to this ID. + // Code is implemented in XMLPropertyBackpatcher.cxx + void InsertSequenceID(const OUString& sXMLId, + const OUString& sName, + sal_Int16 nAPIId); + + /// set sequence ID or insert into backpatch list + // Code is implemented in XMLPropertyBackpatcher.cxx + void ProcessSequenceReference( + const OUString& sXMLId, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> & xPropSet); + + sal_Bool IsInFrame() const; + virtual sal_Bool IsInHeaderFooter() const; + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> + createAndInsertOLEObject( SvXMLImport& rImport, + const OUString& rHRef, + const OUString &rStyleName, + const OUString &rTblName, + sal_Int32 nWidth, sal_Int32 nHeight ); + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> + createAndInsertOOoLink( SvXMLImport& rImport, + const OUString& rHRef, + const OUString &rStyleName, + const OUString &rTblName, + sal_Int32 nWidth, sal_Int32 nHeight ); + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> + createAndInsertApplet( + const OUString &rName, + const OUString &rCode, + sal_Bool bMayScript, + const OUString& rHRef, + sal_Int32 nWidth, sal_Int32 nHeight ); + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> + createAndInsertPlugin( + const OUString &rMimeType, + const OUString& rHRef, + sal_Int32 nWidth, sal_Int32 nHeight ); + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> + createAndInsertFloatingFrame( + const OUString &rName, + const OUString &rHRef, + const OUString &rStyleName, + sal_Int32 nWidth, sal_Int32 nHeight ); + + virtual void endAppletOrPlugin( + const com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> &rPropSet, + ::std::map < const OUString, OUString, ::comphelper::UStringLess > &rParamMap ); + + // applet helper methods + // implemented in sw/filter/xml/txtparai.hxx + + // redlining helper methods + // (to be implemented in sw/filter/xml/txtparai.hxx) + + virtual void RedlineAdd( + const OUString& rType, /// redline type (insert, del,... ) + const OUString& rId, /// use to identify this redline + const OUString& rAuthor, /// name of the author + const OUString& rComment, /// redline comment + const ::com::sun::star::util::DateTime& rDateTime, /// date+time + sal_Bool bMergeLastParagraph); /// merge last paras + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextCursor> RedlineCreateText( + ::com::sun::star::uno::Reference< /// needed to get the document + ::com::sun::star::text::XTextCursor> & rOldCursor, + const OUString& rId); /// ID used to RedlineAdd() call + virtual void RedlineSetCursor( + const OUString& rId, /// ID used to RedlineAdd() call + sal_Bool bStart, /// start or end Cursor + sal_Bool bIsOutsideOfParagraph); /// range is not within <text:p> + virtual void RedlineAdjustStartNodeCursor( + sal_Bool bStart); + virtual void SetShowChanges( sal_Bool bShowChanges ); + virtual void SetRecordChanges( sal_Bool bRecordChanges ); + virtual void SetChangesProtectionKey( + const ::com::sun::star::uno::Sequence<sal_Int8> & rProtectionKey ); + + // access to the last open redline ID: + OUString GetOpenRedlineId(); + void SetOpenRedlineId( OUString& rId); + void ResetOpenRedlineId(); + + // #107848# + // Access methods to the inside_deleted_section flag (redlining) + void SetInsideDeleteContext(bool const bNew); + bool IsInsideDeleteContext() const; + + SvXMLImport & GetXMLImport(); + + XMLTextListsHelper & GetTextListHelper(); + + // forwards to TextListHelper; these are used in many places + /// push a list context on the list context stack + void PushListContext(XMLTextListBlockContext *i_pListBlock = 0); + /// pop the list context stack + void PopListContext(); + + void SetCellParaStyleDefault(OUString const& rNewValue); + OUString const& GetCellParaStyleDefault(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/txtimppr.hxx b/include/xmloff/txtimppr.hxx new file mode 100644 index 000000000000..ae58bdd9f55e --- /dev/null +++ b/include/xmloff/txtimppr.hxx @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _XMLOFF_TXTIMPPR_HXX +#define _XMLOFF_TXTIMPPR_HXX + +#include "xmloff/dllapi.h" +#include <xmloff/xmlimppr.hxx> + +class XMLFontStylesContext; + +class XMLOFF_DLLPUBLIC XMLTextImportPropertyMapper : public SvXMLImportPropertyMapper +{ + sal_Int32 nSizeTypeIndex; + sal_Int32 nWidthTypeIndex; + SvXMLImportContextRef xFontDecls; + + void FontFinished( + XMLPropertyState *pFontFamilyNameState, + XMLPropertyState *pFontStyleNameState, + XMLPropertyState *pFontFamilyState, + XMLPropertyState *pFontPitchState, + XMLPropertyState *pFontCharsetState ) const; + + void FontDefaultsCheck( + XMLPropertyState*pFontFamilyName, + XMLPropertyState* pFontStyleName, + XMLPropertyState* pFontFamily, + XMLPropertyState* pFontPitch, + XMLPropertyState* pFontCharSet, + XMLPropertyState** ppNewFontStyleName, + XMLPropertyState** ppNewFontFamily, + XMLPropertyState** ppNewFontPitch, + XMLPropertyState** ppNewFontCharSet ) const; + +protected: + virtual bool handleSpecialItem( + XMLPropertyState& rProperty, + ::std::vector< XMLPropertyState >& rProperties, + const OUString& rValue, + const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap ) const; +public: + XMLTextImportPropertyMapper( + const UniReference< XMLPropertySetMapper >& rMapper, + SvXMLImport& rImport, + XMLFontStylesContext *pFontDecls = 0 ); + virtual ~XMLTextImportPropertyMapper(); + + void SetFontDecls( XMLFontStylesContext *pFontDecls ); + + /** This method is called when all attributes have benn processed. It may be used to remove items that are incomplete */ + virtual void finished( + ::std::vector< XMLPropertyState >& rProperties, + sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const; +}; + +#endif // _XMLOFF_XMLIMPPR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/txtparae.hxx b/include/xmloff/txtparae.hxx new file mode 100644 index 000000000000..8e432e8cf7d7 --- /dev/null +++ b/include/xmloff/txtparae.hxx @@ -0,0 +1,728 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_TEXTPARAE_HXX_ +#define _XMLOFF_TEXTPARAE_HXX_ + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <xmloff/uniref.hxx> +#include <xmloff/xmlexppr.hxx> +#include <xmloff/styleexp.hxx> +#include <xmloff/xmltoken.hxx> +#include <xmloff/SinglePropertySetInfoCache.hxx> +#include <xmloff/XMLStringVector.hxx> +#include <vector> +#include <boost/scoped_ptr.hpp> + +class XMLTextListsHelper; +class SvXMLExport; +class SvXMLAutoStylePoolP; +class XMLTextFieldExport; +class XMLTextNumRuleInfo; +class XMLTextListAutoStylePool; +class XMLSectionExport; +class XMLIndexMarkExport; +class XMLRedlineExport; +struct XMLPropertyState; +class MultiPropertySetHelper; + +namespace com { namespace sun { namespace star +{ + namespace beans { class XPropertySet; class XPropertyState; + class XPropertySetInfo; } + namespace container { class XEnumerationAccess; class XEnumeration; class XIndexAccess; } + namespace text { class XTextContent; class XTextRange; class XText; + class XFootnote; class XTextFrame; class XTextSection; + class XTextField; + class XDocumentIndex; class XTextShapesSupplier; } +} } } + +namespace xmloff +{ + class OFormLayerXMLExport; + class BoundFrameSets; +} + +class XMLOFF_DLLPUBLIC XMLTextParagraphExport : public XMLStyleExport +{ + struct Impl; + ::boost::scoped_ptr<Impl> m_pImpl; + +// SvXMLExport& rExport; + SvXMLAutoStylePoolP& rAutoStylePool; + UniReference < SvXMLExportPropertyMapper > xParaPropMapper; + UniReference < SvXMLExportPropertyMapper > xTextPropMapper; + UniReference < SvXMLExportPropertyMapper > xFramePropMapper; + UniReference < SvXMLExportPropertyMapper > xAutoFramePropMapper; + UniReference < SvXMLExportPropertyMapper > xSectionPropMapper; + UniReference < SvXMLExportPropertyMapper > xRubyPropMapper; + + const ::std::auto_ptr< ::xmloff::BoundFrameSets > pBoundFrameSets; + XMLTextFieldExport *pFieldExport; + std::vector<OUString> *pListElements; + XMLTextListAutoStylePool *pListAutoPool; + XMLSectionExport *pSectionExport; + XMLIndexMarkExport *pIndexMarkExport; + + /// may be NULL (if no redlines should be exported; e.g. in block mode) + XMLRedlineExport *pRedlineExport; + XMLStringVector *pHeadingStyles; + + sal_Bool bProgress; + + sal_Bool bBlock; + + // keep track of open rubies + OUString sOpenRubyText; + OUString sOpenRubyCharStyle; + sal_Bool bOpenRuby; + + XMLTextListsHelper* mpTextListsHelper; + ::std::vector< XMLTextListsHelper* > maTextListsHelperStack; + + enum FrameType { FT_TEXT, FT_GRAPHIC, FT_EMBEDDED, FT_SHAPE }; +public: + + enum FieldmarkType { NONE, TEXT, CHECK }; // Used for simulating fieldmarks in OpenDocument 1.n Strict (for n <= 2). CHECK currently ignored. + +protected: + + const OUString sActualSize; + // Implement Title/Description Elements UI (#i73249#) + const OUString sTitle; + const OUString sDescription; + const OUString sAnchorCharStyleName; + const OUString sAnchorPageNo; + const OUString sAnchorType; + const OUString sBeginNotice; + const OUString sBookmark; + const OUString sCategory; + const OUString sChainNextName; + const OUString sCharStyleName; + const OUString sCharStyleNames; + const OUString sContourPolyPolygon; + const OUString sDocumentIndex; + const OUString sDocumentIndexMark; + const OUString sEndNotice; + const OUString sFootnote; + const OUString sFootnoteCounting; + const OUString sFrame; + const OUString sFrameHeightAbsolute; + const OUString sFrameHeightPercent; + const OUString sFrameStyleName; + const OUString sFrameWidthAbsolute; + const OUString sFrameWidthPercent; + const OUString sGraphicFilter; + const OUString sGraphicRotation; + const OUString sGraphicURL; + const OUString sReplacementGraphicURL; + const OUString sHeight; + const OUString sHoriOrient; + const OUString sHoriOrientPosition; + const OUString sHyperLinkName; + const OUString sHyperLinkTarget; + const OUString sHyperLinkURL; + const OUString sIsAutomaticContour; + const OUString sIsCollapsed; + const OUString sIsPixelContour; + const OUString sIsStart; + const OUString sIsSyncHeightToWidth; + const OUString sIsSyncWidthToHeight; + const OUString sNumberingRules; + const OUString sNumberingType; + const OUString sPageDescName; + const OUString sPageStyleName; + const OUString sParaChapterNumberingLevel; + const OUString sParaConditionalStyleName; + const OUString sParagraphService; + const OUString sParaStyleName; + const OUString sPositionEndOfDoc; + const OUString sPrefix; + const OUString sRedline; + const OUString sReferenceId; + const OUString sReferenceMark; + const OUString sRelativeHeight; + const OUString sRelativeWidth; + const OUString sRuby; + const OUString sRubyAdjust; + const OUString sRubyCharStyleName; + const OUString sRubyText; + const OUString sServerMap; + const OUString sShapeService; + const OUString sSizeType; + const OUString sSoftPageBreak; + const OUString sStartAt; + const OUString sSuffix; + const OUString sTableService; + const OUString sText; + const OUString sTextContentService; + const OUString sTextEmbeddedService; + const OUString sTextEndnoteService; + const OUString sTextField; + const OUString sTextFieldService; + const OUString sTextFrameService; + const OUString sTextGraphicService; + const OUString sTextPortionType; + const OUString sTextSection; + const OUString sUnvisitedCharStyleName; + const OUString sVertOrient; + const OUString sVertOrientPosition; + const OUString sVisitedCharStyleName; + const OUString sWidth; + const OUString sWidthType; + const OUString sTextFieldStart; + const OUString sTextFieldEnd; + const OUString sTextFieldStartEnd; + + SinglePropertySetInfoCache aCharStyleNamesPropInfoCache; + +// SvXMLExport& GetExport() { return rExport; } +// const SvXMLExport& GetExport() const { return rExport; } + + UniReference < SvXMLExportPropertyMapper > GetParaPropMapper() const + { + return xParaPropMapper; + } + + UniReference < SvXMLExportPropertyMapper > GetTextPropMapper() const + { + return xTextPropMapper; + } + + UniReference < SvXMLExportPropertyMapper > GetFramePropMapper() const + { + return xFramePropMapper; + } + UniReference < SvXMLExportPropertyMapper > GetAutoFramePropMapper() const + { + return xAutoFramePropMapper; + } + UniReference < SvXMLExportPropertyMapper > GetSectionPropMapper() const + { + return xSectionPropMapper; + } + UniReference < SvXMLExportPropertyMapper > GetRubyPropMapper() const + { + return xRubyPropMapper; + } + + + SvXMLAutoStylePoolP& GetAutoStylePool() { return rAutoStylePool; } + const SvXMLAutoStylePoolP& GetAutoStylePool() const { return rAutoStylePool; } + +public: + OUString FindTextStyleAndHyperlink( + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > & rPropSet, + sal_Bool& rbHyperlink, + sal_Bool& rbHasCharStyle, + sal_Bool& rbHasAutoStyle, + const XMLPropertyState** pAddState = NULL) const; + sal_Bool addHyperlinkAttributes( + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > & rPropSet, + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertyState > & rPropState, + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySetInfo > & rPropSetInfo ); + + void exportTextRangeEnumeration( + const ::com::sun::star::uno::Reference < + ::com::sun::star::container::XEnumeration > & rRangeEnum, + sal_Bool bAutoStyles, sal_Bool bProgress, + sal_Bool bPrvChrIsSpc = sal_True ); + +protected: + + sal_Int32 addTextFrameAttributes( + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet >& rPropSet, + sal_Bool bShape, + OUString *pMinHeightValue = 0, + OUString *pMinWidthValue = 0 ); + + virtual void exportStyleAttributes( + const ::com::sun::star::uno::Reference< + ::com::sun::star::style::XStyle > & rStyle ); + + void exportPageFrames( sal_Bool bAutoStyles, sal_Bool bProgress ); + void exportFrameFrames( sal_Bool bAutoStyles, sal_Bool bProgress, + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextFrame > *pParentTxtFrame = 0 ); + + void exportNumStyles( sal_Bool bUsed ); + + void exportText( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XText > & rText, + sal_Bool bAutoStyles, sal_Bool bProgress, sal_Bool bExportParagraph ); + + void exportText( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XText > & rText, + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextSection > & rBaseSection, + sal_Bool bAutoStyles, sal_Bool bProgress, sal_Bool bExportParagraph ); + + sal_Bool exportTextContentEnumeration( + const ::com::sun::star::uno::Reference < + ::com::sun::star::container::XEnumeration > & rContentEnum, + sal_Bool bAutoStyles, + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextSection > & rBaseSection, + sal_Bool bProgress, + sal_Bool bExportParagraph = sal_True, + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > *pRangePropSet = 0, + sal_Bool bExportLevels = sal_True ); + void exportParagraph( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextContent > & rTextContent, + sal_Bool bAutoStyles, sal_Bool bProgress, + sal_Bool bExportParagraph, + MultiPropertySetHelper& rPropSetHelper); + virtual void exportTable( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextContent > & rTextContent, + sal_Bool bAutoStyles, sal_Bool bProgress ); + + void exportTextField( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextRange > & rTextRange, + sal_Bool bAutoStyles, sal_Bool bProgress ); + + void exportTextField( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextField> & xTextField, + const sal_Bool bAutoStyles, const sal_Bool bProgress, + const sal_Bool bRecursive ); + + void exportAnyTextFrame( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextContent > & rTextContent, + FrameType eTxpe, + sal_Bool bAutoStyles, sal_Bool bProgress, sal_Bool bExportContent, + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > *pRangePropSet = 0 ); + void _exportTextFrame( + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > & rPropSet, + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySetInfo > & rPropSetInfo, + sal_Bool bProgress ); + inline void exportTextFrame( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextContent > & rTextContent, + sal_Bool bAutoStyles, sal_Bool bProgress, sal_Bool bExportContent, + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > *pRangePropSet = 0 ); + inline void exportShape( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextContent > & rTextContent, + sal_Bool bAutoStyles, + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > *pRangePropSet = 0 ); + + void exportContour( + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > & rPropSet, + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySetInfo > & rPropSetInfo ); + void _exportTextGraphic( + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > & rPropSet, + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySetInfo > & rPropSetInfo ); + inline void exportTextGraphic( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextContent > & rTextContent, + sal_Bool bAutoStyles, + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > *pRangePropSet = 0 ); + + virtual void _collectTextEmbeddedAutoStyles( + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > & rPropSet ); + virtual void _exportTextEmbedded( + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > & rPropSet, + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySetInfo > & rPropSetInfo ); + inline void exportTextEmbedded( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextContent > & rTextContent, + sal_Bool bAutoStyles, + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > *pRangePropSet = 0 ); + virtual void setTextEmbeddedGraphicURL( + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet >& rPropSet, + OUString& rStreamName ) const; + + /// export a footnote and styles + void exportTextFootnote( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > & rPropSet, + const OUString& sString, + sal_Bool bAutoStyles, sal_Bool bProgress ); + + /// helper for exportTextFootnote + void exportTextFootnoteHelper( + const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XFootnote > & rPropSet, + const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XText> & rText, + const OUString& sString, + sal_Bool bAutoStyles, + sal_Bool bIsEndnote, sal_Bool bProgress ); + + /// export footnote and endnote configuration elements + void exportTextFootnoteConfiguration(); + + void exportTextFootnoteConfigurationHelper( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> & rFootnoteSupplier, + sal_Bool bIsEndnote); + + void exportTextMark( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> & xPropSet, + const OUString& rProperty, + const enum ::xmloff::token::XMLTokenEnum pElements[], + sal_Bool bAutoStyles); + + void exportIndexMark( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> & rPropSet, + sal_Bool bAutoStyles); + + void exportSoftPageBreak( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> & rPropSet, + sal_Bool bAutoStyles); + + void exportTextRange( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextRange > & rTextRange, + sal_Bool bAutoStyles, + bool& rPrevCharWasSpace, + FieldmarkType& openFieldmarkType ); + + void exportListChange( const XMLTextNumRuleInfo& rPrvInfo, + const XMLTextNumRuleInfo& rNextInfo ); + + /// check if current section or current list has changed; + /// calls exortListChange as appropriate + void exportListAndSectionChange( + ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextSection > & rOldSection, + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextSection > & rNewSection, + const XMLTextNumRuleInfo& rOldList, + const XMLTextNumRuleInfo& rNewList, + sal_Bool bAutoStyles ); + + /// overload for exportListAndSectionChange; + /// takes new content rather than new section. + void exportListAndSectionChange( + ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextSection > & rOldSection, + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextContent > & rNewContent, + const XMLTextNumRuleInfo& rOldList, + const XMLTextNumRuleInfo& rNewList, + sal_Bool bAutoStyles ); + void exportListAndSectionChange( + ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextSection > & rOldSection, + MultiPropertySetHelper& rPropSetHelper, + sal_Int16 nTextSectionId, + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextContent > & rNewContent, + const XMLTextNumRuleInfo& rOldList, + const XMLTextNumRuleInfo& rNewList, + sal_Bool bAutoStyles ); + + /// export a redline text portion + void exportChange( + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > & rPropSet, + sal_Bool bAutoStyle); + + /// export a ruby + void exportRuby( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> & rPortionPropSet, + sal_Bool bAutoStyles ); + + /// export a text:meta + void exportMeta( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> & i_xPortion, + sal_Bool i_bAutoStyles, sal_Bool i_isProgress ); + +public: + + XMLTextParagraphExport( + SvXMLExport& rExp, + SvXMLAutoStylePoolP & rASP + ); + virtual ~XMLTextParagraphExport(); + + /// add autostyle for specified family + void Add( + sal_uInt16 nFamily, + MultiPropertySetHelper& rPropSetHelper, + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > & rPropSet, + const XMLPropertyState** pAddState = NULL ); + void Add( + sal_uInt16 nFamily, + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > & rPropSet, + const XMLPropertyState** pAddState = NULL, bool bDontSeek = false ); + + /// find style name for specified family and parent + OUString Find( + sal_uInt16 nFamily, + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > & rPropSet, + const OUString& rParent, + const XMLPropertyState** pAddState = NULL ) const; + + static SvXMLExportPropertyMapper *CreateShapeExtPropMapper( + SvXMLExport& rExport ); + static SvXMLExportPropertyMapper *CreateCharExtPropMapper( + SvXMLExport& rExport); + static SvXMLExportPropertyMapper *CreateParaExtPropMapper( + SvXMLExport& rExport); + static SvXMLExportPropertyMapper *CreateParaDefaultExtPropMapper( + SvXMLExport& rExport); + + // This methods exports all (or all used) styles + void exportTextStyles( sal_Bool bUsed + , sal_Bool bProg = sal_False + ); + + /// This method exports (text field) declarations etc. + void exportTextDeclarations(); + + /// export the (text field) declarations for a particular XText + void exportTextDeclarations( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XText > & rText ); + + /// true: export only those declarations that are used; + /// false: export all declarations + void exportUsedDeclarations( sal_Bool bOnlyUsed ); + + /// Export the list of change information (enclosed by <tracked-changes>) + /// (or the necessary automatic styles) + void exportTrackedChanges(sal_Bool bAutoStyle); + + /// Export the list of change information (enclosed by <tracked-changes>) + /// (or the necessary automatic styles) + void exportTrackedChanges(const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XText > & rText, + sal_Bool bAutoStyle ); + + /// Record tracked changes for this particular XText + /// (empty reference stop recording) + /// This should be used if tracked changes for e.g. footers are to + /// be exported seperately via the exportTrackedChanges(sal_Bool, + /// Reference<XText>) method. + void recordTrackedChangesForXText( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XText > & rText ); + + + /// Stop recording tracked changes. + /// This is the same as calling recordTrackedChanges(...) with an + /// empty reference. + void recordTrackedChangesNoXText(); + + + // This method exports the given OUString + void exportText( + const OUString& rText, + bool& rPrevCharWasSpace ); + + // This method collects all automatic styles for the given XText + void collectTextAutoStyles( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XText > & rText, + sal_Bool bIsProgress = sal_False, + sal_Bool bExportParagraph = sal_True ) + { + exportText( rText, sal_True, bIsProgress, bExportParagraph ); + } + + void collectTextAutoStyles( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XText > & rText, + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextSection > & rBaseSection, + sal_Bool bIsProgress = sal_False, + sal_Bool bExportParagraph = sal_True ) + { + exportText( rText, rBaseSection, sal_True, bIsProgress, bExportParagraph ); + } + + // It the model implements the xAutoStylesSupplier interface, the automatic + // styles can exported without iterating over the text portions + bool collectTextAutoStylesOptimized( + sal_Bool bIsProgress = sal_False ); + + // This method exports all automatic styles that have been collected. + virtual void exportTextAutoStyles(); + + void exportEvents( const ::com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > & rPropSet ); + + // Implement Title/Description Elements UI (#i73249#) + void exportTitleAndDescription( const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & rPropSet, + const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySetInfo > & rPropSetInfo ); + + // This method exports the given XText + void exportText( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XText > & rText, + sal_Bool bIsProgress = sal_False, + sal_Bool bExportParagraph = sal_True) + { + exportText( rText, sal_False, bIsProgress, bExportParagraph ); + } + + void exportText( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XText > & rText, + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextSection > & rBaseSection, + sal_Bool bIsProgress = sal_False, + sal_Bool bExportParagraph = sal_True) + { + exportText( rText, rBaseSection, sal_False, bIsProgress, bExportParagraph ); + } + + void exportFramesBoundToPage( sal_Bool bIsProgress = sal_False ) + { + exportPageFrames( sal_False, bIsProgress ); + } + void exportFramesBoundToFrame( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextFrame >& rParentTxtFrame, + sal_Bool bIsProgress = sal_False ) + { + exportFrameFrames( sal_False, bIsProgress, &rParentTxtFrame ); + } + inline const XMLTextListAutoStylePool& GetListAutoStylePool() const; + + void SetBlockMode( sal_Bool bSet ) { bBlock = bSet; } + sal_Bool IsBlockMode() const { return bBlock; } + + + UniReference < SvXMLExportPropertyMapper > GetParagraphPropertyMapper() const + { + return xParaPropMapper; + } + + + /** exclude form controls which are in mute sections. + * + * This method is necessary to prevent the form layer export from exporting + * control models whose controls are not represented in the document. To + * achieve this, this method iterates over all shapes, checks to see if + * they are control shapes, and if so, whether they should be exported or + * not. If not, the form layer export will be notified accordingly. + * + * The reason this method is located here is tha it needs to access the + * XMLSectionExport, which is only available here. + */ + void PreventExportOfControlsInMuteSections( + const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XIndexAccess> & rShapes, + UniReference<xmloff::OFormLayerXMLExport> xFormExport ); + + SinglePropertySetInfoCache& GetCharStyleNamesPropInfoCache() { return aCharStyleNamesPropInfoCache; } + + void PushNewTextListsHelper(); + + void PopTextListsHelper(); + +private: + XMLTextParagraphExport(XMLTextParagraphExport &); // private copy-ctor because of explicit copy-ctor of auto_ptr +}; + +inline const XMLTextListAutoStylePool& + XMLTextParagraphExport::GetListAutoStylePool() const +{ + return *pListAutoPool; +} + +inline void XMLTextParagraphExport::exportTextFrame( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextContent > & rTextContent, + sal_Bool bAutoStyles, sal_Bool bIsProgress, sal_Bool bExportContent, + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > *pRangePropSet) +{ + exportAnyTextFrame( rTextContent, FT_TEXT, bAutoStyles, bIsProgress, + bExportContent, pRangePropSet ); +} + +inline void XMLTextParagraphExport::exportTextGraphic( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextContent > & rTextContent, + sal_Bool bAutoStyles, + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > *pRangePropSet ) +{ + exportAnyTextFrame( rTextContent, FT_GRAPHIC, bAutoStyles, sal_False, + sal_True, pRangePropSet ); +} + +inline void XMLTextParagraphExport::exportTextEmbedded( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextContent > & rTextContent, + sal_Bool bAutoStyles, + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > *pRangePropSet ) +{ + exportAnyTextFrame( rTextContent, FT_EMBEDDED, bAutoStyles, sal_False, + sal_True, pRangePropSet ); +} + +inline void XMLTextParagraphExport::exportShape( + const ::com::sun::star::uno::Reference < + ::com::sun::star::text::XTextContent > & rTextContent, + sal_Bool bAutoStyles, + const ::com::sun::star::uno::Reference < + ::com::sun::star::beans::XPropertySet > *pRangePropSet ) +{ + exportAnyTextFrame( rTextContent, FT_SHAPE, bAutoStyles, sal_False, + sal_True, pRangePropSet ); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/txtprmap.hxx b/include/xmloff/txtprmap.hxx new file mode 100644 index 000000000000..9228591152be --- /dev/null +++ b/include/xmloff/txtprmap.hxx @@ -0,0 +1,204 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _XMLOFF_TEXTPRMAP_HXX_ +#define _XMLOFF_TEXTPRMAP_HXX_ + +#include <xmloff/contextid.hxx> +#include <xmloff/xmlprmap.hxx> + +#define CTF_CHARHEIGHT (XML_TEXT_CTF_START + 1) +#define CTF_CHARHEIGHT_REL (XML_TEXT_CTF_START + 2) +#define CTF_PARALEFTMARGIN (XML_TEXT_CTF_START + 3) +#define CTF_PARALEFTMARGIN_REL (XML_TEXT_CTF_START + 4) +#define CTF_PARARIGHTMARGIN (XML_TEXT_CTF_START + 5) +#define CTF_PARARIGHTMARGIN_REL (XML_TEXT_CTF_START + 6) +#define CTF_PARAFIRSTLINE (XML_TEXT_CTF_START + 7) +#define CTF_PARAFIRSTLINE_REL (XML_TEXT_CTF_START + 8) +#define CTF_PARATOPMARGIN (XML_TEXT_CTF_START + 9) +#define CTF_PARATOPMARGIN_REL (XML_TEXT_CTF_START + 10) +#define CTF_PARABOTTOMMARGIN (XML_TEXT_CTF_START + 11) +#define CTF_PARABOTTOMMARGIN_REL (XML_TEXT_CTF_START + 12) +#define CTF_ALLBORDERWIDTH (XML_TEXT_CTF_START + 13) +#define CTF_LEFTBORDERWIDTH (XML_TEXT_CTF_START + 14) +#define CTF_RIGHTBORDERWIDTH (XML_TEXT_CTF_START + 15) +#define CTF_TOPBORDERWIDTH (XML_TEXT_CTF_START + 16) +#define CTF_BOTTOMBORDERWIDTH (XML_TEXT_CTF_START + 17) +#define CTF_ALLBORDERDISTANCE (XML_TEXT_CTF_START + 18) +#define CTF_LEFTBORDERDISTANCE (XML_TEXT_CTF_START + 19) +#define CTF_RIGHTBORDERDISTANCE (XML_TEXT_CTF_START + 20) +#define CTF_TOPBORDERDISTANCE (XML_TEXT_CTF_START + 21) +#define CTF_BOTTOMBORDERDISTANCE (XML_TEXT_CTF_START + 22) +#define CTF_ALLBORDER (XML_TEXT_CTF_START + 23) +#define CTF_LEFTBORDER (XML_TEXT_CTF_START + 24) +#define CTF_RIGHTBORDER (XML_TEXT_CTF_START + 25) +#define CTF_TOPBORDER (XML_TEXT_CTF_START + 26) +#define CTF_BOTTOMBORDER (XML_TEXT_CTF_START + 27) +#define CTF_DROPCAPWHOLEWORD (XML_TEXT_CTF_START + 28) +#define CTF_DROPCAPFORMAT (XML_TEXT_CTF_START + 29) +#define CTF_DROPCAPCHARSTYLE (XML_TEXT_CTF_START + 30) +#define CTF_TABSTOP (XML_TEXT_CTF_START + 31) +#define CTF_NUMBERINGSTYLENAME (XML_TEXT_CTF_START + 32) +#define CTF_OLDTEXTBACKGROUND (XML_TEXT_CTF_START + 33) +#define CTF_FONTFAMILYNAME (XML_TEXT_CTF_START + 34) +#define CTF_FONTSTYLENAME (XML_TEXT_CTF_START + 35) +#define CTF_FONTFAMILY (XML_TEXT_CTF_START + 36) +#define CTF_FONTPITCH (XML_TEXT_CTF_START + 37) +#define CTF_FONTCHARSET (XML_TEXT_CTF_START + 38) +#define CTF_TEXTWRITINGMODE (XML_TEXT_CTF_START + 39) +#define CTF_SYNCHEIGHT_MIN (XML_TEXT_CTF_START + 40) +#define CTF_FRAMEHEIGHT_ABS (XML_TEXT_CTF_START + 41) +#define CTF_FRAMEHEIGHT_REL (XML_TEXT_CTF_START + 42) +#define CTF_FRAMEHEIGHT_MIN_ABS (XML_TEXT_CTF_START + 43) +#define CTF_FRAMEHEIGHT_MIN_REL (XML_TEXT_CTF_START + 44) +#define CTF_SIZETYPE (XML_TEXT_CTF_START + 45) +#define CTF_SYNCHEIGHT (XML_TEXT_CTF_START + 46) +#define CTF_WRAP (XML_TEXT_CTF_START + 47) +#define CTF_WRAP_CONTOUR (XML_TEXT_CTF_START + 48) +#define CTF_WRAP_CONTOUR_MODE (XML_TEXT_CTF_START + 49) +#define CTF_WRAP_PARAGRAPH_ONLY (XML_TEXT_CTF_START + 50) +#define CTF_ANCHORTYPE (XML_TEXT_CTF_START + 51) +#define CTF_ANCHORPAGENUMBER (XML_TEXT_CTF_START + 52) +#define CTF_TEXTCOLUMNS (XML_TEXT_CTF_START + 53) +#define CTF_HORIZONTALPOS (XML_TEXT_CTF_START + 54) +#define CTF_HORIZONTALPOS_MIRRORED (XML_TEXT_CTF_START + 55) +#define CTF_HORIZONTALREL (XML_TEXT_CTF_START + 56) +#define CTF_HORIZONTALREL_FRAME (XML_TEXT_CTF_START + 57) +#define CTF_HORIZONTALMIRROR (XML_TEXT_CTF_START + 58) +#define CTF_VERTICALPOS (XML_TEXT_CTF_START + 59) +#define CTF_VERTICALREL (XML_TEXT_CTF_START + 60) +#define CTF_VERTICALREL_PAGE (XML_TEXT_CTF_START + 61) +#define CTF_VERTICALREL_FRAME (XML_TEXT_CTF_START + 62) +#define CTF_VERTICALREL_ASCHAR (XML_TEXT_CTF_START + 63) +#define CTF_PAGEDESCNAME (XML_TEXT_CTF_START + 64) +#define CTF_BACKGROUND_URL (XML_TEXT_CTF_START + 66) +#define CTF_BACKGROUND_POS (XML_TEXT_CTF_START + 67) +#define CTF_BACKGROUND_FILTER (XML_TEXT_CTF_START + 68) +#define CTF_CHARHEIGHT_DIFF (XML_TEXT_CTF_START + 69) +#define CTF_FONTNAME (XML_TEXT_CTF_START + 70) +#define CTF_FONTNAME_CJK (XML_TEXT_CTF_START + 71) +#define CTF_FONTFAMILYNAME_CJK (XML_TEXT_CTF_START + 72) +#define CTF_FONTSTYLENAME_CJK (XML_TEXT_CTF_START + 73) +#define CTF_FONTFAMILY_CJK (XML_TEXT_CTF_START + 74) +#define CTF_FONTPITCH_CJK (XML_TEXT_CTF_START + 75) +#define CTF_FONTCHARSET_CJK (XML_TEXT_CTF_START + 76) +#define CTF_CHARHEIGHT_CJK (XML_TEXT_CTF_START + 77) +#define CTF_CHARHEIGHT_REL_CJK (XML_TEXT_CTF_START + 78) +#define CTF_CHARHEIGHT_DIFF_CJK (XML_TEXT_CTF_START + 79) +#define CTF_FONTNAME_CTL (XML_TEXT_CTF_START + 80) +#define CTF_FONTFAMILYNAME_CTL (XML_TEXT_CTF_START + 81) +#define CTF_FONTSTYLENAME_CTL (XML_TEXT_CTF_START + 82) +#define CTF_FONTFAMILY_CTL (XML_TEXT_CTF_START + 83) +#define CTF_FONTPITCH_CTL (XML_TEXT_CTF_START + 84) +#define CTF_FONTCHARSET_CTL (XML_TEXT_CTF_START + 85) +#define CTF_CHARHEIGHT_CTL (XML_TEXT_CTF_START + 86) +#define CTF_CHARHEIGHT_REL_CTL (XML_TEXT_CTF_START + 87) +#define CTF_CHARHEIGHT_DIFF_CTL (XML_TEXT_CTF_START + 88) +#define CTF_UNDERLINE (XML_TEXT_CTF_START + 89) +#define CTF_UNDERLINE_COLOR (XML_TEXT_CTF_START + 90) +#define CTF_UNDERLINE_HASCOLOR (XML_TEXT_CTF_START + 91) +#define CTF_SECTION_FOOTNOTE_END (XML_TEXT_CTF_START + 92) +#define CTF_SECTION_FOOTNOTE_NUM_RESTART (XML_TEXT_CTF_START + 93) +#define CTF_SECTION_FOOTNOTE_NUM_RESTART_AT (XML_TEXT_CTF_START + 94) +#define CTF_SECTION_FOOTNOTE_NUM_TYPE (XML_TEXT_CTF_START + 95) +#define CTF_SECTION_FOOTNOTE_NUM_PREFIX (XML_TEXT_CTF_START + 96) +#define CTF_SECTION_FOOTNOTE_NUM_SUFFIX (XML_TEXT_CTF_START + 97) +#define CTF_SECTION_FOOTNOTE_NUM_OWN (XML_TEXT_CTF_START + 98) +#define CTF_SECTION_ENDNOTE_END (XML_TEXT_CTF_START + 99) +#define CTF_SECTION_ENDNOTE_NUM_RESTART (XML_TEXT_CTF_START + 100) +#define CTF_SECTION_ENDNOTE_NUM_RESTART_AT (XML_TEXT_CTF_START + 101) +#define CTF_SECTION_ENDNOTE_NUM_TYPE (XML_TEXT_CTF_START + 102) +#define CTF_SECTION_ENDNOTE_NUM_PREFIX (XML_TEXT_CTF_START + 103) +#define CTF_SECTION_ENDNOTE_NUM_SUFFIX (XML_TEXT_CTF_START + 104) +#define CTF_SECTION_ENDNOTE_NUM_OWN (XML_TEXT_CTF_START + 105) +#define CTF_PAGE_FOOTNOTE (XML_TEXT_CTF_START + 106) +#define CTF_FRAME_DISPLAY_SCROLLBAR (XML_TEXT_CTF_START + 107) +#define CTF_FRAME_DISPLAY_BORDER (XML_TEXT_CTF_START + 108) +#define CTF_FRAME_MARGIN_HORI (XML_TEXT_CTF_START + 109) +#define CTF_FRAME_MARGIN_VERT (XML_TEXT_CTF_START + 110) +#define CTF_COMBINED_CHARACTERS_FIELD (XML_TEXT_CTF_START + 111) +#define CTF_OLE_VIS_AREA_TOP (XML_TEXT_CTF_START + 112) +#define CTF_OLE_VIS_AREA_LEFT (XML_TEXT_CTF_START + 113) +#define CTF_OLE_VIS_AREA_WIDTH (XML_TEXT_CTF_START + 114) +#define CTF_OLE_VIS_AREA_HEIGHT (XML_TEXT_CTF_START + 115) +#define CTF_OLE_DRAW_ASPECT (XML_TEXT_CTF_START + 116) +#define CTF_HYPERLINK_URL (XML_TEXT_CTF_START + 117) +#define CTF_CHAR_STYLE_NAME (XML_TEXT_CTF_START + 118) +#define CTF_VERTICALPOS_ATCHAR (XML_TEXT_CTF_START + 119) +#define CTF_BACKGROUND_TRANSPARENCY (XML_TEXT_CTF_START + 120) +#define CTF_BACKGROUND_TRANSPARENT (XML_TEXT_CTF_START + 121) +#define CTF_KEEP_TOGETHER (XML_TEXT_CTF_START + 122) +#define CTF_FRAMEWIDTH_ABS (XML_TEXT_CTF_START + 123) +#define CTF_FRAMEWIDTH_MIN_ABS (XML_TEXT_CTF_START + 124) +#define CTF_FRAMEWIDTH_MIN_REL (XML_TEXT_CTF_START + 125) +#define CTF_FRAMEWIDTH_REL (XML_TEXT_CTF_START + 126) +#define CTF_FRAMEWIDTH_TYPE (XML_TEXT_CTF_START + 127) +#define CTF_BORDER_MODEL (XML_TEXT_CTF_START + 128) +/* Define CTF ids for positioning properties of + shapes, because on export to OpenOffice.org file format these have to + be handled special, if shape isn't anchored as-character. (#i28749#) +*/ +#define CTF_SHAPE_HORIZONTALPOS (XML_TEXT_CTF_START + 129) +#define CTF_SHAPE_HORIZONTALPOS_MIRRORED (XML_TEXT_CTF_START + 130) +#define CTF_SHAPE_HORIZONTALREL (XML_TEXT_CTF_START + 131) +#define CTF_SHAPE_HORIZONTALREL_FRAME (XML_TEXT_CTF_START + 132) +#define CTF_SHAPE_HORIZONTALMIRROR (XML_TEXT_CTF_START + 133) +#define CTF_SHAPE_VERTICALPOS (XML_TEXT_CTF_START + 134) +#define CTF_SHAPE_VERTICALPOS_ATCHAR (XML_TEXT_CTF_START + 135) +#define CTF_SHAPE_VERTICALREL (XML_TEXT_CTF_START + 136) +#define CTF_SHAPE_VERTICALREL_PAGE (XML_TEXT_CTF_START + 137) +#define CTF_SHAPE_VERTICALREL_FRAME (XML_TEXT_CTF_START + 138) +#define CTF_PARA_ADJUSTLAST (XML_TEXT_CTF_START + 139) +#define CTF_DEFAULT_OUTLINE_LEVEL (XML_TEXT_CTF_START + 140) +#define CTF_OLD_FLOW_WITH_TEXT (XML_TEXT_CTF_START + 141) +#define CTF_ISNUMBERING (XML_TEXT_CTF_START + 142) +#define CTF_TEXT_DISPLAY (XML_TEXT_CTF_START + 143) +#define CTF_TEXT_CLIP (XML_TEXT_CTF_START + 144) +#define CTF_TEXT_CLIP11 (XML_TEXT_CTF_START + 145) +#define CTF_PARAMARGINALL (XML_TEXT_CTF_START + 146) +#define CTF_PARAMARGINALL_REL (XML_TEXT_CTF_START + 147) +#define CTF_MARGINALL (XML_TEXT_CTF_START + 148) +#define CTF_MARGINLEFT (XML_TEXT_CTF_START + 149) +#define CTF_MARGINRIGHT (XML_TEXT_CTF_START + 150) +#define CTF_MARGINTOP (XML_TEXT_CTF_START + 151) +#define CTF_MARGINBOTTOM (XML_TEXT_CTF_START + 152) + +#define TEXT_PROP_MAP_TEXT 0 +#define TEXT_PROP_MAP_PARA 1 +#define TEXT_PROP_MAP_FRAME 2 +#define TEXT_PROP_MAP_AUTO_FRAME 3 +#define TEXT_PROP_MAP_SECTION 4 +#define TEXT_PROP_MAP_SHAPE 5 +#define TEXT_PROP_MAP_RUBY 6 +#define TEXT_PROP_MAP_SHAPE_PARA 7 +#define TEXT_PROP_MAP_TEXT_ADDITIONAL_DEFAULTS 8 +#define TEXT_PROP_MAP_TABLE_DEFAULTS 9 +#define TEXT_PROP_MAP_TABLE_ROW_DEFAULTS 10 + +class XMLOFF_DLLPUBLIC XMLTextPropertySetMapper : public XMLPropertySetMapper +{ +public: + XMLTextPropertySetMapper( sal_uInt16 nType ); + virtual ~XMLTextPropertySetMapper(); + + static const XMLPropertyMapEntry* getPropertyMapForType( sal_uInt16 _nType ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/txtstyli.hxx b/include/xmloff/txtstyli.hxx new file mode 100644 index 000000000000..d645cfc11281 --- /dev/null +++ b/include/xmloff/txtstyli.hxx @@ -0,0 +1,112 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _XMLOFF_TXTSTYLI_HXX_ +#define _XMLOFF_TXTSTYLI_HXX_ + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <xmloff/prstylei.hxx> + +class SvXMLTokenMap; +class XMLEventsImportContext; + +class XMLOFF_DLLPUBLIC XMLTextStyleContext : public XMLPropStyleContext +{ + OUString sListStyleName; + OUString sCategoryVal; + OUString sDropCapTextStyleName; + OUString sMasterPageName; + OUString sDataStyleName; // for grid columns only + const OUString sIsAutoUpdate; + const OUString sCategory; + const OUString sNumberingStyleName; + const OUString sOutlineLevel; + +public: + const OUString sDropCapCharStyleName; +private: + const OUString sPageDescName; + + sal_Int8 nOutlineLevel; + + sal_Bool bAutoUpdate : 1; + sal_Bool bHasMasterPageName : 1; + + sal_Bool bHasCombinedCharactersLetter : 1; + + // Introduce import of empty list style (#i69523#) + sal_Bool mbListStyleSet : 1; + + XMLEventsImportContext* pEventContext; + +protected: + + virtual void SetAttribute( sal_uInt16 nPrefixKey, + const OUString& rLocalName, + const OUString& rValue ); + +public: + + TYPEINFO(); + + XMLTextStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, + const OUString& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList, + SvXMLStylesContext& rStyles, sal_uInt16 nFamily, + sal_Bool bDefaultStyle = sal_False ); + virtual ~XMLTextStyleContext(); + + virtual SvXMLImportContext *CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + + sal_Bool IsAutoUpdate() const { return bAutoUpdate; } + + const OUString& GetListStyle() const { return sListStyleName; } + // XML import: reconstrution of assignment of paragraph style to outline levels (#i69629#) + sal_Bool IsListStyleSet() const + { + return mbListStyleSet; + } + + const OUString& GetMasterPageName() const { return sMasterPageName; } + sal_Bool HasMasterPageName() const { return bHasMasterPageName; } + const OUString& GetDropCapStyleName() const { return sDropCapTextStyleName; } + const OUString& GetDataStyleName() const { return sDataStyleName; } + + virtual void CreateAndInsert( sal_Bool bOverwrite ); + virtual void Finish( sal_Bool bOverwrite ); + virtual void SetDefaults(); + + // overload FillPropertySet, so we can get at the combined characters + virtual void FillPropertySet( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > & rPropSet ); + + inline sal_Bool HasCombinedCharactersLetter() + { return bHasCombinedCharactersLetter; } + + const ::std::vector< XMLPropertyState > & _GetProperties() { return GetProperties(); } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/uniref.hxx b/include/xmloff/uniref.hxx new file mode 100644 index 000000000000..808ed8212b97 --- /dev/null +++ b/include/xmloff/uniref.hxx @@ -0,0 +1,224 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _UNIVERSALL_REFERENCE_HXX +#define _UNIVERSALL_REFERENCE_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <sal/types.h> +#include <osl/interlck.h> + +/** + * An instance of this class holds a pointer to an object. The lifetime of + * the object is controled by the instance. The constructor calls + * acquire() and the destructor calls release(). + * You could delive your class from the baseclass UniRefBase wich implements + * the methods acquire and release, yet. + */ +template< class T > class UniReference +{ +private: + T* mpElement; + +public: + /** Create an empty reference.*/ + UniReference() + : mpElement( NULL ) + {} + + /** Destroy the reference and releases the element.*/ + inline ~UniReference(); + + /** Create a new reference with the same element as in rRef and acquire this one.*/ + inline UniReference( const UniReference< T > & rRef ); + + /** + * Create a new reference with the given element pElement and acquire this one. + */ + inline UniReference( T * pElement ); + + /** + * Release the reference and set the new one pObj. + */ + inline UniReference< T > & operator = ( T * pElement ); + + /** + * Release the reference and set the new one from rObj. + */ + inline UniReference< T > & operator = ( const UniReference< T > & rRef ); + + /** + * Return the pointer to the element, may be null. + */ + inline T* operator -> () const; + + /** + * Returns true if the pointer to the element is valid. + */ + inline sal_Bool is() const; + + /** + * Return true if both elements refer to the same object. + */ + inline sal_Bool operator == ( const UniReference & rRef ) const; + + /** + * Return true if both elements does not refer to the same object. + */ + inline sal_Bool operator != ( const UniReference & rRef ) const; + + /** Gets implementation pointer. + This call does <b>not</b> acquire the implementation. + <br> + @return <b>un</b>acquired implementation pointer + */ + inline T* get() const; +}; + +class XMLOFF_DLLPUBLIC UniRefBase +{ +private: + /** + * The reference counter. + */ + oslInterlockedCount m_refCount; + +public: + UniRefBase() : m_refCount( 0 ) + {} + virtual ~UniRefBase(); + + void acquire() { osl_atomic_increment( &m_refCount ); } + void release(); + +}; + +/////////////////////////////////////////////////////////////////////////////// +// +// Inline-implementations of UniReference +// + +/** Create a new reference with the same element as in rRef and acquire this one.*/ +template< class T > +inline UniReference< T >::UniReference( const UniReference< T > & rRef ) + : mpElement( rRef.mpElement ) +{ + if( mpElement ) + mpElement->acquire(); +} + +template< class T > +inline UniReference< T >::~UniReference() +{ + if( mpElement ) + mpElement->release(); +} + +/** + * Create a new reference with the given element pElement and acquire this one. + * @param pInterface the interface, pointer may be null. + */ +template< class T > +inline UniReference< T >::UniReference( T * pElement ) + : mpElement( pElement ) +{ + if( mpElement ) + mpElement->acquire(); +} + +/** + * Release the reference and set the new one pObj.<BR> + * <B>The operation is not thread save. You must protect all assigns to a reference class.</B> + */ +template< class T > +inline UniReference< T > & UniReference< T >::operator = ( T * pElement ) +{ + if( pElement ) + pElement->acquire(); + if( mpElement ) + mpElement->release(); + + mpElement = pElement; + + return *this; +} + +/** + * Release the reference and set the new one from rObj.<BR> + * <B>The operation is not thread save. You must protect all assigns to a reference class.</B> + */ +template< class T > +inline UniReference< T > & UniReference< T >::operator = ( const UniReference< T > & rRef ) +{ + return operator = ( rRef.mpElement ); +} + +/** + * Return the pointer to the interface, may be null. + */ +template< class T > +inline T* UniReference< T >::operator -> () const +{ + return get(); +} + +/** + * Return the pointer to the interface, may be null. + */ +template< class T > +inline T* UniReference< T >::get () const +{ + return static_cast< T * >( mpElement ); +} + +/** + * Returns true if the pointer to the interface is valid. + */ +template< class T > +inline sal_Bool UniReference< T >::is() const +{ + return (mpElement != 0); +} +/** + * Return true if both interfaces refer to the same object. The operation can be + * much more expensive than a pointer comparision.<BR> + * + * @param rRef another interface reference + */ +template< class T > +inline sal_Bool UniReference< T >::operator == ( const UniReference & rRef ) const +{ + return ( mpElement == rRef.mpElement ); +} +/** + * Return true if both interfaces does not refer to the same object. The operation can be + * much more expensive than a pointer comparision.<BR> + * + * @param rRef another interface reference + */ +template< class T > +inline sal_Bool UniReference< T >::operator != ( const UniReference & rRef ) const +{ + return ( ! operator == ( rRef ) ); +} + +#endif // _UNIVERSALL_REFERENCE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/unoatrcn.hxx b/include/xmloff/unoatrcn.hxx new file mode 100644 index 000000000000..616d1db4f740 --- /dev/null +++ b/include/xmloff/unoatrcn.hxx @@ -0,0 +1,79 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include "sal/types.h" +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> + +#include <cppuhelper/implbase3.hxx> + +extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SvUnoAttributeContainer_CreateInstance(); + +class SvXMLAttrContainerData; + +class XMLOFF_DLLPUBLIC SvUnoAttributeContainer: + public ::cppu::WeakAggImplHelper3< + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::lang::XUnoTunnel, + ::com::sun::star::container::XNameContainer > +{ +private: + SvXMLAttrContainerData* mpContainer; + + SAL_DLLPRIVATE sal_uInt16 getIndexByName(const OUString& aName ) + const; + +public: + SvUnoAttributeContainer( SvXMLAttrContainerData* pContainer = NULL ); + virtual ~SvUnoAttributeContainer(); + + SvXMLAttrContainerData* GetContainerImpl() const { return mpContainer; } + + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::container::XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL hasElements(void) throw( ::com::sun::star::uno::RuntimeException ); + + // ::com::sun::star::container::XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName(const OUString& aName) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL hasByName(const OUString& aName) throw( ::com::sun::star::uno::RuntimeException ); + + // ::com::sun::star::container::XNameReplace + virtual void SAL_CALL replaceByName(const OUString& aName, const ::com::sun::star::uno::Any& aElement) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); + + // ::com::sun::star::container::XNameContainer + virtual void SAL_CALL insertByName(const OUString& aName, const ::com::sun::star::uno::Any& aElement) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeByName(const OUString& Name) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ); + + // ::com::sun::star::lang::XServiceInfo + virtual OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException ); + + friend ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SvUnoAttributeContainer_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr ) throw( ::com::sun::star::uno::Exception ); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/unointerfacetouniqueidentifiermapper.hxx b/include/xmloff/unointerfacetouniqueidentifiermapper.hxx new file mode 100644 index 000000000000..e538cbe176e0 --- /dev/null +++ b/include/xmloff/unointerfacetouniqueidentifiermapper.hxx @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef __COMPHELPER_UNOINTERFACETOUNIQUEIDENTIFIERMAPPER__ +#define __COMPHELPER_UNOINTERFACETOUNIQUEIDENTIFIERMAPPER__ + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include "sal/types.h" + +#include <map> +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/XInterface.hpp> + +namespace comphelper +{ + +typedef ::std::map< OUString, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > IdMap_t; + +class XMLOFF_DLLPUBLIC UnoInterfaceToUniqueIdentifierMapper +{ +public: + UnoInterfaceToUniqueIdentifierMapper(); + + /** returns a unique identifier for the given uno object. IF a uno object is + registered more than once, the returned identifier is always the same. + */ + const OUString& registerReference( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rInterface ); + + /** registers the given uno object with the given identifier. + + @returns + false, if the given identifier already exists and is not associated with the given interface + */ + bool registerReference( const OUString& rIdentifier, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rInterface ); + + /** @returns + the identifier for the given uno object. If this uno object is not already + registered, an empty string is returned + */ + const OUString& getIdentifier( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rInterface ) const; + + /** @returns + the uno object that is registered with the given identifier. If no uno object + is registered with the given identifier, an empty reference is returned. + */ + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& getReference( const OUString& rIdentifier ) const; + +private: + bool findReference( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rInterface, IdMap_t::const_iterator& rIter ) const; + bool findIdentifier( const OUString& rIdentifier, IdMap_t::const_iterator& rIter ) const; + + IdMap_t maEntries; + sal_Int32 mnNextId; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xformsexport.hxx b/include/xmloff/xformsexport.hxx new file mode 100644 index 000000000000..802180126f1b --- /dev/null +++ b/include/xmloff/xformsexport.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _XMLOFF_XFORMSEXPORT_HXX +#define _XMLOFF_XFORMSEXPORT_HXX + +#include "xmloff/dllapi.h" +#include <rtl/ustring.hxx> + +class SvXMLExport; +namespace com { namespace sun { namespace star { + namespace uno { template<typename T> class Reference; } + namespace uno { template<typename T> class Sequence; } + namespace frame { class XModel; } + namespace beans { class XPropertySet; struct PropertyValue; } + namespace container { class XNameAccess; } +} } } + + +/** export an XForms model. */ +void SAL_DLLPRIVATE exportXForms( SvXMLExport& ); + +OUString SAL_DLLPRIVATE getXFormsBindName( const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xBinding ); + +OUString SAL_DLLPRIVATE getXFormsListBindName( const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xBinding ); + +OUString SAL_DLLPRIVATE getXFormsSubmissionName( const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xBinding ); + + +/** returns the settings of the given XForms container, to be exported as document specific settings +*/ +void XMLOFF_DLLPUBLIC getXFormsSettings( + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rXForms, + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _out_rSettings + ); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xformsimport.hxx b/include/xmloff/xformsimport.hxx new file mode 100644 index 000000000000..b6770320dbd3 --- /dev/null +++ b/include/xmloff/xformsimport.hxx @@ -0,0 +1,79 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _XMLOFF_XFORMSIMPORT_HXX +#define _XMLOFF_XFORMSIMPORT_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" + +#include <tools/solar.h> // for sal_uInt16 +#include <com/sun/star/uno/Reference.hxx> + +class SvXMLImport; +class SvXMLImportContext; + +namespace com { namespace sun { namespace star { + namespace uno { template<typename T> class Reference; } + namespace beans { class XPropertySet; struct PropertyValue; } + namespace frame { class XModel; } + namespace container { class XNameAccess; } +} } } + +/** create import context for xforms:model element. */ +XMLOFF_DLLPUBLIC SvXMLImportContext* createXFormsModelContext( + SvXMLImport& rImport, + sal_uInt16 nPrefix, + const OUString& rLocalName ); + +/** perform the actual binding of an XForms-binding with the suitable control + * @param document which contains the XForms-model(s) + * @param pair<XForms binding ID, reference to control> + */ +void bindXFormsValueBinding( + com::sun::star::uno::Reference<com::sun::star::frame::XModel>, + std::pair<com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>,OUString> ); + + +/** perform the actual binding of an XForms-binding as list source with a list control + * @param document which contains the XForms-model(s) + * @param pair<XForms binding ID, reference to control> + */ +void bindXFormsListBinding( + com::sun::star::uno::Reference<com::sun::star::frame::XModel>, + std::pair<com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>,OUString> ); + +/** perform the actual binding of an XForms submission with the suitable control + * @param document which contains the XForms-model(s) + * @param pair<XForms submission ID, reference to control> + */ +void bindXFormsSubmission( + com::sun::star::uno::Reference<com::sun::star::frame::XModel>, + std::pair<com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>,OUString> ); + +/** applies the given settings to the given XForms container +*/ +void XMLOFF_DLLPUBLIC applyXFormsSettings( + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rXForms, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rSettings + ); + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlaustp.hxx b/include/xmloff/xmlaustp.hxx new file mode 100644 index 000000000000..e08b027ddb0f --- /dev/null +++ b/include/xmloff/xmlaustp.hxx @@ -0,0 +1,124 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLASTPLP_HXX +#define _XMLOFF_XMLASTPLP_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <xmloff/xmlprmap.hxx> +#include <xmloff/uniref.hxx> + +class SvXMLExportPropertyMapper; +class SvXMLNamespaceMap; +class SvXMLAutoStylePoolP_Impl; +class SvXMLAttributeList; +class SvXMLExport; +namespace com { namespace sun { namespace star { namespace uno + { template<typename A> class Sequence; } +} } } + +class XMLOFF_DLLPUBLIC SvXMLAutoStylePoolP : public UniRefBase +{ + friend class Test; + friend class SvXMLAutoStylePoolP_Impl; + + SvXMLAutoStylePoolP_Impl *pImpl; + +protected: + + virtual void exportStyleAttributes( + SvXMLAttributeList& rAttrList, + sal_Int32 nFamily, + const ::std::vector< XMLPropertyState >& rProperties, + const SvXMLExportPropertyMapper& rPropExp + , const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap + ) const; + +// this methode is executed after Properties Export, so you can e.g. export a map or so on + virtual void exportStyleContent( + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler, + sal_Int32 nFamily, + const ::std::vector< XMLPropertyState >& rProperties, + const SvXMLExportPropertyMapper& rPropExp + , const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap + ) const; + + +public: + + SvXMLAutoStylePoolP( SvXMLExport& rExport); + + virtual ~SvXMLAutoStylePoolP(); + + SvXMLExport& GetExport() const; + + /** register a new family with its appropriate instance of a derivation of XMLPropertySetMapper + for family numbers see families.hxx + if bAsFamily is sal_False, the family name is used as element name + */ + // TODO: Remove this ugly method as soon as possible + void AddFamily( sal_Int32 nFamily, const OUString& rStrName, SvXMLExportPropertyMapper* pMapper, OUString aStrPrefix, sal_Bool bAsFamily = sal_True ); + void AddFamily( sal_Int32 nFamily, const OUString& rStrName, + const UniReference< SvXMLExportPropertyMapper >& rMapper, + const OUString& rStrPrefix, sal_Bool bAsFamily = sal_True ); + void SetFamilyPropSetMapper( sal_Int32 nFamily, + const UniReference< SvXMLExportPropertyMapper >& rMapper ); + + /// Register a name that must not be used as a generated name. + void RegisterName( sal_Int32 nFamily, const OUString& rName ); + + /// retrieve the registered names (names + families) + void GetRegisteredNames( + com::sun::star::uno::Sequence<sal_Int32>& aFamilies, + com::sun::star::uno::Sequence<OUString>& aNames ); + + /// register (families + names) + void RegisterNames( + com::sun::star::uno::Sequence<sal_Int32>& aFamilies, + com::sun::star::uno::Sequence<OUString>& aNames ); + + /// Add an item set to the pool and return its generated name. + OUString Add( sal_Int32 nFamily, const ::std::vector< XMLPropertyState >& rProperties ); + OUString Add( sal_Int32 nFamily, const OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties, bool bDontSeek = false ); + sal_Bool Add( OUString& rName, sal_Int32 nFamily, const OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties ); + + /// Add an item set with a pre-defined name (needed for saving sheets separately in Calc). + sal_Bool AddNamed( const OUString& rName, sal_Int32 nFamily, const OUString& rParent, + const ::std::vector< XMLPropertyState >& rProperties ); + + /// Find an item set's name. + OUString Find( sal_Int32 nFamily, const OUString& rParent, const ::std::vector< XMLPropertyState >& rProperties ) const; + + /** Export all item sets ofs a certain class in the order in that they have been added. */ + void exportXML( sal_Int32 nFamily + , const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler, + const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap + ) const; + + void ClearEntries(); +}; + +#endif // _XMLOFF_XMLASTPLP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlcnimp.hxx b/include/xmloff/xmlcnimp.hxx new file mode 100644 index 000000000000..f99c0a55ad73 --- /dev/null +++ b/include/xmloff/xmlcnimp.hxx @@ -0,0 +1,74 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLCNIMP_HXX +#define _XMLOFF_XMLCNIMP_HXX + +#include "xmloff/dllapi.h" //XMLOFF_DLLPUBLIC +#include <sal/types.h> //sal_uInt16 and sal_Bool +#include <boost/scoped_ptr.hpp> + +class SvXMLAttrCollection; //Forward declaration only. + +class XMLOFF_DLLPUBLIC SvXMLAttrContainerData +{ +private: + boost::scoped_ptr<SvXMLAttrCollection> pimpl; + +public: + SvXMLAttrContainerData(); + SvXMLAttrContainerData(const SvXMLAttrContainerData &rCopy); + ~SvXMLAttrContainerData(); + + int operator ==( const SvXMLAttrContainerData& rCmp ) const; + + sal_Bool AddAttr( const OUString& rLName, const OUString& rValue ); + sal_Bool AddAttr( const OUString& rPrefix, const OUString& rNamespace, + const OUString& rLName, const OUString& rValue ); + sal_Bool AddAttr( const OUString& rPrefix, + const OUString& rLName, + const OUString& rValue ); + + size_t GetAttrCount() const; + const OUString GetAttrNamespace( size_t i ) const; + const OUString GetAttrPrefix( size_t i ) const; + const OUString& GetAttrLName( size_t i ) const; + const OUString& GetAttrValue( size_t i ) const; + + sal_uInt16 GetFirstNamespaceIndex() const; + sal_uInt16 GetNextNamespaceIndex( sal_uInt16 nIdx ) const; + const OUString& GetNamespace( sal_uInt16 i ) const; + const OUString& GetPrefix( sal_uInt16 i ) const; + + sal_Bool SetAt( size_t i, + const OUString& rLName, const OUString& rValue ); + sal_Bool SetAt( size_t i, + const OUString& rPrefix, const OUString& rNamespace, + const OUString& rLName, const OUString& rValue ); + sal_Bool SetAt( size_t i, + const OUString& rPrefix, + const OUString& rLName, + const OUString& rValue ); + + void Remove( size_t i ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlement.hxx b/include/xmloff/xmlement.hxx new file mode 100644 index 000000000000..ecf90373f30a --- /dev/null +++ b/include/xmloff/xmlement.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLEMENT_HXX +#define _XMLOFF_XMLEMENT_HXX + +#include <sal/types.h> +#include <xmloff/xmltoken.hxx> + +/** Map an XMLTokenEnum to a sal_uInt16 value. + * To be used with SvXMLUnitConverter::convertEnum(...) + */ +struct SvXMLEnumMapEntry +{ + ::xmloff::token::XMLTokenEnum eToken; + sal_uInt16 nValue; +}; + +#define ENUM_STRING_MAP_ENTRY(name,tok) { name, sizeof(name)-1, tok } + +#define ENUM_STRING_MAP_END() { NULL, 0, 0 } + +/** Map a const sal_Char* (with length) to a sal_uInt16 value. + * To be used with SvXMLUnitConverter::convertEnum(...) + */ +struct SvXMLEnumStringMapEntry +{ + const sal_Char * pName; + sal_Int32 nNameLength; + sal_uInt16 nValue; +}; + +#endif // _XMLOFF_XMLEMENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlerror.hxx b/include/xmloff/xmlerror.hxx new file mode 100644 index 000000000000..78ecbe914850 --- /dev/null +++ b/include/xmloff/xmlerror.hxx @@ -0,0 +1,147 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLERROR_HXX +#define _XMLOFF_XMLERROR_HXX + +#include <com/sun/star/xml/sax/SAXParseException.hpp> +#include <sal/types.h> + +// STL includes +#include <vector> + + + +// masks for the error ID fields +#define XMLERROR_MASK_FLAG 0xF0000000 +#define XMLERROR_MASK_CLASS 0x00FF0000 +#define XMLERROR_MASK_NUMBER 0x0000FFFF + +// error flags: +#define XMLERROR_FLAG_WARNING 0x10000000 +#define XMLERROR_FLAG_ERROR 0x20000000 +#define XMLERROR_FLAG_SEVERE 0x40000000 + +// error classes: Error ID +#define XMLERROR_CLASS_IO 0x00010000 +#define XMLERROR_CLASS_FORMAT 0x00020000 +#define XMLERROR_CLASS_API 0x00040000 +#define XMLERROR_CLASS_OTHER 0x00080000 + + +// error numbers, listed by error class +// Within each class, errors should be numbered consecutively. Please +// always add to error code below the appropriate comment. + +// I/O errors: + +// format errors: +#define XMLERROR_SAX ( XMLERROR_CLASS_FORMAT | 0x00000001 ) +#define XMLERROR_STYLE_ATTR_VALUE ( XMLERROR_CLASS_FORMAT | 0x00000002 ) +#define XMLERROR_NO_INDEX_ALLOWED_HERE ( XMLERROR_CLASS_FORMAT | 0x00000003 ) +#define XMLERROR_PARENT_STYLE_NOT_ALLOWED ( XMLERROR_CLASS_FORMAT | 0x00000004 ) +#define XMLERROR_ILLEGAL_EVENT (XMLERROR_CLASS_FORMAT | 0x00000005 ) +#define XMLERROR_NAMESPACE_TROUBLE (XMLERROR_CLASS_FORMAT | 0x00000006 ) + +#define XMLERROR_XFORMS_NO_SCHEMA_SUPPORT ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x00000007 ) +#define XMLERROR_XFORMS_UNKNOWN ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x00000008 ) +#define XMLERROR_XFORMS_ONLY_ONE_INSTANCE_ELEMENT ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x00000009 ) +#define XMLERROR_UNKNOWN_ATTRIBUTE ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x0000000a ) +#define XMLERROR_UNKNOWN_ELEMENT ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x0000000b ) +#define XMLERROR_UNKNOWN_CHARACTERS ( XMLERROR_CLASS_FORMAT | XMLERROR_FLAG_WARNING | 0x0000000c ) +#define XMLERROR_UNKNOWN_ROOT (XMLERROR_CLASS_FORMAT | 0x0000000d ) + +// API errors: +#define XMLERROR_STYLE_PROP_VALUE ( XMLERROR_CLASS_API | 0x00000001 ) +#define XMLERROR_STYLE_PROP_UNKNOWN ( XMLERROR_CLASS_API | 0x00000002 ) +#define XMLERROR_STYLE_PROP_OTHER ( XMLERROR_CLASS_API | 0x00000003 ) +#define XMLERROR_API ( XMLERROR_CLASS_API | 0x00000004 ) + +// other errors: +#define XMLERROR_CANCEL ( XMLERROR_CLASS_OTHER | 0x00000001 ) + + + +// 16bit error flag constants for use in the +// SvXMLExport/SvXMLImport error flags +#define ERROR_NO 0x0000 +#define ERROR_DO_NOTHING 0x0001 +#define ERROR_ERROR_OCCURRED 0x0002 +#define ERROR_WARNING_OCCURRED 0x0004 + + + + +// forward declarations +namespace com { namespace sun { namespace star { + namespace uno { template<class X> class Sequence; } + namespace uno { template<class X> class Reference; } + namespace xml { namespace sax { class XLocator; } } +} } } +class ErrorRecord; + + + +/** + * The XMLErrors is used to collect all errors and warnings that occur + * for appropriate processing. + */ +class XMLErrors +{ + /// definition of type for error list + typedef ::std::vector<ErrorRecord> ErrorList; + + ErrorList aErrors; /// list of error records + +public: + + XMLErrors(); + ~XMLErrors(); + + /// add a new entry to the list of error messages + void AddRecord( + sal_Int32 nId, /// error ID == error flags + error class + error number + const ::com::sun::star::uno::Sequence< + OUString> & rParams, /// parameters for error message + const OUString& rExceptionMessage, /// original exception string + sal_Int32 nRow, /// XLocator: file row number + sal_Int32 nColumn, /// XLocator: file column number + const OUString& rPublicId, /// XLocator: file public ID + const OUString& rSystemId ); /// XLocator: file system ID + + void AddRecord( + sal_Int32 nId, /// error ID == error flags + error class + error number + const ::com::sun::star::uno::Sequence< + OUString> & rParams, /// parameters for error message + const OUString& rExceptionMessage, /// original exception string + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XLocator> & rLocator); /// location + + /** + * throw a SAXParseException that describes the first error that matches + * the given mask + */ + void ThrowErrorAsSAXException( sal_Int32 nIdMask ) + throw( ::com::sun::star::xml::sax::SAXParseException ); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlevent.hxx b/include/xmloff/xmlevent.hxx new file mode 100644 index 000000000000..9738a58fc30f --- /dev/null +++ b/include/xmloff/xmlevent.hxx @@ -0,0 +1,145 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLEVENT_HXX +#define _XMLOFF_XMLEVENT_HXX + +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Reference.hxx> + + +/** + * @#file + * + * Several definition used in im- and export of events + */ + +namespace com { namespace sun { namespace star { + namespace xml { namespace sax { class XAttributeList; } } + namespace beans { struct PropertyValue; } +} } } + +class SvXMLExport; +class SvXMLImportContext; +class SvXMLImport; +class XMLEventsImportContext; + + +struct XMLEventName +{ + sal_uInt16 m_nPrefix; + OUString m_aName; + + XMLEventName() : m_nPrefix( 0 ) {} + XMLEventName( sal_uInt16 n, const sal_Char *p ) : + m_nPrefix( n ), + m_aName( OUString::createFromAscii(p) ) + {} + + XMLEventName( sal_uInt16 n, const OUString& r ) : + m_nPrefix( n ), + m_aName( r ) + {} + + bool operator<( const XMLEventName& r ) const + { + return m_nPrefix < r.m_nPrefix || + (m_nPrefix == r.m_nPrefix && m_aName < r.m_aName ); + } + +}; + +/** + * XMLEventNameTranslation: define tables that translate between event names + * as used in the XML file format and in the StarOffice API. + * The last entry in the table must be { NULL, 0, NULL }. + */ +struct XMLEventNameTranslation +{ + const sal_Char* sAPIName; + sal_uInt16 nPrefix; // namespace prefix + const sal_Char* sXMLName; +}; + +/// a translation table for the events defined in the XEventsSupplier service +/// (implemented in XMLEventExport.cxx) +extern const XMLEventNameTranslation aStandardEventTable[]; + + +/** + * Handle export of an event for a certain event type (event type as + * defined by the PropertyValue "EventType" in API). + * + * The Handler has to generate the full <script:event> element. + */ +class XMLEventExportHandler +{ +public: + virtual ~XMLEventExportHandler() {}; + + virtual void Export( + SvXMLExport& rExport, /// the current XML export + const OUString& rEventQName, /// the XML name of the event + ::com::sun::star::uno::Sequence< /// the values for the event + ::com::sun::star::beans::PropertyValue> & rValues, + sal_Bool bUseWhitespace) = 0; /// create whitespace around elements? +}; + + +/** + * Handle import of an event for a certain event type (as defined by + * the PropertyValue "EventType" in the API). + * + * EventContextFactories must be registered with the EventImportHelper + * that is attached to the SvXMLImport. + * + * The factory has to create an import context for a <script:event> + * element. The context has to call the + * EventsImportContext::AddEventValues() method to fave its event + * registered with the enclosing element. For events consisting only + * of attributes (and an empty element) an easy solution is to handle + * all attributes in the CreateContext()-method and return a default + * context. + * + * EventContextFactory objects have to be registered with the + * EventsImportHelper. + */ +class XMLEventContextFactory +{ +public: + virtual ~XMLEventContextFactory() {}; + + virtual SvXMLImportContext* CreateContext( + SvXMLImport& rImport, /// import context + sal_uInt16 nPrefix, /// element: namespace prefix + const OUString& rLocalName, /// element: local name + const ::com::sun::star::uno::Reference< /// attribute list + ::com::sun::star::xml::sax::XAttributeList> & xAttrList, + /// the context for the enclosing <script:events> element + XMLEventsImportContext* rEvents, + /// the event name (as understood by the API) + const OUString& rApiEventName, + /// the event type name (as registered) + const OUString& rApiLanguage) = 0; +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlexp.hxx b/include/xmloff/xmlexp.hxx new file mode 100644 index 000000000000..148f73692158 --- /dev/null +++ b/include/xmloff/xmlexp.hxx @@ -0,0 +1,659 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLEXP_HXX +#define _XMLOFF_XMLEXP_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include "sal/types.h" + +#include <com/sun/star/embed/XStorage.hpp> +#include <com/sun/star/xml/sax/SAXParseException.hpp> +#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> +#include <com/sun/star/xml/sax/SAXException.hpp> +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <com/sun/star/xml/sax/XLocator.hpp> +#include <com/sun/star/util/XNumberFormatsSupplier.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <rtl/ustring.hxx> +#include <xmloff/txtparae.hxx> +#include <xmloff/formlayerexport.hxx> +#include <xmloff/xmlnumfe.hxx> +#include <xmloff/xmlaustp.hxx> +#include <xmloff/shapeexport.hxx> +#include <xmloff/xmltoken.hxx> +#include <xmloff/SchXMLExportHelper.hxx> +#include <xmloff/XMLFontAutoStylePool.hxx> +#include <com/sun/star/document/XFilter.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/document/XExporter.hpp> +#include <com/sun/star/document/XGraphicObjectResolver.hpp> +#include <com/sun/star/document/XEmbeddedObjectResolver.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/container/XNamed.hpp> + +#include <unotools/saveopt.hxx> + +#include <xmloff/XMLPageExport.hxx> +#include <xmloff/ProgressBarHelper.hxx> +#include <cppuhelper/implbase6.hxx> + +#include <list> + +class SvXMLNamespaceMap; +class SvXMLAttributeList; +class SvXMLExport_Impl; +class SvXMLUnitConverter; +class ProgressBarHelper; +class XMLEventExport; +class XMLSettingsExportHelper; +class XMLImageMapExport; +class XMLErrors; + +// Shapes in Writer cannot be named via context menu (#i51726#) +#include <unotools/moduleoptions.hxx> + +namespace com { namespace sun { namespace star { + namespace frame { class XModel; } + namespace container { class XIndexContainer; } +} } } +namespace comphelper { class UnoInterfaceToUniqueIdentifierMapper; } + +#define EXPORT_META 0x0001 +#define EXPORT_STYLES 0x0002 +#define EXPORT_MASTERSTYLES 0x0004 +#define EXPORT_AUTOSTYLES 0x0008 +#define EXPORT_CONTENT 0x0010 +#define EXPORT_SCRIPTS 0x0020 +#define EXPORT_SETTINGS 0x0040 +#define EXPORT_FONTDECLS 0x0080 +#define EXPORT_EMBEDDED 0x0100 +#define EXPORT_NODOCTYPE 0x0200 +#define EXPORT_PRETTY 0x0400 +#define EXPORT_SAVEBACKWARDCOMPATIBLE 0x0800 +#define EXPORT_OASIS 0x8000 +#define EXPORT_ALL 0x7fff + +class XMLOFF_DLLPUBLIC SvXMLExport : public ::cppu::WeakImplHelper6< + ::com::sun::star::document::XFilter, + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::document::XExporter, + ::com::sun::star::lang::XInitialization, + ::com::sun::star::container::XNamed, + ::com::sun::star::lang::XUnoTunnel> +{ + SvXMLExport_Impl *mpImpl; // dummy + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; + + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler; // the handlers + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > mxExtHandler; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > mxNumberFormatsSupplier; + ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver > mxGraphicResolver; + ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedObjectResolver > mxEmbeddedResolver; + ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > mxStatusIndicator; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxExportInfo; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > mxEventListener; + + SvXMLAttributeList *mpAttrList; // a common attribute list + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > mxAttrList; // and an interface of it + + OUString msOrigFileName; // the original URL + OUString msGraphicObjectProtocol; + OUString msEmbeddedObjectProtocol; + OUString msFilterName; + SvXMLNamespaceMap *mpNamespaceMap; // the namepspace map + SvXMLUnitConverter *mpUnitConv; // the unit converter + SvXMLNumFmtExport *mpNumExport; + ProgressBarHelper *mpProgressBarHelper; + + UniReference< XMLTextParagraphExport > mxTextParagraphExport; + UniReference< XMLShapeExport > mxShapeExport; + UniReference< SvXMLAutoStylePoolP > mxAutoStylePool; + UniReference< SchXMLExportHelper > mxChartExport; + UniReference< XMLPageExport > mxPageExport; + UniReference< XMLFontAutoStylePool > mxFontAutoStylePool; + UniReference< xmloff::OFormLayerXMLExport > mxFormExport; + XMLEventExport* mpEventExport; + XMLImageMapExport* mpImageMapExport; + XMLErrors* mpXMLErrors; + + sal_Bool mbExtended; // Does document contain extens. + + const enum ::xmloff::token::XMLTokenEnum meClass; + SAL_DLLPRIVATE void _InitCtor(); + + sal_uInt16 mnExportFlags; + sal_uInt16 mnErrorFlags; + bool mbEnableExperimentalOdfExport; + +public: + + const OUString msWS; // " " + +private: + + // Shapes in Writer cannot be named via context menu (#i51726#) + SvtModuleOptions::EFactory meModelType; + SAL_DLLPRIVATE void _DetermineModelType(); + + SAL_DLLPRIVATE void ImplExportMeta(); // <office:meta> + SAL_DLLPRIVATE void ImplExportSettings(); // <office:settings> + SAL_DLLPRIVATE void ImplExportStyles( sal_Bool bUsed ); // <office:styles> + SAL_DLLPRIVATE void ImplExportAutoStyles( sal_Bool bUsed ); + // <office:automatic-styles> + SAL_DLLPRIVATE void ImplExportMasterStyles( sal_Bool bUsed ); + // <office:master-styles> + SAL_DLLPRIVATE void ImplExportContent(); // <office:body> + virtual void SetBodyAttributes(); + void GetViewSettingsAndViews(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rProps); + +protected: + void setExportFlags( sal_uInt16 nExportFlags ) { mnExportFlags = nExportFlags; } + + // Get (modifyable) namespace map + SvXMLNamespaceMap& _GetNamespaceMap() { return *mpNamespaceMap; } + + // get a new namespave map (used in starmath to have a default namespace) + void ResetNamespaceMap(); + + // This method can be overloaded to export the content of <office:meta>. + // There is a default implementation. + virtual void _ExportMeta(); + + // This method can be overloaded to export the content of <office:scripts>. + // There is a default implementation. + virtual void _ExportScripts(); + + // This method can be overloaded to export the font declarations + // The default implementation will export the contents of the + // XMLFontAutoStylePool if it has been created. + virtual void _ExportFontDecls(); + + // This method should be overloaded to export the content of <style:styles>. + // If bUsed is set, used styles should be exported only. + // Overloaded Methods must call this method ! + virtual void _ExportStyles( sal_Bool bUsed ) ; + + // This method must be overloaded to export the contents of + // <style:auto-styles> + virtual void _ExportAutoStyles() = 0; + + // This method must be overloaded to export the contents of + // <style:master-styles> + virtual void _ExportMasterStyles() = 0; + + // This method must be overloaded to export the content of <office:body>. + virtual void _ExportContent() = 0; + + void SetExtended( sal_Bool bSet=sal_True ) { mbExtended = bSet; } + + // save linked sections? (may be false in global documents) + sal_Bool mbSaveLinkedSections; + + virtual XMLTextParagraphExport* CreateTextParagraphExport(); + virtual XMLShapeExport* CreateShapeExport(); + virtual SvXMLAutoStylePoolP* CreateAutoStylePool(); + virtual SchXMLExportHelper* CreateChartExport(); + virtual XMLPageExport* CreatePageExport(); + virtual XMLFontAutoStylePool* CreateFontAutoStylePool(); + virtual xmloff::OFormLayerXMLExport* CreateFormExport(); + virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps); + virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps); + + struct SettingsGroup + { + ::xmloff::token::XMLTokenEnum eGroupName; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aSettings; + + SettingsGroup() + :eGroupName( ::xmloff::token::XML_TOKEN_INVALID ) + ,aSettings() + { + } + + SettingsGroup( + const ::xmloff::token::XMLTokenEnum _eGroupName, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rSettings ) + :eGroupName( _eGroupName ) + ,aSettings( _rSettings ) + { + } + }; + /** returns the current document settings + + The default implementation will obtain the view settings by calling GetViewSettingsAndViews, and the + configuration settings by calling GetConfigurationSettings, and return them together with the proper XML token. + + @return + the accumulated count of all settings in all groups + */ + virtual sal_Int32 GetDocumentSpecificSettings( ::std::list< SettingsGroup >& _out_rSettings ); + + const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedObjectResolver >& GetEmbeddedResolver() const { return mxEmbeddedResolver; } + inline void SetEmbeddedResolver( com::sun::star::uno::Reference< com::sun::star::document::XEmbeddedObjectResolver >& _xEmbeddedResolver ); + + const ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver >& GetGraphicResolver() const { return mxGraphicResolver; } + void SetGraphicResolver( com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& _xGraphicResolver ); + + void SetDocHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > &rHandler ); + +public: + + SvXMLExport( + sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, + const enum ::xmloff::token::XMLTokenEnum eClass = xmloff::token::XML_TOKEN_INVALID, + sal_uInt16 nExportFlag = EXPORT_ALL ); + + SvXMLExport( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, + const OUString& rFileName, + sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler); + + SvXMLExport( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, + const OUString& rFileName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &, + sal_Int16 const eDefaultFieldUnit ); + + virtual ~SvXMLExport(); + + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); + static SvXMLExport* getImplementation( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > ) throw(); + + // XExporter + virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + // XFilter + virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL cancel() throw(::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XNamed + virtual OUString SAL_CALL getName( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + /** ensures that the given namespace is in scope at the next started + element. + + <p>If the namespace is not yet declared, the necessary attribute will + be added, as well.</p> + + @param i_rNamespace the namespace to be declared + @param i_rPreferredPrefix (opt.) preferred prefix for the namespace + + @returns the actual prefix that the namespace is associated with + */ + OUString EnsureNamespace(OUString const & i_rNamespace, + OUString const & i_rPreferredPrefix = OUString("gen") ); + + // Check if common attribute list is empty. +#ifndef DBG_UTIL + void CheckAttrList() {} +#else + void CheckAttrList(); +#endif + + // Clear common attribute list. + void ClearAttrList(); + + // Add an attribute to the common attribute list. + void AddAttributeASCII( sal_uInt16 nPrefix, const sal_Char *pName, + const sal_Char *pValue ); + void AddAttribute( sal_uInt16 nPrefix, const sal_Char *pName, + const OUString& rValue ); + void AddAttribute( sal_uInt16 nPrefix, const OUString& rName, + const OUString& rValue ); + void AddAttribute( sal_uInt16 nPrefix, + enum ::xmloff::token::XMLTokenEnum eName, + const OUString& rValue ); + void AddAttribute( sal_uInt16 nPrefix, + enum ::xmloff::token::XMLTokenEnum eName, + enum ::xmloff::token::XMLTokenEnum eValue ); + void AddAttribute( const OUString& rQName, + const OUString& rValue ); + void AddAttribute( const OUString& rQName, + enum ::xmloff::token::XMLTokenEnum eValue ); + // add several attributes to the common attribute list + void AddAttributeList( const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + // Get common attribute list as implementation or interface. + SvXMLAttributeList &GetAttrList() { return *mpAttrList; } + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & GetXAttrList() { return mxAttrList; } + + // Get document handler. This methods are not const, because the + // reference allowes modifications through the handler. + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & GetDocHandler() { return mxHandler; } + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XExtendedDocumentHandler > & GetExtDocHandler() + { + return mxExtHandler; + } + + // Get original ::com::sun::star::util::URL. + const OUString& GetOrigFileName() const { return msOrigFileName; } + + // Get (const) namespace map. + const SvXMLNamespaceMap& GetNamespaceMap() const { return *mpNamespaceMap; } + + // Get unit converter + const SvXMLUnitConverter& GetMM100UnitConverter() const { return *mpUnitConv; } + + SvXMLUnitConverter& GetMM100UnitConverter() { return *mpUnitConv; } + + void addChaffWhenEncryptedStorage(); + + // Export the document. + virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ); + + virtual void addDataStyle(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat = sal_False ); + virtual void exportDataStyles(); + virtual void exportAutoDataStyles(); + virtual OUString getDataStyleName(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat = sal_False ) const; + sal_Int32 dataStyleForceSystemLanguage(sal_Int32 nFormat) const; + + virtual void exportAnnotationMeta( const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape); + + // Get XModel + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & + GetModel() const { return mxModel; } + // Get XNumberFormatsSupplier + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & GetNumberFormatsSupplier() { return mxNumberFormatsSupplier; } + inline void SetNumberFormatsSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& _xNumberFormatSupplier) + { + mxNumberFormatsSupplier = _xNumberFormatSupplier; + if ( mxNumberFormatsSupplier.is() && mxHandler.is() ) + mpNumExport = new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier); + } + + // get export helper for text + inline UniReference< XMLTextParagraphExport > GetTextParagraphExport(); + + // get export helper for shapes + inline UniReference< XMLShapeExport > GetShapeExport(); + + // get auto style pool + inline UniReference< SvXMLAutoStylePoolP > GetAutoStylePool(); + + // get Page Export + inline UniReference< XMLPageExport > GetPageExport(); + + // get chart export helper + inline UniReference< SchXMLExportHelper > GetChartExport(); + + // get font auto style pool + inline UniReference< XMLFontAutoStylePool > GetFontAutoStylePool(); + + ProgressBarHelper* GetProgressBarHelper(); + + // get Formlayer Export + inline UniReference< xmloff::OFormLayerXMLExport > GetFormExport(); + inline bool HasFormExport(); + + // get XPropertySet with export information + inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getExportInfo() const { return mxExportInfo; } + + com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > GetStatusIndicator() { return mxStatusIndicator; } + + /// get Event export, with handlers for script types "None" and + /// "StarBasic" already registered; other handlers may be registered, too. + XMLEventExport& GetEventExport(); + + /// get the export for image maps + XMLImageMapExport& GetImageMapExport(); + + OUString AddEmbeddedGraphicObject( + const OUString& rGraphicObjectURL ); + sal_Bool AddEmbeddedGraphicObjectAsBase64( + const OUString& rGraphicObjectURL ); + + OUString AddEmbeddedObject( + const OUString& rEmbeddedObjectURL ); + sal_Bool AddEmbeddedObjectAsBase64( + const OUString& rEmbeddedObjectURL ); + + OUString EncodeStyleName( const OUString& rName, + sal_Bool *pEncoded=0 ) const; + + // save linked sections? + inline sal_Bool IsSaveLinkedSections() { return mbSaveLinkedSections; } + + // get export flags + sal_uInt16 getExportFlags() const { return mnExportFlags; } + + sal_Bool ExportEmbeddedOwnObject( + ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XComponent >& rComp ); + + OUString GetRelativeReference(const OUString& rValue); + + // methods for accessing the document handler and handling SAX errors + void StartElement(sal_uInt16 nPrefix, + enum ::xmloff::token::XMLTokenEnum eName, + sal_Bool bIgnWSOutside ); + void StartElement(const OUString& rName, + sal_Bool bIgnWSOutside ); + void Characters(const OUString& rChars); + void EndElement(sal_uInt16 nPrefix, + enum ::xmloff::token::XMLTokenEnum eName, + sal_Bool bIgnWSInside ); + void EndElement(const OUString& rName, + sal_Bool bIgnWSInside ); + void IgnorableWhitespace(); + + /** + * Record an error condition that occurred during export. The + * behavior of SetError can be modified using the error flag + * constants. + */ + void SetError( + /// error ID, may contain an error flag + sal_Int32 nId, + /// string parameters for the error message + const ::com::sun::star::uno::Sequence< OUString> & rMsgParams, + /// original exception message (if applicable) + const OUString& rExceptionMessage, + /// error location (if applicable) + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XLocator> & rLocator ); + + void SetError( + sal_Int32 nId, + const ::com::sun::star::uno::Sequence< OUString> & rMsgParams); + + /** return current error flags (logical 'or' of all error flags so far) */ + sal_uInt16 GetErrorFlags() { return mnErrorFlags; } + + virtual void DisposingModel(); + + ::comphelper::UnoInterfaceToUniqueIdentifierMapper& getInterfaceToIdentifierMapper(); + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getComponentContext(); + + // Shapes in Writer cannot be named via context menu (#i51726#) + SvtModuleOptions::EFactory GetModelType() const + { + return meModelType; + } + + // Written OpenDocument file format doesn't fit to the created text document (#i69627#) + sal_Bool writeOutlineStyleAsNormalListStyle() const; + bool isExperimentalOdfExportEnabled() const { return mbEnableExperimentalOdfExport; } + + ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetTargetStorage(); + + /// returns the currently configured default version for odf export + SvtSaveOptions::ODFDefaultVersion getDefaultVersion() const; + + /// name of stream in package, e.g., "content.xml" + OUString GetStreamName() const; + + // FIXME: this is only for legacy stuff that has not yet been adapted + // to implement XMetadatable; this can write duplicate IDs! + /// add xml:id and legacy namespace id + void SAL_DLLPRIVATE AddAttributeIdLegacy( + sal_uInt16 const nLegacyPrefix, OUString const& rValue); + + /// add xml:id attribute (for RDF metadata) + void AddAttributeXmlId(::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface> const & i_xIfc); + + /// add RDFa attributes for a metadatable text content + void AddAttributesRDFa( ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextContent> const & i_xTextContent); + + sal_Bool exportTextNumberElement() const; + + /// set null date from model to unit converter, if not already done + sal_Bool SetNullDateOnUnitConverter(); +}; + +inline UniReference< XMLTextParagraphExport > SvXMLExport::GetTextParagraphExport() +{ + if( !mxTextParagraphExport.is() ) + mxTextParagraphExport = CreateTextParagraphExport(); + + return mxTextParagraphExport; +} + +inline UniReference< XMLShapeExport > SvXMLExport::GetShapeExport() +{ + if( !mxShapeExport.is() ) + mxShapeExport = CreateShapeExport(); + + return mxShapeExport; +} + +inline UniReference< SvXMLAutoStylePoolP > SvXMLExport::GetAutoStylePool() +{ + if( !mxAutoStylePool.is() ) + mxAutoStylePool = CreateAutoStylePool(); + + return mxAutoStylePool; +} + +inline UniReference< SchXMLExportHelper > SvXMLExport::GetChartExport() +{ + if( !mxChartExport.is() ) + mxChartExport = CreateChartExport(); + + return mxChartExport; +} + +inline UniReference< XMLPageExport > SvXMLExport::GetPageExport() +{ + if( !mxPageExport.is() ) + mxPageExport = CreatePageExport(); + + return mxPageExport; +} + +inline UniReference< XMLFontAutoStylePool > SvXMLExport::GetFontAutoStylePool() +{ + if( !mxFontAutoStylePool.is() ) + mxFontAutoStylePool = CreateFontAutoStylePool(); + + return mxFontAutoStylePool; +} + +inline UniReference< xmloff::OFormLayerXMLExport > SvXMLExport::GetFormExport() +{ + if( !mxFormExport.is() ) + mxFormExport = CreateFormExport(); + + return mxFormExport; +} + +inline bool SvXMLExport::HasFormExport() +{ + return mxFormExport.is(); +} + +inline void SvXMLExport::SetEmbeddedResolver( + com::sun::star::uno::Reference< com::sun::star::document::XEmbeddedObjectResolver >& _xEmbeddedResolver ) +{ + mxEmbeddedResolver = _xEmbeddedResolver; +} + +inline void SvXMLExport::SetGraphicResolver( + com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& _xGraphicResolver ) +{ + mxGraphicResolver = _xGraphicResolver; +} + +// Helper class to export an element. +class XMLOFF_DLLPUBLIC SvXMLElementExport +{ + SvXMLExport& rExport; + OUString aName; + sal_Bool bIgnWS : 1; + sal_Bool bDoSomething : 1; + + SAL_DLLPRIVATE void StartElement( SvXMLExport& rExp, sal_uInt16 nPrefix, + const OUString& rName, + sal_Bool bIgnWSOutside ); + +public: + + // The constructor prints a start tag that has the common attributes + // of the XMLExport instance attached. + SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix, + const sal_Char *pName, + sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside ); + SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix, + const OUString& rName, + sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside ); + SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix, + enum ::xmloff::token::XMLTokenEnum eName, + sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside ); + SvXMLElementExport( SvXMLExport& rExp, const OUString& rQName, + sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside ); + + // Thes constructors do nothing if bDoSomething is not set + SvXMLElementExport( SvXMLExport& rExp, sal_Bool bDoSomething, + sal_uInt16 nPrefix, + enum ::xmloff::token::XMLTokenEnum eName, + sal_Bool bIgnWSOutside, sal_Bool bIgnWSInside ); + + // The destructor prints an end tag. + ~SvXMLElementExport(); +}; + +#endif // _XMLOFF_SVXMLEXP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlexppr.hxx b/include/xmloff/xmlexppr.hxx new file mode 100644 index 000000000000..7e7bb7658903 --- /dev/null +++ b/include/xmloff/xmlexppr.hxx @@ -0,0 +1,188 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLEXPPR_HXX +#define _XMLOFF_XMLEXPPR_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <xmloff/xmlprmap.hxx> +#include <xmloff/uniref.hxx> + + +class SvXMLUnitConverter; +class SvXMLAttributeList; +class SvXMLNamespaceMap; +class FilterPropertiesInfos_Impl; +class SvXMLExport; + +#define XML_EXPORT_FLAG_DEFAULTS 0x0001 // export also default items +#define XML_EXPORT_FLAG_DEEP 0x0002 // export also items from + // parent item sets +#define XML_EXPORT_FLAG_EMPTY 0x0004 // export attribs element + // even if its empty +#define XML_EXPORT_FLAG_IGN_WS 0x0008 + +class XMLOFF_DLLPUBLIC SvXMLExportPropertyMapper : public UniRefBase +{ + UniReference< SvXMLExportPropertyMapper> mxNextMapper; + + FilterPropertiesInfos_Impl *pCache; + +protected: + UniReference< XMLPropertySetMapper > maPropMapper; + + OUString maStyleName; + + /** Filter all properties we don't want to export: + Take all properties of the XPropertySet which are also found in the + XMLPropertyMapEntry-array and which are not set directly (so, the value isn't + default and isn't inherited, apart from bDefault is true) + After this process It'll called 'Contextfilter' for application-specific + filter-processes. */ + ::std::vector< XMLPropertyState > _Filter( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > rPropSet, + const sal_Bool bDefault ) const; + + /** Application-specific filter. By default do nothing. */ + virtual void ContextFilter( + ::std::vector< XMLPropertyState >& rProperties, + ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > rPropSet ) const; + + /** fills the given attribute list with the items in the given set */ + void _exportXML( sal_uInt16 nPropType, sal_uInt16& rPropTypeFlags, + SvXMLAttributeList& rAttrList, + const ::std::vector< XMLPropertyState >& rProperties, + const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap, + sal_uInt16 nFlags, + std::vector<sal_uInt16>* pIndexArray, + sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx ) const; + + void _exportXML( SvXMLAttributeList& rAttrList, + const XMLPropertyState& rProperty, + const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap, + sal_uInt16 nFlags, + const ::std::vector< XMLPropertyState > *pProperties = 0, + sal_uInt32 nIdx = 0 ) const; + + void exportElementItems( + SvXMLExport& rExport, + const ::std::vector< XMLPropertyState >& rProperties, + sal_uInt16 nFlags, + const std::vector<sal_uInt16>& rIndexArray ) const; + +public: + + SvXMLExportPropertyMapper( + const UniReference< XMLPropertySetMapper >& rMapper ); + virtual ~SvXMLExportPropertyMapper(); + + // Add a ExportPropertyMapper at the end of the import mapper chain. + // The added mapper MUST not be used outside the Mapper chain any longer, + // because its PropertyMapper will be replaced. + void ChainExportMapper( + const UniReference< SvXMLExportPropertyMapper>& rMapper ); + + /** Filter all properties we don't want to export: + Take all properties of the XPropertySet which are also found in the + XMLPropertyMapEntry-array and which are not set directly (so, the value isn't + default and isn't inherited) + After this process It'll called 'Contextfilter' for application-specific + filter-processes. */ + ::std::vector< XMLPropertyState > Filter( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > rPropSet ) const + { return _Filter(rPropSet, sal_False); } + + /** Like Filter(), except that: + * - only properties that have the map flag MID_FLAG_DEFAULT_ITEM_EXPORT + * set are exported, + * - instead of the property's value, its default value is exported. + */ + ::std::vector< XMLPropertyState > FilterDefaults( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > rPropSet ) const + { return _Filter(rPropSet, sal_True); } + + /** Compare to arrays of XMLPropertyState */ + sal_Bool Equals( const ::std::vector< XMLPropertyState >& aProperties1, + const ::std::vector< XMLPropertyState >& aProperties2 ) const; + + /** fills the given attribute list with the items in the given set */ + void exportXML( + SvXMLAttributeList& rAttrList, + const ::std::vector< XMLPropertyState >& rProperties, + const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap, + sal_uInt16 nFlags = 0 ) const; + /** like above but only properties whose property map index is within the + specified range are exported */ + void exportXML( + SvXMLAttributeList& rAttrList, + const ::std::vector< XMLPropertyState >& rProperties, + const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap, + sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx, + sal_uInt16 nFlags = 0 ) const; + + void exportXML( + SvXMLExport& rExport, + const ::std::vector< XMLPropertyState >& rProperties, + sal_uInt16 nFlags = 0 ) const; + + /** like above but only properties whose property map index is within the + specified range are exported */ + void exportXML( + SvXMLExport& rExport, + const ::std::vector< XMLPropertyState >& rProperties, + sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx, + sal_uInt16 nFlags = 0 ) const; + + /** this method is called for every item that has the + MID_FLAG_ELEMENT_EXPORT flag set */ + virtual void handleElementItem( + SvXMLExport& rExport, + const XMLPropertyState& rProperty, + sal_uInt16 nFlags, + const ::std::vector< XMLPropertyState > *pProperties = 0, + sal_uInt32 nIdx = 0 ) const; + + /** this method is called for every item that has the + MID_FLAG_SPECIAL_ITEM_EXPORT flag set */ + virtual void handleSpecialItem( + SvXMLAttributeList& rAttrList, + const XMLPropertyState& rProperty, + const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap, + const ::std::vector< XMLPropertyState > *pProperties = 0, + sal_uInt32 nIdx = 0 ) const; + + inline const UniReference< XMLPropertySetMapper >& + getPropertySetMapper() const { return maPropMapper; } + + void SetStyleName( const OUString& rStyleName ) { maStyleName = rStyleName; } +}; + +#endif // _XMLOFF_XMLEXPPR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlictxt.hxx b/include/xmloff/xmlictxt.hxx new file mode 100644 index 000000000000..37903e4b4f8a --- /dev/null +++ b/include/xmloff/xmlictxt.hxx @@ -0,0 +1,101 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLICTXT_HXX +#define _XMLOFF_XMLICTXT_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include "sal/types.h" +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <tools/solar.h> +#include <tools/ref.hxx> +#include <rtl/ustring.hxx> +#include <tools/rtti.hxx> + +class SvXMLNamespaceMap; +class SvXMLImport; + +class XMLOFF_DLLPUBLIC SvXMLImportContext : public SvRefBase +{ + friend class SvXMLImport; + + SvXMLImport& mrImport; + + sal_uInt16 mnPrefix; + OUString maLocalName; + + SvXMLNamespaceMap *mpRewindMap; + + SAL_DLLPRIVATE SvXMLNamespaceMap *GetRewindMap() const + { return mpRewindMap; } + SAL_DLLPRIVATE void SetRewindMap( SvXMLNamespaceMap *p ) { mpRewindMap = p; } + +protected: + + SvXMLImport& GetImport() { return mrImport; } + const SvXMLImport& GetImport() const { return mrImport; } + +public: + TYPEINFO(); + + sal_uInt16 GetPrefix() const { return mnPrefix; } + const OUString& GetLocalName() const { return maLocalName; } + + // A contexts constructor does anything that is required if an element + // starts. Namespace processing has been done already. + // Note that virtual methods cannot be used inside constructors. Use + // StartElement instead if this is required. + SvXMLImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx, + const OUString& rLName ); + + // A contexts destructor does anything that is required if an element + // ends. By default, nothing is done. + // Note that virtual methods cannot be used inside destructors. Use + // EndElement instead if this is required. + virtual ~SvXMLImportContext(); + + // Create a children element context. By default, the import's + // CreateContext method is called to create a new default context. + virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + // StartElement is called after a context has been constructed and + // before a elements context is parsed. It may be used for actions that + // require virtual methods. The default is to do nothing. + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + // EndElement is called before a context will be destructed, but + // after a elements context has been parsed. It may be used for actions + // that require virtual methods. The default is to do nothing. + virtual void EndElement(); + + // This method is called for all characters that are contained in the + // current element. The default is to ignore them. + virtual void Characters( const OUString& rChars ); +}; + +SV_DECL_REF( SvXMLImportContext ) +SV_IMPL_REF( SvXMLImportContext ) + + +#endif // _XMLOFF_XMLICTXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx new file mode 100644 index 000000000000..750f56725aaf --- /dev/null +++ b/include/xmloff/xmlimp.hxx @@ -0,0 +1,525 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLIMP_HXX +#define _XMLOFF_XMLIMP_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include "sal/types.h" +#include <com/sun/star/embed/XStorage.hpp> +#include <com/sun/star/xml/sax/SAXParseException.hpp> +#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> +#include <com/sun/star/xml/sax/SAXException.hpp> +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <com/sun/star/xml/sax/XLocator.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/util/XNumberFormatsSupplier.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/document/XImporter.hpp> +#include <com/sun/star/document/XFilter.hpp> +#include <com/sun/star/document/XGraphicObjectResolver.hpp> +#include <com/sun/star/document/XEmbeddedObjectResolver.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <cppuhelper/weak.hxx> +#include <xmloff/txtimp.hxx> +#include <xmloff/shapeimport.hxx> +#include <xmloff/SchXMLImportHelper.hxx> +#include <xmloff/ProgressBarHelper.hxx> +#include <cppuhelper/implbase6.hxx> +#include <xmloff/formlayerimport.hxx> + +#include <com/sun/star/beans/NamedValue.hpp> + +namespace com { namespace sun { namespace star { + namespace frame { class XModel; } + namespace io { class XOutputStream; } + namespace rdf { class XMetadatable; } +} } } +namespace comphelper { class UnoInterfaceToUniqueIdentifierMapper; } + +class SvXMLNamespaceMap; +class SvXMLImportContext; +class SvXMLImportContexts_Impl; +class SvXMLImport_Impl; +class SvXMLUnitConverter; +class SvXMLNumFmtHelper; +class XMLFontStylesContext; +class XMLEventImportHelper; +class XMLErrors; +class StyleMap; + +namespace xmloff { + class RDFaImportHelper; +} + +#define IMPORT_META 0x0001 +#define IMPORT_STYLES 0x0002 +#define IMPORT_MASTERSTYLES 0x0004 +#define IMPORT_AUTOSTYLES 0x0008 +#define IMPORT_CONTENT 0x0010 +#define IMPORT_SCRIPTS 0x0020 +#define IMPORT_SETTINGS 0x0040 +#define IMPORT_FONTDECLS 0x0080 +#define IMPORT_EMBEDDED 0x0100 +#define IMPORT_OOO_NAMESPACES 0x0100 +#define IMPORT_ALL 0xffff + + + +class XMLOFF_DLLPUBLIC SvXMLImport : public ::cppu::WeakImplHelper6< + ::com::sun::star::xml::sax::XExtendedDocumentHandler, + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::lang::XInitialization, + ::com::sun::star::document::XImporter, + ::com::sun::star::document::XFilter, + ::com::sun::star::lang::XUnoTunnel> +{ + friend class SvXMLImportContext; + + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > mxLocator; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > mxNumberFormatsSupplier; + ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver > mxGraphicResolver; + ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedObjectResolver > mxEmbeddedResolver; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mxImportInfo; + + UniReference< XMLTextImportHelper > mxTextImport; + UniReference< XMLShapeImportHelper > mxShapeImport; + UniReference< SchXMLImportHelper > mxChartImport; + UniReference< ::xmloff::OFormLayerXMLImport > mxFormImport; + + SvXMLImportContextRef mxFontDecls; + SvXMLImportContextRef mxStyles; + SvXMLImportContextRef mxAutoStyles; + SvXMLImportContextRef mxMasterStyles; + + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxGradientHelper; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxHatchHelper; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxBitmapHelper; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxTransGradientHelper; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxMarkerHelper; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxDashHelper; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxNumberStyles; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > mxEventListener; + + SvXMLImport_Impl *mpImpl; // dummy + + SvXMLNamespaceMap *mpNamespaceMap; + SvXMLUnitConverter *mpUnitConv; + SvXMLImportContexts_Impl *mpContexts; + SvXMLNumFmtHelper *mpNumImport; + ProgressBarHelper *mpProgressBarHelper; + XMLEventImportHelper *mpEventImportHelper; + XMLErrors *mpXMLErrors; + StyleMap *mpStyleMap; + OUString msPackageProtocol; + + SAL_DLLPRIVATE void _InitCtor(); + + sal_uInt16 mnImportFlags; + sal_uInt16 mnErrorFlags; + std::set< OUString > embeddedFontUrlsKnown; + +protected: + + ::com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > mxStatusIndicator; + sal_Bool mbIsFormsSupported; + bool mbIsTableShapeSupported; + bool mbIsGraphicLoadOnDemandSupported; + + // This method is called after the namespace map has been updated, but + // before a context for the current element has been pushed. + virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + virtual XMLTextImportHelper* CreateTextImport(); + inline void ClearTextImport() { mxTextImport = 0; } + virtual XMLShapeImportHelper* CreateShapeImport(); + inline sal_Bool HasShapeImport() const { return mxShapeImport.is(); } + inline void ClearShapeImport() { mxShapeImport = 0; } + + virtual SchXMLImportHelper* CreateChartImport(); + virtual ::xmloff::OFormLayerXMLImport* CreateFormImport(); + + void SetFontDecls( XMLFontStylesContext *pFontDecls ); + void SetStyles( SvXMLStylesContext *pStyles ); + void SetAutoStyles( SvXMLStylesContext *pAutoStyles ); + void SetMasterStyles( SvXMLStylesContext *pMasterStyles ); + + sal_Bool IsODFVersionConsistent( const OUString& aODFVersion ); + + const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEmbeddedObjectResolver >& GetEmbeddedResolver() const { return mxEmbeddedResolver; } + inline void SetEmbeddedResolver( com::sun::star::uno::Reference< com::sun::star::document::XEmbeddedObjectResolver >& _xEmbeddedResolver ); + + const ::com::sun::star::uno::Reference< ::com::sun::star::document::XGraphicObjectResolver >& GetGraphicResolver() const { return mxGraphicResolver; } + void SetGraphicResolver( com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& _xGraphicResolver ); + + + void _CreateNumberFormatsSupplier(); + void _CreateDataStylesImport(); + +public: + // #110680# + // SvXMLImport( sal_uInt16 nImportFlags = IMPORT_ALL ) throw(); + SvXMLImport( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, + sal_uInt16 nImportFlags = IMPORT_ALL ) throw(); + + virtual ~SvXMLImport() throw(); + + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); + + // ::com::sun::star::xml::sax::XDocumentHandler + virtual void SAL_CALL startDocument(void) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL endDocument(void) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL startElement(const 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 ); + virtual void SAL_CALL endElement(const OUString& aName) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL characters(const OUString& aChars) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL ignorableWhitespace(const OUString& aWhitespaces) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL processingInstruction(const OUString& aTarget, + const OUString& aData) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + 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 ); + + // ::com::sun::star::xml::sax::XExtendedDocumentHandler + virtual void SAL_CALL startCDATA(void) throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL endCDATA(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL comment(const OUString& sComment) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL allowLineBreak(void) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL unknown(const OUString& sString) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + + // XImporter + virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + // XFilter + virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL cancel( ) throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) + throw(::com::sun::star::uno::RuntimeException); + + // may be called by certain subclasses that handle document meta-data + // override to provide customized handling of document statistics + // the base class implementation initializes the progress bar and should + // be called by overriding methods + virtual void SetStatistics(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > & i_rStats); + + // get import helper for text + inline UniReference< XMLTextImportHelper > GetTextImport(); + sal_Bool HasTextImport() const { return mxTextImport.is(); } + inline SvXMLNumFmtHelper* GetDataStylesImport(); + + // get import helper for shapes + inline UniReference< XMLShapeImportHelper > GetShapeImport(); + + // get import helper for charts + inline UniReference< SchXMLImportHelper > GetChartImport(); + + // get import helper for form layer + inline UniReference< ::xmloff::OFormLayerXMLImport > GetFormImport(); + + // get XPropertySet with import information + inline ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getImportInfo() const { return mxImportInfo; } + + // get import helper for events + XMLEventImportHelper& GetEventImport(); + + SvXMLNamespaceMap& GetNamespaceMap() { return *mpNamespaceMap; } + const SvXMLNamespaceMap& GetNamespaceMap() const { return *mpNamespaceMap; } + const SvXMLUnitConverter& GetMM100UnitConverter() const { return *mpUnitConv; } + SvXMLUnitConverter& GetMM100UnitConverter() { return *mpUnitConv; } + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > & GetLocator() const { return mxLocator; } + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & + GetModel() const { return mxModel; } + + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetGradientHelper(); + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetHatchHelper(); + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetBitmapHelper(); + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetTransGradientHelper(); + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetMarkerHelper(); + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & GetDashHelper(); + inline ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & GetNumberFormatsSupplier(); + inline void SetNumberFormatsSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& _xNumberFormatSupplier) + { + mxNumberFormatsSupplier = _xNumberFormatSupplier; + } + + // Convert a local packe URL into either a graphic manager or a + // internal package URL. The later one happens only if bLoadURL is true + OUString ResolveGraphicObjectURL( const OUString& rURL, sal_Bool bLoadOnDemand ); + ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > + GetStreamForGraphicObjectURLFromBase64(); + OUString ResolveGraphicObjectURLFromBase64( + const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOut ); + + sal_Bool IsPackageURL( const OUString& rURL ) const; + OUString ResolveEmbeddedObjectURL( const OUString& rURL, + const OUString& rClassId ); + ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > + GetStreamForEmbeddedObjectURLFromBase64(); + OUString ResolveEmbeddedObjectURLFromBase64(); + + // get source storage we're importing from (if available) + ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > + GetSourceStorage(); + + void AddStyleDisplayName( sal_uInt16 nFamily, + const OUString& rName, + const OUString& rDisplayName ); + OUString GetStyleDisplayName( sal_uInt16 nFamily, + const OUString& rName ) const; + + ProgressBarHelper* GetProgressBarHelper(); + + void AddNumberStyle(sal_Int32 nKey, const OUString& sName); + + virtual void SetViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps); + virtual void SetConfigurationSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aConfigProps); + virtual void SetDocumentSpecificSettings(const OUString& _rSettingsGroupName, + const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& _rSettings); + + XMLFontStylesContext *GetFontDecls(); + SvXMLStylesContext *GetStyles(); + SvXMLStylesContext *GetAutoStyles(); + const XMLFontStylesContext *GetFontDecls() const; + const SvXMLStylesContext *GetStyles() const; + const SvXMLStylesContext *GetAutoStyles() const; + + sal_uInt16 getImportFlags() const { return mnImportFlags; } + sal_Bool IsFormsSupported() const { return mbIsFormsSupported; } + OUString GetAbsoluteReference(const OUString& rValue) const; + + sal_Unicode ConvStarBatsCharToStarSymbol( sal_Unicode c ); + sal_Unicode ConvStarMathCharToStarSymbol( sal_Unicode c ); + + bool IsTableShapeSupported() const { return mbIsTableShapeSupported; } + + OUString GetODFVersion() const; + + /** + * Record an error condition that occurred during import. The + * behavior of SetError can be modified using the error flag + * constants. + */ + void SetError( + /// error ID, may contain an error flag + sal_Int32 nId, + /// string parameters for the error message + const ::com::sun::star::uno::Sequence< OUString > & rMsgParams, + /// original exception message (if applicable) + const OUString& rExceptionMessage, + /// error location (if applicable) + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XLocator> & rLocator ); + + void SetError( + sal_Int32 nId, + const ::com::sun::star::uno::Sequence< OUString> & rMsgParams); + + void SetError( sal_Int32 nId ); + void SetError( sal_Int32 nId, const OUString& rMsg1 ); + void SetError( sal_Int32 nId, const OUString& rMsg1, + const OUString& rMsg2 ); + + /** return current error flags */ + sal_uInt16 GetErrorFlags() { return mnErrorFlags; } + + virtual void DisposingModel(); + + ::comphelper::UnoInterfaceToUniqueIdentifierMapper& getInterfaceToIdentifierMapper(); + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + GetComponentContext() const; + + // Convert drawing object positions from OOo file format to OASIS file format and vice versa (#i28749#) + sal_Bool IsShapePositionInHoriL2R() const; + + sal_Bool IsTextDocInOOoFileFormat() const; + + OUString GetBaseURL() const; + OUString GetDocumentBase() const; + + /// name of stream in package, e.g., "content.xml" + OUString GetStreamName() const; + + /// set the XmlId attribute of given UNO object (for RDF metadata) + void SetXmlId(::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface> const & i_xIfc, + OUString const & i_rXmlId); + + /// Add a RDFa statement; parameters are XML attribute values + void AddRDFa( ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable> i_xObject, + OUString const & i_rAbout, + OUString const & i_rProperty, + OUString const & i_rContent, + OUString const & i_rDatatype); + + /// do not dllexport this; only for advanced cases (bookmark-start) + SAL_DLLPRIVATE ::xmloff::RDFaImportHelper & GetRDFaImportHelper(); + + // #i31958# XForms helper method + // (to be implemented by applications suporting XForms) + virtual void initXForms(); + + /** returns the upd and build id (f.e. "680m124$Build-8964" gives rMaster = 680 and rBuild = 8964) + from the metafile. + this only works if the meta.xml was already imported and the + import propertyset contains the string property "BuildId". + If false is returned the build ids are not available (yet). + **/ + bool getBuildIds( sal_Int32& rUPD, sal_Int32& rBuild ) const; + + static const sal_uInt16 OOo_1x = 10; + static const sal_uInt16 OOo_2x = 20; + static const sal_uInt16 OOo_30x = 30; + static const sal_uInt16 OOo_31x = 31; + static const sal_uInt16 OOo_32x = 32; + static const sal_uInt16 OOo_33x = 33; + static const sal_uInt16 OOo_34x = 34; + static const sal_uInt16 LO_flag = 0x100; + static const sal_uInt16 LO_3x = 30 | LO_flag; + static const sal_uInt16 LO_4x = 40 | LO_flag; + static const sal_uInt16 ProductVersionUnknown = SAL_MAX_UINT16; + + /** depending on whether the generator version indicates LO, compare + against either the given LO or given OOo version */ + bool isGeneratorVersionOlderThan( + sal_uInt16 const nOOoVersion, sal_uInt16 const nLOVersion); + + /** this checks the build ID and returns + + * OOo_1x for files created with OpenOffice.org 1.x or StarOffice 7 (this also includes binary import over binfilter) + * OOo_2x for files created with OpenOffice.org 2.x or StarOffice 8 + * OOo_30x for files created with OpenOffice.org 3.0/3.0.1 or StarOffice 9/9 PU01 + * OOo_31x for files created with OpenOffice.org 3.1/3.1.1 or StarOffice 9 PU02/9 PU03 + * OOo_32x for files created with OpenOffice.org 3.2/3.2.1 or StarOffice 9 PU04 or Oracle Open Office 3.2.1 + * OOo_33x for files created with OpenOffice.org 3.3 (and minors) or Oracle Open Office 3.3 (and minors) + * OOo_34x for files created with OpenOffice.org 3.4 Beta or Oracle Open Office 3.4 Beta + * ProductVersionUnknown for files not created with OpenOffice.org, StarOffice or Oracle Open Office + */ + sal_uInt16 getGeneratorVersion() const; + + /** If true, the URL for graphic shapes may be stored as a package URL and + loaded later (on demand) by the application. Otherwise graphics are + loaded immediately and the graphic shape gets the graphic manager URL. + + @see <member>mbIsGraphicLoadOnDemandSupported</member> + */ + bool isGraphicLoadOnDemandSupported() const; + + /** + Returns true if the embedded font document URL has already been processed. + Otherwise returns false and consequent calls with the same URL will return true. + */ + bool embeddedFontAlreadyProcessed( const OUString& url ); + + virtual void NotifyEmbeddedFontRead() {}; +}; + +inline UniReference< XMLTextImportHelper > SvXMLImport::GetTextImport() +{ + if( !mxTextImport.is() ) + mxTextImport = CreateTextImport(); + + return mxTextImport; +} + +inline UniReference< XMLShapeImportHelper > SvXMLImport::GetShapeImport() +{ + if( !mxShapeImport.is() ) + mxShapeImport = CreateShapeImport(); + + return mxShapeImport; +} + +inline UniReference< SchXMLImportHelper > SvXMLImport::GetChartImport() +{ + if( !mxChartImport.is() ) + mxChartImport = CreateChartImport(); + + return mxChartImport; +} + +inline UniReference< ::xmloff::OFormLayerXMLImport > SvXMLImport::GetFormImport() +{ + if( !mxFormImport.is() ) + mxFormImport = CreateFormImport(); + + return mxFormImport; +} + +inline void SvXMLImport::SetEmbeddedResolver( + com::sun::star::uno::Reference< com::sun::star::document::XEmbeddedObjectResolver >& _xEmbeddedResolver ) +{ + mxEmbeddedResolver = _xEmbeddedResolver; +} + +inline void SvXMLImport::SetGraphicResolver( + com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& _xGraphicResolver ) +{ + mxGraphicResolver = _xGraphicResolver; +} + +inline ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > & SvXMLImport::GetNumberFormatsSupplier() +{ + if ( ! mxNumberFormatsSupplier.is() && mxModel.is() ) + _CreateNumberFormatsSupplier(); + + return mxNumberFormatsSupplier; +} + +inline SvXMLNumFmtHelper* SvXMLImport::GetDataStylesImport() +{ + if ( mpNumImport == NULL) + _CreateDataStylesImport(); + + return mpNumImport; +} + + +#endif // _XMLOFF_XMLIMP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlimppr.hxx b/include/xmloff/xmlimppr.hxx new file mode 100644 index 000000000000..642e898aa3bb --- /dev/null +++ b/include/xmloff/xmlimppr.hxx @@ -0,0 +1,192 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _XMLOFF_XMLIMPPR_HXX +#define _XMLOFF_XMLIMPPR_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include "sal/types.h" +#include <tools/solar.h> +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/XMultiPropertySet.hpp> +#include <com/sun/star/beans/XTolerantMultiPropertySet.hpp> + +#include <vector> +#include <xmloff/uniref.hxx> + +struct XMLPropertyState; +class XMLPropertySetMapper; + + +class SvXMLUnitConverter; +class SvXMLNamespaceMap; +class SvXMLImport; + +/** This struct is used as an optional parameter to the static + * _FillPropertySet() methods. + * + * It should not be used in any other context. + */ +struct _ContextID_Index_Pair +{ + sal_Int16 nContextID; + sal_Int32 nIndex; +}; + +class XMLOFF_DLLPUBLIC SvXMLImportPropertyMapper : public UniRefBase +{ + UniReference< SvXMLImportPropertyMapper> mxNextMapper; + + SvXMLImport& rImport; // access to error handling + + SAL_DLLPRIVATE SvXMLImportPropertyMapper(SvXMLImportPropertyMapper &); + // not defined + SAL_DLLPRIVATE void operator =(SvXMLImportPropertyMapper &); // not defined + +protected: + + UniReference< XMLPropertySetMapper > maPropMapper; + SvXMLImport& GetImport() const { return rImport;} + +public: + + SvXMLImportPropertyMapper( + const UniReference< XMLPropertySetMapper >& rMapper, + SvXMLImport& rImport); + virtual ~SvXMLImportPropertyMapper(); + + // Add a ImportPropertyMapper at the end of the import mapper chain. + // The added mapper MUST not be used outside the Mapper chain any longer, + // because its PropertyMapper will be replaced. + void ChainImportMapper( + const UniReference< SvXMLImportPropertyMapper>& rMapper ); + + /** fills the given itemset with the attributes in the given list + * the map is only searched within the range + * [nStartIdx, nEndIdx[ + */ + void importXML( + ::std::vector< XMLPropertyState >& rProperties, + ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > xAttrList, + const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap, + sal_uInt32 nPropType, + sal_Int32 nStartIdx, sal_Int32 nEndIdx ) const; + + /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_IMPORT flag set */ + virtual bool handleSpecialItem( + XMLPropertyState& rProperty, + ::std::vector< XMLPropertyState >& rProperties, + const OUString& rValue, + const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap ) const; + + /** This method is called when all attributes have benn processed. It may be used to remove items that are incomplete */ + virtual void finished( + ::std::vector< XMLPropertyState >& rProperties, + sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const; + + void CheckSpecialContext( + const ::std::vector< XMLPropertyState >& aProperties, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > rPropSet, + _ContextID_Index_Pair* pSpecialContextIds ) const; + + sal_Bool FillPropertySet( + const ::std::vector< XMLPropertyState >& aProperties, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > rPropSet, + _ContextID_Index_Pair* pSpecialContextIds = NULL ) const; + + void FillPropertySequence( + const ::std::vector< XMLPropertyState >& aProperties, + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rValues ) + const; + + inline const UniReference< XMLPropertySetMapper >& + getPropertySetMapper() const; + + + + /** implementation helper for FillPropertySet: fill an XPropertySet. + * Exceptions will be asserted. */ + static sal_Bool _FillPropertySet( + const ::std::vector<XMLPropertyState> & rProperties, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet> & rPropSet, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySetInfo> & rPropSetInfo, + const UniReference<XMLPropertySetMapper> & rPropMapper, + SvXMLImport& rImport, + + // parameter for use by txtstyli.cxx; allows efficient + // catching the combined characters property + _ContextID_Index_Pair* pSpecialContextIds = NULL ); + + /** implementation helper for FillPropertySet: fill an XMultiPropertySet. + * If unsuccessul, set return value. */ + static sal_Bool _FillMultiPropertySet( + const ::std::vector<XMLPropertyState> & rProperties, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XMultiPropertySet> & rMultiPropSet, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySetInfo> & rPropSetInfo, + const UniReference<XMLPropertySetMapper> & rPropMapper, + + // parameters for use by txtstyli.cxx; allows efficient + // catching the combined characters property + _ContextID_Index_Pair* pSpecialContextIds = NULL ); + + /** implementation helper for FillPropertySet: fill an XTolerantMultiPropertySet. + * If unsuccessul, set return value. */ + static sal_Bool _FillTolerantMultiPropertySet( + const ::std::vector<XMLPropertyState> & rProperties, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XTolerantMultiPropertySet> & rTolPropSet, + const UniReference<XMLPropertySetMapper> & rPropMapper, + SvXMLImport& rImport, + + // parameters for use by txtstyli.cxx; allows efficient + // catching the combined characters property + _ContextID_Index_Pair* pSpecialContextIds = NULL ); + + + static void _PrepareForMultiPropertySet( + const ::std::vector<XMLPropertyState> & rProperties, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySetInfo> & rPropSetInfo, + const UniReference<XMLPropertySetMapper> & rPropMapper, + _ContextID_Index_Pair* pSpecialContextIds, + ::com::sun::star::uno::Sequence< OUString >& rNames, + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rValues); +}; + + +inline const UniReference< XMLPropertySetMapper >& + SvXMLImportPropertyMapper::getPropertySetMapper() const +{ + return maPropMapper; +} + +#endif // _XMLOFF_XMLIMPPR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlmetae.hxx b/include/xmloff/xmlmetae.hxx new file mode 100644 index 000000000000..3b99cbfabfdf --- /dev/null +++ b/include/xmloff/xmlmetae.hxx @@ -0,0 +1,120 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLMETAE_HXX +#define _XMLOFF_XMLMETAE_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include "sal/types.h" + +#include <cppuhelper/implbase1.hxx> +#include <xmloff/xmltoken.hxx> + +#include <vector> + +#include <com/sun/star/beans/StringPair.hpp> +#include <com/sun/star/util/DateTime.hpp> +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <com/sun/star/document/XDocumentProperties.hpp> + + +class SvXMLExport; + +/** export meta data from an <type>XDocumentProperties</type> instance. + + <p> + This class will start the export at the office:meta element, + not at the root element. This means that when <method>Export</method> + is called here, the document root element must already be written, but + office:meta must <em>not</em> be written. + </p> + */ +class XMLOFF_DLLPUBLIC SvXMLMetaExport : public ::cppu::WeakImplHelper1< + ::com::sun::star::xml::sax::XDocumentHandler > +{ +private: + SvXMLExport& mrExport; + ::com::sun::star::uno::Reference< + ::com::sun::star::document::XDocumentProperties> mxDocProps; + /// counts levels of the xml document. necessary for special handling. + int m_level; + /// preserved namespaces. necessary because we do not write the root node. + std::vector< ::com::sun::star::beans::StringPair > m_preservedNSs; + + SAL_DLLPRIVATE void SimpleStringElement( + const OUString& rText, sal_uInt16 nNamespace, + enum ::xmloff::token::XMLTokenEnum eElementName ); + SAL_DLLPRIVATE void SimpleDateTimeElement( + const ::com::sun::star::util::DateTime & rDate, sal_uInt16 nNamespace, + enum ::xmloff::token::XMLTokenEnum eElementName ); + + /// currently unused; for exporting via the XDocumentProperties interface + SAL_DLLPRIVATE void _MExport(); + +public: + SvXMLMetaExport( SvXMLExport& i_rExport, + const ::com::sun::star::uno::Reference< + ::com::sun::star::document::XDocumentProperties>& i_rDocProps); + + virtual ~SvXMLMetaExport(); + + /// export via XSAXWriter interface, with fallback to _MExport + void Export(); + + static OUString GetISODateTimeString( + const ::com::sun::star::util::DateTime& rDateTime ); + + // ::com::sun::star::xml::sax::XDocumentHandler: + virtual void SAL_CALL startDocument() + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::xml::sax::SAXException); + virtual void SAL_CALL endDocument() + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::xml::sax::SAXException); + virtual void SAL_CALL startElement(const OUString & i_rName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & i_xAttribs) + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::xml::sax::SAXException); + virtual void SAL_CALL endElement(const OUString & i_rName) + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::xml::sax::SAXException); + virtual void SAL_CALL characters(const OUString & i_rChars) + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::xml::sax::SAXException); + virtual void SAL_CALL ignorableWhitespace( + const OUString & i_rWhitespaces) + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::xml::sax::SAXException); + virtual void SAL_CALL processingInstruction( + const OUString & i_rTarget, const OUString & i_rData) + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::xml::sax::SAXException); + virtual void SAL_CALL setDocumentLocator( + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XLocator > & i_xLocator) + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::xml::sax::SAXException); + +}; + +#endif // _XMLOFF_XMLMETAE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlmetai.hxx b/include/xmloff/xmlmetai.hxx new file mode 100644 index 000000000000..061bd78e6df0 --- /dev/null +++ b/include/xmloff/xmlmetai.hxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef XMLOFF_XMLMETAI_HXX +#define XMLOFF_XMLMETAI_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <xmloff/xmlictxt.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/document/XDocumentProperties.hpp> +#include <com/sun/star/xml/dom/XSAXDocumentBuilder2.hpp> + + +/// handles the top-level office:document-meta element of meta.xml documents +// NB: virtual inheritance is needed so that the context that handles the +// flat xml file format can multiply inherit properly +class XMLOFF_DLLPUBLIC SvXMLMetaDocumentContext + : public virtual SvXMLImportContext +{ +private: + ::com::sun::star::uno::Reference< + ::com::sun::star::document::XDocumentProperties> mxDocProps; + ::com::sun::star::uno::Reference< + ::com::sun::star::xml::dom::XSAXDocumentBuilder2> mxDocBuilder; + +public: + SvXMLMetaDocumentContext(SvXMLImport& rImport, sal_uInt16 nPrfx, + const OUString& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::document::XDocumentProperties>& xDocProps); + + virtual ~SvXMLMetaDocumentContext(); + + virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); + + virtual void StartElement( const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + virtual void EndElement(); + +public: + static void setBuildId(const OUString & rGenerator, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& xImportInfo ); +}; + +#endif // _XMLOFF_XMLMETAI_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlmultiimagehelper.hxx b/include/xmloff/xmlmultiimagehelper.hxx new file mode 100644 index 000000000000..cb0a290b1bbd --- /dev/null +++ b/include/xmloff/xmlmultiimagehelper.hxx @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLMULTIIMAGEHELPER_HXX +#define _XMLOFF_XMLMULTIIMAGEHELPER_HXX + +#include <sal/types.h> +#include <xmloff/xmlimp.hxx> + +////////////////////////////////////////////////////////////////////////////// + +class multiImageImportHelper +{ +private: + std::vector< SvXMLImportContextRef* > maImplContextVector; + bool mbSupportsMultipleContents; + +protected: + /// helper to get the created xShape instance, needs to be overloaded + virtual OUString getGraphicURLFromImportContext(const SvXMLImportContext& rContext) const = 0; + virtual void removeGraphicFromImportContext(const SvXMLImportContext& rContext) const = 0; + +public: + multiImageImportHelper(); + virtual ~multiImageImportHelper(); + + /// solve multiple imported images. The most valuable one is choosen, + /// see imlementation for evtl. changing weights and/or adding filetypes + void solveMultipleImages(); + + /// add a content to the remembered image import contexts + void addContent(const SvXMLImportContext& rSvXMLImportContext); + + /// read/write access to boolean switch + bool getSupportsMultipleContents() const { return mbSupportsMultipleContents; } + void setSupportsMultipleContents(bool bNew) { mbSupportsMultipleContents = bNew; } +}; + +////////////////////////////////////////////////////////////////////////////// + +#endif // _XMLOFF_XMLMULTIIMAGEHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlnmspe.hxx b/include/xmloff/xmlnmspe.hxx new file mode 100644 index 000000000000..b1646c307b63 --- /dev/null +++ b/include/xmloff/xmlnmspe.hxx @@ -0,0 +1,106 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLNMSPE_HXX +#define _XMLOFF_XMLNMSPE_HXX + +#include <sal/types.h> + +#define XML_NAMESPACE( prefix, key ) \ +const sal_uInt16 XML_NAMESPACE_##prefix = key; \ +const sal_uInt16 XML_NAMESPACE_##prefix##_IDX = key; + +#define XML_OLD_NAMESPACE( prefix, index ) \ +const sal_uInt16 XML_OLD_NAMESPACE_##prefix##_IDX = \ + (_XML_OLD_NAMESPACE_BASE+index); + +// current namespaces +// These namespaces have the same index in the namespace table as prefix used. +// If a namespace is added, _XML_OLD_NAMESPACE_BASE has to be adjusted! +XML_NAMESPACE( OFFICE, 0U ) +XML_NAMESPACE( STYLE, 1U ) +XML_NAMESPACE( TEXT , 2U ) +XML_NAMESPACE( TABLE, 3U ) +XML_NAMESPACE( DRAW , 4U ) +XML_NAMESPACE( FO , 5U ) +XML_NAMESPACE( XLINK, 6U ) +XML_NAMESPACE( DC , 7U ) +XML_NAMESPACE( META , 8U ) +XML_NAMESPACE( NUMBER, 9U ) +XML_NAMESPACE( PRESENTATION, 10U ) +XML_NAMESPACE( SVG, 11U ) +XML_NAMESPACE( CHART, 12U ) +XML_NAMESPACE( DR3D, 13U ) +XML_NAMESPACE( MATH, 14U ) +XML_NAMESPACE( FORM, 15U ) +XML_NAMESPACE( SCRIPT, 16U ) +XML_NAMESPACE( BLOCKLIST, 17U ) +XML_NAMESPACE( FRAMEWORK, 18U ) +XML_NAMESPACE( CONFIG, 19U ) +XML_NAMESPACE( OOO, 20U ) +XML_NAMESPACE( OOOW, 21U ) +XML_NAMESPACE( OOOC, 22U ) +XML_NAMESPACE( DOM, 23U ) +XML_NAMESPACE( TCD, 24U ) // text conversion dictionary +XML_NAMESPACE( DB, 25U ) +XML_NAMESPACE( DLG, 26U ) +XML_NAMESPACE( XFORMS, 27U ) +XML_NAMESPACE( XSD, 28U ) +XML_NAMESPACE( XSI, 29U ) +XML_NAMESPACE( SMIL, 30U ) +XML_NAMESPACE( ANIMATION, 31U ) +XML_NAMESPACE( XML, 32U ) +XML_NAMESPACE( REPORT, 33U ) +XML_NAMESPACE( OF, 34U ) // OpenFormula aka ODFF +XML_NAMESPACE( XHTML, 35U ) +XML_NAMESPACE( GRDDL, 36U ) + +// namespaces for odf extended formats + +#define XML_NAMESPACE_EXT( prefix, key ) \ +const sal_uInt16 XML_NAMESPACE_##prefix##_EXT = key; \ +const sal_uInt16 XML_NAMESPACE_##prefix##_EXT_IDX = key; + +XML_NAMESPACE_EXT( OFFICE, 37U ) +XML_NAMESPACE_EXT( TABLE, 38U ) +XML_NAMESPACE_EXT( CHART, 39U ) +XML_NAMESPACE_EXT( DRAW, 40U ) +XML_NAMESPACE_EXT( CALC, 41U ) + +#define _XML_OLD_NAMESPACE_BASE 42U + +// namespaces used in the technical preview (SO 5.2) +XML_OLD_NAMESPACE( FO, 0U ) +XML_OLD_NAMESPACE( XLINK, 1U ) + +XML_OLD_NAMESPACE( OFFICE, 2U ) +XML_OLD_NAMESPACE( STYLE, 3U ) +XML_OLD_NAMESPACE( TEXT, 4U ) +XML_OLD_NAMESPACE( TABLE, 5U ) +XML_OLD_NAMESPACE( META, 6U ) + +// experimental namespaces +XML_NAMESPACE( FIELD, 100U ) +XML_NAMESPACE( CSS3TEXT, 103U ) // CSS Text Level 3 +XML_NAMESPACE( FORMX, 101U ) // form interop extensions + + +#endif // _XMLOFF_XMLNMSPE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlnume.hxx b/include/xmloff/xmlnume.hxx new file mode 100644 index 000000000000..78e7cbfdd191 --- /dev/null +++ b/include/xmloff/xmlnume.hxx @@ -0,0 +1,94 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLNUME_HXX +#define _XMLOFF_XMLNUME_HXX + +#include <rtl/ustring.hxx> +#include <tools/mapunit.hxx> +#include <xmloff/XMLStringVector.hxx> +#include <xmloff/attrlist.hxx> + +namespace com { namespace sun { namespace star { + namespace frame { class XModel; } + namespace style { class XStyle; } + namespace container { class XIndexReplace; } + namespace beans { struct PropertyValue; } +} } } + +class SvXMLNamespaceMap; +class SvXMLUnitConverter; +class SvXMLExportItemMapper; +class SvXMLExport; +class XMLTextListAutoStylePool; + +class SvxXMLNumRuleExport +{ + SvXMLExport& rExport; + const OUString sCDATA; + const OUString sWS; + const OUString sNumberingRules; + const OUString sIsPhysical; + const OUString sIsContinuousNumbering; + // Boolean indicating, if properties for position-and-space-mode LABEL_ALIGNEMNT + // are exported or not. (#i89178#) + // These properties have been introduced in ODF 1.2. Thus, its export have + // to be suppressed on writing ODF 1.0 respectively ODF 1.1 + bool mbExportPositionAndSpaceModeLabelAlignment; + + void exportLevelStyles( + const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XIndexReplace > & xNumRule, + sal_Bool bOutline=sal_False ); + + void exportLevelStyle( + sal_Int32 nLevel, + const ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue>& rProps, + sal_Bool bOutline=sal_False ); + +protected: + + // This method may be overloaded to add attributes to the <list-style> + // element. + virtual void AddListStyleAttributes(); + + sal_Bool exportStyle( const ::com::sun::star::uno::Reference< + ::com::sun::star::style::XStyle >& rStyle ); + void exportOutline(); + + SvXMLExport& GetExport() { return rExport; } + +public: + + SvxXMLNumRuleExport( SvXMLExport& rExport ); + virtual ~SvxXMLNumRuleExport(); + + void exportStyles( sal_Bool bUsed, + XMLTextListAutoStylePool *pPool, + sal_Bool bExportChapterNumbering = sal_True ); + void exportNumberingRule( + const OUString& rName, sal_Bool bIsHidden, + const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XIndexReplace > & xNumRule ); +}; + +#endif // _XMLOFF_XMLNUME_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlnumfe.hxx b/include/xmloff/xmlnumfe.hxx new file mode 100644 index 000000000000..20029a6f99b7 --- /dev/null +++ b/include/xmloff/xmlnumfe.hxx @@ -0,0 +1,134 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLNUMFE_HXX +#define _XMLOFF_XMLNUMFE_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include "sal/types.h" +#include <com/sun/star/util/XNumberFormatsSupplier.hpp> +#include <com/sun/star/uno/Sequence.h> +#include <rtl/ustrbuf.hxx> + +#define XML_WRITTENNUMBERSTYLES "WrittenNumberStyles" + +class Color; +class LocaleDataWrapper; +class CharClass; +class SvXMLExport; +class SvXMLNamespaceMap; +class SvXMLAttributeList; +class SvNumberFormatter; +class SvNumberformat; +class SvXMLNumUsedList_Impl; +class SvXMLEmbeddedTextEntryArr; + +class XMLOFF_DLLPUBLIC SvXMLNumFmtExport +{ +private: + SvXMLExport& rExport; + OUString sPrefix; + SvNumberFormatter* pFormatter; + OUStringBuffer sTextContent; + SvXMLNumUsedList_Impl* pUsedList; + CharClass* pCharClass; + LocaleDataWrapper* pLocaleData; + + SAL_DLLPRIVATE void AddCalendarAttr_Impl( const OUString& rCalendar ); + SAL_DLLPRIVATE void AddStyleAttr_Impl( sal_Bool bLong ); + SAL_DLLPRIVATE void AddTextualAttr_Impl( sal_Bool bText ); + SAL_DLLPRIVATE void AddLanguageAttr_Impl( sal_Int32 nLang ); + + SAL_DLLPRIVATE void AddToTextElement_Impl( const OUString& rString ); + SAL_DLLPRIVATE void FinishTextElement_Impl(); + + SAL_DLLPRIVATE void WriteColorElement_Impl( const Color& rColor ); + SAL_DLLPRIVATE void WriteNumberElement_Impl( sal_Int32 nDecimals, sal_Int32 nInteger, + const OUString& rDashStr, sal_Bool bVarDecimals, + sal_Bool bGrouping, sal_Int32 nTrailingThousands, + const SvXMLEmbeddedTextEntryArr& rEmbeddedEntries ); + SAL_DLLPRIVATE void WriteScientificElement_Impl( sal_Int32 nDecimals, sal_Int32 nInteger, + sal_Bool bGrouping, sal_Int32 nExp ); + SAL_DLLPRIVATE void WriteFractionElement_Impl( sal_Int32 nInteger, sal_Bool bGrouping, + sal_Int32 nNumeratorDigits, sal_Int32 nDenominatorDigits, sal_Int32 nDenominator ); + SAL_DLLPRIVATE void WriteCurrencyElement_Impl( const OUString& rString, + const OUString& rExt ); + SAL_DLLPRIVATE void WriteBooleanElement_Impl(); + SAL_DLLPRIVATE void WriteTextContentElement_Impl(); + SAL_DLLPRIVATE void WriteDayElement_Impl( const OUString& rCalendar, sal_Bool bLong ); + SAL_DLLPRIVATE void WriteMonthElement_Impl( const OUString& rCalendar, sal_Bool bLong, sal_Bool bText ); + SAL_DLLPRIVATE void WriteYearElement_Impl( const OUString& rCalendar, sal_Bool bLong ); + SAL_DLLPRIVATE void WriteEraElement_Impl( const OUString& rCalendar, sal_Bool bLong ); + SAL_DLLPRIVATE void WriteDayOfWeekElement_Impl( const OUString& rCalendar, sal_Bool bLong ); + SAL_DLLPRIVATE void WriteWeekElement_Impl( const OUString& rCalendar ); + SAL_DLLPRIVATE void WriteQuarterElement_Impl( const OUString& rCalendar, sal_Bool bLong ); + SAL_DLLPRIVATE void WriteHoursElement_Impl( sal_Bool bLong ); + SAL_DLLPRIVATE void WriteMinutesElement_Impl( sal_Bool bLong ); + SAL_DLLPRIVATE void WriteSecondsElement_Impl( sal_Bool bLong, sal_uInt16 nDecimals ); + SAL_DLLPRIVATE void WriteAMPMElement_Impl(); + SAL_DLLPRIVATE void WriteMapElement_Impl( sal_Int32 nOp, double fLimit, + sal_Int32 nKey, sal_Int32 nPart ); + + SAL_DLLPRIVATE void WriteRepeatedElement_Impl( sal_Unicode ch ); + SAL_DLLPRIVATE sal_Bool WriteTextWithCurrency_Impl( const OUString& rString, + const ::com::sun::star::lang::Locale& rLocale ); + SAL_DLLPRIVATE void ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey, + sal_uInt16 nPart, sal_Bool bDefPart ); + + SAL_DLLPRIVATE void ExportFormat_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey ); + +public: + SvXMLNumFmtExport( SvXMLExport& rExport, + const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XNumberFormatsSupplier >& rSupp ); + SvXMLNumFmtExport( SvXMLExport& rExport, + const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XNumberFormatsSupplier >& rSupp, + const OUString& rPrefix ); + + virtual ~SvXMLNumFmtExport(); + + // core API + void Export( sal_Bool bIsAutoStyle); + + // mark number format as used + void SetUsed( sal_uInt32 nKey ); + + // get the style name that was generated for a key + OUString GetStyleName( sal_uInt32 nKey ); + + void GetWasUsed(com::sun::star::uno::Sequence<sal_Int32>& rWasUsed); + void SetWasUsed(const com::sun::star::uno::Sequence<sal_Int32>& rWasUsed); + + + + // two methods to allow the field import/export to treat system languages + // properly: + + /// obtain number format with system languange for a given key + sal_uInt32 ForceSystemLanguage( sal_uInt32 nKey ); + + /// determine whether number format uses system language + bool IsSystemLanguage( sal_uInt32 nKey ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlnumfi.hxx b/include/xmloff/xmlnumfi.hxx new file mode 100644 index 000000000000..34bb91cbe9fe --- /dev/null +++ b/include/xmloff/xmlnumfi.hxx @@ -0,0 +1,214 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLNUMFI_HXX +#define _XMLOFF_XMLNUMFI_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include "sal/types.h" +#include <com/sun/star/util/XNumberFormatsSupplier.hpp> +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <xmloff/xmlstyle.hxx> +#include <rtl/ustrbuf.hxx> +#include <i18nlangtag/lang.h> +#include <vector> +#include <unotools/localedatawrapper.hxx> + +#define XML_NUMBERSTYLES "NumberStyles" + +enum SvXMLStylesTokens +{ + XML_TOK_STYLES_NUMBER_STYLE, + XML_TOK_STYLES_CURRENCY_STYLE, + XML_TOK_STYLES_PERCENTAGE_STYLE, + XML_TOK_STYLES_DATE_STYLE, + XML_TOK_STYLES_TIME_STYLE, + XML_TOK_STYLES_BOOLEAN_STYLE, + XML_TOK_STYLES_TEXT_STYLE +}; + +enum SvXMLDateElementAttributes +{ + XML_DEA_NONE, + XML_DEA_ANY, + XML_DEA_SHORT, + XML_DEA_LONG, + XML_DEA_TEXTSHORT, + XML_DEA_TEXTLONG +}; + +class Color; +class SvXMLNumImpData; +class SvXMLImport; +class SvXMLStyleContext; +class SvXMLStylesContext; +struct SvXMLNumberInfo; +class SvNumberFormatter; +class SvtSysLocale; +namespace com { namespace sun { namespace star { namespace lang { + class XMultiServiceFactory; +}}}} + + +// use SvXMLNumFmtHelper in the context for <office:styles> to create +// child contexts for data styles + +class SvXMLNumFmtHelper +{ + SvXMLNumImpData* pData; + +public: + SvXMLNumFmtHelper( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& rSupp, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); + + SvXMLNumFmtHelper( + SvNumberFormatter* pNumberFormatter, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); + + ~SvXMLNumFmtHelper(); + + SvXMLStyleContext* CreateChildContext( SvXMLImport& rImport, + sal_uInt16 nPrefix, const OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList, + SvXMLStylesContext& rStyles); + + SvXMLNumImpData* getData() { return pData; } + + const SvXMLTokenMap& GetStylesElemTokenMap(); + +// sal_uInt32 GetKeyForName( const OUString& rName ); +}; + +// SvXMLNumFmtDefaults is used in import and export + +class SvXMLNumFmtDefaults +{ +public: + // return value is NfIndexTableOffset + static sal_uInt16 GetDefaultDateFormat( SvXMLDateElementAttributes eDOW, + SvXMLDateElementAttributes eDay, SvXMLDateElementAttributes eMonth, + SvXMLDateElementAttributes eYear, SvXMLDateElementAttributes eHours, + SvXMLDateElementAttributes eMins, SvXMLDateElementAttributes eSecs, + sal_Bool bSystem ); +}; + +struct MyCondition +{ + OUString sCondition; + OUString sMapName; +}; + +class XMLOFF_DLLPUBLIC SvXMLNumFormatContext : public SvXMLStyleContext +{ + SvXMLNumImpData* pData; + SvXMLStylesContext* pStyles; + std::vector <MyCondition> aMyConditions; + sal_uInt16 nType; + sal_Int32 nKey; +// OUString sFormatName; + OUString sFormatTitle; +// OUString sMapName; + OUString sCalendar; + OUString sFormatString; + LanguageType nFormatLang; + com::sun::star::lang::Locale aLocale; + sal_Bool bAutoOrder; + sal_Bool bFromSystem; + sal_Bool bTruncate; + sal_Bool bAutoDec; // set in AddNumber + sal_Bool bAutoInt; // set in AddNumber + sal_Bool bHasExtraText; + OUStringBuffer aFormatCode; + OUStringBuffer aConditions; + sal_Bool bHasLongDoW; + sal_Bool bHasEra; + sal_Bool bHasDateTime; + sal_Bool bRemoveAfterUse; + + // contained date elements, used to recognize default date formats + SvXMLDateElementAttributes eDateDOW; + SvXMLDateElementAttributes eDateDay; + SvXMLDateElementAttributes eDateMonth; + SvXMLDateElementAttributes eDateYear; + SvXMLDateElementAttributes eDateHours; + SvXMLDateElementAttributes eDateMins; + SvXMLDateElementAttributes eDateSecs; + sal_Bool bDateNoDefault; + + SAL_DLLPRIVATE sal_Int32 PrivateGetKey(); + +public: + SvXMLNumFormatContext( SvXMLImport& rImport, sal_uInt16 nPrfx, + const OUString& rLName, + SvXMLNumImpData* pNewData, sal_uInt16 nNewType, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList, + SvXMLStylesContext& rStyles ); + SvXMLNumFormatContext( SvXMLImport& rImport, sal_uInt16 nPrfx, + const OUString& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList, + const sal_Int32 nKey, + SvXMLStylesContext& rStyles ); + virtual ~SvXMLNumFormatContext(); + + virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); + virtual void CreateAndInsert(sal_Bool bOverwrite); + virtual void Finish(sal_Bool bOverwrite); + + SvXMLNumImpData* GetData() const { return pData; } + sal_Int32 GetKey(); + sal_Int32 CreateAndInsert( SvNumberFormatter* pFormatter ); + sal_Int32 CreateAndInsert( com::sun::star::uno::Reference< com::sun::star::util::XNumberFormatsSupplier >& xFormatsSupplier ); + sal_uInt16 GetType() const { return nType; } // SvXMLStylesTokens + + sal_Bool IsFromSystem() const { return bFromSystem; } + sal_Bool HasLongDoW() const { return bHasLongDoW; } + void SetHasLongDoW(sal_Bool bSet) { bHasLongDoW = bSet; } + sal_Bool HasEra() const { return bHasEra; } + void SetHasEra(sal_Bool bSet) { bHasEra = bSet; } + + void UpdateCalendar( const OUString& rNewCalendar ); + + const LocaleDataWrapper& GetLocaleData() const; + + void AddToCode( const OUString& rString ); + void AddToCode( sal_Unicode c ); + void AddNumber( const SvXMLNumberInfo& rInfo ); + void AddCurrency( const OUString& rContent, LanguageType nLang ); + + void AddNfKeyword( sal_uInt16 nIndex ); + sal_Bool ReplaceNfKeyword( sal_uInt16 nOld, sal_uInt16 nNew ); + void AddCondition( const sal_Int32 nIndex ); + void AddCondition( const OUString& rCondition, const OUString& rApplyName ); + void AddColor( sal_uInt32 const nColor ); + + /// determine whether number format uses the system language + sal_Bool IsSystemLanguage(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlnumi.hxx b/include/xmloff/xmlnumi.hxx new file mode 100644 index 000000000000..ea547379f261 --- /dev/null +++ b/include/xmloff/xmlnumi.hxx @@ -0,0 +1,104 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLNUMI_HXX +#define _XMLOFF_XMLNUMI_HXX + +#include <com/sun/star/container/XIndexReplace.hpp> + +#include <xmloff/xmlstyle.hxx> +#include <com/sun/star/style/NumberingType.hpp> + +namespace com { namespace sun { namespace star { namespace frame { class XModel; } } } } +class SvI18NMap; +class SvxXMLListStyle_Impl; + +class SvxXMLListStyleContext : public SvXMLStyleContext +{ + const OUString sIsPhysical; + const OUString sNumberingRules; + const OUString sName; + const OUString sIsContinuousNumbering; + + ::com::sun::star::uno::Reference < + ::com::sun::star::container::XIndexReplace > xNumRules; + + SvxXMLListStyle_Impl *pLevelStyles; + + sal_Int32 nLevels; + sal_Bool bConsecutive : 1; + sal_Bool bOutline : 1; + +protected: + + virtual void SetAttribute( sal_uInt16 nPrefixKey, + const OUString& rLocalName, + const OUString& rValue ); + +public: + + TYPEINFO(); + + SvxXMLListStyleContext( + SvXMLImport& rImport, sal_uInt16 nPrfx, + const OUString& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList >& xAttrList, + sal_Bool bOutl=sal_False ); + + virtual ~SvxXMLListStyleContext(); + + virtual SvXMLImportContext *CreateChildContext( + sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + void FillUnoNumRule( + const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XIndexReplace > & rNumRule, + const SvI18NMap *pI18NMap ) const; + + const ::com::sun::star::uno::Reference < + ::com::sun::star::container::XIndexReplace >& GetNumRules() const + { return xNumRules; } + sal_Bool IsOutline() const { return bOutline; } + sal_Bool IsConsecutive() const { return bConsecutive; } + sal_Int32 GetLevels() const { return nLevels; } + + static ::com::sun::star::uno::Reference < + ::com::sun::star::container::XIndexReplace > + CreateNumRule( + const ::com::sun::star::uno::Reference < + ::com::sun::star::frame::XModel > & rModel ); + + static void SetDefaultStyle( + const ::com::sun::star::uno::Reference < + ::com::sun::star::container::XIndexReplace > & rNumRule, + sal_Int16 nLevel, + sal_Bool bOrdered ); + + virtual void CreateAndInsertLate( sal_Bool bOverwrite ); + + void CreateAndInsertAuto() const; +}; + +#endif // _XMLOFF_XMLNUMI_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlprcon.hxx b/include/xmloff/xmlprcon.hxx new file mode 100644 index 000000000000..3ed1af78e736 --- /dev/null +++ b/include/xmloff/xmlprcon.hxx @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLPROPERTYSETCONTEXT_HXX +#define _XMLOFF_XMLPROPERTYSETCONTEXT_HXX + +#include <xmloff/xmlictxt.hxx> +#include <xmloff/xmlimppr.hxx> +#include <xmloff/xmlprmap.hxx> +#include <xmloff/uniref.hxx> + + +class SvXMLImportPropertyMapper; + +class XMLOFF_DLLPUBLIC SvXMLPropertySetContext : public SvXMLImportContext +{ +protected: + sal_Int32 mnStartIdx; + sal_Int32 mnEndIdx; + sal_uInt32 mnFamily; + ::std::vector< XMLPropertyState > &mrProperties; + UniReference < SvXMLImportPropertyMapper > mxMapper; + +public: + + SvXMLPropertySetContext( + SvXMLImport& rImport, sal_uInt16 nPrfx, + const OUString& rLName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList, + sal_uInt32 nFamily, + ::std::vector< XMLPropertyState > &rProps, + const UniReference < SvXMLImportPropertyMapper > &rMap, + sal_Int32 nStartIdx = -1, sal_Int32 nEndIdx = -1 ); + + virtual ~SvXMLPropertySetContext(); + + virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + // This method is called from this instance implementation of + // CreateChildContext if the element matches an entry in the + // SvXMLImportItemMapper with the mid flag MID_FLAG_ELEMENT_ITEM_IMPORT + virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList, + ::std::vector< XMLPropertyState > &rProperties, + const XMLPropertyState& rProp ); + +}; + +#endif // _XMLOFF_XMLPROPERTYSETCONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlprhdl.hxx b/include/xmloff/xmlprhdl.hxx new file mode 100644 index 000000000000..746e9e39d3e7 --- /dev/null +++ b/include/xmloff/xmlprhdl.hxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX +#define _XMLOFF_PROPERTYHANDLERBASE_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <sal/types.h> +#include <rtl/ustring.hxx> + +namespace com{ namespace sun{ namespace star{ namespace uno{ class Any; } } } } + +class SvXMLUnitConverter; +struct XMLPropertyState; + +/////////////////////////////////////////////////////////////////////////// +// +/** Abstract base-class for different XML-types. Derivations of this class + knows how to compare, im/export a special XML-type +*/ +class XMLOFF_DLLPUBLIC XMLPropertyHandler +{ + // ??? const SvXMLUnitConverter& rUnitConverter Do we need this ? + +public: + // Just needed for virtual destruction + virtual ~XMLPropertyHandler(); + + /** Compares two Any's in case of the given XML-data-type. + By default the Any-equal-operator is called. */ + virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const; + + /// Imports the given value in cas of the given XML-data-type + virtual sal_Bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const =0; + /// Exports the given value in cas of the given XML-data-type + virtual sal_Bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const =0; +}; + +#endif // _XMLOFF_PROPERTYHANDLERBASE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlprmap.hxx b/include/xmloff/xmlprmap.hxx new file mode 100644 index 000000000000..0da806ea6768 --- /dev/null +++ b/include/xmloff/xmlprmap.hxx @@ -0,0 +1,181 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_PROPERTYSETMAPPER_HXX +#define _XMLOFF_PROPERTYSETMAPPER_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/beans/XPropertySet.hpp> + +#include <vector> +#include <xmloff/uniref.hxx> +#include <xmloff/maptype.hxx> +#include <xmloff/xmltypes.hxx> +#include <xmloff/prhdlfac.hxx> + +#include <tools/debug.hxx> + +class SvXMLUnitConverter; +class XMLPropertyHandler; + +/////////////////////////////////////////////////////////////////////////// +// +/** Helper-class for XML-im/export: + - Holds a pointer to a given array of XMLPropertyMapEntry + - Provides several methods to access data from this array + - Holds a Sequence of XML-names (for properties) + - The filter takes all properties of the XPropertySet which are also + in the XMLPropertyMapEntry and which are have not a default value + and put them into a vector of XMLPropertyStae + - this class knows how to compare, im/export properties + + Attention: At all methods, which get an index as parameter, there is no + range validation to save runtime !! +*/ +struct XMLPropertySetMapperEntry_Impl +{ + OUString sXMLAttributeName; + OUString sAPIPropertyName; + sal_uInt16 nXMLNameSpace; + sal_Int32 nType; + sal_Int16 nContextId; + SvtSaveOptions::ODFDefaultVersion nEarliestODFVersionForExport; + const XMLPropertyHandler *pHdl; + + XMLPropertySetMapperEntry_Impl( + const XMLPropertyMapEntry& rMapEntry, + const UniReference< XMLPropertyHandlerFactory >& rFactory ); + + XMLPropertySetMapperEntry_Impl( + const XMLPropertySetMapperEntry_Impl& rEntry ); + + sal_uInt32 GetPropType() const { return nType & XML_TYPE_PROP_MASK; } +}; + +class XMLOFF_DLLPUBLIC XMLPropertySetMapper : public UniRefBase +{ + ::std::vector< XMLPropertySetMapperEntry_Impl > aMapEntries; + ::std::vector< UniReference < XMLPropertyHandlerFactory > > aHdlFactories; + +public: + /** The last element of the XMLPropertyMapEntry-array must contain NULL-values */ + XMLPropertySetMapper( + const XMLPropertyMapEntry* pEntries, + const UniReference< XMLPropertyHandlerFactory >& rFactory ); + virtual ~XMLPropertySetMapper(); + + void AddMapperEntry( const UniReference < XMLPropertySetMapper >& rMapper ); + + /** Return number of entries in input-array */ + sal_Int32 GetEntryCount() const { return aMapEntries.size(); } + + /** Returns the flags of an entry */ + sal_uInt32 GetEntryFlags( sal_Int32 nIndex ) const + { + DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" ); + return aMapEntries[nIndex].nType & ~MID_FLAG_MASK; + } + + /** Returns the type of an entry */ + sal_uInt32 GetEntryType( sal_Int32 nIndex, + sal_Bool bWithFlags = sal_True ) const + { + DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" ); + sal_uInt32 nType = aMapEntries[nIndex].nType; + if( !bWithFlags ) + nType = nType & MID_FLAG_MASK; + return nType; + } + + /** Returns the namespace-key of an entry */ + sal_uInt16 GetEntryNameSpace( sal_Int32 nIndex ) const + { + DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" ); + return aMapEntries[nIndex].nXMLNameSpace; + } + + /** Returns the 'local' XML-name of the entry */ + const OUString& GetEntryXMLName( sal_Int32 nIndex ) const + { + DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" ); + return aMapEntries[nIndex].sXMLAttributeName; + } + + /** Returns the entry API name */ + const OUString& GetEntryAPIName( sal_Int32 nIndex ) const + { + DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" ); + return aMapEntries[nIndex].sAPIPropertyName; + } + + /** returns the entry context id. -1 is a valid index here. */ + sal_Int16 GetEntryContextId( sal_Int32 nIndex ) const + { + DBG_ASSERT( (nIndex >= -1) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" ); + return nIndex == -1 ? 0 : aMapEntries[nIndex].nContextId; + } + + /** returns the earliest odf version for which this property should be exported. */ + SvtSaveOptions::ODFDefaultVersion GetEarliestODFVersionForExport( sal_Int32 nIndex ) const + { + DBG_ASSERT( (nIndex >= -1) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" ); + return nIndex == -1 ? SvtSaveOptions::ODFVER_UNKNOWN : aMapEntries[nIndex].nEarliestODFVersionForExport; + } + + /** Returns the index of an entry with the given XML-name and namespace + If there is no matching entry the method returns -1 */ + sal_Int32 GetEntryIndex( sal_uInt16 nNamespace, + const OUString& rStrName, + sal_uInt32 nPropType, + sal_Int32 nStartAt = -1 ) const; + + /** Retrieves a PropertyHandler for that property wich placed at nIndex in the XMLPropertyMapEntry-array */ + const XMLPropertyHandler* GetPropertyHandler( sal_Int32 nIndex ) const + { + DBG_ASSERT( (nIndex >= 0) && (nIndex < (sal_Int32)aMapEntries.size() ), "illegal access to invalid entry!" ); + return aMapEntries[nIndex].pHdl; + } + + /** import/export + This methods calls the respective im/export-method of the respective PropertyHandler. */ + virtual sal_Bool exportXML( OUString& rStrExpValue, + const XMLPropertyState& rProperty, + const SvXMLUnitConverter& rUnitConverter ) const; + virtual sal_Bool importXML( const OUString& rStrImpValue, + XMLPropertyState& rProperty, + const SvXMLUnitConverter& rUnitConverter ) const; + + /** searches for an entry that matches the given api name, namespace and local name or -1 if nothing found */ + sal_Int32 FindEntryIndex( const sal_Char* sApiName, + sal_uInt16 nNameSpace, + const OUString& sXMLName ) const; + + /** searches for an entry that matches the given ContextId or gives -1 if nothing found */ + sal_Int32 FindEntryIndex( const sal_Int16 nContextId ) const; + + /** Remove an entry */ + void RemoveEntry( sal_Int32 nIndex ); +}; + +#endif // _XMLOFF_PROPERTYSETMAPPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlreg.hxx b/include/xmloff/xmlreg.hxx new file mode 100644 index 000000000000..1095e4861a88 --- /dev/null +++ b/include/xmloff/xmlreg.hxx @@ -0,0 +1,36 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLREG_HXX +#define _XMLOFF_XMLREG_HXX + +#include <rtl/ref.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +/** + * Register subset of UNO services from XML Office library. This is necessary when + * linking against the static "xol.lib". + * + * @return returns sal_False if at least one component could not be registered. + */ +sal_Bool XMLRegisterServices( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > ); /// [all] ServiceProvider to register in. + +#endif // _XMLOFF_XMLREG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlscripti.hxx b/include/xmloff/xmlscripti.hxx new file mode 100644 index 000000000000..031e33511a91 --- /dev/null +++ b/include/xmloff/xmlscripti.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLSCRIPTI_HXX +#define _XMLOFF_XMLSCRIPTI_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <xmloff/xmlictxt.hxx> + +namespace com { namespace sun { namespace star { namespace frame { + class XModel; +}}}} + +class XMLOFF_DLLPUBLIC XMLScriptContext : public SvXMLImportContext +{ +private: + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel; + +public: + XMLScriptContext( SvXMLImport& rImport, sal_uInt16 nPrfx, + const OUString& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel>& rDocModel ); + virtual ~XMLScriptContext(); + + // Create child element. + virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); + + virtual void EndElement(); +}; + +#endif // _XMLOFF_XMLSCRIPTI_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlstyle.hxx b/include/xmloff/xmlstyle.hxx new file mode 100644 index 000000000000..86641f067982 --- /dev/null +++ b/include/xmloff/xmlstyle.hxx @@ -0,0 +1,265 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLSTYLE_HXX +#define _XMLOFF_XMLSTYLE_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include "sal/types.h" +#include <rsc/rscsfx.hxx> +#include <tools/rtti.hxx> +#include <xmloff/uniref.hxx> +#include <xmloff/xmltkmap.hxx> +#include <xmloff/xmlictxt.hxx> + +class SvXMLStylesContext_Impl; +class SvXMLUnitConverter; +class SvXMLImportPropertyMapper; + +namespace com { namespace sun { namespace star { +namespace container { class XNameContainer; } +namespace style { class XAutoStyleFamily; } +} } } + +enum XMLStyleStylesElemTokens +{ + XML_TOK_STYLE_STYLE, + XML_TOK_STYLE_PAGE_MASTER, + XML_TOK_TEXT_LIST_STYLE, + XML_TOK_TEXT_OUTLINE, + XML_TOK_STYLES_GRADIENTSTYLES, + XML_TOK_STYLES_HATCHSTYLES, + XML_TOK_STYLES_BITMAPSTYLES, + XML_TOK_STYLES_TRANSGRADIENTSTYLES, + XML_TOK_STYLES_MARKERSTYLES, + XML_TOK_STYLES_DASHSTYLES, + XML_TOK_TEXT_NOTE_CONFIG, + XML_TOK_TEXT_BIBLIOGRAPHY_CONFIG, + XML_TOK_TEXT_LINENUMBERING_CONFIG, + XML_TOK_STYLE_DEFAULT_STYLE, + XML_TOK_STYLE_DEFAULT_PAGE_LAYOUT, //text grid enhancement + XML_TOK_STYLE_STYLES_ELEM_END=XML_TOK_UNKNOWN +}; + +class XMLOFF_DLLPUBLIC SvXMLStyleContext : public SvXMLImportContext +{ + OUString maName; + OUString maDisplayName; + OUString maAutoName; + OUString maParentName;// Will be moved to XMLPropStyle soon!!!! + OUString maFollow; // Will be moved to XMLPropStyle soon!!!! + sal_Bool mbHidden; + + OUString maHelpFile; // Will be removed very soon!!!! + + sal_uInt32 mnHelpId; // Will be removed very soon!!!! + sal_uInt16 mnFamily; + + sal_Bool mbValid : 1; // Set this to false in CreateAndInsert + // if the style shouldn't be processed + // by Finish() or si somehow invalid. + sal_Bool mbNew : 1; // Set this to false in CreateAnsInsert + // if the style is already existing. + sal_Bool mbDefaultStyle : 1; + +protected: + + virtual void SetAttribute( sal_uInt16 nPrefixKey, + const OUString& rLocalName, + const OUString& rValue ); + + void SetFamily( sal_uInt16 nSet ) { mnFamily = nSet; } + void SetAutoName( const OUString& rName ) { maAutoName = rName; } + +public: + + TYPEINFO(); + + SvXMLStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, + const OUString& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList >& xAttrList, + sal_uInt16 nFamily=0, sal_Bool bDefaultStyle = sal_False ); + + virtual ~SvXMLStyleContext(); + + virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + + virtual void StartElement( + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + + const OUString& GetName() const { return maName; } + const OUString& GetDisplayName() const { return maDisplayName.getLength() ? maDisplayName : maName; } + const OUString& GetAutoName() const { return maAutoName; } + const OUString& GetParentName() const { return maParentName; } + const OUString& GetFollow() const { return maFollow; } + + const OUString& GetHelpFile() const { return maHelpFile; } + sal_uInt32 GetHelpId() const { return mnHelpId; } + + sal_uInt16 GetFamily() const { return mnFamily; } + + sal_Bool IsValid() const { return mbValid; } + void SetValid( sal_Bool b ) { mbValid = b; } + + sal_Bool IsNew() const { return mbNew; } + void SetNew( sal_Bool b ) { mbNew = b; } + + sal_Bool IsHidden() const { return mbHidden; } + + // This method is called for every default style + virtual void SetDefaults(); + + // This method is called for every style. It must create it and insert + // it into the document. + virtual void CreateAndInsert( sal_Bool bOverwrite ); + + // This method is called for every style. It must create it and insert + // it into the document if this hasn't happened already in CreateAndInsert(). + virtual void CreateAndInsertLate( sal_Bool bOverwrite ); + + // This method is called fpr every style after all styles have been + // inserted into the document. + virtual void Finish( sal_Bool bOverwrite ); + + sal_Bool IsDefaultStyle() const { return mbDefaultStyle; } + + /** if this method returns true, its parent styles context + should not add it to its container.<br> + Transient styles can't be accessed from its + parent SvXMLStylesContext after theyre imported and + the methods CreateAndInsert(), CreateAndInsertLate() + and Finish() will not be called. + The default return value is false + */ + virtual sal_Bool IsTransient() const; +}; + +class XMLOFF_DLLPUBLIC SvXMLStylesContext : public SvXMLImportContext +{ + const OUString msParaStyleServiceName; + const OUString msTextStyleServiceName; + + SvXMLStylesContext_Impl *mpImpl; + SvXMLTokenMap *mpStyleStylesElemTokenMap; + + + ::com::sun::star::uno::Reference < + ::com::sun::star::container::XNameContainer > mxParaStyles; + + ::com::sun::star::uno::Reference < + ::com::sun::star::container::XNameContainer > mxTextStyles; + + ::com::sun::star::uno::Reference < + ::com::sun::star::style::XAutoStyleFamily > mxParaAutoStyles; + + ::com::sun::star::uno::Reference < + ::com::sun::star::style::XAutoStyleFamily > mxTextAutoStyles; + + UniReference < SvXMLImportPropertyMapper > mxParaImpPropMapper; + UniReference < SvXMLImportPropertyMapper > mxTextImpPropMapper; + UniReference < SvXMLImportPropertyMapper > mxShapeImpPropMapper; + mutable UniReference < SvXMLImportPropertyMapper > mxChartImpPropMapper; + mutable UniReference < SvXMLImportPropertyMapper > mxPageImpPropMapper; + + SAL_DLLPRIVATE const SvXMLTokenMap& GetStyleStylesElemTokenMap(); + + SAL_DLLPRIVATE SvXMLStylesContext(SvXMLStylesContext &); // not defined + SAL_DLLPRIVATE void operator =(SvXMLStylesContext &); // not defined + +protected: + + sal_uInt32 GetStyleCount() const; + SvXMLStyleContext *GetStyle( sal_uInt32 i ); + const SvXMLStyleContext *GetStyle( sal_uInt32 i ) const; + + virtual SvXMLStyleContext *CreateStyleChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + + virtual SvXMLStyleContext *CreateStyleStyleChildContext( sal_uInt16 nFamily, + sal_uInt16 nPrefix, const OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + + virtual SvXMLStyleContext *CreateDefaultStyleStyleChildContext( + sal_uInt16 nFamily, sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + + virtual sal_Bool InsertStyleFamily( sal_uInt16 nFamily ) const; + +public: + TYPEINFO(); + + SvXMLStylesContext( SvXMLImport& rImport, sal_uInt16 nPrfx, + const OUString& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList, + sal_Bool bAutomatic = sal_False ); + + virtual ~SvXMLStylesContext(); + + // Create child element. + virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, + const OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + + // This method must be overloaded to insert styles into the document. + virtual void EndElement(); + + // This allows to add an SvXMLStyleContext to this context from extern + void AddStyle(SvXMLStyleContext& rNew); + + const SvXMLStyleContext *FindStyleChildContext( + sal_uInt16 nFamily, + const OUString& rName, + sal_Bool bCreateIndex=sal_False ) const; + virtual sal_uInt16 GetFamily( const OUString& rFamily ) const; + virtual UniReference < SvXMLImportPropertyMapper > GetImportPropertyMapper( + sal_uInt16 nFamily ) const; + + virtual ::com::sun::star::uno::Reference < + ::com::sun::star::container::XNameContainer > + GetStylesContainer( sal_uInt16 nFamily ) const; + virtual OUString GetServiceName( sal_uInt16 nFamily ) const; + + virtual ::com::sun::star::uno::Reference < ::com::sun::star::style::XAutoStyleFamily > + GetAutoStyles( sal_uInt16 nFamily ) const; + void CopyAutoStylesToDoc(); + void CopyStylesToDoc( sal_Bool bOverwrite, sal_Bool bFinish=sal_True ); + void FinishStyles( sal_Bool bOverwrite ); + + // This method must be called to release the references to all styles + // that are stored in the context. + void Clear(); + sal_Bool IsAutomaticStyle() const; +}; + +#endif // _XMLOFF_XMLSTYLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmltabe.hxx b/include/xmloff/xmltabe.hxx new file mode 100644 index 000000000000..114624d1a15a --- /dev/null +++ b/include/xmloff/xmltabe.hxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLTABE_HXX +#define _XMLOFF_XMLTABE_HXX + +// prevent funny things like "#define sun 1" from the compiler +#include <sal/config.h> + +class SvXMLExport; +namespace com { namespace sun { namespace star { + namespace style { struct TabStop; } + namespace uno { class Any; } +} } } + + +class SvxXMLTabStopExport +{ + SvXMLExport& rExport; // for access to document handler + +protected: + + void exportTabStop( const ::com::sun::star::style::TabStop* pTabStop ); + +public: + + SvxXMLTabStopExport( SvXMLExport& rExport ); + virtual ~SvxXMLTabStopExport(); + + // core API + void Export( const ::com::sun::star::uno::Any& rAny ); +}; + + +#endif // _XMLOFF_XMLTABE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmltkmap.hxx b/include/xmloff/xmltkmap.hxx new file mode 100644 index 000000000000..9df059f6da9a --- /dev/null +++ b/include/xmloff/xmltkmap.hxx @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLTKMAP_HXX +#define _XMLOFF_XMLTKMAP_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <sal/types.h> +#include <xmloff/xmltoken.hxx> + + +class SvXMLTokenMap_Impl; +class SvXMLTokenMapEntry_Impl; + +#define XML_TOK_UNKNOWN 0xffffU +#define XML_TOKEN_MAP_END { 0xffffU, ::xmloff::token::XML_TOKEN_INVALID, 0U } + +struct SvXMLTokenMapEntry +{ + sal_uInt16 nPrefixKey; + enum ::xmloff::token::XMLTokenEnum eLocalName; + sal_uInt16 nToken; +}; + +class XMLOFF_DLLPUBLIC SvXMLTokenMap +{ + SvXMLTokenMap_Impl *pImpl; + + SAL_DLLPRIVATE SvXMLTokenMapEntry_Impl *_Find( + sal_uInt16 nKind, const OUString& rName ) const; + +public: + + SvXMLTokenMap( const SvXMLTokenMapEntry* pMap ); + ~SvXMLTokenMap(); + + sal_uInt16 Get( sal_uInt16 nPrefix, const OUString& rLName ) const; +}; + +#endif // _XMLOFF_XMLTKMAP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx new file mode 100644 index 000000000000..a40da2c19b5c --- /dev/null +++ b/include/xmloff/xmltoken.hxx @@ -0,0 +1,3212 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLTOKEN_HXX +#define _XMLOFF_XMLTOKEN_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include <sal/types.h> +#include <rtl/ustring.hxx> + +/** + * Handling of tokens in XML: + * + * This header defines te enum ::xmloff::token::XMLTokenEnum containing one + * value for every fixed string used in our XML files. + * + * Usage: + * To obtain an OUString for a token, use the GetXMLToken() function. + * To test equality of an OUString and a token, use IsXMLToken(). + * Additionally, XMLTokenEnum values may be passed to SvXMLExport::AddAttribute + * methods and the SvXMLElementExport constructor. + */ + +namespace xmloff { namespace token { + + + /** + * The enumeration of all XML tokens. + */ + enum XMLTokenEnum + { + XML_TOKEN_START = 0, + XML_TOKEN_INVALID = XML_TOKEN_START, + + // common xml + XML_CDATA, + XML_WS, + XML_XML, + XML_XMLNS, + XML_XML_PI, + XML_XML_DOCTYPE_PREFIX, + XML_XML_DOCTYPE_SUFFIX, + + // namespace prefixes and names + XML_N_XML, + XML_NP_OFFICE, + XML_N_OFFICE, + XML_N_OFFICE_OLD, + XML_NP_META, + XML_N_META, + XML_N_META_OLD, + XML_NP_STYLE, + XML_N_STYLE, + XML_N_STYLE_OLD, + XML_NP_NUMBER, + XML_N_NUMBER, + XML_N_NUMBER_OLD, + XML_NP_TEXT, + XML_N_TEXT, + XML_N_TEXT_OLD, + XML_NP_TABLE, + XML_N_TABLE, + XML_N_TABLE_OLD, + XML_NP_DRAW, + XML_N_DRAW, + XML_NP_DR3D, + XML_N_DR3D, + XML_N_DRAW_OLD, + XML_NP_PRESENTATION, + XML_N_PRESENTATION, + XML_N_PRESENTATION_OLD, + XML_NP_CHART, + XML_N_CHART, + XML_NP_CONFIG, + XML_N_CONFIG, + XML_N_CHART_OLD, + XML_NP_FO, + XML_N_FO_OLD, + XML_N_FO, + XML_NP_XLINK, + XML_N_XLINK, + XML_N_XLINK_OLD, + XML_NP_DC, + XML_N_DC, + XML_NP_SVG, + XML_N_SVG, + XML_NP_FORM, + XML_N_FORM, + XML_NP_SCRIPT, + XML_N_SCRIPT, + XML_NP_XFORMS_1_0, + XML_N_XFORMS_1_0, + XML_NP_XSD, + XML_N_XSD, + XML_NP_XSI, + XML_N_XSI, + + XML_NP_BLOCK_LIST, + XML_N_BLOCK_LIST, + + XML_NP_MATH, + XML_N_MATH, + + XML_NP_VERSIONS_LIST, + XML_N_VERSIONS_LIST, + + // erAck: 2008-04-09T20:02+0200 OpenFormula aka ODFF + XML_NP_OF, + XML_N_OF, + + // ODF 1.2 metadata: RDFa and GRDDL + XML_NP_XHTML, + XML_N_XHTML, + XML_NP_GRDDL, + XML_N_GRDDL, + + // ODF Enhanced namespaces + XML_NP_OFFICE_EXT, + XML_N_OFFICE_EXT, + + // jonp: 2008-09-24 Excel Interop + XML_NP_FORMX, + XML_N_FORMX, + + XML_NP_TABLE_EXT, + XML_N_TABLE_EXT, + + XML_NP_DRAW_EXT, + XML_N_DRAW_EXT, + + // css text level 3 + XML_NP_CSS3TEXT, + XML_N_CSS3TEXT, + + // calc extensions + XML_NP_CALC_EXT, + XML_N_CALC_EXT, + + // units + XML_UNIT_MM, + XML_UNIT_M, + XML_UNIT_KM, + XML_UNIT_CM, + XML_UNIT_PT, + XML_UNIT_PC, + XML_UNIT_FOOT, + XML_UNIT_MILES, + XML_UNIT_INCH, + + // any other + XML_1, + XML_10, + XML_2, + XML_3, + XML_4, + XML_5, + XML_6, + XML_7, + XML_8, + XML_9, + XML_A_UPCASE, + XML_I_UPCASE, + XML_IBM437, + XML_IBM850, + XML_IBM860, + XML_IBM861, + XML_IBM863, + XML_IBM865, + XML_ISO_8859_1, + XML_OLE2, + XML__COLON, + XML__EMPTY, + XML__UNKNOWN_, + + XML_A, + XML_ABBREVIATED_NAME, + XML_ABOVE, + XML_ABS, + XML_ACCENT, + XML_ACCENTUNDER, + XML_ACCEPTANCE_STATE, + XML_ACCEPTED, + XML_ACTION, + XML_ACTIVE, + XML_ACTIVE_SPLIT_RANGE, + XML_ACTIVE_TABLE, + XML_ACTUATE, + XML_ADD_IN, + XML_ADD_IN_NAME, + XML_ADDRESS, + XML_ADJUSTMENT, + XML_ALGORITHM, + XML_ALIGN, + XML_ALL, + XML_ALLOW_EMPTY_CELL, + XML_ALPHABETICAL_INDEX, + XML_ALPHABETICAL_INDEX_AUTO_MARK_FILE, + XML_ALPHABETICAL_INDEX_ENTRY_TEMPLATE, + XML_ALPHABETICAL_INDEX_MARK, + XML_ALPHABETICAL_INDEX_MARK_END, + XML_ALPHABETICAL_INDEX_MARK_START, + XML_ALPHABETICAL_INDEX_SOURCE, + XML_ALPHABETICAL_SEPARATORS, + XML_ALTERNATE, + XML_AM_PM, + XML_AMBIENT_COLOR, + XML_ANCHOR_PAGE_NUMBER, + XML_ANCHOR_TYPE, + XML_AND, + XML_ANIMATION, + XML_ANIMATION_DELAY, + XML_ANIMATION_DIRECTION, + XML_ANIMATION_REPEAT, + XML_ANIMATION_START_INSIDE, + XML_ANIMATION_STEPS, + XML_ANIMATION_STOP_INSIDE, + XML_ANIMATIONS, + XML_ANNOTATION, + XML_ANNOTATION_END, + XML_ANNOTATIONS, + XML_ANNOTE, + XML_APPEAR, + XML_APPLET, + XML_APPLET_NAME, + XML_APPLICATION_DATA, + XML_APPLICATION_XML, + XML_APPLY, + XML_APPLY_STYLE_NAME, + XML_AQUA, + XML_ARC, + XML_ARCCOS, + XML_ARCHIVE, + XML_ARCSIN, + XML_ARCTAN, + XML_AREA, + XML_AREA_CIRCLE, + XML_AREA_POLYGON, + XML_AREA_RECTANGLE, + XML_ARTICLE, + XML_AS_CHAR, + XML_ASCENDING, + XML_ATTACHED_AXIS, + XML_ATTRACTIVE, + XML_AUTHOR, + XML_AUTHOR_INITIALS, + XML_AUTHOR_NAME, + XML_AUTO, + XML_AUTO_GROW_HEIGHT, + XML_AUTO_GROW_WIDTH, + XML_AUTO_RELOAD, + XML_AUTO_TEXT, + XML_AUTO_TEXT_EVENTS, + XML_AUTO_TEXT_GROUP, + XML_AUTO_TEXT_INDENT, + XML_AUTO_UPDATE, + XML_AUTOMATIC, + XML_AUTOMATIC_FIND_LABELS, + XML_AUTOMATIC_ORDER, + XML_AUTOMATIC_STYLES, + XML_AUTOMATIC_UPDATE, + XML_AUTOSIZE, + XML_AVERAGE, + XML_AXIS, + XML_AXIS_COLOR, + XML_BACK_SCALE, + XML_BACKFACE_CULLING, + XML_BACKGROUND, + XML_BACKGROUND_COLOR, + XML_BACKGROUND_IMAGE, + XML_BACKGROUND_NO_REPEAT, + XML_BACKGROUND_REPEAT, + XML_BACKGROUND_STRETCH, + XML_BAR, + XML_BASE64BINARY, + XML_BASE_CELL_ADDRESS, + XML_BASELINE, + XML_BEFORE_DATE_TIME, + XML_BELOW, + XML_BETWEEN_DATE_TIMES, + XML_BEVEL, + XML_BIBILIOGRAPHIC_TYPE, + XML_BIBLIOGRAPHY, + XML_BIBLIOGRAPHY_CONFIGURATION, + XML_BIBLIOGRAPHY_DATA_FIELD, + XML_BIBLIOGRAPHY_ENTRY_TEMPLATE, + XML_BIBLIOGRAPHY_MARK, + XML_BIBLIOGRAPHY_SOURCE, + XML_BIBLIOGRAPHY_TYPE, + XML_BIND_STYLES_TO_CONTENT, + XML_BITMAP, + XML_BLACK, + XML_BLEND, + XML_BLINKING, + XML_BLOCK, + XML_BLOCK_LIST, + XML_BLUE, + XML_BODY, + XML_BOLD, + XML_BOOK, + XML_BOOKLET, + XML_BOOKMARK, + XML_BOOKMARK_END, + XML_BOOKMARK_REF, + XML_BOOKMARK_START, + XML_BOOKTITLE, + XML_BOOLEAN, + XML_BOOLEAN_STYLE, + XML_BOOLEAN_VALUE, + XML_BORDER, + XML_BORDER_BOTTOM, + XML_BORDER_COLOR, + XML_BORDER_LEFT, + XML_BORDER_LINE_WIDTH, + XML_BORDER_LINE_WIDTH_BOTTOM, + XML_BORDER_LINE_WIDTH_LEFT, + XML_BORDER_LINE_WIDTH_RIGHT, + XML_BORDER_LINE_WIDTH_TOP, + XML_BORDER_RIGHT, + XML_BORDER_TOP, + XML_BOTH, + XML_BOTTOM, + XML_BOTTOM_LEFT, + XML_BOTTOM_PERCENT, + XML_BOTTOM_RIGHT, + XML_BOTTOM_VALUES, + XML_BOTTOMARC, + XML_BOTTOMCIRCLE, + XML_BREAK_AFTER, + XML_BREAK_BEFORE, + XML_BREAK_INSIDE, + XML_BUBBLE, + XML_BULLET_CHAR, + XML_BULLET_RELATIVE_SIZE, + XML_BUTT, + XML_BUTTON1, + XML_BUTTON2, + XML_BUTTON3, + XML_BUTTON4, + XML_BUTTONS, + XML_BVAR, + XML_C, + XML_CALCULATION_SETTINGS, + XML_CALENDAR, + XML_CAPITALIZE_ENTRIES, + XML_CAPTION, + XML_CAPTION_POINT_X, + XML_CAPTION_POINT_Y, + XML_CAPTION_SEQUENCE_FORMAT, + XML_CAPTION_SEQUENCE_NAME, + XML_CASE_SENSITIVE, + XML_CASEMAP_CAPITALIZE, + XML_CASEMAP_LOWERCASE, + XML_CASEMAP_NORMAL, + XML_CASEMAP_SMALL_CAPS, + XML_CASEMAP_UPPERCASE, + XML_CATEGORIES, + XML_CATEGORY, + XML_CATEGORY_AND_VALUE, + XML_CELL_ADDRESS, + XML_CELL_CONTENT_CHANGE, + XML_CELL_CONTENT_DELETION, + XML_CELL_COUNT, + XML_CELL_PROTECT, + XML_CELL_RANGE_ADDRESS, + XML_CELL_RANGE_ADDRESS_LIST, + XML_CELL_RANGE_SOURCE, + XML_CENTER, + XML_CHAIN_NEXT_NAME, + XML_CHANGE, + XML_CHANGE_DELETION, + XML_CHANGE_END, + XML_CHANGE_ID, + XML_CHANGE_INFO, + XML_CHANGE_START, + XML_CHANGE_TRACK_TABLE_CELL, + XML_CHANGE_VIEW_CONDITIONS, + XML_CHANGE_VIEW_SETTINGS, + XML_CHANGED_REGION, + XML_CHAPTER, + XML_CHAR, + XML_CHARACTER_COUNT, + XML_CHART, + XML_CHARTS, + XML_CHECKERBOARD, + XML_CHG_AUTHOR, + XML_CHG_COMMENT, + XML_CHG_DATE_TIME, + XML_CI, + XML_CIRCLE, + XML_CITATION_BODY_STYLE_NAME, + XML_CITATION_STYLE_NAME, + XML_CLASS, + XML_CLASS_ID, + XML_CLIP, + XML_CLOCKWISE, + XML_CLOSE, + XML_CLOSE_HORIZONTAL, + XML_CLOSE_VERTICAL, + XML_CM, + XML_CN, + XML_CODE, + XML_CODEBASE, + XML_COLLAPSE, + XML_COLOR, + XML_COLOR_INVERSION, + XML_COLOR_MODE, + XML_COLOR_SCALE, + XML_COLOR_SCALE_ENTRY, + XML_COLUMN, + XML_COLUMN_COUNT, + XML_COLUMN_GAP, + XML_COLUMN_NAME, + XML_COLUMN_SEP, + XML_COLUMN_WIDTH, + XML_COLUMNS, + XML_COLUMNSPLIT_AUTO, + XML_COLUMNSPLIT_AVOID, + XML_COMBINE_ENTRIES, + XML_COMBINE_ENTRIES_WITH_DASH, + XML_COMBINE_ENTRIES_WITH_PP, + XML_COMMA_SEPARATED, + XML_COMMAND, + XML_COMMENT, + XML_COMPOSE, + XML_COND_STYLE_NAME, + XML_CONDITION, + XML_CONDITION_SOURCE, + XML_CONDITION_SOURCE_RANGE_ADDRESS, + XML_CONDITIONAL_TEXT, + XML_CONDITIONAL_FORMAT, + XML_CONDITIONAL_FORMATS, + XML_CONE, + XML_CONFERENCE, + XML_CONFIG_ITEM, + XML_CONFIG_ITEM_MAP_ENTRY, + XML_CONFIG_ITEM_MAP_INDEXED, + XML_CONFIG_ITEM_MAP_NAMED, + XML_CONFIG_ITEM_SET, + XML_CONFIGURATION_SETTINGS, + XML_CONJUGATE, + XML_CONNECT_BARS, + XML_CONNECTION_NAME, + XML_CONNECTOR, + XML_CONSECUTIVE_NUMBERING, + XML_CONSOLIDATION, + XML_CONSTANT, + XML_CONTAINS_ERROR, + XML_CONTAINS_HEADER, + XML_CONTENT, + XML_CONTENT_VALIDATION, + XML_CONTENT_VALIDATION_NAME, + XML_CONTENT_VALIDATIONS, + XML_CONTEXTUAL_SPACING, + XML_CONTINUE, + XML_CONTINUE_NUMBERING, + XML_CONTOUR_PATH, + XML_CONTOUR_POLYGON, + XML_CONTRAST, + XML_CONTROL, + XML_CONVERSION_MODE, + XML_COPY_BACK, + XML_COPY_FORMULAS, + XML_COPY_OUTLINE_LEVELS, + XML_COPY_RESULTS_ONLY, + XML_COPY_STYLES, + XML_CORNER_RADIUS, + XML_CORRECT, + XML_COS, + XML_COSH, + XML_COT, + XML_COTH, + XML_COUNT, + XML_COUNT_EMPTY_LINES, + XML_COUNT_IN_FLOATING_FRAMES, + XML_COUNTER_CLOCKWISE, + XML_COUNTERCLOCKWISE, + XML_COUNTNUMS, + XML_COUNTRY, + XML_COUNTRY_ASIAN, + XML_COUNTRY_COMPLEX, + XML_COVERED_TABLE_CELL, + XML_CREATE_DATE, + XML_CREATE_DATE_STRING, + XML_CREATION_DATE, + XML_CREATION_TIME, + XML_CREATOR, + XML_CSC, + XML_CSCH, + XML_CUBE, + XML_CUBOID, + XML_CURRENCY, + XML_CURRENCY_STYLE, + XML_CURRENCY_SYMBOL, + XML_CURRENT, + XML_CURRENT_VALUE, + XML_CURSOR_POSITION, + XML_CURSOR_POSITION_X, + XML_CURSOR_POSITION_Y, + XML_CURVE, + XML_CUSTOM1, + XML_CUSTOM2, + XML_CUSTOM3, + XML_CUSTOM4, + XML_CUSTOM5, + XML_CUT, + XML_CUT_OFFS, + XML_CX, + XML_CY, + XML_CYLINDER, + XML_D, + XML_DASH, + XML_DASHED, + XML_DATA, + XML_DATA_BAR, + XML_DATA_BAR_ENTRY, + XML_DATA_CELL_RANGE_ADDRESS, + XML_DATA_LABEL_NUMBER, + XML_DATA_LABEL_SYMBOL, + XML_DATA_LABEL_TEXT, + XML_DATA_PILOT_FIELD, + XML_DATA_PILOT_GRAND_TOTAL, + XML_DATA_PILOT_LEVEL, + XML_DATA_PILOT_MEMBER, + XML_DATA_PILOT_MEMBERS, + XML_DATA_PILOT_SUBTOTAL, + XML_DATA_PILOT_SUBTOTALS, + XML_DATA_PILOT_TABLE, + XML_DATA_PILOT_TABLES, + XML_DATA_POINT, + XML_DATA_STYLE, + XML_DATA_STYLE_NAME, + XML_DATA_TYPE, + XML_DATABASE_DISPLAY, + XML_DATABASE_NAME, + XML_DATABASE_NEXT, + XML_DATABASE_RANGE, + XML_DATABASE_RANGES, + XML_DATABASE_ROW_NUMBER, + XML_DATABASE_SELECT, + XML_DATABASE_SOURCE_QUERY, + XML_DATABASE_SOURCE_SQL, + XML_DATABASE_SOURCE_TABLE, + XML_DATE, + XML_DATE_IS, + XML_DATE_ADJUST, + XML_DATE_STYLE, + XML_DATE_TIME, + XML_DATE_VALUE, + XML_DATETIME, + XML_DAY, + XML_DAY_OF_WEEK, + XML_DDE_APPLICATION, + XML_DDE_CONNECTION, + XML_DDE_CONNECTION_DECL, + XML_DDE_CONNECTION_DECLS, + XML_DDE_ITEM, + XML_DDE_LINK, + XML_DDE_LINKS, + XML_DDE_SOURCE, + XML_DDE_TOPIC, + XML_DECIMAL_PLACES, + XML_DECIMAL_REPLACEMENT, + XML_DECLARE, + XML_DECORATE_WORDS_ONLY, + XML_DECORATIVE, + XML_DEEP, + XML_DEFAULT, + XML_DEFAULT_CELL_STYLE_NAME, + XML_DEFAULT_STYLE, + XML_DEFAULT_STYLE_NAME, + XML_DEGREE, + XML_DELAY, + XML_DELETION, + XML_DELETIONS, + XML_DENOMINATOR_VALUE, + XML_DEPENDENCE, + XML_DEPENDENCES, + XML_DEPENDENCIES, + XML_DEPTH, + XML_DESC, + XML_DESCENDING, + XML_DESCRIPTION, + XML_DETECTIVE, + XML_DETERMINANT, + XML_DIFF, + XML_DIFFUSE_COLOR, + XML_DIM, + XML_DIRECTION, + XML_DISABLED, + XML_DISC, + XML_DISPLAY, + XML_DISPLAY_BORDER, + XML_DISPLAY_DETAILS, + XML_DISPLAY_DUPLICATES, + XML_DISPLAY_EMPTY, + XML_DISPLAY_FILTER_BUTTONS, + XML_DISPLAY_FORMULA, + XML_DISPLAY_LABEL, + XML_DISPLAY_LEVELS, + XML_DISPLAY_NAME, + XML_DISPLAY_OUTLINE_LEVEL, + XML_DISSOLVE, + XML_DISTANCE, + XML_DISTANCE_AFTER_SEP, + XML_DISTANCE_BEFORE_SEP, + XML_DISTRIBUTE, + XML_DISTRIBUTE_LETTER, + XML_DISTRIBUTE_SPACE, + XML_DIVIDE, + XML_DOCUMENT, + XML_DOCUMENT_CONTENT, + XML_DOCUMENT_META, + XML_DOCUMENT_SETTINGS, + XML_DOCUMENT_STATISTIC, + XML_DOCUMENT_STYLES, + XML_DOMAIN, + XML_DOT, + XML_DOTS1, + XML_DOTS1_LENGTH, + XML_DOTS2, + XML_DOTS2_LENGTH, + XML_DOTTED, + XML_DOUBLE, + XML_DOUBLE_SIDED, + XML_DOWN, + XML_DRAFT, + XML_DRAW, + XML_DRAW_ASPECT, + XML_DRAWING, + XML_DRAWINGS, + XML_DRAWPOOL, + XML_DROP_CAP, + XML_DYNAMIC, + XML_EDGE_ROUNDING, + XML_EDITABLE, + XML_EDITING_CYCLES, + XML_EDITING_DURATION, + XML_EDITION, + XML_EDITOR, + XML_EFFECT, + XML_ELLIPSE, + XML_EMAIL, + XML_EMBED, + XML_EMBEDDED_VISIBLE_AREA, + XML_EMBOSSED, + XML_EMISSIVE_COLOR, + XML_EMPTY, + XML_ENABLE_NUMBERING, + XML_ENABLED, + XML_ENCODING, + XML_END, + XML_END_ANGLE, + XML_END_CELL_ADDRESS, + XML_END_COLOR, + XML_END_COLUMN, + XML_END_GLUE_POINT, + XML_END_GUIDE, + XML_END_INTENSITY, + XML_END_LINE_SPACING_HORIZONTAL, + XML_END_LINE_SPACING_VERTICAL, + XML_END_POSITION, + XML_END_ROW, + XML_END_SHAPE, + XML_END_TABLE, + XML_END_X, + XML_END_Y, + XML_ENDLESS, + XML_ENDNOTE, + XML_ENDNOTE_BODY, + XML_ENDNOTE_CITATION, + XML_ENDNOTE_REF, + XML_ENDNOTES_CONFIGURATION, + XML_ENGRAVED, + XML_EQ, + XML_EQUAL_AUTHOR, + XML_EQUAL_COMMENT, + XML_EQUAL_DATE, + XML_ERA, + XML_ERGO_SUM, + XML_ERROR_CATEGORY, + XML_ERROR_LOWER_INDICATOR, + XML_ERROR_LOWER_LIMIT, + XML_ERROR_MACRO, + XML_ERROR_MARGIN, + XML_ERROR_MESSAGE, + XML_ERROR_PERCENTAGE, + XML_ERROR_UPPER_INDICATOR, + XML_ERROR_UPPER_LIMIT, + XML_ESCAPEMENT_SUB, + XML_ESCAPEMENT_SUPER, + XML_EVEN_PAGE, + XML_EVENT, + XML_EVENT_NAME, + XML_EVENTS, + XML_EXECUTE, + XML_EXECUTE_MACRO, + XML_EXISTS, + XML_EXP, + XML_EXPONENTIAL, + XML_EXPRESSION, + XML_EXTRA, + XML_EXTRUDE, + XML_FACTORIAL, + XML_FADE, + XML_FADE_FROM_BOTTOM, + XML_FADE_FROM_CENTER, + XML_FADE_FROM_LEFT, + XML_FADE_FROM_LOWERLEFT, + XML_FADE_FROM_LOWERRIGHT, + XML_FADE_FROM_RIGHT, + XML_FADE_FROM_TOP, + XML_FADE_FROM_UPPERLEFT, + XML_FADE_FROM_UPPERRIGHT, + XML_FADE_OUT, + XML_FADE_TO_CENTER, + XML_FALSE, + XML_FAMILY, + XML_FAST, + XML_FIELD_NUMBER, + XML_FILE_NAME, + XML_FILL, + XML_FILL_CHARACTER, + XML_FILL_COLOR, + XML_FILL_GRADIENT_NAME, + XML_FILL_HATCH_NAME, + XML_FILL_HATCH_SOLID, + XML_FILL_IMAGE, + XML_FILL_IMAGE_HEIGHT, + XML_FILL_IMAGE_NAME, + XML_FILL_IMAGE_REF_POINT, + XML_FILL_IMAGE_REF_POINT_X, + XML_FILL_IMAGE_REF_POINT_Y, + XML_FILL_IMAGE_WIDTH, + XML_FILTER, + XML_FILTER_AND, + XML_FILTER_CONDITION, + XML_FILTER_NAME, + XML_FILTER_OPTIONS, + XML_FILTER_OR, + XML_FILTER_SET_ITEM, + XML_FIRST_DATE_TIME, + XML_FIRST_PAGE, + XML_FIRST_PAGE_NUMBER, + XML_FIT_TO_CONTOUR, + XML_FIT_TO_SIZE, + XML_FIX, + XML_FIXED, + XML_FLAT, + XML_FLOAT, + XML_FLOATING_FRAME, + XML_FLOOR, + XML_FN, + XML_FOCAL_LENGTH, + XML_FONT_CHAR_WIDTH, + XML_FONT_CHARSET, + XML_FONT_CHARSET_ASIAN, + XML_FONT_CHARSET_COMPLEX, + XML_FONT_COLOR, + XML_FONT_DECL, + XML_FONT_DECLS, + XML_FONT_FAMILY, + XML_FONT_FAMILY_ASIAN, + XML_FONT_FAMILY_COMPLEX, + XML_FONT_FAMILY_GENERIC, + XML_FONT_FAMILY_GENERIC_ASIAN, + XML_FONT_FAMILY_GENERIC_COMPLEX, + XML_FONT_KERNING, + XML_FONT_NAME, + XML_FONT_NAME_ASIAN, + XML_FONT_NAME_COMPLEX, + XML_FONT_PITCH, + XML_FONT_PITCH_ASIAN, + XML_FONT_PITCH_COMPLEX, + XML_FONT_RELIEF, + XML_FONT_SIZE, + XML_FONT_SIZE_ASIAN, + XML_FONT_SIZE_COMPLEX, + XML_FONT_SIZE_REL, + XML_FONT_SIZE_REL_ASIAN, + XML_FONT_SIZE_REL_COMPLEX, + XML_FONT_STYLE, + XML_FONT_STYLE_ASIAN, + XML_FONT_STYLE_COMPLEX, + XML_FONT_STYLE_NAME, + XML_FONT_STYLE_NAME_ASIAN, + XML_FONT_STYLE_NAME_COMPLEX, + XML_FONT_VARIANT, + XML_FONT_WEIGHT, + XML_FONT_WEIGHT_ASIAN, + XML_FONT_WEIGHT_COMPLEX, + XML_FONT_WIDTH, + XML_FONT_WORD_LINE_MODE, + XML_FONTFAMILY, + XML_FONTSIZE, + XML_FONTSTYLE, + XML_FONTWEIGHT, + XML_FONTWORK_ADJUST, + XML_FONTWORK_DISTANCE, + XML_FONTWORK_FORM, + XML_FONTWORK_HIDE_FORM, + XML_FONTWORK_MIRROR, + XML_FONTWORK_OUTLINE, + XML_FONTWORK_SHADOW, + XML_FONTWORK_SHADOW_COLOR, + XML_FONTWORK_SHADOW_OFFSET_X, + XML_FONTWORK_SHADOW_OFFSET_Y, + XML_FONTWORK_SHADOW_TRANSPARENCE, + XML_FONTWORK_START, + XML_FONTWORK_STYLE, + XML_FOOTER, + XML_FOOTER_FIRST, + XML_FOOTER_LEFT, + XML_FOOTER_STYLE, + XML_FOOTNOTE, + XML_FOOTNOTE_BODY, + XML_FOOTNOTE_CITATION, + XML_FOOTNOTE_CONTINUATION_NOTICE_BACKWARD, + XML_FOOTNOTE_CONTINUATION_NOTICE_FORWARD, + XML_FOOTNOTE_MAX_HEIGHT, + XML_FOOTNOTE_REF, + XML_FOOTNOTE_SEP, + XML_FOOTNOTES_CONFIGURATION, + XML_FOOTNOTES_POSITION, + XML_FORALL, + XML_FORCE_MANUAL, + XML_FOREGROUND, + XML_FOREIGN_OBJECT, + XML_FORMAT_CHANGE, + XML_FORMAT_SOURCE, + XML_FORMATTING_ENTRY, + XML_FORMS, + XML_FORMULA, + XML_FORMULA_HIDDEN, + XML_FORMULAS, + XML_FRACTION, + XML_FRAME, + XML_FRAME_CONTENT, + XML_FRAME_DISPLAY_BORDER, + XML_FRAME_DISPLAY_SCROLLBAR, + XML_FRAME_END_MARGIN, + XML_FRAME_MARGIN_HORIZONTAL, + XML_FRAME_MARGIN_VERTICAL, + XML_FRAME_NAME, + XML_FRAME_START_MARGIN, + XML_FREEZE, + XML_FREEZE_POSITION, + XML_FROM_ANOTHER_TABLE, + XML_FROM_BOTTOM, + XML_FROM_CENTER, + XML_FROM_INSIDE, + XML_FROM_LEFT, + XML_FROM_LOWER_LEFT, + XML_FROM_LOWER_RIGHT, + XML_FROM_RIGHT, + XML_FROM_SAME_TABLE, + XML_FROM_TOP, + XML_FROM_UPPER_LEFT, + XML_FROM_UPPER_RIGHT, + XML_FUCHSIA, + XML_FULL, + XML_FULL_SCREEN, + XML_FUNCTION, + XML_FX, + XML_FY, + XML_G, + XML_GAMMA, + XML_GAP, + XML_GAP_WIDTH, + XML_GCD, + XML_GENERATOR, + XML_GEQ, + XML_GOURAUD, + XML_GRADIENT, + XML_GRADIENT_ANGLE, + XML_GRADIENT_BORDER, + XML_GRADIENT_STEP_COUNT, + XML_GRADIENT_STYLE, + XML_GRADIENTSTYLE_AXIAL, + XML_GRADIENTSTYLE_ELLIPSOID, + XML_GRADIENTSTYLE_LINEAR, + XML_GRADIENTSTYLE_RADIAL, + XML_GRADIENTSTYLE_RECTANGULAR, + XML_GRADIENTSTYLE_SQUARE, + XML_GRADIENTTRANSFORM, + XML_GRAND_TOTAL, + XML_GRAPHIC, + XML_GRAY, + XML_GREEN, + XML_GREYSCALE, + XML_GRID, + XML_GROOVE, + XML_GROUP_BY_FIELD_NUMBER, + XML_GROUP_NAME, + XML_GROUPING, + XML_GT, + XML_GUIDE_DISTANCE, + XML_GUIDE_OVERHANG, + XML_H, + XML_HANGING, + XML_HAS_PERSISTENT_DATA, + XML_HATCH, + XML_HATCH_DISTANCE, + XML_HATCH_STYLE, + XML_HATCHSTYLE_DOUBLE, + XML_HATCHSTYLE_SINGLE, + XML_HATCHSTYLE_TRIPLE, + XML_HEADER, + XML_HEADER_FIRST, + XML_HEADER_LEFT, + XML_HEADER_STYLE, + XML_HEADERS, + XML_HEIGHT, + XML_HELP, + XML_HELP_FILE_NAME, + XML_HELP_ID, + XML_HELP_MESSAGE, + XML_HIDDEN, + XML_HIDDEN_AND_PROTECTED, + XML_HIDDEN_PARAGRAPH, + XML_HIDDEN_TEXT, + XML_HIDE, + XML_HIDE_SHAPE, + XML_HIDE_TEXT, + XML_HIGHLIGHTED_RANGE, + XML_HINT, + XML_HORIZONTAL, + XML_HORIZONTAL_LINES, + // XML_HORIZONTAL_ON_LEFT_PAGES and XML_HORIZONTAL_ON_RIGHT_PAGES + // are replaced by XML_HORIZONTAL_ON_EVEN and XML_HORIZONTAL_ON_ODD. + // Usage is deprecated, but the old token are needed for the + // OpenOffice.org file format import/export filter for the renaming (#i49139#) + XML_HORIZONTAL_ON_LEFT_PAGES, + XML_HORIZONTAL_ON_RIGHT_PAGES, + XML_HORIZONTAL_POS, + XML_HORIZONTAL_REL, + XML_HORIZONTAL_SCROLLBAR_WIDTH, + XML_HORIZONTAL_SEGMENTS, + XML_HORIZONTAL_SPLIT_MODE, + XML_HORIZONTAL_SPLIT_POSITION, + XML_HORIZONTAL_STRIPES, + XML_HOURS, + XML_HOWPUBLISHED, + XML_HREF, + XML_HTML, + XML_HYPERLINK, + XML_HYPERLINK_BEHAVIOUR, + XML_HYPHENATE, + XML_HYPHENATION_KEEP, + XML_HYPHENATION_LADDER_COUNT, + XML_HYPHENATION_PUSH_CHAR_COUNT, + XML_HYPHENATION_REMAIN_CHAR_COUNT, + XML_I, + XML_ICON, + XML_ICON_SET, + XML_ICON_SET_TYPE, + XML_ID, + XML_IDENT, + XML_IDENTIFIER, + XML_IDENTIFY_CATEGORIES, + XML_IDEOGRAPH_ALPHA, + XML_IGNORE_CASE, + XML_IGNORE_EMPTY_ROWS, + XML_ILLUSTRATION_INDEX, + XML_ILLUSTRATION_INDEX_ENTRY_TEMPLATE, + XML_ILLUSTRATION_INDEX_SOURCE, + XML_IMAGE, + XML_IMAGE_COUNT, + XML_IMAGE_MAP, + XML_IMPLIES, + XML_IN, + XML_IN_RANGE, + XML_INBOOK, + XML_INCOLLECTION, + XML_INCREMENT, + XML_INDEX, + XML_INDEX_BODY, + XML_INDEX_ENTRY_BIBLIOGRAPHY, + XML_INDEX_ENTRY_CHAPTER, + XML_INDEX_ENTRY_CHAPTER_NUMBER, + XML_INDEX_ENTRY_LINK_END, + XML_INDEX_ENTRY_LINK_START, + XML_INDEX_ENTRY_PAGE_NUMBER, + XML_INDEX_ENTRY_SPAN, + XML_INDEX_ENTRY_TAB_STOP, + XML_INDEX_ENTRY_TEMPLATE, + XML_INDEX_ENTRY_TEXT, + XML_INDEX_NAME, + XML_INDEX_SCOPE, + XML_INDEX_SOURCE_STYLE, + XML_INDEX_SOURCE_STYLES, + XML_INDEX_TITLE, + XML_INDEX_TITLE_TEMPLATE, + XML_INFORMATION, + XML_INITIAL_CREATOR, + XML_INPROCEEDINGS, + XML_INSERTION, + XML_INSERTION_CUT_OFF, + XML_INSET, + XML_INSIDE, + XML_INSTITUTION, + XML_INT, + XML_INTENSITY, + XML_INTERSECT, + XML_INTERVAL, + XML_INTERVAL_MAJOR, + XML_INTERVAL_MINOR, + XML_INTO_ENGLISH_NUMBER, + XML_INVERSE, + XML_IS_ACTIVE, + XML_IS_DATA_LAYOUT_FIELD, + XML_IS_HIDDEN, + XML_IS_SELECTION, + XML_ISBN, + XML_ITALIC, + XML_ITERATION, + XML_JOURNAL, + XML_JUSTIFIED, + XML_JUSTIFY, + XML_JUSTIFY_SINGLE_WORD, + XML_KEEP_WITH_NEXT, + XML_KERNING_NORMAL, + XML_KEY, + XML_KEY1, + XML_KEY2, + XML_KEYWORD, + XML_KEYWORDS, + XML_KIND, + XML_KM, + XML_LABEL, + XML_LABEL_ARRANGEMENT, + XML_LABEL_CELL_ADDRESS, + XML_LABEL_CELL_RANGE_ADDRESS, + XML_LABEL_RANGE, + XML_LABEL_RANGES, + XML_LAMBDA, + XML_LANDSCAPE, + XML_LANGUAGE, + XML_LANGUAGE_ASIAN, + XML_LANGUAGE_COMPLEX, + XML_LASER, + XML_LAST_COLUMN_SPANNED, + XML_LAST_PAGE, + XML_LAST_ROW_SPANNED, + XML_LAYER, + XML_LAYER_SET, + XML_LEADER_CHAR, + XML_LEFT, + XML_LEFT_OUTSIDE, + XML_LEFT_TOP_POSITION, + XML_LEFTARC, + XML_LEFTCIRCLE, + XML_LEGEND, + XML_LEGEND_POSITION, + XML_LENGTH, + XML_LEQ, + XML_LET_TEXT, + XML_KEEP_TEXT, + XML_LETTER_KERNING, + XML_LETTER_SPACING, + XML_LETTERS, + XML_LEVEL, + XML_LIBRARY, + XML_LIBRARY_EMBEDDED, + XML_LIBRARY_LINKED, + XML_LIGHT, + XML_LIGHTING_MODE, + XML_LIME, + XML_LIMIT, + XML_LINE, + XML_LINE_BREAK, + XML_LINE_DISTANCE, + XML_LINE_HEIGHT, + XML_LINE_HEIGHT_AT_LEAST, + XML_LINE_NUMBER, + XML_LINE_SKEW, + XML_LINE_SPACING, + XML_LINE_STYLE, + XML_LINEAR, + XML_LINENUMBERING_CONFIGURATION, + XML_LINENUMBERING_SEPARATOR, + XML_LINES, + XML_LINES_USED, + XML_LINK_TO_SOURCE_DATA, + XML_LIST, + XML_LIST_BLOCK, + XML_LIST_HEADER, + XML_LIST_INFO, + XML_LIST_ITEM, + XML_LIST_LEVEL, + XML_LIST_LEVEL_STYLE_BULLET, + XML_LIST_LEVEL_STYLE_IMAGE, + XML_LIST_LEVEL_STYLE_NUMBER, + XML_LIST_NAME, + XML_LIST_STYLE, + XML_LIST_STYLE_NAME, + XML_LN, + XML_LOCKED, + XML_LOG, + XML_LOGARITHMIC, + XML_LOGBASE, + XML_LONG, + XML_LOWLIMIT, + XML_LR_TB, + XML_LT, + XML_LTR, + XML_LUMINANCE, + XML_MACRO_NAME, + XML_MACTION, + XML_MAIN_ENTRY_STYLE_NAME, + XML_MAJOR, + XML_MALIGNGROUP, + XML_MALIGNMARK, + XML_MANUAL, + XML_MAP, + XML_MARGIN_BOTTOM, + XML_MARGIN_LEFT, + XML_MARGIN_RIGHT, + XML_MARGIN_TOP, + XML_MARGINS, + XML_MARKER, + XML_MARKER_END, + XML_MARKER_END_CENTER, + XML_MARKER_END_WIDTH, + XML_MARKER_START, + XML_MARKER_START_CENTER, + XML_MARKER_START_WIDTH, + XML_MAROON, + XML_MASTER_PAGE, + XML_MASTER_PAGE_NAME, + XML_MASTER_STYLES, + XML_MASTERSTHESIS, + XML_MATCH, + XML_MATH, + XML_MATRIX, + XML_MATRIX_COVERED, + XML_MATRIXROW, + XML_MAX, + XML_MAX_EDGE, + XML_MAX_HEIGHT, + XML_MAX_WIDTH, + XML_MAXIMUM, + XML_MAXIMUM_DIFFERENCE, + XML_MAY_BREAK_BETWEEN_ROWS, + XML_MAY_SCRIPT, + XML_MEAN, + XML_MEAN_VALUE, + XML_MEASURE, + XML_MEASURE_ALIGN, + XML_MEASURE_VERTICAL_ALIGN, + XML_MEDIAN, + XML_MEDIUM, + XML_MERROR, + XML_MESSAGE_TYPE, + XML_META, + XML_MFENCED, + XML_MFRAC, + XML_MI, + XML_MIDDLE, + XML_MIME_TYPE, + XML_MIN, + XML_MIN_DENOMINATOR_DIGITS, + XML_MIN_EDGE, + XML_MIN_EXPONENT_DIGITS, + XML_MIN_HEIGHT, + XML_MIN_INTEGER_DIGITS, + XML_MIN_LABEL_DISTANCE, + XML_MIN_LABEL_WIDTH, + XML_MIN_LINE_HEIGHT, + XML_MIN_NUMERATOR_DIGITS, + XML_MIN_ROW_HEIGHT, + XML_MIN_WIDTH, + XML_MINIMUM, + XML_MINOR, + XML_MINUS, + XML_MINUTES, + XML_MIRROR, + XML_MIRRORED, + XML_MISC, + XML_MITER, + XML_MM, + XML_MMULTISCRIPTS, + XML_MN, + XML_MO, + XML_MODE, + XML_MODERN, + XML_MODIFICATION_DATE, + XML_MODIFICATION_TIME, + XML_MODULATE, + XML_MODULE, + XML_MOMENT, + XML_MONO, + XML_MONTH, + XML_MOUSE_AS_PEN, + XML_MOUSE_VISIBLE, + XML_MOVE, + XML_MOVE_FROM_BOTTOM, + XML_MOVE_FROM_LEFT, + XML_MOVE_FROM_RIGHT, + XML_MOVE_FROM_TOP, + XML_MOVE_PROTECT, + XML_MOVE_SHORT, + XML_MOVEMENT, + XML_MOVEMENT_CUT_OFF, + XML_MOVER, + XML_MPADDED, + XML_MPHANTOM, + XML_MPRESCRIPTS, + XML_MROOT, + XML_MROW, + XML_MS, + XML_MSPACE, + XML_MSQRT, + XML_MSTYLE, + XML_MSUB, + XML_MSUBSUP, + XML_MSUP, + XML_MTABLE, + XML_MTD, + XML_MTEXT, + XML_MTR, + XML_MULTI_DELETION_SPANNED, + XML_MUNDER, + XML_MUNDEROVER, + XML_NAME, + XML_NAME_AND_EXTENSION, + XML_NAMED_EXPRESSION, + XML_NAMED_EXPRESSIONS, + XML_NAMED_RANGE, + XML_NAVY, + XML_NEGATIVE_COLOR, + XML_NEQ, + XML_NEW, + XML_NEXT, + XML_NEXT_PAGE, + XML_NEXT_STYLE_NAME, + XML_NO_LIMIT, + XML_NO_WRAP, + XML_NOEMPTY, + XML_NOHREF, + XML_NOMATCH, + XML_NONE, + XML_NOPRTSUBSET, + XML_NORMAL, + XML_NORMALS_DIRECTION, + XML_NORMALS_KIND, + XML_NOT, + XML_NOT_EQUAL_DATE, + XML_NOTE, + XML_NOTES, + XML_NOTIN, + XML_NOTSUBSET, + XML_NULL_DATE, + XML_NULL_YEAR, + XML_NUM_FORMAT, + XML_NUM_LETTER_SYNC, + XML_NUM_PREFIX, + XML_NUM_SUFFIX, + XML_NUMBER, + XML_NUMBER_AND_NAME, + XML_NUMBER_COLUMNS_REPEATED, + XML_NUMBER_COLUMNS_SPANNED, + XML_NUMBER_LINES, + XML_NUMBER_MATRIX_COLUMNS_SPANNED, + XML_NUMBER_MATRIX_ROWS_SPANNED, + XML_NUMBER_POSITION, + XML_NUMBER_ROWS_REPEATED, + XML_NUMBER_ROWS_SPANNED, + XML_NUMBER_STYLE, + XML_NUMBER_WRAPPED_PARAGRAPHS, + XML_NUMBERED_ENTRIES, + XML_OBJECT, + XML_OBJECT_COUNT, + XML_OBJECT_INDEX, + XML_OBJECT_INDEX_ENTRY_TEMPLATE, + XML_OBJECT_INDEX_SOURCE, + XML_OBJECT_NAME, + XML_OBJECT_OLE, + XML_OBJECTS, + XML_ODD_PAGE, + XML_OFFSET, + XML_OLIVE, + XML_ONLOAD, + XML_ONREQUEST, + XML_ON_UPDATE_KEEP_SIZE, + XML_ON_UPDATE_KEEP_STYLES, + XML_ONLINE, + XML_ONLINE_TEXT, + XML_OPAQUE_BACKGROUND, + XML_OPAQUE_FOREGROUND, + XML_OPEN, + XML_OPEN_HORIZONTAL, + XML_OPEN_VERTICAL, + XML_OPERATION, + XML_OPERATOR, + XML_OPTIMAL, + XML_OR, + XML_ORDER, + XML_ORDERED_LIST, + XML_ORGANIZATIONS, + XML_ORIENTATION, + XML_ORIENTATION_LANDSCAPE, + XML_ORIENTATION_PORTRAIT, + XML_ORIGIN, + XML_ORPHANS, + XML_OUTLINE_LEVEL, + XML_OUTLINE_LEVEL_STYLE, + XML_OUTLINE_STYLE, + XML_OUTSET, + XML_OUTSIDE, + XML_OVERLAP, + XML_P, + XML_PACKAGE_NAME, + XML_PADDING, + XML_PADDING_BOTTOM, + XML_PADDING_LEFT, + XML_PADDING_RIGHT, + XML_PADDING_TOP, + XML_PAGE, + XML_PAGE_ADJUST, + XML_PAGE_BREAKS_ON_GROUP_CHANGE, + XML_PAGE_CONTENT, + XML_PAGE_CONTINUATION_STRING, + XML_PAGE_COUNT, + XML_PAGE_END_MARGIN, + XML_PAGE_HEIGHT, + XML_PAGE_MASTER, + XML_PAGE_MASTER_NAME, + XML_PAGE_NUMBER, + XML_PAGE_START_MARGIN, + XML_PAGE_STYLE_NAME, + XML_PAGE_THUMBNAIL, + XML_PAGE_USAGE, + XML_PAGE_VARIABLE_GET, + XML_PAGE_VARIABLE_SET, + XML_PAGE_VIEW_ZOOM_VALUE, + XML_PAGE_WIDTH, + XML_PAGES, + XML_PAPER_TRAY_NUMBER, + XML_PARAGRAPH, + XML_PARAGRAPH_CONTENT, + XML_PARAGRAPH_COUNT, + XML_PARAGRAPH_END_MARGIN, + XML_PARAGRAPH_START_MARGIN, + XML_PARALLEL, + XML_PARAM, + XML_PARENT_STYLE_NAME, + XML_PARSE_SQL_STATEMENT, + XML_PARSED, + XML_PARTIALDIFF, + XML_PASSWORD, + XML_PASSWORT, + XML_PATH, + XML_PATH_ID, + XML_PAUSE, + XML_PENDING, + XML_PERCENTAGE, + XML_PERCENTAGE_STYLE, + XML_PERSPECTIVE, + XML_PHDTHESIS, + XML_PHONG, + XML_PIE_OFFSET, + XML_PLACEHOLDER, + XML_PLACEHOLDER_TYPE, + XML_PLACING, + XML_PLAIN_NUMBER, + XML_PLAIN_NUMBER_AND_NAME, + XML_PLAY_FULL, + XML_PLOT_AREA, + XML_PLUGIN, + XML_PLUS, + XML_POINTS, + XML_POLYGON, + XML_POLYLINE, + XML_POLYNOMIAL, + XML_POOL_ID, + XML_PORTRAIT, + XML_POSITION, + XML_POSITION_BOTTOM, + XML_POSITION_LEFT, + XML_POSITION_RIGHT, + XML_POSITION_TOP, + XML_POSITIVE_COLOR, + XML_POSTURE_ITALIC, + XML_POSTURE_NORMAL, + XML_POSTURE_OBLIQUE, + XML_POWER, + XML_PRECISION_AS_SHOWN, + XML_PREFIX, + XML_PRESENTATION, + XML_PRESENTATION_CHART, + XML_PRESENTATION_GRAPHIC, + XML_PRESENTATION_NOTES, + XML_PRESENTATION_OBJECT, + XML_PRESENTATION_ORGCHART, + XML_PRESENTATION_OUTLINE, + XML_PRESENTATION_PAGE, + XML_PRESENTATION_PAGE_LAYOUT, + XML_PRESENTATION_PAGE_LAYOUT_NAME, + XML_PRESENTATION_SUBTITLE, + XML_PRESENTATION_TABLE, + XML_PRESENTATION_TITLE, + XML_PREVIOUS, + XML_PREVIOUS_PAGE, + XML_PRINT, + XML_PRINT_CONTENT, + XML_PRINT_DATE, + XML_PRINT_ORIENTATION, + XML_PRINT_PAGE_ORDER, + XML_PRINT_RANGE, + XML_PRINT_RANGES, + XML_PRINT_TIME, + XML_PRINTABLE, + XML_PRINTED_BY, + XML_PROCEEDINGS, + XML_PRODUCT, + XML_PROJECTION, + XML_PROPERTIES, + XML_PROTECT, + XML_PROTECT_CONTENT, + XML_PROTECT_POSITION, + XML_PROTECT_SIZE, + XML_PROTECTED, + XML_PROTECTION_KEY, + XML_PROTECTION_KEY_DIGEST_ALGORITHM, + XML_PROTECTION_KEY_DIGEST_ALGORITHM_2, + XML_PRSUBSET, + XML_PUBLISHER, + XML_PUNCTUATION_WRAP, + XML_PURPLE, + XML_PYRAMID, + XML_QUARTER, + XML_QUERY_NAME, + XML_QUO_VADIS, + XML_QUOTIENT, + XML_R, + XML_RADAR, + XML_RANDOM, + XML_RANGE_ADDRESS, + XML_RANGE_USABLE_AS, + XML_RECREATE_ON_EDIT, + XML_RECT, + XML_RED, + XML_REF_NAME, + XML_REFERENCE, + XML_REFERENCE_END, + XML_REFERENCE_FORMAT, + XML_REFERENCE_MARK, + XML_REFERENCE_MARK_END, + XML_REFERENCE_MARK_START, + XML_REFERENCE_REF, + XML_REFERENCE_START, + XML_REFERENCE_TYPE, + XML_REFRESH_DELAY, + XML_REGION_CENTER, + XML_REGION_LEFT, + XML_REGION_RIGHT, + XML_REGISTER_TRUE, + XML_REGISTER_TRUTH_REF_STYLE_NAME, + XML_REGRESSION_TYPE, + XML_REJECTED, + XML_REJECTING_CHANGE_ID, + XML_REJECTION, + XML_REL_COLUMN_WIDTH, + XML_REL_HEIGHT, + XML_REL_WIDTH, + XML_RELATIVE, + XML_RELATIVE_TAB_STOP_POSITION, + XML_RELN, + XML_REM, + XML_REMOVE_DEPENDENTS, + XML_REMOVE_PRECEDENTS, + XML_REPEAT, + XML_REPEAT_COLUMN, + XML_REPEAT_ROW, + XML_REPEATED, + XML_REPLACE, + XML_REPORT_TYPE, + XML_RESTART_ON_PAGE, + XML_REVISION, + XML_RIDGE, + XML_RIGHT, + XML_RIGHT_OUTSIDE, + XML_RIGHTARC, + XML_RIGHTCIRCLE, + XML_RING, + XML_ROLE, + XML_ROLL_FROM_BOTTOM, + XML_ROLL_FROM_LEFT, + XML_ROLL_FROM_RIGHT, + XML_ROMAN, + XML_ROOT, + XML_ROTATE, + XML_ROTATION, + XML_ROTATION_ALIGN, + XML_ROTATION_ANGLE, + XML_ROUND, + XML_ROW, + XML_ROW_HEIGHT, + XML_ROW_NUMBER, + XML_ROWS, + XML_RSID, + XML_PARRSID, + XML_RUBY, + XML_RUBY_ALIGN, + XML_RUBY_BASE, + XML_RUBY_POSITION, + XML_RUBY_TEXT, + XML_RUN_THROUGH, + XML_RX, + XML_RY, + XML_S, + XML_SCALE, + XML_SCALE_MIN, + XML_SCALE_TEXT, + XML_SCALE_TO, + XML_SCALE_TO_PAGES, + XML_SCATTER, + XML_SCENARIO, + XML_SCENARIO_RANGES, + XML_SCENE, + XML_SCHOOL, + XML_SCIENTIFIC_NUMBER, + XML_SCORE_SPACES, + XML_SCRIPT, + XML_SCROLL, + XML_SDEV, + XML_SEARCH_CRITERIA_MUST_APPLY_TO_WHOLE_CELL, + XML_SEC, + XML_SECH, + XML_SECOND_DATE_TIME, + XML_SECONDS, + XML_SECTION, + XML_SECTION_DESC, + XML_SECTION_NAME, + XML_SECTION_SOURCE, + XML_SELECT_PAGE, + XML_SELECT_PROTECTED_CELLS, + XML_SELECT_UNPROTECTED_CELLS, + XML_SELECTOR, + XML_SEMANTICS, + XML_SEMI_AUTOMATIC, + XML_SENDER_CITY, + XML_SENDER_COMPANY, + XML_SENDER_COUNTRY, + XML_SENDER_EMAIL, + XML_SENDER_FAX, + XML_SENDER_FIRSTNAME, + XML_SENDER_INITIALS, + XML_SENDER_LASTNAME, + XML_SENDER_PHONE_PRIVATE, + XML_SENDER_PHONE_WORK, + XML_SENDER_POSITION, + XML_SENDER_POSTAL_CODE, + XML_SENDER_STATE_OR_PROVINCE, + XML_SENDER_STREET, + XML_SENDER_TITLE, + XML_SEP, + XML_SEPARATION_CHARACTER, + XML_SEPARATOR, + XML_SEQUENCE, + XML_SEQUENCE_DECL, + XML_SEQUENCE_DECLS, + XML_SEQUENCE_REF, + XML_SERIES, + XML_SERIES_SOURCE, + XML_SERVER_MAP, + XML_SET, + XML_SETDIFF, + XML_SETTINGS, + XML_SHADE_MODE, + XML_SHADOW, + XML_SHADOW_COLOR, + XML_SHADOW_OFFSET_X, + XML_SHADOW_OFFSET_Y, + XML_SHADOW_SLANT, + XML_SHADOW_TRANSPARENCY, + XML_SHAPE, + XML_SHAPE_ID, + XML_SHAPES, + XML_SHEET_NAME, + XML_SHININESS, + XML_SHORT, + XML_SHOW, + XML_SHOW_ACCEPTED_CHANGES, + XML_SHOW_CHANGES, + XML_SHOW_CHANGES_BY_AUTHOR, + XML_SHOW_CHANGES_BY_AUTHOR_NAME, + XML_SHOW_CHANGES_BY_COMMENT, + XML_SHOW_CHANGES_BY_COMMENT_TEXT, + XML_SHOW_CHANGES_BY_DATETIME, + XML_SHOW_CHANGES_BY_DATETIME_FIRST_DATETIME, + XML_SHOW_CHANGES_BY_DATETIME_MODE, + XML_SHOW_CHANGES_BY_DATETIME_SECOND_DATETIME, + XML_SHOW_CHANGES_BY_RANGES, + XML_SHOW_CHANGES_BY_RANGES_LIST, + XML_SHOW_LOGO, + XML_SHOW_REJECTED_CHANGES, + XML_SHOW_SHAPE, + XML_SHOW_TEXT, + XML_SHOW_UNIT, + XML_SHOW_VALUE, + XML_SHOWS, + XML_SIDE_BY_SIDE, + XML_SILVER, + XML_SIMPLE, + XML_SIN, + XML_SINCE_DATE_TIME, + XML_SINCE_SAVE, + XML_SINH, + XML_SIZE, + XML_SIZE_PROTECT, + XML_SLANT, + XML_SLANT_X, + XML_SLANT_Y, + XML_SLIDE, + XML_SLOW, + XML_SOLID, + XML_SOLID_TYPE, + XML_SORT, + XML_SORT_ASCENDING, + XML_SORT_BY, + XML_SORT_BY_POSITION, + XML_SORT_GROUPS, + XML_SORT_KEY, + XML_SOUND, + XML_SOURCE_CELL_RANGE, + XML_SOURCE_CELL_RANGE_ADDRESSES, + XML_SOURCE_FIELD_NAME, + XML_SOURCE_NAME, + XML_SOURCE_RANGE_ADDRESS, + XML_SOURCE_SERVICE, + XML_SPACE_BEFORE, + XML_SPAN, + XML_SPECULAR, + XML_SPECULAR_COLOR, + XML_SPEED, + XML_SPHERE, + XML_SPIRAL, + XML_SPIRAL_IN, + XML_SPIRAL_INWARD_LEFT, + XML_SPIRAL_INWARD_RIGHT, + XML_SPIRAL_OUT, + XML_SPIRAL_OUTWARD_LEFT, + XML_SPIRAL_OUTWARD_RIGHT, + XML_SPIRALIN_LEFT, + XML_SPIRALIN_RIGHT, + XML_SPIRALOUT_LEFT, + XML_SPIRALOUT_RIGHT, + XML_SPLINES, + XML_SPLIT, + XML_SPLIT_COLUMN, + XML_SPLIT_POSITION, + XML_SPLIT_ROW, + XML_SPREADSHEET, + XML_SPREADMETHOD, + XML_SQL_STATEMENT, + XML_STACKED, + XML_STAGGER_EVEN, + XML_STAGGER_ODD, + XML_STANDARD, + XML_STANDARD_DEVIATION, + XML_STARBASIC, + XML_START, + XML_START_ANGLE, + XML_START_COLOR, + XML_START_COLUMN, + XML_START_GLUE_POINT, + XML_START_GUIDE, + XML_START_INTENSITY, + XML_START_LINE_SPACING_HORIZONTAL, + XML_START_LINE_SPACING_VERTICAL, + XML_START_NUMBERING_AT, + XML_START_PAGE, + XML_START_POSITION, + XML_START_ROW, + XML_START_SCALE, + XML_START_SHAPE, + XML_START_TABLE, + XML_START_VALUE, + XML_START_WITH_NAVIGATOR, + XML_STATISTICS, + XML_STATUS, + XML_STAY_ON_TOP, + XML_STDEV, + XML_STDEVP, + XML_STEPS, + XML_STOCK, + XML_STOCK_UPDOWN_BARS, + XML_STOCK_WITH_VOLUME, + XML_STOP, + XML_STOPCOLOR, + XML_STOPOPACITY, + XML_STRETCH, + XML_STRETCH_FROM_BOTTOM, + XML_STRETCH_FROM_LEFT, + XML_STRETCH_FROM_RIGHT, + XML_STRETCH_FROM_TOP, + XML_STRETCHY, + XML_STRICT, + XML_STRING, + XML_STRING_VALUE, + XML_STRING_VALUE_IF_FALSE, + XML_STRING_VALUE_IF_TRUE, + XML_STRIPES, + XML_STROKE, + XML_STROKE_COLOR, + XML_STROKE_DASH, + XML_STROKE_LINECAP, + XML_STROKE_LINEJOIN, + XML_STROKE_OPACITY, + XML_STROKE_WIDTH, + XML_STRUCTURE_PROTECTED, + XML_STYLE, + XML_STYLE_NAME, + XML_STYLES, + XML_STYLESHEET, + XML_SUB_TABLE, + XML_SUBJECT, + XML_SUBSET, + XML_SUBTITLE, + XML_SUBTOTAL_FIELD, + XML_SUBTOTAL_RULE, + XML_SUBTOTAL_RULES, + XML_SUB_VIEW_SIZE, + XML_SUFFIX, + XML_SUM, + XML_SVGLINEARGRADIENT, + XML_SWISS, + XML_SYMBOL, + XML_SYMBOL_HEIGHT, + XML_SYMBOL_IMAGE_NAME, + XML_SYMBOL_WIDTH, + XML_SYSTEM, + XML_TAB_COLOR, + XML_TAB_STOP, + XML_TAB_STOP_DISTANCE, + XML_TAB_STOPS, + XML_TABLE, + XML_TABLE_BACKGROUND, + XML_TABLE_CELL, + XML_TABLE_CENTERING, + XML_TABLE_COLUMN, + XML_TABLE_COLUMN_GROUP, + XML_TABLE_COLUMNS, + XML_TABLE_COUNT, + XML_TABLE_HEADER, + XML_TABLE_HEADER_COLUMNS, + XML_TABLE_HEADER_ROWS, + XML_TABLE_INDEX, + XML_TABLE_INDEX_ENTRY_TEMPLATE, + XML_TABLE_INDEX_SOURCE, + XML_TABLE_NAME, + XML_TABLE_NUMBER_LIST, + XML_TABLE_OF_CONTENT, + XML_TABLE_OF_CONTENT_ENTRY_TEMPLATE, + XML_TABLE_OF_CONTENT_SOURCE, + XML_TABLE_PAGE, + XML_TABLE_PROTECTION, + XML_TABLE_ROW, + XML_TABLE_ROW_GROUP, + XML_TABLE_ROWS, + XML_TABLE_SOURCE, + XML_TABLE_VIEW, + XML_TABLES, + XML_TAN, + XML_TANH, + XML_TARGET_CELL_ADDRESS, + XML_TARGET_FRAME_NAME, + XML_TARGET_RANGE_ADDRESS, + XML_TB_RL, + XML_TEAL, + XML_TECHREPORT, + XML_TEMPLATE, + XML_TEMPLATE_NAME, + XML_TENDSTO, + XML_TEX_FILTER, + XML_TEX_GENERATION_MODE_X, + XML_TEX_GENERATION_MODE_Y, + XML_TEX_KIND, + XML_TEX_MODE, + XML_TEXT, + XML_TEXT_ALIGN, + XML_TEXT_ALIGN_LAST, + XML_TEXT_ALIGN_SOURCE, + XML_TEXT_AUTOSPACE, + XML_TEXT_BACKGROUND_COLOR, + XML_TEXT_BLINKING, + XML_TEXT_BOX, + XML_TEXT_COMBINE, + XML_TEXT_COMBINE_END_CHAR, + XML_TEXT_COMBINE_START_CHAR, + XML_TEXT_CONTENT, + XML_TEXT_CROSSING_OUT, + XML_TEXT_EMPHASIZE, + XML_TEXT_GLOBAL, + XML_TEXT_INDENT, + XML_TEXT_INPUT, + XML_TEXT_JUSTIFY, + XML_TEXT_OUTLINE, + XML_TEXT_POSITION, + XML_TEXT_ROTATION_ANGLE, + XML_TEXT_ROTATION_SCALE, + XML_TEXT_SCALE, + XML_TEXT_SHADOW, + XML_TEXT_STYLE, + XML_TEXT_TRANSFORM, + XML_TEXT_UNDERLINE, + XML_TEXT_UNDERLINE_COLOR, + XML_TEXTAREA_HORIZONTAL_ALIGN, + XML_TEXTAREA_VERTICAL_ALIGN, + XML_TEXTUAL, + XML_THICK, + XML_THIN, + XML_THREE_DIMENSIONAL, + XML_THUMBNAIL, + XML_TICK_MARKS_MAJOR_INNER, + XML_TICK_MARKS_MAJOR_OUTER, + XML_TICK_MARKS_MINOR_INNER, + XML_TICK_MARKS_MINOR_OUTER, + XML_TILE_REPEAT_OFFSET, + XML_TIME, + XML_TIME_ADJUST, + XML_TIME_STYLE, + XML_TIME_VALUE, + XML_TIMES, + XML_TITLE, + XML_TO_ANOTHER_TABLE, + XML_TO_BOTTOM, + XML_TO_CENTER, + XML_TO_LEFT, + XML_TO_LOWER_LEFT, + XML_TO_LOWER_RIGHT, + XML_TO_RIGHT, + XML_TO_TOP, + XML_TO_UPPER_LEFT, + XML_TO_UPPER_RIGHT, + XML_TOC_MARK, + XML_TOC_MARK_END, + XML_TOC_MARK_START, + XML_TOP, + XML_TOP_LEFT, + XML_TOP_PERCENT, + XML_TOP_RIGHT, + XML_TOP_VALUES, + XML_TOPARC, + XML_TOPCIRCLE, + XML_TRACE_DEPENDENTS, + XML_TRACE_ERRORS, + XML_TRACE_PRECEDENTS, + XML_TRACK_CHANGES, + XML_TRACKED_CHANGES, + XML_TRACKED_CHANGES_VIEW_SETTINGS, + XML_TRANSFORM, + XML_TRANSITION_ON_CLICK, + XML_TRANSPARENCY, + XML_TRANSPARENCY_NAME, + XML_TRANSPARENT, + XML_TRANSPOSE, + XML_TRUE, + XML_TRUNCATE_ON_OVERFLOW, + XML_TTB, + XML_TYPE, + XML_DOT_DASH, + XML_DOT_DOT_DASH, + XML_LONG_DASH, + XML_SINGLE, + XML_SMALL_WAVE, + XML_WAVE, + XML_UNFORMATTED_TEXT, + XML_UNION, + XML_UNIT, + XML_UNORDERED_LIST, + XML_UNPUBLISHED, + XML_UP, + XML_UPLIMIT, + XML_UPRIGHT, + XML_URL, + XML_USE_CAPTION, + XML_USE_CELL_PROTECTION, + XML_USE_CHART_OBJECTS, + XML_USE_CONDITION, + XML_USE_DRAW_OBJECTS, + XML_USE_FLOATING_FRAMES, + XML_USE_GRAPHICS, + XML_USE_IMAGE_OBJECTS, + XML_USE_INDEX_MARKS, + XML_USE_INDEX_SOURCE_STYLES, + XML_USE_KEYS_AS_ENTRIES, + XML_USE_LABEL, + XML_USE_MATH_OBJECTS, + XML_USE_OBJECTS, + XML_USE_OPTIMAL_COLUMN_WIDTH, + XML_USE_OPTIMAL_ROW_HEIGHT, + XML_USE_OTHER_OBJECTS, + XML_USE_SPREADSHEET_OBJECTS, + XML_USE_STYLES, + XML_USE_TABLES, + XML_USE_WINDOW_FONT_COLOR, + XML_USED_HIERARCHY, + XML_USER_DEFINED, + XML_USER_FIELD_DECL, + XML_USER_FIELD_DECLS, + XML_USER_FIELD_GET, + XML_USER_FIELD_INPUT, + XML_USER_INDEX, + XML_USER_INDEX_ENTRY_TEMPLATE, + XML_USER_INDEX_MARK, + XML_USER_INDEX_MARK_END, + XML_USER_INDEX_MARK_START, + XML_USER_INDEX_SOURCE, + XML_USER_TRANSFORMED, + XML_USERNAME, + XML_VALUE, + XML_VALUE_TYPE, + XML_VALUES_CELL_RANGE_ADDRESS, + XML_VAR, + XML_VARIABLE, + XML_VARIABLE_DECL, + XML_VARIABLE_DECLS, + XML_VARIABLE_GET, + XML_VARIABLE_INPUT, + XML_VARIABLE_SET, + XML_VARIANCE, + XML_VARP, + XML_VECTOR, + XML_VERB, + XML_VERSION, + XML_VERSION_ENTRY, + XML_VERSION_LIST, + XML_VERTICAL, + XML_VERTICAL_ALIGN, + XML_VERTICAL_JUSTIFY, + XML_VERTICAL_LINES, + XML_VERTICAL_POS, + XML_VERTICAL_REL, + XML_VERTICAL_SEGMENTS, + XML_VERTICAL_SPLIT_MODE, + XML_VERTICAL_SPLIT_POSITION, + XML_VERTICAL_STRIPES, + XML_VIEW, + XML_VIEWBOX, + XML_VIEW_ID, + XML_VIEW_SETTINGS, + XML_VISIBILITY, + XML_VISIBLE, + XML_VISIBLE_AREA, + XML_VISIBLE_AREA_HEIGHT, + XML_VISIBLE_AREA_LEFT, + XML_VISIBLE_AREA_TOP, + XML_VISIBLE_AREA_WIDTH, + XML_VISITED_STYLE_NAME, + XML_VOLATILE, + XML_VOLUME, + XML_VPN, + XML_VRP, + XML_VUP, + XML_WALL, + XML_WARNING, + XML_WATERMARK, + XML_WAVYLINE, + XML_WAVYLINE_FROM_BOTTOM, + XML_WAVYLINE_FROM_LEFT, + XML_WAVYLINE_FROM_RIGHT, + XML_WAVYLINE_FROM_TOP, + XML_WEEK_OF_YEAR, + XML_WEIGHT_BOLD, + XML_WEIGHT_NORMAL, + XML_WHITE, + XML_WHOLE_PAGE, + XML_WIDOWS, + XML_WIDTH, + XML_WORD, + XML_WORD_COUNT, + XML_WRAP, + XML_WRAP_CONTOUR, + XML_WRAP_CONTOUR_MODE, + XML_WRAP_OPTION, + XML_WRITING_MODE, + XML_WWW, + XML_X, + XML_X1, + XML_X2, + XML_X_MAC_ROMAN, + XML_X_SYMBOL, + XML_X_SYSTEM, + XML_XOR, + XML_Y, + XML_Y1, + XML_Y2, + XML_YEAR, + XML_YELLOW, + XML_ZERO_VALUES, + XML_ZINDEX, + XML_ZOOM_TYPE, + XML_ZOOM_VALUE, + + XML_ENABLE, + XML_USE_REGULAR_EXPRESSIONS, + XML_DATA_SOURCE_HAS_LABELS, + XML_LINK_DATA_STYLE_TO_SOURCE, + XML_SORT_ALGORITHM, + XML_STRAIGHT_LINE, + XML_ANGLED_LINE, + XML_ANGLED_CONNECTOR_LINE, + XML_APPLICATION_X_WWW_FORM_URLENCODED, + XML_MULTIPART_FORMDATA, + XML_APPLICATION_TEXT, + XML_GET, + XML_POST, + XML_QUERY, + XML_PARENT, + XML_RECORDS, + XML_PUSH, + XML_SUBMIT, + XML_RESET, + XML_VALUE_LIST, + XML_SQL, + XML_SQL_PASS_THROUGH, + XML_TABLE_FIELDS, + XML_UNCHECKED, + XML_CHECKED, + XML_UNKNOWN, + + XML_ROLL_FROM_TOP, + + XML_BINARY_DATA, + XML_NOTIFY_ON_UPDATE_OF_TABLE, + + XML_0, + XML_PLAY, + XML_HANDOUT_MASTER, + XML_TEXT_STYLE_NAME, + XML_ESCAPE_DIRECTION, + XML_GLUE_POINT, + XML_PRIMARY_X, + XML_SECONDARY_X, + XML_PRIMARY_Y, + XML_SECONDARY_Y, + XML_PRIMARY_Z, + + XML_CAPTION_TYPE, + XML_CAPTION_ANGLE_TYPE, + XML_CAPTION_ANGLE, + XML_CAPTION_GAP, + XML_CAPTION_ESCAPE_DIRECTION, + XML_CAPTION_ESCAPE, + XML_CAPTION_LINE_LENGTH, + XML_CAPTION_FIT_LINE_LENGTH, + XML_FREE, + + XML_TRANSITION_TYPE, + XML_TRANSITION_STYLE, + XML_TRANSITION_SPEED, + XML_DURATION, + XML_BACKGROUND_SIZE, + XML_BACKGROUND_OBJECTS_VISIBLE, + XML_BACKGROUND_VISIBLE, + + XML_MOVE_FROM_UPPERLEFT, + XML_MOVE_FROM_UPPERRIGHT, + XML_MOVE_FROM_LOWERRIGHT, + XML_MOVE_FROM_LOWERLEFT, + XML_UNCOVER_TO_LEFT, + XML_UNCOVER_TO_UPPERLEFT, + XML_UNCOVER_TO_TOP, + XML_UNCOVER_TO_UPPERRIGHT, + XML_UNCOVER_TO_RIGHT, + XML_UNCOVER_TO_LOWERRIGHT, + XML_UNCOVER_TO_BOTTOM, + XML_UNCOVER_TO_LOWERLEFT, + XML_VERTICAL_CHECKERBOARD, + XML_HORIZONTAL_CHECKERBOARD, + XML_NOTIFY_ON_UPDATE_OF_RANGES, + XML_BYTE, + XML_MACRO, + XML_LOCATION, + XML_APPLICATION, + XML_SYMBOL_IMAGE, + XML_TEXT_OVERLAP, + XML_SPLINE_ORDER, + XML_SPLINE_RESOLUTION, + + XML_PAPER_TRAY_NAME, + + XML_COLUMN_MAPPING, + XML_ROW_MAPPING, + + XML_TABLE_FORMULA, + + XML_EMBEDDED_TEXT, + + XML_MERGE_LAST_PARAGRAPH, + + XML_STOCK_LOSS_MARKER, + XML_STOCK_GAIN_MARKER, + XML_STOCK_RANGE_LINE, + + XML_RL_TB, + XML_TB_LR, + XML_LR, + XML_RL, + XML_TB, + + XML_LAYOUT_GRID_COLOR, + XML_LAYOUT_GRID_LINES, + XML_LAYOUT_GRID_BASE_HEIGHT, + XML_LAYOUT_GRID_RUBY_HEIGHT, + XML_LAYOUT_GRID_MODE, + XML_LAYOUT_GRID_RUBY_BELOW, + XML_LAYOUT_GRID_PRINT, + XML_LAYOUT_GRID_DISPLAY, + + //text grid enhancement for better CJK support + XML_DEFAULT_PAGE_LAYOUT, + XML_LAYOUT_GRID_STANDARD_MODE, + XML_LAYOUT_GRID_BASE_WIDTH, + XML_LAYOUT_GRID_SNAP_TO_CHARS, + XML_LAYOUT_GRID_SNAP_TO, + + XML_SNAP_TO_LAYOUT_GRID, + XML_DONT_BALANCE_TEXT_COLUMNS, + + XML_GLYPH_ORIENTATION_VERTICAL, + + XML_MARKED_INVALID, + + XML_REGRESSION_CURVE, + XML_ERROR_INDICATOR, + + XML_TABLE_TYPE, + + XML_DISPLAY_FACTOR, + + XML_TRANSLITERATION_FORMAT, + XML_TRANSLITERATION_LANGUAGE, + XML_TRANSLITERATION_COUNTRY, + XML_TRANSLITERATION_STYLE, + + XML_KEY1_PHONETIC, + XML_KEY2_PHONETIC, + XML_STRING_VALUE_PHONETIC, + + XML_BACKGROUND_TRANSPARENCY, + XML_BACKGROUND_IMAGE_TRANSPARENCY, + + XML_DYNAMIC_SPACING, + XML_MAIN_ENTRY, + + XML_USE_OUTLINE_LEVEL, + + // #107245# New 3D properties which are possible for lathe and extrude 3d objects + XML_CLOSE_FRONT, + XML_CLOSE_BACK, + + XML_DROPDOWN, + XML_CURRENT_SELECTED, + + XML_JOIN_BORDER, + + XML_DISPLAY_LIST, + XML_NO, + XML_UNSORTED, + XML_SORTED_ASCENDING, + XML_FONT_INDEPENDENT_LINE_SPACING, + + XML_DATABASE, + XML_DATASOURCE, + XML_QUERIES, + XML_REPORTS, + XML_REPORT, + XML_AS_TEMPLATE, + + XML_CONNECTION_RESOURCE, + XML_SUPPRESS_VERSION_COLUMNS, + XML_JAVA_DRIVER_CLASS, + XML_EXTENSION, + XML_IS_FIRST_ROW_HEADER_LINE, + XML_SHOW_DELETED, + XML_IS_TABLE_NAME_LENGTH_LIMITED, + XML_SYSTEM_DRIVER_SETTINGS, + XML_ENABLE_SQL92_CHECK, + XML_APPEND_TABLE_ALIAS_NAME, + XML_PARAMETER_NAME_SUBSTITUTION, + XML_IGNORE_DRIVER_PRIVILEGES, + XML_BOOLEAN_COMPARISON_MODE, + XML_USE_CATALOG, + XML_BASE_DN, + XML_MAX_ROW_COUNT, + XML_LOGIN, + XML_USER_NAME, + XML_IS_PASSWORD_REQUIRED, + XML_LOGIN_TIMEOUT, + XML_DELIMITER, + XML_FIELD, + XML_DECIMAL, + XML_THOUSAND, + XML_TABLE_FILTER, + XML_TABLE_FILTER_PATTERN, + XML_TABLE_TYPE_FILTER, + XML_AUTO_INCREMENT, + XML_ADDITIONAL_COLUMN_STATEMENT, + XML_ROW_RETRIEVING_STATEMENT, + XML_DATA_SOURCE_SETTINGS, + XML_DATA_SOURCE_SETTING, + XML_DATA_SOURCE_SETTING_VALUE, + XML_DATA_SOURCE_SETTING_IS_LIST, + XML_DATA_SOURCE_SETTING_TYPE, + XML_DATA_SOURCE_SETTING_NAME, + XML_COMPONENT, + XML_COMPONENT_COLLECTION, + XML_QUERY_COLLECTION, + XML_UPDATE_TABLE, + XML_FILTER_STATEMENT, + XML_ORDER_STATEMENT, + XML_ESCAPE_PROCESSING, + XML_KEYS, + XML_INDICES, + XML_TYPE_NAME, + XML_PRECISION, + XML_IS_NULLABLE, + XML_IS_AUTOINCREMENT, + XML_DEFAULT_VALUE, + XML_REFERENCED_TABLE_NAME, + XML_UPDATE_RULE, + XML_DELETE_RULE, + XML_KEY_COLUMNS, + XML_KEY_COLUMN, + XML_RELATED_COLUMN_NAME, + XML_CATALOG_NAME, + XML_IS_UNIQUE, + XML_IS_CLUSTERED, + XML_INDEX_COLUMNS, + XML_INDEX_COLUMN, + XML_IS_ASCENDING, + XML_SCHEMA_NAME, + XML_NP_DB, + XML_N_DB, + XML_APPLY_FILTER, + XML_APPLY_ORDER, + XML_AUTOMATIC_PRINT_RANGE, + + XML_SELECTION, + XML_SELECTION_INDEXES, + + XML_SCALE_TO_X, + XML_SCALE_TO_Y, + + XML_KEEP_TOGETHER, + + XML_USE_HEADER_NAME, + XML_USE_FOOTER_NAME, + XML_USE_DATE_TIME_NAME, + XML_DISPLAY_HEADER, + XML_DISPLAY_FOOTER, + XML_DISPLAY_PAGE_NUMBER, + XML_DISPLAY_DATE_TIME, + XML_SOURCE, + XML_CURRENT_DATE, + + XML_HEADER_DECL, + XML_FOOTER_DECL, + XML_DATE_TIME_DECL, + + XML_SELECTED_PAGE, + + // DVO, OD 01.10.2003 #i18732 + XML_FLOW_WITH_TEXT, + + XML_WITH_TAB, // #i21237# + + XML_CUSTOM_SHAPE, + XML_ENGINE, + XML_ENHANCED_GEOMETRY, + XML_TEXT_ROTATE_ANGLE, + XML_MIRROR_VERTICAL, + XML_MIRROR_HORIZONTAL, + XML_EXTRUSION_ALLOWED, + XML_TEXT_PATH_ALLOWED, + XML_CONCENTRIC_GRADIENT_FILL_ALLOWED, + XML_EXTRUSION, + XML_EXTRUSION_BRIGHTNESS, + XML_EXTRUSION_DEPTH, + XML_EXTRUSION_DIFFUSION, + XML_EXTRUSION_NUMBER_OF_LINE_SEGMENTS, + XML_EXTRUSION_LIGHT_FACE, + XML_EXTRUSION_FIRST_LIGHT_HARSH, + XML_EXTRUSION_SECOND_LIGHT_HARSH, + XML_EXTRUSION_FIRST_LIGHT_LEVEL, + XML_EXTRUSION_SECOND_LIGHT_LEVEL, + XML_EXTRUSION_FIRST_LIGHT_DIRECTION, + XML_EXTRUSION_SECOND_LIGHT_DIRECTION, + XML_EXTRUSION_METAL, + XML_EXTRUSION_ROTATION_ANGLE, + XML_EXTRUSION_ROTATION_CENTER, + XML_EXTRUSION_SHININESS, + XML_EXTRUSION_SKEW, + XML_EXTRUSION_SPECULARITY, + XML_EXTRUSION_PROJECTION_MODE, + XML_EXTRUSION_VIEWPOINT, + XML_EXTRUSION_ORIGIN, + XML_EXTRUSION_COLOR, + XML_SECONDARY_FILL_COLOR, + XML_ENHANCED_PATH, + XML_PATH_STRETCHPOINT_X, + XML_PATH_STRETCHPOINT_Y, + XML_TEXT_AREAS, + XML_GLUE_POINTS, + XML_GLUE_POINT_TYPE, + XML_GLUE_POINT_LEAVING_DIRECTIONS, + XML_TEXT_PATH, + XML_TEXT_PATH_MODE, + XML_TEXT_PATH_SCALE, + XML_TEXT_PATH_SAME_LETTER_HEIGHTS, + XML_MODIFIERS, + XML_EQUATION, + XML_XSTRETCH, + XML_YSTRETCH, + XML_HASSTROKE, + XML_HASFILL, + XML_LOGWIDTH, + XML_LOGHEIGHT, + XML_HANDLE, + XML_HANDLE_MIRROR_VERTICAL, + XML_HANDLE_MIRROR_HORIZONTAL, + XML_HANDLE_SWITCHED, + XML_HANDLE_POSITION, + XML_HANDLE_RANGE_X_MINIMUM, + XML_HANDLE_RANGE_X_MAXIMUM, + XML_HANDLE_RANGE_Y_MINIMUM, + XML_HANDLE_RANGE_Y_MAXIMUM, + XML_HANDLE_POLAR, + XML_HANDLE_RADIUS_RANGE_MINIMUM, + XML_HANDLE_RADIUS_RANGE_MAXIMUM, + XML_RECTANGLE, + XML_ROUNDRECTANGLE, + XML_OVAL, + XML_CLOUD, + XML_BOUNDINGCUBE, + XML_WIREFRAME, + XML_SEGMENTS, + XML_WORD_WRAP, + + XML_COLLAPSING, + XML_SEPARATING, + XML_BORDER_MODEL, + + XML_DATA_PILOT_FIELD_REFERENCE, + XML_MEMBER_DIFFERENCE, + XML_MEMBER_PERCENTAGE, + XML_MEMBER_PERCENTAGE_DIFFERENCE, + XML_RUNNING_TOTAL, + XML_ROW_PERCENTAGE, + XML_COLUMN_PERCENTAGE, + XML_TOTAL_PERCENTAGE, + XML_FIELD_NAME, + XML_MEMBER_TYPE, + XML_NAMED, + XML_MEMBER_NAME, + XML_DISPLAY_MEMBER_MODE, + XML_MEMBER_COUNT, + XML_DATA_FIELD, + XML_DATA_PILOT_DISPLAY_INFO, + XML_SORT_MODE, + XML_DATA_PILOT_SORT_INFO, + XML_ADD_EMPTY_LINES, + XML_TABULAR_LAYOUT, + XML_OUTLINE_SUBTOTALS_TOP, + XML_OUTLINE_SUBTOTALS_BOTTOM, + XML_LAYOUT_MODE, + XML_DATA_PILOT_LAYOUT_INFO, + + XML_SYMBOL_COLOR, + + XML_3D, + XML_IMAGE_POSITION, + XML_IMAGE_ALIGN, + + XML_DIAGONAL_BL_TR, + XML_DIAGONAL_BL_TR_WIDTH, + XML_DIAGONAL_TL_BR, + XML_DIAGONAL_TL_BR_WIDTH, + XML_REPEAT_CONTENT, + XML_SHRINK_TO_FIT, + + /* Core impl. of the positioning of floating screen objects without + considering its wrapping style (#i28701#) + */ + XML_WRAP_INFLUENCE_ON_POSITION, + // Tokens have been renamed and <XML_ITERATIVE> has been added (#i35017#) + XML_ONCE_SUCCESSIVE, + XML_ONCE_CONCURRENT, + + // Names for OOo format only + XML_N_OFFICE_OOO, + XML_N_META_OOO, + XML_N_STYLE_OOO, + XML_N_NUMBER_OOO, + XML_N_TEXT_OOO, + XML_N_TABLE_OOO, + XML_N_DRAW_OOO, + XML_N_DR3D_OOO, + XML_N_PRESENTATION_OOO, + XML_N_CHART_OOO, + XML_N_CONFIG_OOO, + XML_N_FORM_OOO, + XML_N_SCRIPT_OOO, + + XML_GLOBAL, + XML_NOTE_CLASS, + XML_NOTE_CITATION, + XML_NOTE_BODY, + XML_NOTES_CONFIGURATION, + XML_NOTE_REF, + XML_IS_SUB_TABLE, + XML_PAGE_LAYOUT, + XML_PAGE_LAYOUT_NAME, + XML_GRAPHIC_PROPERTIES, + XML_DRAWING_PAGE_PROPERTIES, + XML_PAGE_LAYOUT_PROPERTIES, + XML_HEADER_FOOTER_PROPERTIES, + XML_TEXT_PROPERTIES, + XML_PARAGRAPH_PROPERTIES, + XML_RUBY_PROPERTIES, + XML_SECTION_PROPERTIES, + XML_TABLE_PROPERTIES, + XML_TABLE_COLUMN_PROPERTIES, + XML_TABLE_ROW_PROPERTIES, + XML_TABLE_CELL_PROPERTIES, + XML_LIST_LEVEL_PROPERTIES, + XML_CHART_PROPERTIES, + XML_DRAWING_PAGE, + XML_GRAPHICS, + XML_TAB, + XML_TEXT_UNDERLINE_MODE, + XML_TEXT_LINE_THROUGH_MODE, + XML_CONTINUOUS, + XML_SKIP_WHITE_SPACE, + XML_SCRIPTS, + XML_FONT_FACE_DECLS, + XML_FONT_FACE, + XML_FONT_FACE_SRC, + XML_FONT_FACE_URI, + XML_FONT_ADORNMENTS, + XML_INCH, + XML_SPACE_AFTER, + XML_START_INDENT, + XML_END_INDENT, + + // chart Oasis format additions + XML_INTERVAL_MINOR_DIVISOR, + XML_DATE_STRING, + + XML_TEXT_UNDERLINE_STYLE, + XML_TEXT_UNDERLINE_TYPE, + XML_TEXT_UNDERLINE_WIDTH, + + XML_TEXT_OVERLINE_TYPE, + XML_TEXT_OVERLINE_STYLE, + XML_TEXT_OVERLINE_WIDTH, + XML_TEXT_OVERLINE_COLOR, + XML_TEXT_OVERLINE_MODE, + + XML_TEXT_LINE_THROUGH_STYLE, + XML_TEXT_LINE_THROUGH_TYPE, + XML_TEXT_LINE_THROUGH_WIDTH, + XML_TEXT_LINE_THROUGH_TEXT, + + XML_LEADER_STYLE, + XML_LEADER_TEXT, + + XML_BOLD_DOTTED, + XML_BOLD_DASH, + XML_BOLD_LONG_DASH, + XML_BOLD_DOT_DASH, + XML_BOLD_DOT_DOT_DASH, + XML_BOLD_WAVE, + XML_DOUBLE_WAVE, + XML_DOUBLE_LINE, + XML_THICK_LINE, + XML_SINGLE_LINE, + XML_SLASH, + XML_TEXT_LINE_THROUGH_COLOR, + XML_TEXT_LINE_THROUGH_TEXT_STYLE, + XML_LEADER_COLOR, + XML_LEADER_TYPE, + XML_LEADER_WIDTH, + XML_LEADER_TEXT_STYLE, + + XML_OPACITY, + XML_OPACITY_NAME, + XML_SHADOW_OPACITY, + XML_ALWAYS, + XML_COUNT_IN_TEXT_BOXES, + + XML_NP_OOO, + XML_N_OOO, + XML_NP_OOOW, + XML_N_OOOW, + XML_NP_OOOC, + XML_N_OOOC, + XML_NP_DOM, + XML_N_DOM, + + XML_EVENT_LISTENERS, + XML_EVENT_LISTENER, + + XML_FORM, + XML_VOID, + XML_PROPERTY, + XML_PROPERTY_NAME, + XML_LIST_PROPERTY, + XML_LIST_VALUE, + XML_COLUMN_STYLE_NAME, + + XML_TEXTAREA, + XML_FIXED_TEXT, + XML_FILE, + XML_FORMATTED_TEXT, + XML_BUTTON, + XML_CHECKBOX, + XML_RADIO, + XML_LISTBOX, + XML_COMBOBOX, + XML_IMAGE_FRAME, + XML_VALUE_RANGE, + XML_GENERIC_CONTROL, + XML_SERVICE_NAME, + XML_PROPERTY_TYPE, + XML_INTEGER, + XML_PROPERTY_IS_VOID, + XML_PROPERTY_IS_LIST, + XML_PROPERTY_VALUE, + XML_MIMETYPE, + XML_DATABASE_ROW_SELECT, + XML_CONTROL_IMPLEMENTATION, + XML_INTERPOLATION, + XML_CUBIC_SPLINE, + XML_B_SPLINE, + XML_STEP_START, + XML_STEP_END, + XML_STEP_CENTER_X, + XML_STEP_CENTER_Y, + XML_GNM_STEP_START, + XML_GNM_STEP_END, + XML_GNM_STEP_CENTER_X, + XML_GNM_STEP_CENTER_Y, + XML_N_DB_OASIS, + + XML_SHOW_FILTER_BUTTON, + XML_DRILL_DOWN_ON_DOUBLE_CLICK, + XML_HEADER_GRID_LAYOUT, + XML_GROUPED_BY, + XML_DAYS, + XML_MONTHS, + XML_QUARTERS, + XML_YEARS, + XML_DATE_START, + XML_DATE_END, + XML_STEP, + XML_IS_GROUP_FIELD, + XML_DATA_PILOT_GROUPS, + XML_DATA_PILOT_GROUP, + + XML_JAPANESE_CANDLE_STICK, + XML_NAMED_SYMBOL, + XML_DIAMOND, + XML_ARROW_DOWN, + XML_ARROW_UP, + XML_ARROW_RIGHT, + XML_ARROW_LEFT, + XML_BOW_TIE, + XML_HOURGLASS, + XML_SYMBOL_NAME, + XML_SYMBOL_TYPE, + XML_IMAGE_OPACITY, // #i25616# + + XML_DEFAULT_OUTLINE_LEVEL, + XML_SHOW_DETAILS, + XML_SHOW_EMPTY, + XML_ITERATIVE, + XML_uX, + XML_NP_DLG, + XML_N_DLG, + XML_SCRIPT_DATA, + XML_LIBRARIES, + XML_SOURCE_CODE, + XML_READONLY, + + XML_Z, + XML_DIMENSION, + XML_VALIDATION_NAME, + + XML_SCREEN, + XML_PRINTER, + + // XForms tokens + // already defined: XML_ACTION, XML_VERSION, XML_ENCODING, + // XML_REPLACE, XML_SEPARATOR, XML_TYPE, XML_ID + XML_MODEL, + XML_SCHEMA, + XML_BIND, + XML_INSTANCE, + XML_SUBMISSION, + XML_REF, + XML_SRC, + XML_METHOD, + XML_NODESET, + XML_INDENT, + XML_OMIT_XML_DECLARATION, + XML_STANDALONE, + XML_CDATA_SECTION_ELEMENTS, + XML_REQUIRED, + XML_RELEVANT, + XML_CALCULATE, + XML_CONSTRAINT, + XML_MAXOCCURS, // maxOccurs + XML_MINOCCURS, // minOccurs + XML_P3PTYPE, + XML_MEDIATYPE, + XML_INCLUDENAMESPACEPREFIXES, + + // XForms/XSD Schema; these tokens use innerWordCapitalization + // (already defined: XML_SCHEMA, XML_LENGTH, XML_ID) + XML_BASE, + XML_TARGETNAMESPACE, // targetNamespace + XML_SIMPLETYPE, // simpleType + XML_RESTRICTION, + XML_MAXLENGTH, // maxLength + XML_MINLENGTH, // minLength + XML_MININCLUSIVE, // minInclusive + XML_MINEXCLUSIVE, // minExclusive + XML_MAXINCLUSIVE, // maxInclusive + XML_MAXEXCLUSIVE, // maxExclusive + XML_PATTERN, + XML_ENUMERATION, + XML_WHITESPACE, // whiteSpace + XML_TOTALDIGITS, // totalDigits + XML_FRACTIONDIGITS, // fractionDigits + XML_PRESERVE, + XML_ANYURI, // anyURI + XML_DATETIME_XSD, // dateTime + XML_MAIN_ETRY, // #i28755# + + // SMIL + XML_REMOVE, + XML_HOLD, + XML_TRANSITION, + XML_INHERIT, + XML_FILLDEFAULT, + XML_RESTART, + XML_RESTARTDEFAULT, + XML_WHENNOTACTIVE, + XML_NEVER, + XML_ACCELERATE, + XML_DECELERATE, + XML_AUTOREVERSE, + XML_INDEFINITE, + XML_REPEATCOUNT, + XML_REPEATDUR, + XML_ENDSYNC, + XML_FIRST, + XML_LAST, + XML_MEDIA, + XML_DUR, + XML_BEGIN, + XML_WHOLE, + XML_FROM, + XML_TO, + XML_BY, + XML_VALUES, + XML_KEYTIMES, + XML_KEYSPLINES, + XML_CALCMODE, + XML_DISCRETE, + XML_PACED, + XML_SPLINE, + XML_ACCUMULATE, + XML_ADDITIVE, + XML_MULTIPLY, + XML_ANIMATE, + XML_ANIMATEMOTION, + XML_ANIMATETRANSFORM, + XML_ANIMATECOLOR, + XML_TRANSITIONFILTER, + XML_ATTRIBUTENAME, + + XML_NP_SMIL, + XML_N_SMIL, + + XML_NP_ANIMATION, + XML_N_ANIMATION, + + XML_PAR, + XML_SEQ, + + XML_TRANSLATE, + XML_SKEWX, + XML_SKEWY, + + XML_AUDIO, + + XML_COLOR_INTERPOLATION, + XML_COLOR_INTERPOLATION_DIRECTION, + XML_HSL, + XML_RGB, + + XML_BARWIPE, + XML_BOXWIPE, + XML_FOURBOXWIPE, + XML_BARNDOORWIPE, + XML_DIAGONALWIPE, + XML_BOWTIEWIPE, + XML_MISCDIAGONALWIPE, + XML_VEEWIPE, + XML_BARNVEEWIPE, + XML_ZIGZAGWIPE, + XML_BARNZIGZAGWIPE, + XML_IRISWIPE, + XML_TRIANGLEWIPE, + XML_ARROWHEADWIPE, + XML_PENTAGONWIPE, + XML_HEXAGONWIPE, + XML_ELLIPSEWIPE, + XML_EYEWIPE, + XML_ROUNDRECTWIPE, + XML_STARWIPE, + XML_MISCSHAPEWIPE, + XML_CLOCKWIPE, + XML_PINWHEELWIPE, + XML_SINGLESWEEPWIPE, + XML_FANWIPE, + XML_DOUBLEFANWIPE, + XML_DOUBLESWEEPWIPE, + XML_SALOONDOORWIPE, + XML_WINDSHIELDWIPE, + XML_SNAKEWIPE, + XML_SPIRALWIPE, + XML_PARALLELSNAKESWIPE, + XML_BOXSNAKESWIPE, + XML_WATERFALLWIPE, + XML_PUSHWIPE, + XML_SLIDEWIPE, + XML_BLINDSWIPE, + XML_RANDOMBARWIPE, + XML_CHECKERBOARDWIPE, + XML_ZOOM, + + XML_LEFTTORIGHT, + XML_TOPTOBOTTOM, + XML_TOPLEFT, + XML_TOPRIGHT, + XML_BOTTOMRIGHT, + XML_BOTTOMLEFT, + XML_TOPCENTER, + XML_RIGHTCENTER, + XML_BOTTOMCENTER, + XML_LEFTCENTER, + XML_CORNERSIN, + XML_CORNERSOUT, + XML_DIAGONALBOTTOMLEFT, + XML_DIAGONALTOPLEFT, + XML_DOUBLEBARNDOOR, + XML_DOUBLEDIAMOND, + XML_FOURPOINT, + XML_FIVEPOINT, + XML_SIXPOINT, + XML_HEART, + XML_KEYHOLE, + XML_CLOCKWISETWELVE, + XML_CLOCKWISETHREE, + XML_CLOCKWISESIX, + XML_CLOCKWISENINE, + XML_TWOBLADEVERTICAL, + XML_TWOBLADEHORIZONTAL, + XML_FOURBLADE, + XML_CLOCKWISETOP, + XML_CLOCKWISERIGHT, + XML_CLOCKWISEBOTTOM, + XML_CLOCKWISELEFT, + XML_CLOCKWISETOPLEFT, + XML_COUNTERCLOCKWISEBOTTOMLEFT, + XML_CLOCKWISEBOTTOMRIGHT, + XML_COUNTERCLOCKWISETOPRIGHT, + XML_CENTERTOP, + XML_CENTERRIGHT, + XML_FANOUTVERTICAL, + XML_FANOUTHORIZONTAL, + XML_FANINVERTICAL, + XML_FANINHORIZONTAL, + XML_PARALLELVERTICAL, + XML_PARALLELDIAGONAL, + XML_OPPOSITEVERTICAL, + XML_OPPOSITEHORIZONTAL, + XML_PARALLELDIAGONALTOPLEFT, + XML_PARALLELDIAGONALBOTTOMLEFT, + XML_TOPLEFTHORIZONTAL, + XML_TOPLEFTDIAGONAL, + XML_TOPLEFTVERTICAL, + XML_TOPRIGHTDIAGONAL, + XML_BOTTOMRIGHTDIAGONAL, + XML_BOTTOMLEFTDIAGONAL, + XML_TOPLEFTCLOCKWISE, + XML_TOPRIGHTCLOCKWISE, + XML_BOTTOMRIGHTCLOCKWISE, + XML_BOTTOMLEFTCLOCKWISE, + XML_TOPLEFTCOUNTERCLOCKWISE, + XML_TOPRIGHTCOUNTERCLOCKWISE, + XML_BOTTOMRIGHTCOUNTERCLOCKWISE, + XML_BOTTOMLEFTCOUNTERCLOCKWISE, + XML_VERTICALTOPSAME, + XML_VERTICALBOTTOMSAME, + XML_VERTICALTOPLEFTOPPOSITE, + XML_VERTICALBOTTOMLEFTOPPOSITE, + XML_HORIZONTALLEFTSAME, + XML_HORIZONTALRIGHTSAME, + XML_HORIZONTALTOPLEFTOPPOSITE, + XML_HORIZONTALTOPRIGHTOPPOSITE, + XML_DIAGONALBOTTOMLEFTOPPOSITE, + XML_DIAGONALTOPLEFTOPPOSITE, + XML_TWOBOXTOP, + XML_TWOBOXBOTTOM, + XML_TWOBOXLEFT, + XML_TWOBOXRIGHT, + XML_FOURBOXVERTICAL, + XML_FOURBOXHORIZONTAL, + XML_VERTICALLEFT, + XML_VERTICALRIGHT, + XML_HORIZONTALLEFT, + XML_HORIZONTALRIGHT, + XML_FROMLEFT, + XML_FROMTOP, + XML_FROMRIGHT, + XML_FROMBOTTOM, + XML_CROSSFADE, + XML_FADETOCOLOR, + XML_FADEFROMCOLOR, + XML_FADEOVERCOLOR, + XML_THREEBLADE, + XML_EIGHTBLADE, + XML_ONEBLADE, + XML_ACROSS, + XML_COMBHORIZONTAL, + XML_COMBVERTICAL, + XML_ROTATEIN, + XML_ROTATEOUT, + XML_FROMTOPLEFT, + XML_FROMTOPRIGHT, + XML_FROMBOTTOMLEFT, + XML_FROMBOTTOMRIGHT, + + XML_SUBTYPE, + XML_OUT, + + XML_FORWARD, + XML_REVERSE, + + XML_FADECOLOR, + + XML_ONBEGIN, + XML_ONEND, + XML_CLICK, + XML_DOUBLECLICK, + XML_MOUSEOVER, + XML_MOUSEOUT, + + XML_NODE_TYPE, + XML_PRESET_ID, + XML_PRESET_SUB_TYPE, + XML_PRESET_CLASS, + XML_CUSTOM, + XML_ENTRANCE, + XML_EXIT, + XML_EMPHASIS, + XML_MOTION_PATH, + XML_OLE_ACTION, + XML_MEDIA_CALL, + XML_ON_CLICK, + XML_WITH_PREVIOUS, + XML_AFTER_PREVIOUS, + XML_MAIN_SEQUENCE, + XML_TIMING_ROOT, + XML_INTERACTIVE_SEQUENCE, + + XML_SUB_ITEM, + XML_ITERATE_TYPE, + XML_ITERATE_INTERVAL, + XML_ITERATE, + XML_BY_PARAGRAPH, + XML_BY_WORD, + XML_BY_LETTER, + + XML_AFTER_EFFECT, + XML_MASTER, + + XML_GROUP_ID, + XML_TARGETELEMENT, + XML_TOGGLE_PAUSE, + XML_MASTER_ELEMENT, + XML_STOP_AUDIO, + + XML_AUDIO_LEVEL, + + XML_URN_OASIS_NAMES_TC, + XML_OPENDOCUMENT, + XML_1_0, + + XML_IS_LIST_HEADER, + XML_N_SVG_COMPAT, + XML_N_FO_COMPAT, + XML_N_SMIL_COMPAT, + XML_N_SMIL_OLD, + XML_XFORMS_SUBMISSION, + XML_XFORMS_LIST_SOURCE, + + XML_URI_W3_PREFIX, + XML_URI_XFORMS_SUFFIX, + + // XML_HORIZONTAL_ON_LEFT_PAGES and XML_HORIZONTAL_ON_RIGHT_PAGES + // are replaced by XML_HORIZONTAL_ON_EVEN and XML_HORIZONTAL_ON_ODD. (#i49139#) + XML_HORIZONTAL_ON_EVEN, + XML_N_RPT_OASIS, + XML_N_RPT, + XML_GROUP, + XML_GROUPS , + XML_REPORT_HEADER, + XML_PAGE_HEADER , + XML_DETAIL , + XML_PAGE_FOOTER , + XML_REPORT_FOOTER, + XML_START_NEW_COLUMN , + XML_RESET_PAGE_NUMBER , + XML_PRINT_HEADER_ON_EACH_PAGE , + XML_SORT_EXPRESSION , + XML_GROUP_EXPRESSION , + XML_GROUP_HEADER , + XML_GROUP_FOOTER , + XML_HEADER_ON_NEW_PAGE, + XML_FOOTER_ON_NEW_PAGE, + XML_PAGE_PRINT_OPTION, + XML_PRE_EVALUATED, + XML_COMMAND_TYPE, + XML_MASTER_FIELDS, + XML_DETAIL_FIELDS, + XML_CONDITIONAL_PRINT_EXPRESSION, + XML_REPORT_COMPONENT, + XML_PRINT_REPEATED_VALUES, + XML_REPEAT_SECTION, + XML_FORCE_NEW_COLUMN, + XML_GROUP_ON, + XML_FORCE_NEW_PAGE, + XML_GROUP_INTERVAL, + XML_PRINT_WHEN_GROUP_CHANGE, + XML_REPORT_ELEMENT, + XML_LIST_SOURCE, + XML_LIST_SOURCE_TYPE, + XML_IMAGE_DATA, + XML_SELECTED, + XML_CURRENT_STATE, + XML_IS_TRISTATE, + XML_ALL_PAGES, + XML_NOT_WITH_REPORT_HEADER, + XML_NOT_WITH_REPORT_FOOTER, + XML_NOT_WITH_REPORT_HEADER_NOR_FOOTER, + XML_BEFORE_SECTION, + XML_AFTER_SECTION, + XML_BEFORE_AFTER_SECTION, + XML_PREFIX_CHARACTERS, + XML_QUARTAL, + XML_WEEK, + XML_WHOLE_GROUP, + XML_WITH_FIRST_DETAIL, + XML_TOP_DOWN, + XML_BOTTOM_UP, + XML_HOUR, + XML_MINUTE, + XML_NP_RPT, + XML_FORMAT_CONDITION, + XML_EXPRESSION1, + XML_EXPRESSION2, + XML_EQUAL, + XML_NOT_EQUAL, + XML_LESS, + XML_GREATER, + XML_LESS_EQUAL, + XML_GREATER_EQUAL, + XML_BETWEEN, + XML_NOT_BETWEEN, + XML_TABLE_TEMPLATE, + XML_FIRST_ROW, + XML_LAST_ROW, + XML_FIRST_COLUMN, + XML_LAST_COLUMN, + XML_EVEN_ROWS, + XML_ODD_ROWS, + XML_EVEN_COLUMNS, + XML_ODD_COLUMNS, + XML_HORIZONTAL_ON_ODD, + // Password error from 1.4 to 2.0 Beta (#i45874#) + XML_RESTART_NUMBERING, + // OpenDocument <text:numbered-paragraph> element not supported on OpenDocument import (#i52127#) + XML_NUMBERED_PARAGRAPH, + XML_MASTER_DETAIL_FIELDS, + XML_MASTER_DETAIL_FIELD, + XML_SUB_DOCUMENT, + XML_FIXED_CONTENT, + XML_INITIAL_FORMULA, + XML_DEEP_TRAVERSING, + XML_PRESERVE_IRI, + XML_SORT_BY_X_VALUES, + XML_PAGE_CONTINUATION, + XML_RIGHT_ANGLED_AXES, + XML_SOFT_PAGE_BREAK, + XML_USE_SOFT_PAGE_BREAKS, + XML_PERCENTAGE_DATA_STYLE_NAME, + XML_VALUE_AND_PERCENTAGE, + XML_GROUP_BARS_PER_AXIS, + XML_INCLUDE_HIDDEN_CELLS, + XML_AUTOMATIC_POSITION, + XML_AUTOMATIC_SIZE, + XML_REVERSE_DIRECTION, + XML_LABEL_SEPARATOR, + XML_LABEL_POSITION, + XML_AVOID_OVERLAP, + XML_NEAR_ORIGIN, + XML_DEPENDENCY, + XML_NAV_ORDER, + + XML_USE_FIRST_ROW_STYLES, + XML_USE_LAST_ROW_STYLES, + XML_USE_FIRST_COLUMN_STYLES, + XML_USE_LAST_COLUMN_STYLES, + XML_USE_BANDING_ROWS_STYLES, + XML_USE_BANDING_COLUMNS_STYLES, + + XML_AUTOMATIC_CONTENT, + XML_DISPLAY_R_SQUARE, + XML_DISPLAY_EQUATION, + // db odf 12 + XML_TABLE_REPRESENTATIONS, + XML_TABLE_REPRESENTATION, + XML_SCHEMA_DEFINITION, + XML_CONNECTION_DATA, + XML_DATABASE_DESCRIPTION, + XML_COMPOUND_DATABASE, + XML_FILE_BASED_DATABASE, + XML_SERVER_DATABASE, + XML_MEDIA_TYPE, + XML_HOSTNAME, + XML_PORT, + XML_LOCAL_SOCKET, + XML_USE_SYSTEM_USER, + XML_DRIVER_SETTINGS, + XML_JAVA_CLASSPATH, + XML_CHARACTER_SET, + XML_APPLICATION_CONNECTION_SETTINGS, + XML_TABLE_INCLUDE_FILTER, + XML_DEFAULT_ROW_STYLE_NAME, + XML_ANGLE_OFFSET, + // Core implementation for direct cross-references (#i81002#) + XML_NUMBER_NO_SUPERIOR, + XML_NUMBER_ALL_SUPERIOR, + XML_LIST_LEVEL_POSITION_AND_SPACE_MODE, + XML_LABEL_WIDTH_AND_POSITION, + XML_LABEL_ALIGNMENT, + XML_LIST_LEVEL_LABEL_ALIGNMENT, + XML_LABEL_FOLLOWED_BY, + XML_LISTTAB, + XML_SPACE, + XML_NOTHING, + XML_LIST_TAB_STOP_POSITION, + XML_STANDARD_ERROR, + XML_CELL_RANGE, + XML_ERROR_LOWER_RANGE, + XML_ERROR_UPPER_RANGE, + + XML_CONTINUE_LIST, + XML_STYLE_OVERRIDE, + + // fs: #i90243# + XML_XFORM_MODEL_SETTINGS, + + // ODF 1.2 metadata + XML_META_FIELD, + XML_ABOUT, + XML_DATATYPE, + XML_TRANSFORMATION, + + // ODF 1.2 numbered-paragraph + XML_LIST_ID, + + XML_TREAT_EMPTY_CELLS, + XML_LEAVE_GAP, + XML_USE_ZERO, + XML_IGNORE, + + // enhanced fields + XML_FIELDMARK, + XML_FIELDMARK_START, + XML_FIELDMARK_END, + XML_N_FIELD, + XML_NP_FIELD, + + XML_IMAGE_SCALE, + XML_ISOTROPIC, + XML_ANISOTROPIC, + + XML_AXIS_POSITION, + XML_AXIS_LABEL_POSITION, + XML_NEAR_AXIS, + XML_NEAR_AXIS_OTHER_SIDE, + XML_OUTSIDE_START, + XML_OUTSIDE_END, + XML_TICK_MARK_POSITION, + XML_AT_LABELS, + XML_AT_AXIS, + XML_AT_LABELS_AND_AXIS, + XML_FILLED_RADAR, + XML_SURFACE, + + // MathML only + XML_MATHVARIANT, + XML_MATHSIZE, + XML_MATHWEIGHT, + XML_MATHCOLOR, + + XML_CONTAINS, + XML_DOES_NOT_CONTAIN, + XML_BEGINS_WITH, + XML_DOES_NOT_BEGIN_WITH, + XML_ENDS_WITH, + XML_DOES_NOT_END_WITH, + + //chart + XML_NP_CHART_EXT, + XML_N_CHART_EXT, + XML_COORDINATE_REGION, + + XML_DIAGONAL_BL_TR_WIDTHS, + XML_DIAGONAL_TL_BR_WIDTHS, + + XML_OUTSIDE_MINIMUM,//#i114142# + XML_OUTSIDE_MAXIMUM,//#i114142# + + XML_LEGEND_EXPANSION, //#i28760# + XML_LEGEND_EXPANSION_ASPECT_RATIO, //#i28760# + XML_BALANCED, //#i28760# + XML_HIGH, //#i28760# + XML_WIDE, //#i28760# + + XML_AXIS_TYPE, //#i25706# + XML_DATE_SCALE, + XML_BASE_TIME_UNIT, + XML_MAJOR_INTERVAL_VALUE, + XML_MINOR_INTERVAL_VALUE, + XML_MAJOR_INTERVAL_UNIT, + XML_MINOR_INTERVAL_UNIT, + + XML_MIN_VALUE, + XML_MAX_VALUE, + + XML_MARGIN, // #i117001# + + // regina, ODF1.2 additional symbols in charts + XML_STAR, + XML_ASTERISK, + XML_HORIZONTAL_BAR, + XML_VERTICAL_BAR, + + XML_ERROR_STANDARD_WEIGHT, // errorbar standard deviation error weight + XML_TOKEN_END + }; + + + /// return the OUString representation for eToken + XMLOFF_DLLPUBLIC const OUString& GetXMLToken( + enum XMLTokenEnum eToken ); + + /// compare eToken to the string + XMLOFF_DLLPUBLIC sal_Bool IsXMLToken( + const OUString& rString, + enum XMLTokenEnum eToken ); + + // gives all allocated memory for OUString* back + XMLOFF_DLLPUBLIC void ResetTokens(); + + XMLOFF_DLLPUBLIC void IncRescheduleCount(); + + XMLOFF_DLLPUBLIC void DecRescheduleCount(); + + +} } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmltypes.hxx b/include/xmloff/xmltypes.hxx new file mode 100644 index 000000000000..c20394fd934e --- /dev/null +++ b/include/xmloff/xmltypes.hxx @@ -0,0 +1,283 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLTYPES_HXX +#define _XMLOFF_XMLTYPES_HXX + +/////////////////////////////////////////////////////////////////////////////// +// Flags to specify how to im/export the property +// +// OLD: +// 8421.8421.8421.8421.8421.8421.8421.8421 +// n n m mmmd m baaa tttt.tttt.tttt +// spsp eep paef e ppp tttt.tttt.tttt +// iiee iei ieie i ppp tttt.tttt.tttt +// NOW: +// n n mm mmdm pp ppba aatt.tttt.tttt +// spsp eepp aefe p pptt.tttt.tttt +// iiee ieii eiei p pptt.tttt.tttt + +#define MID_FLAG_MASK 0x00003fff + +// Import only: the xml attribute's value is evaluated by a call to +// handleSpecialItem instead of calling the property handler's importXML method +#define MID_FLAG_SPECIAL_ITEM_IMPORT 0x80000000 + +// Export only: the property's value is exported by a call to handleSpecialItem +// instead of calling the property handler's exportXML method +#define MID_FLAG_SPECIAL_ITEM_EXPORT 0x20000000 +#define MID_FLAG_SPECIAL_ITEM 0xa0000000 // both import and export + +// the map entry denotes the name of an element item +#define MID_FLAG_ELEMENT_ITEM_IMPORT 0x08000000 +#define MID_FLAG_ELEMENT_ITEM_EXPORT 0x04000000 +#define MID_FLAG_ELEMENT_ITEM 0x0c000000 // both import and export + +// the attribute is ignored (not yet implemented) +#define MID_FLAG_NO_PROPERTY_IMPORT 0x40000000 + +// the property is ignored +#define MID_FLAG_NO_PROPERTY_EXPORT 0x10000000 +#define MID_FLAG_NO_PROPERTY 0x50000000 // both import and export + +// Import only: there are more entries for the same xml attribute existing +#define MID_FLAG_MULTI_PROPERTY 0x02000000 // + +// Import only: If a property with the same name has been set already, supply +// the current value to the importXML call. +#define MID_FLAG_MERGE_PROPERTY 0x01000000 + +// Export only: If an xml attribute with the same name has been exported +// already, supply its value to the exportXML call and delete the existing +// atribute afterwards. +#define MID_FLAG_MERGE_ATTRIBUTE 0x00800000 + +// Import and Export: The property in question must exist. No call to +// hasPropertyByName is required. +#define MID_FLAG_MUST_EXIST 0x00400000 + +// Export only: When exporting defaults, export this property even if it is +// not set +#define MID_FLAG_DEFAULT_ITEM_EXPORT 0x00200000 + +// Import only: In general, properties may not throw exception, but +// this one may. If it throws an IllegalArgumentException, it will be +// silently ignored. This should be used for properties whose values +// cannot be checked. (E.g., the printer paper tray: The tray names +// are different for all printers, and we don't know ahead whether a +// printer supports the trays in the current document.) +#define MID_FLAG_PROPERTY_MAY_EXCEPT 0x00100000 + +#define XML_TYPE_PROP_SHIFT 14 +#define XML_TYPE_PROP_MASK (0xf << XML_TYPE_PROP_SHIFT) + +#define XML_TYPE_PROP_START (0x1 << XML_TYPE_PROP_SHIFT) +#define XML_TYPE_PROP_GRAPHIC (0x1 << XML_TYPE_PROP_SHIFT) +#define XML_TYPE_PROP_DRAWING_PAGE (0x2 << XML_TYPE_PROP_SHIFT) +#define XML_TYPE_PROP_PAGE_LAYOUT (0x3 << XML_TYPE_PROP_SHIFT) +#define XML_TYPE_PROP_HEADER_FOOTER (0x4 << XML_TYPE_PROP_SHIFT) +#define XML_TYPE_PROP_TEXT (0x5 << XML_TYPE_PROP_SHIFT) +#define XML_TYPE_PROP_PARAGRAPH (0x6 << XML_TYPE_PROP_SHIFT) +#define XML_TYPE_PROP_RUBY (0x7 << XML_TYPE_PROP_SHIFT) +#define XML_TYPE_PROP_SECTION (0x8 << XML_TYPE_PROP_SHIFT) +#define XML_TYPE_PROP_TABLE (0x9 << XML_TYPE_PROP_SHIFT) +#define XML_TYPE_PROP_TABLE_COLUMN (0xa << XML_TYPE_PROP_SHIFT) +#define XML_TYPE_PROP_TABLE_ROW (0xb << XML_TYPE_PROP_SHIFT) +#define XML_TYPE_PROP_TABLE_CELL (0xc << XML_TYPE_PROP_SHIFT) +#define XML_TYPE_PROP_LIST_LEVEL (0xd << XML_TYPE_PROP_SHIFT) +#define XML_TYPE_PROP_CHART (0xe << XML_TYPE_PROP_SHIFT) +#define XML_TYPE_PROP_END (0xf << XML_TYPE_PROP_SHIFT) + +/////////////////////////////////////////////////////////////////////////////// +// +// XML-data-type-ID's +// + +// simple types, no special compare necessary +#define XML_TYPE_BUILDIN_CMP 0x00002000 + +// basic types (all also XML_TYPE_BUILDIN_CMP) +#define XML_TYPE_BOOL 0x00002001 // true/false +#define XML_TYPE_MEASURE 0x00002002 // 1cm +#define XML_TYPE_MEASURE8 0x00002003 // 1cm +#define XML_TYPE_MEASURE16 0x00002004 // 1cm +#define XML_TYPE_PERCENT 0x00002005 // 50% +#define XML_TYPE_PERCENT8 0x00002006 // 50% +#define XML_TYPE_PERCENT16 0x00002007 // 50% +#define XML_TYPE_STRING 0x00002008 // "blablabla" +#define XML_TYPE_COLOR 0x00002009 // Colors +#define XML_TYPE_NUMBER 0x0000200a // 123 +#define XML_TYPE_NUMBER8 0x0000200b // 123 +#define XML_TYPE_NUMBER16 0x0000200c // 123 +#define XML_TYPE_NUMBER_NONE 0x0000200d // 123 and "no-limit" for 0 +#define XML_TYPE_DOUBLE 0x0000200e // for doubles +#define XML_TYPE_NBOOL 0x0000200f // !true/false +#define XML_TYPE_COLORTRANSPARENT 0x00002010 // Colors or "transparent" +#define XML_TYPE_ISTRANSPARENT 0x00002011 // "transparent" +#define XML_TYPE_BUILDIN_CMP_ONLY 0x00002012 // Only buildin comparison is required, so no handler exists +#define XML_TYPE_NUMBER8_NONE 0x00002013 // 123 and "no-limit" for 0 +#define XML_TYPE_NUMBER16_NONE 0x00002014 // 123 and "no-limit" for 0 +#define XML_TYPE_COLOR_MODE 0x00002015 +#define XML_TYPE_DURATION16_MS 0x00002016 // PT00H00M01S to ms in sal_Int16 +#define XML_TYPE_MEASURE_PX 0x00002017 // 1px +#define XML_TYPE_COLORAUTO 0x00002018 // color if not -1 +#define XML_TYPE_ISAUTOCOLOR 0x00002019 // true if -1 +#define XML_TYPE_STYLENAME 0x00002020 // "blablabla" +#define XML_TYPE_NEG_PERCENT 0x00002021 // (100-x)% +#define XML_TYPE_NEG_PERCENT8 0x00002022 // (100-x)% +#define XML_TYPE_NEG_PERCENT16 0x00002023 // (100-x) +#define XML_TYPE_DOUBLE_PERCENT 0x00002024 // 50% (source is a double from 0.0 to 1.0) +#define XML_TYPE_HEX 0x00002025 // 00544F1B + +// special basic types +#define XML_TYPE_RECTANGLE_LEFT 0x00000100 // the Left member of a awt::Rectangle as a measure +#define XML_TYPE_RECTANGLE_TOP 0x00000101 // the Top member of a awt::Rectangle as a measure +#define XML_TYPE_RECTANGLE_WIDTH 0x00000102 // the Width member of a awt::Rectangle as a measure +#define XML_TYPE_RECTANGLE_HEIGHT 0x00000103 // the Height member of a awt::Rectangle as a measure + +#define XML_TYPE_APP_SHIFT 10 +#define XML_SC_TYPES_START (0x1 << XML_TYPE_APP_SHIFT) +#define XML_SD_TYPES_START (0x2 << XML_TYPE_APP_SHIFT) + +#define XML_TEXT_TYPES_START (0x3 << XML_TYPE_APP_SHIFT) +#define XML_TYPE_TEXT_CROSSEDOUT_STYLE (XML_TEXT_TYPES_START + 0) +#define XML_TYPE_TEXT_CASEMAP (XML_TEXT_TYPES_START + 1) +#define XML_TYPE_TEXT_FONTFAMILYNAME (XML_TEXT_TYPES_START + 2) +#define XML_TYPE_TEXT_FONTFAMILY (XML_TEXT_TYPES_START + 3) +#define XML_TYPE_TEXT_FONTENCODING (XML_TEXT_TYPES_START + 4) +#define XML_TYPE_TEXT_FONTPITCH (XML_TEXT_TYPES_START + 5) +#define XML_TYPE_TEXT_KERNING (XML_TEXT_TYPES_START + 6) +#define XML_TYPE_TEXT_POSTURE (XML_TEXT_TYPES_START + 7) +#define XML_TYPE_TEXT_SHADOWED (XML_TEXT_TYPES_START + 8) +#define XML_TYPE_TEXT_UNDERLINE_STYLE (XML_TEXT_TYPES_START + 9) +#define XML_TYPE_TEXT_WEIGHT (XML_TEXT_TYPES_START + 10) +#define XML_TYPE_TEXT_SPLIT (XML_TEXT_TYPES_START + 11) +#define XML_TYPE_TEXT_BREAKBEFORE (XML_TEXT_TYPES_START + 12) +#define XML_TYPE_TEXT_BREAKAFTER (XML_TEXT_TYPES_START + 13) +#define XML_TYPE_TEXT_SHADOW (XML_TEXT_TYPES_START + 14) +#define XML_TYPE_TEXT_ADJUST (XML_TEXT_TYPES_START + 15) +#define XML_TYPE_TEXT_ADJUSTLAST (XML_TEXT_TYPES_START + 16) +#define XML_TYPE_TEXT_CASEMAP_VAR (XML_TEXT_TYPES_START + 17) +#define XML_TYPE_TEXT_ESCAPEMENT (XML_TEXT_TYPES_START + 18) +#define XML_TYPE_TEXT_ESCAPEMENT_HEIGHT (XML_TEXT_TYPES_START + 19) +#define XML_TYPE_CHAR_HEIGHT (XML_TEXT_TYPES_START + 20) +#define XML_TYPE_CHAR_HEIGHT_PROP (XML_TEXT_TYPES_START + 21) +#define XML_TYPE_CHAR_LANGUAGE (XML_TEXT_TYPES_START + 22) +#define XML_TYPE_CHAR_COUNTRY (XML_TEXT_TYPES_START + 23) +#define XML_TYPE_LINE_SPACE_FIXED (XML_TEXT_TYPES_START + 24) +#define XML_TYPE_LINE_SPACE_MINIMUM (XML_TEXT_TYPES_START + 25) +#define XML_TYPE_LINE_SPACE_DISTANCE (XML_TEXT_TYPES_START + 26) +#define XML_TYPE_BORDER (XML_TEXT_TYPES_START + 27) +#define XML_TYPE_BORDER_WIDTH (XML_TEXT_TYPES_START + 28) +#define XML_TYPE_TEXT_DROPCAP (XML_TEXT_TYPES_START + 29) +#define XML_TYPE_TEXT_TABSTOP (XML_TEXT_TYPES_START + 30) +#define XML_TYPE_TEXT_BOOLCROSSEDOUT (XML_TEXT_TYPES_START + 31) +#define XML_TYPE_TEXT_WRAP (XML_TEXT_TYPES_START + 32) +#define XML_TYPE_TEXT_PARAGRAPH_ONLY (XML_TEXT_TYPES_START + 33) +#define XML_TYPE_TEXT_WRAP_OUTSIDE (XML_TEXT_TYPES_START + 34) +#define XML_TYPE_TEXT_OPAQUE (XML_TEXT_TYPES_START + 35) +#define XML_TYPE_TEXT_PROTECT_CONTENT (XML_TEXT_TYPES_START + 36) +#define XML_TYPE_TEXT_PROTECT_SIZE (XML_TEXT_TYPES_START + 37) +#define XML_TYPE_TEXT_PROTECT_POSITION (XML_TEXT_TYPES_START + 38) +#define XML_TYPE_TEXT_ANCHOR_TYPE (XML_TEXT_TYPES_START + 39) +#define XML_TYPE_TEXT_COLUMNS (XML_TEXT_TYPES_START + 40) +#define XML_TYPE_TEXT_HORIZONTAL_POS (XML_TEXT_TYPES_START + 41) +#define XML_TYPE_TEXT_HORIZONTAL_POS_MIRRORED (XML_TEXT_TYPES_START + 42) +#define XML_TYPE_TEXT_HORIZONTAL_REL (XML_TEXT_TYPES_START + 43) +#define XML_TYPE_TEXT_HORIZONTAL_REL_FRAME (XML_TEXT_TYPES_START + 44) +#define XML_TYPE_TEXT_HORIZONTAL_MIRROR (XML_TEXT_TYPES_START + 45) +#define XML_TYPE_TEXT_VERTICAL_POS (XML_TEXT_TYPES_START + 46) +#define XML_TYPE_TEXT_VERTICAL_REL (XML_TEXT_TYPES_START + 47) +#define XML_TYPE_TEXT_VERTICAL_REL_PAGE (XML_TEXT_TYPES_START + 48) +#define XML_TYPE_TEXT_VERTICAL_REL_FRAME (XML_TEXT_TYPES_START + 49) +#define XML_TYPE_TEXT_VERTICAL_REL_AS_CHAR (XML_TEXT_TYPES_START + 50) +#define XML_TYPE_TEXT_MIRROR_VERTICAL (XML_TEXT_TYPES_START + 51) +#define XML_TYPE_TEXT_MIRROR_HORIZONTAL_LEFT (XML_TEXT_TYPES_START + 52) +#define XML_TYPE_TEXT_MIRROR_HORIZONTAL_RIGHT (XML_TEXT_TYPES_START + 53) +#define XML_TYPE_TEXT_CLIP11 (XML_TEXT_TYPES_START + 54) +#define XML_TYPE_ATTRIBUTE_CONTAINER (XML_TEXT_TYPES_START + 55 ) +#define XML_TYPE_CHAR_HEIGHT_DIFF (XML_TEXT_TYPES_START + 56) +#define XML_TYPE_TEXT_EMPHASIZE (XML_TEXT_TYPES_START + 57) +#define XML_TYPE_TEXT_COMBINE (XML_TEXT_TYPES_START + 58) +#define XML_TYPE_TEXT_COMBINECHAR (XML_TEXT_TYPES_START + 59) +#define XML_TYPE_TEXT_UNDERLINE_COLOR (XML_TEXT_TYPES_START + 60) +#define XML_TYPE_TEXT_UNDERLINE_HASCOLOR (XML_TEXT_TYPES_START + 61) +#define XML_TYPE_TEXT_AUTOSPACE (XML_TEXT_TYPES_START + 62) +#define XML_TYPE_TEXT_PUNCTUATION_WRAP (XML_TEXT_TYPES_START + 63) +#define XML_TYPE_TEXT_LINE_BREAK (XML_TEXT_TYPES_START + 64) + +#define XML_TYPE_TEXT_ALIGN (XML_TEXT_TYPES_START + 65) +#define XML_TYPE_FONT_WIDTH (XML_TEXT_TYPES_START + 66) +#define XML_TYPE_ROTATION_ANGLE (XML_TEXT_TYPES_START + 67) +#define XML_TYPE_CONTROL_BORDER (XML_TEXT_TYPES_START + 68) +#define XML_TYPE_TEXT_REL_WIDTH_HEIGHT (XML_TEXT_TYPES_START + 69) +#define XML_TYPE_TEXT_SYNC_WIDTH_HEIGHT (XML_TEXT_TYPES_START + 70) +#define XML_TYPE_TEXT_SYNC_WIDTH_HEIGHT_MIN (XML_TEXT_TYPES_START + 71) +#define XML_TYPE_TEXT_COMBINE_CHARACTERS (XML_TEXT_TYPES_START + 72) +#define XML_TYPE_TEXT_ANIMATION (XML_TEXT_TYPES_START + 73) +#define XML_TYPE_TEXT_ANIMATION_DIRECTION (XML_TEXT_TYPES_START + 74) +#define XML_TYPE_TEXT_HORIZONTAL_ADJUST (XML_TEXT_TYPES_START + 75) +#define XML_TYPE_TEXT_RUBY_ADJUST (XML_TEXT_TYPES_START + 76) +#define XML_TYPE_TEXT_FONT_RELIEF (XML_TEXT_TYPES_START + 77) +#define XML_TYPE_TEXT_ROTATION_ANGLE (XML_TEXT_TYPES_START + 78) +#define XML_TYPE_TEXT_ROTATION_SCALE (XML_TEXT_TYPES_START + 79) +#define XML_TYPE_TEXT_VERTICAL_ALIGN (XML_TEXT_TYPES_START + 80) +#define XML_TYPE_TEXT_DRAW_ASPECT (XML_TEXT_TYPES_START + 81) +#define XML_TYPE_CONTROL_TEXT_EMPHASIZE (XML_TEXT_TYPES_START + 82) +#define XML_TYPE_TEXT_RUBY_POSITION (XML_TEXT_TYPES_START + 83) +#define XML_TYPE_TEXT_VERTICAL_POS_AT_CHAR (XML_TEXT_TYPES_START + 84) +#define XML_TYPE_TEXT_WRITING_MODE (XML_TEXT_TYPES_START + 85) +#define XML_TYPE_TEXT_WRITING_MODE_WITH_DEFAULT (XML_TEXT_TYPES_START + 86) +#define XML_TYPE_LAYOUT_GRID_MODE (XML_TEXT_TYPES_START + 87) +#define XML_TYPE_TEXT_HIDDEN_AS_DISPLAY (XML_TEXT_TYPES_START + 88) +#define XML_TYPE_CONTROL_BORDER_COLOR (XML_TEXT_TYPES_START + 89) +#define XML_TYPE_BORDER_MODEL (XML_TEXT_TYPES_START + 90) +#define XML_TYPE_TEXT_LINE_MODE (XML_TEXT_TYPES_START + 91) +#define XML_TYPE_TEXT_UNDERLINE_TYPE (XML_TEXT_TYPES_START + 92) +#define XML_TYPE_TEXT_UNDERLINE_WIDTH (XML_TEXT_TYPES_START + 93) +#define XML_TYPE_TEXT_CROSSEDOUT_TYPE (XML_TEXT_TYPES_START + 94) +#define XML_TYPE_TEXT_CROSSEDOUT_WIDTH (XML_TEXT_TYPES_START + 95) +#define XML_TYPE_TEXT_CROSSEDOUT_TEXT (XML_TEXT_TYPES_START + 96) +#define XML_TYPE_TEXT_KEEP (XML_TEXT_TYPES_START + 97) +#define XML_TYPE_TEXT_NKEEP (XML_TEXT_TYPES_START + 98) +#define XML_TYPE_WRAP_INFLUENCE_ON_POSITION (XML_TEXT_TYPES_START + 99) +#define XML_TYPE_WRAP_OPTION (XML_TEXT_TYPES_START + 100) +#define XML_TYPE_TEXT_NUMBER8_ONE_BASED (XML_TEXT_TYPES_START + 101) +#define XML_TYPE_NUMBER_NO_ZERO (XML_TEXT_TYPES_START + 102) +#define XML_TYPE_NUMBER8_NO_ZERO (XML_TEXT_TYPES_START + 103) +#define XML_TYPE_NUMBER16_NO_ZERO (XML_TEXT_TYPES_START + 104) +#define XML_TYPE_NUMBER16_AUTO (XML_TEXT_TYPES_START + 105) +#define XML_TYPE_TEXT_SOFT_PAGE_BREAK (XML_TEXT_TYPES_START + 106) +#define XML_TYPE_TEXT_USE_SOFT_PAGE_BREAKS (XML_TEXT_TYPES_START + 107) +#define XML_TYPE_TEXT_CLIP (XML_TEXT_TYPES_START + 108) +#define XML_TYPE_TEXT_OVERLINE_TYPE (XML_TEXT_TYPES_START + 109) +#define XML_TYPE_TEXT_OVERLINE_STYLE (XML_TEXT_TYPES_START + 110) +#define XML_TYPE_TEXT_OVERLINE_WIDTH (XML_TEXT_TYPES_START + 111) +#define XML_TYPE_TEXT_OVERLINE_COLOR (XML_TEXT_TYPES_START + 112) +#define XML_TYPE_TEXT_OVERLINE_HASCOLOR (XML_TEXT_TYPES_START + 113) +#define XML_TYPE_BOOL_FALSE (XML_TEXT_TYPES_START + 114) +#define XML_TYPE_FILLSTYLE (XML_TEXT_TYPES_START + 115) + +#define XML_SCH_TYPES_START (0x4 << XML_TYPE_APP_SHIFT) +#define XML_PM_TYPES_START (0x5 << XML_TYPE_APP_SHIFT) // page master +#define XML_DB_TYPES_START (0x6 << XML_TYPE_APP_SHIFT) + +#endif // _XMLOFF_XMLTYPES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmluconv.hxx b/include/xmloff/xmluconv.hxx new file mode 100644 index 000000000000..bc4ddb6b6dbd --- /dev/null +++ b/include/xmloff/xmluconv.hxx @@ -0,0 +1,230 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef _XMLOFF_XMLUCONV_HXX +#define _XMLOFF_XMLUCONV_HXX + +#include "sal/config.h" +#include "xmloff/dllapi.h" +#include "sal/types.h" + +#include <memory> +#include <limits.h> +#include <boost/utility.hpp> + +#include <rtl/ustring.hxx> +#include <rtl/ustrbuf.hxx> +#include <tools/solar.h> +#include <xmloff/xmlement.hxx> +#include <xmloff/xmltoken.hxx> +#include <com/sun/star/util/Date.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/drawing/Position3D.hpp> + +#include <com/sun/star/uno/XComponentContext.hpp> + +////////////////////////////////////////////////////////////////////////////// +// predeclarations + +class Time; + +namespace com { namespace sun { namespace star { + namespace util { struct DateTime; } + namespace text { class XNumberingTypeInfo; } +}}} + +namespace basegfx +{ + class B3DVector; +} // end of namespace basegfx + +class XMLOFF_DLLPUBLIC SvXMLTokenEnumerator +{ +private: + const OUString& maTokenString; + sal_Int32 mnNextTokenPos; + sal_Unicode mcSeperator; + +public: + SvXMLTokenEnumerator( const OUString& rString, sal_Unicode cSeperator = sal_Unicode(' ') ); + + sal_Bool getNextToken( OUString& rToken ); +}; + +/** the SvXMLTypeConverter converts values of various types from + their internal represantation to the textual form used in xml + and back. + Most of the methods are static but the SvXMLTypeConverter can + also store default units for both numerical and textual measures. + + @attention: + a lot of the methods here have been moved to <sax/tools/converter.hxx>! +*/ + +class XMLOFF_DLLPUBLIC SvXMLUnitConverter + : private ::boost::noncopyable +{ +private: + struct Impl; + ::std::auto_ptr<Impl> m_pImpl; + +public: + /** constructs a SvXMLUnitConverter. The core measure unit is the + default unit for numerical measures, the XML measure unit is + the default unit for textual measures */ + SvXMLUnitConverter( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext >& xContext, + sal_Int16 eCoreMeasureUnit, + sal_Int16 eXMLMeasureUnit); + + virtual ~SvXMLUnitConverter(); + + static sal_Int16 GetMeasureUnit(sal_Int16 const nFieldUnit); + + /** sets the default unit for numerical measures */ + void SetCoreMeasureUnit( sal_Int16 const eCoreMeasureUnit ); + + /** sets the default unit for textual measures */ + void SetXMLMeasureUnit( sal_Int16 const eXMLMeasureUnit ); + + /** gets the default unit for textual measures */ + sal_Int16 GetXMLMeasureUnit() const; + + /** gets XNumberingTypeInfo */ + const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XNumberingTypeInfo >& getNumTypeInfo() const; + + /** convert string to measure with meCoreMeasureUnit, + using optional min and max values*/ + bool convertMeasureToCore( sal_Int32& rValue, + const OUString& rString, + sal_Int32 nMin = SAL_MIN_INT32, + sal_Int32 nMax = SAL_MAX_INT32) const; + + /** convert measure to string: from meCoreMeasureUnit to meXMLMeasureUnit */ + void convertMeasureToXML( OUStringBuffer& rBuffer, + sal_Int32 nMeasure ) const; + + /** convert string to enum using given enum map, if the enum is + not found in the map, this method will return false */ + static sal_Bool convertEnum( sal_uInt16& rEnum, + const OUString& rValue, + const SvXMLEnumMapEntry *pMap ); + + /** convert string to enum using given token map, if the enum is + not found in the map, this method will return false */ + static sal_Bool convertEnum( sal_uInt16& rEnum, + const OUString& rValue, + const SvXMLEnumStringMapEntry *pMap ); + + /** convert enum to string using given enum map with an optional + default token. If the enum is not found in the map, + this method will either use the given default or return + false if not default is set */ + static sal_Bool convertEnum( OUStringBuffer& rBuffer, + unsigned int nValue, + const SvXMLEnumMapEntry *pMap, + enum ::xmloff::token::XMLTokenEnum eDefault = + ::xmloff::token::XML_TOKEN_INVALID ); + + /** convert double number to string (using ::rtl::math) and DO + convert to export MapUnit using meCoreMeasureUnit/meXMLMeasureUnit */ + void convertDouble(OUStringBuffer& rBuffer, + double fNumber, sal_Bool bWriteUnits) const; + + /** convert string to double number (using ::rtl::math) and DO convert. */ + sal_Bool convertDouble(double& rValue, const OUString& rString, sal_Bool bLookForUnits) const; + + /** get the Null Date of the XModel and set it to the UnitConverter */ + sal_Bool setNullDate ( + const com::sun::star::uno::Reference <com::sun::star::frame::XModel>& xModel); + + /** convert double to ISO Date Time String */ + void convertDateTime( OUStringBuffer& rBuffer, + const double& fDateTime, + bool const bAddTimeIf0AM = false); + + /** convert ISO Date Time String to double */ + bool convertDateTime(double& fDateTime, + const OUString& rString); + + /// these 2 functions use tools Date, so they're not yet moved to sax + + /** convert double to ISO Date Time String */ + static void convertDateTime( OUStringBuffer& rBuffer, + const double& fDateTime, + const com::sun::star::util::Date& aNullDate, + sal_Bool bAddTimeIf0AM=sal_False); + /** convert ISO Date Time String to double */ + static sal_Bool convertDateTime( double& fDateTime, + const OUString& rString, + const com::sun::star::util::Date& aNullDate); + + + /** convert string to ::basegfx::B3DVector */ + static sal_Bool convertB3DVector( ::basegfx::B3DVector& rVector, + const OUString& rValue ); + + /** convert B3DVector to string */ + static void convertB3DVector( OUStringBuffer &rBuffer, + const ::basegfx::B3DVector& rVector ); + + /** convert string to Position3D */ + sal_Bool convertPosition3D( com::sun::star::drawing::Position3D& rPosition, + const OUString& rValue ); + + /** convert Position3D to string */ + void convertPosition3D( OUStringBuffer &rBuffer, + const com::sun::star::drawing::Position3D& rVector ); + + + /** convert num-forat and num-letter-sync values to NumberingType */ + sal_Bool convertNumFormat( sal_Int16& rType, + const OUString& rNumFormat, + const OUString& rNumLetterSync, + sal_Bool bNumberNone = sal_False ) const; + + /** convert NumberingType to num-forat and num-letter-sync values */ + void convertNumFormat( OUStringBuffer& rBuffer, + sal_Int16 nType ) const; + void convertNumLetterSync( OUStringBuffer& rBuffer, + sal_Int16 nType ) const; + + static void convertPropertySet(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rProps, + const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& aProperties); + static void convertPropertySet(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& rProperties, + const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps); + + OUString encodeStyleName( const OUString& rName, + sal_Bool *pEncoded=0 ) const; + /** convert string (hex) to number (sal_uInt32) */ + static sal_Bool convertHex( sal_uInt32& nVal, + const OUString& rValue ); + + /** convert number (sal_uInt32) to string (hex) */ + static void convertHex( OUStringBuffer& rBuffer, + sal_uInt32 nVal ); + +}; + +#endif // _XMLOFF_XMLUCONV_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |