diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /xmloff/inc | |
parent | Initial commit. (diff) | |
download | libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xmloff/inc')
81 files changed, 7137 insertions, 0 deletions
diff --git a/xmloff/inc/AttributeContainerHandler.hxx b/xmloff/inc/AttributeContainerHandler.hxx new file mode 100644 index 000000000..04c812718 --- /dev/null +++ b/xmloff/inc/AttributeContainerHandler.hxx @@ -0,0 +1,38 @@ +/* -*- 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 <xmloff/xmlprhdl.hxx> + +/** + PropertyHandler for the XML-data-type: +*/ +class XMLAttributeContainerHandler final : public XMLPropertyHandler +{ +public: + virtual ~XMLAttributeContainerHandler() override; + + virtual bool equals( const css::uno::Any& r1, const css::uno::Any& r2 ) const 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; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/AutoStyleEntry.hxx b/xmloff/inc/AutoStyleEntry.hxx new file mode 100644 index 000000000..15f99f1b1 --- /dev/null +++ b/xmloff/inc/AutoStyleEntry.hxx @@ -0,0 +1,29 @@ +/* -*- 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/. + * + */ + +#pragma once + +#include <sal/config.h> +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/Any.hxx> +#include <xmloff/dllapi.h> +#include <utility> +#include <vector> + +namespace xmloff +{ +struct AutoStyleEntry +{ + std::vector<std::pair<OUString, css::uno::Any>> m_aXmlProperties; +}; + +} // end xmloff + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/DomBuilderContext.hxx b/xmloff/inc/DomBuilderContext.hxx new file mode 100644 index 000000000..40435abbf --- /dev/null +++ b/xmloff/inc/DomBuilderContext.hxx @@ -0,0 +1,93 @@ +/* -*- 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 <xmloff/xmlictxt.hxx> + + +// forward declarations + + +namespace com::sun::star { + namespace xml::dom { + class XNode; + class XDocument; + } + namespace xml::sax { + class XAttributeList; + } +} +class SvXMLImport; +class SvXMLImportContext; + +/** + * DomBuilderContext creates a DOM tree suitable for in-memory processing of + * XML data from a sequence of SAX events */ +class DomBuilderContext final : public SvXMLImportContext +{ + css::uno::Reference<css::xml::dom::XNode> mxNode; + + void HandleAttributes(const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs); + +public: + + /** default constructor: create new DOM tree */ + DomBuilderContext( SvXMLImport& rImport, + sal_Int32 nElement ); + DomBuilderContext( SvXMLImport& rImport, + const OUString & Namespace, const OUString & Name ); + + /** constructor: create DOM subtree under the given node */ + DomBuilderContext( SvXMLImport& rImport, + sal_Int32 nElement, + css::uno::Reference<css::xml::dom::XNode> const & ); + /** constructor: create DOM subtree under the given node */ + DomBuilderContext( SvXMLImport& rImport, + const OUString & Namespace, const OUString & Name, + css::uno::Reference<css::xml::dom::XNode> const & ); + + virtual ~DomBuilderContext() override; + + + // access to the DOM tree + + + /** access the DOM tree */ + css::uno::Reference<css::xml::dom::XDocument> getTree(); + + + // implement SvXMLImportContext methods: + + 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 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; + + virtual void SAL_CALL startFastElement( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) 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 characters( const OUString& rChars ) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/DomExport.hxx b/xmloff/inc/DomExport.hxx new file mode 100644 index 000000000..b6646214f --- /dev/null +++ b/xmloff/inc/DomExport.hxx @@ -0,0 +1,33 @@ +/* -*- 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 + +// the Solaris compiler apparently needs the following include: +#include <com/sun/star/uno/Reference.hxx> + +class SvXMLExport; +namespace com::sun::star { + namespace uno { template<typename T> class Reference; } + namespace xml::dom { class XDocument; } + namespace xml::dom { class XNode; } +} + +void exportDom( SvXMLExport&, const css::uno::Reference<css::xml::dom::XDocument>& ); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/EnhancedCustomShapeToken.hxx b/xmloff/inc/EnhancedCustomShapeToken.hxx new file mode 100644 index 000000000..4438ba126 --- /dev/null +++ b/xmloff/inc/EnhancedCustomShapeToken.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 . + */ + +#pragma once + +#include <rtl/ustring.hxx> + +namespace xmloff::EnhancedCustomShapeToken { + + enum EnhancedCustomShapeTokenEnum + { + EAS_type, + EAS_name, + EAS_mirror_horizontal, + EAS_mirror_vertical, + EAS_viewBox, + EAS_text_rotate_angle, + EAS_extrusion_allowed, + EAS_text_path_allowed, + EAS_concentric_gradient_fill_allowed, + EAS_extrusion, + EAS_extrusion_brightness, + EAS_extrusion_depth, + EAS_extrusion_diffusion, + EAS_extrusion_number_of_line_segments, + EAS_extrusion_light_face, + EAS_extrusion_first_light_harsh, + EAS_extrusion_second_light_harsh, + EAS_extrusion_first_light_level, + EAS_extrusion_second_light_level, + EAS_extrusion_first_light_direction, + EAS_extrusion_second_light_direction, + EAS_extrusion_metal, + EAS_extrusion_metal_type, + EAS_shade_mode, + EAS_extrusion_rotation_angle, + EAS_extrusion_rotation_center, + EAS_extrusion_shininess, + EAS_extrusion_skew, + EAS_extrusion_specularity, + EAS_extrusion_specularity_loext, + EAS_projection, + EAS_extrusion_viewpoint, + EAS_extrusion_origin, + EAS_extrusion_color, + EAS_enhanced_path, + EAS_path_stretchpoint_x, + EAS_path_stretchpoint_y, + EAS_text_areas, + EAS_glue_points, + EAS_glue_point_type, + EAS_glue_point_leaving_directions, + EAS_text_path, + EAS_text_path_mode, + EAS_text_path_scale, + EAS_text_path_same_letter_heights, + EAS_modifiers, + EAS_equation, + EAS_formula, + EAS_handle, + EAS_handle_mirror_horizontal, + EAS_handle_mirror_vertical, + EAS_handle_switched, + EAS_handle_position, + EAS_handle_range_x_minimum, + EAS_handle_range_x_maximum, + EAS_handle_range_y_minimum, + EAS_handle_range_y_maximum, + EAS_handle_polar, + EAS_handle_radius_range_minimum, + EAS_handle_radius_range_maximum, + EAS_sub_view_size, + + EAS_CustomShapeEngine, + EAS_CustomShapeData, + EAS_Type, + EAS_MirroredX, + EAS_MirroredY, + EAS_ViewBox, + EAS_TextRotateAngle, + EAS_TextPreRotateAngle, + EAS_ExtrusionAllowed, + EAS_ConcentricGradientFillAllowed, + EAS_TextPathAllowed, + EAS_Extrusion, + EAS_Equations, + EAS_Equation, + EAS_Path, + EAS_TextPath, + EAS_Handles, + EAS_Handle, + EAS_Brightness, + EAS_Depth, + EAS_Diffusion, + EAS_NumberOfLineSegments, + EAS_LightFace, + EAS_FirstLightHarsh, + EAS_SecondLightHarsh, + EAS_FirstLightLevel, + EAS_SecondLightLevel, + EAS_FirstLightDirection, + EAS_SecondLightDirection, + EAS_Metal, + EAS_MetalType, + EAS_ShadeMode, + EAS_RotateAngle, + EAS_RotationCenter, + EAS_Shininess, + EAS_Skew, + EAS_Specularity, + EAS_ProjectionMode, + EAS_ViewPoint, + EAS_Origin, + EAS_Color, + EAS_Switched, + EAS_Polar, + EAS_RangeXMinimum, + EAS_RangeXMaximum, + EAS_RangeYMinimum, + EAS_RangeYMaximum, + EAS_RadiusRangeMinimum, + EAS_RadiusRangeMaximum, + EAS_Coordinates, + EAS_Segments, + EAS_StretchX, + EAS_StretchY, + EAS_TextFrames, + EAS_GluePoints, + EAS_GluePointLeavingDirections, + EAS_GluePointType, + EAS_TextPathMode, + EAS_ScaleX, + EAS_SameLetterHeights, + EAS_Position, + EAS_AdjustmentValues, + EAS_SubViewSize, + + EAS_Last, + EAS_NotFound + }; + + EnhancedCustomShapeTokenEnum EASGet( const OUString& ); + EnhancedCustomShapeTokenEnum EASGet( sal_Int32 nToken ); + OUString EASGet( const EnhancedCustomShapeTokenEnum ); +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/MetaExportComponent.hxx b/xmloff/inc/MetaExportComponent.hxx new file mode 100644 index 000000000..ad8e36cf9 --- /dev/null +++ b/xmloff/inc/MetaExportComponent.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 . + */ + +#pragma once + +#include <com/sun/star/document/XDocumentProperties.hpp> + +#include <xmloff/xmlexp.hxx> + +class XMLMetaExportComponent final : public SvXMLExport +{ + css::uno::Reference< css::document::XDocumentProperties > mxDocProps; + +public: + XMLMetaExportComponent( + const css::uno::Reference< css::uno::XComponentContext >& xContext, + OUString const & implementationName, SvXMLExportFlags nFlags + ); + + virtual ~XMLMetaExportComponent() override; + +private: + // export the events off all autotexts + virtual ErrCode exportDoc( + enum ::xmloff::token::XMLTokenEnum eClass = xmloff::token::XML_TOKEN_INVALID ) override; + + // accept XDocumentProperties in addition to XModel + virtual void SAL_CALL setSourceDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override; + + // override + virtual void ExportMeta_() override; + + // methods without content: + virtual void ExportAutoStyles_() override; + virtual void ExportMasterStyles_() override; + virtual void ExportContent_() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/MultiPropertySetHelper.hxx b/xmloff/inc/MultiPropertySetHelper.hxx new file mode 100644 index 000000000..9d539fa26 --- /dev/null +++ b/xmloff/inc/MultiPropertySetHelper.hxx @@ -0,0 +1,186 @@ +/* -*- 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 <rtl/ustring.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <memory> + +namespace com::sun::star +{ +namespace beans +{ +class XMultiPropertySet; +} +namespace beans +{ +class XPropertySet; +} +namespace beans +{ +class XPropertySetInfo; +} +} + +/** + * The MultiPropertySetHelper performs the following functions: + * + * Given a list of property names (as char** or OUString*), it can + * query an XMultiPropertySet (or XPropertySet) which of these properties + * it supports (method hasProperties(...)). The properties *MUST* be + * sorted alphabetically. + * + * Then, the X(Multi)PropertySet can be queried for values, and only + * the supported properties are queried. (method getValues(...)) The + * values are stored in the helper itself. + * + * Finally, each property can be queried for existence + * (method hasProperty(...)) or its value (method (getValue(...))). + * + * After some initial preparation (hasProperties, getValues) the + * MultiPropertySetHelper can be used similarly to an + * XPropertySet in that you can query the values in the places where you + * need them. However, if an XMultiPropertySet is supplied, the queries + * are more efficient, often significantly so. + */ +class MultiPropertySetHelper +{ + /// names of all properties + std::unique_ptr<OUString[]> pPropertyNames; + + /// length of pPropertyNames array + sal_Int16 nLength; + + /// the sequence of property names that the current (multi) + /// property set implementation supports + css::uno::Sequence<OUString> aPropertySequence; + + /// an array of indices that maps from pPropertyNames indices to + /// aPropertySequence indices + std::unique_ptr<sal_Int16[]> pSequenceIndex; + + /// the last set of values retrieved by getValues + css::uno::Sequence<css::uno::Any> aValues; + + /// result of aValues.getConstArray() + const css::uno::Any* pValues; + + /// an empty Any + css::uno::Any aEmptyAny; + +public: + MultiPropertySetHelper(const char** pNames); + + ~MultiPropertySetHelper(); + + /** + * Call hasPropertiesByName for the provided XPropertySetInfo and build + * list of allowed properties. + */ + void hasProperties(const css::uno::Reference<css::beans::XPropertySetInfo>&); + + /** + * Return whether hasProperties was called + * (i.e. if we are ready to call getValues) + */ + bool checkedProperties(); + + /** + * Get values from the XMultiPropertySet. + * + * May only be called after hasProperties() was called for the + * appropriate XPropertySetInfo. + */ + void getValues(const css::uno::Reference<css::beans::XMultiPropertySet>&); + + /** + * Get values from the XPropertySet. This can be much slower than + * getValues( const Reference<XMultiPropertySet& ) and hence + * should be avoided. + * + * May only be called after hasProperties() was called for the + * appropriate XPropertySetInfo. + */ + void getValues(const css::uno::Reference<css::beans::XPropertySet>&); + + /** + * Get a value from the values array. + * + * May only be called after getValues() was called. + */ + inline const css::uno::Any& getValue(sal_Int16 nIndex); + + /** + * Find out if this property is supported. + * + * May only be called after hasProperties() was called. + */ + inline bool hasProperty(sal_Int16 nIndex); + + /** + * Get a value from the XPropertySet on demand. + * + * If neither getValues nor getValueOnDemand has been called already + * after the last call to resetValues, the values are retrieved + * using getValues. Otherwise the value already retrieved is returned. + * In case XMultiPropertySet is supported by the XPropertySet and + * bTryMult is set, the XMultiPropertySet is used to get the values. + * + */ + const css::uno::Any& getValue(sal_Int16 nIndex, + const css::uno::Reference<css::beans::XPropertySet>&, + bool bTryMulti = false); + + /** + * Get a value from the XMultiPropertySet on demand. + * + * If neither getValues nor getValueOnDemand has been called already + * after the last call to resetValues, the values are retrieved + * using getValues. Otherwise the value already retrieved is returned. + * In case XMultiPropertySet is supported by the XPropertySet, + * XMultiPropertySet is used to get the values. + * + */ + const css::uno::Any& getValue(sal_Int16 nIndex, + const css::uno::Reference<css::beans::XMultiPropertySet>&); + + void resetValues() { pValues = nullptr; } +}; + +// inline implementations of the often-called methods getValue and hasProperty: + +const css::uno::Any& MultiPropertySetHelper::getValue(sal_Int16 nValueNo) +{ + assert(pValues && "called getValue() without calling getValues()"); + assert(pSequenceIndex && "called getValue() without calling hasProperties()"); + assert(nValueNo < nLength); + + sal_Int16 nIndex = pSequenceIndex[nValueNo]; + return (nIndex != -1) ? pValues[nIndex] : aEmptyAny; +} + +bool MultiPropertySetHelper::hasProperty(sal_Int16 nValueNo) +{ + assert(pSequenceIndex && "called hasProperty() without calling hasProperties()"); + assert(nValueNo < nLength); + + return pSequenceIndex[nValueNo] != -1; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/PageMasterImportContext.hxx b/xmloff/inc/PageMasterImportContext.hxx new file mode 100644 index 000000000..7e164a1f2 --- /dev/null +++ b/xmloff/inc/PageMasterImportContext.hxx @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <xmloff/prstylei.hxx> +#include <xmloff/xmlimp.hxx> + +class PageStyleContext final : public XMLPropStyleContext +{ +private: + OUString sPageUsage; + bool m_bIsFillStyleAlreadyConverted : 1; + + virtual void SetAttribute( sal_Int32 nElement, + const OUString& rValue ) override; + +public: + + + PageStyleContext( SvXMLImport& rImport, + SvXMLStylesContext& rStyles, + bool bDefaultStyle); + virtual ~PageStyleContext() 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; + + // don't call this + virtual void FillPropertySet( + const css::uno::Reference< css::beans::XPropertySet > & rPropSet ) override; + void FillPropertySet_PageStyle( + const css::uno::Reference< css::beans::XPropertySet > & rPropSet, + XMLPropStyleContext * pDrawingPageStyle); + + //text grid enhancement + virtual void SetDefaults() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/PageMasterPropHdlFactory.hxx b/xmloff/inc/PageMasterPropHdlFactory.hxx new file mode 100644 index 000000000..b21520908 --- /dev/null +++ b/xmloff/inc/PageMasterPropHdlFactory.hxx @@ -0,0 +1,33 @@ +/* -*- 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 <xmloff/prhdlfac.hxx> + +class XMLPageMasterPropHdlFactory final : public XMLPropertyHandlerFactory +{ +public: + XMLPageMasterPropHdlFactory(); + virtual ~XMLPageMasterPropHdlFactory() override; + + virtual const XMLPropertyHandler* GetPropertyHandler(sal_Int32 nType) const override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/PageMasterPropMapper.hxx b/xmloff/inc/PageMasterPropMapper.hxx new file mode 100644 index 000000000..7da53acd2 --- /dev/null +++ b/xmloff/inc/PageMasterPropMapper.hxx @@ -0,0 +1,33 @@ +/* -*- 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 <xmloff/xmlprmap.hxx> + +class XMLPageMasterPropSetMapper final : public XMLPropertySetMapper +{ +public: + explicit XMLPageMasterPropSetMapper(); + XMLPageMasterPropSetMapper(const XMLPropertyMapEntry* pEntries, + const rtl::Reference<XMLPropertyHandlerFactory>& rFactory); + virtual ~XMLPageMasterPropSetMapper() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/PageMasterStyleMap.hxx b/xmloff/inc/PageMasterStyleMap.hxx new file mode 100644 index 000000000..657b17d46 --- /dev/null +++ b/xmloff/inc/PageMasterStyleMap.hxx @@ -0,0 +1,199 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef XMLOFF_INC_PAGEMASTERSTYLEMAP_HXX +#define XMLOFF_INC_PAGEMASTERSTYLEMAP_HXX + +#include <xmloff/maptype.hxx> +#include <xmloff/xmltypes.hxx> +#include <xmloff/contextid.hxx> + + +#define XML_PM_TYPE_PAGESTYLELAYOUT (XML_PM_TYPES_START + 0) +#define XML_PM_TYPE_NUMFORMAT (XML_PM_TYPES_START + 1) +#define XML_PM_TYPE_NUMLETTERSYNC (XML_PM_TYPES_START + 2) +#define XML_PM_TYPE_PAPERTRAYNUMBER (XML_PM_TYPES_START + 3) +#define XML_PM_TYPE_PRINTORIENTATION (XML_PM_TYPES_START + 4) +#define XML_PM_TYPE_PRINTANNOTATIONS (XML_PM_TYPES_START + 5) +#define XML_PM_TYPE_PRINTCHARTS (XML_PM_TYPES_START + 6) +#define XML_PM_TYPE_PRINTDRAWING (XML_PM_TYPES_START + 7) +#define XML_PM_TYPE_PRINTFORMULAS (XML_PM_TYPES_START + 8) +#define XML_PM_TYPE_PRINTGRID (XML_PM_TYPES_START + 9) +#define XML_PM_TYPE_PRINTHEADERS (XML_PM_TYPES_START + 10) +#define XML_PM_TYPE_PRINTOBJECTS (XML_PM_TYPES_START + 11) +#define XML_PM_TYPE_PRINTZEROVALUES (XML_PM_TYPES_START + 12) +#define XML_PM_TYPE_PRINTPAGEORDER (XML_PM_TYPES_START + 13) +#define XML_PM_TYPE_FIRSTPAGENUMBER (XML_PM_TYPES_START + 14) +#define XML_PM_TYPE_CENTER_HORIZONTAL (XML_PM_TYPES_START + 15) +#define XML_PM_TYPE_CENTER_VERTICAL (XML_PM_TYPES_START + 16) + +// control flags +#define CTF_PM_FLAGMASK (XML_PM_CTF_START + 0x0F00) +#define CTF_PM_HEADERFLAG (XML_PM_CTF_START + 0x0100) +#define CTF_PM_FOOTERFLAG (XML_PM_CTF_START + 0x0200) +#define CTF_PM_PRINTMASK (XML_PM_CTF_START + 0x1000) +// page master +#define CTF_PM_BORDERALL (XML_PM_CTF_START + 0x0001) +#define CTF_PM_BORDERTOP (XML_PM_CTF_START + 0x0002) +#define CTF_PM_BORDERBOTTOM (XML_PM_CTF_START + 0x0003) +#define CTF_PM_BORDERLEFT (XML_PM_CTF_START + 0x0004) +#define CTF_PM_BORDERRIGHT (XML_PM_CTF_START + 0x0005) +#define CTF_PM_BORDERWIDTHALL (XML_PM_CTF_START + 0x0006) +#define CTF_PM_BORDERWIDTHTOP (XML_PM_CTF_START + 0x0007) +#define CTF_PM_BORDERWIDTHBOTTOM (XML_PM_CTF_START + 0x0008) +#define CTF_PM_BORDERWIDTHLEFT (XML_PM_CTF_START + 0x0009) +#define CTF_PM_BORDERWIDTHRIGHT (XML_PM_CTF_START + 0x000A) +#define CTF_PM_PADDINGALL (XML_PM_CTF_START + 0x000B) +#define CTF_PM_PADDINGTOP (XML_PM_CTF_START + 0x000C) +#define CTF_PM_PADDINGBOTTOM (XML_PM_CTF_START + 0x000D) +#define CTF_PM_PADDINGLEFT (XML_PM_CTF_START + 0x000E) +#define CTF_PM_PADDINGRIGHT (XML_PM_CTF_START + 0x000F) +#define CTF_PM_TEXTCOLUMNS (XML_PM_CTF_START + 0x0010) +#define CTF_PM_REGISTER_STYLE (XML_PM_CTF_START + 0x0011) +#define CTF_PM_PRINT_ANNOTATIONS (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0012)) +#define CTF_PM_PRINT_CHARTS (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0013)) +#define CTF_PM_PRINT_DRAWING (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0014)) +#define CTF_PM_PRINT_FORMULAS (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0015)) +#define CTF_PM_PRINT_GRID (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0016)) +#define CTF_PM_PRINT_HEADERS (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0017)) +#define CTF_PM_PRINT_OBJECTS (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0018)) +#define CTF_PM_PRINT_ZEROVALUES (CTF_PM_PRINTMASK|(XML_PM_CTF_START + 0x0019)) +#define CTF_PM_MARGINALL (XML_PM_CTF_START + 0x001A) +#define CTF_PM_MARGINTOP (XML_PM_CTF_START + 0x001B) +#define CTF_PM_MARGINBOTTOM (XML_PM_CTF_START + 0x001C) +#define CTF_PM_MARGINLEFT (XML_PM_CTF_START + 0x001D) +#define CTF_PM_MARGINRIGHT (XML_PM_CTF_START + 0x001E) +#define CTF_PM_WRITINGMODE (XML_PM_CTF_START + 0x001F) +#define CTF_PM_RTLGUTTER (XML_PM_CTF_START + 0x0020) +#define CTF_PM_MARGINGUTTER (XML_PM_CTF_START + 0x0021) + +#define CTF_PM_PAGEUSAGE (XML_PM_CTF_START + 0x0031) +#define CTF_PM_GRAPHICPOSITION (XML_PM_CTF_START + 0x0032) +#define CTF_PM_GRAPHICFILTER (XML_PM_CTF_START + 0x0033) +#define CTF_PM_GRAPHICURL (XML_PM_CTF_START + 0x0034) + +// Need own entries for PageMasterStyleMap since these get *filtered* +// at export time using CTF_PM_FLAGMASK and XML_PM_CTF_START as detector +// to find the first entry for header/footer (!), see +// SvXMLAutoStylePoolP_Impl::exportXML, look for XmlStyleFamily::PAGE_MASTER +#define CTF_PM_REPEAT_OFFSET_X (XML_PM_CTF_START + 0x0037) +#define CTF_PM_REPEAT_OFFSET_Y (XML_PM_CTF_START + 0x0038) +#define CTF_PM_FILLGRADIENTNAME (XML_PM_CTF_START + 0x0039) +#define CTF_PM_FILLHATCHNAME (XML_PM_CTF_START + 0x0040) +#define CTF_PM_FILLBITMAPNAME (XML_PM_CTF_START + 0x0041) +#define CTF_PM_FILLTRANSNAME (XML_PM_CTF_START + 0x0042) +#define CTF_PM_FILLBITMAPMODE (XML_PM_CTF_START + 0x0043) +#define CTF_PM_FILL (XML_PM_CTF_START + 0x0044) +#define CTF_PM_BACKGROUNDSIZE (XML_PM_CTF_START + 0x0045) + +#define CTF_PM_SCALETO (XML_PM_CTF_START + 0x0051) // calc specific +#define CTF_PM_SCALETOPAGES (XML_PM_CTF_START + 0x0052) +#define CTF_PM_SCALETOX (XML_PM_CTF_START + 0x0053) +#define CTF_PM_SCALETOY (XML_PM_CTF_START + 0x0054) +#define CTF_PM_STANDARD_MODE (XML_PM_CTF_START + 0x0055) +#define CTP_PM_GRID_BASE_WIDTH (XML_PM_CTF_START + 0x0056) +#define CTP_PM_GRID_SNAP_TO_CHARS (XML_PM_CTF_START + 0x0057) +#define CTP_PM_GRID_SNAP_TO (XML_PM_CTF_START + 0x0058) +// header +#define CTF_PM_HEADERBORDERALL (CTF_PM_HEADERFLAG|CTF_PM_BORDERALL) +#define CTF_PM_HEADERBORDERTOP (CTF_PM_HEADERFLAG|CTF_PM_BORDERTOP) +#define CTF_PM_HEADERBORDERBOTTOM (CTF_PM_HEADERFLAG|CTF_PM_BORDERBOTTOM) +#define CTF_PM_HEADERBORDERLEFT (CTF_PM_HEADERFLAG|CTF_PM_BORDERLEFT) +#define CTF_PM_HEADERBORDERRIGHT (CTF_PM_HEADERFLAG|CTF_PM_BORDERRIGHT) +#define CTF_PM_HEADERBORDERWIDTHALL (CTF_PM_HEADERFLAG|CTF_PM_BORDERWIDTHALL) +#define CTF_PM_HEADERBORDERWIDTHTOP (CTF_PM_HEADERFLAG|CTF_PM_BORDERWIDTHTOP) +#define CTF_PM_HEADERBORDERWIDTHBOTTOM (CTF_PM_HEADERFLAG|CTF_PM_BORDERWIDTHBOTTOM) +#define CTF_PM_HEADERBORDERWIDTHLEFT (CTF_PM_HEADERFLAG|CTF_PM_BORDERWIDTHLEFT) +#define CTF_PM_HEADERBORDERWIDTHRIGHT (CTF_PM_HEADERFLAG|CTF_PM_BORDERWIDTHRIGHT) +#define CTF_PM_HEADERPADDINGALL (CTF_PM_HEADERFLAG|CTF_PM_PADDINGALL) +#define CTF_PM_HEADERPADDINGTOP (CTF_PM_HEADERFLAG|CTF_PM_PADDINGTOP) +#define CTF_PM_HEADERPADDINGBOTTOM (CTF_PM_HEADERFLAG|CTF_PM_PADDINGBOTTOM) +#define CTF_PM_HEADERPADDINGLEFT (CTF_PM_HEADERFLAG|CTF_PM_PADDINGLEFT) +#define CTF_PM_HEADERPADDINGRIGHT (CTF_PM_HEADERFLAG|CTF_PM_PADDINGRIGHT) +#define CTF_PM_HEADERHEIGHT (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0031)) +#define CTF_PM_HEADERMINHEIGHT (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0032)) +#define CTF_PM_HEADERDYNAMIC (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0033)) +#define CTF_PM_HEADERGRAPHICPOSITION (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0034)) +#define CTF_PM_HEADERGRAPHICFILTER (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0035)) +#define CTF_PM_HEADERGRAPHICURL (CTF_PM_HEADERFLAG|(XML_PM_CTF_START + 0x0036)) +#define CTF_PM_HEADERMARGINALL (CTF_PM_HEADERFLAG|CTF_PM_MARGINALL) +#define CTF_PM_HEADERMARGINTOP (CTF_PM_HEADERFLAG|CTF_PM_MARGINTOP) +#define CTF_PM_HEADERMARGINBOTTOM (CTF_PM_HEADERFLAG|CTF_PM_MARGINBOTTOM) +#define CTF_PM_HEADERMARGINLEFT (CTF_PM_HEADERFLAG|CTF_PM_MARGINLEFT) +#define CTF_PM_HEADERMARGINRIGHT (CTF_PM_HEADERFLAG|CTF_PM_MARGINRIGHT) + +// Need own entries for PageMasterStyleMap ORed with the CTF_PM_HEADERFLAG +#define CTF_PM_HEADERREPEAT_OFFSET_X (CTF_PM_HEADERFLAG|CTF_PM_REPEAT_OFFSET_X) +#define CTF_PM_HEADERREPEAT_OFFSET_Y (CTF_PM_HEADERFLAG|CTF_PM_REPEAT_OFFSET_Y) +#define CTF_PM_HEADERFILLGRADIENTNAME (CTF_PM_HEADERFLAG|CTF_PM_FILLGRADIENTNAME) +#define CTF_PM_HEADERFILLHATCHNAME (CTF_PM_HEADERFLAG|CTF_PM_FILLHATCHNAME) +#define CTF_PM_HEADERFILLBITMAPNAME (CTF_PM_HEADERFLAG|CTF_PM_FILLBITMAPNAME) +#define CTF_PM_HEADERFILLTRANSNAME (CTF_PM_HEADERFLAG|CTF_PM_FILLTRANSNAME) + +// footer +#define CTF_PM_FOOTERBORDERALL (CTF_PM_FOOTERFLAG|CTF_PM_BORDERALL) +#define CTF_PM_FOOTERBORDERTOP (CTF_PM_FOOTERFLAG|CTF_PM_BORDERTOP) +#define CTF_PM_FOOTERBORDERBOTTOM (CTF_PM_FOOTERFLAG|CTF_PM_BORDERBOTTOM) +#define CTF_PM_FOOTERBORDERLEFT (CTF_PM_FOOTERFLAG|CTF_PM_BORDERLEFT) +#define CTF_PM_FOOTERBORDERRIGHT (CTF_PM_FOOTERFLAG|CTF_PM_BORDERRIGHT) +#define CTF_PM_FOOTERBORDERWIDTHALL (CTF_PM_FOOTERFLAG|CTF_PM_BORDERWIDTHALL) +#define CTF_PM_FOOTERBORDERWIDTHTOP (CTF_PM_FOOTERFLAG|CTF_PM_BORDERWIDTHTOP) +#define CTF_PM_FOOTERBORDERWIDTHBOTTOM (CTF_PM_FOOTERFLAG|CTF_PM_BORDERWIDTHBOTTOM) +#define CTF_PM_FOOTERBORDERWIDTHLEFT (CTF_PM_FOOTERFLAG|CTF_PM_BORDERWIDTHLEFT) +#define CTF_PM_FOOTERBORDERWIDTHRIGHT (CTF_PM_FOOTERFLAG|CTF_PM_BORDERWIDTHRIGHT) +#define CTF_PM_FOOTERPADDINGALL (CTF_PM_FOOTERFLAG|CTF_PM_PADDINGALL) +#define CTF_PM_FOOTERPADDINGTOP (CTF_PM_FOOTERFLAG|CTF_PM_PADDINGTOP) +#define CTF_PM_FOOTERPADDINGBOTTOM (CTF_PM_FOOTERFLAG|CTF_PM_PADDINGBOTTOM) +#define CTF_PM_FOOTERPADDINGLEFT (CTF_PM_FOOTERFLAG|CTF_PM_PADDINGLEFT) +#define CTF_PM_FOOTERPADDINGRIGHT (CTF_PM_FOOTERFLAG|CTF_PM_PADDINGRIGHT) +#define CTF_PM_FOOTERHEIGHT (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0031)) +#define CTF_PM_FOOTERMINHEIGHT (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0032)) +#define CTF_PM_FOOTERDYNAMIC (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0033)) +#define CTF_PM_FOOTERGRAPHICPOSITION (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0034)) +#define CTF_PM_FOOTERGRAPHICFILTER (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0035)) +#define CTF_PM_FOOTERGRAPHICURL (CTF_PM_FOOTERFLAG|(XML_PM_CTF_START + 0x0036)) +#define CTF_PM_FOOTERMARGINALL (CTF_PM_FOOTERFLAG|CTF_PM_MARGINALL) +#define CTF_PM_FOOTERMARGINTOP (CTF_PM_FOOTERFLAG|CTF_PM_MARGINTOP) +#define CTF_PM_FOOTERMARGINBOTTOM (CTF_PM_FOOTERFLAG|CTF_PM_MARGINBOTTOM) +#define CTF_PM_FOOTERMARGINLEFT (CTF_PM_FOOTERFLAG|CTF_PM_MARGINLEFT) +#define CTF_PM_FOOTERMARGINRIGHT (CTF_PM_FOOTERFLAG|CTF_PM_MARGINRIGHT) + +// Need own entries for PageMasterStyleMap ORed with the CTF_PM_FOOTERFLAG +#define CTF_PM_FOOTERREPEAT_OFFSET_X (CTF_PM_FOOTERFLAG|CTF_PM_REPEAT_OFFSET_X) +#define CTF_PM_FOOTERREPEAT_OFFSET_Y (CTF_PM_FOOTERFLAG|CTF_PM_REPEAT_OFFSET_Y) +#define CTF_PM_FOOTERFILLGRADIENTNAME (CTF_PM_FOOTERFLAG|CTF_PM_FILLGRADIENTNAME) +#define CTF_PM_FOOTERFILLHATCHNAME (CTF_PM_FOOTERFLAG|CTF_PM_FILLHATCHNAME) +#define CTF_PM_FOOTERFILLBITMAPNAME (CTF_PM_FOOTERFLAG|CTF_PM_FILLBITMAPNAME) +#define CTF_PM_FOOTERFILLTRANSNAME (CTF_PM_FOOTERFLAG|CTF_PM_FILLTRANSNAME) + +#define CTF_PM_FTN_HEIGHT (XML_PM_CTF_START + 0x0060) +#define CTF_PM_FTN_LINE_WEIGHT (XML_PM_CTF_START + 0x0061) +#define CTF_PM_FTN_LINE_COLOR (XML_PM_CTF_START + 0x0062) +#define CTF_PM_FTN_LINE_WIDTH (XML_PM_CTF_START + 0x0063) +#define CTF_PM_FTN_LINE_ADJUST (XML_PM_CTF_START + 0x0064) +#define CTF_PM_FTN_LINE_DISTANCE (XML_PM_CTF_START + 0x0065) +#define CTF_PM_FTN_DISTANCE (XML_PM_CTF_START + 0x0066) +#define CTF_PM_FTN_LINE_STYLE (XML_PM_CTF_START + 0x0067) + +extern const XMLPropertyMapEntry aXMLPageMasterStyleMap[]; +extern const XMLPropertyMapEntry g_XMLPageMasterDrawingPageStyleMap[]; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/PropertySetMerger.hxx b/xmloff/inc/PropertySetMerger.hxx new file mode 100644 index 000000000..f002f4c8f --- /dev/null +++ b/xmloff/inc/PropertySetMerger.hxx @@ -0,0 +1,28 @@ +/* -*- 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 <com/sun/star/beans/XPropertySet.hpp> + +extern css::uno::Reference<css::beans::XPropertySet> PropertySetMerger_CreateInstance( + const css::uno::Reference<css::beans::XPropertySet>& rPropSet1, + const css::uno::Reference<css::beans::XPropertySet>& rPropSet2) noexcept; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/RDFaExportHelper.hxx b/xmloff/inc/RDFaExportHelper.hxx new file mode 100644 index 000000000..8a8c49458 --- /dev/null +++ b/xmloff/inc/RDFaExportHelper.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 . + */ + +#pragma once + +#include <com/sun/star/uno/Reference.h> + +#include <rtl/ustring.hxx> +#include <tools/long.hxx> + +#include <map> + + +namespace com::sun::star { + namespace rdf { class XBlankNode; } + namespace rdf { class XMetadatable; } + namespace rdf { class XDocumentRepository; } +} + +class SvXMLExport; + +namespace xmloff { + +class RDFaExportHelper +{ +private: + SvXMLExport & m_rExport; + + css::uno::Reference<css::rdf::XDocumentRepository> m_xRepository; + + typedef ::std::map< OUString, OUString > + BlankNodeMap_t; + + BlankNodeMap_t m_BlankNodeMap; + + tools::Long m_Counter; + + OUString + LookupBlankNode( css::uno::Reference<css::rdf::XBlankNode> const & i_xBlankNode); + +public: + RDFaExportHelper(SvXMLExport & i_rExport); + + void + AddRDFa(css::uno::Reference<css::rdf::XMetadatable> const & i_xMetadatable); +}; + +} // namespace xmloff + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/RDFaImportHelper.hxx b/xmloff/inc/RDFaImportHelper.hxx new file mode 100644 index 000000000..31e00af93 --- /dev/null +++ b/xmloff/inc/RDFaImportHelper.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 . + */ + +#pragma once + +#include <memory> +#include <vector> + +#include <com/sun/star/uno/Reference.h> +#include <rtl/ustring.hxx> + +namespace com::sun::star { + namespace uno { class XComponentContext; } + namespace rdf { class XMetadatable; } + namespace rdf { class XRepositorySupplier; } +} + +class SvXMLImport; + +namespace xmloff { + +struct RDFaEntry; +struct ParsedRDFaAttributes; + +class RDFaImportHelper +{ + +private: + const SvXMLImport & m_rImport; + + ::std::vector< RDFaEntry > m_RDFaEntries; + + const SvXMLImport & GetImport() const { return m_rImport; } + + +public: + RDFaImportHelper(const SvXMLImport & i_rImport); + + ~RDFaImportHelper(); + + /** Parse RDFa attributes */ + std::shared_ptr<ParsedRDFaAttributes> ParseRDFa( + OUString const & i_rAbout, + OUString const & i_rProperty, + OUString const & i_rContent, + OUString const & i_rDatatype); + + /** Add a RDFa statement; must have been parsed with ParseRDFa */ + void AddRDFa( + css::uno::Reference< css::rdf::XMetadatable> const & i_xObject, + std::shared_ptr<ParsedRDFaAttributes> const & i_pRDFaAttributes); + + /** Parse and add a RDFa statement; parameters are XML attribute values */ + void ParseAndAddRDFa( + css::uno::Reference< css::rdf::XMetadatable> const & i_xObject, + OUString const & i_rAbout, + OUString const & i_rProperty, + OUString const & i_rContent, + OUString const & i_rDatatype); + + /** Insert all added statements into the RDF repository. + <p> This is done <em>after</em> the input file has been read, + to prevent collision between generated ids and ids in the file.</p> + */ + void InsertRDFa( css::uno::Reference< css::rdf::XRepositorySupplier > const & i_xModel); +}; + +} // namespace xmloff + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/SchXMLAutoStylePoolP.hxx b/xmloff/inc/SchXMLAutoStylePoolP.hxx new file mode 100644 index 000000000..50f511eae --- /dev/null +++ b/xmloff/inc/SchXMLAutoStylePoolP.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 . + */ +#pragma once + +#include <xmloff/xmlaustp.hxx> + +class SchXMLExport; + +class SchXMLAutoStylePoolP final : public SvXMLAutoStylePoolP +{ + SchXMLExport& mrSchXMLExport; + + virtual void exportStyleAttributes( + SvXMLAttributeList& rAttrList, + XmlStyleFamily nFamily, + const ::std::vector< XMLPropertyState >& rProperties, + const SvXMLExportPropertyMapper& rPropExp + , const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap + ) const override; + +public: + explicit SchXMLAutoStylePoolP( SchXMLExport& rSchXMLExport ); + virtual ~SchXMLAutoStylePoolP() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/SchXMLExport.hxx b/xmloff/inc/SchXMLExport.hxx new file mode 100644 index 000000000..55ac11256 --- /dev/null +++ b/xmloff/inc/SchXMLExport.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 . + */ +#pragma once + +#include <xmloff/SchXMLExportHelper.hxx> +#include "SchXMLAutoStylePoolP.hxx" +#include <xmloff/xmlexp.hxx> +#include <xmloff/xmlprmap.hxx> + +namespace com::sun::star { + namespace task { + class XStatusIndicator; + } +} + +// export class for a complete chart document + +class SchXMLExport final : public SvXMLExport +{ +private: + rtl::Reference<SchXMLAutoStylePoolP> maAutoStylePool; + + rtl::Reference<SchXMLExportHelper> maExportHelper; + + virtual ErrCode exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) override; + + virtual void ExportAutoStyles_() override; + virtual void ExportMasterStyles_() override; + virtual void ExportContent_() override; + +public: + SchXMLExport( + const css::uno::Reference< css::uno::XComponentContext >& xContext, + OUString const & implementationName, + SvXMLExportFlags nExportFlags ); + virtual ~SchXMLExport() override; + + void collectAutoStyles() override; + rtl::Reference< XMLPropertySetMapper > const & GetPropertySetMapper() const; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/SchXMLImport.hxx b/xmloff/inc/SchXMLImport.hxx new file mode 100644 index 000000000..b61b038be --- /dev/null +++ b/xmloff/inc/SchXMLImport.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 . + */ +#pragma once + +#include <xmloff/SchXMLImportHelper.hxx> +#include <xmloff/xmlimp.hxx> +#include <xmloff/xmlictxt.hxx> + +class SchXMLImport final : public SvXMLImport +{ +private: + rtl::Reference<SchXMLImportHelper> maImportHelper; + + virtual SvXMLImportContext* CreateFastContext( + sal_Int32 nElement, + const ::css::uno::Reference<::css::xml::sax::XFastAttributeList>& xAttrList) override; + +public: + SchXMLImport(const css::uno::Reference<css::uno::XComponentContext>& xContext, + OUString const& implementationName, SvXMLImportFlags nImportFlags); + + virtual ~SchXMLImport() noexcept override; + + SvXMLImportContext* CreateStylesContext(); + + // XImporter + virtual void SAL_CALL + setTargetDocument(const css::uno::Reference<css::lang::XComponent>& xDoc) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/StyleMap.hxx b/xmloff/inc/StyleMap.hxx new file mode 100644 index 000000000..8b122fd0f --- /dev/null +++ b/xmloff/inc/StyleMap.hxx @@ -0,0 +1,80 @@ +/* -*- 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 <com/sun/star/lang/XUnoTunnel.hpp> +#include <comphelper/servicehelper.hxx> +#include <cppuhelper/implbase.hxx> +#include <o3tl/hash_combine.hxx> +#include <unordered_map> + +enum class XmlStyleFamily; + +struct StyleNameKey_Impl +{ + XmlStyleFamily m_nFamily; + OUString m_aName; + + StyleNameKey_Impl( XmlStyleFamily nFamily, + const OUString& rName ) : + m_nFamily( nFamily ), + m_aName( rName ) + { + } +}; + +struct StyleNameHash_Impl +{ + inline size_t operator()( const StyleNameKey_Impl& r ) const; + inline bool operator()( const StyleNameKey_Impl& r1, + const StyleNameKey_Impl& r2 ) const; +}; + +inline size_t StyleNameHash_Impl::operator()( const StyleNameKey_Impl& r ) const +{ + std::size_t seed = 0; + o3tl::hash_combine(seed, r.m_nFamily); + o3tl::hash_combine(seed, r.m_aName.hashCode()); + return seed; +} + +inline bool StyleNameHash_Impl::operator()( + const StyleNameKey_Impl& r1, + const StyleNameKey_Impl& r2 ) const +{ + return r1.m_nFamily == r2.m_nFamily && r1.m_aName == r2.m_aName; +} + +class StyleMap final : + public ::cppu::WeakImplHelper< css::lang::XUnoTunnel>, + public std::unordered_map< StyleNameKey_Impl, OUString, + StyleNameHash_Impl, StyleNameHash_Impl > +{ + +public: + + StyleMap(); + virtual ~StyleMap() override; + + // XUnoTunnel + UNO3_GETIMPLEMENTATION_DECL(StyleMap) +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/TransGradientStyle.hxx b/xmloff/inc/TransGradientStyle.hxx new file mode 100644 index 000000000..781969f7d --- /dev/null +++ b/xmloff/inc/TransGradientStyle.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + + +#include <rtl/ustring.hxx> + +class SvXMLImport; +class SvXMLExport; +namespace com::sun::star { + namespace uno { template<class A> class Reference; } + namespace xml::sax { class XFastAttributeList; } + namespace uno { class Any; } +} + + +class XMLTransGradientStyleImport +{ + SvXMLImport& rImport; + +public: + XMLTransGradientStyleImport( SvXMLImport& rImport ); + + void importXML( + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList, + css::uno::Any& rValue, + OUString& rStrName ); +}; + +class XMLTransGradientStyleExport +{ + SvXMLExport& rExport; + +public: + XMLTransGradientStyleExport( SvXMLExport& rExport ); + + void exportXML( const OUString& rStrName, const css::uno::Any& rValue ); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/WordWrapPropertyHdl.hxx b/xmloff/inc/WordWrapPropertyHdl.hxx new file mode 100644 index 000000000..b64d53faf --- /dev/null +++ b/xmloff/inc/WordWrapPropertyHdl.hxx @@ -0,0 +1,41 @@ +/* -*- 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 <xmloff/xmlprhdl.hxx> + +/** + PropertyHandler for a named xml bool type: +*/ +class SvXMLImport; +class XMLWordWrapPropertyHdl final : public XMLPropertyHandler +{ +private: + SvXMLImport* mpImport; + +public: + XMLWordWrapPropertyHdl( SvXMLImport* pImport ); + virtual ~XMLWordWrapPropertyHdl() 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; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLBackgroundImageContext.hxx b/xmloff/inc/XMLBackgroundImageContext.hxx new file mode 100644 index 000000000..ab81cc3cb --- /dev/null +++ b/xmloff/inc/XMLBackgroundImageContext.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 . + */ + +#pragma once + +#include <com/sun/star/style/GraphicLocation.hpp> +#include "XMLElementPropertyContext.hxx" + +namespace com::sun::star { + namespace io { class XOutputStream; } +} + +class XMLBackgroundImageContext final : public XMLElementPropertyContext +{ + XMLPropertyState aPosProp; + sal_Int32 m_nBitmapModeIdx; + XMLPropertyState aFilterProp; + XMLPropertyState aTransparencyProp; + + css::style::GraphicLocation ePos; + OUString m_sURL; + OUString sFilter; + sal_Int8 nTransparency; + + css::uno::Reference < css::io::XOutputStream > m_xBase64Stream; + +private: + void ProcessAttrs( + const css::uno::Reference<css::xml::sax::XFastAttributeList > & xAttrList ); + +public: + + XMLBackgroundImageContext( + SvXMLImport& rImport, + sal_Int32 nElement, + const css::uno::Reference<css::xml::sax::XFastAttributeList > & xAttrList, + const XMLPropertyState& rProp, + sal_Int32 nPosIdx, + sal_Int32 nFilterIdx, + sal_Int32 nTransparencyIdx, + sal_Int32 nBitmapModeIdx, + ::std::vector< XMLPropertyState > &rProps ); + + virtual ~XMLBackgroundImageContext() 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; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLBackgroundImageExport.hxx b/xmloff/inc/XMLBackgroundImageExport.hxx new file mode 100644 index 000000000..401df38ef --- /dev/null +++ b/xmloff/inc/XMLBackgroundImageExport.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 . + */ + +#pragma once + +#include <sal/types.h> +#include <rtl/ustring.hxx> + +namespace com::sun::star::uno { + class Any; +} + +class SvXMLExport; + +class XMLBackgroundImageExport +{ + SvXMLExport& rExport; + +public: + + SvXMLExport& GetExport() const { return rExport; } + + XMLBackgroundImageExport( SvXMLExport& rExport ); + + void exportXML( const css::uno::Any& rURL, + const css::uno::Any *pPos, + const css::uno::Any *pFilter, + const css::uno::Any *pTransparency, + sal_uInt16 nPrefix, + const OUString& rLocalName ); +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLBase64Export.hxx b/xmloff/inc/XMLBase64Export.hxx new file mode 100644 index 000000000..89a915538 --- /dev/null +++ b/xmloff/inc/XMLBase64Export.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 . + */ +#pragma once + +#include <com/sun/star/uno/Reference.h> +#include <xmloff/xmltoken.hxx> + +namespace com::sun::star::io { class XInputStream; } +class SvXMLExport; + +class XMLBase64Export +{ + SvXMLExport& rExport; + + SvXMLExport& GetExport() { return rExport; } + +public: + + XMLBase64Export( SvXMLExport& rExport ); + + bool exportXML( const css::uno::Reference < css::io::XInputStream > & rIn ); + bool exportElement( const css::uno::Reference < css::io::XInputStream > & rIn, + enum ::xmloff::token::XMLTokenEnum eName ); + bool exportOfficeBinaryDataElement( + const css::uno::Reference < css::io::XInputStream > & rIn ); +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLBasicExportFilter.hxx b/xmloff/inc/XMLBasicExportFilter.hxx new file mode 100644 index 000000000..2ed39d409 --- /dev/null +++ b/xmloff/inc/XMLBasicExportFilter.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <cppuhelper/implbase.hxx> + + +typedef ::cppu::WeakImplHelper< + css::xml::sax::XDocumentHandler > XMLBasicExportFilter_BASE; + +class XMLBasicExportFilter final : public XMLBasicExportFilter_BASE +{ +private: + css::uno::Reference< css::xml::sax::XDocumentHandler > m_xHandler; + +public: + XMLBasicExportFilter( + const css::uno::Reference< css::xml::sax::XDocumentHandler >& rxHandler ); + virtual ~XMLBasicExportFilter() override; + + // 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; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLBitmapLogicalSizePropertyHandler.hxx b/xmloff/inc/XMLBitmapLogicalSizePropertyHandler.hxx new file mode 100644 index 000000000..a3be8f99c --- /dev/null +++ b/xmloff/inc/XMLBitmapLogicalSizePropertyHandler.hxx @@ -0,0 +1,52 @@ +/* -*- 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 <xmloff/xmlprhdl.hxx> + +template<typename EnumT> struct SvXMLEnumMapEntry; + + +/** Abstract base-class for different XML-types. Derivations of this class + knows how to compare, im/export a special XML-type +*/ +class XMLBitmapLogicalSizePropertyHandler final : public XMLPropertyHandler +{ +public: + + XMLBitmapLogicalSizePropertyHandler(); + + // Just needed for virtual destruction + virtual ~XMLBitmapLogicalSizePropertyHandler() 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; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLBitmapRepeatOffsetPropertyHandler.hxx b/xmloff/inc/XMLBitmapRepeatOffsetPropertyHandler.hxx new file mode 100644 index 000000000..d008935ac --- /dev/null +++ b/xmloff/inc/XMLBitmapRepeatOffsetPropertyHandler.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 . + */ + +#pragma once + +#include <xmloff/xmlprhdl.hxx> + +template<typename EnumT> struct SvXMLEnumMapEntry; + +/** Abstract base-class for different XML-types. Derivations of this class + knows how to compare, im/export a special XML-type +*/ +class XMLBitmapRepeatOffsetPropertyHandler final : public XMLPropertyHandler +{ + bool mbX; + OUString msVertical; + OUString msHorizontal; +public: + + XMLBitmapRepeatOffsetPropertyHandler( bool bX ); + + // Just needed for virtual destruction + virtual ~XMLBitmapRepeatOffsetPropertyHandler() 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; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLChartPropertySetMapper.hxx b/xmloff/inc/XMLChartPropertySetMapper.hxx new file mode 100644 index 000000000..8b3d72d3e --- /dev/null +++ b/xmloff/inc/XMLChartPropertySetMapper.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 . + */ +#pragma once + +#include <xmloff/xmlprmap.hxx> +#include <xmloff/xmlexppr.hxx> +#include <xmloff/xmlimppr.hxx> +#include <xmloff/xmlimp.hxx> +#include <xmloff/prhdlfac.hxx> + +class SvXMLExport; + +class XMLChartPropHdlFactory final : public XMLPropertyHandlerFactory +{ +private: + SvXMLExport const*const m_pExport; + +public: + XMLChartPropHdlFactory(SvXMLExport const*); + virtual ~XMLChartPropHdlFactory() override; + virtual const XMLPropertyHandler* GetPropertyHandler( sal_Int32 nType ) const override; +}; + +class XMLChartPropertySetMapper final : public XMLPropertySetMapper +{ +public: + explicit XMLChartPropertySetMapper(SvXMLExport const* pExport); + virtual ~XMLChartPropertySetMapper() override; +}; + +class XMLChartExportPropertyMapper final : public SvXMLExportPropertyMapper +{ +private: + SvXMLExport& mrExport; + css::uno::Reference< css::chart2::XChartDocument > mxChartDoc; + + virtual void ContextFilter( + bool bEnableFoFontFamily, + ::std::vector< XMLPropertyState >& rProperties, + const css::uno::Reference<css::beans::XPropertySet >& rPropSet ) const override; + + /// 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 override; + + /// 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 override; + +public: + XMLChartExportPropertyMapper( const rtl::Reference< XMLPropertySetMapper >& rMapper, + SvXMLExport& rExport ); + virtual ~XMLChartExportPropertyMapper() override; + + void setChartDoc( const css::uno::Reference< css::chart2::XChartDocument >& xChartDoc ); +}; + +class XMLChartImportPropertyMapper final : public SvXMLImportPropertyMapper +{ +private: + SvXMLImport& mrImport; + +public: + XMLChartImportPropertyMapper( const rtl::Reference< XMLPropertySetMapper >& rMapper, + const SvXMLImport& rImport ); + virtual ~XMLChartImportPropertyMapper() override; + + virtual bool handleSpecialItem( + XMLPropertyState& rProperty, + ::std::vector< XMLPropertyState >& rProperties, + const OUString& rValue, + const SvXMLUnitConverter& rUnitConverter, + const SvXMLNamespaceMap& rNamespaceMap ) const override; + + virtual void finished( + ::std::vector< XMLPropertyState >& rProperties, + sal_Int32 nStartIndex, sal_Int32 nEndIndex ) const override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLChartStyleContext.hxx b/xmloff/inc/XMLChartStyleContext.hxx new file mode 100644 index 000000000..57744a774 --- /dev/null +++ b/xmloff/inc/XMLChartStyleContext.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <xmloff/XMLShapeStyleContext.hxx> + +class XMLChartStyleContext final : public XMLShapeStyleContext +{ +private: + OUString msDataStyleName; + OUString msPercentageDataStyleName; + SvXMLStylesContext& mrStyles; + + /// is called when an attribute at the (auto)style element is found + virtual void SetAttribute( sal_Int32 nElement, const OUString& rValue ) override; + +public: + + XMLChartStyleContext( + SvXMLImport& rImport, + SvXMLStylesContext& rStyles, XmlStyleFamily nFamily ); + virtual ~XMLChartStyleContext() override; + + /// is called after all styles have been read to apply styles + void FillPropertySet( + const css::uno::Reference<css::beans::XPropertySet > & rPropSet ) override; + + /// necessary for property context (element-property symbol-image) + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; + + bool isEmptyDataStyleName() override { return msDataStyleName.isEmpty(); } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLClipPropertyHandler.hxx b/xmloff/inc/XMLClipPropertyHandler.hxx new file mode 100644 index 000000000..0f9730171 --- /dev/null +++ b/xmloff/inc/XMLClipPropertyHandler.hxx @@ -0,0 +1,39 @@ +/* -*- 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 <xmloff/xmlprhdl.hxx> + +/** + PropertyHandler for the XML-data-type: +*/ +class XMLClipPropertyHandler final : public XMLPropertyHandler +{ + bool m_bODF11; +public: + XMLClipPropertyHandler( bool bODF11 ); + virtual ~XMLClipPropertyHandler() override; + + virtual bool equals( const css::uno::Any& r1, const css::uno::Any& r2 ) const 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; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLElementPropertyContext.hxx b/xmloff/inc/XMLElementPropertyContext.hxx new file mode 100644 index 000000000..bf7553392 --- /dev/null +++ b/xmloff/inc/XMLElementPropertyContext.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <xmloff/xmlictxt.hxx> +#include <xmloff/maptype.hxx> + +class SvXMLImport; + + +class XMLElementPropertyContext : public SvXMLImportContext +{ + bool bInsert; + +protected: + + ::std::vector< XMLPropertyState > &rProperties; + XMLPropertyState aProp; + + void SetInsert( bool bIns ) { bInsert = bIns; } + +public: + + XMLElementPropertyContext( SvXMLImport& rImport, sal_Int32 nElement, + const XMLPropertyState& rProp, + ::std::vector< XMLPropertyState > &rProps ); + + virtual ~XMLElementPropertyContext() override; + + virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLEmbeddedObjectExportFilter.hxx b/xmloff/inc/XMLEmbeddedObjectExportFilter.hxx new file mode 100644 index 000000000..c21321321 --- /dev/null +++ b/xmloff/inc/XMLEmbeddedObjectExportFilter.hxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef XMLOFF_INC_XMLEMBEDDEDOBJECTEXPORTFILTER_HXX +#define XMLOFF_INC_XMLEMBEDDEDOBJECTEXPORTFILTER_HXX + +#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/implbase.hxx> + +class XMLEmbeddedObjectExportFilter final : public cppu::WeakImplHelper< + css::xml::sax::XExtendedDocumentHandler, + css::lang::XServiceInfo, + css::lang::XInitialization> +{ + css::uno::Reference< css::xml::sax::XDocumentHandler > xHandler; + css::uno::Reference< css::xml::sax::XExtendedDocumentHandler > xExtHandler; + +public: + XMLEmbeddedObjectExportFilter( const css::uno::Reference< css::xml::sax::XDocumentHandler > & rHandler ) noexcept; + virtual ~XMLEmbeddedObjectExportFilter () noexcept 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; + + // css::xml::sax::XExtendedDocumentHandler + virtual void SAL_CALL startCDATA() override; + virtual void SAL_CALL endCDATA() override; + virtual void SAL_CALL comment(const OUString& sComment) override; + virtual void SAL_CALL allowLineBreak() override; + virtual void SAL_CALL unknown(const OUString& sString) override; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + +}; + +#endif // XMLOFF_INC_XMLEMBEDDEDOBJECTEXPORTFILTER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLEmbeddedObjectImportContext.hxx b/xmloff/inc/XMLEmbeddedObjectImportContext.hxx new file mode 100644 index 000000000..ca1ea2ac4 --- /dev/null +++ b/xmloff/inc/XMLEmbeddedObjectImportContext.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 . + */ + +#pragma once + +#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp> +#include <xmloff/xmlictxt.hxx> + +namespace com::sun::star::lang { class XComponent; } + +class XMLEmbeddedObjectImportContext final : public SvXMLImportContext +{ + css::uno::Reference<css::xml::sax::XFastDocumentHandler > mxFastHandler; + css::uno::Reference<css::lang::XComponent > xComp; + + OUString sFilterService; + OUString sCLSID; + +public: + + const OUString& GetFilterServiceName() const { return sFilterService; } + const OUString& GetFilterCLSID() const { return sCLSID; } + + XMLEmbeddedObjectImportContext( SvXMLImport& rImport, sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ); + + virtual ~XMLEmbeddedObjectImportContext() 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 startFastElement( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; + + virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; + + virtual void SAL_CALL characters( const OUString& rChars ) override; + + void SetComponent( css::uno::Reference< css::lang::XComponent > const & rComp ); + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLEventImportHelper.hxx b/xmloff/inc/XMLEventImportHelper.hxx new file mode 100644 index 000000000..ccb475ac1 --- /dev/null +++ b/xmloff/inc/XMLEventImportHelper.hxx @@ -0,0 +1,93 @@ +/* -*- 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 <com/sun/star/uno/Reference.hxx> +#include <xmloff/xmlevent.hxx> + +#include <map> +#include <vector> +#include <memory> + + +namespace com::sun::star { + namespace xml::sax { class XFastAttributeList; } +} +class XMLEventContextFactory; +class XMLEventsImportContext; +struct XMLEventNameTranslation; + +typedef ::std::map< OUString, std::unique_ptr<XMLEventContextFactory> > FactoryMap; +typedef ::std::map< XMLEventName, OUString > NameMap; + + +/** + * Helps the XMLEventsImportContext. + * + * This class stores + * a) the translation from XML event names to API event names, and + * b) a mapping from script language names to XMLEventContextFactory objects + * (that handle particular languages). + * + * Event name translation tables may be added, i.e. they will be joined + * together. If different translations are needed (i.e., if the same XML name + * needs to be translated to different API names in different contexts), then + * translation tables may be saved on a translation table stack. + */ +class XMLEventImportHelper +{ + /// map of XMLEventContextFactory objects + FactoryMap aFactoryMap; + + /// map from XML to API names + std::unique_ptr<NameMap> pEventNameMap; + + /// stack of previous aEventNameMap + std::vector< std::unique_ptr<NameMap> > aEventNameMapVector; + +public: + XMLEventImportHelper(); + + ~XMLEventImportHelper(); + + /// register a handler for a particular language type + void RegisterFactory( const OUString& rLanguage, + std::unique_ptr<XMLEventContextFactory> aFactory ); + + /// add event name translation to the internal table + void AddTranslationTable( const XMLEventNameTranslation* pTransTable ); + + /// save the old translation table on a stack and install an empty table + void PushTranslationTable(); + + /// recover the top-most previously saved translation table + void PopTranslationTable(); + + /// create an appropriate import context for a particular event + SvXMLImportContext* CreateContext( + SvXMLImport& rImport, + const css::uno::Reference< css::xml::sax::XFastAttributeList> & xAttrList, + XMLEventsImportContext* rEvents, + const OUString& rXmlEventName, + const OUString& rLanguage); + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLFillBitmapSizePropertyHandler.hxx b/xmloff/inc/XMLFillBitmapSizePropertyHandler.hxx new file mode 100644 index 000000000..4d5a21fae --- /dev/null +++ b/xmloff/inc/XMLFillBitmapSizePropertyHandler.hxx @@ -0,0 +1,52 @@ +/* -*- 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 <xmloff/xmlprhdl.hxx> + +template<typename EnumT> struct SvXMLEnumMapEntry; + + +/** Abstract base-class for different XML-types. Derivations of this class + knows how to compare, im/export a special XML-type +*/ +class XMLFillBitmapSizePropertyHandler final : public XMLPropertyHandler +{ +public: + + XMLFillBitmapSizePropertyHandler(); + + // Just needed for virtual destruction + virtual ~XMLFillBitmapSizePropertyHandler() 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; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLFootnoteConfigurationImportContext.hxx b/xmloff/inc/XMLFootnoteConfigurationImportContext.hxx new file mode 100644 index 000000000..2bd8efc40 --- /dev/null +++ b/xmloff/inc/XMLFootnoteConfigurationImportContext.hxx @@ -0,0 +1,85 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <memory> +#include <xmloff/xmlstyle.hxx> + +namespace com::sun::star { + namespace uno { template<class X> class Reference; } + namespace xml::sax { class XAttributeList; } + namespace beans { class XPropertySet; } +} +class SvXMLImport; + +/// import footnote and endnote configuration elements +class XMLFootnoteConfigurationImportContext final : public SvXMLStyleContext +{ + OUString sCitationStyle; + OUString sAnchorStyle; + OUString sDefaultStyle; + OUString sPageStyle; + OUString sPrefix; + OUString sSuffix; + OUString sNumFormat; + OUString sNumSync; + OUString sBeginNotice; + OUString sEndNotice; + + sal_Int16 nOffset; + sal_Int16 nNumbering; + bool bPosition; + bool bIsEndnote; + + /// parse attributes + virtual void SetAttribute( sal_Int32 nElement, const OUString& rValue ) override; + +public: + + + XMLFootnoteConfigurationImportContext( + SvXMLImport& rImport, + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList> & xAttrList); + + virtual ~XMLFootnoteConfigurationImportContext() override; + + /// for footnotes, also parse begin and end notices + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; + + /// set configuration at document; calls ProcessSettings + /* Move code from <CreateAndInsertLate(..)> to <Finish(..)>, because + at this time all styles it references have been set. (#i40579#) + */ + virtual void Finish( bool bOverwrite) override; + + /// set configuration at document + void ProcessSettings( + const css::uno::Reference< css::beans::XPropertySet> & rConfig); + + /// for helper class: set begin notice + void SetBeginNotice( const OUString& sText); + + /// for helper class: set end notice + void SetEndNotice( const OUString& sText); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLImageMapContext.hxx b/xmloff/inc/XMLImageMapContext.hxx new file mode 100644 index 000000000..aec96fb29 --- /dev/null +++ b/xmloff/inc/XMLImageMapContext.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <xmloff/xmlictxt.hxx> +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/Reference.h> + +namespace com::sun::star { + namespace container { class XIndexContainer; } + namespace beans { class XPropertySet; } + namespace xml::sax { class XAttributeList; } +} + + +class XMLImageMapContext final : public SvXMLImportContext +{ + /// the image map to be imported + css::uno::Reference< css::container::XIndexContainer> xImageMap; + + /// the property set from which to get and where eventually to set the + /// image map + css::uno::Reference< css::beans::XPropertySet> xPropertySet; + +public: + + XMLImageMapContext( + SvXMLImport& rImport, + css::uno::Reference< css::beans::XPropertySet> const & rPropertySet); + + virtual ~XMLImageMapContext() 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; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLImageMapExport.hxx b/xmloff/inc/XMLImageMapExport.hxx new file mode 100644 index 000000000..12679b6db --- /dev/null +++ b/xmloff/inc/XMLImageMapExport.hxx @@ -0,0 +1,88 @@ +/* -*- 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 <sal/types.h> + +namespace com::sun::star { + namespace uno { template<class X> class Reference; } + namespace beans { class XPropertySet; } + namespace container { class XIndexContainer; } +} +class SvXMLExport; + + +/** + * Export an ImageMap as defined by service com.sun.star.image.ImageMap to XML. + */ +class XMLImageMapExport +{ + SvXMLExport& mrExport; + +public: + XMLImageMapExport(SvXMLExport& rExport); + + /** + * Get the ImageMap object from the "ImageMap" property and subsequently + * export the map (if present). + */ + void Export( + /// the property set containing the ImageMap property + const css::uno::Reference< css::beans::XPropertySet> & rPropertySet); + /** + * Export an ImageMap (XIndexContainer). + */ + void Export( + /// the container containing the image map elements + const css::uno::Reference< css::container::XIndexContainer> & rContainer); + +private: + + /** + * Export a single, named map entry. + * (as given by com.sun.star.image.ImageMapObject) + * Calls methods for specific image map entries. + */ + void ExportMapEntry( + const css::uno::Reference< css::beans::XPropertySet> & rPropertySet); + + /** + * Export the specifics of a rectangular image map entry. + * To be called by ExportMapEntry. + */ + void ExportRectangle( + const css::uno::Reference< css::beans::XPropertySet> & rPropertySet); + + /** + * Export the specifics of a circular image map entry. + * To be called by ExportMapEntry. + */ + void ExportCircle( + const css::uno::Reference< css::beans::XPropertySet> & rPropertySet); + + /** + * Export the specifics of a polygonal image map entry; + * To be called by ExportMapEntry. + */ + void ExportPolygon( + const css::uno::Reference< css::beans::XPropertySet> & rPropertySet); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLIndexBibliographyConfigurationContext.hxx b/xmloff/inc/XMLIndexBibliographyConfigurationContext.hxx new file mode 100644 index 000000000..fe0b24b90 --- /dev/null +++ b/xmloff/inc/XMLIndexBibliographyConfigurationContext.hxx @@ -0,0 +1,71 @@ +/* -*- 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 <xmloff/xmlstyle.hxx> +#include <xmloff/languagetagodf.hxx> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <rtl/ustring.hxx> + + +#include <vector> + +namespace com::sun::star { + namespace xml::sax { class XAttributeList; } +} + + +/** + * Import bibliography configuration. + * + * Little cheat: Cover all child elements in CreateChildContext. + */ +class XMLIndexBibliographyConfigurationContext final : public SvXMLStyleContext +{ + OUString sSuffix; + OUString sPrefix; + OUString sAlgorithm; + LanguageTagODF maLanguageTagODF; + bool bNumberedEntries; + bool bSortByPosition; + + ::std::vector< css::uno::Sequence< css::beans::PropertyValue> > aSortKeys; + +public: + + + XMLIndexBibliographyConfigurationContext(SvXMLImport& rImport); + + virtual ~XMLIndexBibliographyConfigurationContext() override; + +private: + + virtual void SetAttribute( sal_Int32 nElement, + const OUString& rValue ) override; + + virtual void CreateAndInsert( bool bOverwrite ) 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; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLIsPercentagePropertyHandler.hxx b/xmloff/inc/XMLIsPercentagePropertyHandler.hxx new file mode 100644 index 000000000..78ddde336 --- /dev/null +++ b/xmloff/inc/XMLIsPercentagePropertyHandler.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 . + */ + +#pragma once + +#include <xmloff/xmlprhdl.hxx> + +/** + This is a handler that returns true for import if the attribute string + contains a '%' value. For export this is only usable for filtering. +*/ +class XMLIsPercentagePropertyHandler final : public XMLPropertyHandler +{ +public: + virtual ~XMLIsPercentagePropertyHandler () 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; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLLineNumberingImportContext.hxx b/xmloff/inc/XMLLineNumberingImportContext.hxx new file mode 100644 index 000000000..9a2083b37 --- /dev/null +++ b/xmloff/inc/XMLLineNumberingImportContext.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 . + */ + +#pragma once + +#include <xmloff/xmlstyle.hxx> +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/Reference.h> + +namespace com::sun::star { + namespace xml::sax { class XAttributeList; } +} + + +/** import <text:linenumbering-configuration> elements */ +class XMLLineNumberingImportContext final : public SvXMLStyleContext +{ + OUString sStyleName; + OUString sNumFormat; + OUString sNumLetterSync; + OUString sSeparator; + sal_Int32 nOffset; + sal_Int16 nNumberPosition; + sal_Int16 nIncrement; + sal_Int16 nSeparatorIncrement; + bool bNumberLines; + bool bCountEmptyLines; + bool bCountInFloatingFrames; + bool bRestartNumbering; + +public: + + XMLLineNumberingImportContext(SvXMLImport& rImport); + + virtual ~XMLLineNumberingImportContext() override; + + // to be used by child context: set separator info + void SetSeparatorText(const OUString& sText); + void SetSeparatorIncrement(sal_Int16 nIncr); + +private: + + virtual void SetAttribute( sal_Int32 nElement, + const OUString& rValue ) override; + + virtual void CreateAndInsert(bool bOverwrite) 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; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLNumberStylesImport.hxx b/xmloff/inc/XMLNumberStylesImport.hxx new file mode 100644 index 000000000..7ff731245 --- /dev/null +++ b/xmloff/inc/XMLNumberStylesImport.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 . + */ + +#pragma once + +#include <xmloff/xmlnumfi.hxx> + +// presentations:animations + +struct SdXMLFixedDataStyle; +class SdXMLImport; +enum class DataStyleNumber : sal_uInt8; + +class SdXMLNumberFormatImportContext final : public SvXMLNumFormatContext +{ + friend class SdXMLNumberFormatMemberImportContext; + + bool mbTimeStyle; + bool mbAutomatic; + DataStyleNumber mnElements[16]; + sal_Int16 mnIndex; + + sal_Int32 mnKey; + + bool compareStyle( const SdXMLFixedDataStyle* pStyle, sal_Int16& nIndex ) const; + + void add( std::u16string_view rNumberStyle, bool bLong, bool bTextual, bool bDecimal02, std::u16string_view rText ); + +public: + + SdXMLNumberFormatImportContext( SdXMLImport& rImport, + sal_Int32 nElement, + SvXMLNumImpData* pNewData, SvXMLStylesTokens nNewType, + const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList, + SvXMLStylesContext& rStyles); + virtual ~SdXMLNumberFormatImportContext() override; + + virtual void SAL_CALL endFastElement(sal_Int32 nElement) 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; + + sal_Int32 GetDrawKey() const { return mnKey; } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLNumberWithAutoForVoidPropHdl.hxx b/xmloff/inc/XMLNumberWithAutoForVoidPropHdl.hxx new file mode 100644 index 000000000..c08054b2e --- /dev/null +++ b/xmloff/inc/XMLNumberWithAutoForVoidPropHdl.hxx @@ -0,0 +1,41 @@ +/* -*- 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 <xmloff/xmlprhdl.hxx> + +/** + PropertyHandler for the XML-data-type: XML_TYPE_NUMBER16_AUTO + Reads/writes numeric properties with special handling for "void" value + (i.e., void property will be written as "auto") +*/ +class XMLNumberWithAutoForVoidPropHdl final : public XMLPropertyHandler +{ +public: + explicit XMLNumberWithAutoForVoidPropHdl() {} + virtual ~XMLNumberWithAutoForVoidPropHdl() 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; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLPercentOrMeasurePropertyHandler.hxx b/xmloff/inc/XMLPercentOrMeasurePropertyHandler.hxx new file mode 100644 index 000000000..d2928d19d --- /dev/null +++ b/xmloff/inc/XMLPercentOrMeasurePropertyHandler.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 . + */ + +#pragma once + +#include <xmloff/xmlprhdl.hxx> + +/** + This is a handler either only import/exports percent or measure. +*/ +class XMLPercentOrMeasurePropertyHandler final : public XMLPropertyHandler +{ +public: + XMLPercentOrMeasurePropertyHandler(); + virtual ~XMLPercentOrMeasurePropertyHandler () 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; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLRectangleMembersHandler.hxx b/xmloff/inc/XMLRectangleMembersHandler.hxx new file mode 100644 index 000000000..5b9766149 --- /dev/null +++ b/xmloff/inc/XMLRectangleMembersHandler.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 . + */ + +#pragma once + +#include <xmloff/xmlprhdl.hxx> + +template<typename EnumT> struct SvXMLEnumMapEntry; + + +/** Abstract base-class for different XML-types. Derivations of this class + knows how to compare, im/export a special XML-type +*/ +class XMLRectangleMembersHdl final : public XMLPropertyHandler +{ +private: + sal_Int32 mnType; +public: + + XMLRectangleMembersHdl( sal_Int32 nType ); + + // Just needed for virtual destruction + virtual ~XMLRectangleMembersHdl() 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; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLReplacementImageContext.hxx b/xmloff/inc/XMLReplacementImageContext.hxx new file mode 100644 index 000000000..5fbf683f3 --- /dev/null +++ b/xmloff/inc/XMLReplacementImageContext.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 . + */ + +#pragma once + +#include <xmloff/xmlictxt.hxx> + + +namespace com::sun::star { + namespace beans { class XPropertySet; } + namespace io { class XOutputStream; } +} + +class XMLReplacementImageContext final : public SvXMLImportContext +{ + css::uno::Reference < css::io::XOutputStream > m_xBase64Stream; + css::uno::Reference < css::beans::XPropertySet > m_xPropSet; + + OUString m_sHRef; + +public: + + + XMLReplacementImageContext( SvXMLImport& rImport, + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & rAttrList, + const css::uno::Reference< css::beans::XPropertySet >& rPropSet ); + virtual ~XMLReplacementImageContext() override; + + virtual void SAL_CALL endFastElement(sal_Int32 nElement) 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; + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLRtlGutterPropertyHandler.hxx b/xmloff/inc/XMLRtlGutterPropertyHandler.hxx new file mode 100644 index 000000000..513320e15 --- /dev/null +++ b/xmloff/inc/XMLRtlGutterPropertyHandler.hxx @@ -0,0 +1,39 @@ +/* -*- 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 <xmloff/xmlprhdl.hxx> + +/// Maps <style:page-layout-properties style:writing-mode="..."> to RtlGutter. +class XMLRtlGutterPropertyHandler final : public XMLPropertyHandler +{ +public: + XMLRtlGutterPropertyHandler(); + + ~XMLRtlGutterPropertyHandler() override; + + bool importXML(const OUString& rStrImpValue, css::uno::Any& rValue, + const SvXMLUnitConverter& rUnitConverter) const override; + + bool exportXML(OUString& rStrExpValue, const css::uno::Any& rValue, + const SvXMLUnitConverter& rUnitConverter) const override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLScriptContextFactory.hxx b/xmloff/inc/XMLScriptContextFactory.hxx new file mode 100644 index 000000000..cde5bb916 --- /dev/null +++ b/xmloff/inc/XMLScriptContextFactory.hxx @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <com/sun/star/uno/Reference.hxx> +#include <xmloff/xmlevent.hxx> + + +namespace com::sun::star { + namespace xml::sax { class XAttributeList; } +} +class SvXMLImport; +class XMLEventsImportContext; + +class XMLScriptContextFactory final : public XMLEventContextFactory +{ +public: + XMLScriptContextFactory(); + virtual ~XMLScriptContextFactory() override; + + virtual SvXMLImportContext * + CreateContext(SvXMLImport & rImport, /// import context + /// attribute list + const css::uno::Reference< css::xml::sax::XFastAttributeList> & xAttrList, + /// the context for the enclosing <script:events> element + XMLEventsImportContext * rEvents, + /// the event name (as understood by the API) + const OUString & rApiEventName) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLScriptExportHandler.hxx b/xmloff/inc/XMLScriptExportHandler.hxx new file mode 100644 index 000000000..4197ba77e --- /dev/null +++ b/xmloff/inc/XMLScriptExportHandler.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 . + */ + +#pragma once + +#include <com/sun/star/uno/Sequence.hxx> +#include <rtl/ustring.hxx> +#include <xmloff/xmlevent.hxx> + +class SvXMLExport; +namespace com::sun::star { + namespace beans { struct PropertyValue; } +} + +class XMLScriptExportHandler final : public XMLEventExportHandler +{ +public: + XMLScriptExportHandler(); + virtual ~XMLScriptExportHandler() override; + + virtual void Export( + SvXMLExport& rExport, + const OUString& rEventName, + const css::uno::Sequence<css::beans::PropertyValue> & rValues, + bool bUseWhitespace) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLShapePropertySetContext.hxx b/xmloff/inc/XMLShapePropertySetContext.hxx new file mode 100644 index 000000000..a277c4aa2 --- /dev/null +++ b/xmloff/inc/XMLShapePropertySetContext.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 . + */ +#pragma once + + +#include <xmloff/xmlprcon.hxx> + +class XMLShapePropertySetContext : public SvXMLPropertySetContext +{ + SvXMLImportContextRef mxBulletStyle; + sal_Int32 mnBulletIndex; + +public: + + + XMLShapePropertySetContext( SvXMLImport& rImport, sal_Int32 nElement, + const css::uno::Reference<css::xml::sax::XFastAttributeList >& xAttrList, + sal_uInt32 nFam, + ::std::vector< XMLPropertyState > &rProps, + const rtl::Reference < SvXMLImportPropertyMapper > &rMap ); + + virtual ~XMLShapePropertySetContext() override; + + virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; + + using SvXMLPropertySetContext::createFastChildContext; + 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 ) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLStarBasicContextFactory.hxx b/xmloff/inc/XMLStarBasicContextFactory.hxx new file mode 100644 index 000000000..ad0ac8939 --- /dev/null +++ b/xmloff/inc/XMLStarBasicContextFactory.hxx @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <com/sun/star/uno/Reference.hxx> +#include <xmloff/xmlevent.hxx> + + +namespace com::sun::star { + namespace xml::sax { class XAttributeList; } +} +class SvXMLImport; +class XMLEventsImportContext; + + +class XMLStarBasicContextFactory final : public XMLEventContextFactory +{ +public: + XMLStarBasicContextFactory(); + virtual ~XMLStarBasicContextFactory() override; + + virtual SvXMLImportContext* CreateContext( + SvXMLImport& rImport, /// import context + const css::uno::Reference<css::xml::sax::XFastAttributeList> & xAttrList,/// attribute list + /// the context for the enclosing <script:events> element + XMLEventsImportContext* rEvents, + /// the event name (as understood by the API) + const OUString& rApiEventName) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLStarBasicExportHandler.hxx b/xmloff/inc/XMLStarBasicExportHandler.hxx new file mode 100644 index 000000000..c1eb9f76a --- /dev/null +++ b/xmloff/inc/XMLStarBasicExportHandler.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 . + */ + +#pragma once + +#include <com/sun/star/uno/Sequence.hxx> +#include <rtl/ustring.hxx> +#include <xmloff/xmlevent.hxx> + +class SvXMLExport; +namespace com::sun::star { + namespace beans { struct PropertyValue; } +} + +class XMLStarBasicExportHandler final : public XMLEventExportHandler +{ +public: + XMLStarBasicExportHandler(); + virtual ~XMLStarBasicExportHandler() override; + + virtual void Export( + SvXMLExport& rExport, + const OUString& rEventName, + const css::uno::Sequence<css::beans::PropertyValue> & rValues, + bool bUseWhitespace) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLStringBufferImportContext.hxx b/xmloff/inc/XMLStringBufferImportContext.hxx new file mode 100644 index 000000000..ea44eb1c6 --- /dev/null +++ b/xmloff/inc/XMLStringBufferImportContext.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 . + */ +#pragma once + + +#include <xmloff/xmlictxt.hxx> + +#include <xmloff/xmlimp.hxx> +#include <rtl/ustrbuf.hxx> + + +/** + * Import all text into a string buffer. Paragraph elements (<text:p>) + * are recognized and cause a return character (0x0a) to be added. + */ +class XMLStringBufferImportContext final : public SvXMLImportContext +{ + OUStringBuffer& rTextBuffer; + +public: + + XMLStringBufferImportContext( + SvXMLImport& rImport, + OUStringBuffer& rBuffer); + + virtual ~XMLStringBufferImportContext() 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; + virtual void SAL_CALL characters(const OUString& rChars) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLTextColumnsContext.hxx b/xmloff/inc/XMLTextColumnsContext.hxx new file mode 100644 index 000000000..9ce2715ba --- /dev/null +++ b/xmloff/inc/XMLTextColumnsContext.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <xmloff/xmltkmap.hxx> + +#include <memory> + +#include "XMLElementPropertyContext.hxx" + +class XMLTextColumnContext_Impl; +class XMLTextColumnSepContext_Impl; +class SvXMLTokenMap; + +typedef std::vector<rtl::Reference<XMLTextColumnContext_Impl>> XMLTextColumnsArray_Impl; + +class XMLTextColumnsContext final :public XMLElementPropertyContext +{ + std::unique_ptr<XMLTextColumnsArray_Impl> pColumns; + rtl::Reference<XMLTextColumnSepContext_Impl> mxColumnSep; + sal_Int16 nCount; + bool bAutomatic; + sal_Int32 nAutomaticDistance; + +public: + + XMLTextColumnsContext( + SvXMLImport& rImport, sal_Int32 nElement, + const css::uno::Reference<css::xml::sax::XFastAttributeList > & xAttrList, + const XMLPropertyState& rProp, + ::std::vector< XMLPropertyState > &rProps ); + + 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; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLTextColumnsExport.hxx b/xmloff/inc/XMLTextColumnsExport.hxx new file mode 100644 index 000000000..7aa2bc78d --- /dev/null +++ b/xmloff/inc/XMLTextColumnsExport.hxx @@ -0,0 +1,41 @@ +/* -*- 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 <sal/types.h> + +namespace com::sun::star::uno +{ +class Any; +} +class SvXMLExport; + +class XMLTextColumnsExport +{ + SvXMLExport& rExport; + + SvXMLExport& GetExport() { return rExport; } + +public: + XMLTextColumnsExport(SvXMLExport& rExport); + + void exportXML(const css::uno::Any& rAny); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLTextColumnsPropertyHandler.hxx b/xmloff/inc/XMLTextColumnsPropertyHandler.hxx new file mode 100644 index 000000000..4c06bc8ff --- /dev/null +++ b/xmloff/inc/XMLTextColumnsPropertyHandler.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 . + */ + +#pragma once + +#include <xmloff/xmlprhdl.hxx> + +/** + PropertyHandler for the XML-data-type: +*/ +class XMLTextColumnsPropertyHandler final : public XMLPropertyHandler +{ +public: + virtual ~XMLTextColumnsPropertyHandler () override; + + virtual bool equals( + const css::uno::Any& r1, + const css::uno::Any& r2 ) const override; + + /// TabStops will be imported/exported as XML-Elements. So the Import/Export-work must be done at another place. + 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; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/XMLTextHeaderFooterContext.hxx b/xmloff/inc/XMLTextHeaderFooterContext.hxx new file mode 100644 index 000000000..27b1b35c0 --- /dev/null +++ b/xmloff/inc/XMLTextHeaderFooterContext.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 . + */ +#pragma once + + +#include <xmloff/xmlictxt.hxx> + +namespace com::sun::star { + namespace text { class XTextCursor; } + namespace beans { class XPropertySet; } +} + +class XMLTextHeaderFooterContext final : public SvXMLImportContext +{ + css::uno::Reference< css::text::XTextCursor > xOldTextCursor; + css::uno::Reference< css::beans::XPropertySet > xPropSet; + + const OUString sOn; + const OUString sShareContent; + const OUString sText; + const OUString sTextFirst; + const OUString sTextLeft; + + bool bInsertContent : 1; + bool bLeft : 1; + bool bFirst : 1; + +public: + + XMLTextHeaderFooterContext( SvXMLImport& rImport, + const css::uno::Reference< css::beans::XPropertySet > & rPageStylePropSet, + bool bFooter, bool bLft, bool bFrst ); + + virtual ~XMLTextHeaderFooterContext() 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; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/anim.hxx b/xmloff/inc/anim.hxx new file mode 100644 index 000000000..b0a4e61d2 --- /dev/null +++ b/xmloff/inc/anim.hxx @@ -0,0 +1,95 @@ +/* -*- 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 <com/sun/star/presentation/AnimationEffect.hpp> +#include <com/sun/star/presentation/AnimationSpeed.hpp> +#include <xmloff/xmlement.hxx> + +enum XMLEffect +{ + EK_none, + EK_fade, + EK_move, + EK_stripes, + EK_open, + EK_close, + EK_dissolve, + EK_wavyline, + EK_random, + EK_lines, + EK_laser, + EK_appear, + EK_hide, + EK_move_short, + EK_checkerboard, + EK_rotate, + EK_stretch +}; + +extern const SvXMLEnumMapEntry<XMLEffect> aXML_AnimationEffect_EnumMap[]; + +enum XMLEffectDirection +{ + ED_none, + ED_from_left, + ED_from_top, + ED_from_right, + ED_from_bottom, + ED_from_center, + ED_from_upperleft, + ED_from_upperright, + ED_from_lowerleft, + ED_from_lowerright, + + ED_to_left, + ED_to_top, + ED_to_right, + ED_to_bottom, + ED_to_upperleft, + ED_to_upperright, + ED_to_lowerright, + ED_to_lowerleft, + + ED_path, + ED_spiral_inward_left, + ED_spiral_inward_right, + ED_spiral_outward_left, + ED_spiral_outward_right, + + ED_vertical, + ED_horizontal, + + ED_to_center, + + ED_clockwise, + ED_cclockwise +}; + +extern const SvXMLEnumMapEntry<XMLEffectDirection> aXML_AnimationDirection_EnumMap[]; + +extern const SvXMLEnumMapEntry<css::presentation::AnimationSpeed> aXML_AnimationSpeed_EnumMap[]; + +void SdXMLImplSetEffect(css::presentation::AnimationEffect eEffect, XMLEffect& eKind, + XMLEffectDirection& eDirection, sal_Int16& nStartScale, bool& bIn); +css::presentation::AnimationEffect +ImplSdXMLgetEffect(XMLEffect eKind, XMLEffectDirection eDirection, sal_Int16 nStartScale, bool bIn); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/animationimport.hxx b/xmloff/inc/animationimport.hxx new file mode 100644 index 000000000..b8f8c9068 --- /dev/null +++ b/xmloff/inc/animationimport.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 . + */ + +#pragma once + +#include <memory> + +#include <xmloff/xmlictxt.hxx> +#include <com/sun/star/animations/XAnimationNode.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> + +// presentations:animations + +namespace xmloff +{ +class AnimationsImportHelperImpl; + +class AnimationNodeContext final : public SvXMLImportContext +{ + std::shared_ptr<AnimationsImportHelperImpl> mpHelper; + css::uno::Reference< css::animations::XAnimationNode > mxNode; + + void init_node( const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ); + +public: + + AnimationNodeContext( + const css::uno::Reference< css::animations::XAnimationNode >& xParentNode, + SvXMLImport& rImport, + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList, + const std::shared_ptr<AnimationsImportHelperImpl>& pImpl = nullptr ); + + virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 Element, + const css::uno::Reference<css::xml::sax::XFastAttributeList>& Attribs) override; + + static void postProcessRootNode( const css::uno::Reference< css::animations::XAnimationNode >& xNode, css::uno::Reference< css::beans::XPropertySet > const & xPageProps ); +}; + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/animations.hxx b/xmloff/inc/animations.hxx new file mode 100644 index 000000000..935ebf039 --- /dev/null +++ b/xmloff/inc/animations.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 . + */ + +#pragma once + +#include <xmloff/xmltoken.hxx> + +template <typename EnumT> struct SvXMLEnumMapEntry; + +namespace xmloff +{ +extern const SvXMLEnumMapEntry<sal_Int16> aAnimations_EnumMap_Fill[]; +extern const SvXMLEnumMapEntry<sal_Int16> aAnimations_EnumMap_FillDefault[]; +extern const SvXMLEnumMapEntry<sal_Int16> aAnimations_EnumMap_Restart[]; +extern const SvXMLEnumMapEntry<sal_Int16> aAnimations_EnumMap_RestartDefault[]; +extern const SvXMLEnumMapEntry<sal_Int16> aAnimations_EnumMap_Endsync[]; +extern const SvXMLEnumMapEntry<sal_Int16> aAnimations_EnumMap_CalcMode[]; +extern const SvXMLEnumMapEntry<sal_Int16> aAnimations_EnumMap_AdditiveMode[]; +extern const SvXMLEnumMapEntry<sal_Int16> aAnimations_EnumMap_TransformType[]; +extern const SvXMLEnumMapEntry<sal_Int16> aAnimations_EnumMap_TransitionType[]; +extern const SvXMLEnumMapEntry<sal_Int16> aAnimations_EnumMap_TransitionSubType[]; +extern const SvXMLEnumMapEntry<sal_Int16> aAnimations_EnumMap_EventTrigger[]; +extern const SvXMLEnumMapEntry<sal_Int16> aAnimations_EnumMap_EffectPresetClass[]; +extern const SvXMLEnumMapEntry<sal_Int16> aAnimations_EnumMap_EffectNodeType[]; +extern const SvXMLEnumMapEntry<sal_Int16> aAnimations_EnumMap_SubItem[]; +extern const SvXMLEnumMapEntry<sal_Int16> aAnimations_EnumMap_IterateType[]; +extern const SvXMLEnumMapEntry<sal_Int16> aAnimations_EnumMap_Command[]; + +struct ImplAttributeNameConversion +{ + token::XMLTokenEnum meXMLToken; + const char* mpAPIName; +}; + +extern const struct ImplAttributeNameConversion* getAnimationAttributeNamesConversionList(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/animimp.hxx b/xmloff/inc/animimp.hxx new file mode 100644 index 000000000..b26c138ab --- /dev/null +++ b/xmloff/inc/animimp.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 <memory> + +#include <xmloff/xmlictxt.hxx> +#include <com/sun/star/beans/XPropertySet.hpp> + +// presentations:animations + +class XMLAnimationsContext final : public SvXMLImportContext +{ +public: + css::uno::Reference<css::beans::XPropertySet> mxLastShape; + OUString maLastShapeId; + + XMLAnimationsContext(SvXMLImport& rImport); + + virtual css::uno::Reference<css::xml::sax::XFastContextHandler> SAL_CALL createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference<css::xml::sax::XFastAttributeList>& AttrList) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/enummaps.hxx b/xmloff/inc/enummaps.hxx new file mode 100644 index 000000000..a170559af --- /dev/null +++ b/xmloff/inc/enummaps.hxx @@ -0,0 +1,24 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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/. + */ + +#pragma once + +#include <sal/config.h> +#include <com/sun/star/drawing/BitmapMode.hpp> +#include <com/sun/star/drawing/FillStyle.hpp> +#include <com/sun/star/drawing/RectanglePoint.hpp> + +template <typename EnumT> struct SvXMLEnumMapEntry; + +extern SvXMLEnumMapEntry<css::drawing::FillStyle> const aXML_FillStyle_EnumMap[]; +extern SvXMLEnumMapEntry<css::drawing::RectanglePoint> const aXML_RefPoint_EnumMap[]; +extern SvXMLEnumMapEntry<css::drawing::BitmapMode> const aXML_BitmapMode_EnumMap[]; +extern SvXMLEnumMapEntry<sal_uInt16> const pXML_ThemeColor_Enum[]; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/xmloff/inc/fasttokenhandler.hxx b/xmloff/inc/fasttokenhandler.hxx new file mode 100644 index 000000000..f0acd0337 --- /dev/null +++ b/xmloff/inc/fasttokenhandler.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/. + */ + +#ifndef XMLOFF_INC_FASTTOKENHANDLER_HXX +#define XMLOFF_INC_FASTTOKENHANDLER_HXX + +#include <com/sun/star/xml/sax/XFastTokenHandler.hpp> +#include <cppuhelper/implbase.hxx> +#include <sax/fastattribs.hxx> +#include <xmloff/token/tokens.hxx> +#include <sal/log.hxx> +#include <xmloff/dllapi.h> + +namespace xmloff::token { + +class TokenMap +{ +public: + explicit TokenMap(); + ~TokenMap(); + + /** Returns the UTF-8 name of the passed token identifier as byte sequence. */ + css::uno::Sequence< sal_Int8 > const & getUtf8TokenName( sal_Int32 nToken ) const + { + SAL_WARN_IF(nToken < 0 || nToken >= XML_TOKEN_COUNT, "xmloff", "Wrong nToken parameter"); + if( 0 <= nToken && nToken < XML_TOKEN_COUNT ) + return maTokenNamesUtf8[ nToken ]; + return EMPTY_BYTE_SEQ; + } + + const OUString& getTokenName( sal_Int32 nToken ) const + { + SAL_WARN_IF(nToken < 0 || nToken >= XML_TOKEN_COUNT, "xmloff", "Wrong nToken parameter"); + if( 0 <= nToken && nToken < XML_TOKEN_COUNT ) + return maTokenNames[ nToken ]; + return EMPTY_STRING; + } + + /** Returns the token identifier for the passed UTF-8 token name. */ + static sal_Int32 getTokenFromUtf8( const css::uno::Sequence< sal_Int8 >& rUtf8Name ) + { + return getTokenFromUTF8( reinterpret_cast< const char* >( + rUtf8Name.getConstArray() ), rUtf8Name.getLength() ); + } + + /** Returns the token identifier for a UTF-8 string */ + static sal_Int32 getTokenFromUTF8( const char *pToken, sal_Int32 nLength ) + { + return getTokenPerfectHash( pToken, nLength ); + } + +private: + static sal_Int32 getTokenPerfectHash( const char *pToken, sal_Int32 nLength ); + + std::vector< css::uno::Sequence< sal_Int8 > > maTokenNamesUtf8; + std::vector< OUString > maTokenNames; + + static const css::uno::Sequence< sal_Int8 > EMPTY_BYTE_SEQ; + static const OUString EMPTY_STRING; +}; + +TokenMap& StaticTokenMap(); + +class FastTokenHandler final : + public sax_fastparser::FastTokenHandlerBase +{ +public: + explicit FastTokenHandler(); + virtual ~FastTokenHandler() override; + + // XFastTokenHandler + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getUTF8Identifier( sal_Int32 nToken ) override; + virtual sal_Int32 SAL_CALL getTokenFromUTF8( const css::uno::Sequence< sal_Int8 >& Identifier ) override; + + const OUString & getIdentifier( sal_Int32 nToken ) const; + + // Much faster direct C++ shortcut to the method that matters + virtual sal_Int32 getTokenDirect( const char *pToken, sal_Int32 nLength ) const override; + +private: + TokenMap& mrTokenMap; +}; + +} // namespace xmloff::token + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/forms/form_handler_factory.hxx b/xmloff/inc/forms/form_handler_factory.hxx new file mode 100644 index 000000000..181c1bc14 --- /dev/null +++ b/xmloff/inc/forms/form_handler_factory.hxx @@ -0,0 +1,35 @@ +/* -*- 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 <forms/property_handler.hxx> + +namespace xmloff +{ +//= FormHandlerFactory +class FormHandlerFactory +{ +public: + static PPropertyHandler getFormPropertyHandler(const PropertyId i_propertyId); +}; + +} // namespace xmloff + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/forms/property_handler.hxx b/xmloff/inc/forms/property_handler.hxx new file mode 100644 index 000000000..822baaf3c --- /dev/null +++ b/xmloff/inc/forms/property_handler.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 . + */ + +#pragma once + +#include <forms/property_ids.hxx> + +#include <com/sun/star/uno/Any.hxx> + +#include <rtl/ref.hxx> +#include <salhelper/simplereferenceobject.hxx> + +#include <map> +#include <vector> + +namespace xmloff +{ + + typedef ::std::map< PropertyId, css::uno::Any > PropertyValues; + + class PropertyHandlerBase : public ::salhelper::SimpleReferenceObject + { + public: + /** is a convenience method for XML attributes whose value comprises of only one UNO API property + */ + virtual OUString + getAttributeValue( const css::uno::Any& i_propertyValue ) const = 0; + + /** retrieves the values of the properties controlled by an XML attributed, described by a given attribute value + */ + virtual bool + getPropertyValues( const OUString& i_attributeValue, PropertyValues& o_propertyValues ) const = 0; + }; + + //= PPropertyHandler + typedef rtl::Reference< PropertyHandlerBase > PPropertyHandler; + + //= PropertyHandlerFactory + typedef PPropertyHandler (*PropertyHandlerFactory)( const PropertyId i_propertyId ); + +} // namespace xmloff + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/forms/property_ids.hxx b/xmloff/inc/forms/property_ids.hxx new file mode 100644 index 000000000..49c896fc2 --- /dev/null +++ b/xmloff/inc/forms/property_ids.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 + +namespace xmloff +{ + + //= PropertyId + enum PropertyId + { + PID_DATE_MIN, + PID_DATE_MAX, + PID_DEFAULT_DATE, + PID_DATE, + PID_TIME_MIN, + PID_TIME_MAX, + PID_DEFAULT_TIME, + PID_TIME, + + PID_INVALID + }; + +} // namespace xmloff + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/pch/precompiled_xo.cxx b/xmloff/inc/pch/precompiled_xo.cxx new file mode 100644 index 000000000..64b16a2cb --- /dev/null +++ b/xmloff/inc/pch/precompiled_xo.cxx @@ -0,0 +1,12 @@ +/* -*- 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/. + */ + +#include "precompiled_xo.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/pch/precompiled_xo.hxx b/xmloff/inc/pch/precompiled_xo.hxx new file mode 100644 index 000000000..f79c367db --- /dev/null +++ b/xmloff/inc/pch/precompiled_xo.hxx @@ -0,0 +1,250 @@ +/* -*- 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 has been autogenerated by update_pch.sh. It is possible to edit it + manually (such as when an include file has been moved/renamed/removed). All such + manual changes will be rewritten by the next run of update_pch.sh (which presumably + also fixes all possible problems, so it's usually better to use it). + + Generated on 2021-08-22 14:50:18 using: + ./bin/update_pch xmloff xo --cutoff=7 --exclude:system --include:module --include:local + + If after updating build fails, use the following command to locate conflicting headers: + ./bin/update_pch_bisect ./xmloff/inc/pch/precompiled_xo.hxx "make xmloff.build" --find-conflicts +*/ + +#include <sal/config.h> +#if PCH_LEVEL >= 1 +#include <algorithm> +#include <array> +#include <cassert> +#include <cmath> +#include <cstddef> +#include <cstdlib> +#include <float.h> +#include <functional> +#include <initializer_list> +#include <iomanip> +#include <limits.h> +#include <limits> +#include <map> +#include <math.h> +#include <memory> +#include <new> +#include <numeric> +#include <optional> +#include <ostream> +#include <set> +#include <stddef.h> +#include <string.h> +#include <string> +#include <string_view> +#include <type_traits> +#include <unordered_map> +#include <utility> +#include <vector> +#include <boost/property_tree/ptree_fwd.hpp> +#endif // PCH_LEVEL >= 1 +#if PCH_LEVEL >= 2 +#include <osl/diagnose.h> +#include <osl/doublecheckedlocking.h> +#include <osl/endian.h> +#include <osl/file.hxx> +#include <osl/getglobalmutex.hxx> +#include <osl/interlck.h> +#include <osl/mutex.h> +#include <osl/mutex.hxx> +#include <osl/thread.h> +#include <rtl/alloc.h> +#include <rtl/character.hxx> +#include <rtl/digest.h> +#include <rtl/instance.hxx> +#include <rtl/locale.h> +#include <rtl/math.h> +#include <rtl/math.hxx> +#include <rtl/ref.hxx> +#include <rtl/strbuf.hxx> +#include <rtl/string.h> +#include <rtl/textcvt.h> +#include <rtl/textenc.h> +#include <rtl/ustrbuf.hxx> +#include <rtl/ustring.h> +#include <rtl/ustring.hxx> +#include <rtl/uuid.h> +#include <sal/backtrace.hxx> +#include <sal/log.hxx> +#include <sal/macros.h> +#include <sal/saldllapi.h> +#include <sal/types.h> +#include <sal/typesizes.h> +#include <vcl/Scanline.hxx> +#include <vcl/alpha.hxx> +#include <vcl/bitmap.hxx> +#include <vcl/bitmap/BitmapTypes.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/checksum.hxx> +#include <vcl/dllapi.h> +#include <vcl/mapmod.hxx> +#include <vcl/region.hxx> +#include <vcl/scopedbitmapaccess.hxx> +#endif // PCH_LEVEL >= 2 +#if PCH_LEVEL >= 3 +#include <basegfx/basegfxdllapi.h> +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/point/b2dpoint.hxx> +#include <basegfx/point/b2ipoint.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/range/b2drange.hxx> +#include <basegfx/range/basicrange.hxx> +#include <basegfx/tuple/Tuple2D.hxx> +#include <basegfx/tuple/Tuple3D.hxx> +#include <basegfx/tuple/b2dtuple.hxx> +#include <basegfx/tuple/b2ituple.hxx> +#include <basegfx/tuple/b3dtuple.hxx> +#include <basegfx/utils/common.hxx> +#include <basegfx/vector/b2dvector.hxx> +#include <basegfx/vector/b2enums.hxx> +#include <basegfx/vector/b2ivector.hxx> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/chart/XChartDocument.hpp> +#include <com/sun/star/chart2/XChartDocument.hpp> +#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp> +#include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XIndexReplace.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/container/XNameReplace.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/document/XDocumentProperties.hpp> +#include <com/sun/star/document/XEventsSupplier.hpp> +#include <com/sun/star/drawing/FillStyle.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/io/XOutputStream.hpp> +#include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/style/NumberingType.hpp> +#include <com/sun/star/style/XStyle.hpp> +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> +#include <com/sun/star/text/VertOrientation.hpp> +#include <com/sun/star/text/XText.hpp> +#include <com/sun/star/text/XTextContent.hpp> +#include <com/sun/star/uno/Any.h> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Type.h> +#include <com/sun/star/uno/TypeClass.hdl> +#include <com/sun/star/uno/XAggregation.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/uno/XWeak.hpp> +#include <com/sun/star/uno/genfunc.h> +#include <com/sun/star/uno/genfunc.hxx> +#include <com/sun/star/util/Date.hpp> +#include <com/sun/star/util/DateTime.hpp> +#include <com/sun/star/util/Duration.hpp> +#include <com/sun/star/util/MeasureUnit.hpp> +#include <com/sun/star/util/Time.hpp> +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <comphelper/base64.hxx> +#include <comphelper/comphelperdllapi.h> +#include <comphelper/extract.hxx> +#include <comphelper/processfactory.hxx> +#include <comphelper/sequence.hxx> +#include <cppu/cppudllapi.h> +#include <cppu/unotype.hxx> +#include <cppuhelper/cppuhelperdllapi.h> +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/implbase_ex.hxx> +#include <cppuhelper/implbase_ex_post.hxx> +#include <cppuhelper/implbase_ex_pre.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/weakref.hxx> +#include <i18nlangtag/i18nlangtagdllapi.h> +#include <i18nlangtag/lang.h> +#include <i18nlangtag/languagetag.hxx> +#include <o3tl/any.hxx> +#include <o3tl/cow_wrapper.hxx> +#include <o3tl/safeint.hxx> +#include <o3tl/strong_int.hxx> +#include <o3tl/typed_flags_set.hxx> +#include <o3tl/underlyingenumvalue.hxx> +#include <o3tl/unit_conversion.hxx> +#include <salhelper/salhelperdllapi.h> +#include <salhelper/simplereferenceobject.hxx> +#include <sax/tools/converter.hxx> +#include <svl/svldllapi.h> +#include <tools/color.hxx> +#include <tools/date.hxx> +#include <tools/debug.hxx> +#include <tools/degree.hxx> +#include <tools/diagnose_ex.h> +#include <tools/gen.hxx> +#include <tools/link.hxx> +#include <tools/long.hxx> +#include <tools/mapunit.hxx> +#include <tools/poly.hxx> +#include <tools/solar.h> +#include <tools/time.hxx> +#include <tools/toolsdllapi.h> +#include <typelib/typeclass.h> +#include <typelib/typedescription.h> +#include <typelib/uik.h> +#include <uno/any2.h> +#include <uno/data.h> +#include <uno/sequence2.h> +#include <unotools/unotoolsdllapi.h> +#endif // PCH_LEVEL >= 3 +#if PCH_LEVEL >= 4 +#include <PageMasterStyleMap.hxx> +#include <XMLStringBufferImportContext.hxx> +#include <xexptran.hxx> +#include <xmloff/ProgressBarHelper.hxx> +#include <xmloff/XMLBase64ImportContext.hxx> +#include <xmloff/XMLEventsImportContext.hxx> +#include <xmloff/attrlist.hxx> +#include <xmloff/dllapi.h> +#include <xmloff/families.hxx> +#include <xmloff/maptype.hxx> +#include <xmloff/namespacemap.hxx> +#include <xmloff/prstylei.hxx> +#include <xmloff/txtimp.hxx> +#include <xmloff/txtprmap.hxx> +#include <xmloff/unointerfacetouniqueidentifiermapper.hxx> +#include <xmloff/xmlement.hxx> +#include <xmloff/xmlerror.hxx> +#include <xmloff/xmlevent.hxx> +#include <xmloff/xmlexp.hxx> +#include <xmloff/xmlictxt.hxx> +#include <xmloff/xmlimp.hxx> +#include <xmloff/xmlimppr.hxx> +#include <xmloff/xmlnamespace.hxx> +#include <xmloff/xmlnumi.hxx> +#include <xmloff/xmlprhdl.hxx> +#include <xmloff/xmlprmap.hxx> +#include <xmloff/xmlstyle.hxx> +#include <xmloff/xmltkmap.hxx> +#include <xmloff/xmltoken.hxx> +#include <xmloff/xmltypes.hxx> +#include <xmloff/xmluconv.hxx> +#include <xmlsdtypes.hxx> +#endif // PCH_LEVEL >= 4 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/pch/precompiled_xof.cxx b/xmloff/inc/pch/precompiled_xof.cxx new file mode 100644 index 000000000..c1330d253 --- /dev/null +++ b/xmloff/inc/pch/precompiled_xof.cxx @@ -0,0 +1,12 @@ +/* -*- 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/. + */ + +#include "precompiled_xof.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/pch/precompiled_xof.hxx b/xmloff/inc/pch/precompiled_xof.hxx new file mode 100644 index 000000000..b25a8f3df --- /dev/null +++ b/xmloff/inc/pch/precompiled_xof.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 has been autogenerated by update_pch.sh. It is possible to edit it + manually (such as when an include file has been moved/renamed/removed). All such + manual changes will be rewritten by the next run of update_pch.sh (which presumably + also fixes all possible problems, so it's usually better to use it). + + Generated on 2021-03-08 13:22:55 using: + ./bin/update_pch xmloff xof --cutoff=1 --exclude:system --exclude:module --include:local + + If after updating build fails, use the following command to locate conflicting headers: + ./bin/update_pch_bisect ./xmloff/inc/pch/precompiled_xof.hxx "make xmloff.build" --find-conflicts +*/ + +#include <sal/config.h> +#if PCH_LEVEL >= 1 +#include <array> +#include <unordered_map> +#include <vector> +#endif // PCH_LEVEL >= 1 +#if PCH_LEVEL >= 2 +#include <osl/diagnose.h> +#include <rtl/math.hxx> +#include <rtl/ref.hxx> +#include <rtl/ustrbuf.hxx> +#include <sal/log.hxx> +#endif // PCH_LEVEL >= 2 +#if PCH_LEVEL >= 3 +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#include <com/sun/star/i18n/CharacterClassification.hpp> +#include <com/sun/star/i18n/UnicodeType.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/uri/UriReferenceFactory.hpp> +#include <com/sun/star/uri/XVndSunStarScriptUrl.hpp> +#include <com/sun/star/util/MeasureUnit.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/xml/sax/SAXException.hpp> +#include <com/sun/star/xml/sax/XAttributeList.hpp> +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <comphelper/base64.hxx> +#include <comphelper/processfactory.hxx> +#include <comphelper/servicehelper.hxx> +#include <cppuhelper/supportsservice.hxx> +#include <cppuhelper/typeprovider.hxx> +#include <sax/tools/converter.hxx> +#include <tools/UnitConversion.hxx> +#include <tools/diagnose_ex.h> +#endif // PCH_LEVEL >= 3 +#if PCH_LEVEL >= 4 +#include <xmloff/attrlist.hxx> +#include <xmloff/namespacemap.hxx> +#include <xmloff/xmlimp.hxx> +#include <xmloff/xmlnamespace.hxx> +#include <xmloff/xmltoken.hxx> +#include <xmloff/xmluconv.hxx> +#endif // PCH_LEVEL >= 4 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/propimp0.hxx b/xmloff/inc/propimp0.hxx new file mode 100644 index 000000000..341cdc73e --- /dev/null +++ b/xmloff/inc/propimp0.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 . + */ + +#pragma once + +#include <xmloff/xmlprhdl.hxx> + +// graphic property Stroke + +class XMLDurationPropertyHdl final : public XMLPropertyHandler +{ +public: + virtual ~XMLDurationPropertyHdl() 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; +}; + +class SvXMLImport; +class XMLOpacityPropertyHdl final : public XMLPropertyHandler +{ +private: + SvXMLImport* mpImport; +public: + explicit XMLOpacityPropertyHdl( SvXMLImport* pImport ); + virtual ~XMLOpacityPropertyHdl() 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; +}; + +class XMLTextAnimationStepPropertyHdl final : public XMLPropertyHandler +{ +public: + virtual ~XMLTextAnimationStepPropertyHdl() 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; +}; + +class SvXMLExport; +class XMLDateTimeFormatHdl final : public XMLPropertyHandler +{ +private: + SvXMLExport* mpExport; + +public: + explicit XMLDateTimeFormatHdl( SvXMLExport* pExport ); + virtual ~XMLDateTimeFormatHdl() 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; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/prstylecond.hxx b/xmloff/inc/prstylecond.hxx new file mode 100644 index 000000000..e658a83b9 --- /dev/null +++ b/xmloff/inc/prstylecond.hxx @@ -0,0 +1,24 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <rtl/ustring.hxx> + +OUString GetParaStyleCondExternal(OUString const&); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/txtflde.hxx b/xmloff/inc/txtflde.hxx new file mode 100644 index 000000000..8670cac40 --- /dev/null +++ b/xmloff/inc/txtflde.hxx @@ -0,0 +1,414 @@ +/* -*- 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 . + */ + +/** @#file + * XML export of all text fields + */ + +#pragma once + +#include <com/sun/star/uno/Reference.h> +#include <xmloff/xmlnamespace.hxx> + +#include <rtl/ustring.hxx> +#include <xmloff/xmltoken.hxx> + +#include <map> +#include <set> +#include <memory> +#include <string_view> + +class SvXMLExport; +struct XMLPropertyState; + +namespace com::sun::star { + namespace util { struct DateTime; } + namespace util { struct Date; } + namespace text { class XTextField; } + namespace text { class XText; } + namespace beans { class XPropertySet; } + namespace beans { class XPropertySetInfo; } + namespace frame { class XModel; } + namespace uno { template<typename A> class Sequence; } +} + + +/// field IDs, +// including translation between UNO speak and XML speak if appropriate + +enum FieldIdEnum { + FIELD_ID_SENDER, // sender == extended user + FIELD_ID_AUTHOR, + FIELD_ID_DATE, // current date + FIELD_ID_TIME, // current time (+date) + FIELD_ID_PAGENAME, // page/slide name + FIELD_ID_PAGENUMBER, // page number + FIELD_ID_PAGESTRING, // page continuation string (page number string) + FIELD_ID_REFPAGE_SET, // set reference page + FIELD_ID_REFPAGE_GET, // get reference page number + + FIELD_ID_PLACEHOLDER, // placeholder field == jump edit field + + FIELD_ID_VARIABLE_GET, // get variable == get expression + FIELD_ID_VARIABLE_SET, // set variable == set expression + FIELD_ID_VARIABLE_INPUT, // input field (variable) + FIELD_ID_USER_GET, // user field + FIELD_ID_USER_INPUT, // input field (user field) + FIELD_ID_TEXT_INPUT, // input field (text) + FIELD_ID_EXPRESSION, // expression field = formula field + FIELD_ID_SEQUENCE, // sequence field + + FIELD_ID_DATABASE_NEXT, // select next row + FIELD_ID_DATABASE_SELECT, // select row # (NumSet) + FIELD_ID_DATABASE_DISPLAY, // display data (form letter field) + FIELD_ID_DATABASE_NAME, // display current db name (database name) + FIELD_ID_DATABASE_NUMBER, // display row # (SetNumber) + + FIELD_ID_DOCINFO_CREATION_AUTHOR, // docinfo fields + FIELD_ID_DOCINFO_CREATION_TIME, + FIELD_ID_DOCINFO_CREATION_DATE, + FIELD_ID_DOCINFO_DESCRIPTION, + FIELD_ID_DOCINFO_CUSTOM, + FIELD_ID_DOCINFO_PRINT_TIME, + FIELD_ID_DOCINFO_PRINT_DATE, + FIELD_ID_DOCINFO_PRINT_AUTHOR, + FIELD_ID_DOCINFO_TITLE, + FIELD_ID_DOCINFO_SUBJECT, + FIELD_ID_DOCINFO_KEYWORDS, + FIELD_ID_DOCINFO_REVISION, + FIELD_ID_DOCINFO_EDIT_DURATION, + FIELD_ID_DOCINFO_SAVE_TIME, + FIELD_ID_DOCINFO_SAVE_DATE, + FIELD_ID_DOCINFO_SAVE_AUTHOR, + + FIELD_ID_CONDITIONAL_TEXT, // conditionally choose between 2 texts + FIELD_ID_HIDDEN_TEXT, // conditionally hide a text + FIELD_ID_HIDDEN_PARAGRAPH, // conditionally hide a paragraph + + FIELD_ID_TEMPLATE_NAME, // display name of template + FIELD_ID_CHAPTER, // display name/number of current chapter + FIELD_ID_FILE_NAME, // display name of current file + + FIELD_ID_COUNT_PARAGRAPHS, // statistics fields: - paragraphs + FIELD_ID_COUNT_WORDS, // - words + FIELD_ID_COUNT_CHARACTERS, // - chars + FIELD_ID_COUNT_PAGES, // - pages + FIELD_ID_COUNT_TABLES, // - tables + FIELD_ID_COUNT_GRAPHICS, // - graphics + FIELD_ID_COUNT_OBJECTS, // - objects + + FIELD_ID_MACRO, // macro fields + FIELD_ID_REF_REFERENCE, // get reference field (reference) + FIELD_ID_REF_SEQUENCE, // get reference field (sequence) + FIELD_ID_REF_BOOKMARK, // get reference field (bookmark) + FIELD_ID_REF_FOOTNOTE, // get reference field (footnote) + FIELD_ID_REF_ENDNOTE, // get reference field (endnote) + FIELD_ID_DDE, // DDE field + + FIELD_ID_BIBLIOGRAPHY, // bibliography index entry + + FIELD_ID_SHEET_NAME, // name of current (spread-)sheet + FIELD_ID_URL, // URL field (only Calc, Draw, Impress) + + FIELD_ID_SCRIPT, // script fields (for HTML pages, mostly) + FIELD_ID_ANNOTATION, // annotation (notice) field + + FIELD_ID_COMBINED_CHARACTERS, // combined characters (asian typography) + + FIELD_ID_META, // text:meta-field (RDF metadata) + + FIELD_ID_MEASURE, // for measure shapes + + FIELD_ID_TABLE_FORMULA, // DEPRECATED: table formulas (Writer 2.0) + FIELD_ID_DROP_DOWN, // DEPRECATED: dropdown fields (WW8) + + FIELD_ID_DRAW_HEADER, + FIELD_ID_DRAW_FOOTER, + FIELD_ID_DRAW_DATE_TIME, + + FIELD_ID_UNKNOWN // invalid or unknown field type! +}; + + +class XMLTextFieldExport final +{ + SvXMLExport& rExport; + + /// store used text field master names (NULL means: don't collect) + std::unique_ptr< ::std::map< + css::uno::Reference< css::text::XText >, + ::std::set< OUString > > > + pUsedMasters; + +public: + + XMLTextFieldExport( SvXMLExport& rExp, + /// XMLPropertyState for the combined characters field + std::unique_ptr<XMLPropertyState> pCombinedCharState ); + ~XMLTextFieldExport(); + + /// Export this field and the surrounding span element with the formatting. + /// To be called for every field in the document body. + void ExportField(const css::uno::Reference < css::text::XTextField > & rTextField, + bool bProgress, bool & rPrevCharIsSpace); + + /// collect styles (character styles, data styles, ...) for this field + /// (if appropriate). + /// Also collect used field masters (if pUsedMasters is set) + /// to be called for every field during style export. + void ExportFieldAutoStyle(const css::uno::Reference < css::text::XTextField > & rTextField, + const bool bProgress, const bool bRecursive ); + + /// export field declarations. + /// to be called once at beginning of document body. + void ExportFieldDeclarations(); + + /// export field declarations for fields used in the particular XText. + /// (Requires that a list of used field declarations has previously been + /// built-up in ExportFieldAutoStyle() ) + void ExportFieldDeclarations( + const css::uno::Reference < css::text::XText > & rText); + + /// export all field declarations, or only those that have been used? + /// Calling this method will reset the list of used field declarations. + void SetExportOnlyUsedFieldDeclarations( + bool bExportOnlyUsed = true); + + // determine element or attribute names + // (public, because they may be useful in related XML export classes) + static enum ::xmloff::token::XMLTokenEnum MapPlaceholderType(sal_uInt16 nType); + static enum ::xmloff::token::XMLTokenEnum MapTemplateDisplayFormat(sal_Int16 nType); + static enum ::xmloff::token::XMLTokenEnum MapChapterDisplayFormat(sal_Int16 nType); + static enum ::xmloff::token::XMLTokenEnum MapFilenameDisplayFormat(sal_Int16 nType); + static enum ::xmloff::token::XMLTokenEnum MapDocInfoFieldName(enum FieldIdEnum nToken); + static enum ::xmloff::token::XMLTokenEnum MapReferenceSource(sal_Int16 nType); + static enum ::xmloff::token::XMLTokenEnum MapReferenceType(sal_Int16 nType); + static enum ::xmloff::token::XMLTokenEnum MapCountFieldName(FieldIdEnum nToken); + static enum ::xmloff::token::XMLTokenEnum MapBibliographyFieldName(std::u16string_view sName); + static enum ::xmloff::token::XMLTokenEnum MapMeasureKind(sal_Int16 nKind); + static enum ::xmloff::token::XMLTokenEnum MapPageNumberName(const css::uno::Reference< css::beans::XPropertySet> & xPropSet, + sal_Int32& nOffset); /// also adjust page offset + static enum ::xmloff::token::XMLTokenEnum MapAuthorFieldName(const css::uno::Reference< css::beans::XPropertySet > & xPropSet); + static enum ::xmloff::token::XMLTokenEnum MapSenderFieldName(const css::uno::Reference< css::beans::XPropertySet > & xPropSet); + +private: + + SvXMLExport& GetExport() { return rExport; } + + /// export a field after <text:span> is already written + void ExportFieldHelper( + const css::uno::Reference< css::text::XTextField> & rTextField, + const css::uno::Reference< css::beans::XPropertySet> & rPropSet, + const css::uno::Reference< css::beans::XPropertySet> & rRangePropSet, + enum FieldIdEnum nToken, + bool bProgress, + bool & rPrevCharIsSpace); + + /// export an empty element + void ExportElement(enum ::xmloff::token::XMLTokenEnum eElement, /// element token + bool bAddSpace = false); /// add blanks around + /// element? + + /// export an element with string content + void ExportElement(enum ::xmloff::token::XMLTokenEnum eElement, /// element token + const OUString& sContent); /// element content + + /// export a macro (as used in the macro field) + void ExportMacro( const css::uno::Reference< css::beans::XPropertySet> & rPropSet, + const OUString& rContent); + + /// export text:meta-field (RDF metadata) + void ExportMetaField( const css::uno::Reference< css::beans::XPropertySet> & i_xMeta, + bool i_bAutoStyles, bool i_bProgress, + bool & rPrevCharIsSpace); + + /// export a boolean attribute + void ProcessBoolean( + enum ::xmloff::token::XMLTokenEnum eXmlName, /// attribute token (namespace text) + bool bBool, /// attribute value + bool bDefault); /// attribute default; omit, if attribute differs + + /// export an integer attribute + void ProcessInteger( + enum ::xmloff::token::XMLTokenEnum eXmlName, /// attribute token (namespace text) + sal_Int32 nNum); /// attribute value + + /// export an integer attribute, omit if default + void ProcessIntegerDef( + enum ::xmloff::token::XMLTokenEnum eXmlName, /// attribute token (namespace text) + sal_Int32 nNum, /// attribute value + sal_Int32 nDefault); /// default value + + /// export a string attribute + void ProcessString( + enum ::xmloff::token::XMLTokenEnum eXmlName, /// attribute token (namespace text) + const OUString& sValue, /// attribute value + bool bOmitEmpty = false, /// omit attribute, if value is empty + sal_uInt16 nPrefix = XML_NAMESPACE_TEXT); /// attribute name prefix + + /// export a string attribute that gets a QName value + void ProcessString( + enum ::xmloff::token::XMLTokenEnum eXmlName, /// attribute token (namespace text) + sal_uInt16 nValuePrefix, + const OUString& sValue); /// attribute value + + + /// export a string attribute, omit if default + void ProcessString( + enum ::xmloff::token::XMLTokenEnum eXmlName, /// attribute token (namespace text) + const OUString& sValue, /// attribute value + std::u16string_view sDefault); /// default value; omit if equal + + /// export a string attribute, omit if default + void ProcessString( + enum ::xmloff::token::XMLTokenEnum eXmlName, /// attribute token (namespace text) + sal_uInt16 nValuePrefix, + const OUString& sValue, /// attribute value + std::u16string_view sDefault); /// default value; omit if equal + + /// export a string attribute + void ProcessString( + enum ::xmloff::token::XMLTokenEnum eXmlName, /// attribute token (namespace text) + enum ::xmloff::token::XMLTokenEnum eValue, /// attribute token + sal_uInt16 nPrefix = XML_NAMESPACE_TEXT); /// attribute name prefix + + /// export a string attribute, omit if default + void ProcessString( + enum ::xmloff::token::XMLTokenEnum eXmlName, /// attribute token (namespace text) + enum ::xmloff::token::XMLTokenEnum eValue, /// attribute value token + enum ::xmloff::token::XMLTokenEnum eDefault); /// default value token + + /// export a string as a sequence of paragraphs + void ProcessParagraphSequence( + /// string containing the paragraphs + std::u16string_view sParagraphSequence); + + /// export a numbering format (numeric, roman, alphabetic, etc.) + void ProcessNumberingType( + sal_Int16 nNumberingType); /// numbering type key + + /// export display attribute (value, formula, none) + void ProcessDisplay(bool bIsVisible, /// is visible? + bool bIsCommand); /// is show command/show name? + + /// export all data-style related attributes + void ProcessValueAndType( + bool bIsString, /// do we process a string or a number? + sal_Int32 nFormatKey, /// format key for NumberFormatter; possibly -1 + const OUString& sContent, /// string content; possibly invalid + std::u16string_view sDefault, /// default string + double fValue, /// float content; possibly invalid + bool bExportValue, /// export value attribute? + bool bExportValueType, /// export value-type attribute? + bool bExportStyle, /// export style-attribute? + bool bForceSystemLanguage, /// no style language export + bool bTimeStyle = false); /// exporting a time style? + + /// export times, dates and durations according to ISO 8601 + void ProcessDateTime( + enum ::xmloff::token::XMLTokenEnum eXMLName, /// attribute token + double dValue, /// date/time value + bool bIsDate, /// export as date (rather than date/time)? + bool bIsDuration, /// export as duration + bool bOmitDurationIfZero = true, /// omit zero-length durat. + sal_uInt16 nPrefix = XML_NAMESPACE_TEXT); /// attribute name prefix + + /// export a date, time, or duration + void ProcessDateTime( + enum ::xmloff::token::XMLTokenEnum eXMLName, /// attribute token + sal_Int32 nMinutes, /// date/time value in minutes + bool bIsDate, /// export as date? + bool bIsDuration); /// export as duration? + + /// export times, dates and durations according to ISO 8601 + void ProcessDateTime( + enum ::xmloff::token::XMLTokenEnum eXMLName, /// attribute token + const css::util::DateTime& rTime); /// date/time value + + /// export time or dateTime + void ProcessTimeOrDateTime( + enum ::xmloff::token::XMLTokenEnum eXMLName, /// attribute token + const css::util::DateTime& rTime); /// date/time value + + /// export all attributes for bibliography data fields + void ProcessBibliographyData( + const css::uno::Reference < + css::beans::XPropertySet > & rPropertySet); + + /// export CommandTypeAttribute + void ProcessCommandType( + sal_Int32 nCommandType); /// css::sdb::CommandType + + void ProcessStringSequence( + const css::uno::Sequence<OUString>& rSequence, + const OUString& sSelected ); + + void ProcessStringSequence( + const css::uno::Sequence<OUString>& rSequence, + sal_Int32 nSelected ); + + /// export attributes that describe a data source + void ExportDataBaseElement( + enum ::xmloff::token::XMLTokenEnum eElement, + const OUString& sContent, + const css::uno::Reference < css::beans::XPropertySet > & rPropertySet, + const css::uno::Reference < css::beans::XPropertySetInfo > & rPropertySetInfo ); + + /// for XDependentTextFields, get PropertySet of FieldMaster + static css::uno::Reference < css::beans::XPropertySet > + GetMasterPropertySet(const css::uno::Reference < css::text::XTextField > & rTextField); + + /// get PropertySet of (any) DependentTextField for this FieldMaster + static bool GetDependentFieldPropertySet( + const css::uno::Reference< css::beans::XPropertySet> & xmaster, + css::uno::Reference< css::beans::XPropertySet> & xField); + + + /// get field ID from XTextField (and it's Property-Set) + static enum FieldIdEnum GetFieldID(const css::uno::Reference < css::text::XTextField > & rTextField, + const css::uno::Reference < css::beans::XPropertySet > & xPropSet); + + /// get field ID from XTextField service name (and it's PropertySet) + static enum FieldIdEnum MapFieldName(std::u16string_view sFieldName, + const css::uno::Reference < css::beans::XPropertySet> & xPropSet); + + /// determine, whether field has string or numeric content + static bool IsStringField(FieldIdEnum nFieldType, /// field ID + const css::uno::Reference < css::beans::XPropertySet > & xPropSet); + + + /// explode a field master name into field type and field name + static void ExplodeFieldMasterName( + std::u16string_view sMasterName, /// name as returned by SO API + OUString& sFieldType, /// out: field type + OUString& sVarName); /// out: variable name + + /// make reference name for a foot- or endnote + static OUString MakeFootnoteRefName(sal_Int16 nSeqNo); + + /// make reference name for a sequence field + static OUString MakeSequenceRefName(sal_Int16 nSeqNo, + std::u16string_view rSeqName); + + std::unique_ptr<XMLPropertyState> pCombinedCharactersPropertyState; + +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx new file mode 100644 index 000000000..f6f27d633 --- /dev/null +++ b/xmloff/inc/txtfldi.hxx @@ -0,0 +1,1122 @@ +/* -*- 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 . + */ + +/** @#file + * + * import of all text fields + * (except variable related + database display field: see txtvfldi.hxx) + */ + +#pragma once + +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/text/PageNumberType.hpp> +#include <com/sun/star/util/DateTime.hpp> +#include <xmloff/xmlictxt.hxx> +#include <xmloff/txtimp.hxx> +#include <xmloff/xmltkmap.hxx> +#include <rtl/ustrbuf.hxx> +#include <vector> + +namespace com::sun::star { + namespace xml::sax { class XAttributeList; } + namespace text { class XTextField; } + namespace beans { class XPropertySet; struct PropertyValue; } +} + +class SvXMLImport; +class XMLTextImportHelper; +class SvXMLTokenMap; + +/// abstract class for text field import +class XMLTextFieldImportContext : public SvXMLImportContext +{ + // data members + OUStringBuffer sContentBuffer; /// collect character data + OUString sContent; /// character data after collection + OUString sServiceName; /// service name for text field + XMLTextImportHelper& rTextImportHelper; /// the import helper + +protected: + OUString sServicePrefix; + + // data members for use in subclasses + bool bValid; /// whether this field is valid ? + +public: + + XMLTextFieldImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp, /// Text import helper + const OUString& pService); /// name of SO API service + + /// process character data: will be collected in member sContentBuffer + virtual void SAL_CALL characters( const OUString& sContent ) override; + + /// parses attributes and calls ProcessAttribute + virtual void SAL_CALL startFastElement( + sal_Int32 nElement, + const css::uno::Reference<css::xml::sax::XFastAttributeList> & xAttrList) override; + + /// create XTextField and insert into document; calls PrepareTextField + virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; + + /// create the appropriate field context from + /// (for use in paragraph import) + static XMLTextFieldImportContext* CreateTextFieldImportContext( + SvXMLImport& rImport, + XMLTextImportHelper& rHlp, + sal_Int32 nElement); + +protected: + /// get helper + XMLTextImportHelper& GetImportHelper() { return rTextImportHelper; } + + const OUString& GetServiceName() const { return sServiceName; } + void SetServiceName(const OUString& sStr) { sServiceName = sStr; } + + OUString const & GetContent(); + + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) = 0; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference< css::beans::XPropertySet> & xPropertySet) = 0; + + /// create field from ServiceName + bool CreateField(css::uno::Reference< css::beans::XPropertySet> & xField, + const OUString& sServiceName); + + /// force an update of the field's value + /// call update on optional XUpdatable interface; (disable Fixed property) + static void ForceUpdate( + const css::uno::Reference< css::beans::XPropertySet> & rPropertySet); +}; + +class XMLSenderFieldImportContext : public XMLTextFieldImportContext +{ + + sal_Int16 nSubType; /// API subtype for ExtUser field + + const OUString sPropertyFixed; + const OUString sPropertyContent; + +protected: + // variables for access in subclass + bool bFixed; + +public: + + XMLSenderFieldImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp); /// Text import helper + +protected: + /// start element + virtual void SAL_CALL startFastElement( + sal_Int32 nElement, + const css::uno::Reference<css::xml::sax::XFastAttributeList> & xAttrList) override; + + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference< css::beans::XPropertySet> & xPropertySet) override; +}; + +/** inherit sender field because of fixed attribute in ProcessAttributes */ +class XMLAuthorFieldImportContext final : public XMLSenderFieldImportContext +{ + bool bAuthorFullName; + const OUString sPropertyFixed; + const OUString sPropertyContent; + +public: + + XMLAuthorFieldImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp); /// Text import helper + +private: + /// start element + virtual void SAL_CALL startFastElement( + sal_Int32 nElement, + const css::uno::Reference<css::xml::sax::XFastAttributeList> & xAttrList) override; + + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference< css::beans::XPropertySet> & xPropertySet) override; +}; + +class XMLPlaceholderFieldImportContext final : public XMLTextFieldImportContext +{ + const OUString sPropertyHint; + + OUString sDescription; + + sal_Int16 nPlaceholderType; + +public: + + XMLPlaceholderFieldImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp); /// Text import helper + +private: + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference< css::beans::XPropertySet> & xPropertySet) override; +}; + +class XMLTimeFieldImportContext : public XMLTextFieldImportContext +{ +protected: + const OUString sPropertyNumberFormat; + const OUString sPropertyFixed; + const OUString sPropertyDateTimeValue; + const OUString sPropertyDateTime; + const OUString sPropertyIsDate; + const OUString sPropertyIsFixedLanguage; + + css::util::DateTime aDateTimeValue; + sal_Int32 nAdjust; + sal_Int32 nFormatKey; + bool bTimeOK; + bool bFormatOK; + bool bFixed; + bool bIsDate; // is this a date? + // (for XMLDateFieldImportContext, really) + bool bIsDefaultLanguage; + +public: + + XMLTimeFieldImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp); /// Text import helper + + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference< css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import date fields (<text:date>); + inherit from TimeField to reuse implementation */ +class XMLDateFieldImportContext final : public XMLTimeFieldImportContext +{ +public: + + XMLDateFieldImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp); /// Text import helper + + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; +}; + +/** import page continuation fields (<text:page-continuation-string>) */ +class XMLPageContinuationImportContext final : public XMLTextFieldImportContext +{ + const OUString sPropertySubType; + const OUString sPropertyNumberingType; + + OUString sString; /// continuation string + css::text::PageNumberType eSelectPage; /// previous, current + /// or next page + bool sStringOK; /// continuation string encountered? + +public: + + XMLPageContinuationImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp); /// Text import helper + + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference< css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import page number fields (<text:page-number>) */ +class XMLPageNumberImportContext final : public XMLTextFieldImportContext +{ + const OUString sPropertySubType; + const OUString sPropertyNumberingType; + const OUString sPropertyOffset; + + OUString sNumberFormat; + OUString sNumberSync; + sal_Int16 nPageAdjust; + css::text::PageNumberType eSelectPage; /// previous, current + /// or next page + bool sNumberFormatOK; + +public: + + XMLPageNumberImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp); /// Text import helper + + + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference< css::beans::XPropertySet> & xPropertySet) override; +}; + +/** superclass for database fields: handle database and table names */ +class XMLDatabaseFieldImportContext : public XMLTextFieldImportContext +{ + OUString m_sDatabaseName; + OUString m_sDatabaseURL; + OUString m_sTableName; + + sal_Int32 m_nCommandType; + bool m_bCommandTypeOK; + + bool m_bDisplay; + bool m_bDisplayOK; + bool m_bUseDisplay; + +protected: + bool m_bDatabaseOK; + bool m_bDatabaseNameOK; + bool m_bDatabaseURLOK; + bool m_bTableOK; + + /// protected constructor: only for subclasses + XMLDatabaseFieldImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp, + const OUString& pServiceName, + bool bUseDisplay ); + +public: + + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference< css::beans::XPropertySet> & xPropertySet) override; + + /// handle database-location children + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; +}; + +/** import database name fields (<text:database-name>) */ +class XMLDatabaseNameImportContext final : public XMLDatabaseFieldImportContext +{ +public: + + XMLDatabaseNameImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp); + + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; +}; + +/** import database next fields (<text:database-next>) */ +class XMLDatabaseNextImportContext : public XMLDatabaseFieldImportContext +{ + const OUString sPropertyCondition; + const OUString sTrue; + OUString sCondition; + bool bConditionOK; + +protected: + // for use in child classes + XMLDatabaseNextImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp, + const OUString& pServiceName); + +public: + + XMLDatabaseNextImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp); + + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference< css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import database select fields (<text:database-select>) */ +class XMLDatabaseSelectImportContext final : public XMLDatabaseNextImportContext +{ + const OUString sPropertySetNumber; + sal_Int32 nNumber; + bool bNumberOK; + +public: + + XMLDatabaseSelectImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp); + + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference< + css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import database display number fields (<text:database-row-number>) */ +class XMLDatabaseNumberImportContext final : public XMLDatabaseFieldImportContext +{ + const OUString sPropertyNumberingType; + const OUString sPropertySetNumber; + OUString sNumberFormat; + OUString sNumberSync; + sal_Int32 nValue; + bool bValueOK; + +public: + + XMLDatabaseNumberImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp); + + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference< css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import docinfo fields with only fixed attribute */ +class XMLSimpleDocInfoImportContext : public XMLTextFieldImportContext +{ + const OUString sPropertyFixed; + const OUString sPropertyContent; + const OUString sPropertyAuthor; + const OUString sPropertyCurrentPresentation; + +protected: + bool bFixed; + bool bHasAuthor; + bool bHasContent; + +public: + + XMLSimpleDocInfoImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp, + sal_Int32 nElementToken, + bool bContent, + bool bAuthor); + +protected: + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference< css::beans::XPropertySet> & xPropertySet) override; + + static OUString MapTokenToServiceName(sal_Int32 nElementToken); +}; + +/** import docinfo fields with date or time attributes and numberformats */ +class XMLDateTimeDocInfoImportContext final : public XMLSimpleDocInfoImportContext +{ + const OUString sPropertyNumberFormat; + const OUString sPropertyIsDate; + const OUString sPropertyIsFixedLanguage; + + sal_Int32 nFormat; + bool bFormatOK; + bool bIsDate; + bool bHasDateTime; + bool bIsDefaultLanguage; + +public: + + XMLDateTimeDocInfoImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp, + sal_Int32 nElement); + +private: + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference< css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import revision field (<text:editing-cycles>) */ +class XMLRevisionDocInfoImportContext final : public XMLSimpleDocInfoImportContext +{ +public: + + XMLRevisionDocInfoImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp, + sal_Int32 nElement); + +private: + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import user docinfo field (<text:user-defined>) */ +class XMLUserDocInfoImportContext final : public XMLSimpleDocInfoImportContext +{ + OUString aName; + const OUString sPropertyName; + const OUString sPropertyNumberFormat; + const OUString sPropertyIsFixedLanguage; + sal_Int32 nFormat; + bool bFormatOK; + bool bIsDefaultLanguage; + +public: + + XMLUserDocInfoImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp, + sal_Int32 nElement); + +private: + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import hidden paragraph fields (<text:hidden-paragraph>) */ +class XMLHiddenParagraphImportContext final : public XMLTextFieldImportContext +{ + const OUString sPropertyCondition; + const OUString sPropertyIsHidden; + + OUString sCondition; + bool bIsHidden; + +public: + + XMLHiddenParagraphImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp); + +private: + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import conditional text fields (<text:conditional-text>) */ +class XMLConditionalTextImportContext final : public XMLTextFieldImportContext +{ + const OUString sPropertyCondition; + const OUString sPropertyCurrentPresentation; + + OUString sCondition; + OUString sTrueContent; + OUString sFalseContent; + + bool bConditionOK; + bool bTrueOK; + bool bFalseOK; + bool bCurrentValue; + +public: + + XMLConditionalTextImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp); + +private: + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import conditional text fields (<text:hidden-text>) */ +class XMLHiddenTextImportContext final : public XMLTextFieldImportContext +{ + const OUString sPropertyCondition; + const OUString sPropertyContent; + const OUString sPropertyIsHidden; + + OUString sCondition; + OUString sString; + + bool bConditionOK; + bool bStringOK; + bool bIsHidden; + +public: + + XMLHiddenTextImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp); + +private: + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import file name fields (<text:file-name>) */ +class XMLFileNameImportContext final : public XMLTextFieldImportContext +{ + const OUString sPropertyFixed; + const OUString sPropertyFileFormat; + const OUString sPropertyCurrentPresentation; + + sal_Int16 nFormat; + bool bFixed; + +public: + + XMLFileNameImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp); + +private: + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import document template name fields (<text:template-name>) */ +class XMLTemplateNameImportContext final : public XMLTextFieldImportContext +{ + const OUString sPropertyFileFormat; + + sal_Int16 nFormat; + +public: + + XMLTemplateNameImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp); + +private: + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import chapter fields (<text:chapter>) */ +class XMLChapterImportContext final : public XMLTextFieldImportContext +{ + sal_Int16 nFormat; + sal_Int8 nLevel; + +public: + + XMLChapterImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp); + +private: + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import count fields (<text:[XXX]-count>) */ +class XMLCountFieldImportContext final : public XMLTextFieldImportContext +{ + const OUString sPropertyNumberingType; + + OUString sNumberFormat; + OUString sLetterSync; + + bool bNumberFormatOK; + +public: + + XMLCountFieldImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp, + sal_Int32 nElement); + +private: + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; + + static OUString MapTokenToServiceName(sal_Int32 nElement); +}; + +/** import page variable fields (<text:get-page-variable>) */ +class XMLPageVarGetFieldImportContext final : public XMLTextFieldImportContext +{ + OUString sNumberFormat; + OUString sLetterSync; + + bool bNumberFormatOK; + +public: + + XMLPageVarGetFieldImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp); + +private: + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import page variable fields (<text:get-page-variable>) */ +class XMLPageVarSetFieldImportContext final : public XMLTextFieldImportContext +{ + sal_Int16 nAdjust; + bool bActive; + +public: + + XMLPageVarSetFieldImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp); + +private: + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import macro fields (<text:execute-macro>) */ +class XMLMacroFieldImportContext final : public XMLTextFieldImportContext +{ + OUString sDescription; + rtl::Reference<XMLEventsImportContext> xEventContext; + + OUString sMacro; // macro for old documents (pre 638i) + + bool bDescriptionOK; + +public: + + XMLMacroFieldImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp); + +private: + /// for <office:events> children + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; + + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import reference fields (<text:reference-get>) */ +class XMLReferenceFieldImportContext final : public XMLTextFieldImportContext +{ + OUString sName; + OUString sLanguage; + sal_Int32 nElementToken; + sal_Int16 nSource; + sal_Int16 nType; + + bool bNameOK; + bool bTypeOK; + +public: + + XMLReferenceFieldImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp, + sal_Int32 nToken); + +private: + /// start element + virtual void SAL_CALL startFastElement( + sal_Int32 nElement, + const css::uno::Reference<css::xml::sax::XFastAttributeList> & xAttrList) override; + + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import dde field declaration container (<text:dde-connection-decls>) */ +class XMLDdeFieldDeclsImportContext final : public SvXMLImportContext +{ +public: + + XMLDdeFieldDeclsImportContext(SvXMLImport& rImport); + + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; +}; + +/** import dde field declaration (<text:dde-connection-decl>) */ +class XMLDdeFieldDeclImportContext final : public SvXMLImportContext +{ +public: + + XMLDdeFieldDeclImportContext(SvXMLImport& rImport); + + // create fieldmaster + virtual void SAL_CALL startFastElement( + sal_Int32 nElement, + const css::uno::Reference<css::xml::sax::XFastAttributeList> & xAttrList) override; +}; + +/** import dde fields (<text:dde-connection>) */ +class XMLDdeFieldImportContext final : public XMLTextFieldImportContext +{ + OUString sName; + OUString sPropertyContent; + +public: + + XMLDdeFieldImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp); + +private: + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// create textfield, attach master, and insert into document + virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; + + /// empty method + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import sheet name fields (Calc) dde fields (<text:sheet-name>) */ +class XMLSheetNameImportContext final : public XMLTextFieldImportContext +{ + +public: + + XMLSheetNameImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp); + +private: + /// no attributes -> empty method + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// no attributes -> empty method + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import page|slide name fields (<text:page-name>) */ +class XMLPageNameFieldImportContext final : public XMLTextFieldImportContext +{ +public: + + XMLPageNameFieldImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp); /// Text import helper + + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import hyperlinks as URL fields (Calc, Impress, Draw) (<office:a>) */ +class XMLUrlFieldImportContext final : public XMLTextFieldImportContext +{ + OUString sURL; + OUString sFrame; + bool bFrameOK; + +public: + + XMLUrlFieldImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp); + +private: + /// no attributes -> empty method + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// no attributes -> empty method + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import bibliography info fields (<text:bibliography-mark>) */ +class XMLBibliographyFieldImportContext final : public XMLTextFieldImportContext +{ + ::std::vector< css::beans::PropertyValue> aValues; + +public: + + XMLBibliographyFieldImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp); + +private: + /// process attributes (fill aValues) + virtual void SAL_CALL startFastElement( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList) override; + + /// empty method; all attributes are handled in StartElement + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// convert aValues into sequence and set property + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; + + static const char* MapBibliographyFieldName(sal_Int32 nElement); +}; + +/** Import an annotation field (<text:annotation>) */ +class XMLAnnotationImportContext final : public XMLTextFieldImportContext +{ + OUStringBuffer aAuthorBuffer; + OUStringBuffer aInitialsBuffer; + OUString aName; + OUStringBuffer aTextBuffer; + OUStringBuffer aDateBuffer; + OUString aResolved; + + css::uno::Reference < css::beans::XPropertySet > mxField; + css::uno::Reference < css::text::XTextCursor > mxCursor; + css::uno::Reference < css::text::XTextCursor > mxOldCursor; + + sal_Int32 mnElement; + +public: + + XMLAnnotationImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp, + sal_Int32 nElement); + +private: + /// process attributes + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// set properties + virtual void PrepareField( + const css::uno::Reference< css::beans::XPropertySet > & xPropertySet) 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; +}; + +/** Import a script field (<text:script>) */ +class XMLScriptImportContext final : public XMLTextFieldImportContext +{ + OUString sContent; + OUString sScriptType; + + bool bContentOK; + +public: + + XMLScriptImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp); + +private: + /// process attributes + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// set properties + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import measure fields (<text:measure>) */ +class XMLMeasureFieldImportContext final : public XMLTextFieldImportContext +{ + sal_Int16 mnKind; + +public: + + XMLMeasureFieldImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp); + +private: + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + +/** dropdown field (filter legacy) */ +class XMLDropDownFieldImportContext final : public XMLTextFieldImportContext +{ + std::vector<OUString> aLabels; + OUString sName; + OUString sHelp; + OUString sHint; + sal_Int32 nSelected; + bool bNameOK; + bool bHelpOK; + bool bHintOK; + +public: + + XMLDropDownFieldImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp); + + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; + +private: + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import header fields (<draw:header>) */ +class XMLHeaderFieldImportContext final : public XMLTextFieldImportContext +{ +public: + + XMLHeaderFieldImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp); /// Text import helper + + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import footer fields (<draw:footer>) */ +class XMLFooterFieldImportContext final : public XMLTextFieldImportContext +{ +public: + + XMLFooterFieldImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp); /// Text import helper + + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + +/** import footer fields (<draw:date-and-time>) */ +class XMLDateTimeFieldImportContext final : public XMLTextFieldImportContext +{ +public: + + XMLDateTimeFieldImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp); /// Text import helper + + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/txtlists.hxx b/xmloff/inc/txtlists.hxx new file mode 100644 index 000000000..dda522c44 --- /dev/null +++ b/xmloff/inc/txtlists.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 . + */ + +#pragma once + +#include <rtl/ustring.hxx> +#include <map> +#include <memory> +#include <stack> +#include <string_view> +#include <tuple> +#include <vector> +#include <com/sun/star/container/XIndexReplace.hpp> +#include <xmloff/xmlictxt.hxx> + +class SvXMLImport; +class XMLTextListBlockContext; +class XMLTextListItemContext; +class XMLNumberedParaContext; + +class XMLTextListsHelper +{ + public: + XMLTextListsHelper(); + XMLTextListsHelper(const XMLTextListsHelper&) = delete; + XMLTextListsHelper& operator=(const XMLTextListsHelper&) = delete; + + /// list stack for importing: + + /// push a list context on the list context stack + void PushListContext(XMLTextListBlockContext *i_pListBlock); + void PushListContext(XMLNumberedParaContext *i_pNumberedParagraph); + /// pop the list context stack + void PopListContext(); + /// peek at the top of the list context stack + void ListContextTop(XMLTextListBlockContext*& o_pListBlockContext, + XMLTextListItemContext*& o_pListItemContext, + XMLNumberedParaContext*& o_pNumberedParagraphContext ); + /// set list item on top of the list context stack + void SetListItem( XMLTextListItemContext *pListItem ); + + + // keeping track of processed lists for import and export + // Add optional parameter <sListStyleDefaultListId> (#i92811#) + void KeepListAsProcessed( const OUString& sListId, + const OUString& sListStyleName, + const OUString& sContinueListId, + const OUString& sListStyleDefaultListId = OUString() ); + + bool IsListProcessed( const OUString& sListId ) const; + OUString GetListStyleOfProcessedList( + const OUString& sListId ) const; + OUString GetContinueListIdOfProcessedList( + const OUString& sListId ) const; + const OUString& GetLastProcessedListId() const { return msLastProcessedListId;} + const OUString& GetListStyleOfLastProcessedList() const { return msListStyleOfLastProcessedList;} + + OUString GenerateNewListId() const; + + // Provide list id for a certain list block for import (#i92811#) + OUString GetListIdForListBlock( XMLTextListBlockContext const & rListBlock ); + + // keep track of continue list chain for export + void StoreLastContinuingList( const OUString& sListId, + const OUString& sContinuingListId ); + + OUString GetLastContinuingListId( const OUString& sListId ) const; + + // keep track of opened list elements of a certain list for export + void PushListOnStack( const OUString& sListId, + const OUString& sListStyleName ); + void PopListFromStack(); + bool EqualsToTopListStyleOnStack( std::u16string_view sListId ) const; + + /** for importing numbered-paragraph + note that the ID namespace for numbered-paragraph and regular list + is distinct; we never combine a list and a n-p + */ + css::uno::Reference< css::container::XIndexReplace> + EnsureNumberedParagraph( + SvXMLImport & i_rImport, + const OUString& i_ListId, + sal_Int16 & io_rLevel, const OUString& i_StyleName); + + /// get ID of the last numbered-paragraph iff it has given style-name + OUString GetNumberedParagraphListId( + const sal_uInt16 i_Level, + std::u16string_view i_StyleName); + + /** Creates a NumRule from given style-name. + @param i_rImport the SvXMLImport + @param i_xNumRule parent num rule + @param i_ParentStyleName parent list style name + @param i_StyleName the list style name + @param io_rLevel the list level (may be reset if too large) + @param o_rRestartNumbering set to true if no style (defaulting) + @param io_rSetDefaults set to true if no style (defaulting) + */ + static css::uno::Reference< css::container::XIndexReplace> MakeNumRule( + SvXMLImport & i_rImport, + const css::uno::Reference< css::container::XIndexReplace>& i_xNumRule, + std::u16string_view i_ParentStyleName, + const OUString& i_StyleName, + sal_Int16 & io_rLevel, + bool* o_pRestartNumbering = nullptr, + bool* io_pSetDefaults = nullptr); + + /// Looks up the last list id of a given list style, by name. + OUString GetLastIdOfStyleName(const OUString& sListStyleName) const; + + private: + + /** list context: list, list-item, numbered-paragraph + XMLTextListBlockContext, XMLTextListItemContext, + XMLNumberedParaContext + */ + typedef std::tuple<SvXMLImportContextRef, + SvXMLImportContextRef, SvXMLImportContextRef> ListStackFrame_t; + std::stack< ListStackFrame_t > mListStack; + + // container type for processed lists: + // map with <ListId> as key and pair( <ListStyleName, ContinueListId> ) + // as value + typedef ::std::map< OUString, + ::std::pair< OUString, OUString > > tMapForLists; + std::unique_ptr<tMapForLists> mpProcessedLists; + OUString msLastProcessedListId; + OUString msListStyleOfLastProcessedList; + + /* additional container for processed lists. + map with <ListStyleName> as key and pair( <ListId, ListStyleDefaultListId> ) + as value. (#i92811#) + */ + std::unique_ptr<tMapForLists> mpMapListIdToListStyleDefaultListId; + + // container type to build up continue list chain: + // map with <ListId> of master list as key and <ListId> of last list + // continuing the master list as value + typedef ::std::map< OUString, OUString > tMapForContinuingLists; + std::unique_ptr<tMapForContinuingLists> mpContinuingLists; + + std::unique_ptr<std::map<OUString, OUString>> mpStyleNameLastListIds; + + // stack type for opened list elements and its list style: + // vector with pair( <ListId>, <ListStyleName> ) as value + typedef ::std::vector< ::std::pair< OUString, OUString > > + tStackForLists; + std::unique_ptr<tStackForLists> mpListStack; + + /// to connect numbered-paragraphs that have no list-id attribute: + /// vector of pair of style-name and list-id (indexed by level) + typedef ::std::vector< ::std::pair< OUString, OUString > > + LastNumberedParagraphs_t; + + LastNumberedParagraphs_t mLastNumberedParagraphs; + + /// numbered-paragraphs + typedef ::std::vector< + ::std::pair< + OUString, + css::uno::Reference< css::container::XIndexReplace > > > NumParaList_t; + ::std::map< OUString, NumParaList_t > mNPLists; + +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/txtvfldi.hxx b/xmloff/inc/txtvfldi.hxx new file mode 100644 index 000000000..d5a4176d5 --- /dev/null +++ b/xmloff/inc/txtvfldi.hxx @@ -0,0 +1,452 @@ +/* -*- 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 . + */ + +/** @#file + * + * XML import of all variable related text fields plus database display field + */ + +#pragma once + +#include "txtfldi.hxx" +#include <com/sun/star/beans/XPropertySet.hpp> + + +/** helper class: parses value-type and associated value attributes */ +class XMLValueImportHelper final +{ + SvXMLImport& rImport; + XMLTextImportHelper& rHelper; + + OUString sValue; /// string value (only valid if bStringValueOK) + double fValue; /// double value (only valid if bFloatValueOK) + sal_Int32 nFormatKey; /// format key (only valid of bFormatOK) + OUString sFormula; /// formula string + OUString sDefault; /// default (see bStringDefault/bFormulaDef.) + bool bIsDefaultLanguage;/// format (of nFormatKey) has system language? + + bool bStringType; /// is this a string (or a float) type? + bool bFormatOK; /// have we read a style:data-style-name attr.? + bool bStringValueOK; /// have we read a string-value attr.? + bool bFormulaOK; /// have we read the formula attribute? + + const bool bSetType; /// should PrepareField set the SetExp subtype? + const bool bSetValue; /// should PrepareField set content/value? + const bool bSetStyle; /// should PrepareField set NumberFormat? + const bool bSetFormula; /// should PrepareField set Formula? + +public: + XMLValueImportHelper( + SvXMLImport& rImprt, /// XML Import + XMLTextImportHelper& rHlp, /// text import helper + bool bType, /// process type (PrepareField) + bool bStyle, /// process data style (P.F.) + bool bValue, /// process value (Prep.Field) + bool bFormula); /// process formula (Prep.F.) + + /// process attribute values + void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ); + + /// prepare XTextField for insertion into document + void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet); + + /// is value a string (rather than double)? + bool IsStringValue() const { return bStringType; } + + /// has format been read? + bool IsFormatOK() const { return bFormatOK; } + + void SetDefault(const OUString& sStr) { sDefault = sStr; } +}; + + +/** + * abstract parent class for all variable related fields + * - variable-set/get/decl (not -decls), + * - user-field-get/decl (not -decls), + * - sequence/-decl (not -decls), + * - expression, + * - text-input + * + * Processes the following attributes: + * - name + * - formula + * - display + * - value, value-type, data-style-name (via XMLValueImportHelper) + * - description. + * + * Each attribute has a corresponding member, a bool variable to indicate + * whether it was set or not, and a bool variable whether it should be set + * using the standard property name. + * + * bValid is set true, when name is found! + * (Most variable related fields are valid, if a name is + * found. However, some are always valid. In this case, setting bValid + * does not matter.) + */ +class XMLVarFieldImportContext : public XMLTextFieldImportContext +{ +private: + OUString sName; /// name attribute + OUString sFormula; /// formula attribute + OUString sDescription; /// description + OUString sHelp; /// help text + OUString sHint; /// hint + XMLValueImportHelper aValueHelper; /// value, value-type, and style + bool bDisplayFormula; /// display formula?(rather than value) + bool bDisplayNone; /// hide field? + + bool bFormulaOK; /// sFormula was set + bool bDescriptionOK; /// sDescription was set + bool bHelpOK; /// sHelp was set + bool bHintOK; /// sHint was set + bool bDisplayOK; /// sDisplayFormula/-None were set + + bool bSetFormula; /// set Formula property + bool bSetFormulaDefault; /// use content as default for formula + bool bSetDescription; /// set sDescription with Hint-property + bool bSetHelp; + bool bSetHint; + bool bSetVisible; /// set IsVisible + bool bSetDisplayFormula; /// set DisplayFormula (sub type???) + bool bSetPresentation; /// set presentation frm elem. content? + +public: + + + XMLVarFieldImportContext( + // for XMLTextFieldImportContext: + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp, /// text import helper + const OUString& pServiceName, /// name of SO API service + // config variables for PrepareField behavior: + bool bFormula, /// set Formula property + bool bFormulaDefault, /// use content as default for formula + bool bDescription, /// set sDescription with Hint-property + bool bHelp, + bool bHint, + bool bVisible, /// set IsVisible (display attr) + bool bDisplayFormula, /// set ??? (display attr.) + bool bType, /// set value type with ???-property + bool bStyle, /// set data style (NumberFormat-Prop.) + bool bValue, /// set value with Content/Value-Prop. + bool bPresentation); /// set presentation from elem. content + +protected: + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference< + css::beans::XPropertySet> & xPropertySet) override; + + // various accessor methods: + const OUString& GetName() const { return sName; } + bool IsStringValue() const { return aValueHelper.IsStringValue();} +}; + + +/** import variable get fields (<text:variable-get>) */ +class XMLVariableGetFieldImportContext final : public XMLVarFieldImportContext +{ +public: + + + XMLVariableGetFieldImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp); /// Text import helper + + +private: + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference< + css::beans::XPropertySet> & xPropertySet) override; +}; + + +/** import expression fields (<text:expression>) */ +class XMLExpressionFieldImportContext final : public XMLVarFieldImportContext +{ +public: + + XMLExpressionFieldImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp); /// Text import helper + +private: + virtual void PrepareField( + const css::uno::Reference< + css::beans::XPropertySet> & xPropertySet) override; +}; + +/*** import text input fields (<text:text-input>) */ +class XMLTextInputFieldImportContext final : public XMLVarFieldImportContext +{ +public: + + XMLTextInputFieldImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp); /// Text import helper + +private: + virtual void PrepareField( + const css::uno::Reference< + css::beans::XPropertySet> & xPropertySet) override; +}; + + +/** + * upperclass for variable/user-set, var/user-input, and sequence fields + * inds field master of appropriate type and attaches field to it. + */ +class XMLSetVarFieldImportContext : public XMLVarFieldImportContext +{ + const VarType eFieldType; + +public: + + + XMLSetVarFieldImportContext( + // for XMLTextFieldImportContext: + SvXMLImport& rImport, /// see XMLTextFieldImportContext + XMLTextImportHelper& rHlp, /// see XMLTextFieldImportContext + const OUString& pServiceName, /// see XMLTextFieldImportContext + // for finding appropriate field master (see endFastElement()) + VarType eVarType, /// variable type + // config variables: + bool bFormula, /// see XMLTextFieldImportContext + bool bFormulaDefault, /// see XMLTextFieldImportContext + bool bDescription, /// see XMLTextFieldImportContext + bool bHelp, /// see XMLTextFieldImportContext + bool bHint, /// see XMLTextFieldImportContext + bool bVisible, /// see XMLTextFieldImportContext + bool bDisplayFormula, /// see XMLTextFieldImportContext + bool bType, /// see XMLTextFieldImportContext + bool bStyle, /// see XMLTextFieldImportContext + bool bValue, /// see XMLTextFieldImportContext + bool bPresentation); /// see XMLTextFieldImportContext + +protected: + + /// create XTextField, attach master and insert into document; + /// also calls PrepareTextField + virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; + + /// find appropriate field master + bool FindFieldMaster( + css::uno::Reference< + css::beans::XPropertySet> & xMaster); +}; + + +/** import variable set fields (<text:variable-set>) */ +class XMLVariableSetFieldImportContext final : public XMLSetVarFieldImportContext +{ +public: + + XMLVariableSetFieldImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp); /// Text import helper +\ +private: + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + + +/** variable input fields (<text:variable-input>) */ +class XMLVariableInputFieldImportContext final : public XMLSetVarFieldImportContext +{ +public: + + + XMLVariableInputFieldImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp); /// Text import helper + +private: + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + + +/** user fields (<text:user-field-get>) */ +class XMLUserFieldImportContext final : public XMLSetVarFieldImportContext +{ + +public: + + + XMLUserFieldImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp); /// Text import helper +}; + +/** user input fields (<text:user-field-input>) */ +class XMLUserFieldInputImportContext final : public XMLVarFieldImportContext +{ + +public: + + + XMLUserFieldInputImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp); /// Text import helper + + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + + +/** sequence fields (<text:sequence>) */ +class XMLSequenceFieldImportContext final : public XMLSetVarFieldImportContext +{ + OUString sNumFormat; + OUString sNumFormatSync; + OUString sRefName; + + bool bRefNameOK; + +public: + + + XMLSequenceFieldImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp); /// Text import helper + +private: + + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + + +/** + * variable declaration container for all variable fields + * (variable-decls, user-field-decls, sequence-decls) + */ +class XMLVariableDeclsImportContext final : public SvXMLImportContext +{ + enum VarType eVarDeclsContextType; + XMLTextImportHelper& rImportHelper; + +public: + + XMLVariableDeclsImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp, /// text import helper + enum VarType eVarType); /// variable type + + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override; +}; + +/** + * variable field declarations + * (variable-decl, user-field-decl, sequence-decl) + */ +class XMLVariableDeclImportContext final : public SvXMLImportContext +{ +public: + + + XMLVariableDeclImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp, /// text import helper + sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList> & xAttrList,/// list of element attributes + enum VarType eVarType); /// variable type + + /// get field master for name and rename if appropriate + static bool FindFieldMaster(css::uno::Reference<css::beans::XPropertySet> & xMaster, + SvXMLImport& rImport, + XMLTextImportHelper& rHelper, + const OUString& sVarName, + enum VarType eVarType); +}; + + +/** import table formula fields (deprecated; for Writer 2.0 compatibility) */ +class XMLTableFormulaImportContext final : public XMLTextFieldImportContext +{ + XMLValueImportHelper aValueHelper; + + bool bIsShowFormula; + +public: + + XMLTableFormulaImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp); /// text import helper + +private: + + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// prepare XTextField for insertion into document + virtual void PrepareField( + const css::uno::Reference<css::beans::XPropertySet> & xPropertySet) override; +}; + + +/** import database display fields (<text:database-display>) */ +class XMLDatabaseDisplayImportContext final : public XMLDatabaseFieldImportContext +{ + XMLValueImportHelper aValueHelper; + + OUString sColumnName; + bool bColumnOK; + + bool bDisplay; + bool bDisplayOK; + +public: + + + XMLDatabaseDisplayImportContext( + SvXMLImport& rImport, /// XML Import + XMLTextImportHelper& rHlp); /// text import helper + +private: + + /// process attribute values + virtual void ProcessAttribute( sal_Int32 nAttrToken, + std::string_view sAttrValue ) override; + + /// create, prepare and insert database field master and database field + virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/xexptran.hxx b/xmloff/inc/xexptran.hxx new file mode 100644 index 000000000..c40629f3a --- /dev/null +++ b/xmloff/inc/xexptran.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 . + */ + +#pragma once + +#include <rtl/ustring.hxx> +#include <com/sun/star/drawing/HomogenMatrix.hpp> + +#include <memory> +#include <vector> + +struct ImpSdXMLExpTransObj2DBase; +struct ImpSdXMLExpTransObj3DBase; +class SvXMLUnitConverter; +class SvXMLImport; +class SvXMLExport; + +namespace basegfx +{ + class B2DTuple; + class B2DHomMatrix; + class B3DHomMatrix; +} + +class SdXMLImExTransform2D +{ + // NOTE: This uses shared_ptr, because with unique_ptr the code + // fails to compile because of incomplete type. + std::vector< std::shared_ptr< ImpSdXMLExpTransObj2DBase > > maList; + OUString msString; + +public: + SdXMLImExTransform2D() {} + + void AddRotate(double fNew); + void AddTranslate(const ::basegfx::B2DTuple& rNew); + void AddSkewX(double fNew); + + bool NeedsAction() const { return !maList.empty(); } + void GetFullTransform(::basegfx::B2DHomMatrix& rFullTrans); + const OUString& GetExportString(const SvXMLUnitConverter& rConv); + void SetString(const OUString& rNew, const SvXMLUnitConverter& rConv); +}; + +class SdXMLImExTransform3D +{ + // NOTE: This uses shared_ptr, because with unique_ptr the code + // fails to compile because of incomplete type. + std::vector< std::shared_ptr< ImpSdXMLExpTransObj3DBase > > maList; + OUString msString; + +public: + SdXMLImExTransform3D() {} + SdXMLImExTransform3D(const OUString& rNew, const SvXMLUnitConverter& rConv); + + void AddMatrix(const ::basegfx::B3DHomMatrix& rNew); + + void AddHomogenMatrix(const css::drawing::HomogenMatrix& xHomMat); + bool NeedsAction() const { return !maList.empty(); } + void GetFullTransform(::basegfx::B3DHomMatrix& rFullTrans); + bool GetFullHomogenTransform(css::drawing::HomogenMatrix& xHomMat); + const OUString& GetExportString(const SvXMLUnitConverter& rConv); + void SetString(const OUString& rNew, const SvXMLUnitConverter& rConv); +}; + +class SdXMLImExViewBox +{ + OUString msString; + double mfX; + double mfY; + double mfW; + double mfH; + +public: + SdXMLImExViewBox(double fX, double fY, double fW, double fH); + SdXMLImExViewBox(const OUString& rNew, const SvXMLUnitConverter& rConv); + + double GetX() const { return mfX; } + double GetY() const { return mfY; } + double GetWidth() const { return mfW; } + double GetHeight() const { return mfH; } + const OUString& GetExportString(); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/xmlmultiimagehelper.hxx b/xmloff/inc/xmlmultiimagehelper.hxx new file mode 100644 index 000000000..adfdce2e9 --- /dev/null +++ b/xmloff/inc/xmlmultiimagehelper.hxx @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <xmloff/xmlimp.hxx> + + +class MultiImageImportHelper +{ +private: + std::vector< SvXMLImportContextRef > maImplContextVector; + bool mbSupportsMultipleContents; + +protected: + /// helper to get the created xShape instance, override this + virtual void removeGraphicFromImportContext(const SvXMLImportContext& rContext) = 0; + virtual OUString getGraphicPackageURLFromImportContext(const SvXMLImportContext& rContext) const = 0; + virtual css::uno::Reference<css::graphic::XGraphic> getGraphicFromImportContext(const SvXMLImportContext& rContext) const = 0; + +public: + MultiImageImportHelper(); + virtual ~MultiImageImportHelper(); + + /// solve multiple imported images. The most valuable one is chosen, + /// see implementation for evtl. changing weights and/or adding filetypes. + /// + /// @returns import context of the selected image + SvXMLImportContextRef solveMultipleImages(); + + /// add a content to the remembered image import contexts + void addContent(const SvXMLImportContext& rSvXMLImportContext); + + /// read/write access to boolean switch + bool getSupportsMultipleContents() const { return mbSupportsMultipleContents; } + void setSupportsMultipleContents(bool bNew) { mbSupportsMultipleContents = bNew; } +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/xmlsdtypes.hxx b/xmloff/inc/xmlsdtypes.hxx new file mode 100644 index 000000000..898c475bd --- /dev/null +++ b/xmloff/inc/xmlsdtypes.hxx @@ -0,0 +1,204 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +//#include <xmloff/xmlnume.hxx> +//#include <xmloff/maptype.hxx> +#include <xmloff/xmltypes.hxx> +//#include <xmloff/xmlement.hxx> +//#include <xmloff/prhdlfac.hxx> +//#include <xmloff/xmlprmap.hxx> +//#include "xmloff/XMLTextListAutoStylePool.hxx" +//#include <xmloff/xmlexppr.hxx> + +////////////////////////////////////////////////////////////////////////////// +// types of own properties + +#define XML_SD_TYPE_STROKE (XML_SD_TYPES_START + 0) +#define XML_SD_TYPE_PRESPAGE_TYPE (XML_SD_TYPES_START + 1) +#define XML_SD_TYPE_PRESPAGE_STYLE (XML_SD_TYPES_START + 2) +#define XML_SD_TYPE_PRESPAGE_SPEED (XML_SD_TYPES_START + 3) +#define XML_SD_TYPE_PRESPAGE_DURATION (XML_SD_TYPES_START + 4) +#define XML_SD_TYPE_PRESPAGE_VISIBILITY (XML_SD_TYPES_START + 5) +#define XML_SD_TYPE_MARKER (XML_SD_TYPES_START + 6 ) +#define XML_SD_TYPE_OPACITY (XML_SD_TYPES_START + 7 ) +#define XML_SD_TYPE_LINEJOIN (XML_SD_TYPES_START + 8 ) +#define XML_SD_TYPE_FILLSTYLE (XML_SD_TYPES_START + 9 ) +#define XML_SD_TYPE_GRADIENT (XML_SD_TYPES_START + 10 ) +#define XML_SD_TYPE_GRADIENT_STEPCOUNT (XML_SD_TYPES_START + 11 ) +#define XML_SD_TYPE_VISIBLE_HIDDEN (XML_SD_TYPES_START + 12 ) +#define XML_SD_TYPE_TEXT_CROSSEDOUT (XML_SD_TYPES_START + 13 ) +#define XML_SD_TYPE_NUMBULLET (XML_SD_TYPES_START + 14 ) +#define XML_SD_TYPE_WRITINGMODE (XML_SD_TYPES_START + 15 ) +#define XML_SD_TYPE_BITMAP_MODE (XML_SD_TYPES_START + 16 ) +#define XML_SD_TYPE_BITMAPREPOFFSETX (XML_SD_TYPES_START + 17 ) +#define XML_SD_TYPE_BITMAPREPOFFSETY (XML_SD_TYPES_START + 18 ) +#define XML_SD_TYPE_FILLBITMAPSIZE (XML_SD_TYPES_START + 19 ) +#define XML_SD_TYPE_LOGICAL_SIZE (XML_SD_TYPES_START + 20 ) +#define XML_SD_TYPE_BITMAP_REFPOINT (XML_SD_TYPES_START + 21 ) +#define XML_SD_TYPE_PRESPAGE_BACKSIZE (XML_SD_TYPES_START + 22 ) +#define XML_TYPE_TEXT_ANIMATION_BLINKING (XML_SD_TYPES_START + 23 ) +#define XML_TYPE_TEXT_ANIMATION_STEPS (XML_SD_TYPES_START + 24 ) +#define XML_SD_TYPE_TEXT_ALIGN (XML_SD_TYPES_START + 25 ) +#define XML_SD_TYPE_VERTICAL_ALIGN (XML_SD_TYPES_START + 26 ) +#define XML_SD_TYPE_FITTOSIZE (XML_SD_TYPES_START + 27 ) +#define XML_SD_TYPE_MEASURE_HALIGN (XML_SD_TYPES_START + 28 ) +#define XML_SD_TYPE_MEASURE_VALIGN (XML_SD_TYPES_START + 29 ) +#define XML_SD_TYPE_MEASURE_UNIT (XML_SD_TYPES_START + 30 ) +#define XML_SD_TYPE_MEASURE_PLACING (XML_SD_TYPES_START + 31 ) +#define XML_SD_TYPE_CONTROL_BORDER (XML_SD_TYPES_START + 32 ) +#define XML_SD_TYPE_CONTROL_BORDER_COLOR (XML_SD_TYPES_START + 33 ) +#define XML_SD_TYPE_IMAGE_SCALE_MODE (XML_SD_TYPES_START + 34 ) +#define XML_SD_TYPE_LINECAP (XML_SD_TYPES_START + 35 ) +#define XML_SD_TYPE_FITTOSIZE_AUTOFIT (XML_SD_TYPES_START + 36 ) + +////////////////////////////////////////////////////////////////////////////// +// 3D property types +#define XML_SD_TYPE_BACKFACE_CULLING (XML_SD_TYPES_START + 40 ) +#define XML_SD_TYPE_NORMALS_KIND (XML_SD_TYPES_START + 41 ) +#define XML_SD_TYPE_NORMALS_DIRECTION (XML_SD_TYPES_START + 42 ) +#define XML_SD_TYPE_TEX_GENERATION_MODE_X (XML_SD_TYPES_START + 43 ) +#define XML_SD_TYPE_TEX_GENERATION_MODE_Y (XML_SD_TYPES_START + 44 ) +#define XML_SD_TYPE_TEX_KIND (XML_SD_TYPES_START + 45 ) +#define XML_SD_TYPE_TEX_MODE (XML_SD_TYPES_START + 46 ) + +////////////////////////////////////////////////////////////////////////////// +// #FontWork# types +#define XML_SD_TYPE_FONTWORK_STYLE (XML_SD_TYPES_START + 47 ) +#define XML_SD_TYPE_FONTWORK_ADJUST (XML_SD_TYPES_START + 48 ) +#define XML_SD_TYPE_FONTWORK_SHADOW (XML_SD_TYPES_START + 49 ) +#define XML_SD_TYPE_FONTWORK_FORM (XML_SD_TYPES_START + 50 ) + +////////////////////////////////////////////////////////////////////////////// +// Caption types +#define XML_SD_TYPE_CAPTION_ANGLE_TYPE (XML_SD_TYPES_START + 60 ) +#define XML_SD_TYPE_CAPTION_IS_ESC_REL (XML_SD_TYPES_START + 61 ) +#define XML_SD_TYPE_CAPTION_ESC_REL (XML_SD_TYPES_START + 62 ) +#define XML_SD_TYPE_CAPTION_ESC_ABS (XML_SD_TYPES_START + 63 ) +#define XML_SD_TYPE_CAPTION_ESC_DIR (XML_SD_TYPES_START + 64 ) +#define XML_SD_TYPE_CAPTION_TYPE (XML_SD_TYPES_START + 65 ) + +////////////////////////////////////////////////////////////////////////////// +// header & footer types +#define XML_SD_TYPE_DATETIMEUPDATE (XML_SD_TYPES_START + 70 ) +#define XML_SD_TYPE_DATETIME_FORMAT (XML_SD_TYPES_START + 71 ) + +////////////////////////////////////////////////////////////////////////////// +// new types for merged style:protect attribute +#define XML_SD_TYPE_MOVE_PROTECT (XML_SD_TYPES_START + 72 ) +#define XML_SD_TYPE_SIZE_PROTECT (XML_SD_TYPES_START + 73 ) + +////////////////////////////////////////////////////////////////////////////// +// new type for style:mirror attribute +#define XML_TYPE_SD_MIRROR (XML_SD_TYPES_START + 74 ) + +////////////////////////////////////////////////////////////////////////////// +// new smil transition types for pages +#define XML_SD_TYPE_TRANSITION_TYPE (XML_SD_TYPES_START + 75 ) +#define XML_SD_TYPE_TRANSTIION_SUBTYPE (XML_SD_TYPES_START + 76 ) +#define XML_SD_TYPE_TRANSTIION_DIRECTION (XML_SD_TYPES_START + 77 ) +#define XML_SD_TYPE_HEADER_FOOTER_VISIBILITY_TYPE (XML_SD_TYPES_START + 78 ) + +////////////////////////////////////////////////////////////////////////////// + +#define XML_SD_TYPE_CELL_ROTATION_ANGLE (XML_SD_TYPES_START + 79 ) + +#define CTF_NUMBERINGRULES 1000 +#define CTF_CONTROLWRITINGMODE 1001 +#define CTF_WRITINGMODE 1002 +#define CTF_REPEAT_OFFSET_X 1003 +#define CTF_REPEAT_OFFSET_Y 1004 +#define CTF_PAGE_SOUND_URL 1005 +#define CTF_PAGE_VISIBLE 1006 +#define CTF_PAGE_TRANS_TYPE 1007 +#define CTF_PAGE_TRANS_STYLE 1008 +#define CTF_PAGE_TRANS_SPEED 1009 +#define CTF_PAGE_TRANS_DURATION 1010 +#define CTF_PAGE_BACKSIZE 1011 +#define CTF_DASHNAME 1012 +#define CTF_LINESTARTNAME 1013 +#define CTF_LINEENDNAME 1014 +#define CTF_FILLGRADIENTNAME 1015 +#define CTF_FILLHATCHNAME 1016 +#define CTF_FILLBITMAPNAME 1017 +#define CTF_FILLTRANSNAME 1018 +#define CTF_TEXTANIMATION_BLINKING 1019 +#define CTF_TEXTANIMATION_KIND 1020 + +#define CTF_PAGE_TRANSITION_TYPE 1021 +#define CTF_PAGE_TRANSITION_SUBTYPE 1022 +#define CTF_PAGE_TRANSITION_DIRECTION 1023 +#define CTF_PAGE_TRANSITION_FADECOLOR 1024 + +////////////////////////////////////////////////////////////////////////////// +// #FontWork# +#define CTF_FONTWORK_STYLE 1021 +#define CTF_FONTWORK_ADJUST 1022 +#define CTF_FONTWORK_DISTANCE 1023 +#define CTF_FONTWORK_START 1024 +#define CTF_FONTWORK_MIRROR 1025 +#define CTF_FONTWORK_OUTLINE 1026 +#define CTF_FONTWORK_SHADOW 1027 +#define CTF_FONTWORK_SHADOWCOLOR 1028 +#define CTF_FONTWORK_SHADOWOFFSETX 1029 +#define CTF_FONTWORK_SHADOWOFFSETY 1030 +#define CTF_FONTWORK_FORM 1031 +#define CTF_FONTWORK_HIDEFORM 1032 +#define CTF_FONTWORK_SHADOWTRANSPARENCE 1033 + +////////////////////////////////////////////////////////////////////////////// +// OLE part 1 +#define CTF_SD_OLE_VIS_AREA_IMPORT_LEFT 1040 +#define CTF_SD_OLE_VIS_AREA_IMPORT_TOP 1041 +#define CTF_SD_OLE_VIS_AREA_IMPORT_WIDTH 1042 +#define CTF_SD_OLE_VIS_AREA_IMPORT_HEIGHT 1043 +#define CTF_SD_OLE_ISINTERNAL 1044 + +#define CTF_SD_MOVE_PROTECT 1045 +#define CTF_SD_SIZE_PROTECT 1046 + +////////////////////////////////////////////////////////////////////////////// +// caption +#define CTF_CAPTION_ISESCREL 1047 +#define CTF_CAPTION_ESCREL 1048 +#define CTF_CAPTION_ESCABS 1049 + +////////////////////////////////////////////////////////////////////////////// +// header&footer +#define CTF_HEADER_VISIBLE 1050 +#define CTF_FOOTER_VISIBLE 1051 +#define CTF_PAGE_NUMBER_VISIBLE 1052 +#define CTF_DATE_TIME_VISIBLE 1053 +#define CTF_HEADER_TEXT 1054 +#define CTF_FOOTER_TEXT 1055 +#define CTF_DATE_TIME_TEXT 1056 +#define CTF_DATE_TIME_FORMAT 1057 +#define CTF_DATE_TIME_UPDATE 1058 + +////////////////////////////////////////////////////////////////////////////// +// OLE part 2 +#define CTF_SD_OLE_ASPECT 1059 +#define CTF_SD_OLE_VIS_AREA_EXPORT_LEFT 1060 +#define CTF_SD_OLE_VIS_AREA_EXPORT_TOP 1061 +#define CTF_SD_OLE_VIS_AREA_EXPORT_WIDTH 1062 +#define CTF_SD_OLE_VIS_AREA_EXPORT_HEIGHT 1063 + +////////////////////////////////////////////////////////////////////////////// + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/xmltabe.hxx b/xmloff/inc/xmltabe.hxx new file mode 100644 index 000000000..af2873b76 --- /dev/null +++ b/xmloff/inc/xmltabe.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef XMLOFF_INC_XMLTABE_HXX +#define XMLOFF_INC_XMLTABE_HXX + +// prevent funny things like "#define sun 1" from the compiler +#include <sal/config.h> +#include <sal/types.h> + +class SvXMLExport; +namespace com::sun::star { + namespace style { struct TabStop; } + namespace uno { class Any; } +} + + +class SvxXMLTabStopExport final +{ + SvXMLExport& rExport; // for access to document handler + + void exportTabStop( const css::style::TabStop* pTabStop ); + +public: + + SvxXMLTabStopExport( SvXMLExport& rExport ); + + // core API + void Export( const css::uno::Any& rAny ); +}; + + +#endif // XMLOFF_INC_XMLTABE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/xmltabi.hxx b/xmloff/inc/xmltabi.hxx new file mode 100644 index 000000000..81cc60e3d --- /dev/null +++ b/xmloff/inc/xmltabi.hxx @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <memory> + +#include "XMLElementPropertyContext.hxx" + +class SvXMLImport; +class SvxXMLTabStopContext_Impl; + +typedef std::vector<rtl::Reference<SvxXMLTabStopContext_Impl>> SvxXMLTabStopArray_Impl; + +class SvxXMLTabStopImportContext final : public XMLElementPropertyContext +{ +private: + std::unique_ptr<SvxXMLTabStopArray_Impl> mpTabStops; + +public: + SvxXMLTabStopImportContext(SvXMLImport& rImport, sal_Int32 nElement, + const XMLPropertyState& rProp, + ::std::vector<XMLPropertyState>& rProps); + + 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; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/inc/xmlversion.hxx b/xmloff/inc/xmlversion.hxx new file mode 100644 index 000000000..5039fc7d7 --- /dev/null +++ b/xmloff/inc/xmlversion.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 . + */ +#pragma once + +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/document/XDocumentRevisionListPersistence.hpp> +#include <com/sun/star/util/RevisionTag.hpp> +#include <com/sun/star/embed/XStorage.hpp> + +#include <cppuhelper/implbase.hxx> +#include <xmloff/xmlictxt.hxx> +#include <xmloff/xmlexp.hxx> +#include <xmloff/xmlimp.hxx> +#include <xmloff/xmltoken.hxx> + +class XMLVersionListExport final : public SvXMLExport +{ +private: + const css::uno::Sequence < css::util::RevisionTag >& maVersions; +public: + XMLVersionListExport( + const css::uno::Reference< css::uno::XComponentContext >& rContext, + const css::uno::Sequence < css::util::RevisionTag >& rVersions, + const OUString &rFileName, + css::uno::Reference< css::xml::sax::XDocumentHandler > const &rHandler ); + + ErrCode exportDoc( enum ::xmloff::token::XMLTokenEnum eClass = ::xmloff::token::XML_TOKEN_INVALID ) override; + void ExportAutoStyles_() override {} + void ExportMasterStyles_ () override {} + void ExportContent_() override {} +}; + +class XMLVersionListImport final : public SvXMLImport +{ +private: + css::uno::Sequence < css::util::RevisionTag >& maVersions; + + virtual SvXMLImportContext *CreateFastContext( sal_Int32 Element, + const ::css::uno::Reference< ::css::xml::sax::XFastAttributeList >& xAttrList ) override; + +public: + + XMLVersionListImport( + const css::uno::Reference< css::uno::XComponentContext >& rContext, + css::uno::Sequence < css::util::RevisionTag >& rVersions ); + virtual ~XMLVersionListImport() noexcept override; + + css::uno::Sequence < css::util::RevisionTag >& + GetList() { return maVersions; } +}; + +class XMLVersionListContext final : public SvXMLImportContext +{ +private: + XMLVersionListImport & GetImport() { return static_cast<XMLVersionListImport&>(SvXMLImportContext::GetImport()); } + +public: + + XMLVersionListContext( XMLVersionListImport& rImport ); + + virtual ~XMLVersionListContext() override; + + virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL + createFastChildContext(sal_Int32 nElement, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttribs) override; +}; + +class XMLVersionContext final : public SvXMLImportContext +{ +private: + static bool ParseISODateTimeString( + std::u16string_view rString, + css::util::DateTime& rDateTime ); + +public: + + XMLVersionContext( XMLVersionListImport& rImport, + const css::uno::Reference< css::xml::sax::XFastAttributeList > & xAttrList ); + + virtual ~XMLVersionContext() override; +}; + +class XMLVersionListPersistence final : public ::cppu::WeakImplHelper< css::document::XDocumentRevisionListPersistence, css::lang::XServiceInfo > +{ +public: + virtual css::uno::Sequence< css::util::RevisionTag > SAL_CALL load( const css::uno::Reference< css::embed::XStorage >& Storage ) override; + virtual void SAL_CALL store( const css::uno::Reference< css::embed::XStorage >& Storage, const css::uno::Sequence< css::util::RevisionTag >& List ) override; + + OUString SAL_CALL getImplementationName() override; + + sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |