From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- include/xmloff/DashStyle.hxx | 62 + include/xmloff/DocumentSettingsContext.hxx | 58 + include/xmloff/EnumPropertyHdl.hxx | 49 + include/xmloff/GradientStyle.hxx | 64 + include/xmloff/HatchStyle.hxx | 61 + include/xmloff/ImageStyle.hxx | 45 + include/xmloff/MarkerStyle.hxx | 63 + include/xmloff/NamedBoolPropertyHdl.hxx | 54 + include/xmloff/ProgressBarHelper.hxx | 69 + include/xmloff/SchXMLExportHelper.hxx | 62 + include/xmloff/SchXMLImportHelper.hxx | 115 + include/xmloff/SchXMLSeriesHelper.hxx | 62 + include/xmloff/SettingsExportHelper.hxx | 101 + include/xmloff/SinglePropertySetInfoCache.hxx | 67 + include/xmloff/XMLBase64ImportContext.hxx | 49 + include/xmloff/XMLCharContext.hxx | 59 + include/xmloff/XMLConstantsPropertyHandler.hxx | 64 + include/xmloff/XMLDrawingPageStyleContext.hxx | 42 + include/xmloff/XMLEventExport.hxx | 128 + include/xmloff/XMLEventsImportContext.hxx | 102 + include/xmloff/XMLFilterServiceNames.h | 40 + include/xmloff/XMLFontAutoStylePool.hxx | 92 + include/xmloff/XMLFontStylesContext.hxx | 74 + include/xmloff/XMLGraphicsDefaultStyle.hxx | 44 + include/xmloff/XMLPageExport.hxx | 97 + include/xmloff/XMLSettingsExportContext.hxx | 60 + include/xmloff/XMLShapeStyleContext.hxx | 60 + include/xmloff/XMLTextListAutoStylePool.hxx | 76 + include/xmloff/XMLTextMasterPageContext.hxx | 81 + include/xmloff/XMLTextMasterPageExport.hxx | 50 + include/xmloff/XMLTextMasterStylesContext.hxx | 44 + include/xmloff/XMLTextShapeImportHelper.hxx | 44 + include/xmloff/XMLTextShapeStyleContext.hxx | 53 + include/xmloff/XMLTextTableContext.hxx | 36 + include/xmloff/animationexport.hxx | 55 + include/xmloff/animexp.hxx | 54 + include/xmloff/attrlist.hxx | 79 + include/xmloff/autolayout.hxx | 67 + include/xmloff/contextid.hxx | 43 + include/xmloff/controlpropertyhdl.hxx | 128 + include/xmloff/dllapi.h | 34 + include/xmloff/families.hxx | 115 + include/xmloff/formlayerexport.hxx | 185 + include/xmloff/formlayerimport.hxx | 133 + include/xmloff/i18nmap.hxx | 66 + include/xmloff/languagetagodf.hxx | 40 + include/xmloff/maptype.hxx | 152 + include/xmloff/namespacemap.hxx | 164 + include/xmloff/numehelp.hxx | 117 + include/xmloff/odffields.hxx | 61 + include/xmloff/prhdlfac.hxx | 106 + include/xmloff/prstylei.hxx | 118 + include/xmloff/settingsstore.hxx | 43 + include/xmloff/shapeexport.hxx | 311 ++ include/xmloff/shapeimport.hxx | 263 ++ include/xmloff/styleexp.hxx | 112 + include/xmloff/table/XMLTableExport.hxx | 105 + include/xmloff/table/XMLTableImport.hxx | 74 + include/xmloff/txtimp.hxx | 443 +++ include/xmloff/txtimppr.hxx | 69 + include/xmloff/txtparae.hxx | 582 ++++ include/xmloff/txtprmap.hxx | 233 ++ include/xmloff/txtstyli.hxx | 100 + include/xmloff/unoatrcn.hxx | 82 + .../unointerfacetouniqueidentifiermapper.hxx | 94 + include/xmloff/xformsexport.hxx | 53 + include/xmloff/xformsimport.hxx | 75 + include/xmloff/xmlaustp.hxx | 135 + include/xmloff/xmlcnimp.hxx | 78 + include/xmloff/xmlement.hxx | 86 + include/xmloff/xmlerror.hxx | 140 + include/xmloff/xmlevent.hxx | 141 + include/xmloff/xmlexp.hxx | 677 ++++ include/xmloff/xmlexppr.hxx | 182 + include/xmloff/xmlictxt.hxx | 125 + include/xmloff/xmlimp.hxx | 664 ++++ include/xmloff/xmlimppr.hxx | 212 ++ include/xmloff/xmlmetae.hxx | 102 + include/xmloff/xmlmetai.hxx | 63 + include/xmloff/xmlnamespace.hxx | 142 + include/xmloff/xmlnume.hxx | 76 + include/xmloff/xmlnumfe.hxx | 131 + include/xmloff/xmlnumfi.hxx | 217 ++ include/xmloff/xmlnumi.hxx | 82 + include/xmloff/xmlprcon.hxx | 68 + include/xmloff/xmlprhdl.hxx | 59 + include/xmloff/xmlprmap.hxx | 128 + include/xmloff/xmlscripti.hxx | 47 + include/xmloff/xmlstyle.hxx | 205 ++ include/xmloff/xmltkmap.hxx | 65 + include/xmloff/xmltoken.hxx | 3532 ++++++++++++++++++++ include/xmloff/xmltypes.hxx | 301 ++ include/xmloff/xmluconv.hxx | 330 ++ 93 files changed, 14571 insertions(+) create mode 100644 include/xmloff/DashStyle.hxx create mode 100644 include/xmloff/DocumentSettingsContext.hxx create mode 100644 include/xmloff/EnumPropertyHdl.hxx create mode 100644 include/xmloff/GradientStyle.hxx create mode 100644 include/xmloff/HatchStyle.hxx create mode 100644 include/xmloff/ImageStyle.hxx create mode 100644 include/xmloff/MarkerStyle.hxx create mode 100644 include/xmloff/NamedBoolPropertyHdl.hxx create mode 100644 include/xmloff/ProgressBarHelper.hxx create mode 100644 include/xmloff/SchXMLExportHelper.hxx create mode 100644 include/xmloff/SchXMLImportHelper.hxx create mode 100644 include/xmloff/SchXMLSeriesHelper.hxx create mode 100644 include/xmloff/SettingsExportHelper.hxx create mode 100644 include/xmloff/SinglePropertySetInfoCache.hxx create mode 100644 include/xmloff/XMLBase64ImportContext.hxx create mode 100644 include/xmloff/XMLCharContext.hxx create mode 100644 include/xmloff/XMLConstantsPropertyHandler.hxx create mode 100644 include/xmloff/XMLDrawingPageStyleContext.hxx create mode 100644 include/xmloff/XMLEventExport.hxx create mode 100644 include/xmloff/XMLEventsImportContext.hxx create mode 100644 include/xmloff/XMLFilterServiceNames.h create mode 100644 include/xmloff/XMLFontAutoStylePool.hxx create mode 100644 include/xmloff/XMLFontStylesContext.hxx create mode 100644 include/xmloff/XMLGraphicsDefaultStyle.hxx create mode 100644 include/xmloff/XMLPageExport.hxx create mode 100644 include/xmloff/XMLSettingsExportContext.hxx create mode 100644 include/xmloff/XMLShapeStyleContext.hxx create mode 100644 include/xmloff/XMLTextListAutoStylePool.hxx create mode 100644 include/xmloff/XMLTextMasterPageContext.hxx create mode 100644 include/xmloff/XMLTextMasterPageExport.hxx create mode 100644 include/xmloff/XMLTextMasterStylesContext.hxx create mode 100644 include/xmloff/XMLTextShapeImportHelper.hxx create mode 100644 include/xmloff/XMLTextShapeStyleContext.hxx create mode 100644 include/xmloff/XMLTextTableContext.hxx create mode 100644 include/xmloff/animationexport.hxx create mode 100644 include/xmloff/animexp.hxx create mode 100644 include/xmloff/attrlist.hxx create mode 100644 include/xmloff/autolayout.hxx create mode 100644 include/xmloff/contextid.hxx create mode 100644 include/xmloff/controlpropertyhdl.hxx create mode 100644 include/xmloff/dllapi.h create mode 100644 include/xmloff/families.hxx create mode 100644 include/xmloff/formlayerexport.hxx create mode 100644 include/xmloff/formlayerimport.hxx create mode 100644 include/xmloff/i18nmap.hxx create mode 100644 include/xmloff/languagetagodf.hxx create mode 100644 include/xmloff/maptype.hxx create mode 100644 include/xmloff/namespacemap.hxx create mode 100644 include/xmloff/numehelp.hxx create mode 100644 include/xmloff/odffields.hxx create mode 100644 include/xmloff/prhdlfac.hxx create mode 100644 include/xmloff/prstylei.hxx create mode 100644 include/xmloff/settingsstore.hxx create mode 100644 include/xmloff/shapeexport.hxx create mode 100644 include/xmloff/shapeimport.hxx create mode 100644 include/xmloff/styleexp.hxx create mode 100644 include/xmloff/table/XMLTableExport.hxx create mode 100644 include/xmloff/table/XMLTableImport.hxx create mode 100644 include/xmloff/txtimp.hxx create mode 100644 include/xmloff/txtimppr.hxx create mode 100644 include/xmloff/txtparae.hxx create mode 100644 include/xmloff/txtprmap.hxx create mode 100644 include/xmloff/txtstyli.hxx create mode 100644 include/xmloff/unoatrcn.hxx create mode 100644 include/xmloff/unointerfacetouniqueidentifiermapper.hxx create mode 100644 include/xmloff/xformsexport.hxx create mode 100644 include/xmloff/xformsimport.hxx create mode 100644 include/xmloff/xmlaustp.hxx create mode 100644 include/xmloff/xmlcnimp.hxx create mode 100644 include/xmloff/xmlement.hxx create mode 100644 include/xmloff/xmlerror.hxx create mode 100644 include/xmloff/xmlevent.hxx create mode 100644 include/xmloff/xmlexp.hxx create mode 100644 include/xmloff/xmlexppr.hxx create mode 100644 include/xmloff/xmlictxt.hxx create mode 100644 include/xmloff/xmlimp.hxx create mode 100644 include/xmloff/xmlimppr.hxx create mode 100644 include/xmloff/xmlmetae.hxx create mode 100644 include/xmloff/xmlmetai.hxx create mode 100644 include/xmloff/xmlnamespace.hxx create mode 100644 include/xmloff/xmlnume.hxx create mode 100644 include/xmloff/xmlnumfe.hxx create mode 100644 include/xmloff/xmlnumfi.hxx create mode 100644 include/xmloff/xmlnumi.hxx create mode 100644 include/xmloff/xmlprcon.hxx create mode 100644 include/xmloff/xmlprhdl.hxx create mode 100644 include/xmloff/xmlprmap.hxx create mode 100644 include/xmloff/xmlscripti.hxx create mode 100644 include/xmloff/xmlstyle.hxx create mode 100644 include/xmloff/xmltkmap.hxx create mode 100644 include/xmloff/xmltoken.hxx create mode 100644 include/xmloff/xmltypes.hxx create mode 100644 include/xmloff/xmluconv.hxx (limited to 'include/xmloff') diff --git a/include/xmloff/DashStyle.hxx b/include/xmloff/DashStyle.hxx new file mode 100644 index 000000000..c27234124 --- /dev/null +++ b/include/xmloff/DashStyle.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 INCLUDED_XMLOFF_DASHSTYLE_HXX +#define INCLUDED_XMLOFF_DASHSTYLE_HXX + +#include +#include + +class SvXMLImport; +class SvXMLExport; +namespace com::sun::star { + namespace uno { template class Reference; } + namespace xml::sax { class XFastAttributeList; } + namespace uno { class Any; } +} + + +class XMLOFF_DLLPUBLIC XMLDashStyleImport +{ + SvXMLImport& rImport; + +public: + XMLDashStyleImport( SvXMLImport& rImport ); + + void importXML( + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, + css::uno::Any& rValue, + OUString& rStrName ); +}; + + +class XMLOFF_DLLPUBLIC XMLDashStyleExport +{ + SvXMLExport& rExport; + +public: + XMLDashStyleExport( SvXMLExport& rExport ); + + void exportXML( const OUString& rStrName, + const css::uno::Any& rValue ); +}; + +#endif // INCLUDED_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 000000000..130da3814 --- /dev/null +++ b/include/xmloff/DocumentSettingsContext.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 INCLUDED_XMLOFF_DOCUMENTSETTINGSCONTEXT_HXX +#define INCLUDED_XMLOFF_DOCUMENTSETTINGSCONTEXT_HXX + +#include +#include +#include + +#include + +struct XMLDocumentSettingsContext_Data; + +class XMLOFF_DLLPUBLIC XMLDocumentSettingsContext final : public SvXMLImportContext +{ + struct SettingsGroup + { + OUString sGroupName; + css::uno::Any aSettings; + }; + css::uno::Any maViewProps; + css::uno::Any maConfigProps; + ::std::vector< SettingsGroup > maDocSpecificSettings; + +public: + XMLDocumentSettingsContext(SvXMLImport& rImport); + virtual ~XMLDocumentSettingsContext() override; + + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; + + virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; + +private: + XMLDocumentSettingsContext( const XMLDocumentSettingsContext& ) = delete; + XMLDocumentSettingsContext& operator=( const XMLDocumentSettingsContext& ) = delete; +}; + +#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 000000000..7256dd69f --- /dev/null +++ b/include/xmloff/EnumPropertyHdl.hxx @@ -0,0 +1,49 @@ +/* -*- 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_ENUMPROPERTYHDL_HXX +#define INCLUDED_XMLOFF_ENUMPROPERTYHDL_HXX + +#include +#include + +template struct SvXMLEnumMapEntry; + +/** + PropertyHandler for a generic xml enumeration type: +*/ +class XMLOFF_DLLPUBLIC XMLEnumPropertyHdl : public XMLPropertyHandler +{ +private: + const SvXMLEnumMapEntry* mpEnumMap; + const css::uno::Type & mrType; + +public: + template + XMLEnumPropertyHdl( const SvXMLEnumMapEntry* pEnumMap) + : mpEnumMap( reinterpret_cast*>(pEnumMap) ), mrType( ::cppu::UnoType::get() ) {} + virtual ~XMLEnumPropertyHdl() override; + + virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override; + virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override; +}; + +#endif // INCLUDED_XMLOFF_ENUMPROPERTYHDL_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 000000000..db946279a --- /dev/null +++ b/include/xmloff/GradientStyle.hxx @@ -0,0 +1,64 @@ +/* -*- 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_GRADIENTSTYLE_HXX +#define INCLUDED_XMLOFF_GRADIENTSTYLE_HXX + +#include +#include +#include + +class SvXMLImport; +class SvXMLExport; +namespace com::sun::star { + namespace uno { template class Reference; } + namespace xml::sax { class XFastAttributeList; } + namespace uno { class Any; } +} + + +class XMLOFF_DLLPUBLIC XMLGradientStyleImport +{ + SvXMLImport& rImport; + +public: + XMLGradientStyleImport( SvXMLImport& rImport ); + + void importXML( + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, + css::uno::Any& rValue, + OUString& rStrName ); +}; + + +class XMLOFF_DLLPUBLIC XMLGradientStyleExport +{ + SvXMLExport& rExport; + +public: + XMLGradientStyleExport( SvXMLExport& rExport ); + + void exportXML( + const OUString& rStrName, + const css::uno::Any& rValue ); +}; + +#endif // INCLUDED_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 000000000..9ded654e5 --- /dev/null +++ b/include/xmloff/HatchStyle.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 INCLUDED_XMLOFF_HATCHSTYLE_HXX +#define INCLUDED_XMLOFF_HATCHSTYLE_HXX + +#include +#include +#include + +class SvXMLImport; +class SvXMLExport; +namespace com::sun::star { + namespace uno { template class Reference; } + namespace xml::sax { class XFastAttributeList; } + namespace uno { class Any; } +} + + +class XMLOFF_DLLPUBLIC XMLHatchStyleImport +{ + SvXMLImport& rImport; + +public: + XMLHatchStyleImport( SvXMLImport& rImport ); + + void importXML( + const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList, + css::uno::Any& rValue, + OUString& rStrName ); +}; + +class XMLOFF_DLLPUBLIC XMLHatchStyleExport +{ + SvXMLExport& rExport; + +public: + XMLHatchStyleExport( SvXMLExport& rExport ); + + void exportXML( const OUString& rStrName, const css::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 000000000..15b1a845a --- /dev/null +++ b/include/xmloff/ImageStyle.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 INCLUDED_XMLOFF_IMAGESTYLE_HXX +#define INCLUDED_XMLOFF_IMAGESTYLE_HXX + +#include +#include +#include + +namespace com::sun::star::uno { class Any; } +namespace com::sun::star::uno { template class Reference; } +namespace com::sun::star::xml::sax { class XFastAttributeList; } + +class SvXMLExport; +class SvXMLImport; + +namespace XMLImageStyle +{ + +XMLOFF_DLLPUBLIC void exportXML(OUString const & rStrName, css::uno::Any const & rValue, SvXMLExport& rExport); +XMLOFF_DLLPUBLIC bool importXML(css::uno::Reference const & xAttrList, + css::uno::Any& rValue, OUString& rStrName, SvXMLImport& rImport); + +} + +#endif // INCLUDED_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 000000000..ce1ae3080 --- /dev/null +++ b/include/xmloff/MarkerStyle.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 INCLUDED_XMLOFF_MARKERSTYLE_HXX +#define INCLUDED_XMLOFF_MARKERSTYLE_HXX + +#include +#include +#include + +class SvXMLImport; +class SvXMLExport; +namespace com::sun::star { + namespace uno { template class Reference; } + namespace xml::sax { class XFastAttributeList; } + namespace uno { class Any; } +} + + +class XMLOFF_DLLPUBLIC XMLMarkerStyleImport +{ + SvXMLImport& rImport; + +public: + XMLMarkerStyleImport( SvXMLImport& rImport ); + + void importXML( + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, + css::uno::Any& rValue, + OUString& rStrName ); +}; + +class XMLOFF_DLLPUBLIC XMLMarkerStyleExport +{ + SvXMLExport& rExport; + +public: + XMLMarkerStyleExport( SvXMLExport& rExport ); + + void exportXML( + const OUString& rStrName, + const css::uno::Any& rValue ); +}; + +#endif // INCLUDED_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 000000000..b5fba6722 --- /dev/null +++ b/include/xmloff/NamedBoolPropertyHdl.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 INCLUDED_XMLOFF_NAMEDBOOLPROPERTYHDL_HXX +#define INCLUDED_XMLOFF_NAMEDBOOLPROPERTYHDL_HXX + +#include +#include + +/** + PropertyHandler for a named xml bool type: +*/ +class XMLOFF_DLLPUBLIC XMLNamedBoolPropertyHdl final : 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() override; + + virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override; + virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override; +}; + +#endif // INCLUDED_XMLOFF_NAMEDBOOLPROPERTYHDL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/ProgressBarHelper.hxx b/include/xmloff/ProgressBarHelper.hxx new file mode 100644 index 000000000..7fe92ab9b --- /dev/null +++ b/include/xmloff/ProgressBarHelper.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 INCLUDED_XMLOFF_PROGRESSBARHELPER_HXX +#define INCLUDED_XMLOFF_PROGRESSBARHELPER_HXX + +#include +#include +#include + +inline constexpr OUStringLiteral XML_PROGRESSRANGE = u"ProgressRange"; +inline constexpr OUStringLiteral XML_PROGRESSMAX = u"ProgressMax"; +inline constexpr OUStringLiteral XML_PROGRESSCURRENT = u"ProgressCurrent"; +inline constexpr OUStringLiteral XML_PROGRESSREPEAT = u"ProgressRepeat"; + +class XMLOFF_DLLPUBLIC ProgressBarHelper +{ + css::uno::Reference < css::task::XStatusIndicator > xStatusIndicator; + sal_Int32 nRange; + sal_Int32 nReference; + sal_Int32 nValue; + double fOldPercent; + bool bStrict; + // #96469#; if the value goes over the Range the progressbar starts again + bool bRepeat; + +#ifdef DBG_UTIL + bool bFailure; +#endif +public: + ProgressBarHelper(const css::uno::Reference < css::task::XStatusIndicator>& xStatusIndicator, + const bool bStrict); + ~ProgressBarHelper(); + + void SetRange(sal_Int32 nVal) { nRange = nVal; } + void SetReference(sal_Int32 nVal) { nReference = nVal; } + void SetValue(sal_Int32 nValue); + void SetRepeat(bool bValue) { bRepeat = bValue; } + 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 same position as before + void ChangeReference(sal_Int32 nNewReference); + + sal_Int32 GetReference() const { return nReference; } + sal_Int32 GetValue() const { return nValue; } + bool GetRepeat() const { return bRepeat; } +}; + +#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 000000000..6043a03ea --- /dev/null +++ b/include/xmloff/SchXMLExportHelper.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 INCLUDED_XMLOFF_SCHXMLEXPORTHELPER_HXX +#define INCLUDED_XMLOFF_SCHXMLEXPORTHELPER_HXX + +#include +#include +#include +#include + +#include + +class SvXMLAutoStylePoolP; +class SvXMLExport; +class SchXMLExportHelper_Impl; + +/** With this class you can export a element containing + its data as 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 final : public salhelper::SimpleReferenceObject +{ +public: + SchXMLExportHelper(SvXMLExport& rExport, SvXMLAutoStylePoolP& rASPool); + + virtual ~SchXMLExportHelper() override; + + /// returns the string corresponding to the current FileFormat CLSID for Chart + const OUString& getChartCLSID() const; + + void SetSourceShellID(const OUString& rShellID); + void SetDestinationShellID(const OUString& rShellID); + +private: + SchXMLExportHelper(SchXMLExportHelper const&) = delete; + SchXMLExportHelper& operator=(SchXMLExportHelper const&) = delete; + +private: + std::unique_ptr m_pImpl; + friend class SchXMLExport; +}; + +#endif // INCLUDED_XMLOFF_SCHXMLEXPORTHELPER_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 000000000..446b07387 --- /dev/null +++ b/include/xmloff/SchXMLImportHelper.hxx @@ -0,0 +1,115 @@ +/* -*- 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_SCHXMLIMPORTHELPER_HXX +#define INCLUDED_XMLOFF_SCHXMLIMPORTHELPER_HXX + +#include +#include +#include +#include + +namespace com::sun::star::chart { class XChartDocument; } +namespace com::sun::star::beans { class XPropertySet; } + +namespace com::sun::star { + namespace frame { + class XModel; + } + namespace xml { + namespace sax { + class XAttributeList; + } + } + namespace chart2 { + class XChartDocument; + class XDataSeries; + } +} + +class SvXMLStylesContext; +class SvXMLImportContext; +class SvXMLImport; + + +/** With this class you can import a element containing + its data as 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 final : public salhelper::SimpleReferenceObject +{ +private: + css::uno::Reference< css::chart::XChartDocument > mxChartDoc; + SvXMLStylesContext* mpAutoStyles; + +public: + + SchXMLImportHelper(); + + /** get the context for reading the element with subelements. + The result is stored in the XModel given if it also implements + XChartDocument + */ + SvXMLImportContext* CreateChartContext( + SvXMLImport& rImport, + const css::uno::Reference< css::frame::XModel >& rChartModel ); + + /** set the auto-style context that will be used to retrieve auto-styles + used inside the following element to parse + */ + void SetAutoStylesContext( SvXMLStylesContext* pAutoStyles ) { mpAutoStyles = pAutoStyles; } + SvXMLStylesContext* GetAutoStylesContext() const { return mpAutoStyles; } + + /// Fill in the autostyle. + void FillAutoStyle(const OUString& rAutoStyleName, const css::uno::Reference& rProp); + + const css::uno::Reference< css::chart::XChartDocument >& GetChartDocument() const + { return mxChartDoc; } + + static XmlStyleFamily GetChartFamilyID() { return XmlStyleFamily::SCH_CHART_ID; } + + /** @param bPushLastChartType If , 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 , 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 css::uno::Reference< css::chart2::XDataSeries > GetNewDataSeries( + const css::uno::Reference< css::chart2::XChartDocument > & xDoc, + sal_Int32 nCoordinateSystemIndex, + const OUString & rChartTypeName, + bool bPushLastChartType ); + + static void DeleteDataSeries( + const css::uno::Reference< css::chart2::XDataSeries >& xSeries, + const css::uno::Reference< css::chart2::XChartDocument > & xDoc ); +}; + +XMLOFF_DLLPUBLIC void setDataProvider(css::uno::Reference const & xChartDoc, OUString const & sDataPilotSource); + +#endif // INCLUDED_XMLOFF_SCHXMLIMPORTHELPER_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 000000000..78c729306 --- /dev/null +++ b/include/xmloff/SchXMLSeriesHelper.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 INCLUDED_XMLOFF_SCHXMLSERIESHELPER_HXX +#define INCLUDED_XMLOFF_SCHXMLSERIESHELPER_HXX + +#include + +#include + +#include +#include + +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::chart2 { class XDataSeries; } +namespace com::sun::star::chart2 { class XDiagram; } +namespace com::sun::star::frame { class XModel; } + +class XMLOFF_DLLPUBLIC SchXMLSeriesHelper +{ +public: + static ::std::vector< css::uno::Reference< css::chart2::XDataSeries > > + getDataSeriesFromDiagram( + const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + static ::std::map< css::uno::Reference< css::chart2::XDataSeries >, sal_Int32 > + getDataSeriesIndexMapFromDiagram( + const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + + static bool isCandleStickSeries( + const css::uno::Reference< css::chart2::XDataSeries >& xSeries + , const css::uno::Reference< css::frame::XModel >& xChartModel ); + + static css::uno::Reference< css::beans::XPropertySet > createOldAPISeriesPropertySet( + const css::uno::Reference< css::chart2::XDataSeries >& xSeries + , const css::uno::Reference< css::frame::XModel >& xChartModel ); + + static css::uno::Reference< css::beans::XPropertySet > createOldAPIDataPointPropertySet( + const css::uno::Reference< css::chart2::XDataSeries >& xSeries + , sal_Int32 nPointIndex + , const css::uno::Reference< css::frame::XModel >& xChartModel ); +}; + +// INCLUDED_XMLOFF_SCHXMLSERIESHELPER_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 000000000..0ee9f3ea4 --- /dev/null +++ b/include/xmloff/SettingsExportHelper.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 INCLUDED_XMLOFF_SETTINGSEXPORTHELPER_HXX +#define INCLUDED_XMLOFF_SETTINGSEXPORTHELPER_HXX + +#include + +#include + +#include + +#include + +namespace com::sun::star::beans { struct PropertyValue; } +namespace com::sun::star::formula { struct SymbolDescriptor; } +namespace com::sun::star::util { class XStringSubstitution; } + +namespace com +{ + namespace sun::star { + namespace container { class XNameAccess; class XIndexAccess; } + namespace util { struct DateTime; } + } +} + +namespace xmloff +{ + class XMLSettingsExportContext; +} + +class XMLOFF_DLLPUBLIC XMLSettingsExportHelper +{ + ::xmloff::XMLSettingsExportContext& m_rContext; + + css::uno::Reference< css::util::XStringSubstitution > mxStringSubstitution; + + void ManipulateSetting( css::uno::Any& rAny, std::u16string_view rName ) const; + + void CallTypeFunction(const css::uno::Any& rAny, + const OUString& rName) const; + + void exportBool(const bool bValue, const OUString& rName) const; + static void exportByte(); + 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 css::util::DateTime& aValue, const OUString& rName) const; + void exportSequencePropertyValue( + const css::uno::Sequence& aProps, + const OUString& rName) const; + void exportbase64Binary( + const css::uno::Sequence& aProps, + const OUString& rName) const; + void exportMapEntry(const css::uno::Any& rAny, + const OUString& rName, + const bool bNameAccess) const; + void exportNameAccess( + const css::uno::Reference& rNamed, + const OUString& rName) const; + void exportIndexAccess( + const css::uno::Reference& rIndexed, + const OUString& rName) const; + + void exportSymbolDescriptors( + const css::uno::Sequence < css::formula::SymbolDescriptor > &rProps, + const OUString& rName) const; + void exportForbiddenCharacters( + const css::uno::Any &rAny, + const OUString& rName) const; + +public: + XMLSettingsExportHelper( ::xmloff::XMLSettingsExportContext& i_rContext ); + ~XMLSettingsExportHelper(); + + void exportAllSettings( + const css::uno::Sequence& 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 000000000..0377c46bb --- /dev/null +++ b/include/xmloff/SinglePropertySetInfoCache.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 INCLUDED_XMLOFF_SINGLEPROPERTYSETINFOCACHE_HXX +#define INCLUDED_XMLOFF_SINGLEPROPERTYSETINFOCACHE_HXX + +#include + +#include + +#include + +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::beans { class XPropertySetInfo; } + +class SinglePropertySetInfoCache +{ + typedef std::map, bool> + Map; + + OUString sName; + Map map_; + +public: + + inline SinglePropertySetInfoCache( const OUString& rName ); + + bool hasProperty( + const css::uno::Reference< css::beans::XPropertySet >& rPropSet, + css::uno::Reference< css::beans::XPropertySetInfo >& rPropSetInfo ); + + inline bool hasProperty( + const css::uno::Reference< css::beans::XPropertySet>& rPropSet ); +}; + +inline SinglePropertySetInfoCache::SinglePropertySetInfoCache( + const OUString& rName ) : + sName( rName ) +{ +} + +inline bool SinglePropertySetInfoCache::hasProperty( + const css::uno::Reference< css::beans::XPropertySet>& rPropSet ) +{ + css::uno::Reference< css::beans::XPropertySetInfo > xInfo; + return hasProperty( rPropSet, xInfo ); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLBase64ImportContext.hxx b/include/xmloff/XMLBase64ImportContext.hxx new file mode 100644 index 000000000..e2b62abea --- /dev/null +++ b/include/xmloff/XMLBase64ImportContext.hxx @@ -0,0 +1,49 @@ +/* -*- 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_XMLBASE64IMPORTCONTEXT_HXX +#define INCLUDED_XMLOFF_XMLBASE64IMPORTCONTEXT_HXX + +#include +#include +#include +#include + +namespace com::sun::star::xml::sax { class XAttributeList; } +namespace com::sun::star::io { class XOutputStream; } + +class XMLOFF_DLLPUBLIC XMLBase64ImportContext final : public SvXMLImportContext +{ + css::uno::Reference< css::io::XOutputStream > xOut; + OUStringBuffer maCharBuffer; + +public: + + XMLBase64ImportContext( SvXMLImport& rImport, + const css::uno::Reference< css::io::XOutputStream >& rOut ); + + virtual ~XMLBase64ImportContext() override; + + virtual void SAL_CALL endFastElement(sal_Int32) override; + virtual void SAL_CALL characters( const OUString& rChars ) override; +}; + +#endif // INCLUDED_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 000000000..dd63a83fc --- /dev/null +++ b/include/xmloff/XMLCharContext.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 INCLUDED_XMLOFF_XMLCHARCONTEXT_HXX +#define INCLUDED_XMLOFF_XMLCHARCONTEXT_HXX + +#include +#include + +namespace com::sun::star::uno { template class Reference; } + +class XMLOFF_DLLPUBLIC XMLCharContext : public SvXMLImportContext +{ + XMLCharContext(const XMLCharContext&) = delete; + void operator =(const XMLCharContext&) = delete; + sal_Int16 m_nControl; +protected: + sal_uInt16 m_nCount; + sal_Unicode m_c; +public: + + XMLCharContext( + SvXMLImport& rImport, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList, + sal_Unicode c, + bool bCount ); + XMLCharContext( + SvXMLImport& rImport, + sal_Int16 nControl ); + + virtual ~XMLCharContext() override; + + // EndElement is called before a context will be destructed, but + // after an elements context has been parsed. It may be used for actions + // that require virtual methods. The default is to do nothing. + virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; + + virtual void InsertControlCharacter(sal_Int16 _nControl); + virtual void InsertString(const OUString& _sString); +}; + +#endif // INCLUDED_XMLOFF_XMLCHARCONTEXT_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 000000000..5db0aa63f --- /dev/null +++ b/include/xmloff/XMLConstantsPropertyHandler.hxx @@ -0,0 +1,64 @@ +/* -*- 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_XMLCONSTANTSPROPERTYHANDLER_HXX +#define INCLUDED_XMLOFF_XMLCONSTANTSPROPERTYHANDLER_HXX + +#include +#include +#include +#include + +template +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: + template + XMLConstantsPropertyHandler( const SvXMLEnumMapEntry *pM, + enum ::xmloff::token::XMLTokenEnum eDflt) + : pMap(reinterpret_cast*>(pM)), eDefault(eDflt) {} + + // Just needed for virtual destruction + virtual ~XMLConstantsPropertyHandler() override; + + /// Imports the given value in case of the given XML-data-type + virtual bool importXML( + const OUString& rStrImpValue, + css::uno::Any& rValue, + const SvXMLUnitConverter& rUnitConverter ) const override; + + /// Exports the given value in case of the given XML-data-type + virtual bool exportXML( + OUString& rStrExpValue, + const css::uno::Any& rValue, + const SvXMLUnitConverter& rUnitConverter ) const override; +}; + +#endif // INCLUDED_XMLOFF_XMLCONSTANTSPROPERTYHANDLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLDrawingPageStyleContext.hxx b/include/xmloff/XMLDrawingPageStyleContext.hxx new file mode 100644 index 000000000..9ef8d060b --- /dev/null +++ b/include/xmloff/XMLDrawingPageStyleContext.hxx @@ -0,0 +1,42 @@ +/* -*- 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 . + */ + +#pragma once + +#include +#include +#include +#include + +class XMLOFF_DLLPUBLIC XMLDrawingPageStyleContext : public XMLPropStyleContext +{ +public: + XMLDrawingPageStyleContext(SvXMLImport& rImport, SvXMLStylesContext& rStyles, + ContextID_Index_Pair const pContextIDs[], + XmlStyleFamily const pFamilies[]); + + virtual void + FillPropertySet(css::uno::Reference const& rPropSet) override; + +private: + std::unique_ptr m_pContextIDs; + XmlStyleFamily const* const m_pFamilies; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLEventExport.hxx b/include/xmloff/XMLEventExport.hxx new file mode 100644 index 000000000..ad83390b6 --- /dev/null +++ b/include/xmloff/XMLEventExport.hxx @@ -0,0 +1,128 @@ +/* -*- 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_XMLEVENTEXPORT_HXX +#define INCLUDED_XMLOFF_XMLEVENTEXPORT_HXX + +#include +#include +#include +#include +#include + +#include +#include + +class SvXMLExport; +namespace com::sun::star { + namespace document { class XEventsSupplier; } + namespace container { class XNameReplace; } + namespace container { class XNameAccess; } + namespace beans { struct PropertyValue; } +} + +namespace com::sun::star::uno { template class Reference; } +namespace com::sun::star::uno { template class Sequence; } + +typedef ::std::map< OUString, std::unique_ptr > 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 +{ + SvXMLExport& rExport; + + HandlerMap aHandlerMap; + NameMap aNameTranslationMap; + + bool bExtNamespace; + +public: + XMLEventExport(SvXMLExport& rExport); + ~XMLEventExport(); + + XMLEventExport& operator=( XMLEventExport const & ) = delete; // MSVC2017 workaround + XMLEventExport( XMLEventExport const & ) = delete; // MSVC2017 workaround + + /// 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, + std::unique_ptr pHandler ); + + /// register additional event names + void AddTranslationTable( const XMLEventNameTranslation* pTransTable ); + + /// export the events (calls EventExport::Export(Reference) ) + void Export( css::uno::Reference const & xAccess, + bool bUseWhitespace = true); + + /// export the events (calls EventExport::Export(Reference) ) + void Export( css::uno::Reference const & xAccess, + bool bUseWhitespace = true); + + /// export the events (writes element) + void Export( css::uno::Reference const & xAccess, + bool bUseWhitespace = true); + + /// export the events, but write element + /// (for new file format additions) + void ExportExt( css::uno::Reference const & xAccess); + + /// export a single event (writes element) + void ExportSingleEvent( + const css::uno::Sequence& rEventValues, + const OUString& rApiEventName, + bool bUseWhitespace = true ); + +private: + + /// export one event (start container-element if necessary) + SAL_DLLPRIVATE void ExportEvent( + const css::uno::Sequence& rEventValues, + const XMLEventName& rXmlEventName, + bool bUseWhitespace, + bool& rExported); + + /// export the start element + SAL_DLLPRIVATE void StartElement(bool bUseWhitespace); + + /// export the end element + SAL_DLLPRIVATE void EndElement(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 000000000..dc03d91a6 --- /dev/null +++ b/include/xmloff/XMLEventsImportContext.hxx @@ -0,0 +1,102 @@ +/* -*- 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_XMLEVENTSIMPORTCONTEXT_HXX +#define INCLUDED_XMLOFF_XMLEVENTSIMPORTCONTEXT_HXX + +#include +#include +#include +#include + +#include + +namespace com::sun::star { + namespace xml::sax { class XAttributeList; } + namespace beans { struct PropertyValue; } + namespace container { class XNameReplace; } + namespace document { class XEventsSupplier; } +} + +namespace com::sun::star::uno { template class Sequence; } + +typedef ::std::pair< + OUString, + css::uno::Sequence > EventNameValuesPair; + +/** + * Import 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 +{ + // the event XNameReplace; may be empty + css::uno::Reference xEvents; + +protected: + // if no XNameReplace is given, use this vector to collect events + std::vector< EventNameValuesPair > aCollectEvents; + +public: + + XMLEventsImportContext(SvXMLImport& rImport); + + XMLEventsImportContext( + SvXMLImport& rImport, + const css::uno::Reference & xEventsSupplier); + + XMLEventsImportContext( + SvXMLImport& rImport, + const css::uno::Reference & xNameRepl); + + virtual ~XMLEventsImportContext() override; + + void AddEventValues( + const OUString& rEventName, + const css::uno::Sequence & 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 css::uno::Reference & 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 css::uno::Reference & xNameRepl); + + /// if the import operates in delayed mode, you can use this method + /// to obtain the value sequence for a specific event + void GetEventSequence( + const OUString& rName, + css::uno::Sequence & rSequence ); + +protected: + + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; +}; + +#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 000000000..31549345b --- /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 . + */ + +#pragma once + +#include + +#include + +inline constexpr OUStringLiteral XML_IMPORT_FILTER_WRITER = u"com.sun.star.comp.Writer.XMLOasisImporter"; +inline constexpr OUStringLiteral XML_IMPORT_FILTER_CALC = u"com.sun.star.comp.Calc.XMLOasisImporter"; +inline constexpr OUStringLiteral XML_IMPORT_FILTER_DRAW = u"com.sun.star.comp.Draw.XMLOasisImporter"; +inline constexpr OUStringLiteral XML_IMPORT_FILTER_IMPRESS = u"com.sun.star.comp.Impress.XMLOasisImporter"; +inline constexpr OUStringLiteral XML_IMPORT_FILTER_MATH = u"com.sun.star.comp.Math.XMLImporter"; +inline constexpr OUStringLiteral XML_IMPORT_FILTER_CHART = u"com.sun.star.comp.Chart.XMLOasisImporter"; + +inline constexpr OUStringLiteral XML_EXPORT_FILTER_WRITER = u"com.sun.star.comp.Writer.XMLOasisExporter"; +inline constexpr OUStringLiteral XML_EXPORT_FILTER_CALC = u"com.sun.star.comp.Calc.XMLOasisExporter"; +inline constexpr OUStringLiteral XML_EXPORT_FILTER_DRAW = u"com.sun.star.comp.Draw.XMLOasisExporter"; +inline constexpr OUStringLiteral XML_EXPORT_FILTER_IMPRESS = u"com.sun.star.comp.Impress.XMLOasisExporter"; +inline constexpr OUStringLiteral XML_EXPORT_FILTER_MATH = u"com.sun.star.comp.Math.XMLExporter"; +inline constexpr OUStringLiteral XML_EXPORT_FILTER_CHART = u"com.sun.star.comp.Chart.XMLOasisExporter"; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/XMLFontAutoStylePool.hxx b/include/xmloff/XMLFontAutoStylePool.hxx new file mode 100644 index 000000000..2354bcf8c --- /dev/null +++ b/include/xmloff/XMLFontAutoStylePool.hxx @@ -0,0 +1,92 @@ +/* -*- 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_XMLFONTAUTOSTYLEPOOL_HXX +#define INCLUDED_XMLOFF_XMLFONTAUTOSTYLEPOOL_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class XMLFontAutoStylePool_Impl; +class SvXMLExport; + +class XMLOFF_DLLPUBLIC XMLFontAutoStylePool : public salhelper::SimpleReferenceObject +{ +private: + SvXMLExport& rExport; + + std::unique_ptr m_pFontAutoStylePool; + std::set m_aNames; + bool m_bTryToEmbedFonts; + std::unordered_map m_aEmbeddedFontFiles; + + OUString embedFontFile(OUString const & rFileUrl, OUString const & rFamilyName); + + std::unordered_set getUsedFontList(); + +protected: + bool m_bEmbedUsedOnly; + bool m_bEmbedLatinScript; + bool m_bEmbedAsianScript; + bool m_bEmbedComplexScript; + + SvXMLExport& GetExport() { return rExport; } + +public: + XMLFontAutoStylePool( SvXMLExport& rExport, bool tryToEmbedFonts = false ); + virtual ~XMLFontAutoStylePool() override; + + 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; + + void exportXML(); + + void setEmbedOnlyUsedFonts(bool bEmbedUsedOnly) + { + m_bEmbedUsedOnly = bEmbedUsedOnly; + } + void setEmbedFontScripts(bool bEmbedLatinScript, bool bEmbedAsianScript, bool bEmbedComplexScript) + { + m_bEmbedLatinScript = bEmbedLatinScript; + m_bEmbedAsianScript = bEmbedAsianScript; + m_bEmbedComplexScript = bEmbedComplexScript; + } +}; + +#endif // INCLUDED_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 000000000..6768ca43b --- /dev/null +++ b/include/xmloff/XMLFontStylesContext.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 INCLUDED_XMLOFF_XMLFONTSTYLESCONTEXT_HXX +#define INCLUDED_XMLOFF_XMLFONTSTYLESCONTEXT_HXX + +#include +#include + +#include +#include + +#include + +struct XMLPropertyState; +class XMLFontFamilyNamePropHdl; +class XMLFontFamilyPropHdl; +class XMLFontPitchPropHdl; +class XMLFontEncodingPropHdl; + +class XMLOFF_DLLPUBLIC XMLFontStylesContext final : public SvXMLStylesContext +{ + std::unique_ptr pFamilyNameHdl; + std::unique_ptr pFamilyHdl; + std::unique_ptr pPitchHdl; + std::unique_ptr pEncHdl; + + rtl_TextEncoding eDfltEncoding; + + using SvXMLStylesContext::CreateStyleChildContext; + virtual SvXMLStyleContext *CreateStyleChildContext( sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ) override; + +public: + + XMLFontStylesContext( SvXMLImport& rImport, rtl_TextEncoding eDfltEnc ); + + ~XMLFontStylesContext() override; + + 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 000000000..58f2f0f1a --- /dev/null +++ b/include/xmloff/XMLGraphicsDefaultStyle.hxx @@ -0,0 +1,44 @@ +/* -*- 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_XMLGRAPHICSDEFAULTSTYLE_HXX +#define INCLUDED_XMLOFF_XMLGRAPHICSDEFAULTSTYLE_HXX + +#include +#include +#include + +class XMLOFF_DLLPUBLIC XMLGraphicsDefaultStyle final : public XMLPropStyleContext +{ +public: + XMLGraphicsDefaultStyle(SvXMLImport& rImport, SvXMLStylesContext& rStyles); + + virtual ~XMLGraphicsDefaultStyle() override; + + virtual css::uno::Reference SAL_CALL createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference& AttrList) override; + + // This method is called for every default style + virtual void SetDefaults() override; +}; + +#endif // INCLUDED_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 000000000..4553c9b61 --- /dev/null +++ b/include/xmloff/XMLPageExport.hxx @@ -0,0 +1,97 @@ +/* -*- 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_XMLPAGEEXPORT_HXX +#define INCLUDED_XMLOFF_XMLPAGEEXPORT_HXX + +#include +#include +#include +#include +#include +#include +#include + +namespace com::sun::star { + namespace style { class XStyle; } + namespace container { class XNameAccess;} + namespace beans { class XPropertySet; } +} + +class SvXMLExport; +class XMLPropertyHandlerFactory; +class XMLPropertySetMapper; +class SvXMLExportPropertyMapper; + + +struct XMLPageExportNameEntry +{ + OUString sPageMasterName; + OUString sDrawingPageStyleName; + OUString sStyleName; +}; + + +class XMLOFF_DLLPUBLIC XMLPageExport : public salhelper::SimpleReferenceObject +{ + SvXMLExport& rExport; + + css::uno::Reference< css::container::XNameAccess > xPageStyles; + + ::std::vector< XMLPageExportNameEntry > aNameVector; + + rtl::Reference < XMLPropertyHandlerFactory > xPageMasterPropHdlFactory; + rtl::Reference < XMLPropertySetMapper > xPageMasterPropSetMapper; + rtl::Reference < SvXMLExportPropertyMapper > xPageMasterExportPropMapper; + rtl::Reference m_xPageMasterDrawingPagePropSetMapper; + rtl::Reference m_xPageMasterDrawingPageExportPropMapper; + +protected: + + SvXMLExport& GetExport() { return rExport; } + + void collectPageMasterAutoStyle( + const css::uno::Reference< css::beans::XPropertySet > & rPropSet, + XMLPageExportNameEntry & rEntry); + + virtual void exportMasterPageContent( + const css::uno::Reference< css::beans::XPropertySet > & rPropSet, + bool bAutoStyles ); + + bool exportStyle( + const css::uno::Reference< css::style::XStyle >& rStyle, + bool bAutoStyles ); + + void exportStyles( bool bUsed, bool bAutoStyles ); + +public: + XMLPageExport( SvXMLExport& rExp ); + virtual ~XMLPageExport() override; + + void collectAutoStyles( bool bUsed ) { exportStyles( bUsed, true ); } + void exportAutoStyles(); + void exportMasterStyles( bool bUsed ) { exportStyles( bUsed, false ); } + + //text grid enhancement for better CJK support + void exportDefaultStyle(); +}; + +#endif // INCLUDED_XMLOFF_XMLPAGEEXPORT_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 000000000..1daf35ada --- /dev/null +++ b/include/xmloff/XMLSettingsExportContext.hxx @@ -0,0 +1,60 @@ +/* -*- 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_XMLSETTINGSEXPORTCONTEXT_HXX +#define INCLUDED_XMLOFF_XMLSETTINGSEXPORTCONTEXT_HXX + +#include + +namespace com::sun::star::uno { class XComponentContext; } + + +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 ) = 0; + virtual void EndElement( const bool i_bIgnoreWhitespace ) = 0; + + virtual void Characters( const OUString& i_rCharacters ) = 0; + + virtual css::uno::Reference< css::uno::XComponentContext > + GetComponentContext() const = 0; + + protected: + ~XMLSettingsExportContext() {} + }; + + +} // namespace xmloff + + +#endif // INCLUDED_XMLOFF_XMLSETTINGSEXPORTCONTEXT_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 000000000..59b7c91e6 --- /dev/null +++ b/include/xmloff/XMLShapeStyleContext.hxx @@ -0,0 +1,60 @@ +/* -*- 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_XMLSHAPESTYLECONTEXT_HXX +#define INCLUDED_XMLOFF_XMLSHAPESTYLECONTEXT_HXX + +#include +#include +#include + +class SvXMLImport; + + +// style:style context + +class XMLOFF_DLLPUBLIC XMLShapeStyleContext: public XMLPropStyleContext +{ + OUString m_sControlDataStyleName; + bool m_bIsNumRuleAlreadyConverted; + +protected: + OUString m_sListStyleName; + + virtual void SetAttribute( sal_Int32 nElement, const OUString& rValue ) override; +public: + + XMLShapeStyleContext( + SvXMLImport& rImport, + SvXMLStylesContext& rStyles, + XmlStyleFamily nFamily); + virtual ~XMLShapeStyleContext() override; + + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; + + virtual void Finish( bool bOverwrite ) override; + + virtual void FillPropertySet( + const css::uno::Reference< css::beans::XPropertySet > & rPropSet ) override; +}; + +#endif // INCLUDED_XMLOFF_XMLSHAPESTYLECONTEXT_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 000000000..6237cda70 --- /dev/null +++ b/include/xmloff/XMLTextListAutoStylePool.hxx @@ -0,0 +1,76 @@ +/* -*- 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_XMLTEXTLISTAUTOSTYLEPOOL_HXX +#define INCLUDED_XMLOFF_XMLTEXTLISTAUTOSTYLEPOOL_HXX + +#include +#include +#include +#include +#include +#include +#include + +namespace com::sun::star::container { class XIndexReplace; } +namespace com::sun::star::ucb { class XAnyCompare; } + + +class XMLTextListAutoStylePool_Impl; +typedef std::set XMLTextListAutoStylePoolNames_Impl; +class XMLTextListAutoStylePoolEntry_Impl; +class SvXMLExport; + +class XMLOFF_DLLPUBLIC XMLTextListAutoStylePool +{ + SvXMLExport& rExport; + + OUString sPrefix; + + std::unique_ptr pPool; + XMLTextListAutoStylePoolNames_Impl m_aNames; + sal_uInt32 nName; + + /** this is an optional NumRule compare component for applications where + the NumRules don't have names */ + css::uno::Reference< css::ucb::XAnyCompare > mxNumRuleCompare; + + SAL_DLLPRIVATE sal_uInt32 Find( const XMLTextListAutoStylePoolEntry_Impl* pEntry ) + const; +public: + + XMLTextListAutoStylePool( SvXMLExport& rExport ); + ~XMLTextListAutoStylePool(); + + void RegisterName( const OUString& rName ); + + OUString Add( + const css::uno::Reference< css::container::XIndexReplace > & rNumRules ); + + OUString Find( + const css::uno::Reference< css::container::XIndexReplace > & rNumRules ) const; + OUString Find( const OUString& rInternalName ) const; + + void exportXML() const; +}; + + +#endif // INCLUDED_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 000000000..d39159890 --- /dev/null +++ b/include/xmloff/XMLTextMasterPageContext.hxx @@ -0,0 +1,81 @@ +/* -*- 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_XMLTEXTMASTERPAGECONTEXT_HXX +#define INCLUDED_XMLOFF_XMLTEXTMASTERPAGECONTEXT_HXX + +#include +#include +#include + +#include + +namespace com::sun::star { + namespace style { class XStyle; } +} + +class XMLOFF_DLLPUBLIC XMLTextMasterPageContext : public SvXMLStyleContext +{ + OUString sFollow; + OUString sPageMasterName; + OUString m_sDrawingPageStyle; + + css::uno::Reference < css::style::XStyle > xStyle; + + bool bInsertHeader; + bool bInsertFooter; + bool bInsertHeaderLeft; + bool bInsertFooterLeft; + bool bInsertHeaderFirst; + bool bInsertFooterFirst; + bool bHeaderInserted; + bool bFooterInserted; + + SAL_DLLPRIVATE css::uno::Reference< css::style::XStyle > Create(); +protected: + const css::uno::Reference< css::style::XStyle >& GetStyle() const { return xStyle; } +public: + + + XMLTextMasterPageContext( SvXMLImport& rImport, sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList, + bool bOverwrite ); + virtual ~XMLTextMasterPageContext() override; + + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; + + virtual SvXMLImportContext *CreateHeaderFooterContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList, + const bool bFooter, + const bool bLeft, + const bool bFirst ); + + virtual void Finish( bool bOverwrite ) override; +}; + +struct ContextID_Index_Pair; + +XMLOFF_DLLPUBLIC extern ContextID_Index_Pair const g_MasterPageContextIDs[]; +XMLOFF_DLLPUBLIC extern XmlStyleFamily const g_MasterPageFamilies[]; + +#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 000000000..57f02ec88 --- /dev/null +++ b/include/xmloff/XMLTextMasterPageExport.hxx @@ -0,0 +1,50 @@ +/* -*- 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_XMLTEXTMASTERPAGEEXPORT_HXX +#define INCLUDED_XMLOFF_XMLTEXTMASTERPAGEEXPORT_HXX + +#include +#include +#include + +namespace com::sun::star { + namespace text { class XText; } +} + +class XMLOFF_DLLPUBLIC XMLTextMasterPageExport : public XMLPageExport +{ +protected: + + virtual void exportHeaderFooterContent( + const css::uno::Reference< css::text::XText >& rText, + bool bAutoStyles, bool bExportParagraph = true ); + + virtual void exportMasterPageContent( + const css::uno::Reference< css::beans::XPropertySet > & rPropSet, + bool bAutoStyles ) override; + +public: + XMLTextMasterPageExport( SvXMLExport& rExp ); + virtual ~XMLTextMasterPageExport() override; +}; + +#endif // INCLUDED_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 000000000..ab1942b31 --- /dev/null +++ b/include/xmloff/XMLTextMasterStylesContext.hxx @@ -0,0 +1,44 @@ +/* -*- 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_XMLTEXTMASTERSTYLESCONTEXT_HXX +#define INCLUDED_XMLOFF_XMLTEXTMASTERSTYLESCONTEXT_HXX + +#include +#include +#include + +class XMLOFF_DLLPUBLIC XMLTextMasterStylesContext : public SvXMLStylesContext +{ +protected: + virtual SvXMLStyleContext* CreateStyleChildContext( + sal_Int32 nElement, + const css::uno::Reference& xAttrList) override; + + virtual bool InsertStyleFamily(XmlStyleFamily nFamily) const override; + +public: + XMLTextMasterStylesContext(SvXMLImport& rImport); + + virtual ~XMLTextMasterStylesContext() override; +}; + +#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 000000000..f02e566af --- /dev/null +++ b/include/xmloff/XMLTextShapeImportHelper.hxx @@ -0,0 +1,44 @@ +/* -*- 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_XMLTEXTSHAPEIMPORTHELPER_HXX +#define INCLUDED_XMLOFF_XMLTEXTSHAPEIMPORTHELPER_HXX + +#include +#include +#include + +class XMLOFF_DLLPUBLIC XMLTextShapeImportHelper : public XMLShapeImportHelper +{ + SvXMLImport& rImport; + +public: + + XMLTextShapeImportHelper( SvXMLImport& rImp ); + virtual ~XMLTextShapeImportHelper() override; + + virtual void addShape( + css::uno::Reference< css::drawing::XShape >& rShape, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, + css::uno::Reference< css::drawing::XShapes >& rShapes ) override; +}; + +#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 000000000..43cd9807a --- /dev/null +++ b/include/xmloff/XMLTextShapeStyleContext.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 INCLUDED_XMLOFF_XMLTEXTSHAPESTYLECONTEXT_HXX +#define INCLUDED_XMLOFF_XMLTEXTSHAPESTYLECONTEXT_HXX + +#include +#include +#include +#include + +class XMLOFF_DLLPUBLIC XMLTextShapeStyleContext final : public XMLShapeStyleContext +{ + bool bAutoUpdate : 1; + + rtl::Reference xEventContext; + + virtual void SetAttribute( sal_Int32 nElement, + const OUString& rValue ) override; + +public: + + + XMLTextShapeStyleContext( SvXMLImport& rImport, + SvXMLStylesContext& rStyles, XmlStyleFamily nFamily ); + virtual ~XMLTextShapeStyleContext() override; + + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; + + virtual void CreateAndInsert( bool bOverwrite ) override; + + virtual void Finish( bool bOverwrite ) override; +}; + +#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 000000000..032d3b7e7 --- /dev/null +++ b/include/xmloff/XMLTextTableContext.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 INCLUDED_XMLOFF_XMLTEXTTABLECONTEXT_HXX +#define INCLUDED_XMLOFF_XMLTEXTTABLECONTEXT_HXX + +#include +#include +#include + +class XMLOFF_DLLPUBLIC XMLTextTableContext : public SvXMLImportContext +{ +public: + XMLTextTableContext( SvXMLImport& rImport ); + virtual ~XMLTextTableContext() override; +}; + +#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 000000000..421be60cc --- /dev/null +++ b/include/xmloff/animationexport.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 INCLUDED_XMLOFF_ANIMATIONEXPORT_HXX +#define INCLUDED_XMLOFF_ANIMATIONEXPORT_HXX + +#include +#include + +#include +#include + +namespace com::sun::star::animations { class XAnimationNode; } +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::uno { template class Reference; } + +class SvXMLExport; + +namespace xmloff +{ +class AnimationsExporterImpl; + +class XMLOFF_DLLPUBLIC AnimationsExporter final : public salhelper::SimpleReferenceObject +{ + std::unique_ptr mpImpl; + +public: + AnimationsExporter( SvXMLExport& rExport, const css::uno::Reference< css::beans::XPropertySet >& xPageProps ); + SAL_DLLPRIVATE virtual ~AnimationsExporter() override; + + void prepare( const css::uno::Reference< css::animations::XAnimationNode >& xRootNode ); + void exportAnimations( const css::uno::Reference< css::animations::XAnimationNode >& xRootNode ); +}; + +} + +#endif // INCLUDED_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 000000000..286cb21d3 --- /dev/null +++ b/include/xmloff/animexp.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 INCLUDED_XMLOFF_ANIMEXP_HXX +#define INCLUDED_XMLOFF_ANIMEXP_HXX + +#include +#include + +namespace com::sun::star::drawing +{ +class XShape; +} +namespace com::sun::star::uno +{ +template class Reference; +} + +class AnimExpImpl; +class SvXMLExport; +class XMLShapeExport; + +class XMLAnimationsExporter final : public salhelper::SimpleReferenceObject +{ + std::unique_ptr mpImpl; + +public: + XMLAnimationsExporter(); + virtual ~XMLAnimationsExporter() override; + + static void prepare(const css::uno::Reference& xShape); + void collect(const css::uno::Reference& xShape, SvXMLExport& rExport); + void exportAnimations(SvXMLExport& rExport); +}; + +#endif // INCLUDED_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 000000000..7f4fef2b9 --- /dev/null +++ b/include/xmloff/attrlist.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 INCLUDED_XMLOFF_ATTRLIST_HXX +#define INCLUDED_XMLOFF_ATTRLIST_HXX + +#include +#include +#include +#include +#include + +#include +#include +#include + +class XMLOFF_DLLPUBLIC SvXMLAttributeList final : public ::cppu::WeakImplHelper< + css::xml::sax::XAttributeList, + css::util::XCloneable, + css::lang::XUnoTunnel> +{ + struct SvXMLTagAttribute_Impl + { + OUString sName; + OUString sValue; + }; + std::vector vecAttribute; +public: + SvXMLAttributeList(); + SvXMLAttributeList( const SvXMLAttributeList& ); + SvXMLAttributeList( const css::uno::Reference< + css::xml::sax::XAttributeList> & rAttrList ); + virtual ~SvXMLAttributeList() override; + + // XUnoTunnel + UNO3_GETIMPLEMENTATION_DECL(SvXMLAttributeList) + + // css::xml::sax::XAttributeList + virtual sal_Int16 SAL_CALL getLength() override; + virtual OUString SAL_CALL getNameByIndex(sal_Int16 i) override; + virtual OUString SAL_CALL getTypeByIndex(sal_Int16 i) override; + virtual OUString SAL_CALL getTypeByName(const OUString& aName) override; + virtual OUString SAL_CALL getValueByIndex(sal_Int16 i) override; + virtual OUString SAL_CALL getValueByName(const OUString& aName) override; + + // css::util::XCloneable + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override; + + // 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 css::uno::Reference< css::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; +}; + + +#endif // INCLUDED_XMLOFF_ATTRLIST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/autolayout.hxx b/include/xmloff/autolayout.hxx new file mode 100644 index 000000000..2f1898a47 --- /dev/null +++ b/include/xmloff/autolayout.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 INCLUDED_XMLOFF_AUTOLAYOUT_HXX +#define INCLUDED_XMLOFF_AUTOLAYOUT_HXX + +enum AutoLayout +{ + // new layouts with enum/text/chart/org/clip merged to content + AUTOLAYOUT_START = 0, + AUTOLAYOUT_TITLE = 0, ///< Title Slide + AUTOLAYOUT_TITLE_CONTENT = 1, ///< Title, Content + AUTOLAYOUT_CHART = 2, + AUTOLAYOUT_TITLE_2CONTENT = 3, ///< Title and 2 Content + AUTOLAYOUT_TEXTCHART = 4, + AUTOLAYOUT_ORG = 5, + AUTOLAYOUT_TEXTCLIP = 6, + AUTOLAYOUT_CHARTTEXT = 7, + AUTOLAYOUT_TAB = 8, + AUTOLAYOUT_CLIPTEXT = 9, + AUTOLAYOUT_TEXTOBJ = 10, + AUTOLAYOUT_OBJ = 11, + AUTOLAYOUT_TITLE_CONTENT_2CONTENT = 12, ///< Title, Content and 2 Content + AUTOLAYOUT_OBJTEXT = 13, + AUTOLAYOUT_TITLE_CONTENT_OVER_CONTENT = 14, ///< Title, Content over Content + AUTOLAYOUT_TITLE_2CONTENT_CONTENT = 15, ///< Title, 2 Content and Content + AUTOLAYOUT_TITLE_2CONTENT_OVER_CONTENT = 16,///< Title, 2 Content over Content + AUTOLAYOUT_TEXTOVEROBJ = 17, + AUTOLAYOUT_TITLE_4CONTENT = 18, ///< Title, 4 Content + AUTOLAYOUT_TITLE_ONLY = 19, ///< Title Only + AUTOLAYOUT_NONE = 20, ///< Blank Slide + AUTOLAYOUT_NOTES = 21, + AUTOLAYOUT_HANDOUT1 = 22, + AUTOLAYOUT_HANDOUT2 = 23, + AUTOLAYOUT_HANDOUT3 = 24, + AUTOLAYOUT_HANDOUT4 = 25, + AUTOLAYOUT_HANDOUT6 = 26, + AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT = 27, ///< Vertical Title, Vertical Content over Vertical Content + AUTOLAYOUT_VTITLE_VCONTENT = 28, ///< Vertical Title, Vertical Content over Vertical Content + AUTOLAYOUT_TITLE_VCONTENT = 29, ///< Title, Vertical Content + AUTOLAYOUT_TITLE_2VTEXT = 30, ///< Title, 2 Vertical Content + AUTOLAYOUT_HANDOUT9 = 31, + AUTOLAYOUT_ONLY_TEXT = 32, ///< Centered Text + AUTOLAYOUT_4CLIPART = 33, + AUTOLAYOUT_TITLE_6CONTENT = 34, ///< Title, 6 Content + AUTOLAYOUT_END +}; + +#endif // INCLUDED_XMLOFF_AUTOLAYOUT_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 000000000..654641f32 --- /dev/null +++ b/include/xmloff/contextid.hxx @@ -0,0 +1,43 @@ +/* -*- 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_CONTEXTID_HXX +#define INCLUDED_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 ) + +#endif // INCLUDED_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 000000000..ce8a2da13 --- /dev/null +++ b/include/xmloff/controlpropertyhdl.hxx @@ -0,0 +1,128 @@ +/* -*- 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_CONTROLPROPERTYHDL_HXX +#define INCLUDED_XMLOFF_CONTROLPROPERTYHDL_HXX + +#include + +#include + +#include +#include +#include +#include +#include + +namespace xmloff +{ + + + //= ORotationAngleHandler + + class XMLOFF_DLLPUBLIC ORotationAngleHandler final : public XMLPropertyHandler + { + public: + SAL_DLLPRIVATE ORotationAngleHandler(); + + SAL_DLLPRIVATE virtual bool importXML( const OUString& _rStrImpValue, css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override; + SAL_DLLPRIVATE virtual bool exportXML( OUString& _rStrExpValue, const css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override; + }; + + + //= OFontWidthHandler + + class XMLOFF_DLLPUBLIC OFontWidthHandler final : public XMLPropertyHandler + { + public: + SAL_DLLPRIVATE OFontWidthHandler(); + + SAL_DLLPRIVATE virtual bool importXML( const OUString& _rStrImpValue, css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override; + SAL_DLLPRIVATE virtual bool exportXML( OUString& _rStrExpValue, const css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override; + }; + + + //= OControlBorderHandlerBase + + class XMLOFF_DLLPUBLIC OControlBorderHandler final : public XMLPropertyHandler + { + public: + enum BorderFacet + { + STYLE, + COLOR + }; + + SAL_DLLPRIVATE OControlBorderHandler( const BorderFacet _eFacet ); + + SAL_DLLPRIVATE virtual bool importXML( const OUString& _rStrImpValue, css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override; + SAL_DLLPRIVATE virtual bool exportXML( OUString& _rStrExpValue, const css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override; + + private: + BorderFacet m_eFacet; + }; + + + //= OControlTextEmphasisHandler + + class OControlTextEmphasisHandler final : public XMLPropertyHandler + { + public: + OControlTextEmphasisHandler(); + + virtual bool importXML( const OUString& _rStrImpValue, css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override; + virtual bool exportXML( OUString& _rStrExpValue, const css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override; + }; + + + //= ImageScaleModeHandler + + class XMLOFF_DLLPUBLIC ImageScaleModeHandler final : public XMLConstantsPropertyHandler + { + public: + ImageScaleModeHandler(); + }; + + + //= OControlPropertyHandlerFactory + + class XMLOFF_DLLPUBLIC OControlPropertyHandlerFactory : public XMLPropertyHandlerFactory + { + mutable std::unique_ptr m_pTextAlignHandler; + mutable std::unique_ptr m_pControlBorderStyleHandler; + mutable std::unique_ptr m_pControlBorderColorHandler; + mutable std::unique_ptr m_pRotationAngleHandler; + mutable std::unique_ptr m_pFontWidthHandler; + mutable std::unique_ptr m_pFontEmphasisHandler; + mutable std::unique_ptr m_pFontReliefHandler; + mutable std::unique_ptr m_pTextLineModeHandler; + + public: + OControlPropertyHandlerFactory(); + + virtual const XMLPropertyHandler* GetPropertyHandler(sal_Int32 _nType) const override; + }; + + +} // namespace xmloff + + +#endif // INCLUDED_XMLOFF_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 000000000..9e5fd13ca --- /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 +#include + +#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 000000000..bc2e315c0 --- /dev/null +++ b/include/xmloff/families.hxx @@ -0,0 +1,115 @@ +/* -*- 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_FAMILIES_HXX +#define INCLUDED_XMLOFF_FAMILIES_HXX + +#include + +/** These defines determine the unique ids for XML style-families + used in the SvXMLAutoStylePoolP. + */ + +inline constexpr OUStringLiteral XML_STYLE_FAMILY_PAGE_MASTER_NAME = u"page-layout"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_PAGE_MASTER_PREFIX = u"pm"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME = u"table"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_TABLE_STYLES_PREFIX = u"ta"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME = u"table-column"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_PREFIX = u"co"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME = u"table-row"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_ROW_STYLES_PREFIX = u"ro"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME = u"table-cell"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_TABLE_CELL_STYLES_PREFIX = u"ce"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_SD_GRAPHICS_NAME = u"graphic"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX = u"gr"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_SD_PRESENTATION_NAME = u"presentation"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_SD_PRESENTATION_PREFIX = u"pr"; +#define XML_STYLE_FAMILY_SD_POOL_NAME u"default" +inline constexpr OUStringLiteral XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME = u"drawing-page"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_SD_DRAWINGPAGE_PREFIX = u"dp"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_SCH_CHART_NAME = u"chart"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_SCH_CHART_PREFIX = u"ch"; +inline constexpr OUStringLiteral XML_STYLE_FAMILY_CONTROL_PREFIX = u"ctrl"; + +enum class XmlStyleFamily +{ +// Misc (Pool) +// reserved: 0..99 + DATA_STYLE = 0, + PAGE_MASTER = 1, + MASTER_PAGE = 2, + +// Text +// reserved: 100..199 + TEXT_PARAGRAPH = 100, + TEXT_TEXT = 101, + TEXT_LIST = 102, + TEXT_OUTLINE = 103, + TEXT_FOOTNOTECONFIG = 105, + TEXT_ENDNOTECONFIG = 106, + TEXT_SECTION = 107, + TEXT_FRAME = 108, // export only + TEXT_RUBY = 109, + TEXT_BIBLIOGRAPHYCONFIG = 110, + TEXT_LINENUMBERINGCONFIG = 111, + +// Table +// reserved: 200..299 + TABLE_TABLE = 200, + TABLE_COLUMN = 202, + TABLE_ROW = 203, + TABLE_CELL = 204, + TABLE_TEMPLATE_ID = 205, + +// Impress/Draw +// reserved: 300..399 + SD_GRAPHICS_ID = 300, + + SD_PRESENTATION_ID = 301, +// families for derived from SvXMLStyleContext + SD_PAGEMASTERCONTEXT_ID = 302, + SD_PAGEMASTERSTYLECONTEXT_ID = 306, + SD_PRESENTATIONPAGELAYOUT_ID = 303, +// family for draw pool + SD_POOL_ID = 304, +// family for presentation drawpage properties + SD_DRAWINGPAGE_ID = 305, + + SD_GRADIENT_ID = 306, + SD_HATCH_ID = 307, + SD_FILL_IMAGE_ID = 308, + SD_MARKER_ID = 309, + SD_STROKE_DASH_ID = 310, + +// Chart +// reserved: 400..499 + SCH_CHART_ID = 400, + +// Math +// reserved: 500..599 + + +// Forms/Controls +// reserved 600..649 + CONTROL_ID = 600, + +}; + +#endif // INCLUDED_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 000000000..823e99875 --- /dev/null +++ b/include/xmloff/formlayerexport.hxx @@ -0,0 +1,185 @@ +/* -*- 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_FORMLAYEREXPORT_HXX +#define INCLUDED_XMLOFF_FORMLAYEREXPORT_HXX + +#include +#include +#include +#include +#include + +namespace com::sun::star::awt { + class XControlModel; +} + +namespace com::sun::star::drawing { class XDrawPage; } +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::uno { template class Reference; } + +class SvXMLExport; + +namespace xmloff +{ + + + class OFormLayerXMLExport_Impl; + class OFormsRootExport; + + + //= OFormLayerXMLExport + + /** provides functionality for exporting a complete form layer. + */ + class XMLOFF_DLLPUBLIC OFormLayerXMLExport final + :public ::salhelper::SimpleReferenceObject + { + // impl class + std::unique_ptr m_pImpl; + + SAL_DLLPRIVATE virtual ~OFormLayerXMLExport() override; + + public: + SAL_DLLPRIVATE OFormLayerXMLExport(SvXMLExport& _rContext); + + /** initializes some internal structures for fast access to the given page + +

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

+ + @return + if the page has been examined before. If is returned, this is a serious error. + + @see getControlId + @see examineForms + */ + bool seekPage( + const css::uno::Reference< css::drawing::XDrawPage >& _rxDrawPage); + + /** get the id for the given control + +

The page the control belongs to must have been examined and sought to.

+ + @param _rxControl + the control which's id should be retrieved. Must not be . + + @see examineForms + @see seekPage + + */ + SAL_DLLPRIVATE OUString getControlId( + const css::uno::Reference< css::beans::XPropertySet >& _rxControl); + + /** retrieves the style name for the control's number style. + +

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.

+ + @param _rxControl + the control which's id should be retrieved. Must not be . + + @see examineForms + @see seekPage + */ + SAL_DLLPRIVATE OUString getControlNumberStyle( + const css::uno::Reference< css::beans::XPropertySet >& _rxControl ); + + /** examines the forms collection given. + +

This method will collect all form layer related data of the given draw page

+ + @param _rxDrawPage + the draw page to examine. The object will be queried for a com.sun.star.form::XFormsSupplier + interface to obtain the forms container. + */ + void examineForms(const css::uno::Reference< css::drawing::XDrawPage >& _rxDrawPage); + + /** exports the structure of a form layer + +

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)

+ +

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 +

+ <Forms> + ... // all the forms stuff here + </Forms> + + you have to start the Forms element yourself.

+ + @param _rxDrawPage + the draw page to examine. The object will be queried for a com.sun.star.form::XFormsSupplier + interface to obtain the forms container. + */ + void exportForms(const css::uno::Reference< css::drawing::XDrawPage >& _rxDrawPage); + + /** exports the XForms model data + */ + void exportXForms() const; + + /** determines whether the given page contains logical forms + */ + static bool pageContainsForms( const css::uno::Reference< css::drawing::XDrawPage >& _rxDrawPage ); + + /** determines whether the given page contains XForm instances + */ + bool documentContainsXForms() const; + + /** exports the automatic controls number styles + */ + SAL_DLLPRIVATE void exportAutoControlNumberStyles(); + + /** exports the auto-styles collected during the examineForms calls + */ + void exportAutoStyles(); + + /** exclude the given control (model) from export. + +

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.
+ Of course you have to do this before calling exportForms

+ */ + SAL_DLLPRIVATE void excludeFromExport( const css::uno::Reference< css::awt::XControlModel >& _rxControl ); + }; + + + //= OOfficeFormsExport + + /// export helper for the office::forms element + class XMLOFF_DLLPUBLIC OOfficeFormsExport + { + private: + std::unique_ptr m_pImpl; + + public: + OOfficeFormsExport( SvXMLExport& _rExp ); + ~OOfficeFormsExport(); + }; + + +} // namespace xmloff + + +#endif // INCLUDED_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 000000000..ae9c5ed7e --- /dev/null +++ b/include/xmloff/formlayerimport.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 INCLUDED_XMLOFF_FORMLAYERIMPORT_HXX +#define INCLUDED_XMLOFF_FORMLAYERIMPORT_HXX + +#include +#include +#include +#include +#include + +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::drawing { class XDrawPage; } +namespace com::sun::star::xml::sax { class XAttributeList; } +namespace com::sun::star::xml::sax { class XFastAttributeList; } + +class SvXMLImport; +class SvXMLImportContext; +class SvXMLStylesContext; + + +namespace xmloff +{ + + + //= OFormLayerXMLImport + + class OFormLayerXMLImport_Impl; + /** allows you to import a <form:form> element + */ + class XMLOFF_DLLPUBLIC OFormLayerXMLImport final + :public ::salhelper::SimpleReferenceObject + { + std::unique_ptr m_pImpl; + + public: + SAL_DLLPRIVATE OFormLayerXMLImport(SvXMLImport& _rImporter); + SAL_DLLPRIVATE virtual ~OFormLayerXMLImport() override; + + /** start importing the forms of the given page + +

starting the import of a new page (by using this method) invalidates the current page position.

+ + @see endPage + */ + void startPage( + const css::uno::Reference< css::drawing::XDrawPage >& _rxDrawPage); + + /** creates an import context for the office:forms element + */ + static SvXMLImportContext* createOfficeFormsContext( + SvXMLImport& _rImport); + + /** create an SvXMLImportContext instance which is able to import the <form:form> + element. + +

You must have called startPage before you can create such an import context.

+ + @see startPage + @see endPage + */ + SAL_DLLPRIVATE SvXMLImportContext* createContext( + const sal_Int32 _nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& _rxAttribs); + + /** lookup a control given by id. + +

The control must be part of the page which is currently being imported.

+ +

(And, of course, the control must have been imported already at the moment you call this.)

+ + @see startPage + */ + SAL_DLLPRIVATE css::uno::Reference< css::beans::XPropertySet > + lookupControl(const OUString& _rId); + + /** end importing the forms of the current page + +

You must call this method if you want the import to be finished correctly. Without calling + it, you will lose information.

+ + @see startPage + */ + void endPage(); + + /** announces the auto-style context to the form importer + */ + SAL_DLLPRIVATE 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 _rControlNumberStyleName + the style name for the control's number style + */ + SAL_DLLPRIVATE void applyControlNumberStyle( + const css::uno::Reference< css::beans::XPropertySet >& _rxControlModel, + const OUString& _rControlNumberStyleName + ); + + /** to be called when the document has been completely imported + +

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.

+ */ + SAL_DLLPRIVATE void documentDone( ); + }; + + +} // namespace xmloff + + +#endif // INCLUDED_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 000000000..c3921281f --- /dev/null +++ b/include/xmloff/i18nmap.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 INCLUDED_XMLOFF_I18NMAP_HXX +#define INCLUDED_XMLOFF_I18NMAP_HXX + +#include +#include +#include +#include + +class SvI18NMapEntry_Key +{ + sal_uInt16 nKind; + OUString aName; +public: + SvI18NMapEntry_Key( sal_uInt16 nKnd, const OUString& rName ) : + nKind( nKnd ), + aName( rName ) + { + } + + bool operator<( const SvI18NMapEntry_Key& r ) const + { + return nKind < r.nKind || + ( nKind == r.nKind && + aName < r.aName); + } +}; + +typedef std::map SvI18NMap_Impl; + +class XMLOFF_DLLPUBLIC SvI18NMap +{ + SvI18NMap_Impl m_aMap; + +public: + // Add a name mapping + void 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 // INCLUDED_XMLOFF_I18NMAP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/languagetagodf.hxx b/include/xmloff/languagetagodf.hxx new file mode 100644 index 000000000..be687b7a8 --- /dev/null +++ b/include/xmloff/languagetagodf.hxx @@ -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/. + */ + +#ifndef INCLUDED_XMLOFF_LANGUAGETAGODF_HXX +#define INCLUDED_XMLOFF_LANGUAGETAGODF_HXX + +#include +#include +#include + +/** Helper to gather the single language tag relevant attributes during reading + ODF and form a resulting LanguageTag when done. + + For example fo:language, fo:script, fo:country, style:rfc-language-tag + */ +struct LanguageTagODF +{ + OUString maRfcLanguageTag; + OUString maLanguage; + OUString maScript; + OUString maCountry; + + bool isEmpty() const { return maRfcLanguageTag.isEmpty() && + maLanguage.isEmpty() && maScript.isEmpty() && maCountry.isEmpty(); } + + /** Best call this only once per instance, it recreates a LanguageTag + instance on every call. + */ + LanguageTag getLanguageTag() const { return LanguageTag( maRfcLanguageTag, maLanguage, maScript, maCountry); } +}; + +#endif // INCLUDED_XMLOFF_LANGUAGETAGODF_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 000000000..a4b105b65 --- /dev/null +++ b/include/xmloff/maptype.hxx @@ -0,0 +1,152 @@ +/* -*- 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_MAPTYPE_HXX +#define INCLUDED_XMLOFF_MAPTYPE_HXX + +#include +#include +#include + + +/** Represents a property with its API-name, its XML-name and the type of + its value. +*/ +struct XMLPropertyMapEntry +{ + const char* msApiName; /// Property-Name + sal_Int32 nApiNameLength; /// length of property name + enum ::xmloff::token::XMLTokenEnum meXMLName; /// XML-Name + sal_uInt16 mnNameSpace; /** declares the Namespace in which this + property exists */ + + /** + * The lowest 14 bits specify the basic XML type of the property value, of + * which the 11th bit specifies the application type. The basic type has + * the 11th bit off and the 14th bit on. For the most part, the lower 14 + * bits are used as a single value. + * + *

The next 4 bits specify the family type of the property value. This + * can be one of the following:

+ * + *
    + *
  • XML_TYPE_PROP_GRAPHIC
  • + *
  • XML_TYPE_PROP_DRAWING_PAGE
  • + *
  • XML_TYPE_PROP_PAGE_LAYOUT
  • + *
  • XML_TYPE_PROP_HEADER_FOOTER
  • + *
  • XML_TYPE_PROP_TEXT
  • + *
  • XML_TYPE_PROP_PARAGRAPH
  • + *
  • XML_TYPE_PROP_RUBY
  • + *
  • XML_TYPE_PROP_SECTION
  • + *
  • XML_TYPE_PROP_TABLE
  • + *
  • XML_TYPE_PROP_TABLE_COLUMN
  • + *
  • XML_TYPE_PROP_TABLE_ROW
  • + *
  • XML_TYPE_PROP_TABLE_CELL
  • + *
  • XML_TYPE_PROP_LIST_LEVEL
  • + *
  • XML_TYPE_PROP_CHART
  • + *
+ * + *

The next 2 bits are not used.

+ * + *

The last 12 bits specify additional rules on how to special-case the + * value during import and export. This value may be a combination of the + * following flags:

+ * + *
    + *
  • MID_FLAG_PROPERTY_MAY_THROW
  • + *
  • MID_FLAG_DEFAULT_ITEM_EXPORT
  • + *
  • MID_FLAG_MUST_EXIST
  • + *
  • MID_FLAG_MERGE_ATTRIBUTE
  • + *
  • MID_FLAG_MERGE_PROPERTY
  • + *
  • MID_FLAG_MULTI_PROPERTY
  • + *
  • MID_FLAG_ELEMENT_ITEM_IMPORT
  • + *
  • MID_FLAG_ELEMENT_ITEM_EXPORT
  • + *
  • MID_FLAG_SPECIAL_ITEM_IMPORT
  • + *
  • MID_FLAG_SPECIAL_ITEM_EXPORT
  • + *
  • MID_FLAG_NO_PROPERTY_IMPORT
  • + *
  • MID_FLAG_NO_PROPERTY_EXPORT
  • + *
+ */ + sal_uInt32 mnType; + + sal_Int16 mnContextId; /// User defined id for context filtering + /** no export to standard namespace when the used ODF version is lower than this; + no export to extension namespace when the used ODF version is at least this + */ + SvtSaveOptions::ODFSaneDefaultVersion mnEarliestODFVersionForExport; + + /** Flag to specify whether entry is only used during import. + + Allows to handle more than one Namespace/XML-Name to Property-Name + mapping, i.e. for extensions. If several entries for the same + Property-Name exist, all except one must have this flag set. + */ + bool mbImportOnly; + + template< std::size_t N > + XMLPropertyMapEntry( + const char (&sApiName)[N], + sal_uInt16 nNameSpace, + enum ::xmloff::token::XMLTokenEnum eXMLName, + sal_uInt32 nType, + sal_Int16 nContextId, + SvtSaveOptions::ODFSaneDefaultVersion nEarliestODFVersionForExport, + bool bImportOnly) + : + msApiName(sApiName), + nApiNameLength(N-1), + meXMLName(eXMLName), mnNameSpace(nNameSpace), mnType(nType), + mnContextId(nContextId), mnEarliestODFVersionForExport(nEarliestODFVersionForExport), + mbImportOnly(bImportOnly) + {} + XMLPropertyMapEntry( + std::nullptr_t , + sal_uInt16 nNameSpace, + enum ::xmloff::token::XMLTokenEnum eXMLName, + sal_uInt32 nType, + sal_Int16 nContextId, + SvtSaveOptions::ODFSaneDefaultVersion nEarliestODFVersionForExport, + bool bImportOnly) + : + msApiName(nullptr), + nApiNameLength(0), + meXMLName(eXMLName), mnNameSpace(nNameSpace), mnType(nType), + mnContextId(nContextId), mnEarliestODFVersionForExport(nEarliestODFVersionForExport), + mbImportOnly(bImportOnly) + {} +}; + + +/** Smart struct to transport an Any with an index to the appropriate + property-name +*/ +struct XMLPropertyState +{ + sal_Int32 mnIndex; + css::uno::Any maValue; + + XMLPropertyState( sal_Int32 nIndex ) + : mnIndex( nIndex ) {} + XMLPropertyState( sal_Int32 nIndex, const css::uno::Any& rValue ) + : mnIndex( nIndex ), maValue( rValue ) {} +}; + +#endif // INCLUDED_XMLOFF_MAPTYPE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/namespacemap.hxx b/include/xmloff/namespacemap.hxx new file mode 100644 index 000000000..51e741fb8 --- /dev/null +++ b/include/xmloff/namespacemap.hxx @@ -0,0 +1,164 @@ +/* -*- 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_NMSPMAP_HXX +#define INCLUDED_XMLOFF_NMSPMAP_HXX + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + +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 final +{ +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; + + bool operator==(NameSpaceEntry const & rhs) const + { + return sName == rhs.sName && sPrefix == rhs.sPrefix && nKey == rhs.nKey; + } +}; + +class KeyToNameSpaceMapEntry final +{ +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; +}; + +typedef ::std::pair < sal_uInt16, OUString > QNamePair; + +struct QNamePairHash +{ + size_t operator()( const QNamePair &r1 ) const + { + size_t hash = 17; + hash = hash * 37 + r1.first; + hash = hash * 37 + r1.second.hashCode(); + return hash; + } +}; + +typedef std::unordered_map < QNamePair, OUString, QNamePairHash > QNameCache; +typedef std::unordered_map < OUString, NameSpaceEntry > NameSpaceHash; +typedef std::unordered_map < sal_uInt16, KeyToNameSpaceMapEntry > KeyToNameSpaceMap; + +class XMLOFF_DLLPUBLIC SvXMLNamespaceMap +{ + OUString sXMLNS; + + NameSpaceHash aNameHash; + mutable NameSpaceHash aNameCache; + KeyToNameSpaceMap maKeyToNamespaceMap; + mutable QNameCache aQNameCache; + SAL_DLLPRIVATE sal_uInt16 Add_( const OUString& rPrefix, const OUString &rName, sal_uInt16 nKey ); + +public: + + SvXMLNamespaceMap(); + ~SvXMLNamespaceMap(); + + SvXMLNamespaceMap( const SvXMLNamespaceMap& ); + + SvXMLNamespaceMap& operator =( const SvXMLNamespaceMap& rCmp ); + bool 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, + bool bCache = true) const; + + OUString GetAttrNameByKey( sal_uInt16 nKey ) const; + + enum class QNameMode { AttrNameCached, AttrValue }; + sal_uInt16 GetKeyByQName(const OUString& rQName, + OUString *pPrefix, + OUString *pLocalName, + OUString *pNamespace, + QNameMode eMode) const; + + sal_uInt16 GetKeyByAttrValueQName(const OUString& rAttrName, + OUString *pLocalName) 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; } + + void Clear(); + + static bool NormalizeOasisURN( OUString& rName ); + static bool NormalizeW3URI( OUString& rName ); + static bool NormalizeURI( OUString& rName ); + +/* deprecated */ void AddAtIndex( const OUString& rPrefix, + const OUString& rName, sal_uInt16 nKey ); +/* deprecated */ static sal_uInt16 GetIndexByKey( sal_uInt16 nKey ); +/* 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; + sal_uInt16 GetKeyByAttrName( const OUString& rAttrName, + OUString *pPrefix, + OUString *pLocalName, + OUString *pNamespace ) const; +/* deprecated */ sal_uInt16 GetKeyByAttrName( const OUString& rAttrName, + OUString *pLocalName = nullptr ) const; +}; + +#endif // INCLUDED_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 000000000..41d2ddaf2 --- /dev/null +++ b/include/xmloff/numehelp.hxx @@ -0,0 +1,117 @@ +/* -*- 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_NUMEHELP_HXX +#define INCLUDED_XMLOFF_NUMEHELP_HXX + +#include +#include +#include +#include +#include + +#include +#include + +namespace com::sun::star::util { class XNumberFormats; } +namespace com::sun::star::util { class XNumberFormatsSupplier; } + +class SvXMLExport; + +struct XMLNumberFormat +{ + OUString sCurrency; + sal_Int32 nNumberFormat; + sal_Int16 nType; + bool bIsStandard : 1; + + XMLNumberFormat(sal_Int32 nTempFormat) + : nNumberFormat(nTempFormat) + , nType(0) + , bIsStandard(false) + { + } +}; + +struct LessNumberFormat +{ + bool operator() (const XMLNumberFormat& rValue1, const XMLNumberFormat& rValue2) const + { + return rValue1.nNumberFormat < rValue2.nNumberFormat; + } +}; + +typedef std::set XMLNumberFormatSet; + +class XMLOFF_DLLPUBLIC XMLNumberFormatAttributesExportHelper +{ + css::uno::Reference< css::util::XNumberFormats > xNumberFormats; + SvXMLExport* pExport; + const OUString sAttrValue; + const OUString sAttrDateValue; + const OUString sAttrTimeValue; + const OUString sAttrBooleanValue; + const OUString sAttrStringValue; + const OUString sAttrCurrency; + XMLNumberFormatSet aNumberFormats; +public: + XMLNumberFormatAttributesExportHelper(css::uno::Reference< css::util::XNumberFormatsSupplier > const & xNumberFormatsSupplier); + XMLNumberFormatAttributesExportHelper(css::uno::Reference< css::util::XNumberFormatsSupplier > const & xNumberFormatsSupplier, + SvXMLExport& rExport ); + ~XMLNumberFormatAttributesExportHelper(); + + 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, + bool bExportValue); + static bool GetCurrencySymbol(const sal_Int32 nNumberFormat, OUString& rCurrencySymbol, + css::uno::Reference< css::util::XNumberFormatsSupplier > const & xNumberFormatsSupplier); + static sal_Int16 GetCellType(const sal_Int32 nNumberFormat, bool& bIsStandard, + css::uno::Reference< css::util::XNumberFormatsSupplier > const & xNumberFormatsSupplier); + static void SetNumberFormatAttributes(SvXMLExport& rXMLExport, + const sal_Int32 nNumberFormat, + const double& rValue, + bool bExportValue = true); + static void SetNumberFormatAttributes(SvXMLExport& rXMLExport, + const OUString& rValue, + std::u16string_view rCharacters, + bool bExportValue, + bool bExportTypeAttribute = true); + + 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, + bool bExportValue, sal_uInt16 nNamespace = XML_NAMESPACE_OFFICE); + void SetNumberFormatAttributes(const sal_Int32 nNumberFormat, + const double& rValue, + bool bExportValue = true, + sal_uInt16 nNamespace = XML_NAMESPACE_OFFICE, bool bExportCurrencySymbol = true); + void SetNumberFormatAttributes(const OUString& rValue, + std::u16string_view rCharacters, + bool bExportValue = true, + sal_uInt16 nNamespace = XML_NAMESPACE_OFFICE); +}; + +#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 000000000..8dd75e038 --- /dev/null +++ b/include/xmloff/odffields.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 INCLUDED_XMLOFF_ODFFIELDS_HXX +#define INCLUDED_XMLOFF_ODFFIELDS_HXX + +#include + +inline constexpr OUStringLiteral ODF_FORMTEXT = u"vnd.oasis.opendocument.field.FORMTEXT"; +#define ODF_FORMFIELD_DEFAULT_LENGTH 5 + +inline constexpr OUStringLiteral ODF_FORMCHECKBOX = u"vnd.oasis.opendocument.field.FORMCHECKBOX"; +inline constexpr OUStringLiteral ODF_FORMCHECKBOX_HELPTEXT = u"Checkbox_HelpText"; +inline constexpr OUStringLiteral ODF_FORMCHECKBOX_NAME = u"Checkbox_Name"; +inline constexpr OUStringLiteral ODF_FORMCHECKBOX_RESULT = u"Checkbox_Checked"; + +inline constexpr OUStringLiteral ODF_FORMDROPDOWN = u"vnd.oasis.opendocument.field.FORMDROPDOWN"; +inline constexpr OUStringLiteral ODF_FORMDROPDOWN_LISTENTRY = u"Dropdown_ListEntry"; +inline constexpr OUStringLiteral ODF_FORMDROPDOWN_RESULT = u"Dropdown_Selected"; +#define ODF_FORMDROPDOWN_ENTRY_COUNT_LIMIT 25 + +inline constexpr OUStringLiteral ODF_FORMDATE = u"vnd.oasis.opendocument.field.FORMDATE"; +inline constexpr OUStringLiteral ODF_FORMDATE_DATEFORMAT + = u"DateField_DateFormat"; // e.g. "MM.DD.YY"; +inline constexpr OUStringLiteral ODF_FORMDATE_DATEFORMAT_LANGUAGE + = u"DateField_DateFormat_Language"; // e.g. "en-US", "hu-HU"; +inline constexpr OUStringLiteral ODF_FORMDATE_CURRENTDATE + = u"DateField_CurrentDate"; // date string in a specific format +inline constexpr OUStringLiteral ODF_FORMDATE_CURRENTDATE_FORMAT = u"YYYY-MM-DD"; // Coming from MSO +#define ODF_FORMDATE_CURRENTDATE_LANGUAGE LANGUAGE_ENGLISH_US + +#define ODF_TOC "vnd.oasis.opendocument.field.TOC" + +#define ODF_HYPERLINK "vnd.oasis.opendocument.field.HYPERLINK" + +#define ODF_PAGEREF "vnd.oasis.opendocument.field.PAGEREF" + +inline constexpr OUStringLiteral ODF_UNHANDLED = u"vnd.oasis.opendocument.field.UNHANDLED"; +inline constexpr OUStringLiteral ODF_OLE_PARAM = u"vnd.oasis.opendocument.field.ole"; +inline constexpr OUStringLiteral ODF_ID_PARAM = u"vnd.oasis.opendocument.field.id"; +inline constexpr OUStringLiteral ODF_CODE_PARAM = u"vnd.oasis.opendocument.field.code"; + +#endif // INCLUDED_XMLOFF_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 000000000..e9eb038da --- /dev/null +++ b/include/xmloff/prhdlfac.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 INCLUDED_XMLOFF_PRHDLFAC_HXX +#define INCLUDED_XMLOFF_PRHDLFAC_HXX + +#include +#include + +#include +#include + +class XMLPropertyHandler; + +/** + 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 salhelper::SimpleReferenceObject +{ + struct Impl; + std::unique_ptr mpImpl; + + XMLPropertyHandlerFactory(const XMLPropertyHandlerFactory&) = delete; + XMLPropertyHandlerFactory& operator=(const XMLPropertyHandlerFactory&) = delete; + +public: + XMLPropertyHandlerFactory(); + virtual ~XMLPropertyHandlerFactory() override; + + /** + 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, ... ). + After 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 std::unique_ptr CreatePropertyHandler(sal_Int32 nType); + +protected: + /** Retrieves a PropertyHandler from the internal cache */ + const 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; +}; + +#endif // INCLUDED_XMLOFF_PRHDLFAC_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 000000000..98df0c4ea --- /dev/null +++ b/include/xmloff/prstylei.hxx @@ -0,0 +1,118 @@ +/* -*- 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_PRSTYLEI_HXX +#define INCLUDED_XMLOFF_PRSTYLEI_HXX + +#include +#include +#include +#include +#include + +#include + +struct XMLPropertyState; + +namespace com::sun::star { + namespace beans { class XPropertySet; } +} + +namespace com::sun::star::style { class XStyle; } + +typedef std::unordered_set OldFillStyleDefinitionSet; + +class XMLOFF_DLLPUBLIC XMLPropStyleContext : public SvXMLStyleContext +{ +private: + ::std::vector< XMLPropertyState > maProperties; + css::uno::Reference < css::style::XStyle > mxStyle; + rtl::Reference mxStyles; + + XMLPropStyleContext(XMLPropStyleContext const &) = delete; + XMLPropStyleContext& operator =(XMLPropStyleContext const &) = delete; + +public: + + // Helper to check if the local maProperties contains the given + // FillStyle tag and if the FillStyle there is different from FillStyle_NONE + bool doNewDrawingLayerFillStyleDefinitionsExist( + const OUString& rFillStyleTag) const; + +protected: + + // Helper which will deactivate all old fill definitions (identified by + // the given OldFillStyleDefinitionSet) in the local maProperties. Deactivation + // is done setting the index to -1. It returns true when actually old fill + // definitions existed and were deactivated + void deactivateOldFillStyleDefinitions( + const OldFillStyleDefinitionSet& rHashSetOfTags); + + // Helper to translate new DrawingLayer FillStyle values which are name-based + // from ODF internal name to style display names which can be found in the current + // document model (using NameOrIndex Items). The change is executed on the internal + // maProperties. The return value is true when actually names were changed + void translateNameBasedDrawingLayerFillStyleDefinitionsToStyleDisplayNames(); + + // provider for often used sets + static const OldFillStyleDefinitionSet& getStandardSet(); + static const OldFillStyleDefinitionSet& getHeaderSet(); + static const OldFillStyleDefinitionSet& getFooterSet(); + + virtual void SetAttribute( sal_Int32 nElement, const OUString& rValue ) override; + SvXMLStylesContext *GetStyles() { return mxStyles.get(); } + ::std::vector< XMLPropertyState > & GetProperties() { return maProperties; } + + // Override this method to create a new style. It's called by + // CreateInsert to create a style if a style with the requested family and + // name couldn't be found. + virtual css::uno::Reference< css::style::XStyle > Create(); + +public: + + + XMLPropStyleContext( SvXMLImport& rImport, + SvXMLStylesContext& rStyles, XmlStyleFamily nFamily, + bool bDefaultStyle=false ); + virtual ~XMLPropStyleContext() override; + + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; + + virtual void FillPropertySet( + const css::uno::Reference< css::beans::XPropertySet > & rPropSet ); + + virtual bool isEmptyDataStyleName() { return false; }; + + const SvXMLStylesContext *GetStyles() const { return static_cast(mxStyles.get()); } + const ::std::vector< XMLPropertyState > & GetProperties() const { return maProperties; } + + const css::uno::Reference< css::style::XStyle >& + GetStyle() const { return mxStyle; } + void SetStyle( + const css::uno::Reference< css::style::XStyle >& xStl) { mxStyle = xStl; } + + virtual void SetDefaults() override; + + virtual void CreateAndInsert( bool bOverwrite ) override; + virtual void Finish( bool bOverwrite ) override; +}; + +#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 000000000..ba5526f72 --- /dev/null +++ b/include/xmloff/settingsstore.hxx @@ -0,0 +1,43 @@ +/* -*- 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/. + */ + +// Simple interface to allow serialization of document settings + +#ifndef INCLUDED_XMLOFF_SETTINGSSTORE_HXX +#define INCLUDED_XMLOFF_SETTINGSSTORE_HXX + +#include + +namespace com::sun::star::beans { struct PropertyValue; } +namespace com::sun::star::embed { class XStorage; } +namespace com::sun::star::uno { template class Reference; } + +// Scans list of properties for certain URL properties that could refer +// to internal objects, and initializes from these. +class SAL_DLLPUBLIC_RTTI DocumentSettingsSerializer { +public: + // Import objects and update properties (eliding URLs) + virtual css::uno::Sequence + filterStreamsFromStorage( + OUString const & referer, + const css::uno::Reference< css::embed::XStorage > &xStorage, + const css::uno::Sequence& aConfigProps ) = 0; + // Export objects and update properties with relative URLs into this storage + virtual css::uno::Sequence + filterStreamsToStorage( + const css::uno::Reference< css::embed::XStorage > &xStorage, + const css::uno::Sequence& aConfigProps ) = 0; + +protected: + ~DocumentSettingsSerializer() {} +}; + +#endif // INCLUDED_XMLOFF_SETTINGSSTORE_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 000000000..add92acf4 --- /dev/null +++ b/include/xmloff/shapeexport.hxx @@ -0,0 +1,311 @@ +/* -*- 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_SHAPEEXPORT_HXX +#define INCLUDED_XMLOFF_SHAPEEXPORT_HXX + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace com::sun::star::awt { struct Point; } +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::drawing { class XShape; } +namespace com::sun::star::drawing { class XShapes; } + +class XMLTableExport; +class SvXMLAttributeList; +class XMLPropertyHandlerFactory; + +// shape export features are bits used for the nFeature +// parameter of XMLShapeExport::exportShape +enum class XMLShapeExportFlags { + NONE = 0, + X = 0x0001, + Y = 0x0002, + POSITION = 0x0003, + WIDTH = 0x0004, + HEIGHT = 0x0008, + SIZE = WIDTH | HEIGHT, +// When setting the flag below no ignorableWhiteSpace will be called around +// the drawing object elements + NO_WS = 0x0020, +// When setting the flag below a callout shape is exported as office:annotation + ANNOTATION = 0x0040, +}; +namespace o3tl +{ + template<> struct typed_flags : is_typed_flags {}; +} + +#define SEF_DEFAULT XMLShapeExportFlags::POSITION|XMLShapeExportFlags::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; + XmlStyleFamily mnFamily; + XmlShapeType meShapeType; + + css::uno::Reference< css::drawing::XShape > xCustomShapeReplacement; + + ImplXMLShapeExportInfo() : mnFamily( XmlStyleFamily::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< css::uno::Reference < css::drawing::XShapes >, ImplXMLShapeExportInfoVector > ShapesInfos; + +class SvXMLExport; +class SvXMLExportPropertyMapper; + +namespace basegfx +{ + class B2DTuple; + class B2DHomMatrix; +} + +class XMLOFF_DLLPUBLIC XMLShapeExport : public salhelper::SimpleReferenceObject +{ +private: + + SvXMLExport& mrExport; + rtl::Reference< SvXMLExportPropertyMapper > mxPropertySetMapper; + rtl::Reference< XMLAnimationsExporter > mxAnimationsExporter; + ShapesInfos maShapesInfos; + ShapesInfos::iterator maCurrentShapesIter; + bool mbExportLayer; + OUString msPresentationStylePrefix; + + // #88546# possibility to switch progress bar handling on/off + bool mbHandleProgressBar; + + rtl::Reference< XMLTableExport > mxShapeTableExport; + +protected: + SvXMLExport& GetExport() { return mrExport; } + const SvXMLExport& GetExport() const { return mrExport; } +private: + + SAL_DLLPRIVATE const rtl::Reference< SvXMLExportPropertyMapper >& GetPropertySetMapper() const { return mxPropertySetMapper; } + + OUStringBuffer msBuffer; + + SAL_DLLPRIVATE void ImpCalcShapeType(const css::uno::Reference< css::drawing::XShape >& xShape, XmlShapeType& eShapeType); + + SAL_DLLPRIVATE void ImpExportNewTrans(const css::uno::Reference< css::beans::XPropertySet >& xPropSet, XMLShapeExportFlags nFeatures, css::awt::Point* pRefPoint); + SAL_DLLPRIVATE void ImpExportNewTrans_GetB2DHomMatrix(::basegfx::B2DHomMatrix& rMatrix, const css::uno::Reference< css::beans::XPropertySet >& xPropSet); + SAL_DLLPRIVATE static void ImpExportNewTrans_DecomposeAndRefPoint(const ::basegfx::B2DHomMatrix& rMat, ::basegfx::B2DTuple& rTRScale, double& fTRShear, double& fTRRotate, ::basegfx::B2DTuple& rTRTranslate, css::awt::Point* pRefPoint); + SAL_DLLPRIVATE void ImpExportNewTrans_FeaturesAndWrite(::basegfx::B2DTuple const & rTRScale, double fTRShear, double fTRRotate, ::basegfx::B2DTuple const & rTRTranslate, const XMLShapeExportFlags nFeatures); + SAL_DLLPRIVATE bool ImpExportPresentationAttributes( const css::uno::Reference< css::beans::XPropertySet >& xPropSet, const OUString& rClass ); + SAL_DLLPRIVATE void ImpExportText( const css::uno::Reference< css::drawing::XShape >& xShape, TextPNS eExtensionNS = TextPNS::ODF ); + SAL_DLLPRIVATE void ImpExportEvents( const css::uno::Reference< css::drawing::XShape >& xShape ); + SAL_DLLPRIVATE void ImpExportDescription( const css::uno::Reference< css::drawing::XShape >& xShape ); // #i68101# + SAL_DLLPRIVATE void ImpExportGluePoints( const css::uno::Reference< css::drawing::XShape >& xShape ); + SAL_DLLPRIVATE void ImpExportSignatureLine(const css::uno::Reference& xShape); + SAL_DLLPRIVATE void ImpExportQRCode(const css::uno::Reference& xShape); + + // single shape exporters + SAL_DLLPRIVATE void ImpExportGroupShape( const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr ); + SAL_DLLPRIVATE void ImpExport3DSceneShape( const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr ); + SAL_DLLPRIVATE void ImpExportRectangleShape( const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr ); + SAL_DLLPRIVATE void ImpExportLineShape(const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr ); + SAL_DLLPRIVATE void ImpExportEllipseShape(const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr ); + SAL_DLLPRIVATE void ImpExportPolygonShape(const css::uno::Reference< css::drawing::XShape >& xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr ); + SAL_DLLPRIVATE void ImpExportTextBoxShape(const css::uno::Reference< css::drawing::XShape >& xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr ); + SAL_DLLPRIVATE void ImpExportGraphicObjectShape(const css::uno::Reference< css::drawing::XShape >& xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr ); + SAL_DLLPRIVATE void ImpExportChartShape(const css::uno::Reference< css::drawing::XShape >& xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr, SvXMLAttributeList* pAttrList = nullptr ); + SAL_DLLPRIVATE void ImpExportControlShape(const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr ); + SAL_DLLPRIVATE void ImpExportConnectorShape(const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr ); + SAL_DLLPRIVATE void ImpExportMeasureShape(const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point const * pRefPoint = nullptr ); + SAL_DLLPRIVATE void ImpExportOLE2Shape(const css::uno::Reference< css::drawing::XShape >& xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr, SvXMLAttributeList* pAttrList = nullptr ); + SAL_DLLPRIVATE void ImpExportPageShape(const css::uno::Reference< css::drawing::XShape >& xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr ); + SAL_DLLPRIVATE void ImpExportCaptionShape(const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr ); + SAL_DLLPRIVATE void ImpExport3DShape(const css::uno::Reference< css::drawing::XShape >& xShape, XmlShapeType eShapeType ); + SAL_DLLPRIVATE void ImpExportFrameShape( const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr ); + SAL_DLLPRIVATE void ImpExportPluginShape( const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr ); + SAL_DLLPRIVATE void ImpExportAppletShape( const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr ); + SAL_DLLPRIVATE void ImpExportCustomShape( const css::uno::Reference< css::drawing::XShape >& xShape, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr ); + SAL_DLLPRIVATE void ImpExportMediaShape( const css::uno::Reference< css::drawing::XShape >& xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr ); + SAL_DLLPRIVATE void ImpExportTableShape(const css::uno::Reference< css::drawing::XShape >& xShape, XmlShapeType eShapeType, XMLShapeExportFlags nFeatures = SEF_DEFAULT, css::awt::Point* pRefPoint = nullptr ); +public: + XMLShapeExport(SvXMLExport& rExp, SvXMLExportPropertyMapper *pExtMapper=nullptr ); + virtual ~XMLShapeExport() override; + + // This method collects all automatic styles for the given XShape + void collectShapeAutoStyles( + const css::uno::Reference < css::drawing::XShape >& xShape); + + // This method exports the given XShape + void exportShape( + const css::uno::Reference < css::drawing::XShape >& xShape, + XMLShapeExportFlags nFeatures = SEF_DEFAULT, + css::awt::Point* pRefPoint = nullptr, + SvXMLAttributeList* pAttrList = nullptr + ); + + // This method collects all automatic styles for the shapes inside the given XShapes collection + void collectShapesAutoStyles( + const css::uno::Reference < css::drawing::XShapes >& xShapes); + + // This method exports all XShape inside the given XShapes collection + void exportShapes( + const css::uno::Reference < css::drawing::XShapes >& xShapes, + XMLShapeExportFlags nFeatures = SEF_DEFAULT, + css::awt::Point* pRefPoint = nullptr + ); + + /** initializes some internal structures for fast access to the given XShapes collection + +

This method has to be called before you use exportShape or collectShapeAutoStyles. + It is automatically called if you use collectShapesAutoStyles and exportShapes. + + @see collectShapeAutoStyles + @see exportShape + @see collectShapesAutoStyles + @see exportShapes + */ + void seekShapes( + const css::uno::Reference< css::drawing::XShapes >& xShapes ) noexcept; + + 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( rtl::Reference< XMLAnimationsExporter > const & xAnimExport ) { mxAnimationsExporter = xAnimExport; } + + /** returns the last set XMLAnimationExport */ + const rtl::Reference< XMLAnimationsExporter >& getAnimationsExporter() const { return mxAnimationsExporter; } + + /// returns the export property mapper for external chaining + static SvXMLExportPropertyMapper* CreateShapePropMapper( SvXMLExport& rExport ); + + void enableLayerExport() { mbExportLayer = true; } + + /** defines if the export should increment the progress bar or not */ + void enableHandleProgressBar() { mbHandleProgressBar = true; } + 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 css::uno::Reference< css::beans::XPropertySet >& xPropSet ); + + /** helper for chart that exports all lamps from the propertyset */ + void export3DLamps( const css::uno::Reference< css::beans::XPropertySet >& xPropSet ); + + /** sj: replacing CustomShapes with standard objects that are also supported in OpenOffice.org format */ + css::uno::Reference < css::drawing::XShape > checkForCustomShapeReplacement( + const css::uno::Reference < css::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 css::uno::Reference < css::drawing::XShape >& xShape ); + + const rtl::Reference< XMLTableExport >& GetShapeTableExport(); +}; + +namespace xmloff { + +XMLOFF_DLLPUBLIC void FixZOrder( + css::uno::Reference const& xShapes, + std::function const&)> const& rGetLayer); + +} // namespace xmloff + +#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 000000000..12cb9f8fd --- /dev/null +++ b/include/xmloff/shapeimport.hxx @@ -0,0 +1,263 @@ +/* -*- 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_SHAPEIMPORT_HXX +#define INCLUDED_XMLOFF_SHAPEIMPORT_HXX + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::drawing { class XShape; } +namespace com::sun::star::drawing { class XShapes; } +namespace com::sun::star::frame { class XModel; } +namespace com::sun::star::xml::sax { class XAttributeList; } + +class SvXMLImport; +class SvXMLTokenMap; +class SvXMLStylesContext; +class XMLSdPropHdlFactory; +class SvXMLImportPropertyMapper; +class XMLTableImport; + +// dr3d:3dlight context + +class SdXML3DLightContext final : public SvXMLImportContext +{ + // local parameters which need to be read + sal_Int32 maDiffuseColor; + ::basegfx::B3DVector maDirection; + bool mbEnabled; + bool mbSpecular; + +public: + SdXML3DLightContext( + SvXMLImport& rImport, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList); + virtual ~SdXML3DLightContext() override; + + sal_Int32 GetDiffuseColor() const { return maDiffuseColor; } + const ::basegfx::B3DVector& GetDirection() const { return maDirection; } + bool GetEnabled() const { return mbEnabled; } +}; + + +class SdXML3DSceneAttributesHelper +{ +protected: + SvXMLImport& mrImport; + + // list for local light contexts + ::std::vector< rtl::Reference< SdXML3DLightContext > > + maList; + + // local parameters which need to be read + css::drawing::HomogenMatrix mxHomMat; + bool mbSetTransform; + + css::drawing::ProjectionMode mxPrjMode; + sal_Int32 mnDistance; + sal_Int32 mnFocalLength; + sal_Int32 mnShadowSlant; + css::drawing::ShadeMode mxShadeMode; + sal_Int32 maAmbientColor; + bool mbLightingMode; + + ::basegfx::B3DVector maVRP; + ::basegfx::B3DVector maVPN; + ::basegfx::B3DVector maVUP; + bool mbVRPUsed; + +public: + SdXML3DSceneAttributesHelper( SvXMLImport& rImporter ); + + /** creates a 3d light context and adds it to the internal list for later processing */ + SvXMLImportContext * create3DLightContext( const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList); + + /** this should be called for each scene attribute */ + void processSceneAttribute( const sax_fastparser::FastAttributeList::FastAttributeIter & aIter ); + + /** this sets the scene attributes at this propertyset */ + void setSceneAttributes( const css::uno::Reference< css::beans::XPropertySet >& xPropSet ); +}; + + +class SvXMLShapeContext : public SvXMLImportContext +{ +protected: + css::uno::Reference< css::drawing::XShape > mxShape; + bool mbTemporaryShape; + OUString msHyperlink; + +public: + SvXMLShapeContext( SvXMLImport& rImp, bool bTemporaryShape ) : SvXMLImportContext( rImp ), mbTemporaryShape(bTemporaryShape) {} + + + const css::uno::Reference< css::drawing::XShape >& getShape() const { return mxShape; } + + void setHyperlink( const OUString& rHyperlink ); +}; + + +struct XMLShapeImportHelperImpl; +struct XMLShapeImportPageContextImpl; +struct SdXMLEventContextData; + +class XMLOFF_DLLPUBLIC XMLShapeImportHelper : public salhelper::SimpleReferenceObject +{ + std::unique_ptr mpImpl; + + std::shared_ptr mpPageContext; + + // PropertySetMappers and factory + rtl::Reference mpSdPropHdlFactory; + rtl::Reference mpPropertySetMapper; + rtl::Reference mpPresPagePropsMapper; + + // contexts for Style and AutoStyle import + rtl::Reference mxStylesContext; + rtl::Reference mxAutoStylesContext; + + rtl::Reference< XMLTableImport > mxShapeTableImport; + +protected: + SvXMLImport& mrImporter; + +public: + XMLShapeImportHelper( SvXMLImport& rImporter, + const css::uno::Reference< css::frame::XModel>& rModel, + SvXMLImportPropertyMapper *pExtMapper=nullptr ); + + virtual ~XMLShapeImportHelper() override; + + static SvXMLShapeContext* CreateGroupChildContext( + SvXMLImport& rImport, sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, + css::uno::Reference< css::drawing::XShapes > const & rShapes, + bool bTemporaryShape = false); + + static SvXMLShapeContext* CreateFrameChildContext( + SvXMLImport& rImport, sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, + css::uno::Reference< css::drawing::XShapes > const & rShapes, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xFrameAttrList); + static css::uno::Reference< css::xml::sax::XFastContextHandler > CreateFrameChildContext( + SvXMLImportContext *pThisContext, sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ); + + static SvXMLShapeContext* Create3DSceneChildContext( + SvXMLImport& rImport, sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, + css::uno::Reference< css::drawing::XShapes > const & rShapes); + + // Styles and AutoStyles contexts + SvXMLStylesContext* GetStylesContext() const { return mxStylesContext.get(); } + void SetStylesContext(SvXMLStylesContext* pNew); + SvXMLStylesContext* GetAutoStylesContext() const { return mxAutoStylesContext.get(); } + void SetAutoStylesContext(SvXMLStylesContext* pNew); + + // get factories and mappers + SvXMLImportPropertyMapper* GetPropertySetMapper() const { return mpPropertySetMapper.get(); } + SvXMLImportPropertyMapper* GetPresPagePropsMapper() const { return mpPresPagePropsMapper.get(); } + + // this function is called whenever the implementation classes like to add this new + // shape to the given XShapes. + virtual void addShape( + css::uno::Reference< css::drawing::XShape >& rShape, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, + css::uno::Reference< css::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( + css::uno::Reference< css::drawing::XShape >& rShape, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, + css::uno::Reference< css::drawing::XShapes >& rShapes); + + // tdf#127791 help function for group shape events + void addShapeEvents(SdXMLEventContextData& rData); + + // helper functions processing groups after their component shapes are collected + // e.g. for z-order sorting or adding events to the group + void pushGroupForPostProcessing( css::uno::Reference< css::drawing::XShapes >& rShapes ); + void popGroupAndPostProcess(); + + void shapeWithZIndexAdded( css::uno::Reference< css::drawing::XShape > const & rShape, + sal_Int32 nZIndex ); + /// Updates the z-order of other shapes to be consistent again, needed due + /// to the removal of rShape. + void shapeRemoved(const css::uno::Reference& rShape); + + void addShapeConnection( css::uno::Reference< css::drawing::XShape > const & rConnectorShape, + bool bStart, + const OUString& rDestShapeId, + sal_Int32 nDestGlueId ); + + /** adds a mapping for a gluepoint identifier from an xml file to the identifier created after inserting + the new gluepoint into the core. The saved mappings can be retrieved by getGluePointId() */ + void addGluePointMapping( css::uno::Reference< css::drawing::XShape > const & xShape, + sal_Int32 nSourceId, sal_Int32 nDestinnationId ); + + /** moves all current DestinationId's for rXShape by n */ + void moveGluePointMapping( const css::uno::Reference< css::drawing::XShape >& xShape, const sal_Int32 n ); + + /** retrieves a mapping for a gluepoint identifier from the current xml file to the identifier created after + inserting the new gluepoint into the core. The mapping must be initialized first with addGluePointMapping() */ + sal_Int32 getGluePointId( const css::uno::Reference< css::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( css::uno::Reference< css::drawing::XShapes > const & 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( css::uno::Reference< css::drawing::XShapes > const & rShapes ); + + void restoreConnections(); + + /** creates a property mapper for external chaining */ + static SvXMLImportPropertyMapper* CreateShapePropMapper( + const css::uno::Reference< css::frame::XModel>& rModel, SvXMLImport& rImport ); + + /** defines if the import should increment the progress bar or not */ + void enableHandleProgressBar(); + bool IsHandleProgressBarEnabled() const; + + /** queries the capability of the current model to create presentation shapes */ + bool IsPresentationShapesSupported() const; + + XMLSdPropHdlFactory* GetSdPropHdlFactory() const { return mpSdPropHdlFactory.get(); } + + const rtl::Reference< XMLTableImport >& GetShapeTableImport(); +}; + +#endif // INCLUDED_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 000000000..4cd11971c --- /dev/null +++ b/include/xmloff/styleexp.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 INCLUDED_XMLOFF_STYLEEXP_HXX +#define INCLUDED_XMLOFF_STYLEEXP_HXX + +#include +#include +#include + +#include + +namespace com::sun::star::uno { template class Reference; } +namespace rtl { template class Reference; } + +namespace com::sun::star +{ + namespace style + { + class XStyle; + } + namespace beans + { + class XPropertySet; + } + namespace container + { + class XNameAccess; + } + +} + +class SvXMLExportPropertyMapper; +class SvXMLAutoStylePoolP; +class SvXMLExport; +enum class XmlStyleFamily; + +class XMLOFF_DLLPUBLIC XMLStyleExport : public salhelper::SimpleReferenceObject +{ + SvXMLExport& rExport; + SvXMLAutoStylePoolP *pAutoStylePool; + +protected: + SvXMLExport& GetExport() { return rExport; } + const SvXMLExport& GetExport() const { return rExport; } + + bool exportStyle( + const css::uno::Reference< css::style::XStyle > & rStyle, + const OUString& rXMLFamily, + const rtl::Reference < SvXMLExportPropertyMapper >& rPropMapper, + const css::uno::Reference< css::container::XNameAccess > & xStyles, + const OUString* pPrefix ); + + virtual void exportStyleAttributes( + const css::uno::Reference< css::style::XStyle > & rStyle ); + + virtual void exportStyleContent( + const css::uno::Reference< css::style::XStyle > & rStyle ); +public: + XMLStyleExport( + SvXMLExport& rExp, + SvXMLAutoStylePoolP *pAutoStyleP=nullptr ); + virtual ~XMLStyleExport() override; + +// void exportStyleFamily( +// const OUString& rFamily, const OUString& rXMLFamily, +// const rtl::Reference < XMLPropertySetMapper >& rPropMapper, +// bool bUsed, sal_uInt16 nFamily = 0, +// const OUString* pPrefix = 0); + +// void exportStyleFamily( +// const char *pFamily, const OUString& rXMLFamily, +// const rtl::Reference < XMLPropertySetMapper >& rPropMapper, +// bool bUsed, sal_uInt16 nFamily = 0, +// const OUString* pPrefix = 0); + + void exportDefaultStyle( + const css::uno::Reference< css::beans::XPropertySet > & xPropSet, + const OUString& rXMLFamily, + const rtl::Reference < SvXMLExportPropertyMapper >& rPropMapper ); + + void exportStyleFamily( + const OUString& rFamily, const OUString& rXMLFamily, + const rtl::Reference < SvXMLExportPropertyMapper >& rPropMapper, + bool bUsed, XmlStyleFamily nFamily, + const OUString* pPrefix = nullptr); + + void exportStyleFamily( + const char *pFamily, const OUString& rXMLFamily, + const rtl::Reference < SvXMLExportPropertyMapper >& rPropMapper, + bool bUsed, XmlStyleFamily nFamily, + const OUString* pPrefix = nullptr); +}; + +#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 000000000..dfdb08d73 --- /dev/null +++ b/include/xmloff/table/XMLTableExport.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 INCLUDED_XMLOFF_TABLE_XMLTABLEEXPORT_HXX +#define INCLUDED_XMLOFF_TABLE_XMLTABLEEXPORT_HXX + +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +class SvXMLExport; +class SvXMLExportPropertyMapper; + +typedef std::map< const css::uno::Reference< css::uno::XInterface >, OUString > TableStyleMap; + +struct XMLTableInfo +{ + TableStyleMap maColumnStyleMap; + TableStyleMap maRowStyleMap; + TableStyleMap maCellStyleMap; + std::vector< OUString > maDefaultRowCellStyles; +}; + +class XMLOFF_DLLPUBLIC XMLTableExport final : public salhelper::SimpleReferenceObject +{ +public: + XMLTableExport(SvXMLExport& rExp, const rtl::Reference< SvXMLExportPropertyMapper >& xCellExportPropertySetMapper, const rtl::Reference< XMLPropertyHandlerFactory >& xFactoryRef ); + virtual ~XMLTableExport() override; + + // This method collects all automatic styles for the given table + void collectTableAutoStyles(const css::uno::Reference < css::table::XColumnRowRange >& xColumnRowRange); + + // This method exports the given table + void exportTable(const css::uno::Reference < css::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; + std::map< const css::uno::Reference< css::table::XColumnRowRange >, std::shared_ptr< XMLTableInfo > > + maTableInfoMap; + bool mbExportTables; + bool mbWriter; + + SvXMLExport& GetExport() { return mrExport; } + const SvXMLExport& GetExport() const { return mrExport; } + + SAL_DLLPRIVATE void ImpExportText( const css::uno::Reference < css::table::XCell >& xCell ); + + void ExportCell( const css::uno::Reference < css::table::XCell >& xCell, const std::shared_ptr< XMLTableInfo >& pTableInfo, std::u16string_view sDefaultCellStyle ); + void ExportTableColumns( const css::uno::Reference < css::container::XIndexAccess >& xtableColumns, const std::shared_ptr< XMLTableInfo >& pTableInfo ); + +}; + +class XMLOFF_DLLPUBLIC XMLCellStyleExport final : public XMLStyleExport +{ + using XMLStyleExport::XMLStyleExport; + virtual void exportStyleAttributes(const css::uno::Reference& rStyle) override; + virtual void exportStyleContent(const css::uno::Reference& rStyle) override; +}; + +#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 000000000..c0f702b5c --- /dev/null +++ b/include/xmloff/table/XMLTableImport.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 INCLUDED_XMLOFF_TABLE_XMLTABLEIMPORT_HXX +#define INCLUDED_XMLOFF_TABLE_XMLTABLEIMPORT_HXX + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include + +class SvXMLStyleContext; + +typedef std::map< OUString, OUString > XMLTableTemplate; +typedef std::map < OUString, std::shared_ptr< XMLTableTemplate > > XMLTableTemplateMap; + +class XMLOFF_DLLPUBLIC XMLTableImport final : public salhelper::SimpleReferenceObject +{ + friend class XMLTableImportContext; + +public: + XMLTableImport( SvXMLImport& rImport, const rtl::Reference< XMLPropertySetMapper >& xCellPropertySetMapper, const rtl::Reference< XMLPropertyHandlerFactory >& xFactoryRef ); + virtual ~XMLTableImport() override; + + SvXMLImportContext* CreateTableContext( css::uno::Reference< css::table::XColumnRowRange > const & xColumnRowRange ); + + SvXMLStyleContext* CreateTableTemplateContext( sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ); + + const rtl::Reference< SvXMLImportPropertyMapper >& GetCellImportPropertySetMapper() const { return mxCellImportPropertySetMapper; } + const rtl::Reference< SvXMLImportPropertyMapper >& GetRowImportPropertySetMapper() const { return mxRowImportPropertySetMapper; } + const rtl::Reference< SvXMLImportPropertyMapper >& GetColumnImportPropertySetMapper() const { return mxColumnImportPropertySetMapper; } + + void addTableTemplate( const OUString& rsStyleName, XMLTableTemplate& xTableTemplate ); + /// Inserts to the doc template with given name. + void insertTabletemplate( const OUString& rsStyleName, bool bOverwrite); + /// Inserts all table templates. + void finishStyles(); + +private: + SvXMLImport& mrImport; + rtl::Reference< SvXMLImportPropertyMapper > mxCellImportPropertySetMapper; + rtl::Reference< SvXMLImportPropertyMapper > mxRowImportPropertySetMapper; + rtl::Reference< SvXMLImportPropertyMapper > mxColumnImportPropertySetMapper; + + XMLTableTemplateMap maTableTemplates; +}; + +#endif // INCLUDED_XMLOFF_TABLE_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 000000000..0124bc8eb --- /dev/null +++ b/include/xmloff/txtimp.hxx @@ -0,0 +1,443 @@ +/* -*- 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_TXTIMP_HXX +#define INCLUDED_XMLOFF_TXTIMP_HXX + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +class XMLTextListsHelper; +class SvXMLImportContext; +class SvXMLTokenMap; +class SvXMLImportPropertyMapper; +class SvXMLImport; +class SvXMLStylesContext; +class SvxXMLListStyleContext; +class XMLPropStyleContext; +class SvI18NMap; +template class XMLPropertyBackpatcher; +class XMLEventsImportContext; + +namespace xmloff { + struct ParsedRDFaAttributes; +} + +namespace com::sun::star { +namespace text { + class XText; + class XTextCursor; + class XTextRange; + class XTextContent; + class XFormField; +} +namespace frame { class XModel; } +namespace container { class XNameContainer; class XIndexReplace; } +namespace beans { class XPropertySet; } +namespace xml::sax { class XAttributeList; } +namespace xml::sax { class XFastAttributeList; } +namespace util { struct DateTime; } +} + +namespace rtl { template class Reference; } + +enum XMLTextType +{ + Body, + Cell, + Shape, + TextBox, + HeaderFooter, + Section, + Footnote, + ChangedRegion +}; + +/// variable type (for XMLSetVarFieldImportContext) +enum VarType +{ + VarTypeSimple, + VarTypeUserField, + VarTypeSequence + // see following NOTE! +}; + +// NOTE: these values must be distinct from any in "enum VarType" because they +// are used as keys to SvI18NMap::Add() +#define XML_TEXT_RENAME_TYPE_FRAME 10 +#define XML_TEXT_RENAME_TYPE_TABLE 20 + +class XMLOFF_DLLPUBLIC XMLTextImportHelper : public salhelper::SimpleReferenceObject +{ +private: + XMLTextImportHelper(const XMLTextImportHelper&) = delete; + XMLTextImportHelper& operator=(const XMLTextImportHelper&) = delete; + + struct Impl; + std::unique_ptr m_xImpl; + /// ugly, but implementation of this is in XMLPropertyBackpatcher.cxx + struct BackpatcherImpl; + std::shared_ptr m_xBackpatcherImpl; + static std::shared_ptr MakeBackpatcherImpl(); + +protected: + virtual SvXMLImportContext *CreateTableChildContext( + SvXMLImport& rImport, + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ); + + // access, lazy initialization and destruction of backpatchers + // Code is implemented in XMLPropertyBackpatcher.cxx + inline XMLPropertyBackpatcher& GetFootnoteBP(); + inline XMLPropertyBackpatcher& GetSequenceIdBP(); + inline XMLPropertyBackpatcher< OUString> & GetSequenceNameBP(); + +public: + + XMLTextImportHelper( + css::uno::Reference< css::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); + + virtual ~XMLTextImportHelper() override; + + void dispose(); + + void SetCursor( + const css::uno::Reference< css::text::XTextCursor >& rCursor ); + void ResetCursor(); + + void SetAutoStyles( SvXMLStylesContext *pStyles ); + + SvXMLImportContext *CreateTextChildContext( + SvXMLImport& rImport, + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList, + XMLTextType eType = XMLTextType::Shape ); + + css::uno::Reference< css::text::XText > & GetText(); + css::uno::Reference< css::text::XTextCursor > & GetCursor(); + css::uno::Reference< css::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, + 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, + bool& rIgnoreLeadingSpace ); + // Delete current paragraph + void DeleteParagraph(); + + void InsertControlCharacter( sal_Int16 nControl ); + void InsertTextContent( css::uno::Reference< css::text::XTextContent > const & xContent); + + // Add parameter (#i73509#) + // Add parameter in order to suppress the handling of the list attributes (#i80724#) + OUString SetStyleAndAttrs( + SvXMLImport const & rImport, + const css::uno::Reference< css::text::XTextCursor >& rCursor, + const OUString& rStyleName, + bool bPara, + bool bOutlineLevelAttrFound = false, + sal_Int8 nOutlineLevel = -1, + bool bSetListAttrs = true, + bool bOutlineContentVisible = 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( bool bSetEmpty ); + + void SetHyperlink( + SvXMLImport const & rImport, + const css::uno::Reference< css::text::XTextCursor >& rCursor, + const OUString& rHRef, + const OUString& rName, + const OUString& rTargetFrameName, + const OUString& rStyleName, + const OUString& rVisitedStyleName, + XMLEventsImportContext* pEvents); + void SetRuby( + SvXMLImport const & rImport, + const css::uno::Reference< css::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, + bool* pIsSystemLanguage = nullptr ); + + 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; + XMLPropStyleContext* FindDrawingPage(OUString const& rName) const; + + const css::uno::Reference< css::container::XNameContainer> & GetParaStyles() const; + + const css::uno::Reference< css::container::XNameContainer> & GetTextStyles() const; + + const css::uno::Reference< css::container::XNameContainer> & + GetNumberingStyles() const; + + const css::uno::Reference< css::container::XNameContainer> & GetFrameStyles() const; + + const css::uno::Reference< css::container::XNameContainer> & GetPageStyles() const; + + const css::uno::Reference< css::container::XNameContainer> & GetCellStyles() const; + + const css::uno::Reference< css::container::XIndexReplace > & + GetChapterNumbering() const; + + bool HasFrameByName( const OUString& rName ) const; + + bool IsDuplicateFrame(const OUString& sName, sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight) const; + void StoreLastImportedFrameName(const OUString& rName); + void ClearLastImportedTextFrameName(); + + void ConnectFrameChains( const OUString& rFrmName, + const OUString& rNextFrmName, + const css::uno::Reference< css::beans::XPropertySet >& rFrmPropSet ); + + rtl::Reference< SvXMLImportPropertyMapper > const& + GetParaImportPropertySetMapper() const; + rtl::Reference< SvXMLImportPropertyMapper > const& + GetTextImportPropertySetMapper() const; + rtl::Reference< SvXMLImportPropertyMapper > const& + GetSectionImportPropertySetMapper() const; + rtl::Reference< SvXMLImportPropertyMapper > const& + GetRubyImportPropertySetMapper() const; + + static SvXMLImportPropertyMapper *CreateShapeExtPropMapper(SvXMLImport&); + static SvXMLImportPropertyMapper *CreateParaExtPropMapper(SvXMLImport&); + static SvXMLImportPropertyMapper* CreateParaDefaultExtPropMapper(SvXMLImport&); + static SvXMLImportPropertyMapper* CreateTableDefaultExtPropMapper(SvXMLImport&); + static SvXMLImportPropertyMapper* CreateTableRowDefaultExtPropMapper(SvXMLImport&); + static SvXMLImportPropertyMapper* CreateTableCellExtPropMapper(SvXMLImport&); + static SvXMLImportPropertyMapper* CreateDrawingPageExtPropMapper(SvXMLImport&); + + SvI18NMap& GetRenameMap(); + + /// save the start of a range reference + void InsertBookmarkStartRange( + const OUString & sName, + const css::uno::Reference< css::text::XTextRange> & rRange, + OUString const& i_rXmlId, + std::shared_ptr< ::xmloff::ParsedRDFaAttributes > & + i_rpRDFaAttributes); + + /// process the start of a range reference + bool FindAndRemoveBookmarkStartRange( + const OUString & sName, + css::uno::Reference< css::text::XTextRange> & o_rRange, + OUString & o_rXmlId, + std::shared_ptr< ::xmloff::ParsedRDFaAttributes > & o_rpRDFaAttributes); + + void pushFieldCtx( const OUString& name, const OUString& type ); + css::uno::Reference popFieldCtx(); + void addFieldParam( const OUString& name, const OUString& value ); + void setCurrentFieldParamsTo(css::uno::Reference< css::text::XFormField> const &xFormField); + ::std::pair getCurrentFieldType() const; + css::uno::Reference getCurrentFieldStart() const; + bool hasCurrentFieldSeparator() const; + bool hasCurrentFieldCtx() const; + + + /// 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 css::uno::Reference< css::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 css::uno::Reference< css::beans::XPropertySet> & xPropSet); + + bool IsInFrame() const; + virtual bool IsInHeaderFooter() const; + + virtual css::uno::Reference< css::beans::XPropertySet> + createAndInsertOLEObject( SvXMLImport& rImport, + const OUString& rHRef, + const OUString &rStyleName, + const OUString &rTblName, + sal_Int32 nWidth, sal_Int32 nHeight ); + + virtual css::uno::Reference< css::beans::XPropertySet> + createAndInsertOOoLink( SvXMLImport& rImport, + const OUString& rHRef, + const OUString &rStyleName, + const OUString &rTblName, + sal_Int32 nWidth, sal_Int32 nHeight ); + + virtual css::uno::Reference< css::beans::XPropertySet> + createAndInsertApplet( + const OUString &rName, + const OUString &rCode, + bool bMayScript, + const OUString& rHRef, + sal_Int32 nWidth, sal_Int32 nHeight ); + + virtual css::uno::Reference< css::beans::XPropertySet> + createAndInsertPlugin( + const OUString &rMimeType, + const OUString& rHRef, + sal_Int32 nWidth, sal_Int32 nHeight ); + + virtual css::uno::Reference< css::beans::XPropertySet> + createAndInsertFloatingFrame( + const OUString &rName, + const OUString &rHRef, + const OUString &rStyleName, + sal_Int32 nWidth, sal_Int32 nHeight ); + + virtual void endAppletOrPlugin( + const css::uno::Reference< css::beans::XPropertySet> &rPropSet, + ::std::map < const OUString, OUString > &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( + /// redline type (insert, del,... ) + const OUString& rType, + /// use to identify this redline + const OUString& rId, + /// name of the author + const OUString& rAuthor, + /// redline comment + const OUString& rComment, + /// date+time + const css::util::DateTime& rDateTime, + /// merge last paras + bool bMergeLastParagraph); + + virtual css::uno::Reference< css::text::XTextCursor> RedlineCreateText( + /// needed to get the document + css::uno::Reference< css::text::XTextCursor > & rOldCursor, + /// ID used to RedlineAdd() call + const OUString& rId); + + virtual void RedlineSetCursor( + /// ID used to RedlineAdd() call + const OUString& rId, + /// start or end Cursor + bool bStart, + /// range is not within + bool bIsOutsideOfParagraph); + + virtual void RedlineAdjustStartNodeCursor(); + virtual void SetShowChanges( bool bShowChanges ); + virtual void SetRecordChanges( bool bRecordChanges ); + virtual void SetChangesProtectionKey( + const css::uno::Sequence & rProtectionKey ); + + /// get the last open redline ID + OUString const & GetOpenRedlineId() const; + /// modify the last open redline ID + void SetOpenRedlineId( OUString const & rId); + /// reset the last open redline ID + void ResetOpenRedlineId(); + + /** redlining : Setter to remember the fact we are inside/outside + * a element (deleted redline section) */ + void SetInsideDeleteContext(bool const bNew); + /** redlining : Getter to know if we are inside + * a element (deleted redline section) */ + 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(); + /// pop the list context stack + void PopListContext(); + + void SetCellParaStyleDefault(OUString const& rNewValue); + OUString const& GetCellParaStyleDefault() const; + + void AddCrossRefHeadingMapping(OUString const& rFrom, OUString const& rTo); + void MapCrossRefHeadingFieldsHorribly(); + + void setBookmarkAttributes(OUString const& bookmark, bool hidden, OUString const& condition); + bool getBookmarkHidden(OUString const& bookmark) const; + const OUString& getBookmarkCondition(OUString const& bookmark) const; + +}; + +#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 000000000..860c86961 --- /dev/null +++ b/include/xmloff/txtimppr.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 INCLUDED_XMLOFF_TXTIMPPR_HXX +#define INCLUDED_XMLOFF_TXTIMPPR_HXX + +#include +#include +#include + +class XMLOFF_DLLPUBLIC XMLTextImportPropertyMapper final : public SvXMLImportPropertyMapper +{ + sal_Int32 nSizeTypeIndex; + sal_Int32 nWidthTypeIndex; + + static void FontFinished( + XMLPropertyState *pFontFamilyNameState, + XMLPropertyState *pFontStyleNameState, + XMLPropertyState *pFontFamilyState, + XMLPropertyState *pFontPitchState, + XMLPropertyState *pFontCharsetState ); + + void FontDefaultsCheck( + XMLPropertyState const * pFontFamilyName, + XMLPropertyState const * pFontStyleName, + XMLPropertyState const * pFontFamily, + XMLPropertyState const * pFontPitch, + XMLPropertyState const * pFontCharSet, + std::optional* ppNewFontStyleName, + std::optional* ppNewFontFamily, + std::optional* ppNewFontPitch, + std::optional* ppNewFontCharSet ) const; + + virtual bool handleSpecialItem( + XMLPropertyState& rProperty, + ::std::vector< XMLPropertyState >& rProperties, + const OUString& rValue, + const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap ) const override; +public: + XMLTextImportPropertyMapper( + const rtl::Reference< XMLPropertySetMapper >& rMapper, + SvXMLImport& rImport ); + virtual ~XMLTextImportPropertyMapper() override; + + /** 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 override; +}; + +#endif // INCLUDED_XMLOFF_TXTIMPPR_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 000000000..e474a9c5b --- /dev/null +++ b/include/xmloff/txtparae.hxx @@ -0,0 +1,582 @@ +/* -*- 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_TXTPARAE_HXX +#define INCLUDED_XMLOFF_TXTPARAE_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class XMLTextListsHelper; +class SvXMLExport; +class SvXMLAutoStylePoolP; +class XMLTextFieldExport; +class XMLTextNumRuleInfo; +class XMLSectionExport; +class XMLIndexMarkExport; +class XMLRedlineExport; +struct XMLPropertyState; +class MultiPropertySetHelper; +enum class XMLShapeExportFlags; +class SvXMLExportPropertyMapper; + +namespace com::sun::star +{ + namespace beans { class XPropertySet; class XPropertyState; + class XPropertySetInfo; } + namespace container { class XEnumeration; class XIndexAccess; class XNameReplace; } + namespace text { class XTextContent; class XTextRange; class XText; + class XFootnote; class XTextFrame; class XTextSection; + class XTextField; } +} + +namespace xmloff +{ + class OFormLayerXMLExport; + class BoundFrameSets; + +} + +namespace basegfx +{ + class B2DPoint; +} + +enum class TextPNS +{ + ODF, + EXTENSION +}; + +class XMLOFF_DLLPUBLIC XMLTextParagraphExport : public XMLStyleExport +{ + struct Impl; + std::unique_ptr m_xImpl; + +// SvXMLExport& rExport; + SvXMLAutoStylePoolP& rAutoStylePool; + rtl::Reference < SvXMLExportPropertyMapper > xParaPropMapper; + rtl::Reference < SvXMLExportPropertyMapper > xTextPropMapper; + rtl::Reference < SvXMLExportPropertyMapper > xFramePropMapper; + rtl::Reference < SvXMLExportPropertyMapper > xAutoFramePropMapper; + rtl::Reference < SvXMLExportPropertyMapper > xSectionPropMapper; + rtl::Reference < SvXMLExportPropertyMapper > xRubyPropMapper; + + const ::std::unique_ptr< ::xmloff::BoundFrameSets > pBoundFrameSets; + std::unique_ptr pFieldExport; + std::vector maListElements; + XMLTextListAutoStylePool maListAutoPool; + std::unique_ptr pSectionExport; + std::unique_ptr pIndexMarkExport; + + /// may be NULL (if no redlines should be exported; e.g. in block mode) + std::unique_ptr pRedlineExport; + + bool bProgress; + + bool bBlock; + + // keep track of open rubies + OUString sOpenRubyText; + OUString sOpenRubyCharStyle; + bool bOpenRuby; + + XMLTextListsHelper* mpTextListsHelper; + ::std::vector< std::unique_ptr > maTextListsHelperStack; + + bool mbCollected; + + enum class FrameType { Text, Graphic, Embedded, Shape }; +public: + + enum FieldmarkType { NONE, TEXT, CHECK }; // Used for simulating fieldmarks in OpenDocument 1.n Strict (for n <= 2). CHECK currently ignored. + + + void exportTextRangeSpan( + const css::uno::Reference< css::text::XTextRange > & rTextRange, + css::uno::Reference< css::beans::XPropertySet > const & xPropSet, + css::uno::Reference < css::beans::XPropertySetInfo > & xPropSetInfo, + const bool bIsUICharStyle, + const bool bHasAutoStyle, + const OUString& sStyle, + bool& rPrevCharIsSpace, + FieldmarkType& openFieldMark); + +private: + + // Implement Title/Description Elements UI (#i73249#) + static constexpr OUStringLiteral gsAnchorCharStyleName = u"AnchorCharStyleName"; + static constexpr OUStringLiteral gsBeginNotice = u"BeginNotice"; + static constexpr OUStringLiteral gsCategory = u"Category"; + static constexpr OUStringLiteral gsCharStyleName = u"CharStyleName"; + static constexpr OUStringLiteral gsCharStyleNames = u"CharStyleNames"; + static constexpr OUStringLiteral gsEndNotice = u"EndNotice"; + static constexpr OUStringLiteral gsFootnote = u"Footnote"; + static constexpr OUStringLiteral gsFootnoteCounting = u"FootnoteCounting"; + static constexpr OUStringLiteral gsNumberingType = u"NumberingType"; + static constexpr OUStringLiteral gsPageDescName = u"PageDescName"; + static constexpr OUStringLiteral gsPageStyleName = u"PageStyleName"; + static constexpr OUStringLiteral gsParaStyleName = u"ParaStyleName"; + static constexpr OUStringLiteral gsPositionEndOfDoc = u"PositionEndOfDoc"; + static constexpr OUStringLiteral gsPrefix = u"Prefix"; + static constexpr OUStringLiteral gsReferenceId = u"ReferenceId"; + static constexpr OUStringLiteral gsStartAt = u"StartAt"; + static constexpr OUStringLiteral gsSuffix = u"Suffix"; + static constexpr OUStringLiteral gsTextEndnoteService = u"com.sun.star.text.Endnote"; + static constexpr OUStringLiteral gsTextSection = u"TextSection"; + +protected: + static constexpr OUStringLiteral gsFrameStyleName = u"FrameStyleName"; + SinglePropertySetInfoCache aCharStyleNamesPropInfoCache; + + SvXMLAutoStylePoolP& GetAutoStylePool() { return rAutoStylePool; } + const SvXMLAutoStylePoolP& GetAutoStylePool() const { return rAutoStylePool; } + +public: + const rtl::Reference < SvXMLExportPropertyMapper >& GetParaPropMapper() const + { + return xParaPropMapper; + } + + const rtl::Reference < SvXMLExportPropertyMapper >& GetTextPropMapper() const + { + return xTextPropMapper; + } + + const rtl::Reference < SvXMLExportPropertyMapper >& GetAutoFramePropMapper() const + { + return xAutoFramePropMapper; + } + const rtl::Reference < SvXMLExportPropertyMapper >& GetSectionPropMapper() const + { + return xSectionPropMapper; + } + const rtl::Reference < SvXMLExportPropertyMapper >& GetRubyPropMapper() const + { + return xRubyPropMapper; + } + + OUString FindTextStyle( + const css::uno::Reference< css::beans::XPropertySet > & rPropSet, + bool& rbHasCharStyle, + bool& rbHasAutoStyle, + const XMLPropertyState** pAddState = nullptr) const; + + void exportTextRangeEnumeration( + const css::uno::Reference< css::container::XEnumeration > & rRangeEnum, + bool bAutoStyles, bool bProgress, bool & rPrevCharIsSpace); + +protected: + + XMLShapeExportFlags addTextFrameAttributes( + const css::uno::Reference< css::beans::XPropertySet >& rPropSet, + bool bShape, + basegfx::B2DPoint* pCenter = nullptr, + OUString *pMinHeightValue = nullptr, + OUString *pMinWidthValue = nullptr ); + + virtual void exportStyleAttributes( + const css::uno::Reference< css::style::XStyle > & rStyle ) override; + + void exportPageFrames( bool bProgress ); + void exportFrameFrames( bool bAutoStyles, bool bProgress, + const css::uno::Reference< css::text::XTextFrame > *pParentTxtFrame ); + + void exportNumStyles( bool bUsed ); + + void exportText( + const css::uno::Reference < + css::text::XText > & rText, + bool bAutoStyles, bool bProgress, bool bExportParagraph, TextPNS eExtensionNS = TextPNS::ODF ); + + void exportText( + const css::uno::Reference< css::text::XText > & rText, + const css::uno::Reference< css::text::XTextSection > & rBaseSection, + bool bAutoStyles, bool bProgress, bool bExportParagraph ); + + void exportTextContentEnumeration( + const css::uno::Reference< css::container::XEnumeration > & rContentEnum, + bool bAutoStyles, + const css::uno::Reference< css::text::XTextSection > & rBaseSection, + bool bProgress, + bool bExportParagraph = true, + const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet = nullptr, + TextPNS eExtensionNS = TextPNS::ODF); + void exportParagraph( + const css::uno::Reference< css::text::XTextContent > & rTextContent, + bool bAutoStyles, bool bProgress, + bool bExportParagraph, + MultiPropertySetHelper& rPropSetHelper, + TextPNS eExtensionNS); + + virtual void exportTable( + const css::uno::Reference< css::text::XTextContent > & rTextContent, + bool bAutoStyles, bool bProgress ); + + void exportTextField( + const css::uno::Reference< css::text::XTextRange > & rTextRange, + bool bAutoStyles, bool bProgress, bool * pPrevCharIsSpace); + + void exportTextField( + const css::uno::Reference< css::text::XTextField> & xTextField, + const bool bAutoStyles, const bool bProgress, + const bool bRecursive, bool * pPrevCharIsSpace); + + void exportAnyTextFrame( + const css::uno::Reference< css::text::XTextContent > & rTextContent, + FrameType eTxpe, + bool bAutoStyles, bool bProgress, bool bExportContent, + const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet ); + void _exportTextFrame( + const css::uno::Reference< css::beans::XPropertySet > & rPropSet, + const css::uno::Reference< css::beans::XPropertySetInfo > & rPropSetInfo, + bool bProgress ); + inline void exportTextFrame( + const css::uno::Reference< css::text::XTextContent > & rTextContent, + bool bAutoStyles, bool bProgress, bool bExportContent, + const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet = nullptr ); + inline void exportShape( + const css::uno::Reference< css::text::XTextContent > & rTextContent, + bool bAutoStyles, + const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet = nullptr ); + + void exportContour( + const css::uno::Reference< css::beans::XPropertySet > & rPropSet, + const css::uno::Reference< css::beans::XPropertySetInfo > & rPropSetInfo ); + void _exportTextGraphic( + const css::uno::Reference< css::beans::XPropertySet > & rPropSet, + const css::uno::Reference< css::beans::XPropertySetInfo > & rPropSetInfo ); + inline void exportTextGraphic( + const css::uno::Reference< css::text::XTextContent > & rTextContent, + bool bAutoStyles, + const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet = nullptr ); + + virtual void _collectTextEmbeddedAutoStyles( + const css::uno::Reference< css::beans::XPropertySet > & rPropSet ); + virtual void _exportTextEmbedded( + const css::uno::Reference< css::beans::XPropertySet > & rPropSet, + const css::uno::Reference< css::beans::XPropertySetInfo > & rPropSetInfo ); + inline void exportTextEmbedded( + const css::uno::Reference< css::text::XTextContent > & rTextContent, + bool bAutoStyles, + const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet = nullptr ); + + /// export a footnote and styles + void exportTextFootnote( + const css::uno::Reference< css::beans::XPropertySet > & rPropSet, + const OUString& sString, + bool bAutoStyles, bool bProgress ); + + /// helper for exportTextFootnote + void exportTextFootnoteHelper( + const css::uno::Reference< css::text::XFootnote > & rPropSet, + const css::uno::Reference< css::text::XText> & rText, + const OUString& sString, + bool bAutoStyles, + bool bIsEndnote, bool bProgress ); + + /// export footnote and endnote configuration elements + void exportTextFootnoteConfiguration(); + + void exportTextFootnoteConfigurationHelper( + const css::uno::Reference< css::beans::XPropertySet> & rFootnoteSupplier, + bool bIsEndnote); + + void exportTextMark( + const css::uno::Reference< css::beans::XPropertySet> & xPropSet, + const OUString& rProperty, + const enum ::xmloff::token::XMLTokenEnum pElements[], + bool bAutoStyles); + + void exportSoftPageBreak(); + + void exportTextLineBreak(const css::uno::Reference& xPropSet); + + void exportTextRange( + const css::uno::Reference< css::text::XTextRange > & rTextRange, + bool bAutoStyles, + bool& rPrevCharWasSpace, + FieldmarkType& openFieldmarkType ); + + void exportListChange( const XMLTextNumRuleInfo& rPrvInfo, + const XMLTextNumRuleInfo& rNextInfo ); + + /// check if current section or current list has changed; + /// calls exportListChange as appropriate + void exportListAndSectionChange( + css::uno::Reference< css::text::XTextSection > & rOldSection, + const css::uno::Reference< css::text::XTextSection > & rNewSection, + const XMLTextNumRuleInfo& rOldList, + const XMLTextNumRuleInfo& rNewList, + bool bAutoStyles ); + + /// overload for exportListAndSectionChange; + /// takes new content rather than new section. + void exportListAndSectionChange( + css::uno::Reference< css::text::XTextSection > & rOldSection, + const css::uno::Reference< css::text::XTextContent > & rNewContent, + const XMLTextNumRuleInfo& rOldList, + const XMLTextNumRuleInfo& rNewList, + bool bAutoStyles ); + void exportListAndSectionChange( + css::uno::Reference< css::text::XTextSection > & rOldSection, + MultiPropertySetHelper& rPropSetHelper, + sal_Int16 nTextSectionId, + const css::uno::Reference< css::text::XTextContent > & rNewContent, + const XMLTextNumRuleInfo& rOldList, + const XMLTextNumRuleInfo& rNewList, + bool bAutoStyles ); + + /// export a ruby + void exportRuby( + const css::uno::Reference< css::beans::XPropertySet> & rPortionPropSet, + bool bAutoStyles ); + + /// export a text:meta + void exportMeta( + const css::uno::Reference< css::beans::XPropertySet> & i_xPortion, + bool i_bAutoStyles, bool i_isProgress, bool & rPrevCharIsSpace); + + /// Exports a element. + void ExportContentControl(const css::uno::Reference& xPortion, + bool bAutoStyles, bool isProgress, bool& rPrevCharIsSpace); + + bool isAutoStylesCollected() const { return mbCollected; } + + virtual void exportTableAutoStyles(); + +public: + + XMLTextParagraphExport( + SvXMLExport& rExp, + SvXMLAutoStylePoolP & rASP + ); + virtual ~XMLTextParagraphExport() override; + + /// add autostyle for specified family + void Add( + XmlStyleFamily nFamily, + MultiPropertySetHelper& rPropSetHelper, + const css::uno::Reference< css::beans::XPropertySet > & rPropSet ); + void Add( + XmlStyleFamily nFamily, + const css::uno::Reference< css::beans::XPropertySet > & rPropSet, + o3tl::span aAddStates = {}, bool bDontSeek = false ); + + /// find style name for specified family and parent + OUString Find( + XmlStyleFamily nFamily, + const css::uno::Reference< css::beans::XPropertySet > & rPropSet, + const OUString& rParent, + const o3tl::span aAddStates = {} ) 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( bool bUsed, bool bProg ); + + /// This method exports (text field) declarations etc. + void exportTextDeclarations(); + + /// export the (text field) declarations for a particular XText + void exportTextDeclarations( + const css::uno::Reference< css::text::XText > & rText ); + + /// export all declarations + void exportUsedDeclarations(); + + /// Export the list of change information (enclosed by ) + /// (or the necessary automatic styles) + void exportTrackedChanges(bool bAutoStyle); + + /// Export the list of change information (enclosed by ) + /// (or the necessary automatic styles) + void exportTrackedChanges(const css::uno::Reference< css::text::XText > & rText, + 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 separately via the exportTrackedChanges(bool, + /// Reference) method. + void recordTrackedChangesForXText( + const css::uno::Reference< css::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 exportCharacterData( + const OUString& rText, + bool& rPrevCharWasSpace); + + // This method collects all automatic styles for the given XText + void collectTextAutoStyles( + const css::uno::Reference< css::text::XText > & rText, + bool bIsProgress = false, + bool bExportParagraph = true ) + { + exportText( rText, true, bIsProgress, bExportParagraph ); + } + + void collectTextAutoStyles( + const css::uno::Reference< css::text::XText > & rText, + const css::uno::Reference< css::text::XTextSection > & rBaseSection, + bool bIsProgress ) + { + exportText( rText, rBaseSection, true, bIsProgress, true/*bExportParagraph*/ ); + } + + // It the model implements the xAutoStylesSupplier interface, the automatic + // styles can exported without iterating over the text portions + void collectTextAutoStylesOptimized( bool bIsProgress ); + + // This method exports all automatic styles that have been collected. + void exportTextAutoStyles(); + + void exportEvents( const css::uno::Reference< css::beans::XPropertySet > & rPropSet ); + + // Implement Title/Description Elements UI (#i73249#) + void exportTitleAndDescription( const css::uno::Reference< css::beans::XPropertySet > & rPropSet, + const css::uno::Reference< css::beans::XPropertySetInfo > & rPropSetInfo ); + + // This method exports the given XText + void exportText( + const css::uno::Reference< css::text::XText > & rText, + bool bIsProgress = false, + bool bExportParagraph = true, TextPNS eExtensionNS = TextPNS::ODF) + { + exportText( rText, false, bIsProgress, bExportParagraph, eExtensionNS ); + } + + void exportText( + const css::uno::Reference< css::text::XText > & rText, + const css::uno::Reference< css::text::XTextSection > & rBaseSection, + bool bIsProgress) + { + exportText( rText, rBaseSection, false, bIsProgress, true/*bExportParagraph*/ ); + } + + void exportFramesBoundToPage( bool bIsProgress ) + { + exportPageFrames( bIsProgress ); + } + inline const XMLTextListAutoStylePool& GetListAutoStylePool() const; + + void SetBlockMode( bool bSet ) { bBlock = bSet; } + bool IsBlockMode() const { return bBlock; } + + + const rtl::Reference < 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 that it needs to access the + * XMLSectionExport, which is only available here. + */ + void PreventExportOfControlsInMuteSections( + const css::uno::Reference< css::container::XIndexAccess> & rShapes, + const rtl::Reference& xFormExport ); + + SinglePropertySetInfoCache& GetCharStyleNamesPropInfoCache() { return aCharStyleNamesPropInfoCache; } + + void PushNewTextListsHelper(); + + void PopTextListsHelper(); + +private: + XMLTextParagraphExport(XMLTextParagraphExport const &) = delete; +}; + +inline const XMLTextListAutoStylePool& + XMLTextParagraphExport::GetListAutoStylePool() const +{ + return maListAutoPool; +} + +inline void XMLTextParagraphExport::exportTextFrame( + const css::uno::Reference< css::text::XTextContent > & rTextContent, + bool bAutoStyles, bool bIsProgress, bool bExportContent, + const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet) +{ + exportAnyTextFrame( rTextContent, FrameType::Text, bAutoStyles, bIsProgress, + bExportContent, pRangePropSet ); +} + +inline void XMLTextParagraphExport::exportTextGraphic( + const css::uno::Reference< css::text::XTextContent > & rTextContent, + bool bAutoStyles, + const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet ) +{ + exportAnyTextFrame( rTextContent, FrameType::Graphic, bAutoStyles, false, + true, pRangePropSet ); +} + +inline void XMLTextParagraphExport::exportTextEmbedded( + const css::uno::Reference< css::text::XTextContent > & rTextContent, + bool bAutoStyles, + const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet ) +{ + exportAnyTextFrame( rTextContent, FrameType::Embedded, bAutoStyles, false, + true, pRangePropSet ); +} + +inline void XMLTextParagraphExport::exportShape( + const css::uno::Reference< css::text::XTextContent > & rTextContent, + bool bAutoStyles, + const css::uno::Reference< css::beans::XPropertySet > *pRangePropSet ) +{ + exportAnyTextFrame( rTextContent, FrameType::Shape, bAutoStyles, false, + 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 000000000..37c0d7a9f --- /dev/null +++ b/include/xmloff/txtprmap.hxx @@ -0,0 +1,233 @@ +/* -*- 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_TXTPRMAP_HXX +#define INCLUDED_XMLOFF_TXTPRMAP_HXX + +#include +#include + +#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) +/* CTF ids for character border to avoid interference between + paragraph and character attributes */ +#define CTF_CHARALLBORDERWIDTH (XML_TEXT_CTF_START + 153) +#define CTF_CHARLEFTBORDERWIDTH (XML_TEXT_CTF_START + 154) +#define CTF_CHARRIGHTBORDERWIDTH (XML_TEXT_CTF_START + 155) +#define CTF_CHARTOPBORDERWIDTH (XML_TEXT_CTF_START + 156) +#define CTF_CHARBOTTOMBORDERWIDTH (XML_TEXT_CTF_START + 157) +#define CTF_CHARALLBORDERDISTANCE (XML_TEXT_CTF_START + 158) +#define CTF_CHARLEFTBORDERDISTANCE (XML_TEXT_CTF_START + 159) +#define CTF_CHARRIGHTBORDERDISTANCE (XML_TEXT_CTF_START + 160) +#define CTF_CHARTOPBORDERDISTANCE (XML_TEXT_CTF_START + 161) +#define CTF_CHARBOTTOMBORDERDISTANCE (XML_TEXT_CTF_START + 162) +#define CTF_CHARALLBORDER (XML_TEXT_CTF_START + 163) +#define CTF_CHARLEFTBORDER (XML_TEXT_CTF_START + 164) +#define CTF_CHARRIGHTBORDER (XML_TEXT_CTF_START + 165) +#define CTF_CHARTOPBORDER (XML_TEXT_CTF_START + 166) +#define CTF_CHARBOTTOMBORDER (XML_TEXT_CTF_START + 167) +#define CTF_RELWIDTHREL (XML_TEXT_CTF_START + 168) +#define CTF_RELHEIGHTREL (XML_TEXT_CTF_START + 169) +#define CTF_CHAR_BACKGROUND (XML_TEXT_CTF_START + 170) +#define CTF_CHAR_BACKGROUND_TRANSPARENCY (XML_TEXT_CTF_START + 171) +#define CTF_CHAR_HIGHLIGHT (XML_TEXT_CTF_START + 172) +#define CTF_FILLSTYLE (XML_TEXT_CTF_START + 173) +#define CTF_FILLCOLOR (XML_TEXT_CTF_START + 174) +#define CTF_PAGENUMBEROFFSET (XML_TEXT_CTF_START + 175) + + +enum class TextPropMap { + TEXT = 0, + PARA = 1, + FRAME = 2, + AUTO_FRAME = 3, + SECTION = 4, + SHAPE = 5, + RUBY = 6, + SHAPE_PARA = 7, + TEXT_ADDITIONAL_DEFAULTS = 8, + TABLE_DEFAULTS = 9, + TABLE_ROW_DEFAULTS = 10, + CELL = 11 +}; + +class XMLOFF_DLLPUBLIC XMLTextPropertySetMapper final : public XMLPropertySetMapper +{ +public: + XMLTextPropertySetMapper( TextPropMap nType, bool bForExport ); + virtual ~XMLTextPropertySetMapper() override; + + static const XMLPropertyMapEntry* getPropertyMapForType( TextPropMap _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 000000000..aa5627c0e --- /dev/null +++ b/include/xmloff/txtstyli.hxx @@ -0,0 +1,100 @@ +/* -*- 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_TXTSTYLI_HXX +#define INCLUDED_XMLOFF_TXTSTYLI_HXX + +#include + +#include + +#include +#include + +class XMLEventsImportContext; + +class XMLOFF_DLLPUBLIC XMLTextStyleContext : public XMLPropStyleContext +{ + OUString m_sListStyleName; + OUString m_sCategoryVal; + OUString m_sDropCapTextStyleName; + OUString m_sMasterPageName; + OUString m_sDataStyleName; // for grid columns only + + sal_Int8 m_nOutlineLevel; + + bool m_isAutoUpdate : 1; + bool m_bHasMasterPageName : 1; + + bool m_bHasCombinedCharactersLetter : 1; + + // Introduce import of empty list style (#i69523#) + bool m_bListStyleSet : 1; + + rtl::Reference m_xEventContext; + + /// Reads . + std::optional m_aListLevel; + +protected: + + virtual void SetAttribute( sal_Int32 nElement, + const OUString& rValue ) override; + +public: + + XMLTextStyleContext( SvXMLImport& rImport, + SvXMLStylesContext& rStyles, XmlStyleFamily nFamily, + bool bDefaultStyle = false ); + ~XMLTextStyleContext() override; + + XMLTextStyleContext(const XMLTextStyleContext &) = delete; + XMLTextStyleContext operator=(const XMLTextStyleContext &) = delete; + + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; + + const OUString& GetListStyle() const { return m_sListStyleName; } + // XML import: reconstruction of assignment of paragraph style to outline levels (#i69629#) + bool IsListStyleSet() const + { + return m_bListStyleSet; + } + + const OUString& GetMasterPageName() const { return m_sMasterPageName; } + bool HasMasterPageName() const { return m_bHasMasterPageName; } + const OUString& GetDropCapStyleName() const { return m_sDropCapTextStyleName; } + const OUString& GetDataStyleName() const { return m_sDataStyleName; } + + virtual void CreateAndInsert( bool bOverwrite ) override; + virtual void Finish( bool bOverwrite ) override; + virtual void SetDefaults() override; + + // override FillPropertySet, so we can get at the combined characters + virtual void FillPropertySet( + const css::uno::Reference< css::beans::XPropertySet > & rPropSet ) override; + + bool HasCombinedCharactersLetter() const + { return m_bHasCombinedCharactersLetter; } + + const ::std::vector< XMLPropertyState > & GetProperties_() { return GetProperties(); } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/unoatrcn.hxx b/include/xmloff/unoatrcn.hxx new file mode 100644 index 000000000..8e5556bb1 --- /dev/null +++ b/include/xmloff/unoatrcn.hxx @@ -0,0 +1,82 @@ +/* -*- 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_UNOATRCN_HXX +#define INCLUDED_XMLOFF_UNOATRCN_HXX + +#include + +#include + +#include +#include +#include +#include +#include + +#include + +#include + +extern css::uno::Reference< css::uno::XInterface > SvUnoAttributeContainer_CreateInstance(); + +class XMLOFF_DLLPUBLIC SvUnoAttributeContainer final : + public ::cppu::WeakAggImplHelper3< + css::lang::XServiceInfo, + css::lang::XUnoTunnel, + css::container::XNameContainer > +{ +private: + std::unique_ptr mpContainer; + + SAL_DLLPRIVATE sal_uInt16 getIndexByName(std::u16string_view aName ) + const; + +public: + SvUnoAttributeContainer( std::unique_ptr pContainer = nullptr ); + SvXMLAttrContainerData* GetContainerImpl() const { return mpContainer.get(); } + + static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId() noexcept; + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + // css::container::XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + + // css::container::XNameAccess + virtual css::uno::Any SAL_CALL getByName(const OUString& aName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override; + virtual sal_Bool SAL_CALL hasByName(const OUString& aName) override; + + // css::container::XNameReplace + virtual void SAL_CALL replaceByName(const OUString& aName, const css::uno::Any& aElement) override; + + // css::container::XNameContainer + virtual void SAL_CALL insertByName(const OUString& aName, const css::uno::Any& aElement) override; + virtual void SAL_CALL removeByName(const OUString& Name) override; + + // css::lang::XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/unointerfacetouniqueidentifiermapper.hxx b/include/xmloff/unointerfacetouniqueidentifiermapper.hxx new file mode 100644 index 000000000..332005e72 --- /dev/null +++ b/include/xmloff/unointerfacetouniqueidentifiermapper.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 INCLUDED_XMLOFF_UNOINTERFACETOUNIQUEIDENTIFIERMAPPER_HXX +#define INCLUDED_XMLOFF_UNOINTERFACETOUNIQUEIDENTIFIERMAPPER_HXX + +#include +#include +#include + +#include +#include +#include +#include + +namespace comphelper +{ + +typedef ::std::map< OUString, css::uno::Reference< css::uno::XInterface > > IdMap_t; + +class XMLOFF_DLLPUBLIC UnoInterfaceToUniqueIdentifierMapper +{ + typedef std::deque< OUString > Reserved_t; + +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 css::uno::Reference< css::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 css::uno::Reference< css::uno::XInterface >& rInterface ); + + /** reserves an identifier for later registration. + + @returns + false, if the identifier already exists + */ + bool reserveIdentifier( const OUString& rIdentifier ); + + /** registers the given uno object with reserved identifier. + */ + bool registerReservedReference( const OUString& rIdentifier, const css::uno::Reference< css::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 css::uno::Reference< css::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 css::uno::Reference< css::uno::XInterface >& getReference( const OUString& rIdentifier ) const; + +private: + bool findReference( const css::uno::Reference< css::uno::XInterface >& rInterface, IdMap_t::const_iterator& rIter ) const; + bool findIdentifier( const OUString& rIdentifier, IdMap_t::const_iterator& rIter ) const; + bool findReserved( const OUString& rIdentifier ) const; + bool findReserved( const OUString& rIdentifier, Reserved_t::const_iterator& rIter ) const; + + IdMap_t maEntries; + sal_uInt32 mnNextId; + Reserved_t maReserved; +}; + +} + +#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 000000000..4ab7034ec --- /dev/null +++ b/include/xmloff/xformsexport.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 INCLUDED_XMLOFF_XFORMSEXPORT_HXX +#define INCLUDED_XMLOFF_XFORMSEXPORT_HXX + +#include +#include + +class SvXMLExport; +namespace com::sun::star { + namespace uno { template class Reference; } + namespace uno { template class Sequence; } + namespace beans { class XPropertySet; struct PropertyValue; } + namespace container { class XNameAccess; } +} + + +/** export an XForms model. */ +void exportXForms( SvXMLExport& ); + +OUString getXFormsBindName( const css::uno::Reference& xBinding ); + +OUString getXFormsListBindName( const css::uno::Reference& xBinding ); + +OUString getXFormsSubmissionName( const css::uno::Reference& xBinding ); + + +/** returns the settings of the given XForms container, to be exported as document specific settings +*/ +void XMLOFF_DLLPUBLIC getXFormsSettings( + const css::uno::Reference< css::container::XNameAccess >& _rXForms, + css::uno::Sequence< css::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 000000000..8a7ef2f67 --- /dev/null +++ b/include/xmloff/xformsimport.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 INCLUDED_XMLOFF_XFORMSIMPORT_HXX +#define INCLUDED_XMLOFF_XFORMSIMPORT_HXX + +#include +#include +#include + +class SvXMLImport; +class SvXMLImportContext; + +namespace com::sun::star { + namespace uno { template class Reference; } + namespace uno { template class Sequence; } + 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 ); + +/** perform the actual binding of an XForms-binding with the suitable control + * @param document which contains the XForms-model(s) + * @param pair + */ +void bindXFormsValueBinding( + css::uno::Reference const&, + const std::pair, 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 + */ +void bindXFormsListBinding( + css::uno::Reference const&, + const std::pair, OUString>&); + +/** perform the actual binding of an XForms submission with the suitable control + * @param document which contains the XForms-model(s) + * @param pair + */ +void bindXFormsSubmission( + css::uno::Reference const&, + const std::pair, OUString>&); + +/** applies the given settings to the given XForms container +*/ +void XMLOFF_DLLPUBLIC applyXFormsSettings( + const css::uno::Reference< css::container::XNameAccess >& _rXForms, + const css::uno::Sequence< css::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 000000000..1adc3b786 --- /dev/null +++ b/include/xmloff/xmlaustp.hxx @@ -0,0 +1,135 @@ +/* -*- 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_XMLAUSTP_HXX +#define INCLUDED_XMLOFF_XMLAUSTP_HXX + +#include +#include +#include +#include +#include +#include + +class SvXMLExportPropertyMapper; +class SvXMLNamespaceMap; +class SvXMLAutoStylePoolP_Impl; +class SvXMLAttributeList; +class SvXMLExport; +class SvXMLUnitConverter; +struct XMLPropertyState; +enum class XmlStyleFamily; + +namespace com::sun::star::uno { + template class Sequence; +} + +namespace com::sun::star::uno { template class Reference; } + +namespace com::sun::star::xml::sax { class XDocumentHandler; } +namespace xmloff { struct AutoStyleEntry; } +namespace rtl { template class Reference; } + +class XMLOFF_DLLPUBLIC SvXMLAutoStylePoolP : public salhelper::SimpleReferenceObject +{ + friend class Test; + friend class SvXMLAutoStylePoolP_Impl; + + std::unique_ptr pImpl; + +protected: + + virtual void exportStyleAttributes( + SvXMLAttributeList& rAttrList, + XmlStyleFamily nFamily, + const ::std::vector< XMLPropertyState >& rProperties, + const SvXMLExportPropertyMapper& rPropExp, + const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap + ) const; + +// this method is executed after Properties Export, so you can e.g. export a map or so on + virtual void exportStyleContent( + const css::uno::Reference< css::xml::sax::XDocumentHandler > & rHandler, + XmlStyleFamily nFamily, + const ::std::vector< XMLPropertyState >& rProperties, + const SvXMLExportPropertyMapper& rPropExp, + const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap + ) const; + + +public: + + SvXMLAutoStylePoolP( SvXMLExport& rExport); + + virtual ~SvXMLAutoStylePoolP() override; + + SvXMLExport& GetExport() const; + + /** register a new family with its appropriate instance of a derivation of XMLPropertySetMapper + for family numbers see families.hxx + */ + // TODO: Remove this ugly method as soon as possible + void AddFamily( XmlStyleFamily nFamily, const OUString& rStrName, SvXMLExportPropertyMapper* pMapper, const OUString& aStrPrefix ); + void AddFamily( XmlStyleFamily nFamily, const OUString& rStrName, + const rtl::Reference< SvXMLExportPropertyMapper >& rMapper, + const OUString& rStrPrefix, bool bAsFamily = true ); + void SetFamilyPropSetMapper( XmlStyleFamily nFamily, + const rtl::Reference< SvXMLExportPropertyMapper >& rMapper ); + + /// Register a name that must not be used as a generated name. + void RegisterName( XmlStyleFamily nFamily, const OUString& rName ); + + /// Register a name that may only be used through AddNamed + void RegisterDefinedName(XmlStyleFamily nFamily, const OUString& rName); + + /// retrieve the registered names (names + families) + void GetRegisteredNames( + css::uno::Sequence& aFamilies, + css::uno::Sequence& aNames ); + + /// register (families + names) + void RegisterNames( + css::uno::Sequence const & aFamilies, + css::uno::Sequence const & aNames ); + + /// Add an item set to the pool and return its generated name. + OUString Add( XmlStyleFamily nFamily, ::std::vector< XMLPropertyState >&& rProperties ); + OUString Add( XmlStyleFamily nFamily, const OUString& rParent, ::std::vector< XMLPropertyState >&& rProperties, bool bDontSeek = false ); + bool Add( OUString& rName, XmlStyleFamily nFamily, const OUString& rParent, ::std::vector< XMLPropertyState >&& rProperties ); + + /// Add an item set with a pre-defined name (needed for saving sheets separately in Calc). + bool AddNamed( const OUString& rName, XmlStyleFamily nFamily, const OUString& rParent, + std::vector< XMLPropertyState >&& rProperties ); + + /// Find an item set's name. + OUString Find( XmlStyleFamily 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( XmlStyleFamily nFamily ) const; + + void ClearEntries(); + + std::vector GetAutoStyleEntries() const; +}; + +#endif // INCLUDED_XMLOFF_XMLAUSTP_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 000000000..614a8cae7 --- /dev/null +++ b/include/xmloff/xmlcnimp.hxx @@ -0,0 +1,78 @@ +/* -*- 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_XMLCNIMP_HXX +#define INCLUDED_XMLOFF_XMLCNIMP_HXX + +#include + +#include +#include + +class SvXMLAttrCollection; + +class XMLOFF_DLLPUBLIC SvXMLAttrContainerData +{ +private: + std::unique_ptr pimpl; + +public: + SvXMLAttrContainerData(); + SvXMLAttrContainerData(const SvXMLAttrContainerData &rCopy); + ~SvXMLAttrContainerData(); + + SvXMLAttrContainerData& operator=( const SvXMLAttrContainerData& rCmp ); + SvXMLAttrContainerData& operator=( SvXMLAttrContainerData&& rCmp ) noexcept; + + bool operator ==( const SvXMLAttrContainerData& rCmp ) const; + + bool AddAttr( const OUString& rLName, const OUString& rValue ); + bool AddAttr( const OUString& rPrefix, const OUString& rNamespace, + const OUString& rLName, const OUString& rValue ); + bool AddAttr( const OUString& rPrefix, + const OUString& rLName, + const OUString& rValue ); + + size_t GetAttrCount() const; + OUString GetAttrNamespace( size_t i ) 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; + + bool SetAt( size_t i, + const OUString& rLName, const OUString& rValue ); + bool SetAt( size_t i, + const OUString& rPrefix, const OUString& rNamespace, + const OUString& rLName, const OUString& rValue ); + 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 000000000..bedef86e6 --- /dev/null +++ b/include/xmloff/xmlement.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 INCLUDED_XMLOFF_XMLEMENT_HXX +#define INCLUDED_XMLOFF_XMLEMENT_HXX + +#include +#include + +/** Map an XMLTokenEnum to an enum value. + * To be used with SvXMLUnitConverter::convertEnum(...) + * We store the enum internally as a fixed size field, since there are + * places where we want to store a generic pointer to an array of SvXMLEnumMapEntry + * and we don't want to templatize the class. + */ +template +struct SvXMLEnumMapEntry +{ +private: + ::xmloff::token::XMLTokenEnum eToken; + sal_uInt16 nValue; +public: + SvXMLEnumMapEntry(::xmloff::token::XMLTokenEnum eToken_, EnumT nValue_) + : eToken(eToken_), nValue(static_cast(nValue_)) {} + ::xmloff::token::XMLTokenEnum GetToken() const { return eToken; } + sal_uInt16 GetValue() const { return nValue; } +}; + +#if defined(_MSC_VER) +// specialisation to avoid lots of "C2398: conversion from 'const sal_Int16' to 'sal_uInt16' requires a narrowing conversion" +// errors when compiling on MSVC +template<> +struct SvXMLEnumMapEntry +{ +private: + ::xmloff::token::XMLTokenEnum eToken; + sal_uInt16 nValue; +public: + SvXMLEnumMapEntry(::xmloff::token::XMLTokenEnum eToken_, sal_Int32 nValue_) + : eToken(eToken_), nValue(nValue_) {} + ::xmloff::token::XMLTokenEnum GetToken() const { return eToken; } + sal_uInt16 GetValue() const { return nValue; } +}; +#endif + +#define ENUM_STRING_MAP_ENTRY(name,tok) { name, sizeof(name)-1, tok } + +#define ENUM_STRING_MAP_END() { nullptr, 0, 0 } + +/** Map a const char* (with length) to a sal_uInt16 value. + * To be used with SvXMLUnitConverter::convertEnum(...) + */ +template +struct SvXMLEnumStringMapEntry +{ +private: + const char * pName; + sal_Int32 nNameLength; + sal_uInt16 nValue; +public: + SvXMLEnumStringMapEntry(const char * pName_, sal_Int32 nNameLength_, EnumT nValue_) + : pName(pName_), nNameLength(nNameLength_), nValue(nValue_) {} + const char * GetName() const { return pName; } + sal_Int32 GetNameLength() const { return nNameLength; } + EnumT GetValue() const { return static_cast(nValue); } +}; + +#endif // INCLUDED_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 000000000..2b4c8717d --- /dev/null +++ b/include/xmloff/xmlerror.hxx @@ -0,0 +1,140 @@ +/* -*- 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_XMLERROR_HXX +#define INCLUDED_XMLOFF_XMLERROR_HXX + +#include +#include +#include + +#include + +// 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 +enum class SvXMLErrorFlags { + NO = 0x0000, + DO_NOTHING = 0x0001, + ERROR_OCCURRED = 0x0002, + WARNING_OCCURRED = 0x0004, +}; + +namespace o3tl +{ + template<> struct typed_flags : is_typed_flags {}; +} + +namespace com::sun::star { + namespace uno { template class Sequence; } + namespace uno { template class Reference; } + namespace xml::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 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 css::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 css::uno::Sequence & rParams, /// parameters for error message + const OUString& rExceptionMessage, /// original exception string + const css::uno::Reference & rLocator); /// location + + /** + * throw a SAXParseException that describes the first error that matches + * the given mask + */ + /// @throws css::xml::sax::SAXParseException + void ThrowErrorAsSAXException( sal_Int32 nIdMask ); +}; + +#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 000000000..900a03694 --- /dev/null +++ b/include/xmloff/xmlevent.hxx @@ -0,0 +1,141 @@ +/* -*- 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_XMLEVENT_HXX +#define INCLUDED_XMLOFF_XMLEVENT_HXX + +#include + +namespace com::sun::star::uno { template class Reference; } +namespace com::sun::star::uno { template class Sequence; } + + +/** + * @#file + * + * Several definition used in im- and export of events + */ + +namespace com::sun::star { + namespace xml::sax { class XFastAttributeList; } + 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 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 char* sAPIName; + sal_uInt16 nPrefix; // namespace prefix + const 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 element. + */ +class XMLEventExportHandler +{ +public: + virtual ~XMLEventExportHandler() {}; + + virtual void Export( + SvXMLExport& rExport, /// the current XML export + const OUString& rEventQName, /// the XML name of the event + const css::uno::Sequence & rValues, /// the values for the event + 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 + * element. The context has to call the + * EventsImportContext::AddEventValues() method to save 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 + const css::uno::Reference & xAttrList, /// attribute list + /// the context for the enclosing element + XMLEventsImportContext* rEvents, + /// the event name (as understood by the API) + const OUString& rApiEventName) = 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 000000000..e9dcd2bfe --- /dev/null +++ b/include/xmloff/xmlexp.hxx @@ -0,0 +1,677 @@ +/* -*- 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_XMLEXP_HXX +#define INCLUDED_XMLOFF_XMLEXP_HXX + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::document { class XEmbeddedObjectResolver; } +namespace com::sun::star::document { class XGraphicStorageHandler; } +namespace com::sun::star::embed { class XStorage; } +namespace com::sun::star::graphic { class XGraphic; } +namespace com::sun::star::lang { class XEventListener; } +namespace com::sun::star::task { class XStatusIndicator; } +namespace com::sun::star::uno { class XComponentContext; } +namespace com::sun::star::util { class XNumberFormatsSupplier; } +namespace com::sun::star::xml::sax { class XAttributeList; } +namespace com::sun::star::xml::sax { class XDocumentHandler; } +namespace com::sun::star::xml::sax { class XExtendedDocumentHandler; } +namespace com::sun::star::xml::sax { class XLocator; } + +class SvXMLNamespaceMap; +class SvtSecurityMapPersonalInfo; +class SvXMLExport_Impl; +class ProgressBarHelper; +class XMLEventExport; +class XMLImageMapExport; +class XMLErrors; +class LanguageTag; +enum class SvXMLErrorFlags; + +// Shapes in Writer cannot be named via context menu (#i51726#) +#include + +namespace com::sun::star { + namespace frame { class XModel; } + namespace lang { struct Locale; } +} +namespace comphelper { class UnoInterfaceToUniqueIdentifierMapper; } + +enum class SvXMLExportFlags { + NONE = 0, + META = 0x0001, + STYLES = 0x0002, + MASTERSTYLES = 0x0004, + AUTOSTYLES = 0x0008, + CONTENT = 0x0010, + SCRIPTS = 0x0020, + SETTINGS = 0x0040, + FONTDECLS = 0x0080, + EMBEDDED = 0x0100, + PRETTY = 0x0400, + OASIS = 0x8000, + ALL = 0x05ff +}; +namespace o3tl +{ + template<> struct typed_flags : is_typed_flags {}; +} + +class XMLOFF_DLLPUBLIC SvXMLExport : public cppu::WeakImplHelper< + css::document::XFilter, + css::lang::XServiceInfo, + css::document::XExporter, + css::lang::XInitialization, + css::container::XNamed, + css::lang::XUnoTunnel> +{ + std::unique_ptr mpImpl; // dummy + + css::uno::Reference< css::uno::XComponentContext > m_xContext; + OUString m_implementationName; + + css::uno::Reference< css::frame::XModel > mxModel; + css::uno::Reference< css::xml::sax::XDocumentHandler > mxHandler; // the handlers + css::uno::Reference< css::xml::sax::XExtendedDocumentHandler > mxExtHandler; + css::uno::Reference< css::util::XNumberFormatsSupplier > mxNumberFormatsSupplier; + css::uno::Reference< css::document::XGraphicStorageHandler > mxGraphicStorageHandler; + css::uno::Reference< css::document::XEmbeddedObjectResolver > mxEmbeddedResolver; + css::uno::Reference< css::task::XStatusIndicator > mxStatusIndicator; + css::uno::Reference< css::beans::XPropertySet > mxExportInfo; + css::uno::Reference< css::lang::XEventListener > mxEventListener; + + rtl::Reference mxAttrList; // a common attribute list + + OUString msOrigFileName; // the original URL + OUString msFilterName; + OUString msImgFilterName; + std::unique_ptr mpNamespaceMap; // the namespace map + std::unique_ptr mpAuthorIDs; // map authors to remove personal info + SvXMLUnitConverter maUnitConv; // the unit converter + std::unique_ptr mpNumExport; + std::unique_ptr mpProgressBarHelper; + + rtl::Reference< XMLTextParagraphExport > mxTextParagraphExport; + rtl::Reference< XMLShapeExport > mxShapeExport; + rtl::Reference< SvXMLAutoStylePoolP > mxAutoStylePool; + rtl::Reference< SchXMLExportHelper > mxChartExport; + rtl::Reference< XMLPageExport > mxPageExport; + rtl::Reference< XMLFontAutoStylePool > mxFontAutoStylePool; + rtl::Reference< xmloff::OFormLayerXMLExport > mxFormExport; + std::unique_ptr mpEventExport; + std::unique_ptr mpImageMapExport; + std::unique_ptr mpXMLErrors; + + const enum ::xmloff::token::XMLTokenEnum meClass; + SAL_DLLPRIVATE void InitCtor_(); + + SvXMLExportFlags mnExportFlags; + SvXMLErrorFlags mnErrorFlags; + + const OUString msWS; // " " + + // Shapes in Writer cannot be named via context menu (#i51726#) + SvtModuleOptions::EFactory meModelType; + SAL_DLLPRIVATE void DetermineModelType_(); + + SAL_DLLPRIVATE void ImplExportMeta(); // + SAL_DLLPRIVATE void ImplExportSettings(); // + SAL_DLLPRIVATE void ImplExportStyles(); // + SAL_DLLPRIVATE void ImplExportAutoStyles(); + // + SAL_DLLPRIVATE void ImplExportMasterStyles(); + // + SAL_DLLPRIVATE void ImplExportContent(); // + virtual void SetBodyAttributes(); + void GetViewSettingsAndViews(css::uno::Sequence& rProps); + +protected: + void setExportFlags( SvXMLExportFlags nExportFlags ) { mnExportFlags = nExportFlags; } + + // Get (modifiable) namespace map + SvXMLNamespaceMap& GetNamespaceMap_() { return *mpNamespaceMap; } + + // get a new namespace map (used in starmath to have a default namespace) + void ResetNamespaceMap(); + + /// Override this method to export the content of . + /// There is a default implementation. + virtual void ExportMeta_(); + + /// Override this method to export the content of . + /// There is a default implementation. + virtual void ExportScripts_(); + + /// Override this method to export the font declarations + /// The default implementation will export the contents of the + /// XMLFontAutoStylePool if it has been created. + virtual void ExportFontDecls_(); + + /// Override this method to export the content of . + /// If bUsed is set, used styles should be exported only. + /// Overriding Methods must call this method ! + virtual void ExportStyles_( bool bUsed ); + + /// Override this method to export the contents of . + virtual void ExportAutoStyles_() = 0; + + /// Override this method to export the contents of . + virtual void ExportMasterStyles_() = 0; + + /// Override this method to export the content of . + virtual void ExportContent_() = 0; + + OUString const & GetSourceShellID() const; + OUString const & GetDestinationShellID() const; + + // save linked sections? (may be false in global documents) + bool mbSaveLinkedSections; + + virtual XMLTextParagraphExport* CreateTextParagraphExport(); + virtual XMLShapeExport* CreateShapeExport(); + virtual SvXMLAutoStylePoolP* CreateAutoStylePool(); + SchXMLExportHelper* CreateChartExport(); + virtual XMLPageExport* CreatePageExport(); + virtual XMLFontAutoStylePool* CreateFontAutoStylePool(); + xmloff::OFormLayerXMLExport* CreateFormExport(); + virtual void GetViewSettings(css::uno::Sequence& aProps); + virtual void GetConfigurationSettings(css::uno::Sequence& aProps); + + struct SettingsGroup + { + ::xmloff::token::XMLTokenEnum eGroupName; + css::uno::Sequence< css::beans::PropertyValue > aSettings; + + SettingsGroup( + const ::xmloff::token::XMLTokenEnum _eGroupName, + const css::uno::Sequence< css::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::vector< SettingsGroup >& _out_rSettings ); + + const css::uno::Reference< css::document::XEmbeddedObjectResolver >& GetEmbeddedResolver() const { return mxEmbeddedResolver; } + inline void SetEmbeddedResolver( css::uno::Reference< css::document::XEmbeddedObjectResolver > const & _xEmbeddedResolver ); + + const css::uno::Reference & GetGraphicStorageHandler() const + { + return mxGraphicStorageHandler; + } + void SetGraphicStorageHandler(css::uno::Reference const & rxGraphicStorageHandler); + + void SetDocHandler( const css::uno::Reference< css::xml::sax::XDocumentHandler > &rHandler ); + + bool mbAutoStylesCollected; +public: + + SvXMLExport( + const css::uno::Reference< css::uno::XComponentContext >& xContext, + OUString const & implementationName, + sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/, + const enum ::xmloff::token::XMLTokenEnum eClass, + SvXMLExportFlags nExportFlag ); + + SvXMLExport( + const css::uno::Reference< css::uno::XComponentContext >& xContext, + OUString const & implementationName, + const OUString& rFileName, + sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/, + const css::uno::Reference< css::xml::sax::XDocumentHandler > & rHandler); + + SvXMLExport( + const css::uno::Reference< css::uno::XComponentContext >& xContext, + OUString const & implementationName, + const OUString& rFileName, + const css::uno::Reference< css::xml::sax::XDocumentHandler > & rHandler, + const css::uno::Reference< css::frame::XModel > &, + FieldUnit const eDefaultFieldUnit, + SvXMLExportFlags nExportFlag ); + + virtual ~SvXMLExport() override; + + virtual void collectAutoStyles(); + + // XExporter + virtual void SAL_CALL setSourceDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override; + + // XFilter + virtual sal_Bool SAL_CALL filter( const css::uno::Sequence< css::beans::PropertyValue >& aDescriptor ) override; + virtual void SAL_CALL cancel() override; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; + + // XNamed + virtual OUString SAL_CALL getName( ) override; + virtual void SAL_CALL setName( const OUString& aName ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) final override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) final override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) final override; + + // XUnoTunnel + UNO3_GETIMPLEMENTATION_DECL(SvXMLExport) + + /** ensures that the given namespace is in scope at the next started + element. + +

If the namespace is not yet declared, the necessary attribute will + be added, as well.

+ + @param i_rNamespace the namespace to be declared + + @returns the actual prefix that the namespace is associated with + */ + OUString EnsureNamespace(OUString const & i_rNamespace ); + + // Check if common attribute list is empty. +#ifndef DBG_UTIL + void CheckAttrList() { (void) this; /* avoid loplugin:staticmethods */ } +#else + void CheckAttrList(); +#endif + + // Clear common attribute list. + void ClearAttrList(); + + // Add an attribute to the common attribute list. + 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 language tag attributes, deciding which are necessary. + + @param nPrefix + Namespace prefix for *:language, *:script and *:country + + @param nPrefixRfc + Namespace prefix for *:rfc-language-tag + + @param bWriteEmpty + Whether to write empty *:language and *:country attribute + values in case of an empty locale (denoting system). + */ + void AddLanguageTagAttributes( sal_uInt16 nPrefix, sal_uInt16 nPrefixRfc, + const css::lang::Locale& rLocale, bool bWriteEmpty); + + /** Same as AddLanguageTagAttributes() but with LanguageTag parameter + instead of Locale. + */ + void AddLanguageTagAttributes( sal_uInt16 nPrefix, sal_uInt16 nPrefixRfc, + const LanguageTag& rLanguageTag, bool bWriteEmpty ); + + // add several attributes to the common attribute list + void AddAttributeList( const css::uno::Reference< + css::xml::sax::XAttributeList >& xAttrList ); + + // Get common attribute list as implementation or interface. + SvXMLAttributeList &GetAttrList() { return *mxAttrList; } + css::uno::Reference< css::xml::sax::XAttributeList > GetXAttrList() const { return mxAttrList; } + + // Get document handler. This methods are not const, because the + // reference allows modifications through the handler. + const css::uno::Reference< css::xml::sax::XDocumentHandler > & GetDocHandler() const { return mxHandler; } + + // Get original URL. + const OUString& GetOrigFileName() const { return msOrigFileName; } + + // Get (const) namespace map. + const SvXMLNamespaceMap& GetNamespaceMap() const { return *mpNamespaceMap; } + + // Get author id to remove personal info + size_t GetInfoID( const OUString sPersonalInfo ) const { return mpAuthorIDs->GetInfoID(sPersonalInfo); } + + // Get unit converter + const SvXMLUnitConverter& GetMM100UnitConverter() const { return maUnitConv; } + + SvXMLUnitConverter& GetMM100UnitConverter() { return maUnitConv; } + + void addChaffWhenEncryptedStorage(); + + // Export the document. + virtual ErrCode exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ); + + void collectDataStyles(bool bFromUsedStyles); + virtual void addDataStyle(const sal_Int32 nNumberFormat, bool bTimeFormat = false ); + virtual void exportDataStyles(); + virtual void exportAutoDataStyles(); + virtual OUString getDataStyleName(const sal_Int32 nNumberFormat, bool bTimeFormat = false ) const; + sal_Int32 dataStyleForceSystemLanguage(sal_Int32 nFormat) const; + + virtual void exportAnnotationMeta( const css::uno::Reference < css::drawing::XShape >& xShape); + + // Get XModel + const css::uno::Reference< css::frame::XModel > & + GetModel() const { return mxModel; } + // Get XNumberFormatsSupplier + css::uno::Reference< css::util::XNumberFormatsSupplier > & GetNumberFormatsSupplier() { return mxNumberFormatsSupplier; } + void SetNumberFormatsSupplier(const css::uno::Reference< css::util::XNumberFormatsSupplier >& _xNumberFormatSupplier) + { + mxNumberFormatsSupplier = _xNumberFormatSupplier; + if ( mxNumberFormatsSupplier.is() && mxHandler.is() ) + mpNumExport.reset( new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier) ); + } + + // get export helper for text + inline rtl::Reference< XMLTextParagraphExport > const & GetTextParagraphExport(); + + // get export helper for shapes + inline rtl::Reference< XMLShapeExport > const & GetShapeExport(); + + // get auto style pool + inline rtl::Reference< SvXMLAutoStylePoolP > const & GetAutoStylePool(); + + // get Page Export + inline rtl::Reference< XMLPageExport > const & GetPageExport(); + + // get chart export helper + inline rtl::Reference< SchXMLExportHelper > const & GetChartExport(); + + // get font auto style pool + inline rtl::Reference< XMLFontAutoStylePool > const & GetFontAutoStylePool(); + + ProgressBarHelper* GetProgressBarHelper(); + + // get Formlayer Export + inline rtl::Reference< xmloff::OFormLayerXMLExport > const & GetFormExport(); + inline bool HasFormExport() const; + + // get XPropertySet with export information + const css::uno::Reference< css::beans::XPropertySet >& getExportInfo() const { return mxExportInfo; } + + const css::uno::Reference< css::task::XStatusIndicator >& GetStatusIndicator() const { 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 AddEmbeddedXGraphic(css::uno::Reference const & rxGraphic, OUString & rOutMimeType, OUString const & rRequestedName = OUString()); + bool AddEmbeddedXGraphicAsBase64(css::uno::Reference const & rxGraphic); + bool GetGraphicMimeTypeFromStream(css::uno::Reference const & rxGraphic, OUString & rOutMimeType); + + OUString AddEmbeddedObject( + const OUString& rEmbeddedObjectURL ); + bool AddEmbeddedObjectAsBase64( + const OUString& rEmbeddedObjectURL ); + + OUString EncodeStyleName( const OUString& rName, + bool *pEncoded=nullptr ) const; + + // save linked sections? + bool IsSaveLinkedSections() const { return mbSaveLinkedSections; } + + // get export flags + SvXMLExportFlags getExportFlags() const { return mnExportFlags; } + + void ExportEmbeddedOwnObject( + css::uno::Reference const & 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, + bool bIgnWSOutside ); + void StartElement(const OUString& rName, + bool bIgnWSOutside ); + void Characters(const OUString& rChars); + void EndElement(sal_uInt16 nPrefix, + enum ::xmloff::token::XMLTokenEnum eName, + bool bIgnWSInside ); + void EndElement(const OUString& rName, + 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 css::uno::Sequence< OUString> & rMsgParams, + /// original exception message (if applicable) + const OUString& rExceptionMessage, + /// error location (if applicable) + const css::uno::Reference & rLocator ); + + void SetError( + sal_Int32 nId, + const css::uno::Sequence< OUString> & rMsgParams); + + virtual void DisposingModel(); + + ::comphelper::UnoInterfaceToUniqueIdentifierMapper& getInterfaceToIdentifierMapper(); + + const css::uno::Reference< css::uno::XComponentContext >& getComponentContext() const { return m_xContext;} + + // 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#) + bool writeOutlineStyleAsNormalListStyle() const; + + css::uno::Reference< css::embed::XStorage > const & GetTargetStorage() const; + + /// returns value of ODF version attribute + char const* GetODFVersionAttributeValue() const; + + /// returns the deterministic version for odf export + SvtSaveOptions::ODFSaneDefaultVersion getSaneDefaultVersion() 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(css::uno::Reference const & i_xIfc); + + /// add RDFa attributes for a metadatable text content + void AddAttributesRDFa( css::uno::Reference const & i_xTextContent); + + bool exportTextNumberElement() const; + + /// set null date from model to unit converter, if not already done + bool SetNullDateOnUnitConverter(); + + /// Get clamped mimetype for image export (empty if none) + OUString const & GetImageFilterName() const; +}; + +inline rtl::Reference< XMLTextParagraphExport > const & SvXMLExport::GetTextParagraphExport() +{ + if( !mxTextParagraphExport.is() ) + mxTextParagraphExport = CreateTextParagraphExport(); + + return mxTextParagraphExport; +} + +inline rtl::Reference< XMLShapeExport > const & SvXMLExport::GetShapeExport() +{ + if( !mxShapeExport.is() ) + mxShapeExport = CreateShapeExport(); + + return mxShapeExport; +} + +inline rtl::Reference< SvXMLAutoStylePoolP > const & SvXMLExport::GetAutoStylePool() +{ + if( !mxAutoStylePool.is() ) + mxAutoStylePool = CreateAutoStylePool(); + + return mxAutoStylePool; +} + +inline rtl::Reference< SchXMLExportHelper > const & SvXMLExport::GetChartExport() +{ + if( !mxChartExport.is() ) + mxChartExport = CreateChartExport(); + + return mxChartExport; +} + +inline rtl::Reference< XMLPageExport > const & SvXMLExport::GetPageExport() +{ + if( !mxPageExport.is() ) + mxPageExport = CreatePageExport(); + + return mxPageExport; +} + +inline rtl::Reference< XMLFontAutoStylePool > const & SvXMLExport::GetFontAutoStylePool() +{ + if( !mxFontAutoStylePool.is() ) + mxFontAutoStylePool = CreateFontAutoStylePool(); + + return mxFontAutoStylePool; +} + +inline rtl::Reference< xmloff::OFormLayerXMLExport > const & SvXMLExport::GetFormExport() +{ + if( !mxFormExport.is() ) + mxFormExport = CreateFormExport(); + + return mxFormExport; +} + +inline bool SvXMLExport::HasFormExport() const +{ + return mxFormExport.is(); +} + +inline void SvXMLExport::SetEmbeddedResolver( + css::uno::Reference< css::document::XEmbeddedObjectResolver > const & _xEmbeddedResolver ) +{ + mxEmbeddedResolver = _xEmbeddedResolver; +} + +inline void SvXMLExport::SetGraphicStorageHandler( + css::uno::Reference const & rxGraphicStorageHandler) +{ + mxGraphicStorageHandler = rxGraphicStorageHandler; +} + +// Helper class to export an element. +class XMLOFF_DLLPUBLIC SvXMLElementExport +{ + SvXMLExport& mrExport; + OUString maElementName; + const bool mbIgnoreWhitespaceInside :1; + const bool mbDoSomething :1; + + SAL_DLLPRIVATE + void StartElement( + const sal_uInt16 nPrefix, + const OUString& rName, + const bool bIgnoreWhitespaceOutside ); + +public: + + // The constructor prints a start tag that has the common attributes + // of the XMLExport instance attached. + SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix, + const char *pName, + bool bIgnWSOutside, bool bIgnWSInside ); + SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix, + const OUString& rName, + bool bIgnWSOutside, bool bIgnWSInside ); + SvXMLElementExport( SvXMLExport& rExp, sal_uInt16 nPrefix, + enum ::xmloff::token::XMLTokenEnum eName, + bool bIgnWSOutside, bool bIgnWSInside ); + SvXMLElementExport( SvXMLExport& rExp, const OUString& rQName, + bool bIgnWSOutside, bool bIgnWSInside ); + + // These constructors do nothing if bDoSomething is not set + SvXMLElementExport( SvXMLExport& rExp, bool bDoSomething, + sal_uInt16 nPrefix, + enum ::xmloff::token::XMLTokenEnum eName, + bool bIgnWSOutside, 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 000000000..5e47201a5 --- /dev/null +++ b/include/xmloff/xmlexppr.hxx @@ -0,0 +1,182 @@ +/* -*- 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_XMLEXPPR_HXX +#define INCLUDED_XMLOFF_XMLEXPPR_HXX + +#include +#include +#include +#include +#include + +#include +#include + +namespace com::sun::star::uno { template class Reference; } +namespace com::sun::star::beans { class XPropertySet; } +namespace rtl { template class Reference; } + +class XMLPropertySetMapper; +struct XMLPropertyState; + +enum class SvXmlExportFlags { + NONE = 0x0000, + IGN_WS = 0x0008 +}; +namespace o3tl +{ + template<> struct typed_flags : is_typed_flags {}; +} + +class SvXMLUnitConverter; +class SvXMLAttributeList; +class SvXMLNamespaceMap; +class SvXMLExport; + +class XMLOFF_DLLPUBLIC SvXMLExportPropertyMapper : public salhelper::SimpleReferenceObject +{ + struct Impl; + std::unique_ptr mpImpl; + +protected: + + /** 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 Filter_( + SvXMLExport const& rExport, + const css::uno::Reference& rPropSet, + bool bDefault, bool bDisableFoFontFamily ) const; + + /** Application-specific filter. By default do nothing. */ + virtual void ContextFilter( + bool bEnableFoFontFamily, + ::std::vector< XMLPropertyState >& rProperties, + const css::uno::Reference& 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, + std::vector* pIndexArray, + sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx ) const; + + void _exportXML( SvXMLAttributeList& rAttrList, + const XMLPropertyState& rProperty, + const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap, + const ::std::vector< XMLPropertyState > *pProperties, + sal_uInt32 nIdx ) const; + + void exportElementItems( + SvXMLExport& rExport, + const ::std::vector< XMLPropertyState >& rProperties, + SvXmlExportFlags nFlags, + const std::vector& rIndexArray ) const; + +public: + + SvXMLExportPropertyMapper( + const rtl::Reference< XMLPropertySetMapper >& rMapper ); + virtual ~SvXMLExportPropertyMapper() override; + + // 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 rtl::Reference< 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 Filter( + SvXMLExport const& rExport, + const css::uno::Reference& rPropSet, bool bEnableFoFontFamily = false ) const; + + /** 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 FilterDefaults( + SvXMLExport const& rExport, + const css::uno::Reference& rPropSet ) const; + + /** Provides a partial ordering over two arrays of XMLPropertyState, + Partial because implementing a full order requires quite a lot of code. */ + bool LessPartial( const ::std::vector< XMLPropertyState >& aProperties1, + const ::std::vector< XMLPropertyState >& aProperties2 ) const; + + /** Compare two arrays of XMLPropertyState */ + bool Equals( const ::std::vector< XMLPropertyState >& aProperties1, + const ::std::vector< XMLPropertyState >& aProperties2 ) const; + void exportXML( + SvXMLExport& rExport, + const ::std::vector< XMLPropertyState >& rProperties, + SvXmlExportFlags nFlags, + bool bUseExtensionNamespaceForGraphicProperties = false ) const; + + /** like above but only properties whose property map index is within the + * specified range are exported + * + * @param bExtensionNamespace use the extension namespace for graphic-properties + */ + void exportXML( + SvXMLExport& rExport, + const ::std::vector< XMLPropertyState >& rProperties, + sal_Int32 nPropMapStartIdx, sal_Int32 nPropMapEndIdx, + SvXmlExportFlags nFlags, bool bExtensionNamespace = false ) 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, + SvXmlExportFlags nFlags, + const ::std::vector< XMLPropertyState > *pProperties, + sal_uInt32 nIdx ) 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, + sal_uInt32 nIdx ) const; + + const rtl::Reference& getPropertySetMapper() const; + + void SetStyleName( const OUString& rStyleName ); + const OUString& GetStyleName() const; +}; + +#endif // INCLUDED_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 000000000..7ff91aa84 --- /dev/null +++ b/include/xmloff/xmlictxt.hxx @@ -0,0 +1,125 @@ +/* -*- 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_XMLICTXT_HXX +#define INCLUDED_XMLOFF_XMLICTXT_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace com::sun::star::xml::sax { class XAttributeList; } + +class SvXMLImport; + +class SvXMLImportContext; + +typedef rtl::Reference SvXMLImportContextRef; + +/** +This class deliberately does not support XWeak, to improve performance when loading +large documents. +*/ +class XMLOFF_DLLPUBLIC SvXMLImportContext : public css::xml::sax::XFastContextHandler, + public css::lang::XTypeProvider + +{ + friend class SvXMLImport; + + SvXMLImport& mrImport; + oslInterlockedCount m_nRefCount; + std::optional m_xRewindMap; + + SAL_DLLPRIVATE std::optional TakeRewindMap() { return std::move(m_xRewindMap); } + SAL_DLLPRIVATE void PutRewindMap(std::optional&& p) { m_xRewindMap = std::move(p); } + +protected: + + SvXMLImport& GetImport() { return mrImport; } + const SvXMLImport& GetImport() const { return mrImport; } + +public: + + /** 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 ); + + /** 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(); + + // css::xml::sax::XFastContextHandler: + virtual void SAL_CALL startFastElement (sal_Int32 Element, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs) override; + + virtual void SAL_CALL startUnknownElement(const OUString & Namespace, const OUString & Name, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override; + + /** endFastElement is called before a context will be destructed, but + * after an elements context has been parsed. It may be used for actions + * that require virtual methods. The default is to do nothing. */ + virtual void SAL_CALL endFastElement(sal_Int32 Element) override; + + virtual void SAL_CALL endUnknownElement(const OUString & Namespace, const OUString & Name) override; + + virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 Element, + const css::uno::Reference& Attribs) override; + + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createUnknownChildContext( + const OUString & Namespace, const OUString & Name, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override; + + /** This method is called for all characters that are contained in the + * current element. The default is to ignore them. */ + virtual void SAL_CALL characters(const OUString & aChars) override; + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) final override; + virtual void SAL_CALL acquire() noexcept final override + { osl_atomic_increment(&m_nRefCount); } + virtual void SAL_CALL release() noexcept final override + { if (osl_atomic_decrement(&m_nRefCount) == 0) delete this; } + + // XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) final override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) final override; +}; + +#define XMLOFF_WARN_UNKNOWN(area, rIter) \ + SAL_WARN(area, "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(rIter.getToken()) << " value=" << rIter.toString()); + +#define XMLOFF_WARN_UNKNOWN_ATTR(area, token, value) \ + SAL_WARN(area, "unknown attribute " << SvXMLImport::getPrefixAndNameFromToken(token) << "=" << value); + +#define XMLOFF_WARN_UNKNOWN_ELEMENT(area, token) \ + SAL_WARN(area, "unknown element " << SvXMLImport::getPrefixAndNameFromToken(token)); + +#endif // INCLUDED_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 000000000..1a7731739 --- /dev/null +++ b/include/xmloff/xmlimp.hxx @@ -0,0 +1,664 @@ +/* -*- 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_XMLIMP_HXX +#define INCLUDED_XMLOFF_XMLIMP_HXX + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::beans { struct NamedValue; } +namespace com::sun::star::document { class XEmbeddedObjectResolver; } +namespace com::sun::star::document { class XGraphicStorageHandler; } +namespace com::sun::star::embed { class XStorage; } +namespace com::sun::star::graphic { class XGraphic; } +namespace com::sun::star::task { class XStatusIndicator; } +namespace com::sun::star::uno { class XComponentContext; } +namespace com::sun::star::util { class XNumberFormatsSupplier; } +namespace com::sun::star::xml::sax { class XAttributeList; } +namespace com::sun::star::xml::sax { class XFastAttributeList; } +namespace com::sun::star::xml::sax { class XFastContextHandler; } +namespace com::sun::star { + namespace frame { class XModel; } + namespace io { class XOutputStream; } + namespace rdf { class XMetadatable; } +} + +namespace comphelper { class UnoInterfaceToUniqueIdentifierMapper; } +namespace comphelper { class AttributeList; } + +namespace xmloff { + class RDFaImportHelper; +} +namespace xmloff::token { + class FastTokenHandler; +} +class EmbeddedFontsHelper; +class ProgressBarHelper; +class SvXMLNamespaceMap; +class SvXMLImport_Impl; +class SvXMLUnitConverter; +class SvXMLNumFmtHelper; +class XMLFontStylesContext; +class XMLEventImportHelper; +class XMLErrors; +class StyleMap; +enum class SvXMLErrorFlags; + +constexpr sal_Int32 LAST_NAMESPACE = 121; // last value in xmloff/xmnspe.hxx +constexpr size_t NMSP_SHIFT = 16; +constexpr sal_Int32 TOKEN_MASK = 0xffff; +constexpr sal_Int32 NMSP_MASK = 0xffff0000; + +#define XML_ELEMENT( prefix, name ) ( NAMESPACE_TOKEN(XML_NAMESPACE_##prefix) | name ) + +constexpr sal_Int32 NAMESPACE_TOKEN( sal_uInt16 prefixToken ) +{ + return ( prefixToken + 1 ) << NMSP_SHIFT; +} + +constexpr bool IsTokenInNamespace(sal_Int32 nToken, sal_uInt16 nNamespacePrefix) +{ + auto nTmp = ((nToken & NMSP_MASK) >> NMSP_SHIFT) - 1; + return nTmp == nNamespacePrefix; +} + + +enum class SvXMLImportFlags { + NONE = 0x0000, + META = 0x0001, + STYLES = 0x0002, + MASTERSTYLES = 0x0004, + AUTOSTYLES = 0x0008, + CONTENT = 0x0010, + SCRIPTS = 0x0020, + SETTINGS = 0x0040, + FONTDECLS = 0x0080, + EMBEDDED = 0x0100, + ALL = 0xffff +}; +namespace o3tl +{ + template<> struct typed_flags : is_typed_flags {}; +} + +class SvXMLImportFastNamespaceHandler final : public ::cppu::WeakImplHelper< css::xml::sax::XFastNamespaceHandler > +{ +private: + struct NamespaceDefine + { + OUString m_aPrefix; + OUString m_aNamespaceURI; + + NamespaceDefine( const OUString& rPrefix, const OUString& rNamespaceURI ) : m_aPrefix( rPrefix ), m_aNamespaceURI( rNamespaceURI ) {} + }; + std::vector< NamespaceDefine > m_aNamespaceDefines; + +public: + SvXMLImportFastNamespaceHandler(); + void addNSDeclAttributes( rtl::Reference < comphelper::AttributeList > const & rAttrList ); + + //XFastNamespaceHandler + virtual void SAL_CALL registerNamespace( const OUString& rNamespacePrefix, const OUString& rNamespaceURI ) override; + virtual OUString SAL_CALL getNamespaceURI( const OUString& rNamespacePrefix ) override; +}; + +class XMLOFF_DLLPUBLIC SvXMLLegacyToFastDocHandler final : public ::cppu::WeakImplHelper< + css::xml::sax::XDocumentHandler, + css::document::XImporter > +{ +private: + rtl::Reference< SvXMLImport > mrImport; + rtl::Reference< sax_fastparser::FastAttributeList > mxFastAttributes; + std::stack maDefaultNamespaces; + +public: + SvXMLLegacyToFastDocHandler( const rtl::Reference< SvXMLImport > & rImport ); + + // XImporter + virtual void SAL_CALL setTargetDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override; + + // css::xml::sax::XDocumentHandler + virtual void SAL_CALL startDocument() override; + virtual void SAL_CALL endDocument() override; + virtual void SAL_CALL startElement(const OUString& aName, + const css::uno::Reference< css::xml::sax::XAttributeList > & xAttribs) override; + virtual void SAL_CALL endElement(const OUString& aName) override; + virtual void SAL_CALL characters(const OUString& aChars) override; + virtual void SAL_CALL ignorableWhitespace(const OUString& aWhitespaces) override; + virtual void SAL_CALL processingInstruction(const OUString& aTarget, + const OUString& aData) override; + virtual void SAL_CALL setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator > & xLocator) override; +}; + +class XMLOFF_DLLPUBLIC SvXMLImport : public cppu::WeakImplHelper< + css::xml::sax::XFastDocumentHandler, + css::lang::XServiceInfo, + css::lang::XInitialization, + css::document::XImporter, + css::document::XFilter, + css::lang::XUnoTunnel, + css::xml::sax::XFastParser> +{ + friend class SvXMLImportContext; + friend class SvXMLLegacyToFastDocHandler; + + css::uno::Reference< css::xml::sax::XLocator > mxLocator; + css::uno::Reference< css::frame::XModel > mxModel; + css::uno::Reference< css::util::XNumberFormatsSupplier > mxNumberFormatsSupplier; + css::uno::Reference< css::document::XGraphicStorageHandler > mxGraphicStorageHandler; + css::uno::Reference< css::document::XEmbeddedObjectResolver > mxEmbeddedResolver; + css::uno::Reference< css::beans::XPropertySet > mxImportInfo; + + rtl::Reference< XMLTextImportHelper > mxTextImport; + rtl::Reference< XMLShapeImportHelper > mxShapeImport; + rtl::Reference< SchXMLImportHelper > mxChartImport; + rtl::Reference< ::xmloff::OFormLayerXMLImport > mxFormImport; + + rtl::Reference mxFontDecls; + rtl::Reference mxStyles; + rtl::Reference mxAutoStyles; + rtl::Reference mxMasterStyles; + + css::uno::Reference< css::container::XNameContainer > mxGradientHelper; + css::uno::Reference< css::container::XNameContainer > mxHatchHelper; + css::uno::Reference< css::container::XNameContainer > mxBitmapHelper; + css::uno::Reference< css::container::XNameContainer > mxTransGradientHelper; + css::uno::Reference< css::container::XNameContainer > mxMarkerHelper; + css::uno::Reference< css::container::XNameContainer > mxDashHelper; + css::uno::Reference< css::container::XNameContainer > mxNumberStyles; + css::uno::Reference< css::lang::XEventListener > mxEventListener; + + std::unique_ptr mpImpl; // dummy + + std::optional mxNamespaceMap; + std::unique_ptr mpUnitConv; + std::stack> + maContexts; + std::unique_ptr mpNumImport; + std::unique_ptr mpProgressBarHelper; + std::unique_ptr mpEventImportHelper; + std::unique_ptr mpXMLErrors; + rtl::Reference mpStyleMap; + + SAL_DLLPRIVATE void InitCtor_(); + + SvXMLImportFlags mnImportFlags; + std::set< OUString > embeddedFontUrlsKnown; + css::uno::Reference< css::xml::sax::XFastParser > mxParser; + rtl::Reference< SvXMLImportFastNamespaceHandler > maNamespaceHandler; + rtl::Reference < comphelper::AttributeList > maNamespaceAttrList; + css::uno::Reference< css::xml::sax::XFastDocumentHandler > mxFastDocumentHandler; + static rtl::Reference< xmloff::token::FastTokenHandler > xTokenHandler; + static std::unordered_map< sal_Int32, std::pair< OUString, OUString > > aNamespaceMap; + static std::unordered_map< OUString, OUString > aNamespaceURIPrefixMap; + static bool bIsNSMapsInitialized; + + static void initializeNamespaceMaps(); + void registerNamespaces(); +public: + static std::optional processNSAttributes( + std::optional & rpNamespaceMap, + SvXMLImport *const pImport, + const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList); +private: + + css::uno::Reference< css::task::XStatusIndicator > mxStatusIndicator; + + // tdf#69060 & tdf#137643 import embedded fonts and activate them in a + // batch in EmbeddedFontsHelper's dtor + std::unique_ptr> mxEmbeddedFontHelper; + +protected: + bool mbIsFormsSupported; + bool mbIsTableShapeSupported; + bool mbNotifyMacroEventRead; + + // Create top-level element context. + // This method is called after the namespace map has been updated, but + // before a context for the current element has been pushed. + // This base class implementation returns a context that ignores everything. + virtual SvXMLImportContext *CreateFastContext( sal_Int32 Element, + const ::css::uno::Reference< ::css::xml::sax::XFastAttributeList >& xAttrList ); + + virtual XMLTextImportHelper* CreateTextImport(); + void ClearTextImport() { mxTextImport = nullptr; } + virtual XMLShapeImportHelper* CreateShapeImport(); + bool HasShapeImport() const { return mxShapeImport.is(); } + void ClearShapeImport() { mxShapeImport = nullptr; } + + static SchXMLImportHelper* CreateChartImport(); + ::xmloff::OFormLayerXMLImport* CreateFormImport(); + + void SetFontDecls( XMLFontStylesContext *pFontDecls ); + void SetStyles( SvXMLStylesContext *pStyles ); + void SetAutoStyles( SvXMLStylesContext *pAutoStyles ); + void SetMasterStyles( SvXMLStylesContext *pMasterStyles ); + + bool IsODFVersionConsistent( const OUString& aODFVersion ); + + const css::uno::Reference< css::document::XEmbeddedObjectResolver >& GetEmbeddedResolver() const { return mxEmbeddedResolver; } + inline void SetEmbeddedResolver( css::uno::Reference< css::document::XEmbeddedObjectResolver > const & _xEmbeddedResolver ); + + const css::uno::Reference & GetGraphicStorageHandler() const + { + return mxGraphicStorageHandler; + } + void SetGraphicStorageHandler(css::uno::Reference const & rxGraphicStorageHandler); + + void CreateNumberFormatsSupplier_(); + void CreateDataStylesImport_(); + +public: + // SvXMLImport( sal_uInt16 nImportFlags = IMPORT_ALL ) throw(); + /** + * @param sSupportedServiceNames if this is empty we default to our normal supported service names + */ + SvXMLImport( + const css::uno::Reference< css::uno::XComponentContext >& xContext, + OUString const & implementationName, + SvXMLImportFlags nImportFlags = SvXMLImportFlags::ALL, + const css::uno::Sequence< OUString > & sSupportedServiceNames = {}); + + void cleanup() noexcept; + + virtual ~SvXMLImport() noexcept override; + + virtual void SAL_CALL startDocument() override; + virtual void SAL_CALL endDocument() override; + virtual void SAL_CALL characters(const OUString& aChars) override; + virtual void SAL_CALL processingInstruction(const OUString& aTarget, + const OUString& aData) override; + virtual void SAL_CALL setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator > & xLocator) override; + + // ::css::xml::sax::XFastContextHandler + virtual void SAL_CALL startFastElement(sal_Int32 Element, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override; + virtual void SAL_CALL startUnknownElement(const OUString & Namespace, + const OUString & Name, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override; + virtual void SAL_CALL endFastElement(sal_Int32 Element) override; + virtual void SAL_CALL endUnknownElement(const OUString & Namespace, + const OUString & Name) override; + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext(sal_Int32 Element, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override; + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL + createUnknownChildContext(const OUString & Namespace, const OUString & Name, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs) override; + + // XFastParser + virtual void SAL_CALL parseStream( const css::xml::sax::InputSource& aInputSource ) override; + virtual void SAL_CALL setFastDocumentHandler( const css::uno::Reference< css::xml::sax::XFastDocumentHandler >& Handler ) override; + virtual void SAL_CALL setTokenHandler( const css::uno::Reference< css::xml::sax::XFastTokenHandler >& Handler ) override; + virtual void SAL_CALL registerNamespace( const OUString& NamespaceURL, sal_Int32 NamespaceToken ) override; + virtual OUString SAL_CALL getNamespaceURL( const OUString& rPrefix ) override; + virtual void SAL_CALL setErrorHandler( const css::uno::Reference< css::xml::sax::XErrorHandler >& Handler ) override; + virtual void SAL_CALL setEntityResolver( const css::uno::Reference< css::xml::sax::XEntityResolver >& Resolver ) override; + virtual void SAL_CALL setLocale( const css::lang::Locale& rLocale ) override; + virtual void SAL_CALL setNamespaceHandler( const css::uno::Reference< css::xml::sax::XFastNamespaceHandler >& Handler) override; + virtual void SAL_CALL setCustomEntityNames( const ::css::uno::Sequence< ::css::beans::Pair<::rtl::OUString, ::rtl::OUString> >& replacements ) override; + + // XImporter + virtual void SAL_CALL setTargetDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override; + + // XFilter + virtual sal_Bool SAL_CALL filter( const css::uno::Sequence< css::beans::PropertyValue >& aDescriptor ) override; + virtual void SAL_CALL cancel( ) override; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; + + // XUnoTunnel + static const css::uno::Sequence& getUnoTunnelId() noexcept; + virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) final override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) final override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) final override; + + // 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 css::uno::Sequence< css::beans::NamedValue > & i_rStats); + + // get import helper for text + inline rtl::Reference< XMLTextImportHelper > const & GetTextImport(); + bool HasTextImport() const { return mxTextImport.is(); } + inline SvXMLNumFmtHelper* GetDataStylesImport(); + + // get import helper for shapes + inline rtl::Reference< XMLShapeImportHelper > const & GetShapeImport(); + + // get import helper for charts + inline rtl::Reference< SchXMLImportHelper > const & GetChartImport(); + + // get import helper for form layer + inline rtl::Reference< ::xmloff::OFormLayerXMLImport > const & GetFormImport(); + + // get XPropertySet with import information + const css::uno::Reference< css::beans::XPropertySet >& getImportInfo() const { return mxImportInfo; } + + // get import helper for events + XMLEventImportHelper& GetEventImport(); + + static const OUString & getNameFromToken( sal_Int32 nToken ); + static OUString getPrefixAndNameFromToken( sal_Int32 nToken ); + static OUString getNamespacePrefixFromToken(sal_Int32 nToken, const SvXMLNamespaceMap* pMap); + static OUString getNamespaceURIFromToken( sal_Int32 nToken ); + static OUString getNamespacePrefixFromURI( const OUString& rURI ); + static sal_Int32 getTokenFromName(const OUString& sName); + + SvXMLNamespaceMap& GetNamespaceMap() { return *mxNamespaceMap; } + const SvXMLNamespaceMap& GetNamespaceMap() const { return *mxNamespaceMap; } + const SvXMLUnitConverter& GetMM100UnitConverter() const { return *mpUnitConv; } + SvXMLUnitConverter& GetMM100UnitConverter() { return *mpUnitConv; } + const css::uno::Reference< css::xml::sax::XLocator > & GetLocator() const { return mxLocator; } + const css::uno::Reference< css::frame::XModel > & + GetModel() const { return mxModel; } + + const css::uno::Reference< css::container::XNameContainer > & GetGradientHelper(); + const css::uno::Reference< css::container::XNameContainer > & GetHatchHelper(); + const css::uno::Reference< css::container::XNameContainer > & GetBitmapHelper(); + const css::uno::Reference< css::container::XNameContainer > & GetTransGradientHelper(); + const css::uno::Reference< css::container::XNameContainer > & GetMarkerHelper(); + const css::uno::Reference< css::container::XNameContainer > & GetDashHelper(); + inline css::uno::Reference< css::util::XNumberFormatsSupplier > & GetNumberFormatsSupplier(); + void SetNumberFormatsSupplier(const css::uno::Reference< css::util::XNumberFormatsSupplier >& _xNumberFormatSupplier) + { + mxNumberFormatsSupplier = _xNumberFormatSupplier; + } + + css::uno::Reference loadGraphicByURL(OUString const & rURL); + css::uno::Reference loadGraphicFromBase64(css::uno::Reference const & rxOutputStream); + + css::uno::Reference< css::io::XOutputStream > GetStreamForGraphicObjectURLFromBase64() const; + + bool IsPackageURL( const OUString& rURL ) const; + OUString ResolveEmbeddedObjectURL( const OUString& rURL, + std::u16string_view rClassId ); + css::uno::Reference< css::io::XOutputStream > + GetStreamForEmbeddedObjectURLFromBase64() const; + OUString ResolveEmbeddedObjectURLFromBase64(); + + // get source storage we're importing from (if available) + css::uno::Reference< css::embed::XStorage > const & + GetSourceStorage() const; + + void AddStyleDisplayName( XmlStyleFamily nFamily, + const OUString& rName, + const OUString& rDisplayName ); + OUString GetStyleDisplayName( XmlStyleFamily nFamily, + const OUString& rName ) const; + + ProgressBarHelper* GetProgressBarHelper(); + + void AddNumberStyle(sal_Int32 nKey, const OUString& sName); + + virtual void SetViewSettings(const css::uno::Sequence& aViewProps); + virtual void SetConfigurationSettings(const css::uno::Sequence& aConfigProps); + virtual void SetDocumentSpecificSettings(const OUString& _rSettingsGroupName, + const css::uno::Sequence& _rSettings); + + XMLFontStylesContext *GetFontDecls(); + SvXMLStylesContext *GetStyles(); + SvXMLStylesContext *GetAutoStyles(); + const XMLFontStylesContext *GetFontDecls() const; + const SvXMLStylesContext *GetStyles() const; + const SvXMLStylesContext *GetAutoStyles() const; + + SvXMLImportFlags getImportFlags() const { return mnImportFlags; } + 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; + bool IsOOoXML() const; // legacy non-ODF format? + /// Determines if the document was generated by Microsoft Office. + bool IsMSO() 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 css::uno::Sequence< OUString > & rMsgParams, + /// original exception message (if applicable) + const OUString& rExceptionMessage, + /// error location (if applicable) + const css::uno::Reference< css::xml::sax::XLocator> & rLocator ); + + void SetError( + sal_Int32 nId, + const css::uno::Sequence< OUString> & rMsgParams = {}); + + void SetError( sal_Int32 nId, const OUString& rMsg1 ); + + virtual void DisposingModel(); + + ::comphelper::UnoInterfaceToUniqueIdentifierMapper& getInterfaceToIdentifierMapper(); + + css::uno::Reference< css::uno::XComponentContext > const & + GetComponentContext() const; + + // Convert drawing object positions from OOo file format to OASIS file format and vice versa (#i28749#) + bool IsShapePositionInHoriL2R() const; + + bool IsTextDocInOOoFileFormat() const; + + OUString GetBaseURL() const; + OUString GetDocumentBase() const; + + /// set the XmlId attribute of given UNO object (for RDF metadata) + void SetXmlId(css::uno::Reference< + css::uno::XInterface> const & i_xIfc, + OUString const & i_rXmlId); + + /// Add a RDFa statement; parameters are XML attribute values + void AddRDFa( const css::uno::Reference< css::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 supporting 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 constexpr OUStringLiteral aNamespaceSeparator = u":"; + + 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; + // for AOO, no release overlaps with OOo, so continue OOo version numbers + static const sal_uInt16 AOO_40x = 40; + // @ATTENTION: it's not usually ok to use the "4x" "wildcard" in an "==" + // comparison, since that will match unreleased versions too; it is also + // risky to use it in "<" comparison, because it requires checking and + // possibly adapting all such uses when a new value for a more specific + // version is added. + static const sal_uInt16 AOO_4x = 41; + static const sal_uInt16 LO_flag = 0x100; + static const sal_uInt16 LO_3x = 30 | LO_flag; + static const sal_uInt16 LO_41x = 41 | LO_flag; + static const sal_uInt16 LO_42x = 42 | LO_flag; + static const sal_uInt16 LO_43x = 43 | LO_flag; + static const sal_uInt16 LO_44x = 44 | LO_flag; + static const sal_uInt16 LO_5x = 50 | LO_flag; + /// @ATTENTION: when adding a new value more specific than "6x", grep for + /// all current uses and adapt them!!! + static const sal_uInt16 LO_6x = 60 | LO_flag; + static const sal_uInt16 LO_63x = 63 | LO_flag; + static const sal_uInt16 LO_7x = 70 | 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; + + /** + 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 ); + + // see EmbeddedFontsHelper::addEmbeddedFont + bool addEmbeddedFont( const css::uno::Reference< css::io::XInputStream >& stream, + const OUString& fontName, const char* extra, + std::vector< unsigned char > const & key, bool eot); + + virtual void NotifyContainsEmbeddedFont() {} + + // something referencing a macro/script was imported + void NotifyMacroEventRead(); + + bool needFixPositionAfterZ() const; +}; + +inline rtl::Reference< XMLTextImportHelper > const & SvXMLImport::GetTextImport() +{ + if( !mxTextImport.is() ) + mxTextImport = CreateTextImport(); + + return mxTextImport; +} + +inline rtl::Reference< XMLShapeImportHelper > const & SvXMLImport::GetShapeImport() +{ + if( !mxShapeImport.is() ) + mxShapeImport = CreateShapeImport(); + + return mxShapeImport; +} + +inline rtl::Reference< SchXMLImportHelper > const & SvXMLImport::GetChartImport() +{ + if( !mxChartImport.is() ) + mxChartImport = CreateChartImport(); + + return mxChartImport; +} + +inline rtl::Reference< ::xmloff::OFormLayerXMLImport > const & SvXMLImport::GetFormImport() +{ + if( !mxFormImport.is() ) + mxFormImport = CreateFormImport(); + + return mxFormImport; +} + +inline void SvXMLImport::SetEmbeddedResolver( + css::uno::Reference< css::document::XEmbeddedObjectResolver > const & _xEmbeddedResolver ) +{ + mxEmbeddedResolver = _xEmbeddedResolver; +} + +inline void SvXMLImport::SetGraphicStorageHandler( + css::uno::Reference const & rxGraphicStorageHandler) +{ + mxGraphicStorageHandler = rxGraphicStorageHandler; +} + +inline css::uno::Reference< css::util::XNumberFormatsSupplier > & SvXMLImport::GetNumberFormatsSupplier() +{ + if ( ! mxNumberFormatsSupplier.is() && mxModel.is() ) + CreateNumberFormatsSupplier_(); + + return mxNumberFormatsSupplier; +} + +inline SvXMLNumFmtHelper* SvXMLImport::GetDataStylesImport() +{ + if ( !mpNumImport ) + CreateDataStylesImport_(); + + return mpNumImport.get(); +} + + +#endif // INCLUDED_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 000000000..8ce28dd5c --- /dev/null +++ b/include/xmloff/xmlimppr.hxx @@ -0,0 +1,212 @@ +/* -*- 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_XMLIMPPR_HXX +#define INCLUDED_XMLOFF_XMLIMPPR_HXX + +#include +#include +#include +#include +#include + +#include +#include + +namespace com::sun::star::beans { class XMultiPropertySet; } +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::beans { class XPropertySetInfo; } +namespace com::sun::star::beans { class XTolerantMultiPropertySet; } +namespace com::sun::star::beans { struct PropertyValue; } +namespace com::sun::star::container { class XNameContainer; } +namespace com::sun::star::uno { class Any; } +namespace com::sun::star::uno { template class Reference; } +namespace com::sun::star::uno { template class Sequence; } +namespace com::sun::star::xml::sax { class XAttributeList; } +namespace com::sun::star::xml::sax { class XFastAttributeList; } +namespace com::sun::star::drawing { enum class SAL_DLLPUBLIC_RTTI FillStyle; } + +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 /*const*/ nContextID; + sal_Int32 nIndex; + css::drawing::FillStyle /*const*/ nExpectedFillStyle; +}; + +class XMLOFF_DLLPUBLIC SvXMLImportPropertyMapper : public salhelper::SimpleReferenceObject +{ + rtl::Reference< SvXMLImportPropertyMapper> mxNextMapper; + + SvXMLImport& rImport; // access to error handling + + SvXMLImportPropertyMapper(SvXMLImportPropertyMapper const &) = delete; + SvXMLImportPropertyMapper& operator =(SvXMLImportPropertyMapper const &) = delete; + +protected: + + rtl::Reference< XMLPropertySetMapper > maPropMapper; + SvXMLImport& GetImport() const { return rImport;} + +public: + + SvXMLImportPropertyMapper( + const rtl::Reference< XMLPropertySetMapper >& rMapper, + SvXMLImport& rImport); + virtual ~SvXMLImportPropertyMapper() override; + + // Add an 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 rtl::Reference< 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, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& 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 >& rProperties, + const css::uno::Reference< css::beans::XPropertySet >& rPropSet, + ContextID_Index_Pair* pSpecialContextIds ) const; + + bool FillPropertySet( + const ::std::vector< XMLPropertyState >& rProperties, + const css::uno::Reference< css::beans::XPropertySet >& rPropSet, + ContextID_Index_Pair* pSpecialContextIds = nullptr ) const; + + void FillPropertySequence( + const ::std::vector< XMLPropertyState >& aProperties, + css::uno::Sequence< css::beans::PropertyValue >& rValues ) + const; + + inline const rtl::Reference< XMLPropertySetMapper >& + getPropertySetMapper() const; + + + /** implementation helper for FillPropertySet: fill an XPropertySet. + * Exceptions will be asserted. */ + static bool FillPropertySet_( + const ::std::vector & rProperties, + const css::uno::Reference< css::beans::XPropertySet> & rPropSet, + const css::uno::Reference< css::beans::XPropertySetInfo> & rPropSetInfo, + const rtl::Reference & rPropMapper, + SvXMLImport& rImport, + + // parameter for use by txtstyli.cxx; allows efficient + // catching the combined characters property + ContextID_Index_Pair* pSpecialContextIds ); + + /** implementation helper for FillPropertySet: fill an XMultiPropertySet. + * If unsuccessful, set return value. */ + static bool FillMultiPropertySet_( + const ::std::vector & rProperties, + const css::uno::Reference< css::beans::XMultiPropertySet> & rMultiPropSet, + const css::uno::Reference< css::beans::XPropertySetInfo> & rPropSetInfo, + const rtl::Reference & rPropMapper, + + // parameters for use by txtstyli.cxx; allows efficient + // catching the combined characters property + ContextID_Index_Pair* pSpecialContextIds ); + + /** implementation helper for FillPropertySet: fill an XTolerantMultiPropertySet. + * If unsuccessful, set return value. */ + static bool FillTolerantMultiPropertySet_( + const ::std::vector & rProperties, + const css::uno::Reference< css::beans::XTolerantMultiPropertySet> & rTolPropSet, + const rtl::Reference & rPropMapper, + SvXMLImport& rImport, + + // parameters for use by txtstyli.cxx; allows efficient + // catching the combined characters property + ContextID_Index_Pair* pSpecialContextIds ); + + + static void PrepareForMultiPropertySet_( + const ::std::vector & rProperties, + const css::uno::Reference< css::beans::XPropertySetInfo> & rPropSetInfo, + const rtl::Reference & rPropMapper, + ContextID_Index_Pair* pSpecialContextIds, + css::uno::Sequence< OUString >& rNames, + css::uno::Sequence< css::uno::Any >& rValues); + +private: + void importXMLAttribute( + std::vector< XMLPropertyState >& rProperties, + const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap, + sal_uInt32 nPropType, + sal_Int32 nStartIdx, + sal_Int32 nEndIdx, + css::uno::Reference< css::container::XNameContainer >& xAttrContainer, + const OUString& sAttrName, + const OUString& aNamespaceURI, + const OUString& sValue) const; +}; + + +inline const rtl::Reference< XMLPropertySetMapper >& + SvXMLImportPropertyMapper::getPropertySetMapper() const +{ + return maPropMapper; +} + +namespace xmloff { + +bool IsIgnoreFillStyleNamedItem( + css::uno::Reference const& xProps, + css::drawing::FillStyle nExpectedFillStyle); + +} + +#endif // INCLUDED_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 000000000..220807f55 --- /dev/null +++ b/include/xmloff/xmlmetae.hxx @@ -0,0 +1,102 @@ +/* -*- 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_XMLMETAE_HXX +#define INCLUDED_XMLOFF_XMLMETAE_HXX + +#include +#include + +#include +#include + +#include + +#include +#include + +namespace com::sun::star::document { class XDocumentProperties; } +namespace com::sun::star::util { struct DateTime; } + + +class SvXMLExport; + +/** export meta data from an XDocumentProperties instance. + +

+ This class will start the export at the office:meta element, + not at the root element. This means that when Export + is called here, the document root element must already be written, but + office:meta must not be written. +

+ */ +class SvXMLMetaExport final : public cppu::WeakImplHelper< + css::xml::sax::XDocumentHandler > +{ +private: + SvXMLExport& mrExport; + css::uno::Reference< css::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< css::beans::StringPair > m_preservedNSs; + + void SimpleStringElement( + const OUString& rText, sal_uInt16 nNamespace, + enum ::xmloff::token::XMLTokenEnum eElementName ); + void SimpleDateTimeElement( + const css::util::DateTime & rDate, sal_uInt16 nNamespace, + enum ::xmloff::token::XMLTokenEnum eElementName ); + + /// currently unused; for exporting via the XDocumentProperties interface + void MExport_(); + +public: + SvXMLMetaExport( SvXMLExport& i_rExport, + const css::uno::Reference< css::document::XDocumentProperties>& i_rDocProps); + + virtual ~SvXMLMetaExport() override; + + /// export via XSAXWriter interface, with fallback to _MExport + void Export(); + + static OUString GetISODateTimeString( + const css::util::DateTime& rDateTime ); + + // css::xml::sax::XDocumentHandler: + virtual void SAL_CALL startDocument() override; + virtual void SAL_CALL endDocument() override; + virtual void SAL_CALL startElement(const OUString & i_rName, + const css::uno::Reference< + css::xml::sax::XAttributeList > & i_xAttribs) override; + virtual void SAL_CALL endElement(const OUString & i_rName) override; + virtual void SAL_CALL characters(const OUString & i_rChars) override; + virtual void SAL_CALL ignorableWhitespace( + const OUString & i_rWhitespaces) override; + virtual void SAL_CALL processingInstruction( + const OUString & i_rTarget, const OUString & i_rData) override; + virtual void SAL_CALL setDocumentLocator( + const css::uno::Reference< + css::xml::sax::XLocator > & i_xLocator) override; + +}; + +#endif // INCLUDED_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 000000000..92fe0f085 --- /dev/null +++ b/include/xmloff/xmlmetai.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 INCLUDED_XMLOFF_XMLMETAI_HXX +#define INCLUDED_XMLOFF_XMLMETAI_HXX + +#include +#include +#include + + +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::document { class XDocumentProperties; } +namespace com::sun::star::xml::dom { class XSAXDocumentBuilder2; } + +/// 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: + css::uno::Reference< css::document::XDocumentProperties> mxDocProps; + css::uno::Reference< css::xml::dom::XSAXDocumentBuilder2> mxDocBuilder; + +public: + SvXMLMetaDocumentContext(SvXMLImport& rImport, + const css::uno::Reference< css::document::XDocumentProperties>& xDocProps); + + virtual ~SvXMLMetaDocumentContext() override; + + virtual void SAL_CALL startFastElement( sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; + + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; + +public: + void FinishMetaElement(); + + static void setBuildId(const OUString & rGenerator, + const css::uno::Reference< css::beans::XPropertySet>& xImportInfo ); +}; + +#endif // _ INCLUDED_XMLOFF_XMLMETAI_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/xmloff/xmlnamespace.hxx b/include/xmloff/xmlnamespace.hxx new file mode 100644 index 000000000..91ff2aae4 --- /dev/null +++ b/include/xmloff/xmlnamespace.hxx @@ -0,0 +1,142 @@ +/* -*- 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_XMLNMSPE_HXX +#define INCLUDED_XMLOFF_XMLNMSPE_HXX + +#include + +// 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! +// * standard ODF elements and attributes +constexpr sal_uInt16 XML_NAMESPACE_OFFICE = 0; +constexpr sal_uInt16 XML_NAMESPACE_STYLE = 1; +constexpr sal_uInt16 XML_NAMESPACE_TEXT = 2; +constexpr sal_uInt16 XML_NAMESPACE_TABLE = 3; +constexpr sal_uInt16 XML_NAMESPACE_DRAW = 4; +constexpr sal_uInt16 XML_NAMESPACE_FO = 5; +constexpr sal_uInt16 XML_NAMESPACE_XLINK = 6; +constexpr sal_uInt16 XML_NAMESPACE_DC = 7; +constexpr sal_uInt16 XML_NAMESPACE_META = 8; +constexpr sal_uInt16 XML_NAMESPACE_NUMBER = 9; +constexpr sal_uInt16 XML_NAMESPACE_PRESENTATION = 10; +constexpr sal_uInt16 XML_NAMESPACE_SVG = 11; +constexpr sal_uInt16 XML_NAMESPACE_CHART = 12; +constexpr sal_uInt16 XML_NAMESPACE_DR3D = 13; +constexpr sal_uInt16 XML_NAMESPACE_MATH = 14; +constexpr sal_uInt16 XML_NAMESPACE_FORM = 15; +constexpr sal_uInt16 XML_NAMESPACE_SCRIPT = 16; +constexpr sal_uInt16 XML_NAMESPACE_CONFIG = 17; +constexpr sal_uInt16 XML_NAMESPACE_DB = 18; +constexpr sal_uInt16 XML_NAMESPACE_XFORMS = 19; +constexpr sal_uInt16 XML_NAMESPACE_SMIL = 20; +constexpr sal_uInt16 XML_NAMESPACE_ANIMATION = 21; +constexpr sal_uInt16 XML_NAMESPACE_XML = 22; +constexpr sal_uInt16 XML_NAMESPACE_XHTML = 23; +constexpr sal_uInt16 XML_NAMESPACE_GRDDL = 24; +// * formula attribute values (standard ODF) +constexpr sal_uInt16 XML_NAMESPACE_OF = 25; // OpenFormula aka ODFF +// * event attribute values (standard W3C) +constexpr sal_uInt16 XML_NAMESPACE_DOM = 26; +// * XForms attribute values (standard W3C) +constexpr sal_uInt16 XML_NAMESPACE_XSD = 27; +constexpr sal_uInt16 XML_NAMESPACE_XSI = 28; +// * following 3 namespaces are used for non-standard attribute values and non-ODF XML +constexpr sal_uInt16 XML_NAMESPACE_OOO = 29; // lots of attributes, settings.xml, non-ODF XML +constexpr sal_uInt16 XML_NAMESPACE_OOOW = 30; // formula attribute values +constexpr sal_uInt16 XML_NAMESPACE_OOOC = 31; // formula attribute values +// non-ODF XML namespaces +constexpr sal_uInt16 XML_NAMESPACE_BLOCKLIST = 32; +constexpr sal_uInt16 XML_NAMESPACE_FRAMEWORK = 33; +constexpr sal_uInt16 XML_NAMESPACE_TCD = 34; // text conversion dictionary +constexpr sal_uInt16 XML_NAMESPACE_DLG = 35; +constexpr sal_uInt16 XML_NAMESPACE_REPORT = 36; +constexpr sal_uInt16 XML_NAMESPACE_VERSIONS_LIST = 37; +// OOo extension digital signatures, used in ODF 1.1 +constexpr sal_uInt16 XML_NAMESPACE_DSIG_OOO = 38; +// ODF 1.2 digital signature namespaces +constexpr sal_uInt16 XML_NAMESPACE_DSIG = 39; +constexpr sal_uInt16 XML_NAMESPACE_DS = 40; +constexpr sal_uInt16 XML_NAMESPACE_XADES132 = 41; +constexpr sal_uInt16 XML_NAMESPACE_XADES141 = 42; +// OOXML digital signature extension namespaces, also based on xmldsig-core +constexpr sal_uInt16 XML_NAMESPACE_MDSSI = 43; +constexpr sal_uInt16 XML_NAMESPACE_MSODIGSIG = 44; + +// namespaces for ODF extended formats +constexpr sal_uInt16 XML_NAMESPACE_EXT_BASE = 50; +constexpr sal_uInt16 XML_NAMESPACE_OFFICE_EXT = XML_NAMESPACE_EXT_BASE + 0; +constexpr sal_uInt16 XML_NAMESPACE_TABLE_EXT = XML_NAMESPACE_EXT_BASE + 1; +constexpr sal_uInt16 XML_NAMESPACE_CHART_EXT = XML_NAMESPACE_EXT_BASE + 2; +constexpr sal_uInt16 XML_NAMESPACE_DRAW_EXT = XML_NAMESPACE_EXT_BASE + 3; +constexpr sal_uInt16 XML_NAMESPACE_CALC_EXT = XML_NAMESPACE_EXT_BASE + 4; +constexpr sal_uInt16 XML_NAMESPACE_LO_EXT = XML_NAMESPACE_EXT_BASE + 5; + +// experimental ODF extended namespaces +constexpr sal_uInt16 XML_NAMESPACE_FIELD = XML_NAMESPACE_EXT_BASE + 6; +constexpr sal_uInt16 XML_NAMESPACE_CSS3TEXT = XML_NAMESPACE_EXT_BASE + 7; // CSS Text Level 3 +constexpr sal_uInt16 XML_NAMESPACE_FORMX = XML_NAMESPACE_EXT_BASE + 8; // form interop extensions + + +// namespaces for OOo formats +constexpr sal_uInt16 XML_NAMESPACE_OOO_BASE = 60; +constexpr sal_uInt16 XML_NAMESPACE_OFFICE_OOO = XML_NAMESPACE_OOO_BASE + 0; +constexpr sal_uInt16 XML_NAMESPACE_META_OOO = XML_NAMESPACE_OOO_BASE + 1; +constexpr sal_uInt16 XML_NAMESPACE_STYLE_OOO = XML_NAMESPACE_OOO_BASE + 2; +constexpr sal_uInt16 XML_NAMESPACE_NUMBER_OOO = XML_NAMESPACE_OOO_BASE + 3; +constexpr sal_uInt16 XML_NAMESPACE_TEXT_OOO = XML_NAMESPACE_OOO_BASE + 4; +constexpr sal_uInt16 XML_NAMESPACE_TABLE_OOO = XML_NAMESPACE_OOO_BASE + 5; +constexpr sal_uInt16 XML_NAMESPACE_DRAW_OOO = XML_NAMESPACE_OOO_BASE + 6; +constexpr sal_uInt16 XML_NAMESPACE_DR3D_OOO = XML_NAMESPACE_OOO_BASE + 7; +constexpr sal_uInt16 XML_NAMESPACE_PRESENTATION_OOO = XML_NAMESPACE_OOO_BASE + 8; +constexpr sal_uInt16 XML_NAMESPACE_PRESENTATION_OASIS = XML_NAMESPACE_OOO_BASE + 9; // only used for some config files in sd/ +constexpr sal_uInt16 XML_NAMESPACE_CHART_OOO = XML_NAMESPACE_OOO_BASE + 10; +constexpr sal_uInt16 XML_NAMESPACE_CONFIG_OOO = XML_NAMESPACE_OOO_BASE + 12; +constexpr sal_uInt16 XML_NAMESPACE_FORM_OOO = XML_NAMESPACE_OOO_BASE + 13; +constexpr sal_uInt16 XML_NAMESPACE_SCRIPT_OOO = XML_NAMESPACE_OOO_BASE + 14; +constexpr sal_uInt16 XML_NAMESPACE_ANIMATION_OOO = XML_NAMESPACE_OOO_BASE + 15; + +constexpr sal_uInt16 XML_NAMESPACE_COMPAT_BASE = 80; +constexpr sal_uInt16 XML_NAMESPACE_SVG_COMPAT = XML_NAMESPACE_COMPAT_BASE + 0; +constexpr sal_uInt16 XML_NAMESPACE_FO_COMPAT = XML_NAMESPACE_COMPAT_BASE + 1; +constexpr sal_uInt16 XML_NAMESPACE_SMIL_COMPAT = XML_NAMESPACE_COMPAT_BASE + 2; + +constexpr sal_uInt16 XML_NAMESPACE_OASIS_BASE = 90; +constexpr sal_uInt16 XML_NAMESPACE_DB_OASIS = XML_NAMESPACE_OASIS_BASE + 0; +constexpr sal_uInt16 XML_NAMESPACE_REPORT_OASIS = XML_NAMESPACE_OASIS_BASE + 1; + +// namespaces used in the technical preview (SO 5.2) +constexpr sal_uInt16 XML_OLD_NAMESPACE_BASE = 100; +constexpr sal_uInt16 XML_NAMESPACE_FO_SO52 = XML_OLD_NAMESPACE_BASE + 0; +constexpr sal_uInt16 XML_NAMESPACE_XLINK_SO52 = XML_OLD_NAMESPACE_BASE + 1; +constexpr sal_uInt16 XML_NAMESPACE_OFFICE_SO52 = XML_OLD_NAMESPACE_BASE + 2; +constexpr sal_uInt16 XML_NAMESPACE_STYLE_SO52 = XML_OLD_NAMESPACE_BASE + 3; +constexpr sal_uInt16 XML_NAMESPACE_TEXT_SO52 = XML_OLD_NAMESPACE_BASE + 4; +constexpr sal_uInt16 XML_NAMESPACE_TABLE_SO52 = XML_OLD_NAMESPACE_BASE + 5; +constexpr sal_uInt16 XML_NAMESPACE_META_SO52 = XML_OLD_NAMESPACE_BASE + 6; +constexpr sal_uInt16 XML_NAMESPACE_DRAW_SO52 = XML_OLD_NAMESPACE_BASE + 7; +constexpr sal_uInt16 XML_NAMESPACE_NUMBER_SO52 = XML_OLD_NAMESPACE_BASE + 8; +constexpr sal_uInt16 XML_NAMESPACE_PRESENTATION_SO52 = XML_OLD_NAMESPACE_BASE + 9; +constexpr sal_uInt16 XML_NAMESPACE_CHART_SO52 = XML_OLD_NAMESPACE_BASE + 10; +constexpr sal_uInt16 XML_NAMESPACE_SMIL_SO52 = XML_OLD_NAMESPACE_BASE + 11; + +#endif // INCLUDED_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 000000000..68818f107 --- /dev/null +++ b/include/xmloff/xmlnume.hxx @@ -0,0 +1,76 @@ +/* -*- 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_XMLNUME_HXX +#define INCLUDED_XMLOFF_XMLNUME_HXX + +#include +#include + +namespace com::sun::star { + namespace style { class XStyle; } + namespace container { class XIndexReplace; } + namespace beans { struct PropertyValue; } +} + +namespace com::sun::star::uno { template class Sequence; } +namespace com::sun::star::uno { template class Reference; } + +class SvXMLExport; +class XMLTextListAutoStylePool; + +class XMLOFF_DLLPUBLIC SvxXMLNumRuleExport final +{ + SvXMLExport& rExport; + // Boolean indicating, if properties for position-and-space-mode LABEL_ALIGNMENT + // 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; + + SAL_DLLPRIVATE void exportLevelStyle( + sal_Int32 nLevel, + const css::uno::Sequence< css::beans::PropertyValue>& rProps, + bool bOutline ); + + SAL_DLLPRIVATE void exportStyle( const css::uno::Reference< css::style::XStyle >& rStyle ); + SAL_DLLPRIVATE void exportOutline(); + + SvXMLExport& GetExport() { return rExport; } + +public: + + SvxXMLNumRuleExport( SvXMLExport& rExport ); + + // should be private but sw::StoredChapterNumberingExport needs it + void exportLevelStyles( + const css::uno::Reference< css::container::XIndexReplace > & xNumRule, + bool bOutline=false ); + + void exportStyles( bool bUsed, + XMLTextListAutoStylePool *pPool, + bool bExportChapterNumbering ); + void exportNumberingRule( + const OUString& rName, bool bIsHidden, + const css::uno::Reference< css::container::XIndexReplace > & xNumRule ); +}; + +#endif // INCLUDED_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 000000000..3d1f48ddf --- /dev/null +++ b/include/xmloff/xmlnumfe.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 INCLUDED_XMLOFF_XMLNUMFE_HXX +#define INCLUDED_XMLOFF_XMLNUMFE_HXX + +#include +#include +#include +#include +#include +#include +#include + +namespace com::sun::star::lang { struct Locale; } +namespace com::sun::star::uno { template class Reference; } +namespace com::sun::star::util { class XNumberFormatsSupplier; } + +inline constexpr OUStringLiteral XML_WRITTENNUMBERSTYLES = u"WrittenNumberStyles"; + +class Color; +class LocaleDataWrapper; +class CharClass; +class SvXMLExport; +class SvNumberFormatter; +class SvNumberformat; +class SvXMLNumUsedList_Impl; + +class SvXMLEmbeddedTextEntryArr; + +class XMLOFF_DLLPUBLIC SvXMLNumFmtExport final +{ +private: + SvXMLExport& rExport; + OUString sPrefix; + SvNumberFormatter* pFormatter; + OUStringBuffer sTextContent; + bool bHasText; + std::unique_ptr pUsedList; + std::unique_ptr pLocaleData; + + SAL_DLLPRIVATE void AddCalendarAttr_Impl( const OUString& rCalendar ); + SAL_DLLPRIVATE void AddStyleAttr_Impl( bool bLong ); + SAL_DLLPRIVATE void AddLanguageAttr_Impl( LanguageType nLang ); + + SAL_DLLPRIVATE void AddToTextElement_Impl( std::u16string_view rString ); + SAL_DLLPRIVATE void FinishTextElement_Impl(bool bUseExtensionNS = false); + + SAL_DLLPRIVATE void WriteColorElement_Impl( const Color& rColor ); + SAL_DLLPRIVATE void WriteNumberElement_Impl( sal_Int32 nDecimals, sal_Int32 nMinDecimals, + sal_Int32 nInteger, const OUString& rDashStr, + bool bGrouping, sal_Int32 nTrailingThousands, + const SvXMLEmbeddedTextEntryArr& rEmbeddedEntries ); + SAL_DLLPRIVATE void WriteScientificElement_Impl( sal_Int32 nDecimals, sal_Int32 nMinDecimals, sal_Int32 nInteger, + bool bGrouping, sal_Int32 nExp, sal_Int32 nExpInterval, bool bExpSign ); + SAL_DLLPRIVATE void WriteFractionElement_Impl( sal_Int32 nInteger, bool bGrouping, + const SvNumberformat& rFormat, sal_uInt16 nPart ); + SAL_DLLPRIVATE void WriteCurrencyElement_Impl( const OUString& rString, + std::u16string_view rExt ); + SAL_DLLPRIVATE void WriteBooleanElement_Impl(); + SAL_DLLPRIVATE void WriteTextContentElement_Impl(); + SAL_DLLPRIVATE void WriteDayElement_Impl( const OUString& rCalendar, bool bLong ); + SAL_DLLPRIVATE void WriteMonthElement_Impl( const OUString& rCalendar, bool bLong, bool bText ); + SAL_DLLPRIVATE void WriteYearElement_Impl( const OUString& rCalendar, bool bLong ); + SAL_DLLPRIVATE void WriteEraElement_Impl( const OUString& rCalendar, bool bLong ); + SAL_DLLPRIVATE void WriteDayOfWeekElement_Impl( const OUString& rCalendar, bool bLong ); + SAL_DLLPRIVATE void WriteWeekElement_Impl( const OUString& rCalendar ); + SAL_DLLPRIVATE void WriteQuarterElement_Impl( const OUString& rCalendar, bool bLong ); + SAL_DLLPRIVATE void WriteHoursElement_Impl( bool bLong ); + SAL_DLLPRIVATE void WriteMinutesElement_Impl( bool bLong ); + SAL_DLLPRIVATE void WriteSecondsElement_Impl( 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 bool WriteTextWithCurrency_Impl( const OUString& rString, + const css::lang::Locale& rLocale ); + SAL_DLLPRIVATE void ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey, sal_uInt32 nRealKey, + sal_uInt16 nPart, bool bDefPart ); + + SAL_DLLPRIVATE void ExportFormat_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey, sal_uInt32 nRealKey ); + +public: + SvXMLNumFmtExport( SvXMLExport& rExport, + const css::uno::Reference< css::util::XNumberFormatsSupplier >& rSupp ); + SvXMLNumFmtExport( SvXMLExport& rExport, + const css::uno::Reference< css::util::XNumberFormatsSupplier >& rSupp, + const OUString& rPrefix ); + + ~SvXMLNumFmtExport(); + + // core API + void Export( 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 ); + + css::uno::Sequence GetWasUsed() const; + void SetWasUsed(const css::uno::Sequence& rWasUsed); + + + // two methods to allow the field import/export to treat system languages + // properly: + + /// obtain number format with system language for a given key + sal_uInt32 ForceSystemLanguage( 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 000000000..9a18893df --- /dev/null +++ b/include/xmloff/xmlnumfi.hxx @@ -0,0 +1,217 @@ +/* -*- 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_XMLNUMFI_HXX +#define INCLUDED_XMLOFF_XMLNUMFI_HXX + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace com::sun::star::uno { class XComponentContext; } +namespace com::sun::star::util { class XNumberFormatsSupplier; } +namespace com::sun::star::xml::sax { class XAttributeList; } + +inline constexpr OUStringLiteral XML_NUMBERSTYLES = u"NumberStyles"; + +enum class SvXMLStylesTokens +{ + NUMBER_STYLE, + CURRENCY_STYLE, + PERCENTAGE_STYLE, + DATE_STYLE, + TIME_STYLE, + BOOLEAN_STYLE, + 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; +struct SvXMLNumberInfo; +class SvNumberFormatter; +class LocaleDataWrapper; + + +// use SvXMLNumFmtHelper in the context for to create +// child contexts for data styles + +class SvXMLNumFmtHelper +{ + std::unique_ptr pData; + +public: + SvXMLNumFmtHelper( + const css::uno::Reference< css::util::XNumberFormatsSupplier >& rSupp, + const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + + SvXMLNumFmtHelper( + SvNumberFormatter* pNumberFormatter, + const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + + ~SvXMLNumFmtHelper(); + + SvXMLStyleContext* CreateChildContext( SvXMLImport& rImport, + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, + SvXMLStylesContext& rStyles); + + SvXMLNumImpData* getData() { return pData.get(); } + + LanguageType GetLanguageForKey(sal_Int32 nKey) const; + +// 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, + bool bSystem ); +}; + +struct MyCondition +{ + OUString sCondition; + OUString sMapName; +}; + +class XMLOFF_DLLPUBLIC SvXMLNumFormatContext : public SvXMLStyleContext +{ +public: + enum ImplicitCalendar + { + DEFAULT, + SECONDARY, + OTHER, + DEFAULT_FROM_OTHER, + SECONDARY_FROM_OTHER + }; + +private: + + SvXMLNumImpData* pData; + SvXMLStylesContext* pStyles; + std::vector aMyConditions; + SvXMLStylesTokens nType; + sal_Int32 nKey; +// OUString sFormatName; + OUString sFormatTitle; +// OUString sMapName; + OUString sCalendar; + OUString aImplicitCalendar[2]; + ImplicitCalendar eImplicitCalendar; + LanguageType nFormatLang; + bool bAutoOrder; + bool bFromSystem; + bool bTruncate; + bool bAutoDec; // set in AddNumber + bool bAutoInt; // set in AddNumber + bool bHasExtraText; + bool bHasTrailingEmptyText; + OUStringBuffer aFormatCode{64}; + OUStringBuffer aConditions{32}; + bool bHasLongDoW; + bool bHasDateTime; + 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; + bool bDateNoDefault; + + SAL_DLLPRIVATE sal_Int32 PrivateGetKey(); + +public: + SvXMLNumFormatContext( SvXMLImport& rImport, + sal_Int32 nElement, + SvXMLNumImpData* pNewData, + SvXMLStylesTokens nNewType, + const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList, + SvXMLStylesContext& rStyles ); + SvXMLNumFormatContext( SvXMLImport& rImport, + const OUString& rName, + const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList, + const sal_Int32 nKey, + LanguageType nLang, + SvXMLStylesContext& rStyles ); + virtual ~SvXMLNumFormatContext() override; + + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; + virtual void CreateAndInsert(bool bOverwrite) override; + + sal_Int32 GetKey(); + sal_Int32 CreateAndInsert( SvNumberFormatter* pFormatter ); + sal_Int32 CreateAndInsert( css::uno::Reference< css::util::XNumberFormatsSupplier > const & xFormatsSupplier ); + SvXMLStylesTokens GetType() const { return nType; } // SvXMLStylesTokens + + bool HasLongDoW() const { return bHasLongDoW; } + void SetHasLongDoW(bool bSet) { bHasLongDoW = bSet; } + void SetHasTrailingEmptyText(bool bSet) { bHasTrailingEmptyText = bSet; } + + void UpdateCalendar( const OUString& rNewCalendar ); + ImplicitCalendar GetImplicitCalendarState() const { return eImplicitCalendar; } + + const LocaleDataWrapper& GetLocaleData() const; + + void AddToCode( std::u16string_view rString ); + void AddToCode( sal_Unicode c ); + void AddNumber( const SvXMLNumberInfo& rInfo ); + void AddCurrency( const OUString& rContent, LanguageType nLang ); + + void AddNfKeyword( sal_uInt16 nIndex ); + bool ReplaceNfKeyword( sal_uInt16 nOld, sal_uInt16 nNew ); + void AddCondition( const sal_Int32 nIndex ); + void AddCondition( const OUString& rCondition, const OUString& rApplyName ); + void AddColor( Color nColor ); + + /// determine whether number format uses the system language + bool IsSystemLanguage() const; +}; + +#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 000000000..4adfd437b --- /dev/null +++ b/include/xmloff/xmlnumi.hxx @@ -0,0 +1,82 @@ +/* -*- 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_XMLNUMI_HXX +#define INCLUDED_XMLOFF_XMLNUMI_HXX + +#include + +#include +#include + +#include + +namespace com::sun::star::frame { class XModel; } +namespace com::sun::star::container { class XIndexReplace; } + +class SvxXMLListLevelStyleContext_Impl; +typedef std::vector> SvxXMLListStyle_Impl; + +class XMLOFF_DLLPUBLIC SvxXMLListStyleContext final + : public SvXMLStyleContext +{ + css::uno::Reference< css::container::XIndexReplace > xNumRules; + + std::unique_ptr pLevelStyles; + + bool bConsecutive : 1; + bool bOutline : 1; + + SAL_DLLPRIVATE virtual void SetAttribute( sal_Int32 nElement, + const OUString& rValue ) override; + +public: + + SvxXMLListStyleContext( + SvXMLImport& rImport, + bool bOutl = false ); + + ~SvxXMLListStyleContext() override; + + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; + + void FillUnoNumRule( + const css::uno::Reference< css::container::XIndexReplace> & rNumRule) const; + + const css::uno::Reference< css::container::XIndexReplace >& GetNumRules() const + { return xNumRules; } + + static css::uno::Reference< css::container::XIndexReplace > + CreateNumRule( + const css::uno::Reference< css::frame::XModel > & rModel ); + + static void SetDefaultStyle( + const css::uno::Reference< css::container::XIndexReplace > & rNumRule, + sal_Int16 nLevel, + bool bOrdered ); + + virtual void CreateAndInsertLate( bool bOverwrite ) override; + + void CreateAndInsertAuto() const; +}; + +#endif // INCLUDED_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 000000000..37ce9ba2c --- /dev/null +++ b/include/xmloff/xmlprcon.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 INCLUDED_XMLOFF_XMLPRCON_HXX +#define INCLUDED_XMLOFF_XMLPRCON_HXX + +#include + +#include + +class SvXMLImportPropertyMapper; +struct XMLPropertyState; + +class XMLOFF_DLLPUBLIC SvXMLPropertySetContext : public SvXMLImportContext +{ +protected: + sal_Int32 mnStartIdx; + sal_Int32 mnEndIdx; + sal_uInt32 mnFamily; + ::std::vector< XMLPropertyState > &mrProperties; + rtl::Reference < SvXMLImportPropertyMapper > mxMapper; + +public: + + SvXMLPropertySetContext( + SvXMLImport& rImport, sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, + sal_uInt32 nFamily, + ::std::vector< XMLPropertyState > &rProps, + const rtl::Reference < SvXMLImportPropertyMapper > &rMap, + sal_Int32 nStartIdx = -1, sal_Int32 nEndIdx = -1 ); + + virtual ~SvXMLPropertySetContext() override; + + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; + + // 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 css::uno::Reference< css::xml::sax::XFastContextHandler > createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, + ::std::vector< XMLPropertyState > &rProperties, + const XMLPropertyState& rProp ); + +}; + +#endif // INCLUDED_XMLOFF_XMLPRCON_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 000000000..e0b5a7edc --- /dev/null +++ b/include/xmloff/xmlprhdl.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 INCLUDED_XMLOFF_XMLPRHDL_HXX +#define INCLUDED_XMLOFF_XMLPRHDL_HXX + +#include +#include +#include + +namespace com::sun::star::uno { class Any; } + +class SvXMLUnitConverter; + + +/** 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 +{ + +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 css::uno::Any& r1, const css::uno::Any& r2 ) const; + + /** Imports the given value according to the XML-data-type corresponding to + the derived class. + @retval true if the value was successfully converted to Any + @retval false if the value was not recognised (warning will be printed) + */ + virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const =0; + /// Exports the given value according to the XML-data-type corresponding to + /// the derived class. + virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const =0; +}; + +#endif // INCLUDED_XMLOFF_XMLPRHDL_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 000000000..2a4b93e84 --- /dev/null +++ b/include/xmloff/xmlprmap.hxx @@ -0,0 +1,128 @@ +/* -*- 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_XMLPRMAP_HXX +#define INCLUDED_XMLOFF_XMLPRMAP_HXX + +#include +#include +#include + +#include +#include + +namespace rtl { template class Reference; } + +class SvXMLUnitConverter; +class XMLPropertyHandler; +class XMLPropertyHandlerFactory; +struct XMLPropertyMapEntry; +struct XMLPropertyState; + +class XMLOFF_DLLPUBLIC XMLPropertySetMapper : public salhelper::SimpleReferenceObject +{ + struct Impl; + + std::unique_ptr mpImpl; + + XMLPropertySetMapper( const XMLPropertySetMapper& ) = delete; + XMLPropertySetMapper& operator= ( const XMLPropertySetMapper& ) = delete; + +public: + /** The last element of the XMLPropertyMapEntry-array must contain NULL-values. + + @param bForExport + If TRUE, only entries that have the mbImportOnly flag not set + will be in the mappings. + */ + XMLPropertySetMapper( + const XMLPropertyMapEntry* pEntries, + const rtl::Reference& rFactory, + bool bForExport ); + + virtual ~XMLPropertySetMapper() override; + + void AddMapperEntry( const rtl::Reference < XMLPropertySetMapper >& rMapper ); + + /** Return number of entries in input-array */ + sal_Int32 GetEntryCount() const; + + /** Returns the flags of an entry */ + sal_uInt32 GetEntryFlags( sal_Int32 nIndex ) const; + + /** Returns the type of an entry */ + sal_uInt32 GetEntryType( sal_Int32 nIndex ) const; + + /** Returns the namespace-key of an entry */ + sal_uInt16 GetEntryNameSpace( sal_Int32 nIndex ) const; + + /** Returns the 'local' XML-name of the entry */ + const OUString& GetEntryXMLName( sal_Int32 nIndex ) const; + + /** Returns the entry API name */ + const OUString& GetEntryAPIName( sal_Int32 nIndex ) const; + + /** returns the entry context id. -1 is a valid index here. */ + sal_Int16 GetEntryContextId( sal_Int32 nIndex ) const; + + /** returns the earliest ODF version for which this property should be + exported as standard ODF element, which is the earliest ODF version + for which the property should not be exported as extension element. + */ + SvtSaveOptions::ODFSaneDefaultVersion GetEarliestODFVersionForExport(sal_Int32 nIndex) const; + + /** 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, std::u16string_view rStrName, sal_uInt32 nPropType, + sal_Int32 nStartAt = -1 ) const; + + /** 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_Int32 nElement, sal_uInt32 nPropType, + sal_Int32 nStartAt = -1 ) const; + + /** Retrieves a PropertyHandler for that property which placed at nIndex in the XMLPropertyMapEntry-array */ + const XMLPropertyHandler* GetPropertyHandler( sal_Int32 nIndex ) const; + + /** import/export + This methods calls the respective im/export-method of the respective PropertyHandler. */ + bool exportXML( + OUString& rStrExpValue, const XMLPropertyState& rProperty, + const SvXMLUnitConverter& rUnitConverter ) const; + + 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 char* sApiName, sal_uInt16 nNameSpace, std::u16string_view 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 // INCLUDED_XMLOFF_XMLPRMAP_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 000000000..0be5a0c6f --- /dev/null +++ b/include/xmloff/xmlscripti.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 INCLUDED_XMLOFF_XMLSCRIPTI_HXX +#define INCLUDED_XMLOFF_XMLSCRIPTI_HXX + +#include +#include +#include + +namespace com::sun::star::frame { + class XModel; +} + +class XMLOFF_DLLPUBLIC XMLScriptContext final : public SvXMLImportContext +{ +private: + css::uno::Reference< css::frame::XModel > m_xModel; + +public: + XMLScriptContext( SvXMLImport& rImport, + const css::uno::Reference< css::frame::XModel>& rDocModel ); + virtual ~XMLScriptContext() override; + + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; +}; + +#endif // INCLUDED_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 000000000..04a74b841 --- /dev/null +++ b/include/xmloff/xmlstyle.hxx @@ -0,0 +1,205 @@ +/* -*- 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_XMLSTYLE_HXX +#define INCLUDED_XMLOFF_XMLSTYLE_HXX + +#include +#include +#include +#include +#include +#include +#include + +class SvXMLStylesContext_Impl; +class SvXMLImportPropertyMapper; +class SvXMLTokenMap; + +namespace com::sun::star { +namespace container { class XNameContainer; } +namespace style { class XAutoStyleFamily; } +} + +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!!!! + OUString maLinked; + bool mbHidden; + + XmlStyleFamily mnFamily; + + bool mbValid : 1; // Set this to false in CreateAndInsert + // if the style shouldn't be processed + // by Finish() or si somehow invalid. + bool mbNew : 1; // Set this to false in CreateAnsInsert + // if the style is already existing. + bool mbDefaultStyle : 1; + +protected: + + virtual void SetAttribute( sal_Int32 nElement, const OUString& rValue ); + + void SetFamily( XmlStyleFamily nSet ) { mnFamily = nSet; } + void SetAutoName( const OUString& rName ) { maAutoName = rName; } + +public: + + SvXMLStyleContext( SvXMLImport& rImport, + XmlStyleFamily nFamily=XmlStyleFamily::DATA_STYLE, + bool bDefaultStyle = false ); + + virtual ~SvXMLStyleContext() override; + + virtual void SAL_CALL startFastElement( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override; + + 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& GetLinked() const { return maLinked; } + + XmlStyleFamily GetFamily() const { return mnFamily; } + + bool IsValid() const { return mbValid; } + void SetValid( bool b ) { mbValid = b; } + + bool IsNew() const { return mbNew; } + void SetNew( bool b ) { mbNew = b; } + + 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( 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( bool bOverwrite ); + + // This method is called for every style after all styles have been + // inserted into the document. + virtual void Finish( bool bOverwrite ); + + bool IsDefaultStyle() const { return mbDefaultStyle; } + + /** if this method returns true, its parent styles context + should not add it to its container.
+ Transient styles can't be accessed from its + parent SvXMLStylesContext after they are imported and + the methods CreateAndInsert(), CreateAndInsertLate() + and Finish() will not be called. + The default return value is false + */ + virtual bool IsTransient() const; +}; + +class XMLOFF_DLLPUBLIC SvXMLStylesContext : public SvXMLImportContext +{ + std::unique_ptr mpImpl; + + + css::uno::Reference< css::container::XNameContainer > mxParaStyles; + + css::uno::Reference< css::container::XNameContainer > mxTextStyles; + + css::uno::Reference< css::style::XAutoStyleFamily > mxParaAutoStyles; + + css::uno::Reference< css::style::XAutoStyleFamily > mxTextAutoStyles; + + rtl::Reference < SvXMLImportPropertyMapper > mxParaImpPropMapper; + rtl::Reference < SvXMLImportPropertyMapper > mxTextImpPropMapper; + rtl::Reference < SvXMLImportPropertyMapper > mxShapeImpPropMapper; + mutable rtl::Reference < SvXMLImportPropertyMapper > mxChartImpPropMapper; + mutable rtl::Reference < SvXMLImportPropertyMapper > mxPageImpPropMapper; + + SvXMLStylesContext(SvXMLStylesContext const &) = delete; + SvXMLStylesContext& operator =(SvXMLStylesContext const &) = delete; + +protected: + + sal_uInt32 GetStyleCount() const; + SvXMLStyleContext *GetStyle( sal_uInt32 i ); + const SvXMLStyleContext *GetStyle( sal_uInt32 i ) const; + + virtual SvXMLStyleContext *CreateStyleChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ); + + virtual SvXMLStyleContext *CreateStyleStyleChildContext( XmlStyleFamily nFamily, + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ); + + virtual SvXMLStyleContext *CreateDefaultStyleStyleChildContext( + XmlStyleFamily nFamily, sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ); + + virtual bool InsertStyleFamily( XmlStyleFamily nFamily ) const; + +public: + + SvXMLStylesContext( SvXMLImport& rImport, + bool bAutomatic = false ); + + virtual ~SvXMLStylesContext() override; + + // Create child element. + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; + + // This allows to add an SvXMLStyleContext to this context from extern + void AddStyle(SvXMLStyleContext& rNew); + + const SvXMLStyleContext *FindStyleChildContext( + XmlStyleFamily nFamily, + const OUString& rName, + bool bCreateIndex = false ) const; + static XmlStyleFamily GetFamily( std::u16string_view rFamily ); + virtual rtl::Reference < SvXMLImportPropertyMapper > GetImportPropertyMapper( + XmlStyleFamily nFamily ) const; + + virtual css::uno::Reference< css::container::XNameContainer > + GetStylesContainer( XmlStyleFamily nFamily ) const; + virtual OUString GetServiceName( XmlStyleFamily nFamily ) const; + + css::uno::Reference< css::style::XAutoStyleFamily > + GetAutoStyles( XmlStyleFamily nFamily ) const; + void CopyAutoStylesToDoc(); + void CopyStylesToDoc( bool bOverwrite, bool bFinish = true ); + void FinishStyles( bool bOverwrite ); + + // This method must be called to release the references to all styles + // that are stored in the context. + void dispose(); + bool IsAutomaticStyle() const; +}; + +#endif // INCLUDED_XMLOFF_XMLSTYLE_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 000000000..e47719960 --- /dev/null +++ b/include/xmloff/xmltkmap.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_XMLTKMAP_HXX +#define INCLUDED_XMLOFF_XMLTKMAP_HXX + +#include +#include +#include +#include +#include + + +class SvXMLTokenMap_Impl; + +#define XML_TOK_UNKNOWN 0xffffU +#define XML_TOKEN_MAP_END { 0xffffU, xmloff::token::XML_TOKEN_INVALID, 0U } + +struct SvXMLTokenMapEntry +{ + enum xmloff::token::XMLTokenEnum eLocalName; + sal_uInt16 nPrefixKey; + sal_uInt16 nToken; + + SvXMLTokenMapEntry( sal_uInt16 nPrefix, xmloff::token::XMLTokenEnum eName, + sal_uInt16 nTok ) : + eLocalName( eName ), + nPrefixKey( nPrefix ), + nToken( nTok ) + { + } +}; + +class XMLOFF_DLLPUBLIC SvXMLTokenMap +{ +private: + std::unique_ptr m_pImpl; + +public: + + SvXMLTokenMap( const SvXMLTokenMapEntry* pMap ); + ~SvXMLTokenMap(); + + sal_uInt16 Get( sal_uInt16 nPrefix, const OUString& rLName ) const; +}; + +#endif // INCLUDED_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 000000000..77f9c605b --- /dev/null +++ b/include/xmloff/xmltoken.hxx @@ -0,0 +1,3532 @@ +/* -*- 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_XMLTOKEN_HXX +#define INCLUDED_XMLOFF_XMLTOKEN_HXX + +#include +#include +#include +#include + +/** + * 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::token { + + // IMPORTANT! XMLTokenEnum order MUST be in synch with aTokenList in + // xmloff/source/core/xmltoken.cxx, and with xmloff/source/token/tokens.txt. + + /** + * The enumeration of all XML tokens. + */ + enum XMLTokenEnum : sal_Int16 + { + 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_TCD, + XML_N_TCD, + 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, + + // OOo extension digital signatures, used in ODF 1.1 + XML_NP_DSIG_OOO, + XML_N_DSIG_OOO, + // ODF 1.2 digital signatures + XML_NP_DSIG, + XML_N_DSIG, + XML_NP_DS, + XML_N_DS, + XML_NP_XADES132, + XML_N_XADES132, + XML_NP_XADES141, + XML_N_XADES141, + + // 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, + // generic LO extensions + XML_NP_LO_EXT, + XML_N_LO_EXT, + + // enhanced fields + XML_N_FIELD, + XML_NP_FIELD, + + // units + XML_UNIT_M, + XML_UNIT_CM, + XML_UNIT_PT, + XML_UNIT_PC, + XML_UNIT_FOOT, + + // 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_ALLOW_DELETES, + XML_ALLOW_INSERTS, + XML_ALLOW_UPDATES, + 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_DESIGN_MODE, + 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_COMPLETE, + 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_FOCUS, + XML_AUTOMATIC_ORDER, + XML_AUTOMATIC_STYLES, + XML_AUTOMATIC_UPDATE, + XML_AUTOSIZE, + XML_AVERAGE, + XML_AVERAGED_ABSCISSA, + XML_AXIS, + XML_AXIS_COLOR, + XML_BACK_SCALE, + XML_BACKFACE_CULLING, + XML_BACKGROUND, + XML_BACKGROUND_COLOR, + XML_BACKGROUND_IMAGE, + XML_BACKGROUND_NO_REPEAT, + XML_BAR, + XML_BASE64BINARY, + XML_BASE_CELL_ADDRESS, + XML_BASELINE, + XML_BEFORE_DATE_TIME, + XML_BELOW, + XML_BETWEEN_DATE_TIMES, + XML_BEVEL, + XML_BEVELLED, + 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_BITMAP_TABLE, + 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_BOUND_COLUMN, + 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_BUTTON_TYPE, + XML_BVAR, + XML_C, + XML_CALCULATION_SETTINGS, + XML_CALENDAR, + XML_CAPITALIZE_ENTRIES, + XML_CAN_ADD_COMMENT, + 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_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_CENTRAL, + 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_CHAR_SHADING_VALUE, + 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_CN, + XML_CODE, + XML_CODEBASE, + XML_COLLAPSE, + XML_COLOR, + XML_COLOR_AXIS, + XML_COLOR_FIRST, + XML_COLOR_HIGH, + XML_COLOR_INVERSION, + XML_COLOR_LAST, + XML_COLOR_LOW, + XML_COLOR_MARKERS, + XML_COLOR_MODE, + XML_COLOR_NEGATIVE, + XML_COLOR_SERIES, + XML_COLOR_SCALE, + XML_COLOR_SCALE_ENTRY, + XML_COLOR_TABLE, + XML_COLUMN, + XML_COLUMN_COUNT, + XML_COLUMN_GAP, + XML_COLUMN_NAME, + XML_COLUMN_SEP, + XML_COLUMN_WIDTH, + XML_COLUMNALIGN, + XML_COLUMNS, + 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_CONVERSION_TYPE, + XML_CONVERT_EMPTY_TO_NULL, + 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_CUSTOM_ICONSET, + XML_CUSTOM_ICONSET_INDEX, + XML_CUSTOM_ICONSET_NAME, + XML_CUSTOM_LABEL_FIELD, + XML_CUSTOM_LABEL_POS_X, + XML_CUSTOM_LABEL_POS_Y, + XML_CUSTOM_LEADERLINES, + XML_CUT, + XML_CUT_OFFS, + XML_CUT_OFFS2, + XML_CX, + XML_CY, + XML_CYLINDER, + XML_D, + XML_DASH, + XML_DASH_DOT, + XML_DASH_DOT_DOT, + XML_DASH_TABLE, + XML_DASHED, + XML_DATA, + XML_DATA_BAR, + XML_DATA_BAR_ENTRY, + XML_DATA_CELL_RANGE_ADDRESS, + XML_DATA_LABEL, + XML_DATA_LABEL_GUID, + XML_DATA_LABEL_NUMBER, + XML_DATA_LABEL_SYMBOL, + XML_DATA_LABEL_TEXT, + XML_DATA_LABEL_SERIES, + XML_DATA_LABELS_CELL_RANGE, + XML_DATA_PILOT_SOURCE, + 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_RANGE, + XML_DATA_STREAM_SOURCE, + 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_DATABASE_TABLE_NAME, + XML_DATE, + XML_DATE_AXIS, + XML_DATE_IS, + XML_DATE_ADJUST, + XML_DATE_STYLE, + XML_DATE_TIME, + XML_DATE_TIME_UPDATE, + XML_DATE_TIME_VISIBLE, + 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_BUTTON, + XML_DEFAULT_CELL_STYLE_NAME, + XML_DEFAULT_STYLE, + XML_DEFAULT_STYLE_NAME, + XML_DEGREE, + XML_DELAY, + XML_DELAY_FOR_REPEAT, + XML_DELETE_COLUMNS, + XML_DELETE_ROWS, + XML_DELETION, + XML_DELETIONS, + XML_DENOMALIGN, + 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_EMPTY_CELLS_AS, + XML_DISPLAY_FILTER_BUTTONS, + XML_DISPLAY_FORMULA, + XML_DISPLAY_HIDDEN, + XML_DISPLAY_LABEL, + XML_DISPLAY_LEVELS, + XML_DISPLAY_NAME, + XML_DISPLAY_OUTLINE_LEVEL, + XML_DISPLAY_X_AXIS, + 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_DOUBLE_THIN, + XML_DOWN, + XML_DRAFT, + XML_DRAW, + XML_DRAW_ASPECT, + XML_DRAWING, + XML_DRAWINGS, + XML_DRAWPOOL, + XML_DROPDOWN, + XML_DROP_CAP, + XML_DYNAMIC, + XML_ECHO_CHAR, + 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_EMPTY_LINE_REFRESH, + XML_ENABLE_NUMBERING, + XML_ENABLED, + XML_ENCODING, + XML_ENCTYPE, + 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_ENTRY, + 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_FENCE, + 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_FILL_RULE, + XML_FILTER, + XML_FILTER_AND, + XML_FILTER_CONDITION, + XML_FILTER_NAME, + XML_FILTER_OPTIONS, + XML_FILTER_OR, + XML_FILTER_SET_ITEM, + XML_FINE_DASHED, + 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_FOCUS_ON_CLICK, + 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_FOOTER_VISIBLE, + 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_FOR, + 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_GLOW_RADIUS, + XML_GLOW_COLOR, + XML_GLOW_TRANSPARENCY, + XML_GOURAUD, + XML_GRADIENT, + XML_GRADIENT_ANGLE, + XML_GRADIENT_STEP_COUNT, + XML_GRADIENT_STYLE, + XML_GRADIENT_TABLE, + XML_GRADIENTSTYLE_AXIAL, + XML_GRADIENTSTYLE_ELLIPSOID, + 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_TABLE, + 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_LEGEND, + XML_HIDE_SHAPE, + XML_HIDE_TEXT, + XML_HIGHLIGHTED_RANGE, + XML_HINT, + XML_HORIZONTAL, + XML_HORIZONTALSTRIKE, + 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_HYPHENATION_NO_CAPS, + XML_HYPHENATION_NO_LAST_WORD, + XML_HYPHENATION_WORD_CHAR_COUNT, + XML_HYPHENATION_ZONE, + 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_IGNORE_RESULT, + XML_IGNORE_SELECTED_PAGE, // used for ODF compatibility + 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_INPUT_REQUIRED, + XML_INSERT_COLUMNS, + XML_INSERT_ROWS, + XML_INSERTION, + XML_INSERTION_CUT_OFF, + XML_INSERTION_POSITION, + XML_INSET, + XML_INSIDE, + XML_INSTITUTION, + XML_INT, + XML_INTENSITY, + XML_INTER_CHARACTER, + 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_ITEM, + XML_ITERATION, + XML_JOURNAL, + XML_JUSTIFIED, + XML_JUSTIFY, + XML_JUSTIFY_SINGLE_WORD, + XML_KEEP_WITH_NEXT, + 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_FILL, + XML_LABEL_FILL_COLOR, + XML_LABEL_RANGE, + XML_LABEL_RANGES, + XML_LABEL_STRING, + XML_LABEL_STROKE, + XML_LABEL_STROKE_COLOR, + XML_LABEL_STROKE_OPACITY, + XML_LABEL_STROKE_WIDTH, + XML_LAMBDA, + XML_LANDSCAPE, + XML_LANG, + 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_TEXT, + 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_CLEAR, + XML_LINE_DISTANCE, + XML_LINE_HEIGHT, + XML_LINE_HEIGHT_AT_LEAST, + XML_LINE_NUMBER, + XML_LINE_SKEW, + XML_LINE_SPACING, + XML_LINE_STYLE, + XML_LINE_WIDTH, + XML_LINEAR, + XML_LINEARGRADIENT, + XML_LINENUMBERING_CONFIGURATION, + XML_LINENUMBERING_SEPARATOR, + XML_LINES, + XML_LINES_USED, + XML_LINKED_CELL, + 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_LINKAGE_TYPE, + XML_LIST_NAME, + XML_LIST_STYLE, + XML_LIST_STYLE_NAME, + XML_LN, + XML_LOCKED, + XML_LOG, + XML_LOGARITHMIC, + XML_LOGBASE, + XML_LONG, + XML_LOW, + XML_LOWLIMIT, + XML_LR_TB, + XML_LT, + XML_LTR, + XML_LUMINANCE, + XML_MACRO_NAME, + XML_MACTION, + XML_MAIN_ENTRY_STYLE_NAME, + XML_MAJOR, + XML_MAJOR_ORIGIN, + XML_MALIGNGROUP, + XML_MALIGNMARK, + XML_MANUAL, + XML_MANUAL_MIN, + XML_MANUAL_MAX, + XML_MAP, + XML_MARGIN_BOTTOM, + XML_MARGIN_LEFT, + XML_MARGIN_RIGHT, + XML_MARGIN_TOP, + XML_MARGINS, + XML_MARKER, + XML_MARKERS, + XML_MARKER_END, + XML_MARKER_END_CENTER, + XML_MARKER_END_WIDTH, + XML_MARKER_START, + XML_MARKER_START_CENTER, + XML_MARKER_START_WIDTH, + XML_MARKER_TABLE, + 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_AXIS_TYPE, + XML_MAX_EDGE, + XML_MAX_HEIGHT, + XML_MAX_LENGTH, + 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_MENCLOSE, + XML_MERROR, + XML_MESSAGE_TYPE, + XML_META, + XML_MFENCED, + XML_MFRAC, + XML_MI, + XML_MIDDLE, + XML_MIME_TYPE, + XML_MIN, + XML_MIN_AXIS_TYPE, + 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_LENGTH, + 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_MOVING_AVERAGE, + 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_MULTI_LINE, + XML_MULTIPLE, + XML_MUNDER, + XML_MUNDEROVER, + XML_NAME, + XML_NAME_AND_EXTENSION, + XML_NAMED_EXPRESSION, + XML_NAMED_EXPRESSIONS, + XML_NAMED_RANGE, + XML_NAVIGATION_MODE, + XML_NAVY, + XML_NEGATIVE, + 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_NON_WHITESPACE_CHARACTER_COUNT, + XML_NONE, + XML_NORMAL, + XML_NORMALS_DIRECTION, + XML_NORMALS_KIND, + XML_NOT, + XML_NOT_EQUAL_DATE, + XML_NOTATION, + XML_NOTE, + XML_NOTES, + XML_NOTIN, + XML_NOTPRSUBSET, + XML_NOTSUBSET, + XML_NULL_DATE, + XML_NULL_YEAR, + XML_NUM_FORMAT, + XML_NUM_LETTER_SYNC, + XML_NUM_LIST_FORMAT, + XML_NUM_PREFIX, + XML_NUM_SUFFIX, + XML_NUMALIGN, + 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_OPEN, + XML_OPEN_HORIZONTAL, + XML_OPEN_VERTICAL, + XML_OPERATION, + XML_OPERATOR, + XML_OPTIMAL, + XML_OPTION, + XML_OR, + XML_ORDER, + XML_ORDERED_LIST, + XML_ORGANIZATIONS, + XML_ORIENTATION, + XML_ORIENTATION_LANDSCAPE, + XML_ORIENTATION_PORTRAIT, + XML_ORIGIN, + XML_ORPHANS, + XML_OUTLINE_CONTENT_VISIBLE, + XML_OUTLINE_LEVEL, + XML_OUTLINE_LEVEL_STYLE, + XML_OUTLINE_STYLE, + XML_OUTSET, + XML_OUTSIDE, + XML_OVERLAP, + XML_OVERLAY, + 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_NAME, + XML_PAGE_NUMBER, + XML_PAGE_NUMBER_VISIBLE, + XML_PAGE_START_MARGIN, + XML_PAGE_STEP_SIZE, + 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_PHYSICS_ANIMATION_START_VELOCITY_X, + XML_PHYSICS_ANIMATION_START_VELOCITY_Y, + XML_PHYSICS_ANIMATION_DENSITY, + XML_PHYSICS_ANIMATION_BOUNCINESS, + 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_OBLIQUE, + XML_POWER, + XML_PRECISION_AS_SHOWN, + XML_PREFIX, + XML_INFIX, + XML_POSTFIX, + XML_PRESENTATION, + XML_PRESENTATION_ORGCHART, + XML_PRESENTATION_OUTLINE, + XML_PRESENTATION_PAGE_LAYOUT, + XML_PRESENTATION_PAGE_LAYOUT_NAME, + 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_PRIOR, + XML_PROCEEDINGS, + XML_PRODUCT, + XML_PROJECTION, + XML_PROPERTIES, + XML_PROTECT, + 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_QRCODE, + XML_QRCODE_BORDER, + XML_QRCODE_ERROR_CORRECTION, + XML_QRCODE_TYPE, + 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_REJECTED, + XML_REJECTING_CHANGE_ID, + XML_REJECTION, + XML_REL_COLUMN_WIDTH, + XML_REL_HEIGHT, + XML_REL_HEIGHT_REL, + XML_REL_WIDTH, + XML_REL_WIDTH_REL, + 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_RIGHT_TEXT, + XML_RIGHT_TO_LEFT, + 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_SCRIPT_ASIAN, + XML_SCRIPT_COMPLEX, + 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_SHADOW_BLUR, + 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_SOFTEDGE_RADIUS, + 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_SPARKLINE_GROUPS, + XML_SPARKLINE_GROUP, + XML_SPARKLINES, + XML_SPARKLINE, + 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_STATE, + XML_STATISTICS, + XML_STATUS, + XML_STAY_ON_TOP, + XML_STDEV, + XML_STDEVP, + XML_STEPS, + XML_STEP_SIZE, + XML_STOCK, + XML_STOCK_UPDOWN_BARS, + XML_STOCK_WITH_VOLUME, + XML_STOP, + XML_STOP_COLOR, + XML_STOP_OPACITY, + 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_SWISS, + XML_SYMBOL, + XML_SYMBOL_HEIGHT, + XML_SYMBOL_IMAGE_NAME, + XML_SYMBOL_WIDTH, + XML_SYSTEM, + XML_TAB_COLOR, + XML_TAB_CYCLE, + XML_TAB_INDEX, + 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_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, + 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_CHANGES_ONLY, + XML_TEXT_COLOR, + XML_TEXT_COMBINE, + XML_TEXT_COMBINE_END_CHAR, + XML_TEXT_COMBINE_START_CHAR, + XML_TEXT_CONTENT, + XML_TEXT_CONVERSION_DICTIONARY, + XML_TEXT_CROSSING_OUT, + XML_TEXT_EMPHASIZE, + XML_TEXT_GLOBAL, + XML_TEXT_INDENT, + XML_TEXT_INPUT, + XML_TEXT_JUSTIFY, + XML_TEXT_OUTLINE, + XML_TEXT_ONLY, + 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_TOGGLE, + 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_TRY_STAGGERING_FIRST, + XML_TSPAN, + XML_TTB, + XML_TYPE, + XML_DOT_DASH, + XML_DOT_DOT_DASH, + XML_LONG_DASH, + XML_SHOW_SIGN_DATE, + XML_SIGNATURELINE, + XML_SIGNING_INSTRUCTIONS, + XML_SINGLE, + XML_SMALL_WAVE, + XML_SUGGESTED_SIGNER_EMAIL, + XML_SUGGESTED_SIGNER_NAME, + XML_SUGGESTED_SIGNER_TITLE, + XML_WAVE, + XML_UNFORMATTED_TEXT, + XML_UNION, + XML_UNIT, + XML_UNORDERED_LIST, + XML_UNPUBLISHED, + XML_UP, + XML_UPLIMIT, + XML_UPRIGHT, + XML_URL, + XML_USE, + 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_VALIDATION, + 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_VISUAL_EFFECT, + 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_WHITE, + XML_WHOLE_PAGE, + XML_WIDOWS, + XML_WIDTH, + XML_WINDOW_FONT_COLOR, + 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_USE_WILDCARDS, + 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_BT_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_REGRESSION_TYPE, + XML_REGRESSION_CURVE_NAME, + XML_REGRESSION_EXTRAPOLATE_FORWARD, + XML_REGRESSION_EXTRAPOLATE_BACKWARD, + XML_REGRESSION_MAX_DEGREE, + XML_REGRESSION_MIN_DEGREE, + XML_REGRESSION_MOVING_TYPE, + XML_REGRESSION_PERIOD, + XML_REGRESSION_FORCE_INTERCEPT, + XML_REGRESSION_INTERCEPT_VALUE, + XML_REGRESSION_X_NAME, + XML_REGRESSION_Y_NAME, + + 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_DROP_DOWN, + XML_CURRENT_SELECTED, + + XML_JOIN_BORDER, + + XML_DISPLAY_LIST, + XML_NO, + XML_UNSORTED, + XML_FONT_INDEPENDENT_LINE_SPACING, + + // Wrong! Do not write, use XML_SORT_ASCENDING instead. Only read. fdo#72548 + XML_SORTED_ASCENDING, + + XML_DATABASE, + XML_DATASOURCE, // forms "datasource" + XML_DATA_SOURCE, // db "data-source" + 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_METAL_TYPE, + XML_EXTRUSION_ROTATION_ANGLE, + XML_EXTRUSION_ROTATION_CENTER, + XML_EXTRUSION_SHININESS, + XML_EXTRUSION_SKEW, + XML_EXTRUSION_SPECULARITY, + XML_EXTRUSION_SPECULARITY_LOEXT, + 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 has been added (#i35017#) + XML_ONCE_SUCCESSIVE, + XML_ONCE_CONCURRENT, + XML_ALLOW_OVERLAP, + + // 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_PRESENTATION_OASIS, + 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_FACE_FORMAT, + 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_DATA_PILOT_GROUPS, + XML_DATA_PILOT_GROUP, + XML_DATA_PILOT_GROUP_MEMBER, + + 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_REPEAT_ITEM_LABELS, + 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_ANIMATEPHYSICS, + XML_ANIMATETRANSFORM, + XML_ANIMATECOLOR, + XML_TRANSITIONFILTER, + XML_ATTRIBUTENAME, + + XML_NP_SMIL, + XML_N_SMIL, + + XML_NP_ANIMATION, + XML_N_ANIMATION, + XML_N_ANIMATION_OOO, + + 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_PRESET_PROPERTY, + 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, + // table styles + XML_FIRST_ROW_EVEN_COLUMN, + XML_LAST_ROW_EVEN_COLUMN, + XML_FIRST_ROW_END_COLUMN, + XML_FIRST_ROW_START_COLUMN, + XML_LAST_ROW_END_COLUMN, + XML_LAST_ROW_START_COLUMN, + + XML_HORIZONTAL_ON_ODD, + // Password error from 1.4 to 2.0 Beta (#i45874#) + XML_RESTART_NUMBERING, + // OpenDocument 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_SEPARATOR, + XML_FIELDMARK_END, + + 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# + + XML_PROPERTY_MAPPING, + XML_PROVIDER, + XML_DATA_MAPPINGS, + XML_DATA_MAPPING, + XML_DATA_FREQUENCY, + XML_DATA_TRANSFORMATIONS, + XML_COLUMN_REMOVE_TRANSFORMATION, + XML_COLUMN_SPLIT_TRANSFORMATION, + XML_COLUMN_MERGE_TRANSFORMATION, + XML_COLUMN_SORT_TRANSFORMATION, + XML_COLUMN_TEXT_TRANSFORMATION, + XML_COLUMN_AGGREGATE_TRANSFORMATION, + XML_COLUMN_NUMBER_TRANSFORMATION, + XML_SORT_PARAM, + XML_MERGE_STRING, + XML_TRIM, + XML_ROUND_UP, + XML_ROUND_DOWN, + XML_LOG_10, + XML_SQUARE, + XML_SQUARE_ROOT, + XML_EVEN, + XML_ODD, + XML_SIGN, + XML_REPLACE_STRING, + XML_COLUMN_REPLACENULL_TRANSFORMATION, + XML_COLUMN_DATETIME_TRANSFORMATION, + XML_START_OF_YEAR, + XML_END_OF_YEAR, + XML_MONTH_NAME, + XML_START_OF_MONTH, + XML_END_OF_MONTH, + XML_DAY_OF_YEAR, + XML_START_OF_QUARTER, + XML_END_OF_QUARTER, + + //Already defined XML_SEPARATOR, + + // 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 + + // erAck: 2013-07-02 BCP 47 language tags + XML_RFC_LANGUAGE_TAG, + XML_RFC_LANGUAGE_TAG_ASIAN, + XML_RFC_LANGUAGE_TAG_COMPLEX, + // Chart data table properties + XML_DATA_TABLE_SHOW_HORZ_BORDER, + XML_DATA_TABLE_SHOW_VERT_BORDER, + XML_DATA_TABLE_SHOW_OUTLINE, + // Chart Display units properties + XML_CHART_DUNITS_DISPLAYUNITS, + XML_CHART_DUNITS_BUILTINUNIT, + XML_EXTERNALDATA, + + XML_EXPONENT_INTERVAL, + XML_FORCED_EXPONENT_SIGN, + XML_MIN_DECIMAL_PLACES, + XML_MAX_DENOMINATOR_VALUE, + XML_MAX_NUMERATOR_DIGITS, + XML_ZEROS_NUMERATOR_DIGITS, + XML_ZEROS_DENOMINATOR_DIGITS, + XML_INTEGER_FRACTION_DELIMITER, + + // tdf#115319 + XML_REFERENCE_LANGUAGE, + + XML_NEWLINE, + + XML_CREATOR_INITIALS, + + // tdf#115007 + XML_TRANSLITERATION_SPELLOUT, + + XML_RESOLVED, + + XML_PAGE_CONTENT_TOP, + + XML_PAGE_CONTENT_BOTTOM, + XML_MARGIN_GUTTER, + + XML_LOCAL_URL, + + // Math ml + XML_DIR, + XML_DISPLAYSTYLE, + XML_INFINITY, + XML_LSPACE, + XML_MATHBACKGROUND, + XML_MAXSIZE, + XML_MINSIZE, + XML_MOVABLELIMITS, + XML_RSPACE, + XML_RTL, + XML_SYMMETRIC, + + XML_LINKED_STYLE_NAME, + + XML_THEME, + XML_THEME_COLOR, + XML_FILL_THEME_COLOR, + XML_DK1, + XML_LT1, + XML_DK2, + XML_LT2, + XML_ACCENT1, + XML_ACCENT2, + XML_ACCENT3, + XML_ACCENT4, + XML_ACCENT5, + XML_ACCENT6, + XML_HLINK, + XML_FOLHLINK, + XML_COLOR_LUM_MOD, + XML_COLOR_LUM_OFF, + XML_FILL_COLOR_LUM_MOD, + XML_FILL_COLOR_LUM_OFF, + + XML_CONTENT_CONTROL, + XML_SHOWING_PLACE_HOLDER, + XML_CHECKED_STATE, + XML_UNCHECKED_STATE, + XML_DISPLAY_TEXT, + XML_PICTURE, + XML_DATE_FORMAT, + XML_DATE_RFC_LANGUAGE_TAG, + + XML_FILL_USE_SLIDE_BACKGROUND, + + XML_TOKEN_END + }; + + + /// return the OUString representation for eToken + XMLOFF_DLLPUBLIC const OUString& GetXMLToken( + enum XMLTokenEnum eToken ); + + /// compare eToken to the string + XMLOFF_DLLPUBLIC bool IsXMLToken( + std::u16string_view rString, + enum XMLTokenEnum eToken ); + + /// compare eToken to the string + bool IsXMLToken( + std::string_view rString, + enum XMLTokenEnum eToken ); + + XMLOFF_DLLPUBLIC bool IsXMLToken( + const sax_fastparser::FastAttributeList::FastAttributeIter& aIter, + enum XMLTokenEnum eToken ); +} + +#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 000000000..13e7c3fcc --- /dev/null +++ b/include/xmloff/xmltypes.hxx @@ -0,0 +1,301 @@ +/* -*- 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_XMLTYPES_HXX +#define INCLUDED_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: 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_THROW 0x00100000 + +// Export only: When exporting defaults, export this property even if it is +// not set +#define MID_FLAG_DEFAULT_ITEM_EXPORT 0x00200000 + +// Import and Export: The property in question must exist. No call to +// hasPropertyByName is required. +#define MID_FLAG_MUST_EXIST 0x00400000 + +// 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 +// attribute afterwards. +#define MID_FLAG_MERGE_ATTRIBUTE 0x00800000 + +// 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 + +// Import only: there are more entries for the same xml attribute existing +#define MID_FLAG_MULTI_PROPERTY 0x02000000 + +// the map entry denotes the name of an element item +#define MID_FLAG_ELEMENT_ITEM_EXPORT 0x04000000 +#define MID_FLAG_ELEMENT_ITEM_IMPORT 0x08000000 + +#define MID_FLAG_ELEMENT_ITEM 0x0c000000 // both import and export + +// the property is ignored +#define MID_FLAG_NO_PROPERTY_EXPORT 0x10000000 + +// the attribute is ignored (not yet implemented) +#define MID_FLAG_NO_PROPERTY_IMPORT 0x40000000 + +#define MID_FLAG_NO_PROPERTY 0x50000000 // both import and export + +// 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 + + +#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) + +#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_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) + +// 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 +#define XML_TYPE_PERCENT100 0x00002026 // 100th percent + +// special basic types +#define XML_TYPE_RECTANGLE_LEFT 0x00000100 // the Left member of an awt::Rectangle as a measure +#define XML_TYPE_RECTANGLE_TOP 0x00000101 // the Top member of an awt::Rectangle as a measure +#define XML_TYPE_RECTANGLE_WIDTH 0x00000102 // the Width member of an awt::Rectangle as a measure +#define XML_TYPE_RECTANGLE_HEIGHT 0x00000103 // the Height member of an awt::Rectangle as a measure + +#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_CHAR_SCRIPT (XML_TEXT_TYPES_START + 116) +#define XML_TYPE_CHAR_RFC_LANGUAGE_TAG (XML_TEXT_TYPES_START + 117) +#define XML_TYPE_VERTICAL_ALIGN (XML_TEXT_TYPES_START + 118) + +#define XML_SW_TYPE_FILLSTYLE (XML_TEXT_TYPES_START + 119) +#define XML_SW_TYPE_FILLBITMAPSIZE (XML_TEXT_TYPES_START + 120) +#define XML_SW_TYPE_LOGICAL_SIZE (XML_TEXT_TYPES_START + 121) +#define XML_SW_TYPE_BITMAP_REFPOINT (XML_TEXT_TYPES_START + 122) +#define XML_SW_TYPE_BITMAP_MODE (XML_TEXT_TYPES_START + 123) +#define XML_SW_TYPE_BITMAPREPOFFSETX (XML_TEXT_TYPES_START + 124) +#define XML_SW_TYPE_BITMAPREPOFFSETY (XML_TEXT_TYPES_START + 125) + +#define XML_TYPE_TEXT_RUBY_IS_ABOVE (XML_TEXT_TYPES_START + 126) +#define XML_TYPE_GRAPHIC (XML_TEXT_TYPES_START + 127) +#define XML_SW_TYPE_PRESPAGE_BACKSIZE (XML_TEXT_TYPES_START + 128) +#define XML_SW_TYPE_RTLGUTTER (XML_TEXT_TYPES_START + 129) +#define XML_TYPE_THEME_COLOR (XML_TEXT_TYPES_START + 130) + +#endif // INCLUDED_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 000000000..9af400344 --- /dev/null +++ b/include/xmloff/xmluconv.hxx @@ -0,0 +1,330 @@ +/* -*- 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_XMLUCONV_HXX +#define INCLUDED_XMLOFF_XMLUCONV_HXX + +#include +#include +#include + +#include + +#include +#include +#include + +#include + +#include + +namespace com::sun::star { + namespace text { class XNumberingTypeInfo; } +} + +namespace basegfx +{ + class B3DVector; +} + +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::beans { struct PropertyValue; } +namespace com::sun::star::drawing { struct Position3D; } +namespace com::sun::star::frame { class XModel; } +namespace com::sun::star::uno { class XComponentContext; } +namespace com::sun::star::uno { template class Sequence; } +namespace com::sun::star::util { struct Date; } +template struct SvXMLEnumMapEntry; +template struct SvXMLEnumStringMapEntry; + +class XMLOFF_DLLPUBLIC SvXMLTokenEnumerator +{ +private: + std::u16string_view maTokenString; + size_t mnNextTokenPos; + sal_Unicode mcSeparator; + +public: + SvXMLTokenEnumerator( std::u16string_view rString, sal_Unicode cSeparator = u' ' ); + /** just so no-one accidentally passes a temporary to this, and ends up with this class + * accessing the temporary after the temporary has been deleted. */ + SvXMLTokenEnumerator( OUString&& , sal_Unicode cSeparator = u' ' ) = delete; + + bool getNextToken( std::u16string_view& rToken ); +}; + +/** the SvXMLTypeConverter converts values of various types from + their internal representation 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 ! +*/ + +class XMLOFF_DLLPUBLIC SvXMLUnitConverter final +{ +private: + SvXMLUnitConverter(const SvXMLUnitConverter&) = delete; + SvXMLUnitConverter& operator=(const SvXMLUnitConverter&) = delete; + + struct SAL_DLLPRIVATE Impl; + ::std::unique_ptr 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 css::uno::Reference< css::uno::XComponentContext >& xContext, + sal_Int16 eCoreMeasureUnit /*css::util::MeasureUnit*/, + sal_Int16 eXMLMeasureUnit /*css::util::MeasureUnit*/, + SvtSaveOptions::ODFSaneDefaultVersion const nODFVersion); + + ~SvXMLUnitConverter(); + + static sal_Int16 GetMeasureUnit(FieldUnit const nFieldUnit); + + /** sets the default unit for numerical measures */ + void SetCoreMeasureUnit( sal_Int16 const eCoreMeasureUnit /*css::util::MeasureUnit*/); + + /** sets the default unit for textual measures */ + void SetXMLMeasureUnit( sal_Int16 const eXMLMeasureUnit /*css::util::MeasureUnit*/); + + /** gets the default unit for textual measures */ + sal_Int16 GetXMLMeasureUnit() const; + + /// ODF version, only when exporting + SvtSaveOptions::ODFSaneDefaultVersion getSaneDefaultVersion() const; + void overrideSaneDefaultVersion(SvtSaveOptions::ODFSaneDefaultVersion const); + + /** gets XNumberingTypeInfo */ + const css::uno::Reference< css::text::XNumberingTypeInfo >& getNumTypeInfo() const; + + /** convert string to measure with meCoreMeasureUnit, + using optional min and max values*/ + bool convertMeasureToCore( sal_Int32& rValue, + std::u16string_view rString, + sal_Int32 nMin = SAL_MIN_INT32, + sal_Int32 nMax = SAL_MAX_INT32) const; + + /** convert string to measure with meCoreMeasureUnit, + using optional min and max values*/ + bool convertMeasureToCore( sal_Int32& rValue, + std::string_view 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 measure to string: from meCoreMeasureUnit to meXMLMeasureUnit */ + OUString convertMeasureToXML( 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 */ + template + static bool convertEnum( EnumT& rEnum, + std::u16string_view rValue, + const SvXMLEnumMapEntry *pMap ) + { + sal_uInt16 nTmp; + bool bRet = convertEnumImpl(nTmp, rValue, + reinterpret_cast*>(pMap)); + if (bRet) + rEnum = static_cast(nTmp); + return bRet; + } + + /** convert string to enum using given enum map, if the enum is + not found in the map, this method will return false */ + template + static bool convertEnum( EnumT& rEnum, + std::string_view rValue, + const SvXMLEnumMapEntry *pMap ) + { + sal_uInt16 nTmp; + bool bRet = convertEnumImpl(nTmp, rValue, + reinterpret_cast*>(pMap)); + if (bRet) + rEnum = static_cast(nTmp); + return bRet; + } + + /** convert string to enum using given token map, if the enum is + not found in the map, this method will return false */ + template + static bool convertEnum( EnumT& rEnum, + std::u16string_view rValue, + const SvXMLEnumStringMapEntry *pMap ) + { + sal_uInt16 nTmp; + bool bRet = convertEnumImpl(nTmp, rValue, + reinterpret_cast*>(pMap)); + if (bRet) + rEnum = static_cast(nTmp); + return bRet; + } + + /** convert string to enum using given token map, if the enum is + not found in the map, this method will return false */ + template + static bool convertEnum( EnumT& rEnum, + std::string_view rValue, + const SvXMLEnumStringMapEntry *pMap ) + { + sal_uInt16 nTmp; + bool bRet = convertEnumImpl(nTmp, rValue, + reinterpret_cast*>(pMap)); + if (bRet) + rEnum = static_cast(nTmp); + return bRet; + } + + /** 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 */ + template + static bool convertEnum( OUStringBuffer& rBuffer, + EnumT nValue, + const SvXMLEnumMapEntry *pMap, + enum ::xmloff::token::XMLTokenEnum eDefault = + ::xmloff::token::XML_TOKEN_INVALID ) + { + return convertEnumImpl(rBuffer, static_cast(nValue), + reinterpret_cast*>(pMap), eDefault); + } + + /** convert double number to string (using ::rtl::math) and DO + convert to export MapUnit using meCoreMeasureUnit/meXMLMeasureUnit */ + void convertDouble(OUStringBuffer& rBuffer, + double fNumber) const; + + /** convert string to double number (using ::rtl::math) and DO convert. */ + bool convertDouble(double& rValue, std::u16string_view rString) const; + + /** convert string to double number (using ::rtl::math) and DO convert. */ + bool convertDouble(double& rValue, std::string_view rString) const; + + /** get the Null Date of the XModel and set it to the UnitConverter */ + bool setNullDate ( + const css::uno::Reference & 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, + std::u16string_view rString) const; + + /** convert ISO Date Time String to double */ + bool convertDateTime(double& fDateTime, + std::string_view rString) const; + + /// 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 css::util::Date& aNullDate, + bool bAddTimeIf0AM = false); + /** convert ISO Date Time String to double */ + static bool convertDateTime( double& fDateTime, + std::u16string_view rString, + const css::util::Date& aNullDate); + /** convert ISO Date Time String to double */ + static bool convertDateTime( double& fDateTime, + std::string_view rString, + const css::util::Date& aNullDate); + + /** convert string to ::basegfx::B3DVector */ + static bool convertB3DVector( ::basegfx::B3DVector& rVector, + std::string_view rValue ); + + /** convert B3DVector to string */ + static void convertB3DVector( OUStringBuffer &rBuffer, + const ::basegfx::B3DVector& rVector ); + + /** convert string to Position3D */ + bool convertPosition3D( css::drawing::Position3D& rPosition, + std::string_view rValue ) const; + + /** convert Position3D to string */ + void convertPosition3D( OUStringBuffer &rBuffer, + const css::drawing::Position3D& rVector ); + + + /** convert num-format and num-letter-sync values to NumberingType */ + bool convertNumFormat( sal_Int16& rType, + const OUString& rNumFormat, + std::u16string_view rNumLetterSync, + bool bNumberNone = false ) const; + + /** convert NumberingType to num-format and num-letter-sync values */ + void convertNumFormat( OUStringBuffer& rBuffer, + sal_Int16 nType ) const; + static void convertNumLetterSync( OUStringBuffer& rBuffer, + sal_Int16 nType ); + + static void convertPropertySet(css::uno::Sequence& rProps, + const css::uno::Reference& aProperties); + static void convertPropertySet(css::uno::Reference const & rProperties, + const css::uno::Sequence& aProps); + + OUString encodeStyleName( const OUString& rName, + bool *pEncoded=nullptr ) const; + /** convert string (hex) to number (sal_uInt32) */ + static bool convertHex( sal_uInt32& nVal, + std::u16string_view rValue ); + + /** convert number (sal_uInt32) to string (hex) */ + static void convertHex( OUStringBuffer& rBuffer, + sal_uInt32 nVal ); + +private: + static bool convertEnumImpl( sal_uInt16& rEnum, + std::u16string_view rValue, + const SvXMLEnumMapEntry *pMap ); + + static bool convertEnumImpl( sal_uInt16& rEnum, + std::u16string_view rValue, + const SvXMLEnumStringMapEntry *pMap ); + + static bool convertEnumImpl( sal_uInt16& rEnum, + std::string_view rValue, + const SvXMLEnumMapEntry *pMap ); + + static bool convertEnumImpl( sal_uInt16& rEnum, + std::string_view rValue, + const SvXMLEnumStringMapEntry *pMap ); + + static bool convertEnumImpl( OUStringBuffer& rBuffer, + sal_uInt16 nValue, + const SvXMLEnumMapEntry *pMap, + enum ::xmloff::token::XMLTokenEnum eDefault ); +}; + +#endif // INCLUDED_XMLOFF_XMLUCONV_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3