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 /oox/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 '')
86 files changed, 7061 insertions, 0 deletions
diff --git a/oox/inc/drawingml/ThemeOverrideFragmentHandler.hxx b/oox/inc/drawingml/ThemeOverrideFragmentHandler.hxx new file mode 100644 index 000000000..1582ea819 --- /dev/null +++ b/oox/inc/drawingml/ThemeOverrideFragmentHandler.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/. + */ + +#ifndef INCLUDED_OOX_DRAWINGML_THEMEOVERRICEFRAGMENTHANDLER_HXX +#define INCLUDED_OOX_DRAWINGML_THEMEOVERRICEFRAGMENTHANDLER_HXX + +#include <oox/core/fragmenthandler2.hxx> + +namespace oox::drawingml { + +class Theme; + +class ThemeOverrideFragmentHandler final : public ::oox::core::FragmentHandler2 +{ +public: + explicit ThemeOverrideFragmentHandler( + ::oox::core::XmlFilterBase& rFilter, + const OUString& rFragmentPath, + Theme& rTheme ); + virtual ~ThemeOverrideFragmentHandler() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; + +private: + Theme& mrTheme; +}; + +} // namespace oox::drawingml + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/axiscontext.hxx b/oox/inc/drawingml/chart/axiscontext.hxx new file mode 100644 index 000000000..ad240a4a7 --- /dev/null +++ b/oox/inc/drawingml/chart/axiscontext.hxx @@ -0,0 +1,109 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CHART_AXISCONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_AXISCONTEXT_HXX + +#include <drawingml/chart/chartcontextbase.hxx> + +namespace oox::drawingml::chart { + + +struct AxisDispUnitsModel; + +/** Handler for a value axis display units context (c:dispUnits element). + */ +class AxisDispUnitsContext final : public ContextBase< AxisDispUnitsModel > +{ +public: + explicit AxisDispUnitsContext( ::oox::core::ContextHandler2Helper& rParent, AxisDispUnitsModel& rModel ); + virtual ~AxisDispUnitsContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +struct AxisModel; + +/** Base class for axis context handlers (c:catAx, c:dateAx, c:serAx, c:valAx + elements). + */ +class AxisContextBase : public ContextBase< AxisModel > +{ +public: + explicit AxisContextBase( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel ); + virtual ~AxisContextBase() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +/** Handler for a category axis context (c:catAx element). + */ +class CatAxisContext final : public AxisContextBase +{ +public: + explicit CatAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel ); + virtual ~CatAxisContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +/** Handler for a date axis context (c:dateAx element). + */ +class DateAxisContext final : public AxisContextBase +{ +public: + explicit DateAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel ); + virtual ~DateAxisContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +/** Handler for a series axis context (c:serAx element). + */ +class SerAxisContext final : public AxisContextBase +{ +public: + explicit SerAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel ); + virtual ~SerAxisContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +/** Handler for a value axis context (c:valAx element). + */ +class ValAxisContext final : public AxisContextBase +{ +public: + explicit ValAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel ); + virtual ~ValAxisContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/axisconverter.hxx b/oox/inc/drawingml/chart/axisconverter.hxx new file mode 100644 index 000000000..6efa3af62 --- /dev/null +++ b/oox/inc/drawingml/chart/axisconverter.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 INCLUDED_OOX_DRAWINGML_CHART_AXISCONVERTER_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_AXISCONVERTER_HXX + +#include <drawingml/chart/converterbase.hxx> + +namespace com::sun::star { + namespace chart2 { class XAxis; } + namespace chart2 { class XCoordinateSystem; } +} + +namespace oox::drawingml::chart { + + +struct AxisDispUnitsModel; + +class AxisDispUnitsConverter final : public ConverterBase< AxisDispUnitsModel > +{ +public: + explicit AxisDispUnitsConverter( + const ConverterRoot& rParent, + AxisDispUnitsModel& rModel ); + virtual ~AxisDispUnitsConverter() override; + + /** Creates a chart2 axis and inserts it into the passed coordinate system. */ + void convertFromModel( + const css::uno::Reference< css::chart2::XAxis >& rxAxis); +}; + +struct AxisModel; +class TypeGroupConverter; + +class AxisConverter final : public ConverterBase< AxisModel > +{ +public: + explicit AxisConverter( + const ConverterRoot& rParent, + AxisModel& rModel ); + virtual ~AxisConverter() override; + + /** Creates a chart2 axis and inserts it into the passed coordinate system. */ + void convertFromModel( + const css::uno::Reference<css::chart2::XCoordinateSystem>& rxCoordSystem, + RefVector<TypeGroupConverter>& rTypeGroups, const AxisModel* pCrossingAxis, + sal_Int32 nAxesSetIdx, sal_Int32 nAxisIdx, bool bUseFixedInnerSize ); +}; + + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/axismodel.hxx b/oox/inc/drawingml/chart/axismodel.hxx new file mode 100644 index 000000000..6ecd411e1 --- /dev/null +++ b/oox/inc/drawingml/chart/axismodel.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 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CHART_AXISMODEL_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_AXISMODEL_HXX + +#include <oox/drawingml/shape.hxx> +#include <drawingml/chart/titlemodel.hxx> + +namespace oox::drawingml::chart { + +struct AxisDispUnitsModel +{ + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< TextBody > TextBodyRef; + typedef ModelRef< LayoutModel > LayoutRef; + typedef ModelRef< TextModel > TextRef; + + ShapeRef mxShapeProp; /// Label frame formatting. + TextBodyRef mxTextProp; /// Label text formatting. + LayoutRef mxLayout; /// Layout/position of the axis units label. + TextRef mxText; /// Text source of the axis units label. + double mfCustomUnit; /// Custom unit size on value axis. + OUString mnBuiltInUnit; /// Built-in unit on value axis. + + explicit AxisDispUnitsModel(); + ~AxisDispUnitsModel(); +}; + +struct AxisModel +{ + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< TextBody > TextBodyRef; + typedef ModelRef< TitleModel > TitleRef; + typedef ModelRef< AxisDispUnitsModel > AxisDispUnitsRef; + + ShapeRef mxShapeProp; /// Axis line formatting. + TextBodyRef mxTextProp; /// Axis label text formatting. + TitleRef mxTitle; /// Axis title. + AxisDispUnitsRef mxDispUnits; /// Axis units label. + ShapeRef mxMajorGridLines; /// Major grid lines formatting. + ShapeRef mxMinorGridLines; /// Minor grid lines formatting. + NumberFormat maNumberFormat; /// Number format for axis tick labels. + OptValue< double > mofCrossesAt; /// Position on this axis where another axis crosses. + OptValue< double > mofMajorUnit; /// Unit for major tick marks on date/value axis. + OptValue< double > mofMinorUnit; /// Unit for minor tick marks on date/value axis. + OptValue< double > mofLogBase; /// Logarithmic base for logarithmic axes. + OptValue< double > mofMax; /// Maximum axis value. + OptValue< double > mofMin; /// Minimum axis value. + OptValue< sal_Int32 > monBaseTimeUnit; /// Base time unit shown on a date axis. + sal_Int32 mnAxisId; /// Unique axis identifier. + sal_Int32 mnAxisPos; /// Position of the axis (top/bottom/left/right). + sal_Int32 mnCrossAxisId; /// Identifier of a crossing axis. + sal_Int32 mnCrossBetween; /// This value axis crosses between or inside category. + sal_Int32 mnCrossMode; /// Mode this axis crosses another axis (min, max, auto). + sal_Int32 mnLabelAlign; /// Tick mark label alignment. + sal_Int32 mnLabelOffset; /// Tick mark label distance from axis. + sal_Int32 mnMajorTickMark; /// Major tick mark style. + sal_Int32 mnMajorTimeUnit; /// Time unit for major tick marks on date axis. + sal_Int32 mnMinorTickMark; /// Minor tick mark style. + sal_Int32 mnMinorTimeUnit; /// Time unit for minor tick marks on date axis. + sal_Int32 mnOrientation; /// Axis orientation (value order min to max, or max to min). + sal_Int32 mnTickLabelPos; /// Position of tick mark labels relative to the axis. + sal_Int32 mnTickLabelSkip; /// Number of tick mark labels to skip. + sal_Int32 mnTickMarkSkip; /// Number of tick marks to skip. + sal_Int32 mnTypeId; /// Type identifier of this axis. + bool mbAuto; /// True = automatic selection of text/date axis type. + bool mbDeleted; /// True = axis has been deleted manually. + bool mbNoMultiLevel; /// True = no multi-level categories supported. + + explicit AxisModel( sal_Int32 nTypeId, bool bMSO2007Doc ); + ~AxisModel(); +}; + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/chartcontextbase.hxx b/oox/inc/drawingml/chart/chartcontextbase.hxx new file mode 100644 index 000000000..b91692f9b --- /dev/null +++ b/oox/inc/drawingml/chart/chartcontextbase.hxx @@ -0,0 +1,79 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CHART_CHARTCONTEXTBASE_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_CHARTCONTEXTBASE_HXX + +#include <oox/core/fragmenthandler2.hxx> + +namespace oox::drawingml { class Shape; } + +namespace oox::drawingml::chart { + +template< typename ModelType > +class ContextBase : public ::oox::core::ContextHandler2 +{ +public: + explicit ContextBase( ::oox::core::ContextHandler2Helper& rParent, ModelType& rModel ) : + ::oox::core::ContextHandler2( rParent ), mrModel( rModel ) {} + +protected: + ModelType& mrModel; +}; + +template< typename ModelType > +class FragmentBase : public ::oox::core::FragmentHandler2 +{ +public: + explicit FragmentBase( ::oox::core::XmlFilterBase& rFilter, const OUString& rFragmentPath, ModelType& rModel ) : + ::oox::core::FragmentHandler2( rFilter, rFragmentPath, false ), mrModel( rModel ) {} + +protected: + ModelType& mrModel; +}; + +/** Help class for all contexts that have only the c:spPr child element. + */ +class ShapePrWrapperContext final : public ContextBase< Shape > +{ +public: + explicit ShapePrWrapperContext( ::oox::core::ContextHandler2Helper& rParent, Shape& rModel ); + virtual ~ShapePrWrapperContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + +struct LayoutModel; + +/** Handler for a chart layout context (c:layout element). + */ +class LayoutContext final : public ContextBase< LayoutModel > +{ +public: + explicit LayoutContext( ::oox::core::ContextHandler2Helper& rParent, LayoutModel& rModel ); + virtual ~LayoutContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/chartdrawingfragment.hxx b/oox/inc/drawingml/chart/chartdrawingfragment.hxx new file mode 100644 index 000000000..af5b16145 --- /dev/null +++ b/oox/inc/drawingml/chart/chartdrawingfragment.hxx @@ -0,0 +1,103 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CHART_CHARTDRAWINGFRAGMENT_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_CHARTDRAWINGFRAGMENT_HXX + +#include <oox/core/fragmenthandler2.hxx> +#include <oox/drawingml/shape.hxx> + +namespace oox::drawingml::chart { + + +/** Relative shape position in a chart object. */ +struct AnchorPosModel +{ + double mfX; /// X coordinate relative to chart object (0.0 to 1.0). + double mfY; /// Y coordinate relative to chart object (0.0 to 1.0). + + AnchorPosModel() : mfX( -1.0 ), mfY( -1.0 ) {} + bool isValid() const { return (0.0 <= mfX) && (mfX <= 1.0) && (0.0 <= mfY) && (mfY <= 1.0); } +}; + + +/** Absolute shape size in a chart object (in EMUs). */ +struct AnchorSizeModel : public EmuSize +{ + AnchorSizeModel() : EmuSize( -1, -1 ) {} + bool isValid() const { return (Width >= 0) && (Height >= 0); } +}; + + +/** Contains the position of a shape in the chart object. Supports different + shape anchor modes (absolute, relative). + */ +class ShapeAnchor +{ +public: + explicit ShapeAnchor( bool bRelSize ); + + /** Imports the absolute anchor size from the cdr:ext element. */ + void importExt( const AttributeList& rAttribs ); + /** Sets the relative anchor position from the cdr:from or cdr:to element. */ + void setPos( sal_Int32 nElement, sal_Int32 nParentContext, std::u16string_view rValue ); + + /** Calculates the resulting shape anchor in EMUs. */ + EmuRectangle calcAnchorRectEmu( const EmuRectangle& rChartRect ) const; + +private: + AnchorPosModel maFrom; /// Top-left position relative to chart object. + AnchorPosModel maTo; /// Bottom-right position relative to chart object. + AnchorSizeModel maSize; /// Shape size, if anchor has absolute size. + bool mbRelSize; /// True = relative size, false = absolute size. +}; + +/** Handler for a chart drawing fragment (c:userShapes root element). + */ +class ChartDrawingFragment final : public ::oox::core::FragmentHandler2 +{ +public: + explicit ChartDrawingFragment( + ::oox::core::XmlFilterBase& rFilter, + const OUString& rFragmentPath, + const css::uno::Reference< css::drawing::XShapes >& rxDrawPage, + const css::awt::Size& rChartSize, + const css::awt::Point& rShapesOffset, + bool bOleSupport ); + virtual ~ChartDrawingFragment() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; + virtual void onCharacters( const OUString& rChars ) override; + virtual void onEndElement() override; + +private: + css::uno::Reference< css::drawing::XShapes > + mxDrawPage; /// Drawing page of this sheet. + ::oox::drawingml::ShapePtr mxShape; /// Current top-level shape. + std::shared_ptr< ShapeAnchor > mxAnchor; /// Current anchor of top-level shape. + EmuRectangle maChartRectEmu; /// Position and size of the chart object for embedded shapes (in EMUs). + bool mbOleSupport; /// True = allow to insert OLE objects into the drawing page. +}; + + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/chartspaceconverter.hxx b/oox/inc/drawingml/chart/chartspaceconverter.hxx new file mode 100644 index 000000000..32f13bb0e --- /dev/null +++ b/oox/inc/drawingml/chart/chartspaceconverter.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 INCLUDED_OOX_DRAWINGML_CHART_CHARTSPACECONVERTER_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_CHARTSPACECONVERTER_HXX + +#include <drawingml/chart/converterbase.hxx> + +namespace com::sun::star { + namespace drawing { class XShapes; } +} + +namespace oox::drawingml::chart { + + +struct ChartSpaceModel; + +class ChartSpaceConverter final : public ConverterBase< ChartSpaceModel > +{ +public: + explicit ChartSpaceConverter( const ConverterRoot& rParent, ChartSpaceModel& rModel ); + virtual ~ChartSpaceConverter() override; + + /** Converts the contained OOXML chart model to a chart2 document. */ + void convertFromModel( + const css::uno::Reference< css::drawing::XShapes >& rxExternalPage, + const css::awt::Point& rChartPos ); +}; + + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/chartspacefragment.hxx b/oox/inc/drawingml/chart/chartspacefragment.hxx new file mode 100644 index 000000000..8d29fecb5 --- /dev/null +++ b/oox/inc/drawingml/chart/chartspacefragment.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CHART_CHARTSPACEFRAGMENT_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_CHARTSPACEFRAGMENT_HXX + +#include <drawingml/chart/chartcontextbase.hxx> + +namespace oox::drawingml::chart { + + +struct ChartSpaceModel; + +/** Handler for a chart fragment (c:chartSpace root element). + */ +class ChartSpaceFragment final : public FragmentBase< ChartSpaceModel > +{ +public: + explicit ChartSpaceFragment( + ::oox::core::XmlFilterBase& rFilter, + const OUString& rFragmentPath, + ChartSpaceModel& rModel ); + virtual ~ChartSpaceFragment() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/chartspacemodel.hxx b/oox/inc/drawingml/chart/chartspacemodel.hxx new file mode 100644 index 000000000..0aa564fef --- /dev/null +++ b/oox/inc/drawingml/chart/chartspacemodel.hxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CHART_CHARTSPACEMODEL_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_CHARTSPACEMODEL_HXX + +#include <oox/drawingml/shape.hxx> +#include <drawingml/chart/plotareamodel.hxx> +#include <drawingml/chart/titlemodel.hxx> + +namespace oox::drawingml::chart { + + +struct ChartSpaceModel +{ + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< TextBody > TextBodyRef; + typedef ModelRef< PlotAreaModel > PlotAreaRef; + typedef ModelRef< WallFloorModel > WallFloorRef; + typedef ModelRef< View3DModel > View3DRef; + typedef ModelRef< TitleModel > TitleRef; + typedef ModelRef< LegendModel > LegendRef; + + ShapeRef mxShapeProp; /// Chart frame formatting. + TextBodyRef mxTextProp; /// Global chart text formatting. + PlotAreaRef mxPlotArea; /// Plot area of the chart. + WallFloorRef mxFloor; /// Floor formatting in 3D charts. + WallFloorRef mxBackWall; /// Back wall formatting in 3D charts. + WallFloorRef mxSideWall; /// Side wall formatting in 3D charts. + View3DRef mxView3D; /// 3D settings. + TitleRef mxTitle; /// Chart main title. + LegendRef mxLegend; /// Chart legend. + OUString maDrawingPath; /// Path to drawing fragment with embedded shapes. + OUString maSheetPath; /// Path to embedded charts. + sal_Int32 mnDispBlanksAs; /// Mode how to display blank values. + sal_Int32 mnStyle; /// Index to default formatting. + bool mbAutoTitleDel; /// True = automatic title deleted manually. + bool mbPlotVisOnly; /// True = plot visible cells in a sheet only. + bool mbShowLabelsOverMax;/// True = show labels over chart maximum. + bool mbPivotChart; /// True = pivot chart. + + explicit ChartSpaceModel(bool bMSO2007Doc); + ~ChartSpaceModel(); +}; + + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/converterbase.hxx b/oox/inc/drawingml/chart/converterbase.hxx new file mode 100644 index 000000000..8fe637d95 --- /dev/null +++ b/oox/inc/drawingml/chart/converterbase.hxx @@ -0,0 +1,148 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CHART_CONVERTERBASE_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_CONVERTERBASE_HXX + +#include <drawingml/chart/objectformatter.hxx> + +namespace com::sun::star { + namespace awt { struct Rectangle; } + namespace awt { struct Size; } + namespace chart2 { class XChartDocument; } + namespace chart2 { class XTitle; } + namespace drawing { class XShape; } + namespace uno { class XComponentContext; } +} +namespace oox::core { class XmlFilterBase; } + +namespace oox::drawingml::chart { + +class ChartConverter; +struct ChartSpaceModel; +struct ConverterData; + + +const sal_Int32 API_PRIM_AXESSET = 0; +const sal_Int32 API_SECN_AXESSET = 1; + +const sal_Int32 API_X_AXIS = 0; +const sal_Int32 API_Y_AXIS = 1; +const sal_Int32 API_Z_AXIS = 2; + + +class ConverterRoot +{ +public: + explicit ConverterRoot( + ::oox::core::XmlFilterBase& rFilter, + ChartConverter& rChartConverter, + const ChartSpaceModel& rChartModel, + const css::uno::Reference< css::chart2::XChartDocument >& rxChartDoc, + const css::awt::Size& rChartSize ); + virtual ~ConverterRoot(); + + ConverterRoot(ConverterRoot const &) = default; + ConverterRoot(ConverterRoot &&) = default; + ConverterRoot & operator =(ConverterRoot const &) = default; + ConverterRoot & operator =(ConverterRoot &&) = default; + + /** Creates an instance for the passed service name, using the process service factory. */ + css::uno::Reference< css::uno::XInterface > + createInstance( const OUString& rServiceName ) const; + css::uno::Reference< css::uno::XComponentContext > const & + getComponentContext() const; + +protected: + /** Returns the filter object of the imported/exported document. */ + ::oox::core::XmlFilterBase& getFilter() const; + /** Returns the chart converter. */ + ChartConverter& getChartConverter() const; + /** Returns the API chart document model. */ + css::uno::Reference< css::chart2::XChartDocument > const & + getChartDocument() const; + /** Returns the position and size of the chart shape in 1/100 mm. */ + const css::awt::Size& getChartSize() const; + /** Returns the default position and size of the chart shape in 1/100 mm. */ + static css::awt::Size getDefaultPageSize() { return css::awt::Size(16000, 9000); } + /** Returns the object formatter. */ + ObjectFormatter& getFormatter() const; + + /** Registers a title object and its layout data, needed for conversion of + the title position using the old Chart1 API. */ + void registerTitleLayout( + const css::uno::Reference< css::chart2::XTitle >& rxTitle, + const ModelRef< LayoutModel >& rxLayout, ObjectType eObjType, + sal_Int32 nMainIdx, sal_Int32 nSubIdx ); + /** Converts the positions of the main title and all axis titles. */ + void convertTitlePositions(); + +private: + std::shared_ptr< ConverterData > mxData; +}; + + +/** Base class of all converter classes. Holds a reference to a model structure + of the specified type. + */ +template< typename ModelType > +class ConverterBase : public ConverterRoot +{ +public: + const ModelType& getModel() const { return mrModel; } + +protected: + explicit ConverterBase( const ConverterRoot& rParent, ModelType& rModel ) : + ConverterRoot( rParent ), mrModel( rModel ) {} + virtual ~ConverterBase() override {} + +protected: + ModelType& mrModel; +}; + + +/** A layout converter calculates positions and sizes for various chart objects. + */ +class LayoutConverter final : public ConverterBase< LayoutModel > +{ +public: + explicit LayoutConverter( const ConverterRoot& rParent, LayoutModel& rModel ); + virtual ~LayoutConverter() override; + + /** Tries to calculate the absolute position and size from the contained + OOXML layout model. Returns true, if returned rectangle is valid. */ + bool calcAbsRectangle( css::awt::Rectangle& orRect ) const; + + /** Tries to set the position and size from the contained OOXML layout model. + Returns true, if a manual position and size could be calculated. */ + bool convertFromModel( PropertySet& rPropSet ); + + /** Tries to set the position from the contained OOXML layout model. */ + void convertFromModel( + const css::uno::Reference< css::drawing::XShape >& rxShape, + double fRotationAngle ); + bool getAutoLayout() const {return mrModel.mbAutoLayout;} +}; + + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/datasourcecontext.hxx b/oox/inc/drawingml/chart/datasourcecontext.hxx new file mode 100644 index 000000000..7edb029eb --- /dev/null +++ b/oox/inc/drawingml/chart/datasourcecontext.hxx @@ -0,0 +1,94 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CHART_DATASOURCECONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_DATASOURCECONTEXT_HXX + +#include <memory> +#include <drawingml/chart/chartcontextbase.hxx> + +class SvNumberFormatter; + +namespace oox::drawingml::chart { + + +struct DataSequenceModel; + +typedef ContextBase< DataSequenceModel > DataSequenceContextBase; + + +/** Handler for a double sequence context (c:numLit, c:numRef elements). + */ +class DoubleSequenceContext final : public DataSequenceContextBase +{ +public: + explicit DoubleSequenceContext( ::oox::core::ContextHandler2Helper& rParent, DataSequenceModel& rModel ); + virtual ~DoubleSequenceContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; + virtual void onCharacters( const OUString& rChars ) override; + +private: + SvNumberFormatter* getNumberFormatter(); + +private: + sal_Int32 mnPtIndex; /// Current data point index. + std::unique_ptr<SvNumberFormatter> + mpNumberFormatter; +}; + + +/** Handler for a string sequence context (c:multiLvlStrRef, c:strLit, + c:strRef elements). + */ +class StringSequenceContext final : public DataSequenceContextBase +{ +public: + explicit StringSequenceContext( ::oox::core::ContextHandler2Helper& rParent, DataSequenceModel& rModel ); + virtual ~StringSequenceContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; + virtual void onCharacters( const OUString& rChars ) override; + +private: + sal_Int32 mnPtIndex; /// Current data point index. + bool mbReadC15; /// Allow reading extension tags data under c15 namespace. +}; + + +struct DataSourceModel; + +/** Handler for a data source context (c:bubbleSize, c:cat, c:minus, c:plus, + c:val, c:xVal, c:yVal elements). + */ +class DataSourceContext final : public ContextBase< DataSourceModel > +{ +public: + explicit DataSourceContext( ::oox::core::ContextHandler2Helper& rParent, DataSourceModel& rModel ); + virtual ~DataSourceContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/datasourceconverter.hxx b/oox/inc/drawingml/chart/datasourceconverter.hxx new file mode 100644 index 000000000..eb404e046 --- /dev/null +++ b/oox/inc/drawingml/chart/datasourceconverter.hxx @@ -0,0 +1,64 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CHART_DATASOURCECONVERTER_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_DATASOURCECONVERTER_HXX + +#include <drawingml/chart/converterbase.hxx> + +namespace com::sun::star { + namespace chart2::data { class XDataSequence; } +} + +namespace oox::drawingml::chart { + + +struct DataSequenceModel; + +class DataSequenceConverter final : public ConverterBase< DataSequenceModel > +{ +public: + explicit DataSequenceConverter( const ConverterRoot& rParent, DataSequenceModel& rModel ); + virtual ~DataSequenceConverter() override; + + /** Creates a data sequence object from the contained formula link. */ + css::uno::Reference< css::chart2::data::XDataSequence > + createDataSequence( const OUString& rRole ); +}; + + +struct DataSourceModel; + +class DataSourceConverter final : public ConverterBase< DataSourceModel > +{ +public: + explicit DataSourceConverter( const ConverterRoot& rParent, DataSourceModel& rModel ); + virtual ~DataSourceConverter() override; + + /** Creates a data sequence object from the contained series data. */ + css::uno::Reference< css::chart2::data::XDataSequence > + createDataSequence( const OUString& rRole ); +}; + + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/datatablecontext.hxx b/oox/inc/drawingml/chart/datatablecontext.hxx new file mode 100644 index 000000000..01a75c6e6 --- /dev/null +++ b/oox/inc/drawingml/chart/datatablecontext.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 <drawingml/chart/chartcontextbase.hxx> + +namespace oox::drawingml::chart +{ +struct DataTableModel; + +/** Handler for a data table context (c:dTable element). + */ +class DataTableContext final : public ContextBase<DataTableModel> +{ +public: + explicit DataTableContext(::oox::core::ContextHandler2Helper& rParent, DataTableModel& rModel); + virtual ~DataTableContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, + const AttributeList& rAttribs) override; +}; + +} // namespace oox::drawingml::chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/datatableconverter.hxx b/oox/inc/drawingml/chart/datatableconverter.hxx new file mode 100644 index 000000000..f49d908f4 --- /dev/null +++ b/oox/inc/drawingml/chart/datatableconverter.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 <drawingml/chart/converterbase.hxx> + +namespace com::sun::star::chart2 +{ +class XDiagram; +} + +namespace oox::drawingml::chart +{ +struct DataTableModel; + +class DataTableConverter final : public ConverterBase<DataTableModel> +{ +public: + explicit DataTableConverter(const ConverterRoot& rParent, DataTableModel& rModel); + virtual ~DataTableConverter() override; + + /** Converts the OOXML data table model to a chart2 diagram. */ + void convertFromModel(css::uno::Reference<css::chart2::XDiagram> const& rxDiagram); +}; + +} // namespace oox::drawingml::chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/datatablemodel.hxx b/oox/inc/drawingml/chart/datatablemodel.hxx new file mode 100644 index 000000000..5c7fe7901 --- /dev/null +++ b/oox/inc/drawingml/chart/datatablemodel.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 + +namespace oox::drawingml::chart +{ +struct DataTableModel +{ + bool mbShowHBorder : 1; /// Show Horizontal Border + bool mbShowVBorder : 1; /// Show Vertical Border + bool mbShowOutline : 1; /// Show outline + bool mbShowKeys : 1; + + DataTableModel() + : mbShowHBorder(false) + , mbShowVBorder(false) + , mbShowOutline(false) + , mbShowKeys(false) + { + } +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/objectformatter.hxx b/oox/inc/drawingml/chart/objectformatter.hxx new file mode 100644 index 000000000..9498f0484 --- /dev/null +++ b/oox/inc/drawingml/chart/objectformatter.hxx @@ -0,0 +1,153 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CHART_OBJECTFORMATTER_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_OBJECTFORMATTER_HXX + +#include <oox/helper/propertyset.hxx> +#include <oox/drawingml/drawingmltypes.hxx> +#include <oox/drawingml/chart/modelbase.hxx> + +namespace com::sun::star { + namespace chart2 { class XChartDocument; } +} + +namespace oox::core { class XmlFilterBase; } + +namespace oox::drawingml::chart { + +/** Enumerates different object types for specific automatic formatting behaviour. */ +enum ObjectType +{ + OBJECTTYPE_CHARTSPACE, /// Chart background. + OBJECTTYPE_CHARTTITLE, /// Chart title. + OBJECTTYPE_LEGEND, /// Legend. + OBJECTTYPE_PLOTAREA2D, /// Plot area containing axes and data series in 2D charts. + OBJECTTYPE_PLOTAREA3D, /// Plot area containing axes and data series in 3D charts. + OBJECTTYPE_WALL, /// Background and side wall in 3D charts. + OBJECTTYPE_FLOOR, /// Floor in 3D charts. + OBJECTTYPE_AXIS, /// Axis line, labels, tick marks. + OBJECTTYPE_AXISTITLE, /// Axis title. + OBJECTTYPE_AXISUNIT, /// Axis unit label. + OBJECTTYPE_MAJORGRIDLINE, /// Axis major grid line. + OBJECTTYPE_MINORGRIDLINE, /// Axis minor grid line. + OBJECTTYPE_LINEARSERIES2D, /// Linear series in 2D line/radarline/scatter charts. + OBJECTTYPE_FILLEDSERIES2D, /// Filled series in 2D bar/area/radararea/bubble/pie/surface charts. + OBJECTTYPE_FILLEDSERIES3D, /// Filled series in 3D charts. + OBJECTTYPE_DATALABEL, /// Labels for data points. + OBJECTTYPE_TRENDLINE, /// Data series trend line. + OBJECTTYPE_TRENDLINELABEL, /// Trend line label. + OBJECTTYPE_ERRORBAR, /// Data series error indicator line. + OBJECTTYPE_SERLINE, /// Data point connector lines. + OBJECTTYPE_LEADERLINE, /// Leader lines between pie slice and data label. + OBJECTTYPE_DROPLINE, /// Drop lines between data points and X axis. + OBJECTTYPE_HILOLINE, /// High/low lines in line/stock charts. + OBJECTTYPE_UPBAR, /// Up-bar in line/stock charts. + OBJECTTYPE_DOWNBAR, /// Down-bar in line/stock charts. + OBJECTTYPE_DATATABLE /// Data table. +}; + +struct ChartSpaceModel; +struct ObjectFormatterData; +struct PictureOptionsModel; + +class ObjectFormatter +{ +public: + explicit ObjectFormatter( + const ::oox::core::XmlFilterBase& rFilter, + const css::uno::Reference< css::chart2::XChartDocument >& rxChartDoc, + const ChartSpaceModel& rChartSpace ); + ~ObjectFormatter(); + + /** Sets the maximum series index used for color cycling/fading. */ + void setMaxSeriesIndex( sal_Int32 nMaxSeriesIdx ); + /** Returns the current maximum series index used for color cycling/fading. */ + sal_Int32 getMaxSeriesIndex() const; + + /** Sets frame formatting properties to the passed property set. */ + void convertFrameFormatting( + PropertySet& rPropSet, + const ModelRef< Shape >& rxShapeProp, + ObjectType eObjType, + sal_Int32 nSeriesIdx = -1 ); + + /** Sets frame formatting properties to the passed property set. */ + void convertFrameFormatting( + PropertySet& rPropSet, + const ModelRef< Shape >& rxShapeProp, + const PictureOptionsModel& rPicOptions, + ObjectType eObjType, + sal_Int32 nSeriesIdx = -1 ); + + /** Sets text formatting properties to the passed property set. */ + void convertTextFormatting( + PropertySet& rPropSet, + const ModelRef< TextBody >& rxTextProp, + ObjectType eObjType ); + + /** Sets frame/text formatting properties to the passed property set. */ + void convertFormatting( + PropertySet& rPropSet, + const ModelRef< Shape >& rxShapeProp, + const ModelRef< TextBody >& rxTextProp, + ObjectType eObjType ); + + /** Sets text formatting properties to the passed property set. */ + void convertTextFormatting( + PropertySet& rPropSet, + const TextCharacterProperties& rTextProps, + ObjectType eObjType ); + + /** Sets text rotation properties to the passed property set. */ + static void convertTextRotation( + PropertySet& rPropSet, + const ModelRef< TextBody >& rxTextProp, + bool bSupportsStacked, sal_Int32 nDefaultRotation = 0); + + /** Sets text wrap properties to the passed property set. */ + static void convertTextWrap( + PropertySet& rPropSet, + const ModelRef< TextBody >& rxTextProp); + + /** Sets number format properties to the passed property set. */ + void convertNumberFormat( + PropertySet& rPropSet, + const NumberFormat& rNumberFormat, + bool bAxis, + bool bShowPercent = false ); + + /** Sets automatic fill properties to the passed property set. */ + void convertAutomaticFill( + PropertySet& rPropSet, + ObjectType eObjType, + sal_Int32 nSeriesIdx ); + + /** Returns true, if the passed shape properties have automatic fill mode. */ + static bool isAutomaticFill( const ModelRef< Shape >& rxShapeProp ); + +private: + std::shared_ptr< ObjectFormatterData > mxData; +}; + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/plotareacontext.hxx b/oox/inc/drawingml/chart/plotareacontext.hxx new file mode 100644 index 000000000..2b3fae932 --- /dev/null +++ b/oox/inc/drawingml/chart/plotareacontext.hxx @@ -0,0 +1,74 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CHART_PLOTAREACONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_PLOTAREACONTEXT_HXX + +#include <drawingml/chart/chartcontextbase.hxx> + +namespace oox::drawingml::chart { + + +struct View3DModel; + +/** Handler for a chart plot area context (c:plotArea element). + */ +class View3DContext final : public ContextBase< View3DModel > +{ +public: + explicit View3DContext( ::oox::core::ContextHandler2Helper& rParent, View3DModel& rModel ); + virtual ~View3DContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +struct WallFloorModel; + +/** Handler for a chart wall/floor context (c:backWall, c:floor, c:sideWall + elements). + */ +class WallFloorContext final : public ContextBase< WallFloorModel > +{ +public: + explicit WallFloorContext( ::oox::core::ContextHandler2Helper& rParent, WallFloorModel& rModel ); + virtual ~WallFloorContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + +struct PlotAreaModel; + +/** Handler for a chart plot area context (c:plotArea element). + */ +class PlotAreaContext final : public ContextBase< PlotAreaModel > +{ +public: + explicit PlotAreaContext( ::oox::core::ContextHandler2Helper& rParent, PlotAreaModel& rModel ); + virtual ~PlotAreaContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/plotareaconverter.hxx b/oox/inc/drawingml/chart/plotareaconverter.hxx new file mode 100644 index 000000000..b520c6b48 --- /dev/null +++ b/oox/inc/drawingml/chart/plotareaconverter.hxx @@ -0,0 +1,92 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CHART_PLOTAREACONVERTER_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_PLOTAREACONVERTER_HXX + +#include <drawingml/chart/converterbase.hxx> + +namespace com::sun::star { + namespace chart2 { class XDiagram; } +} + +namespace oox::drawingml::chart { + + +struct View3DModel; +class TypeGroupConverter; + +class View3DConverter final : public ConverterBase< View3DModel > +{ +public: + explicit View3DConverter( const ConverterRoot& rParent, View3DModel& rModel ); + virtual ~View3DConverter() override; + + /** Converts the OOXML plot area model to a chart2 diagram. */ + void convertFromModel( + const css::uno::Reference< css::chart2::XDiagram >& rxDiagram, + TypeGroupConverter const & rTypeGroup ); +}; + + +struct WallFloorModel; + +class WallFloorConverter final : public ConverterBase< WallFloorModel > +{ +public: + explicit WallFloorConverter( const ConverterRoot& rParent, WallFloorModel& rModel ); + virtual ~WallFloorConverter() override; + + /** Converts the OOXML wall/floor model to a chart2 diagram. */ + void convertFromModel( + const css::uno::Reference< css::chart2::XDiagram >& rxDiagram, + ObjectType eObjType ); +}; + +struct PlotAreaModel; + +class PlotAreaConverter final : public ConverterBase< PlotAreaModel > +{ +public: + explicit PlotAreaConverter( const ConverterRoot& rParent, PlotAreaModel& rModel ); + virtual ~PlotAreaConverter() override; + + /** Converts the OOXML plot area model to a chart2 diagram. */ + void convertFromModel( View3DModel& rView3DModel ); + /** Converts the manual plot area position and size, if set. */ + void convertPositionFromModel(); + + /** Returns the automatic chart title if the chart contains only one series. */ + const OUString& getAutomaticTitle() const { return maAutoTitle; } + /** Returns true, if chart type supports wall and floor format in 3D mode. */ + bool isWall3dChart() const { return mbWall3dChart; } + +private: + OUString maAutoTitle; + bool mb3dChart; + bool mbWall3dChart; + bool mbPieChart; +}; + + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/plotareamodel.hxx b/oox/inc/drawingml/chart/plotareamodel.hxx new file mode 100644 index 000000000..119900953 --- /dev/null +++ b/oox/inc/drawingml/chart/plotareamodel.hxx @@ -0,0 +1,77 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CHART_PLOTAREAMODEL_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_PLOTAREAMODEL_HXX + +#include <oox/drawingml/shape.hxx> +#include <drawingml/chart/axismodel.hxx> +#include <drawingml/chart/seriesmodel.hxx> +#include <drawingml/chart/typegroupmodel.hxx> +#include <drawingml/chart/datatablemodel.hxx> + +namespace oox::drawingml::chart { + +struct View3DModel +{ + OptValue< sal_Int32 > monHeightPercent; /// Height of the 3D view, relative to chart width. + OptValue< sal_Int32 > monRotationX; /// Horizontal rotation in degrees. + OptValue< sal_Int32 > monRotationY; /// Vertical rotation in degrees. + sal_Int32 mnDepthPercent; /// Depth of the 3D view, relative to chart width. + sal_Int32 mnPerspective; /// Eye distance to the 3D objects. + bool mbRightAngled; /// True = right-angled axes in 3D view. + + explicit View3DModel(bool bMSO2007Doc); +}; + +struct WallFloorModel +{ + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< PictureOptionsModel > PictureOptionsRef; + + ShapeRef mxShapeProp; /// Wall/floor frame formatting. + PictureOptionsRef mxPicOptions; /// Fill bitmap settings. + + explicit WallFloorModel(); + ~WallFloorModel(); +}; + +struct PlotAreaModel +{ + typedef ModelVector< TypeGroupModel > TypeGroupVector; + typedef ModelVector< AxisModel > AxisVector; + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< LayoutModel > LayoutRef; + typedef ModelRef< DataTableModel > DataTableRef; + + TypeGroupVector maTypeGroups; /// All chart type groups contained in the chart. + AxisVector maAxes; /// All axes contained in the chart. + ShapeRef mxShapeProp; /// Plot area frame formatting. + LayoutRef mxLayout; /// Layout/position of the plot area. + DataTableRef mxDataTable; /// Data table of the plot area. + + explicit PlotAreaModel(); + ~PlotAreaModel(); +}; + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/seriescontext.hxx b/oox/inc/drawingml/chart/seriescontext.hxx new file mode 100644 index 000000000..d3fe3bb05 --- /dev/null +++ b/oox/inc/drawingml/chart/seriescontext.hxx @@ -0,0 +1,245 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CHART_SERIESCONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_SERIESCONTEXT_HXX + +#include <drawingml/chart/chartcontextbase.hxx> + +namespace oox::drawingml::chart { + + +struct DataLabelModel; + +/** Handler for a chart data point label context (c:dLbl element). + */ +class DataLabelContext final : public ContextBase< DataLabelModel > +{ +public: + explicit DataLabelContext( ::oox::core::ContextHandler2Helper& rParent, DataLabelModel& rModel ); + virtual ~DataLabelContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; + virtual void onCharacters( const OUString& rChars ) override; +}; + + +struct DataLabelsModel; + +/** Handler for a chart data point label context (c:dLbls element). + */ +class DataLabelsContext final : public ContextBase< DataLabelsModel > +{ +public: + explicit DataLabelsContext( ::oox::core::ContextHandler2Helper& rParent, DataLabelsModel& rModel ); + virtual ~DataLabelsContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; + virtual void onCharacters( const OUString& rChars ) override; +}; + + +struct PictureOptionsModel; + +/** Handler for fill bitmap settings (c:pictureOptions element). + */ +class PictureOptionsContext final : public ContextBase< PictureOptionsModel > +{ +public: + explicit PictureOptionsContext( ::oox::core::ContextHandler2Helper& rParent, PictureOptionsModel& rModel ); + virtual ~PictureOptionsContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +struct ErrorBarModel; + +/** Handler for a series error bar context (c:errBars element). + */ +class ErrorBarContext final : public ContextBase< ErrorBarModel > +{ +public: + explicit ErrorBarContext( ::oox::core::ContextHandler2Helper& rParent, ErrorBarModel& rModel ); + virtual ~ErrorBarContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +struct TrendlineLabelModel; + +/** Handler for a series trendline label context (c:trendlineLbl element). + */ +class TrendlineLabelContext final : public ContextBase< TrendlineLabelModel > +{ +public: + explicit TrendlineLabelContext( ::oox::core::ContextHandler2Helper& rParent, TrendlineLabelModel& rModel ); + virtual ~TrendlineLabelContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +struct TrendlineModel; + +/** Handler for a series trendline context (c:trendline element). + */ +class TrendlineContext final : public ContextBase< TrendlineModel > +{ +public: + explicit TrendlineContext( ::oox::core::ContextHandler2Helper& rParent, TrendlineModel& rModel ); + virtual ~TrendlineContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; + virtual void onCharacters( const OUString& rChars ) override; +}; + + +struct DataPointModel; + +/** Handler for a chart data point context (c:dPt element). + */ +class DataPointContext final : public ContextBase< DataPointModel > +{ +public: + explicit DataPointContext( ::oox::core::ContextHandler2Helper& rParent, DataPointModel& rModel ); + virtual ~DataPointContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +struct SeriesModel; + +/** Handler base class for chart data series contexts (c:ser element). + */ +class SeriesContextBase : public ContextBase< SeriesModel > +{ +public: + explicit SeriesContextBase( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel ); + virtual ~SeriesContextBase() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +/** Handler for a data series context for area chart types (c:ser element). + */ +class AreaSeriesContext final : public SeriesContextBase +{ +public: + explicit AreaSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel ); + virtual ~AreaSeriesContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +/** Handler for a data series context for bar chart types (c:ser element). + */ +class BarSeriesContext final : public SeriesContextBase +{ +public: + explicit BarSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel ); + virtual ~BarSeriesContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +/** Handler for a data series context for bubble chart types (c:ser element). + */ +class BubbleSeriesContext final : public SeriesContextBase +{ +public: + explicit BubbleSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel ); + virtual ~BubbleSeriesContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +/** Handler for a data series context for line and stock chart types (c:ser + element). + */ +class LineSeriesContext final : public SeriesContextBase +{ +public: + explicit LineSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel ); + virtual ~LineSeriesContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +/** Handler for a data series context for pie and doughnut chart types (c:ser + element). + */ +class PieSeriesContext final : public SeriesContextBase +{ +public: + explicit PieSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel ); + virtual ~PieSeriesContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +/** Handler for a data series context for radar chart types (c:ser element). + */ +class RadarSeriesContext final : public SeriesContextBase +{ +public: + explicit RadarSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel ); + virtual ~RadarSeriesContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +/** Handler for a data series context for scatter chart types (c:ser element). + */ +class ScatterSeriesContext final : public SeriesContextBase +{ +public: + explicit ScatterSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel ); + virtual ~ScatterSeriesContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +/** Handler for a data series context for scatter chart types (c:ser element). + */ +class SurfaceSeriesContext final : public SeriesContextBase +{ +public: + explicit SurfaceSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel ); + virtual ~SurfaceSeriesContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/seriesconverter.hxx b/oox/inc/drawingml/chart/seriesconverter.hxx new file mode 100644 index 000000000..c8cca31d5 --- /dev/null +++ b/oox/inc/drawingml/chart/seriesconverter.hxx @@ -0,0 +1,147 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CHART_SERIESCONVERTER_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_SERIESCONVERTER_HXX + +#include <drawingml/chart/converterbase.hxx> +#include <drawingml/chart/seriesmodel.hxx> + +namespace com::sun::star { + namespace chart2 { class XDataSeries; } + namespace chart2::data { class XLabeledDataSequence; } +} + +namespace oox::drawingml::chart { + +class TypeGroupConverter; + +// #i66858# enable this when Chart2 supports smoothed lines per data series +#define OOX_CHART_SMOOTHED_PER_SERIES 0 + + +class DataLabelConverter final : public ConverterBase< DataLabelModel > +{ +public: + explicit DataLabelConverter( const ConverterRoot& rParent, DataLabelModel& rModel ); + virtual ~DataLabelConverter() override; + + /** Converts OOXML data label settings for the passed data point. */ + void convertFromModel( + const css::uno::Reference< css::chart2::XDataSeries >& rxDataSeries, + const TypeGroupConverter& rTypeGroup ); +}; + + +class DataLabelsConverter final : public ConverterBase< DataLabelsModel > +{ +public: + explicit DataLabelsConverter( const ConverterRoot& rParent, DataLabelsModel& rModel ); + virtual ~DataLabelsConverter() override; + + /** Converts OOXML data label settings for the passed data series. */ + void convertFromModel( + const css::uno::Reference< css::chart2::XDataSeries >& rxDataSeries, + const TypeGroupConverter& rTypeGroup ); +}; + + +class ErrorBarConverter final : public ConverterBase< ErrorBarModel > +{ +public: + explicit ErrorBarConverter( const ConverterRoot& rParent, ErrorBarModel& rModel ); + virtual ~ErrorBarConverter() override; + + /** Converts an OOXML errorbar and inserts it into the passed data series. */ + void convertFromModel( + const css::uno::Reference< css::chart2::XDataSeries >& rxDataSeries ); + +private: + css::uno::Reference< css::chart2::data::XLabeledDataSequence > + createLabeledDataSequence( ErrorBarModel::SourceType eSourceType ); +}; + + +class TrendlineLabelConverter final : public ConverterBase< TrendlineLabelModel > +{ +public: + explicit TrendlineLabelConverter( const ConverterRoot& rParent, TrendlineLabelModel& rModel ); + virtual ~TrendlineLabelConverter() override; + + /** Converts the OOXML trendline label. */ + void convertFromModel( PropertySet& rPropSet ); +}; + + +class TrendlineConverter final : public ConverterBase< TrendlineModel > +{ +public: + explicit TrendlineConverter( const ConverterRoot& rParent, TrendlineModel& rModel ); + virtual ~TrendlineConverter() override; + + /** Converts an OOXML trendline and inserts it into the passed data series. */ + void convertFromModel( + const css::uno::Reference< css::chart2::XDataSeries >& rxDataSeries ); +}; + + +class DataPointConverter final : public ConverterBase< DataPointModel > +{ +public: + explicit DataPointConverter( const ConverterRoot& rParent, DataPointModel& rModel ); + virtual ~DataPointConverter() override; + + /** Converts settings for a data point in the passed series. */ + void convertFromModel( + const css::uno::Reference< css::chart2::XDataSeries >& rxDataSeries, + const TypeGroupConverter& rTypeGroup, + const SeriesModel& rSeries ); +}; + + +class SeriesConverter final : public ConverterBase< SeriesModel > +{ +public: + explicit SeriesConverter( const ConverterRoot& rParent, SeriesModel& rModel ); + virtual ~SeriesConverter() override; + + /** Creates a labeled data sequence object from category data link. */ + css::uno::Reference< css::chart2::data::XLabeledDataSequence > + createCategorySequence( const OUString& rRole ); + /** Creates a labeled data sequence object from value data link. */ + css::uno::Reference< css::chart2::data::XLabeledDataSequence > + createValueSequence( const OUString& rRole ); + /** Creates a data series object with initialized source links. */ + css::uno::Reference< css::chart2::XDataSeries > + createDataSeries( const TypeGroupConverter& rTypeGroup, bool bVaryColorsByPoint ); + +private: + css::uno::Reference< css::chart2::data::XLabeledDataSequence > + createLabeledDataSequence( + SeriesModel::SourceType eSourceType, + const OUString& rRole, + bool bUseTextLabel ); +}; + + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/seriesmodel.hxx b/oox/inc/drawingml/chart/seriesmodel.hxx new file mode 100644 index 000000000..34656a6da --- /dev/null +++ b/oox/inc/drawingml/chart/seriesmodel.hxx @@ -0,0 +1,223 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CHART_SERIESMODEL_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_SERIESMODEL_HXX + +#include <oox/drawingml/chart/datasourcemodel.hxx> +#include <drawingml/chart/titlemodel.hxx> + +namespace oox::drawingml::chart { + +struct DataLabelModelBase +{ + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< TextBody > TextBodyRef; + + ShapeRef mxShapeProp; /// Data label frame formatting. + TextBodyRef mxTextProp; /// Data label text formatting. + NumberFormat maNumberFormat; /// Number format for numeric data labels. + OptValue< OUString > moaSeparator;/// Separator between label components. + OptValue< sal_Int32 > monLabelPos; /// Data label position. + OptValue< bool > mobShowBubbleSize; /// True = show size of bubbles in bubble charts. + OptValue< bool > mobShowCatName; /// True = show category name of data points. + OptValue< bool > mobShowLegendKey; /// True = show legend key of data series. + OptValue< bool > mobShowPercent; /// True = show percentual value in pie/doughnut charts. + OptValue< bool > mobShowSerName; /// True = show series name. + OptValue< bool > mobShowVal; /// True = show data point value. + + /// True = the value from the <c15:datalabelsRange> corresponding to the + /// index of this label is used as the label text. + OptValue< bool > mobShowDataLabelsRange; + bool mbDeleted; /// True = data label(s) deleted. + + explicit DataLabelModelBase(bool bMSO2007Doc); + ~DataLabelModelBase(); +}; + +struct DataLabelsModel; + +struct DataLabelModel : public DataLabelModelBase +{ + typedef ModelRef< LayoutModel > LayoutRef; + typedef ModelRef< TextModel > TextRef; + + LayoutRef mxLayout; /// Layout/position of the data point label frame. + TextRef mxText; /// Manual or linked text for this data point label. + const DataLabelsModel& mrParent; /// Reference to the labels container. + sal_Int32 mnIndex; /// Data point index for this data label. + + explicit DataLabelModel(const DataLabelsModel& rParent, bool bMSO2007Doc); + ~DataLabelModel(); +}; + +struct DataLabelsModel : public DataLabelModelBase +{ + typedef ModelVector< DataLabelModel > DataLabelVector; + typedef ModelRef< Shape > ShapeRef; + + DataLabelVector maPointLabels; /// Settings for individual data point labels. + ShapeRef mxLeaderLines; /// Formatting of connector lines between data points and labels. + + /// Labels source (owned by SeriesModel's DataSourceMap) + const DataSourceModel* mpLabelsSource; + bool mbShowLeaderLines; /// True = show connector lines between data points and labels. + + explicit DataLabelsModel(bool bMSO2007Doc); + ~DataLabelsModel(); +}; + +struct PictureOptionsModel +{ + double mfStackUnit; /// Bitmap stacking unit. + sal_Int32 mnPictureFormat; /// Bitmap mode (stretch/tile). + bool mbApplyToFront; /// True = draw picture at front/back side of 3D data points. + bool mbApplyToSides; /// True = draw picture at left/right side of 3D data points. + bool mbApplyToEnd; /// True = draw picture at top/bottom side of 3D data points. + + explicit PictureOptionsModel(bool bMSO2007Doc); +}; + +struct ErrorBarModel +{ + enum SourceType + { + PLUS, /// Plus error bar values. + MINUS /// Minus error bar values. + }; + + typedef ModelMap< SourceType, DataSourceModel > DataSourceMap; + typedef ModelRef< Shape > ShapeRef; + + DataSourceMap maSources; /// Source ranges for manual error bar values. + ShapeRef mxShapeProp; /// Error line formatting. + double mfValue; /// Fixed value for several error bar types. + sal_Int32 mnDirection; /// Direction of the error bars (x/y). + sal_Int32 mnTypeId; /// Type of the error bars (plus/minus/both). + sal_Int32 mnValueType; /// Type of the values. + bool mbNoEndCap; /// True = no end cap at error bar lines. + + explicit ErrorBarModel(bool bMSO2007Doc); + ~ErrorBarModel(); +}; + +struct TrendlineLabelModel +{ + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< TextBody > TextBodyRef; + typedef ModelRef< LayoutModel > LayoutRef; + typedef ModelRef< TextModel > TextRef; + + ShapeRef mxShapeProp; /// Label frame formatting. + TextBodyRef mxTextProp; /// Label text formatting. + LayoutRef mxLayout; /// Layout/position of the frame. + TextRef mxText; /// Text source of the label. + NumberFormat maNumberFormat; /// Number format for coefficients. + + explicit TrendlineLabelModel(); + ~TrendlineLabelModel(); +}; + +struct TrendlineModel +{ + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< TrendlineLabelModel > TrendlineLabelRef; + + ShapeRef mxShapeProp; /// Trendline formatting. + TrendlineLabelRef mxLabel; /// Trendline label text object. + OUString maName; /// User-defined name of the trendline. + OptValue< double > mfBackward; /// Size of trendline before first data point. + OptValue< double > mfForward; /// Size of trendline behind last data point. + OptValue< double > mfIntercept; /// Crossing point with Y axis. + sal_Int32 mnOrder; /// Polynomial order in range [2, 6]. + sal_Int32 mnPeriod; /// Moving average period in range [2, 255]. + sal_Int32 mnTypeId; /// Type of the trendline. + bool mbDispEquation; /// True = show equation of the trendline. + bool mbDispRSquared; /// True = show R-squared of the trendline. + + explicit TrendlineModel(bool bMSO2007Doc); + ~TrendlineModel(); +}; + +struct DataPointModel +{ + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< PictureOptionsModel > PictureOptionsRef; + + ShapeRef mxShapeProp; /// Data point formatting. + PictureOptionsRef mxPicOptions; /// Fill bitmap settings. + ShapeRef mxMarkerProp; /// Data point marker formatting. + OptValue< sal_Int32 > monExplosion; /// Pie slice moved from pie center. + OptValue< sal_Int32 > monMarkerSize; /// Size of the series line marker (2...72). + OptValue< sal_Int32 > monMarkerSymbol; /// Series line marker symbol. + OptValue< bool > mobBubble3d; /// True = show bubbles with 3D shade. + sal_Int32 mnIndex; /// Unique data point index. + bool mbInvertNeg; /// True = invert negative data points (not derived from series!). + + explicit DataPointModel(bool bMSO2007Doc); + ~DataPointModel(); +}; + +struct SeriesModel +{ + enum SourceType + { + CATEGORIES, /// Data point categories. + VALUES, /// Data point values. + POINTS, /// Data point size (e.g. bubble size in bubble charts). + DATALABELS, /// Data point labels. + }; + + typedef ModelMap< SourceType, DataSourceModel > DataSourceMap; + typedef ModelVector< ErrorBarModel > ErrorBarVector; + typedef ModelVector< TrendlineModel > TrendlineVector; + typedef ModelVector< DataPointModel > DataPointVector; + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< PictureOptionsModel > PictureOptionsRef; + typedef ModelRef< TextModel > TextRef; + typedef ModelRef< DataLabelsModel > DataLabelsRef; + + DataSourceMap maSources; /// Series source ranges. + ErrorBarVector maErrorBars; /// All error bars of this series. + TrendlineVector maTrendlines; /// All trendlines of this series. + DataPointVector maPoints; /// Explicit formatted data points. + ShapeRef mxShapeProp; /// Series formatting. + PictureOptionsRef mxPicOptions; /// Fill bitmap settings. + ShapeRef mxMarkerProp; /// Data point marker formatting. + TextRef mxText; /// Series title source. + DataLabelsRef mxLabels; /// Data point label settings for all points. + OptValue< sal_Int32 > monShape; /// 3D bar shape type. + sal_Int32 mnExplosion; /// Pie slice moved from pie center. + sal_Int32 mnIndex; /// Series index used for automatic formatting. + sal_Int32 mnMarkerSize; /// Size of the series line marker (2...72). + sal_Int32 mnMarkerSymbol; /// Series line marker symbol. + sal_Int32 mnOrder; /// Series order. + bool mbBubble3d; /// True = show bubbles with 3D shade. + bool mbInvertNeg; /// True = invert negative data points. + bool mbSmooth; /// True = smooth series line. + + explicit SeriesModel(bool bMSO2007Doc); + ~SeriesModel(); +}; + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/titlecontext.hxx b/oox/inc/drawingml/chart/titlecontext.hxx new file mode 100644 index 000000000..cb7383a7e --- /dev/null +++ b/oox/inc/drawingml/chart/titlecontext.hxx @@ -0,0 +1,87 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CHART_TITLECONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_TITLECONTEXT_HXX + +#include <drawingml/chart/chartcontextbase.hxx> + +namespace oox::drawingml::chart { + + +struct TextModel; + +/** Handler for a chart text context (c:tx element). + */ +class TextContext final : public ContextBase< TextModel > +{ +public: + explicit TextContext( ::oox::core::ContextHandler2Helper& rParent, TextModel& rModel ); + virtual ~TextContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; + virtual void onCharacters( const OUString& rChars ) override; +}; + + +struct TitleModel; + +/** Handler for a chart title context (c:title element). + */ +class TitleContext final : public ContextBase< TitleModel > +{ +public: + explicit TitleContext( ::oox::core::ContextHandler2Helper& rParent, TitleModel& rModel ); + virtual ~TitleContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + +struct LegendEntryModel; + +/** Handler for a chart legend entry context (c:legendEntry element). + */ +class LegendEntryContext final : public ContextBase< LegendEntryModel > +{ +public: + explicit LegendEntryContext( ::oox::core::ContextHandler2Helper& rParent, LegendEntryModel& rModel ); + virtual ~LegendEntryContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + +struct LegendModel; + +/** Handler for a chart legend context (c:legend element). + */ +class LegendContext final : public ContextBase< LegendModel > +{ +public: + explicit LegendContext( ::oox::core::ContextHandler2Helper& rParent, LegendModel& rModel ); + virtual ~LegendContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/titleconverter.hxx b/oox/inc/drawingml/chart/titleconverter.hxx new file mode 100644 index 000000000..d25aec653 --- /dev/null +++ b/oox/inc/drawingml/chart/titleconverter.hxx @@ -0,0 +1,101 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CHART_TITLECONVERTER_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_TITLECONVERTER_HXX + +#include <drawingml/chart/converterbase.hxx> + +namespace com::sun::star { + namespace chart2 { class XDiagram; } + namespace chart2 { class XFormattedString; } + namespace chart2 { class XTitled; } + namespace chart2::data { class XDataSequence; } +} + +namespace oox::drawingml { struct TextCharacterProperties; } + +namespace oox::drawingml::chart { + + +struct TextModel; + +class TextConverter final : public ConverterBase< TextModel > +{ +public: + explicit TextConverter( const ConverterRoot& rParent, TextModel& rModel ); + virtual ~TextConverter() override; + + /** Creates a data sequence object from the contained text data. */ + css::uno::Reference< css::chart2::data::XDataSequence > + createDataSequence( const OUString& rRole ); + /** Creates a sequence of formatted string objects. */ + css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > > + createStringSequence( + const OUString& rDefaultText, + const ModelRef< TextBody >& rxTextProp, + ObjectType eObjType ); + +private: + css::uno::Reference< css::chart2::XFormattedString > + appendFormattedString( + ::std::vector< css::uno::Reference< css::chart2::XFormattedString > >& orStringVec, + const OUString& rString, + bool bAddNewLine ) const; +}; + + +struct TitleModel; + +class TitleConverter final : public ConverterBase< TitleModel > +{ +public: + explicit TitleConverter( const ConverterRoot& rParent, TitleModel& rModel ); + virtual ~TitleConverter() override; + + /** Creates a title text object and attaches it at the passed interface. */ + void convertFromModel( + const css::uno::Reference< css::chart2::XTitled >& rxTitled, + const OUString& rAutoTitle, ObjectType eObjType, + sal_Int32 nMainIdx = -1, sal_Int32 nSubIdx = -1 ); +}; + + +struct LegendModel; + +class LegendConverter final : public ConverterBase< LegendModel > +{ +public: + explicit LegendConverter( const ConverterRoot& rParent, LegendModel& rModel ); + virtual ~LegendConverter() override; + + /** Creates a legend object and attaches it at the passed diagram. */ + void convertFromModel( + const css::uno::Reference< css::chart2::XDiagram >& rxDiagram ); + +private: + void legendEntriesFormatting(const css::uno::Reference<css::chart2::XDiagram>& rxDiagram); +}; + + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/titlemodel.hxx b/oox/inc/drawingml/chart/titlemodel.hxx new file mode 100644 index 000000000..3aea5b445 --- /dev/null +++ b/oox/inc/drawingml/chart/titlemodel.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 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CHART_TITLEMODEL_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_TITLEMODEL_HXX + +#include <oox/drawingml/shape.hxx> +#include <oox/drawingml/chart/datasourcemodel.hxx> + +namespace oox::drawingml::chart { + +struct TextModel +{ + typedef ModelRef< DataSequenceModel > DataSequenceRef; + typedef ModelRef< TextBody > TextBodyRef; + + DataSequenceRef mxDataSeq; /// The string data or formula link of this text. + TextBodyRef mxTextBody; /// Rich-formatted literal text (for title objects only). + + explicit TextModel(); + ~TextModel(); +}; + +struct TitleModel +{ + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< TextBody > TextBodyRef; + typedef ModelRef< LayoutModel > LayoutRef; + typedef ModelRef< TextModel > TextRef; + + ShapeRef mxShapeProp; /// Title shape formatting. + TextBodyRef mxTextProp; /// Title text formatting. + LayoutRef mxLayout; /// Layout/position of the frame. + TextRef mxText; /// Text source of the title. + bool mbOverlay; /// True = title may overlay other objects. + sal_Int32 mnDefaultRotation; + + explicit TitleModel(sal_Int32 nDefaultRotation = 0); + ~TitleModel(); +}; + +struct LegendEntryModel +{ + sal_Int32 mnLegendEntryIdx; /// Legend entry index. + bool mbLabelDeleted; /// True = legend label deleted. + + LegendEntryModel(); +}; + +struct LegendModel +{ + typedef ModelVector< LegendEntryModel > LegendEntryVector; + typedef ModelRef< Shape > ShapeRef; + typedef ModelRef< TextBody > TextBodyRef; + typedef ModelRef< LayoutModel > LayoutRef; + + LegendEntryVector maLegendEntries; /// Legend entries formatting. + ShapeRef mxShapeProp; /// Legend shape formatting. + TextBodyRef mxTextProp; /// Legend text formatting. + LayoutRef mxLayout; /// Layout/position of the legend. + sal_Int32 mnPosition; /// Legend position. + bool mbOverlay; /// True = legend may overlay other objects. + + explicit LegendModel(); + ~LegendModel(); +}; + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/typegroupcontext.hxx b/oox/inc/drawingml/chart/typegroupcontext.hxx new file mode 100644 index 000000000..5d5306d31 --- /dev/null +++ b/oox/inc/drawingml/chart/typegroupcontext.hxx @@ -0,0 +1,149 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CHART_TYPEGROUPCONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_TYPEGROUPCONTEXT_HXX + +#include <drawingml/chart/chartcontextbase.hxx> + +namespace oox::drawingml::chart { + + +struct UpDownBarsModel; + +/** Handler for an up/down bars context (c:upDownBars element). + */ +class UpDownBarsContext final : public ContextBase< UpDownBarsModel > +{ +public: + explicit UpDownBarsContext( ::oox::core::ContextHandler2Helper& rParent, UpDownBarsModel& rModel ); + virtual ~UpDownBarsContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +struct TypeGroupModel; +typedef ContextBase< TypeGroupModel > TypeGroupContextBase; + + +/** Handler for area type group contexts (c:area3DChart, c:areaChart elements). + */ +class AreaTypeGroupContext final : public TypeGroupContextBase +{ +public: + explicit AreaTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel ); + virtual ~AreaTypeGroupContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +/** Handler for bar type group contexts (c:bar3DChart, c:barChart elements). + */ +class BarTypeGroupContext final : public TypeGroupContextBase +{ +public: + explicit BarTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel ); + virtual ~BarTypeGroupContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +/** Handler for bubble type group context (c:bubbleChart element). + */ +class BubbleTypeGroupContext final : public TypeGroupContextBase +{ +public: + explicit BubbleTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel ); + virtual ~BubbleTypeGroupContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +/** Handler for line type group contexts (c:line3DChart, c:lineChart, + c:stockChart elements). + */ +class LineTypeGroupContext final : public TypeGroupContextBase +{ +public: + explicit LineTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel ); + virtual ~LineTypeGroupContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +/** Handler for pie type group contexts (c:doughnutChart, c:ofPieChart, + c:pie3DChart, c:pieChart elements). + */ +class PieTypeGroupContext final : public TypeGroupContextBase +{ +public: + explicit PieTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel ); + virtual ~PieTypeGroupContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +/** Handler for radar type group context (c:radarChart element). + */ +class RadarTypeGroupContext final : public TypeGroupContextBase +{ +public: + explicit RadarTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel ); + virtual ~RadarTypeGroupContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +/** Handler for scatter type group context (c:scatterChart element). + */ +class ScatterTypeGroupContext final : public TypeGroupContextBase +{ +public: + explicit ScatterTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel ); + virtual ~ScatterTypeGroupContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +/** Handler for surface type group contexts (c:surface3DChart, c:surfaceChart + elements). + */ +class SurfaceTypeGroupContext final : public TypeGroupContextBase +{ +public: + explicit SurfaceTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel ); + virtual ~SurfaceTypeGroupContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override; +}; + + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/typegroupconverter.hxx b/oox/inc/drawingml/chart/typegroupconverter.hxx new file mode 100644 index 000000000..2e3aae5a2 --- /dev/null +++ b/oox/inc/drawingml/chart/typegroupconverter.hxx @@ -0,0 +1,177 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CHART_TYPEGROUPCONVERTER_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_TYPEGROUPCONVERTER_HXX + +#include <drawingml/chart/converterbase.hxx> + +namespace com::sun::star { + namespace chart2 { class XChartType; } + namespace chart2 { class XCoordinateSystem; } + namespace chart2 { class XDataSeries; } + namespace chart2 { class XDiagram; } + namespace chart2::data { class XLabeledDataSequence; } +} + +namespace oox::drawingml::chart { + +/** Enumerates different chart types. */ +enum TypeId +{ + TYPEID_BAR, /// Vertical bar chart. + TYPEID_HORBAR, /// Horizontal bar chart. + TYPEID_LINE, /// Line chart. + TYPEID_AREA, /// Area chart. + TYPEID_STOCK, /// Stock chart. + TYPEID_RADARLINE, /// Linear radar chart. + TYPEID_RADARAREA, /// Filled radar chart. + TYPEID_PIE, /// Pie chart. + TYPEID_DOUGHNUT, /// Doughnut (ring) chart. + TYPEID_OFPIE, /// Pie-to-pie or pie-to-bar chart. + TYPEID_SCATTER, /// Scatter (XY) chart. + TYPEID_BUBBLE, /// Bubble chart. + TYPEID_SURFACE, /// Surface chart. + TYPEID_UNKNOWN /// Default for unknown chart types. +}; + +/** Enumerates different categories of similar chart types. */ +enum TypeCategory +{ + TYPECATEGORY_BAR, /// Bar charts (horizontal or vertical). + TYPECATEGORY_LINE, /// Line charts (line, area, stock charts). + TYPECATEGORY_RADAR, /// Radar charts (linear or filled). + TYPECATEGORY_PIE, /// Pie and donut charts. + TYPECATEGORY_SCATTER, /// Scatter and bubble charts. + TYPECATEGORY_SURFACE /// Surface charts. +}; + +/** Enumerates modes for varying point colors in a series. */ +enum VarPointMode +{ + VARPOINTMODE_NONE, /// No varied colors supported. + VARPOINTMODE_SINGLE, /// Only supported, if type group contains only one series. + VARPOINTMODE_MULTI /// Supported for multiple series in a chart type group. +}; + +/** Contains info for a chart type related to the OpenOffice.org chart module. */ +struct TypeGroupInfo +{ + TypeId meTypeId; /// Unique chart type identifier. + TypeCategory meTypeCategory; /// Category this chart type belongs to. + const char* mpcServiceName; /// Service name of the type. + VarPointMode meVarPointMode; /// Mode for varying point colors. + sal_Int32 mnDefLabelPos; /// Default data label position (API constant). + bool mbPolarCoordSystem; /// True = polar, false = cartesian. + bool mbSeriesIsFrame2d; /// True = 2D type series with area formatting. + bool mbSingleSeriesVis; /// True = only first series visible (e.g. pie charts). + bool mbCategoryAxis; /// True = X axis contains categories. + bool mbSwappedAxesSet; /// True = X axis and Y axis are swapped. + bool mbSupportsStacking; /// True = data points can be stacked on each other. + bool mbPictureOptions; /// True = bitmaps support options from c:pictureOptions. +}; + +const TypeGroupInfo& GetTypeGroupInfo( TypeId eType ); + +struct UpDownBarsModel; + +class UpDownBarsConverter final : public ConverterBase< UpDownBarsModel > +{ +public: + explicit UpDownBarsConverter( const ConverterRoot& rParent, UpDownBarsModel& rModel ); + virtual ~UpDownBarsConverter() override; + + /** Converts the OOXML up/down bars. */ + void convertFromModel( + const css::uno::Reference< css::chart2::XChartType >& rxChartType ); +}; + +struct TypeGroupModel; +struct View3DModel; + +class TypeGroupConverter final : public ConverterBase< TypeGroupModel > +{ +public: + explicit TypeGroupConverter( const ConverterRoot& rParent, TypeGroupModel& rModel ); + virtual ~TypeGroupConverter() override; + + /** Returns the type info struct that describes this chart type group. */ + const TypeGroupInfo& getTypeInfo() const { return maTypeInfo; } + + /** Returns true, if the series in this chart type group are stacked on each other (no percentage). */ + bool isStacked() const; + /** Returns true, if the series in this chart type group are stacked on each other as percentage. */ + bool isPercent() const; + /** Returns true, if the chart is three-dimensional. */ + bool is3dChart() const { return mb3dChart;} + /** Returns true, if chart type supports wall and floor format in 3D mode. */ + bool isWall3dChart() const; + /** Returns true, if the series in this chart type group are ordered on the Z axis. */ + bool isDeep3dChart() const; + + /** Returns true, if this chart type supports area formatting for its series. */ + bool isSeriesFrameFormat() const; + /** Returns the object type for a series depending on the chart type. */ + ObjectType getSeriesObjectType() const; + + /** Returns series title, if the chart type group contains only one single series. */ + OUString getSingleSeriesTitle() const; + + /** Creates a coordinate system according to the contained chart type. */ + css::uno::Reference< css::chart2::XCoordinateSystem > + createCoordinateSystem(); + /** Creates a labeled data sequence object for axis categories. */ + css::uno::Reference< css::chart2::data::XLabeledDataSequence > + createCategorySequence(); + + /** Converts the OOXML type group model into a chart2 coordinate system. */ + void convertFromModel( + const css::uno::Reference< css::chart2::XDiagram >& rxDiagram, + const css::uno::Reference< css::chart2::XCoordinateSystem >& rxCoordSystem, + sal_Int32 nAxesSetIdx, bool bSupportsVaryColorsByPoint ); + + /** Sets the passed OOXML marker style at the passed property set. */ + void convertMarker( PropertySet& rPropSet, sal_Int32 nOoxSymbol, sal_Int32 nOoxSize, + const ModelRef< Shape >& xShapeProps ) const; + /** Sets the passed OOXML line smoothing at the passed property set. */ + void convertLineSmooth( PropertySet& rPropSet, bool bOoxSmooth ) const; + /** Sets the passed OOXML bar 3D geometry at the passed property set. */ + void convertBarGeometry( PropertySet& rPropSet, sal_Int32 nOoxShape ) const; + /** Sets the passed OOXML pie rotation at the passed property set. */ + void convertPieRotation( PropertySet& rPropSet, sal_Int32 nOoxAngle ) const; + /** Sets the passed OOXML pie explosion at the passed property set. */ + void convertPieExplosion( PropertySet& rPropSet, sal_Int32 nOoxExplosion ) const; + +private: + /** Inserts the passed series into the chart type. Adds additional properties to the series. */ + void insertDataSeries( + const css::uno::Reference< css::chart2::XChartType >& rxChartType, + const css::uno::Reference< css::chart2::XDataSeries >& rxSeries, + sal_Int32 nAxesSetIdx ); + +private: + TypeGroupInfo maTypeInfo; /// Extended type info for contained chart type model. + bool mb3dChart; /// True = type is a 3D chart type. +}; + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/chart/typegroupmodel.hxx b/oox/inc/drawingml/chart/typegroupmodel.hxx new file mode 100644 index 000000000..5a37797e1 --- /dev/null +++ b/oox/inc/drawingml/chart/typegroupmodel.hxx @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CHART_TYPEGROUPMODEL_HXX +#define INCLUDED_OOX_DRAWINGML_CHART_TYPEGROUPMODEL_HXX + +#include <drawingml/chart/seriesmodel.hxx> + +namespace oox::drawingml::chart { + +struct UpDownBarsModel +{ + typedef ModelRef< Shape > ShapeRef; + + ShapeRef mxDownBars; /// Formatting of down bars. + ShapeRef mxUpBars; /// Formatting of up bars. + sal_Int32 mnGapWidth; /// Space between up/down bars. + + explicit UpDownBarsModel(); + ~UpDownBarsModel(); +}; + +struct TypeGroupModel +{ + typedef ModelVector< SeriesModel > SeriesVector; + typedef ModelRef< DataLabelsModel > DataLabelsRef; + typedef ModelRef< UpDownBarsModel > UpDownBarsRef; + typedef ModelRef< Shape > ShapeRef; + + SeriesVector maSeries; /// Series attached to this chart type group. + std::vector<sal_Int32> + maAxisIds; /// List of axis identifiers used by this chart type. + DataLabelsRef mxLabels; /// Data point label settings for all series. + UpDownBarsRef mxUpDownBars; /// Up/down bars in stock charts. + ShapeRef mxSerLines; /// Connector lines in stacked bar charts. + ShapeRef mxDropLines; /// Drop lines connecting data points with X axis. + ShapeRef mxHiLowLines; /// High/low lines connecting lowest and highest data points. + double mfSplitPos; /// Threshold value in pie-to charts. + sal_Int32 mnBarDir; /// Bar direction in bar charts (vertical/horizontal). + sal_Int32 mnBubbleScale; /// Relative scaling of bubble size (percent). + sal_Int32 mnFirstAngle; /// Rotation angle of first slice in pie charts. + sal_Int32 mnGapDepth; /// Space between series in deep 3D charts. + sal_Int32 mnGapWidth; /// Space between bars in bar charts, or space in pie-to charts. + sal_Int32 mnGrouping; /// Series grouping mode. + sal_Int32 mnHoleSize; /// Hole size in doughnut charts. + sal_Int32 mnOfPieType; /// Pie-to-pie or pie-to-bar chart. + sal_Int32 mnOverlap; /// Bar overlap per category (2D bar charts only). + sal_Int32 mnRadarStyle; /// Type of radar chart (lines, markers, filled). + sal_Int32 mnScatterStyle; /// Type of scatter chart (lines, markers, smooth). + sal_Int32 mnSecondPieSize; /// relative size of second pie/bar in pie-to charts (percent). + sal_Int32 mnShape; /// 3D bar shape type. + sal_Int32 mnSizeRepresents; /// Bubble size represents area or width. + sal_Int32 mnSplitType; /// Split type in pie-to charts. + sal_Int32 mnTypeId; /// Chart type identifier. + bool mbBubble3d; /// True = show bubbles with 3D shade. + bool mbShowMarker; /// True = show point markers in line charts. + bool mbShowNegBubbles; /// True = show absolute value of negative bubbles. + bool mbSmooth; /// True = smooth lines in line charts. + bool mbVaryColors; /// True = different automatic colors for each point. + bool mbWireframe; /// True = wireframe surface chart, false = filled surface chart. + + explicit TypeGroupModel( sal_Int32 nTypeId, bool bMSO2007Doc ); + ~TypeGroupModel(); +}; + +} // namespace oox::drawingml::chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/clrschemecontext.hxx b/oox/inc/drawingml/clrschemecontext.hxx new file mode 100644 index 000000000..5e7cddfb8 --- /dev/null +++ b/oox/inc/drawingml/clrschemecontext.hxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CLRSCHEMECONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_CLRSCHEMECONTEXT_HXX + +#include <oox/core/contexthandler2.hxx> +#include <oox/drawingml/clrscheme.hxx> +#include <oox/drawingml/color.hxx> +#include <drawingml/colorchoicecontext.hxx> + +namespace oox::drawingml { + +class clrMapContext final : public oox::core::ContextHandler2 +{ +public: + clrMapContext( ::oox::core::ContextHandler2Helper const & rParent, + const ::oox::AttributeList& rAttributes, ClrMap& rClrMap ); +}; + +class clrSchemeColorContext final : private Color, public ColorContext +{ +public: + clrSchemeColorContext( ::oox::core::ContextHandler2Helper const & rParent, ClrScheme& rClrScheme, sal_Int32 nColorToken ); + virtual ~clrSchemeColorContext() override; + +private: + ClrScheme& mrClrScheme; + sal_Int32 mnColorToken; +}; + +class clrSchemeContext final : public oox::core::ContextHandler2 +{ +public: + clrSchemeContext( ::oox::core::ContextHandler2Helper const & rParent, ClrScheme& rClrScheme ); + virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; + +private: + ClrScheme& mrClrScheme; +}; + +} + +#endif // INCLUDED_OOX_DRAWINGML_CLRSCHEMECONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/colorchoicecontext.hxx b/oox/inc/drawingml/colorchoicecontext.hxx new file mode 100644 index 000000000..6e82ee322 --- /dev/null +++ b/oox/inc/drawingml/colorchoicecontext.hxx @@ -0,0 +1,87 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_COLORCHOICECONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_COLORCHOICECONTEXT_HXX + +#include <oox/core/contexthandler2.hxx> + +#include <vector> + +namespace oox::drawingml { + +class Color; + + +/** Context handler for the different color value elements (a:scrgbClr, + a:srgbClr, a:hslClr, a:sysClr, a:schemeClr, a:prstClr). */ +class ColorValueContext final : public ::oox::core::ContextHandler2 +{ +public: + explicit ColorValueContext( ::oox::core::ContextHandler2Helper const & rParent, Color& rColor ); + + + virtual void onStartElement( + const ::oox::AttributeList& rAttribs ) override; + + virtual ::oox::core::ContextHandlerRef + onCreateContext( + sal_Int32 nElement, + const ::oox::AttributeList& rAttribs ) override; + +private: + Color& mrColor; +}; + + +/** Context handler for elements that *contain* a color value element + (a:scrgbClr, a:srgbClr, a:hslClr, a:sysClr, a:schemeClr, a:prstClr). */ +class ColorContext : public ::oox::core::ContextHandler2 +{ +public: + explicit ColorContext( ::oox::core::ContextHandler2Helper const & rParent, Color& rColor ); + + virtual ::oox::core::ContextHandlerRef + onCreateContext( + sal_Int32 nElement, + const ::oox::AttributeList& rAttribs ) override; + +private: + Color& mrColor; +}; + +/// Same as ColorContext, but handles multiple colors. +class ColorsContext final : public ::oox::core::ContextHandler2 +{ +public: + explicit ColorsContext(::oox::core::ContextHandler2Helper const& rParent, + std::vector<Color>& rColors); + + virtual ::oox::core::ContextHandlerRef + onCreateContext(sal_Int32 nElement, const ::oox::AttributeList& rAttribs) override; + +private: + std::vector<Color>& mrColors; +}; + +} // namespace oox::drawingml + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/customshapegeometry.hxx b/oox/inc/drawingml/customshapegeometry.hxx new file mode 100644 index 000000000..e02a693b4 --- /dev/null +++ b/oox/inc/drawingml/customshapegeometry.hxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CUSTOMSHAPEGEOMETRY_HXX +#define INCLUDED_OOX_DRAWINGML_CUSTOMSHAPEGEOMETRY_HXX + +#include <oox/core/contexthandler2.hxx> +#include <oox/drawingml/shape.hxx> + +namespace oox::drawingml { + + +// CT_CustomGeometry2D +class CustomShapeGeometryContext final : public ::oox::core::ContextHandler2 +{ +public: + CustomShapeGeometryContext( ::oox::core::ContextHandler2Helper const & rParent, CustomShapeProperties& rCustomShapeProperties ); + virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 aElementToken, const ::oox::AttributeList& rAttribs ) override; + +private: + CustomShapeProperties& mrCustomShapeProperties; +}; + + +// CT_PresetGeometry2D +class PresetShapeGeometryContext final : public ::oox::core::ContextHandler2 +{ +public: + PresetShapeGeometryContext( ::oox::core::ContextHandler2Helper const & rParent, const ::oox::AttributeList& rAttributes, CustomShapeProperties& rCustomShapeProperties ); + virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 aElementToken, const ::oox::AttributeList& rAttribs ) override; + +private: + CustomShapeProperties& mrCustomShapeProperties; +}; + + +// CT_PresetTextShape +class PresetTextShapeContext final : public ::oox::core::ContextHandler2 +{ +public: + PresetTextShapeContext( ::oox::core::ContextHandler2Helper const & rParent, const ::oox::AttributeList& rAttributes, CustomShapeProperties& rCustomShapeProperties ); + virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 aElementToken, const ::oox::AttributeList& rAttribs ) override; + +private: + CustomShapeProperties& mrCustomShapeProperties; +}; + +} + +#endif // INCLUDED_OOX_DRAWINGML_CUSTOMSHAPEGEOMETRY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/customshapeproperties.hxx b/oox/inc/drawingml/customshapeproperties.hxx new file mode 100644 index 000000000..10251de24 --- /dev/null +++ b/oox/inc/drawingml/customshapeproperties.hxx @@ -0,0 +1,163 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX +#define INCLUDED_OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX + +#include <memory> +#include <unordered_map> +#include <vector> +#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> +#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp> +#include <com/sun/star/drawing/XShape.hpp> +#include <oox/helper/helper.hxx> +#include <oox/helper/propertymap.hxx> +#include <oox/token/tokens.hxx> + +namespace oox::drawingml { + +class CustomShapeProperties; + +typedef std::shared_ptr< CustomShapeProperties > CustomShapePropertiesPtr; + +struct CustomShapeGuide +{ + OUString maName; + OUString maFormula; +}; + +struct AdjustHandle +{ + bool polar; + css::drawing::EnhancedCustomShapeParameterPair + pos; + + // depending to the type (polar or not): + OptValue< OUString > gdRef1; // gdRefX or gdRefR + OptValue< css::drawing::EnhancedCustomShapeParameter > + min1; // minX or minR + OptValue< css::drawing::EnhancedCustomShapeParameter > + max1; // maxX or maxR + OptValue< OUString > gdRef2; // gdRefY or gdRefAng + OptValue< css::drawing::EnhancedCustomShapeParameter > + min2; // minX or minAng + OptValue< css::drawing::EnhancedCustomShapeParameter > + max2; // maxY or maxAng + + AdjustHandle( bool bPolar ) : polar( bPolar ) {}; +}; + +struct ConnectionSite +{ + css::drawing::EnhancedCustomShapeParameterPair + pos; + css::drawing::EnhancedCustomShapeParameter + ang; +}; + +struct GeomRect +{ + css::drawing::EnhancedCustomShapeParameter l; + css::drawing::EnhancedCustomShapeParameter t; + css::drawing::EnhancedCustomShapeParameter r; + css::drawing::EnhancedCustomShapeParameter b; +}; + +struct Path2D +{ + sal_Int64 w; + sal_Int64 h; + sal_Int32 fill; + bool stroke; + bool extrusionOk; + std::vector< css::drawing::EnhancedCustomShapeParameterPair > parameter; + + Path2D() : w( 0 ), h( 0 ), fill( XML_norm ), stroke( true ), extrusionOk( true ) {}; +}; + + +class CustomShapeProperties final +{ +public: + CustomShapeProperties(); + + void pushToPropSet( const css::uno::Reference < css::beans::XPropertySet > & xPropSet, + const css::awt::Size &aSize ); + + sal_Int32 getShapePresetType() const { return mnShapePresetType; } + css::uno::Sequence< sal_Int8 > const & getShapePresetTypeName() const; + void setShapePresetType( sal_Int32 nShapePresetType ){ mnShapePresetType = nShapePresetType; }; + bool getShapeTypeOverride() const { return mbShapeTypeOverride; }; + void setShapeTypeOverride( bool bShapeTypeOverride ) { mbShapeTypeOverride = bShapeTypeOverride; }; + + std::vector< CustomShapeGuide >& getAdjustmentGuideList(){ return maAdjustmentGuideList; }; + std::vector< CustomShapeGuide >& getGuideList(){ return maGuideList; }; + std::vector< AdjustHandle >& getAdjustHandleList(){ return maAdjustHandleList; }; + std::vector< ConnectionSite >& getConnectionSiteList(){ return maConnectionSiteList; }; + OptValue< GeomRect >& getTextRect(){ return maTextRect; }; + std::vector< Path2D >& getPath2DList(){ return maPath2DList; }; + std::vector< css::drawing::EnhancedCustomShapeSegment >& getSegments(){ return maSegments; }; + void setMirroredX( bool bMirroredX ) { mbMirroredX = bMirroredX; }; + void setMirroredY( bool bMirroredY ) { mbMirroredY = bMirroredY; }; + void setTextRotateAngle( sal_Int32 nAngle ) { mnTextRotateAngle = nAngle; }; + void setTextCameraZRotateAngle( sal_Int32 nAngle ) { mnTextCameraZRotateAngle = nAngle; }; + + static sal_Int32 SetCustomShapeGuideValue( std::vector< CustomShapeGuide >& rGuideList, const CustomShapeGuide& rGuide ); + static sal_Int32 GetCustomShapeGuideValue( const std::vector< CustomShapeGuide >& rGuideList, std::u16string_view rFormulaName ); + + sal_Int32 getArcNum() { return mnArcNum++; } + sal_Int32 countArcTo() { return mnArcNum; } + + /** + Returns whether or not the current CustomShapeProperties + represent a default shape preset that is rectangular. + */ + bool representsDefaultShape() const; + +private: + + sal_Int32 mnShapePresetType; + bool mbShapeTypeOverride; + std::vector< CustomShapeGuide > maAdjustmentGuideList; + std::vector< CustomShapeGuide > maGuideList; + std::vector< AdjustHandle > maAdjustHandleList; + std::vector< ConnectionSite > maConnectionSiteList; + OptValue< GeomRect > maTextRect; + std::vector< Path2D > maPath2DList; + + std::vector< css::drawing::EnhancedCustomShapeSegment > + maSegments; + bool mbMirroredX; + bool mbMirroredY; + sal_Int32 mnTextRotateAngle; + sal_Int32 mnTextCameraZRotateAngle; + + typedef std::unordered_map< sal_Int32, PropertyMap > PresetDataMap; + + static PresetDataMap maPresetDataMap; + static void initializePresetDataMap(); + + sal_Int32 mnArcNum; +}; + +} + +#endif // INCLUDED_OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/effectpropertiescontext.hxx b/oox/inc/drawingml/effectpropertiescontext.hxx new file mode 100644 index 000000000..d6a931043 --- /dev/null +++ b/oox/inc/drawingml/effectpropertiescontext.hxx @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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 <oox/core/contexthandler2.hxx> + +namespace oox::drawingml { + +struct EffectProperties; +struct Effect; + +class EffectPropertiesContext final : public ::oox::core::ContextHandler2 +{ +public: + EffectPropertiesContext( ::oox::core::ContextHandler2Helper const & rParent, + EffectProperties& rEffectProperties ) noexcept; + virtual ~EffectPropertiesContext() override; + + virtual ::oox::core::ContextHandlerRef + onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; + +private: + static void saveUnsupportedAttribs( Effect& rEffect, const AttributeList& rAttribs ); + + EffectProperties& mrEffectProperties; +}; + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/embeddedwavaudiofile.hxx b/oox/inc/drawingml/embeddedwavaudiofile.hxx new file mode 100644 index 000000000..cea644666 --- /dev/null +++ b/oox/inc/drawingml/embeddedwavaudiofile.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 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_EMBEDDEDWAVAUDIOFILE_HXX +#define INCLUDED_OOX_DRAWINGML_EMBEDDEDWAVAUDIOFILE_HXX + +#include <rtl/ustring.hxx> + +#include <oox/core/relations.hxx> +#include <oox/helper/attributelist.hxx> + +namespace oox::drawingml { + + OUString getEmbeddedWAVAudioFile( + const ::oox::core::Relations& rRelations, + const AttributeList& rAttribs ); + +} + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/fillproperties.hxx b/oox/inc/drawingml/fillproperties.hxx new file mode 100644 index 000000000..cae4235cd --- /dev/null +++ b/oox/inc/drawingml/fillproperties.hxx @@ -0,0 +1,160 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_INC_DRAWINGML_FILLPROPERTIES_HXX +#define INCLUDED_OOX_INC_DRAWINGML_FILLPROPERTIES_HXX + +#include <map> + +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/geometry/IntegerRectangle2D.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <oox/drawingml/color.hxx> +#include <oox/helper/helper.hxx> +#include <oox/ole/oleobjecthelper.hxx> +#include <rtl/ustring.hxx> +#include <sal/types.h> + +namespace com::sun::star { + namespace graphic { class XGraphic; } +} + +namespace oox { + class GraphicHelper; +} + +namespace oox::drawingml { + +class ShapePropertyMap; + +struct GradientFillProperties +{ + typedef ::std::multimap< double, Color > GradientStopMap; + + GradientStopMap maGradientStops; /// Gradient stops (colors/transparence). + OptValue< css::geometry::IntegerRectangle2D > moFillToRect; + OptValue< css::geometry::IntegerRectangle2D > moTileRect; + OptValue< sal_Int32 > moGradientPath; /// If set, gradient follows rectangle, circle, or shape. + OptValue< sal_Int32 > moShadeAngle; /// Rotation angle of linear gradients. + OptValue< sal_Int32 > moShadeFlip; /// Flip mode of gradient, if not stretched to shape. + OptValue< bool > moShadeScaled; /// True = scale gradient into shape. + OptValue< bool > moRotateWithShape; /// True = rotate gradient with shape. + + /** Overwrites all members that are explicitly set in rSourceProps. */ + void assignUsed( const GradientFillProperties& rSourceProps ); +}; + +struct PatternFillProperties +{ + Color maPattFgColor; /// Pattern foreground color. + Color maPattBgColor; /// Pattern background color. + OptValue< sal_Int32 > moPattPreset; /// Preset pattern type. + + /** Overwrites all members that are explicitly set in rSourceProps. */ + void assignUsed( const PatternFillProperties& rSourceProps ); +}; + +struct ArtisticEffectProperties +{ + OUString msName; + std::map< OUString, css::uno::Any > + maAttribs; + ::oox::ole::OleObjectInfo mrOleObjectInfo; /// The original graphic as embedded object. + + bool isEmpty() const; + + /** Returns the struct as a PropertyValue with Name = msName and + * Value = maAttribs as a Sequence< PropertyValue >. */ + css::beans::PropertyValue getEffect(); + + /** Overwrites all members that are explicitly set in rSourceProps. */ + void assignUsed( const ArtisticEffectProperties& rSourceProps ); + + /** Translate effect tokens to strings. */ + static OUString getEffectString( sal_Int32 nToken ); + + /** Translate effect strings to tokens. */ + static sal_Int32 getEffectToken( const OUString& sName ); +}; + +struct BlipFillProperties +{ + css::uno::Reference<css::graphic::XGraphic> mxFillGraphic; /// The fill graphic. + OptValue< sal_Int32 > moBitmapMode; /// Bitmap tile or stretch. + OptValue< css::geometry::IntegerRectangle2D > + moFillRect; /// Stretch fill offsets. + OptValue< css::geometry::IntegerRectangle2D > + moClipRect; + OptValue< sal_Int32 > moTileOffsetX; /// Width of bitmap tiles (EMUs). + OptValue< sal_Int32 > moTileOffsetY; /// Height of bitmap tiles (EMUs). + OptValue< sal_Int32 > moTileScaleX; /// Horizontal scaling of bitmap tiles (1/1000 percent). + OptValue< sal_Int32 > moTileScaleY; /// Vertical scaling of bitmap tiles (1/1000 percent). + OptValue< sal_Int32 > moTileAlign; /// Anchor point inside bitmap. + OptValue< sal_Int32 > moTileFlip; /// Flip mode of bitmap tiles. + OptValue< bool > moRotateWithShape; /// True = rotate bitmap with shape. + // effects + OptValue< sal_Int32 > moColorEffect; /// XML token for a color effect. + OptValue< sal_Int32 > moBrightness; /// Brightness in the range [-100000,100000]. + OptValue< sal_Int32 > moContrast; /// Contrast in the range [-100000,100000]. + OptValue< sal_Int32 > moBiLevelThreshold; /// Bi-Level (Black/White) effect threshold (1/1000 percent) + Color maColorChangeFrom; /// Start color of color transformation. + Color maColorChangeTo; /// Destination color of color transformation. + Color maDuotoneColors[2]; /// Duotone Colors + + ArtisticEffectProperties maEffect; /// Artistic effect, not supported by core. + OptValue<sal_Int32> moAlphaModFix; ///< Alpha Modulate Fixed Effect. + + /** Overwrites all members that are explicitly set in rSourceProps. */ + void assignUsed( const BlipFillProperties& rSourceProps ); +}; + +struct FillProperties +{ + OptValue< sal_Int32 > moFillType; /// Fill type (OOXML token). + Color maFillColor; /// Solid fill color and transparence. + OptValue< bool > moUseBgFill; /// Whether the background is used as fill type + GradientFillProperties maGradientProps; /// Properties for gradient fills. + PatternFillProperties maPatternProps; /// Properties for pattern fills. + BlipFillProperties maBlipProps; /// Properties for bitmap fills. + + /** Overwrites all members that are explicitly set in rSourceProps. */ + void assignUsed( const FillProperties& rSourceProps ); + + /** Tries to resolve current settings to a solid color, e.g. returns the + start color of a gradient. */ + Color getBestSolidColor() const; + + /** Writes the properties to the passed property map. */ + void pushToPropMap( + ShapePropertyMap& rPropMap, + const GraphicHelper& rGraphicHelper, + sal_Int32 nShapeRotation = 0, + ::Color nPhClr = API_RGB_TRANSPARENT, + sal_Int16 nPhClrTheme = -1, + bool bFlipH = false, + bool bFlipV = false, + bool bIsCustomShape = false ) const; +}; + +} // namespace oox::drawingml + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/graphicproperties.hxx b/oox/inc/drawingml/graphicproperties.hxx new file mode 100644 index 000000000..48d1acf61 --- /dev/null +++ b/oox/inc/drawingml/graphicproperties.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_GRAPHICPROPERTIES_HXX +#define INCLUDED_OOX_DRAWINGML_GRAPHICPROPERTIES_HXX + +#include <sal/config.h> + +#include <com/sun/star/io/XInputStream.hpp> + +#include <drawingml/fillproperties.hxx> + +namespace oox { + class GraphicHelper; + class PropertyMap; +} + +namespace oox::drawingml { + +struct GraphicProperties +{ + BlipFillProperties maBlipProps; ///< Properties for the graphic. + OUString m_sMediaPackageURL; ///< Audio/Video URL. + bool mbIsCustomShape = false; + css::uno::Reference<css::io::XInputStream> m_xMediaStream; ///< Audio/Video input stream. + + /** Writes the properties to the passed property map. */ + void pushToPropMap( + PropertyMap& rPropMap, + const GraphicHelper& rGraphicHelper, + bool bFlipH = false, + bool bFlipV = false) const; +}; + +} // namespace oox::drawingml + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/guidcontext.hxx b/oox/inc/drawingml/guidcontext.hxx new file mode 100644 index 000000000..c60ad75e7 --- /dev/null +++ b/oox/inc/drawingml/guidcontext.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 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_GUIDCONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_GUIDCONTEXT_HXX + +#include <oox/core/contexthandler2.hxx> + +namespace oox::drawingml { + + class GuidContext final : public ::oox::core::ContextHandler2 + { + + public: + GuidContext( ::oox::core::ContextHandler2Helper const & rParent, OUString& rGuidId ); + virtual void onCharacters( const OUString& aChars ) override; + + private: + OUString& mrGuidId; + }; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/hatchmap.hxx b/oox/inc/drawingml/hatchmap.hxx new file mode 100644 index 000000000..64e2722fe --- /dev/null +++ b/oox/inc/drawingml/hatchmap.hxx @@ -0,0 +1,298 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.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 <com/sun/star/drawing/Hatch.hpp> +#include <oox/token/tokens.hxx> + +#include <tools/color.hxx> + +using namespace com::sun::star; +using namespace oox; + +static drawing::Hatch createHatch(sal_Int32 nHatchToken, ::Color nColor) +{ + drawing::Hatch aHatch; + aHatch.Color = sal_Int32(nColor); + // best-effort mapping; we do not support all the styles in core + switch (nHatchToken) + { + case XML_pct5: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 250; + aHatch.Angle = 450; + break; + case XML_pct10: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 200; + aHatch.Angle = 450; + break; + case XML_pct20: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 150; + aHatch.Angle = 450; + break; + case XML_pct25: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 200; + aHatch.Angle = 450; + break; + case XML_pct30: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 175; + aHatch.Angle = 450; + break; + case XML_pct40: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 150; + aHatch.Angle = 450; + break; + case XML_pct50: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 125; + aHatch.Angle = 450; + break; + case XML_pct60: + aHatch.Style = drawing::HatchStyle_TRIPLE; + aHatch.Distance = 150; + aHatch.Angle = 450; + break; + case XML_pct70: + aHatch.Style = drawing::HatchStyle_TRIPLE; + aHatch.Distance = 125; + aHatch.Angle = 450; + break; + case XML_pct75: + aHatch.Style = drawing::HatchStyle_TRIPLE; + aHatch.Distance = 100; + aHatch.Angle = 450; + break; + case XML_pct80: + aHatch.Style = drawing::HatchStyle_TRIPLE; + aHatch.Distance = 75; + aHatch.Angle = 450; + break; + case XML_pct90: + aHatch.Style = drawing::HatchStyle_TRIPLE; + aHatch.Distance = 50; + aHatch.Angle = 450; + break; + case XML_horz: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 100; + aHatch.Angle = 0; + break; + case XML_vert: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 100; + aHatch.Angle = 900; + break; + case XML_ltHorz: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 50; + aHatch.Angle = 0; + break; + case XML_ltVert: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 50; + aHatch.Angle = 900; + break; + case XML_dkHorz: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 25; + aHatch.Angle = 0; + break; + case XML_dkVert: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 25; + aHatch.Angle = 900; + break; + case XML_narHorz: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 50; + aHatch.Angle = 0; + break; + case XML_narVert: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 50; + aHatch.Angle = 900; + break; + case XML_dashHorz: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 150; + aHatch.Angle = 0; + break; + case XML_dashVert: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 150; + aHatch.Angle = 900; + break; + case XML_cross: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 100; + aHatch.Angle = 0; + break; + case XML_dnDiag: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 100; + aHatch.Angle = 1350; + break; + case XML_upDiag: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 100; + aHatch.Angle = 450; + break; + case XML_ltDnDiag: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 50; + aHatch.Angle = 1350; + break; + case XML_ltUpDiag: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 50; + aHatch.Angle = 450; + break; + case XML_dkDnDiag: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 50; + aHatch.Angle = 1350; + break; + case XML_dkUpDiag: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 50; + aHatch.Angle = 450; + break; + case XML_wdDnDiag: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 100; + aHatch.Angle = 1350; + break; + case XML_wdUpDiag: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 100; + aHatch.Angle = 450; + break; + case XML_dashDnDiag: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 150; + aHatch.Angle = 1350; + break; + case XML_dashUpDiag: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 150; + aHatch.Angle = 450; + break; + case XML_diagCross: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 100; + aHatch.Angle = 450; + break; + case XML_smCheck: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 50; + aHatch.Angle = 450; + break; + case XML_lgCheck: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 100; + aHatch.Angle = 450; + break; + case XML_smGrid: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 50; + aHatch.Angle = 0; + break; + case XML_lgGrid: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 100; + aHatch.Angle = 0; + break; + case XML_dotGrid: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 400; + aHatch.Angle = 0; + break; + case XML_smConfetti: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 200; + aHatch.Angle = 600; + break; + case XML_lgConfetti: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 100; + aHatch.Angle = 600; + break; + case XML_horzBrick: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 300; + aHatch.Angle = 0; + break; + case XML_diagBrick: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 300; + aHatch.Angle = 450; + break; + case XML_solidDmnd: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 100; + aHatch.Angle = 450; + break; + case XML_openDmnd: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 100; + aHatch.Angle = 450; + break; + case XML_dotDmnd: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 300; + aHatch.Angle = 450; + break; + case XML_plaid: + aHatch.Style = drawing::HatchStyle_TRIPLE; + aHatch.Distance = 200; + aHatch.Angle = 900; + break; + case XML_sphere: + aHatch.Style = drawing::HatchStyle_TRIPLE; + aHatch.Distance = 100; + aHatch.Angle = 0; + break; + case XML_weave: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 150; + aHatch.Angle = 450; + break; + case XML_divot: + aHatch.Style = drawing::HatchStyle_TRIPLE; + aHatch.Distance = 400; + aHatch.Angle = 450; + break; + case XML_shingle: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 200; + aHatch.Angle = 1350; + break; + case XML_wave: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 100; + aHatch.Angle = 0; + break; + case XML_trellis: + aHatch.Style = drawing::HatchStyle_DOUBLE; + aHatch.Distance = 75; + aHatch.Angle = 450; + break; + case XML_zigZag: + aHatch.Style = drawing::HatchStyle_SINGLE; + aHatch.Distance = 75; + aHatch.Angle = 0; + break; + } + + return aHatch; +} diff --git a/oox/inc/drawingml/lineproperties.hxx b/oox/inc/drawingml/lineproperties.hxx new file mode 100644 index 000000000..214aadba1 --- /dev/null +++ b/oox/inc/drawingml/lineproperties.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 . + */ + +#ifndef INCLUDED_OOX_INC_DRAWINGML_LINEPROPERTIES_HXX +#define INCLUDED_OOX_INC_DRAWINGML_LINEPROPERTIES_HXX + +#include <utility> +#include <vector> + +#include <com/sun/star/drawing/LineCap.hpp> +#include <com/sun/star/drawing/LineJoint.hpp> +#include <com/sun/star/drawing/LineStyle.hpp> +#include <oox/helper/helper.hxx> +#include <sal/types.h> + +#include <drawingml/fillproperties.hxx> + +namespace oox { class GraphicHelper; } + +namespace oox::drawingml { + +class ShapePropertyMap; + +struct LineArrowProperties +{ + OptValue< sal_Int32 > moArrowType; + OptValue< sal_Int32 > moArrowWidth; + OptValue< sal_Int32 > moArrowLength; + + /** Overwrites all members that are explicitly set in rSourceProps. */ + void assignUsed( const LineArrowProperties& rSourceProps ); +}; + +struct LineProperties +{ + typedef ::std::pair< sal_Int32, sal_Int32 > DashStop; + typedef ::std::vector< DashStop > DashStopVector; + + LineArrowProperties maStartArrow; /// Start line arrow style. + LineArrowProperties maEndArrow; /// End line arrow style. + FillProperties maLineFill; /// Line fill (solid, gradient, ...). + DashStopVector maCustomDash; /// User-defined line dash style. + OptValue< sal_Int32 > moLineWidth; /// Line width (EMUs). + OptValue< sal_Int32 > moPresetDash; /// Preset dash (OOXML token). + OptValue< sal_Int32 > moLineCompound; /// Line compound type (OOXML token). + OptValue< sal_Int32 > moLineCap; /// Line cap (OOXML token). + OptValue< sal_Int32 > moLineJoint; /// Line joint type (OOXML token). + + /** Overwrites all members that are explicitly set in rSourceProps. */ + void assignUsed( const LineProperties& rSourceProps ); + + /** Writes the properties to the passed property map. */ + void pushToPropMap( + ShapePropertyMap& rPropMap, + const GraphicHelper& rGraphicHelper, + ::Color nPhClr = API_RGB_TRANSPARENT ) const; + + /** Calculates the line style attribute from the internal state of the object */ + css::drawing::LineStyle getLineStyle() const; + /** Calculates the line cap attribute from the internal state of the object */ + css::drawing::LineCap getLineCap() const; + /** Calculates the line joint attribute from the internal state of the object */ + css::drawing::LineJoint getLineJoint() const; + /** Calculates the line width attribute from the internal state of the object */ + sal_Int32 getLineWidth() const; +}; + +} // namespace oox::drawingml + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/linepropertiescontext.hxx b/oox/inc/drawingml/linepropertiescontext.hxx new file mode 100644 index 000000000..470a38c68 --- /dev/null +++ b/oox/inc/drawingml/linepropertiescontext.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_LINEPROPERTIESCONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_LINEPROPERTIESCONTEXT_HXX + +#include <oox/core/contexthandler2.hxx> + +namespace oox::drawingml { + + +struct LineProperties; + +class LinePropertiesContext final : public ::oox::core::ContextHandler2 +{ +public: + LinePropertiesContext( ::oox::core::ContextHandler2Helper const & rParent, + const ::oox::AttributeList& rAttributes, + LineProperties& rLineProperties ) noexcept; + virtual ~LinePropertiesContext() override; + + virtual ::oox::core::ContextHandlerRef + onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; + +private: + LineProperties& mrLineProperties; +}; + +} + +#endif // INCLUDED_OOX_DRAWINGML_LINEPROPERTIESCONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/misccontexts.hxx b/oox/inc/drawingml/misccontexts.hxx new file mode 100644 index 000000000..495b3bce9 --- /dev/null +++ b/oox/inc/drawingml/misccontexts.hxx @@ -0,0 +1,244 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_MISCCONTEXTS_HXX +#define INCLUDED_OOX_DRAWINGML_MISCCONTEXTS_HXX + +#include <drawingml/colorchoicecontext.hxx> + +#include <drawingml/fillproperties.hxx> + +namespace oox::drawingml { + + +/** Context handler that imports the a:solidFill element. */ +class SolidFillContext final : public ColorContext +{ +public: + explicit SolidFillContext( + ::oox::core::ContextHandler2Helper const & rParent, + FillProperties& rFillProps ); +}; + + +/** Context handler that imports the a:gradFill element. */ +class GradientFillContext final : public ::oox::core::ContextHandler2 +{ +public: + explicit GradientFillContext( + ::oox::core::ContextHandler2Helper const & rParent, + const ::oox::AttributeList& rAttribs, + GradientFillProperties& rGradientProps ); + + virtual ::oox::core::ContextHandlerRef + onCreateContext( + sal_Int32 nElement, + const ::oox::AttributeList& rAttribs ) override; + +private: + GradientFillProperties& mrGradientProps; +}; + +/** Context handler that imports the a:pattFill element. */ +class PatternFillContext final : public ::oox::core::ContextHandler2 +{ +public: + explicit PatternFillContext( + ::oox::core::ContextHandler2Helper const & rParent, + const ::oox::AttributeList& rAttribs, + PatternFillProperties& rPatternProps ); + + virtual ::oox::core::ContextHandlerRef + onCreateContext( + sal_Int32 nElement, + const ::oox::AttributeList& rAttribs ) override; + +private: + PatternFillProperties& mrPatternProps; +}; + + +/** Context handler that imports a14:imgProps, a14:imgLayer, a14:imgEffect containers + and the a14:artistic* effect tags defined in the MS-ODRAWXML extension. */ +class ArtisticEffectContext final : public ::oox::core::ContextHandler2 +{ +public: + explicit ArtisticEffectContext( + ::oox::core::ContextHandler2Helper const & rParent, + ArtisticEffectProperties& rEffect ); + virtual ~ArtisticEffectContext() override; + + virtual ::oox::core::ContextHandlerRef + onCreateContext( + sal_Int32 nElement, + const ::oox::AttributeList& rAttribs ) override; + +private: + ArtisticEffectProperties& maEffect; +}; + + +/** Context handler that imports the a:extLst element inside a:blip and its + children a:ext, which can contain transformations to the bitmap. */ +class BlipExtensionContext final : public ::oox::core::ContextHandler2 +{ +public: + explicit BlipExtensionContext( + ::oox::core::ContextHandler2Helper const & rParent, + BlipFillProperties& rBlipProps ); + virtual ~BlipExtensionContext() override; + + virtual ::oox::core::ContextHandlerRef + onCreateContext( + sal_Int32 nElement, + const ::oox::AttributeList& rAttribs ) override; + +private: + BlipFillProperties& mrBlipProps; +}; + + +/** Context handler that imports the a:duotone element containing the colors + of a bitmap duotone transformation. */ +class DuotoneContext final : public ::oox::core::ContextHandler2 +{ +public: + explicit DuotoneContext( + ::oox::core::ContextHandler2Helper const & rParent, + BlipFillProperties& rBlipProps ); + virtual ~DuotoneContext() override; + + virtual ::oox::core::ContextHandlerRef + onCreateContext( + sal_Int32 nElement, + const ::oox::AttributeList& rAttribs ) override; + +private: + BlipFillProperties& mrBlipProps; + int mnColorIndex; +}; + + +/** Context handler that imports the a:clrChange element containing the colors + of a bitmap color change transformation. */ +class ColorChangeContext final : public ::oox::core::ContextHandler2 +{ +public: + explicit ColorChangeContext( + ::oox::core::ContextHandler2Helper const & rParent, + const ::oox::AttributeList& rAttribs, + BlipFillProperties& rBlipProps ); + virtual ~ColorChangeContext() override; + + virtual ::oox::core::ContextHandlerRef + onCreateContext( + sal_Int32 nElement, + const ::oox::AttributeList& rAttribs ) override; + +private: + BlipFillProperties& mrBlipProps; + bool mbUseAlpha; +}; + +/** Context handler that imports the a:blip element containing the fill bitmap + and bitmap color transformation settings. */ +class BlipContext final : public ::oox::core::ContextHandler2 +{ +public: + explicit BlipContext( + ::oox::core::ContextHandler2Helper const & rParent, + const ::oox::AttributeList& rAttribs, + BlipFillProperties& rBlipProps ); + + virtual ::oox::core::ContextHandlerRef + onCreateContext( + sal_Int32 nElement, + const ::oox::AttributeList& rAttribs ) override; + +private: + BlipFillProperties& mrBlipProps; +}; + +/** Context handler that imports the a:blipFill element. */ +class BlipFillContext final : public ::oox::core::ContextHandler2 +{ +public: + explicit BlipFillContext( + ::oox::core::ContextHandler2Helper const & rParent, + const ::oox::AttributeList& rAttribs, + BlipFillProperties& rBlipProps ); + + virtual ::oox::core::ContextHandlerRef + onCreateContext( + sal_Int32 nElement, + const ::oox::AttributeList& rAttribs ) override; + +private: + BlipFillProperties& mrBlipProps; +}; + +/** Context handler for elements that contain a fill property element + (a:noFill, a:solidFill, a:gradFill, a:pattFill, a:blipFill, a:grpFill). */ +class FillPropertiesContext : public ::oox::core::ContextHandler2 +{ +public: + explicit FillPropertiesContext( + ::oox::core::ContextHandler2Helper const & rParent, + FillProperties& rFillProps ); + + virtual ::oox::core::ContextHandlerRef + onCreateContext( + sal_Int32 nElement, + const ::oox::AttributeList& rAttribs ) override; + + static ::oox::core::ContextHandlerRef + createFillContext( + ::oox::core::ContextHandler2Helper const & rParent, + sal_Int32 nElement, + const ::oox::AttributeList& rAttribs, + FillProperties& rFillProps ); + +private: + FillProperties& mrFillProps; +}; + +/** Context handler for elements that contain a fill property element + (a:noFill, a:solidFill, a:gradFill, a:pattFill, a:blipFill, a:grpFill). + + This context handler takes a simple color instead of a fill properties + struct. The imported fill properties are converted automatically to the + best fitting solid color. + */ +class SimpleFillPropertiesContext final : private FillProperties, public FillPropertiesContext +{ +public: + explicit SimpleFillPropertiesContext( + ::oox::core::ContextHandler2Helper const & rParent, + Color& rColor ); + virtual ~SimpleFillPropertiesContext() override; + +private: + Color& mrColor; +}; + +} // namespace oox::drawingml + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/objectdefaultcontext.hxx b/oox/inc/drawingml/objectdefaultcontext.hxx new file mode 100644 index 000000000..45873c825 --- /dev/null +++ b/oox/inc/drawingml/objectdefaultcontext.hxx @@ -0,0 +1,43 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_OBJECTDEFAULTCONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_OBJECTDEFAULTCONTEXT_HXX + +#include <oox/core/contexthandler2.hxx> + +namespace oox::drawingml +{ +class Theme; + +class objectDefaultContext final : public oox::core::ContextHandler2 +{ +public: + objectDefaultContext(::oox::core::ContextHandler2Helper const& rParent, Theme& rTheme); + virtual ::oox::core::ContextHandlerRef + onCreateContext(::sal_Int32 Element, const ::oox::AttributeList& rAttribs) override; + +private: + Theme& mrTheme; +}; +} + +#endif // INCLUDED_OOX_DRAWINGML_OBJECTDEFAULTCONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/presetgeometrynames.hxx b/oox/inc/drawingml/presetgeometrynames.hxx new file mode 100644 index 000000000..1dc46b86f --- /dev/null +++ b/oox/inc/drawingml/presetgeometrynames.hxx @@ -0,0 +1,23 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_OOX_DRAWINGML_PRESETGEOMETRYNAMES_HXX +#define INCLUDED_OOX_DRAWINGML_PRESETGEOMETRYNAMES_HXX + +#include <rtl/ustring.hxx> + +namespace PresetGeometryTypeNames +{ +OUString GetFontworkType(const OUString& rMsoType); +OUString GetMsoName(const OUString& rFontworkType); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/oox/inc/drawingml/scene3dcontext.hxx b/oox/inc/drawingml/scene3dcontext.hxx new file mode 100644 index 000000000..30e392f94 --- /dev/null +++ b/oox/inc/drawingml/scene3dcontext.hxx @@ -0,0 +1,76 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_SCENE3DCONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_SCENE3DCONTEXT_HXX + +#include <oox/core/contexthandler2.hxx> +#include <drawingml/shape3dproperties.hxx> + +namespace oox::drawingml { + +struct Shape3DProperties; + +class Scene3DRotationPropertiesContext final : public ::oox::core::ContextHandler2 +{ +public: + Scene3DRotationPropertiesContext( ::oox::core::ContextHandler2Helper const & rParent, RotationProperties& rRotationProperties ) noexcept; + + ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; + +private: + RotationProperties& mrRotationProperties; +}; + +class Scene3DPropertiesContext final : public ::oox::core::ContextHandler2 +{ +public: + Scene3DPropertiesContext( ::oox::core::ContextHandler2Helper const & rParent, Shape3DProperties& rShape3DProperties ) noexcept; + ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; + +private: + Shape3DProperties& mr3DProperties; +}; + +class SceneText3DPropertiesContext final : public ::oox::core::ContextHandler2 +{ +public: + SceneText3DPropertiesContext( ::oox::core::ContextHandler2Helper const & rParent, Text3DProperties& rText3DProperties ) noexcept; + ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; + +private: + Text3DProperties& mr3DProperties; +}; + +class Shape3DPropertiesContext final : public ::oox::core::ContextHandler2 +{ +public: + Shape3DPropertiesContext( ::oox::core::ContextHandler2Helper const & rParent, const ::oox::AttributeList& rAttribs, Shape3DProperties& r3DProperties ) noexcept; + + ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; + +private: + Shape3DProperties& mr3DProperties; +}; + +} + +#endif // INCLUDED_OOX_DRAWINGML_SCENE3DCONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/shape3dproperties.hxx b/oox/inc/drawingml/shape3dproperties.hxx new file mode 100644 index 000000000..c43e643aa --- /dev/null +++ b/oox/inc/drawingml/shape3dproperties.hxx @@ -0,0 +1,92 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_SHAPE3DPROPERTIES_HXX +#define INCLUDED_OOX_DRAWINGML_SHAPE3DPROPERTIES_HXX + +#include <oox/drawingml/color.hxx> +#include <oox/helper/helper.hxx> + +namespace oox { class PropertyMap; } +namespace oox { class PropertySet; } +namespace oox::core { class ModelObjectContainer; } + +namespace oox::drawingml { + + +struct RotationProperties +{ + OptValue< sal_Int32 > mnLatitude; + OptValue< sal_Int32 > mnLongitude; + OptValue< sal_Int32 > mnRevolution; +}; + +struct BevelProperties +{ + OptValue< sal_Int32 > mnPreset; + OptValue< sal_Int32 > mnWidth; + OptValue< sal_Int32 > mnHeight; +}; + +struct Generic3DProperties +{ + OptValue< sal_Int32 > mnPreset; + OptValue< float > mfFieldOfVision; + OptValue< float > mfZoom; + OptValue< sal_Int32 > mnLightRigDirection; + OptValue< sal_Int32 > mnLightRigType; + RotationProperties maCameraRotation; + RotationProperties maLightRigRotation; + + OptValue< sal_Int32 > mnExtrusionH; + OptValue< sal_Int32 > mnContourW; + OptValue< sal_Int32 > mnShapeZ; + OptValue< sal_Int32 > mnMaterial; + Color maExtrusionColor; + Color maContourColor; + + OptValue< BevelProperties > maTopBevelProperties; + OptValue< BevelProperties > maBottomBevelProperties; + + static OUString getCameraPrstName( sal_Int32 nElement ); + static OUString getLightRigName( sal_Int32 nElement ); + static OUString getLightRigDirName( sal_Int32 nElement ); + static OUString getBevelPresetTypeString( sal_Int32 nType ); + static OUString getPresetMaterialTypeString( sal_Int32 nType ); + + css::uno::Sequence< css::beans::PropertyValue > getCameraAttributes(); + css::uno::Sequence< css::beans::PropertyValue > getLightRigAttributes(); + css::uno::Sequence< css::beans::PropertyValue > getShape3DAttributes( + const GraphicHelper& rGraphicHelper, ::Color rPhClr ); + static css::uno::Sequence< css::beans::PropertyValue > getBevelAttributes( BevelProperties rProps ); + static css::uno::Sequence< css::beans::PropertyValue > getColorAttributes( + const Color& rColor, const GraphicHelper& rGraphicHelper, ::Color rPhClr ); +}; + +struct Shape3DProperties : Generic3DProperties +{}; + +struct Text3DProperties : Generic3DProperties +{}; + +} // namespace oox::drawingml + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/shapepropertiescontext.hxx b/oox/inc/drawingml/shapepropertiescontext.hxx new file mode 100644 index 000000000..9d047c15c --- /dev/null +++ b/oox/inc/drawingml/shapepropertiescontext.hxx @@ -0,0 +1,43 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_SHAPEPROPERTIESCONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_SHAPEPROPERTIESCONTEXT_HXX + +#include <oox/core/contexthandler2.hxx> +#include <oox/drawingml/shape.hxx> + +namespace oox::drawingml +{ +class ShapePropertiesContext : public ::oox::core::ContextHandler2 +{ +public: + ShapePropertiesContext(::oox::core::ContextHandler2Helper const& rParent, Shape& rShape); + + virtual ::oox::core::ContextHandlerRef + onCreateContext(::sal_Int32 Element, const ::oox::AttributeList& rAttribs) override; + +protected: + Shape& mrShape; +}; +} + +#endif // INCLUDED_OOX_DRAWINGML_SHAPEPROPERTIESCONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/shapestylecontext.hxx b/oox/inc/drawingml/shapestylecontext.hxx new file mode 100644 index 000000000..02faa22a7 --- /dev/null +++ b/oox/inc/drawingml/shapestylecontext.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_SHAPESTYLECONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_SHAPESTYLECONTEXT_HXX + +#include <oox/drawingml/shape.hxx> +#include <oox/core/contexthandler2.hxx> + +namespace oox::drawingml +{ +class ShapeStyleContext final : public ::oox::core::ContextHandler2 +{ +public: + ShapeStyleContext(::oox::core::ContextHandler2Helper const& rParent, Shape& rShape); + virtual ~ShapeStyleContext() override; + + virtual ::oox::core::ContextHandlerRef + onCreateContext(::sal_Int32 Element, const ::oox::AttributeList& rAttribs) override; + +private: + Shape& mrShape; +}; +} + +#endif // INCLUDED_OOX_DRAWINGML_SHAPESTYLECONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/spdefcontext.hxx b/oox/inc/drawingml/spdefcontext.hxx new file mode 100644 index 000000000..6e9206d4a --- /dev/null +++ b/oox/inc/drawingml/spdefcontext.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 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_SPDEFCONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_SPDEFCONTEXT_HXX + +#include <oox/drawingml/shape.hxx> +#include <oox/core/contexthandler2.hxx> + +namespace oox::drawingml +{ +class spDefContext final : public oox::core::ContextHandler2 +{ +public: + spDefContext(::oox::core::ContextHandler2Helper const& rParent, Shape& rDefaultObject); + virtual ::oox::core::ContextHandlerRef + onCreateContext(::sal_Int32 Element, const ::oox::AttributeList& rAttribs) override; + +private: + Shape& mrDefaultObject; +}; +} + +#endif // INCLUDED_OOX_DRAWINGML_SPDEFCONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/table/tablebackgroundstylecontext.hxx b/oox/inc/drawingml/table/tablebackgroundstylecontext.hxx new file mode 100644 index 000000000..d90597497 --- /dev/null +++ b/oox/inc/drawingml/table/tablebackgroundstylecontext.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TABLE_TABLEBACKGROUNDSTYLECONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_TABLE_TABLEBACKGROUNDSTYLECONTEXT_HXX + +#include <oox/core/contexthandler2.hxx> +#include <drawingml/table/tablestyle.hxx> + +namespace oox::drawingml::table { + +class TableBackgroundStyleContext final : public ::oox::core::ContextHandler2 +{ +public: + TableBackgroundStyleContext( ::oox::core::ContextHandler2Helper const & rParent, TableStyle& rTableStyle ); + virtual ~TableBackgroundStyleContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; + +private: + + TableStyle& mrTableStyle; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/table/tablecell.hxx b/oox/inc/drawingml/table/tablecell.hxx new file mode 100644 index 000000000..988b0d057 --- /dev/null +++ b/oox/inc/drawingml/table/tablecell.hxx @@ -0,0 +1,111 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TABLE_TABLECELL_HXX +#define INCLUDED_OOX_DRAWINGML_TABLE_TABLECELL_HXX + +#include <oox/drawingml/drawingmltypes.hxx> +#include <drawingml/textfont.hxx> +#include <com/sun/star/table/XCell.hpp> + +#include <drawingml/fillproperties.hxx> +#include <drawingml/lineproperties.hxx> + +namespace oox::drawingml::table { + +class TableCellContext; +class TableProperties; +class TableStyle; + +class TableCell +{ + friend class TableCellContext; + +public: + + TableCell(); + + sal_Int32 getRowSpan() const { return mnRowSpan; }; + void setRowSpan( sal_Int32 nRowSpan ){ mnRowSpan = nRowSpan; }; + sal_Int32 getGridSpan() const { return mnGridSpan; }; + void setGridSpan( sal_Int32 nGridSpan ){ mnGridSpan = nGridSpan; }; + bool gethMerge() const { return mbhMerge; }; + void sethMerge( bool bhMerge ){ mbhMerge = bhMerge; }; + bool getvMerge() const { return mbvMerge; }; + void setvMerge( bool bvMerge ){ mbvMerge = bvMerge; }; + sal_Int32 getLeftMargin() const { return mnMarL; }; + void setLeftMargin( sal_Int32 nMargin ){ mnMarL = nMargin; }; + sal_Int32 getRightMargin() const { return mnMarR; }; + void setRightMargin( sal_Int32 nMargin ){ mnMarR = nMargin; }; + sal_Int32 getTopMargin() const { return mnMarT; }; + void setTopMargin( sal_Int32 nMargin ){ mnMarT = nMargin; }; + sal_Int32 getBottomMargin() const { return mnMarB; }; + void setBottomMargin( sal_Int32 nMargin ){ mnMarB = nMargin; }; + sal_Int32 getVertToken() const { return mnVertToken; }; + void setVertToken( sal_Int32 nToken ){ mnVertToken = nToken; }; + sal_Int32 getAnchorToken() const { return mnAnchorToken; }; + void setAnchorToken( sal_Int32 nToken ){ mnAnchorToken = nToken; }; + void setAnchorCtr( bool bAnchorCtr ){ mbAnchorCtr = bAnchorCtr; }; + void setHorzOverflowToken( sal_Int32 nToken ){ mnHorzOverflowToken = nToken; }; + + void setTextBody( const oox::drawingml::TextBodyPtr& pTextBody ){ mpTextBody = pTextBody; }; + const oox::drawingml::TextBodyPtr& getTextBody() const { return mpTextBody; }; + + void pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, + const ::oox::drawingml::TextListStylePtr& pMasterTextListStyle, + const css::uno::Reference < css::table::XCell >& rxCell, + const TableProperties& rTableProperties, + const TableStyle& rTable, + sal_Int32 nColumn, sal_Int32 nMaxColumn, sal_Int32 nRow, sal_Int32 nMaxRow ); + +private: + + oox::drawingml::TextBodyPtr mpTextBody; + + oox::drawingml::LineProperties maLinePropertiesLeft; + oox::drawingml::LineProperties maLinePropertiesRight; + oox::drawingml::LineProperties maLinePropertiesTop; + oox::drawingml::LineProperties maLinePropertiesBottom; + oox::drawingml::LineProperties maLinePropertiesInsideH; + oox::drawingml::LineProperties maLinePropertiesInsideV; + oox::drawingml::LineProperties maLinePropertiesTopLeftToBottomRight; + oox::drawingml::LineProperties maLinePropertiesBottomLeftToTopRight; + + oox::drawingml::FillProperties maFillProperties; + + sal_Int32 mnRowSpan; + sal_Int32 mnGridSpan; + bool mbhMerge; + bool mbvMerge; + + sal_Int32 mnMarL; + sal_Int32 mnMarR; + sal_Int32 mnMarT; + sal_Int32 mnMarB; + sal_Int32 mnVertToken; + sal_Int32 mnAnchorToken; + bool mbAnchorCtr; + sal_Int32 mnHorzOverflowToken; +}; + +} + +#endif // INCLUDED_OOX_DRAWINGML_TABLE_TABLECELL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/table/tablecellcontext.hxx b/oox/inc/drawingml/table/tablecellcontext.hxx new file mode 100644 index 000000000..24a8a2830 --- /dev/null +++ b/oox/inc/drawingml/table/tablecellcontext.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TABLE_TABLECELLCONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_TABLE_TABLECELLCONTEXT_HXX + +#include <oox/core/contexthandler2.hxx> +#include <drawingml/table/tablecell.hxx> + +namespace oox::drawingml::table +{ +class TableCellContext final : public ::oox::core::ContextHandler2 +{ +public: + TableCellContext(::oox::core::ContextHandler2Helper const& rParent, + const ::oox::AttributeList& rAttribs, TableCell& rTableCell); + virtual ~TableCellContext() override; + + virtual ::oox::core::ContextHandlerRef + onCreateContext(::sal_Int32 Element, const ::oox::AttributeList& rAttribs) override; + +private: + TableCell& mrTableCell; +}; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/table/tablecontext.hxx b/oox/inc/drawingml/table/tablecontext.hxx new file mode 100644 index 000000000..3004333d2 --- /dev/null +++ b/oox/inc/drawingml/table/tablecontext.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TABLE_TABLECONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_TABLE_TABLECONTEXT_HXX + +#include <oox/drawingml/shapecontext.hxx> + +namespace oox::drawingml::table +{ +class TableProperties; + +class TableContext final : public ShapeContext +{ +public: + TableContext(::oox::core::ContextHandler2Helper const& rParent, const ShapePtr& pShapePtr); + virtual ~TableContext() override; + + virtual ::oox::core::ContextHandlerRef + onCreateContext(::sal_Int32 Element, const ::oox::AttributeList& rAttribs) override; + +private: + TableProperties& mrTableProperties; +}; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/table/tablepartstylecontext.hxx b/oox/inc/drawingml/table/tablepartstylecontext.hxx new file mode 100644 index 000000000..c2f5baada --- /dev/null +++ b/oox/inc/drawingml/table/tablepartstylecontext.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TABLE_TABLEPARTSTYLECONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_TABLE_TABLEPARTSTYLECONTEXT_HXX + +#include <oox/core/contexthandler2.hxx> +#include <drawingml/table/tablestylepart.hxx> + +namespace oox::drawingml::table { + +class TablePartStyleContext final : public ::oox::core::ContextHandler2 +{ +public: + TablePartStyleContext( ::oox::core::ContextHandler2Helper const & rParent, TableStylePart& rTableStylePart ); + virtual ~TablePartStyleContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; + +private: + + TableStylePart& mrTableStylePart; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/table/tableproperties.hxx b/oox/inc/drawingml/table/tableproperties.hxx new file mode 100644 index 000000000..34e361b18 --- /dev/null +++ b/oox/inc/drawingml/table/tableproperties.hxx @@ -0,0 +1,83 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TABLE_TABLEPROPERTIES_HXX +#define INCLUDED_OOX_DRAWINGML_TABLE_TABLEPROPERTIES_HXX + +#include <drawingml/table/tablerow.hxx> +#include <drawingml/table/tablestyle.hxx> +#include <oox/drawingml/color.hxx> + +#include <memory> +#include <vector> + +namespace oox::drawingml::table { + +class TableProperties +{ +public: + + TableProperties(); + + std::vector< sal_Int32 >& getTableGrid() { return mvTableGrid; }; + std::vector< TableRow >& getTableRows() { return mvTableRows; }; + + OUString& getStyleId() { return maStyleId; }; + std::shared_ptr< TableStyle >& getTableStyle() { return mpTableStyle; }; + bool isFirstRow() const { return mbFirstRow; }; + void setFirstRow(bool b) { mbFirstRow = b; }; + bool isFirstCol() const { return mbFirstCol; }; + void setFirstCol(bool b) { mbFirstCol = b; }; + bool isLastRow() const { return mbLastRow; }; + void setLastRow(bool b) { mbLastRow = b; }; + bool isLastCol() const { return mbLastCol; }; + void setLastCol(bool b) { mbLastCol = b; }; + bool isBandRow() const { return mbBandRow; }; + void setBandRow(bool b) { mbBandRow = b; }; + bool isBandCol() const { return mbBandCol; }; + void setBandCol(bool b) { mbBandCol = b; }; + Color& getBgColor(){ return maBgColor; }; + + void pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBase, + const css::uno::Reference < css::beans::XPropertySet > & xPropSet, + const ::oox::drawingml::TextListStylePtr& pMasterTextListStyle ); + +private: + + const TableStyle& getUsedTableStyle(const ::oox::core::XmlFilterBase& rFilterBase, std::unique_ptr<TableStyle>& rTableStyleToDelete); + + OUString maStyleId; // either StyleId is available + std::shared_ptr< TableStyle > mpTableStyle; // or the complete TableStyle + std::vector< sal_Int32 > mvTableGrid; + std::vector< TableRow > mvTableRows; + Color maBgColor; + + bool mbFirstRow; + bool mbFirstCol; + bool mbLastRow; + bool mbLastCol; + bool mbBandRow; + bool mbBandCol; +}; + +} + +#endif // INCLUDED_OOX_DRAWINGML_TABLE_TABLEPROPERTIES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/table/tablerow.hxx b/oox/inc/drawingml/table/tablerow.hxx new file mode 100644 index 000000000..7f8d212c1 --- /dev/null +++ b/oox/inc/drawingml/table/tablerow.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TABLE_TABLEROW_HXX +#define INCLUDED_OOX_DRAWINGML_TABLE_TABLEROW_HXX + +#include <drawingml/table/tablecell.hxx> +#include <vector> + +namespace oox::drawingml::table +{ +class TableRow +{ +public: + TableRow(); + + void setHeight(sal_Int32 nHeight) { mnHeight = nHeight; }; + sal_Int32 getHeight() const { return mnHeight; }; + std::vector<TableCell>& getTableCells() { return mvTableCells; }; + +private: + sal_Int32 mnHeight; + std::vector<TableCell> mvTableCells; +}; +} + +#endif // INCLUDED_OOX_DRAWINGML_TABLE_TABLEROW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/table/tablerowcontext.hxx b/oox/inc/drawingml/table/tablerowcontext.hxx new file mode 100644 index 000000000..1b18e45d1 --- /dev/null +++ b/oox/inc/drawingml/table/tablerowcontext.hxx @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TABLE_TABLEROWCONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_TABLE_TABLEROWCONTEXT_HXX + +#include <oox/core/contexthandler2.hxx> + +namespace oox::drawingml::table +{ +class TableRow; + +class TableRowContext final : public ::oox::core::ContextHandler2 +{ +public: + TableRowContext(::oox::core::ContextHandler2Helper const& rParent, + const ::oox::AttributeList& rAttribs, TableRow& rTableRow); + virtual ~TableRowContext() override; + + virtual ::oox::core::ContextHandlerRef + onCreateContext(::sal_Int32 Element, const ::oox::AttributeList& rAttribs) override; + +private: + TableRow& mrTableRow; +}; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/table/tablestyle.hxx b/oox/inc/drawingml/table/tablestyle.hxx new file mode 100644 index 000000000..26c4216a7 --- /dev/null +++ b/oox/inc/drawingml/table/tablestyle.hxx @@ -0,0 +1,84 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TABLE_TABLESTYLE_HXX +#define INCLUDED_OOX_DRAWINGML_TABLE_TABLESTYLE_HXX + +#include <drawingml/table/tablestylepart.hxx> +#include <oox/drawingml/drawingmltypes.hxx> +#include <oox/drawingml/shape.hxx> + +namespace oox::drawingml::table { + +class TableStyle +{ +public: + + TableStyle(); + + OUString& getStyleId(){ return maStyleId; } + OUString& getStyleName() { return maStyleName; } + + ::oox::drawingml::ShapeStyleRef& getBackgroundFillStyleRef(){ return maFillStyleRef; } + + ::oox::drawingml::FillPropertiesPtr& getBackgroundFillProperties(){ return mpFillProperties; } + + TableStylePart& getWholeTbl() { return maWholeTbl; } + TableStylePart& getBand1H() { return maBand1H; } + TableStylePart& getBand2H() { return maBand2H; } + TableStylePart& getBand1V() { return maBand1V; } + TableStylePart& getBand2V() { return maBand2V; } + TableStylePart& getLastCol() { return maLastCol; } + TableStylePart& getFirstCol() { return maFirstCol; } + TableStylePart& getLastRow() { return maLastRow; } + TableStylePart& getSeCell() { return maSeCell; } + TableStylePart& getSwCell() { return maSwCell; } + TableStylePart& getFirstRow() { return maFirstRow; } + TableStylePart& getNeCell() { return maNeCell; } + TableStylePart& getNwCell() { return maNwCell; } + +private: + + OUString maStyleId; + OUString maStyleName; + + ::oox::drawingml::ShapeStyleRef maFillStyleRef; + + ::oox::drawingml::FillPropertiesPtr mpFillProperties; + + TableStylePart maWholeTbl; + TableStylePart maBand1H; + TableStylePart maBand2H; + TableStylePart maBand1V; + TableStylePart maBand2V; + TableStylePart maLastCol; + TableStylePart maFirstCol; + TableStylePart maLastRow; + TableStylePart maSeCell; + TableStylePart maSwCell; + TableStylePart maFirstRow; + TableStylePart maNeCell; + TableStylePart maNwCell; +}; + +} + +#endif // INCLUDED_OOX_DRAWINGML_TABLE_TABLESTYLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/table/tablestylecellstylecontext.hxx b/oox/inc/drawingml/table/tablestylecellstylecontext.hxx new file mode 100644 index 000000000..404e86a49 --- /dev/null +++ b/oox/inc/drawingml/table/tablestylecellstylecontext.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TABLE_TABLESTYLECELLSTYLECONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_TABLE_TABLESTYLECELLSTYLECONTEXT_HXX + +#include <oox/core/contexthandler2.hxx> +#include <drawingml/table/tablestylepart.hxx> + +namespace oox::drawingml::table { + +class TableStyleCellStyleContext final : public ::oox::core::ContextHandler2 +{ +public: + TableStyleCellStyleContext( ::oox::core::ContextHandler2Helper const & rParent, TableStylePart& rTableStylePart ); + virtual ~TableStyleCellStyleContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; + +private: + TableStylePart& mrTableStylePart; + sal_Int32 mnLineType; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/table/tablestylecontext.hxx b/oox/inc/drawingml/table/tablestylecontext.hxx new file mode 100644 index 000000000..1ab003496 --- /dev/null +++ b/oox/inc/drawingml/table/tablestylecontext.hxx @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TABLE_TABLESTYLECONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_TABLE_TABLESTYLECONTEXT_HXX + +#include <oox/core/contexthandler2.hxx> +#include <drawingml/table/tablestyle.hxx> + +namespace oox::drawingml::table { + +class TableStyleContext final : public ::oox::core::ContextHandler2 +{ +public: + TableStyleContext( ::oox::core::ContextHandler2Helper const & rParent, + const ::oox::AttributeList& rAttribs, + TableStyle& rTableStyle ); + virtual ~TableStyleContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; + +private: + TableStyle& mrTableStyle; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/table/tablestylelist.hxx b/oox/inc/drawingml/table/tablestylelist.hxx new file mode 100644 index 000000000..7c0d1e2b1 --- /dev/null +++ b/oox/inc/drawingml/table/tablestylelist.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TABLE_TABLESTYLELIST_HXX +#define INCLUDED_OOX_DRAWINGML_TABLE_TABLESTYLELIST_HXX + +#include <rtl/ustring.hxx> +#include <memory> +#include <vector> + +namespace oox::drawingml::table { + +class TableStyle; + +class TableStyleList +{ +public: + + TableStyleList(); + ~TableStyleList(); + + OUString& getDefaultStyleId() { return maDefaultStyleId; }; + std::vector< TableStyle >& getTableStyles(){ return maTableStyles; }; + +private: + + OUString maDefaultStyleId; + std::vector< TableStyle > maTableStyles; + +}; + +typedef std::shared_ptr< TableStyleList > TableStyleListPtr; + +} + +#endif // INCLUDED_OOX_DRAWINGML_TABLE_TABLESTYLELIST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/table/tablestylelistfragmenthandler.hxx b/oox/inc/drawingml/table/tablestylelistfragmenthandler.hxx new file mode 100644 index 000000000..456877cbb --- /dev/null +++ b/oox/inc/drawingml/table/tablestylelistfragmenthandler.hxx @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TABLE_TABLESTYLELISTFRAGMENTHANDLER_HXX +#define INCLUDED_OOX_DRAWINGML_TABLE_TABLESTYLELISTFRAGMENTHANDLER_HXX + +#include <drawingml/table/tablestylelist.hxx> +#include <oox/core/fragmenthandler2.hxx> + +namespace oox::drawingml::table { + +class TableStyleListFragmentHandler final : public ::oox::core::FragmentHandler2 +{ +public: + explicit TableStyleListFragmentHandler( + ::oox::core::XmlFilterBase& rFilter, + const OUString& rFragmentPath, + TableStyleList& rTableStyleList ); + virtual ~TableStyleListFragmentHandler() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const AttributeList& rAttribs ) override; + +private: + + TableStyleList& mrTableStyleList; +}; + +} // namespace oox::drawingml::table + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/table/tablestylepart.hxx b/oox/inc/drawingml/table/tablestylepart.hxx new file mode 100644 index 000000000..3d1251731 --- /dev/null +++ b/oox/inc/drawingml/table/tablestylepart.hxx @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TABLE_TABLESTYLEPART_HXX +#define INCLUDED_OOX_DRAWINGML_TABLE_TABLESTYLEPART_HXX + +#include <optional> +#include <oox/drawingml/color.hxx> +#include <drawingml/textfont.hxx> +#include <oox/drawingml/shape.hxx> + +#include <map> + +namespace oox::drawingml::table { + +class TableStylePart +{ +public: + + TableStylePart(); + + ::oox::drawingml::Color& getTextColor(){ return maTextColor; } + ::std::optional< bool >& getTextBoldStyle(){ return maTextBoldStyle; } + ::std::optional< bool >& getTextItalicStyle(){ return maTextItalicStyle; } + ::oox::drawingml::TextFont& getAsianFont(){ return maAsianFont; } + ::oox::drawingml::TextFont& getComplexFont(){ return maComplexFont; } + ::oox::drawingml::TextFont& getSymbolFont(){ return maSymbolFont; } + ::oox::drawingml::TextFont& getLatinFont(){ return maLatinFont; } + + ::oox::drawingml::FillPropertiesPtr& getFillProperties(){ return mpFillProperties; } + std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >& getLineBorders(){ return maLineBorders; } + + ::oox::drawingml::ShapeStyleRefMap& getStyleRefs(){ return maStyleRefs; } + +private: + + ::oox::drawingml::Color maTextColor; + ::std::optional< bool > maTextBoldStyle; + ::std::optional< bool > maTextItalicStyle; + ::oox::drawingml::TextFont maAsianFont; + ::oox::drawingml::TextFont maComplexFont; + ::oox::drawingml::TextFont maSymbolFont; + ::oox::drawingml::TextFont maLatinFont; + + ::oox::drawingml::FillPropertiesPtr mpFillProperties; + std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr > maLineBorders; + ::oox::drawingml::ShapeStyleRefMap maStyleRefs; +}; + +} + +#endif // INCLUDED_OOX_DRAWINGML_TABLE_TABLESTYLEPART_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/table/tablestyletextstylecontext.hxx b/oox/inc/drawingml/table/tablestyletextstylecontext.hxx new file mode 100644 index 000000000..7edeef1e8 --- /dev/null +++ b/oox/inc/drawingml/table/tablestyletextstylecontext.hxx @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TABLE_TABLESTYLETEXTSTYLECONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_TABLE_TABLESTYLETEXTSTYLECONTEXT_HXX + +#include <oox/core/contexthandler2.hxx> +#include <drawingml/table/tablestylepart.hxx> + +namespace oox::drawingml::table { + +class TableStyleTextStyleContext final : public ::oox::core::ContextHandler2 +{ +public: + TableStyleTextStyleContext( ::oox::core::ContextHandler2Helper const & rParent, + const ::oox::AttributeList& rAttribs, + TableStylePart& rTableStylePart ); + virtual ~TableStyleTextStyleContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; + +private: + TableStylePart& mrTableStylePart; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/textbody.hxx b/oox/inc/drawingml/textbody.hxx new file mode 100644 index 000000000..245589e86 --- /dev/null +++ b/oox/inc/drawingml/textbody.hxx @@ -0,0 +1,104 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TEXTBODY_HXX +#define INCLUDED_OOX_DRAWINGML_TEXTBODY_HXX + +#include <oox/drawingml/drawingmltypes.hxx> +#include <drawingml/textbodyproperties.hxx> +#include <drawingml/textliststyle.hxx> +#include <drawingml/shape3dproperties.hxx> +#include <oox/helper/refvector.hxx> + +namespace com::sun::star::text { + class XText; + class XTextCursor; +} + +namespace oox::core { class XmlFilterBase; } + +namespace oox::drawingml { + +class TextParagraph; +typedef RefVector< TextParagraph > TextParagraphVector; + +class TextBody +{ +public: + TextBody(); + TextBody( const TextBodyPtr& pBody ); + + const TextParagraphVector& getParagraphs() const { return maParagraphs; } + TextParagraph& addParagraph(); + + const TextListStyle& getTextListStyle() const { return maTextListStyle; } + TextListStyle& getTextListStyle() { return maTextListStyle; } + + const TextBodyProperties& getTextProperties() const { return maTextProperties; } + TextBodyProperties& getTextProperties() { return maTextProperties; } + + Text3DProperties& get3DProperties() { return ma3DProperties; } + const Text3DProperties& get3DProperties() const { return ma3DProperties; } + + /** insert the text body at the text cursor */ + void insertAt( + const ::oox::core::XmlFilterBase& rFilterBase, + const css::uno::Reference < css::text::XText > & xText, + const css::uno::Reference < css::text::XTextCursor > & xAt, + const TextCharacterProperties& rTextStyleProperties, + const TextListStylePtr& pMasterTextListStyle ) const; + bool isEmpty() const; + OUString toString() const; + + /** Returns whether the textbody had a rPr tag in it that alters it visually + * + * For instance _lang_ doesn't have a visual effect. + */ + bool hasVisualRunProperties() const; + + /// Returns whether the textbody had a pPr tag in it + bool hasParagraphProperties() const; + + /// Returns whether the textbody had a non-empty bodyPr tag in it + bool hasNoninheritedBodyProperties() const { return mbHasNoninheritedBodyProperties; } + /// Flags textbody as having a non-empty bodyPr tag + void setHasNoninheritedBodyProperties() { mbHasNoninheritedBodyProperties = true; } + + /// Returns whether the textbody had a non-empty lstStyle tag in it + bool hasListStyleOnImport() const { return maTextListStyle.hasListStyleOnImport(); } + + void ApplyStyleEmpty( + const ::oox::core::XmlFilterBase& rFilterBase, + const css::uno::Reference < css::text::XText > & xText, + const TextCharacterProperties& rTextStyleProperties, + const TextListStylePtr& pMasterTextListStylePtr) const; +private: + TextParagraphVector maParagraphs; + TextBodyProperties maTextProperties; + /// Set if bodyPr tag in this textbody is non-empty during import + bool mbHasNoninheritedBodyProperties; + TextListStyle maTextListStyle; + Text3DProperties ma3DProperties; +}; + +} + +#endif // INCLUDED_OOX_DRAWINGML_TEXTBODY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/textbodycontext.hxx b/oox/inc/drawingml/textbodycontext.hxx new file mode 100644 index 000000000..e164e3520 --- /dev/null +++ b/oox/inc/drawingml/textbodycontext.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TEXTBODYCONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_TEXTBODYCONTEXT_HXX + +#include <drawingml/textbody.hxx> +#include <drawingml/textrun.hxx> +#include <oox/core/contexthandler2.hxx> + +namespace oox::drawingml { + +class TextBodyContext final : public ::oox::core::ContextHandler2 +{ +public: + TextBodyContext( ::oox::core::ContextHandler2Helper const & rParent, TextBody& rTextBody ); + TextBodyContext(::oox::core::ContextHandler2Helper const& rParent, const ShapePtr& pShapePtr); + + virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; + +private: + TextBody& mrTextBody; + ShapePtr mpShapePtr; +}; + +// CT_RegularTextRun +class RegularTextRunContext final : public ::oox::core::ContextHandler2 +{ +public: + RegularTextRunContext( ::oox::core::ContextHandler2Helper const & rParent, TextRunPtr const & pRunPtr ); + + virtual void onEndElement() override; + virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; + virtual void onCharacters( const OUString& aChars ) override; + +private: + TextRunPtr mpRunPtr; + bool mbIsInText; +}; + +} + +#endif // INCLUDED_OOX_DRAWINGML_TEXTBODYCONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/textbodyproperties.hxx b/oox/inc/drawingml/textbodyproperties.hxx new file mode 100644 index 000000000..7cc1b9d80 --- /dev/null +++ b/oox/inc/drawingml/textbodyproperties.hxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TEXTBODYPROPERTIES_HXX +#define INCLUDED_OOX_DRAWINGML_TEXTBODYPROPERTIES_HXX + +#include <com/sun/star/drawing/TextVerticalAdjust.hpp> +#include <com/sun/star/drawing/XShape.hpp> +#include <oox/helper/helper.hxx> +#include <oox/helper/propertymap.hxx> +#include <optional> +#include <array> + +class Size; + +namespace oox::drawingml { + +struct TextBodyProperties +{ + PropertyMap maPropertyMap; + OptValue< sal_Int32 > moRotation; + bool mbAnchorCtr; + OptValue< sal_Int32 > moVert; + bool moUpright = false; + std::array<std::optional<sal_Int32>, 4> moInsets; + std::optional< sal_Int32 > moTextOffUpper; + std::optional< sal_Int32 > moTextOffLeft; + std::optional< sal_Int32 > moTextOffLower; + std::optional< sal_Int32 > moTextOffRight; + css::drawing::TextVerticalAdjust meVA; + OUString msPrst; + /// Normal autofit: font scale (default: 100%). + sal_Int32 mnFontScale = 100000; + OUString msHorzOverflow; + OUString msVertOverflow; + + std::array<std::optional<sal_Int32>, 4> maTextDistanceValues; + + explicit TextBodyProperties(); + + void pushTextDistances(Size const& rShapeSize); + void readjustTextDistances(css::uno::Reference<css::drawing::XShape> const& xShape); + void pushVertSimulation(); + +}; + + +} // namespace oox::drawingml + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/textbodypropertiescontext.hxx b/oox/inc/drawingml/textbodypropertiescontext.hxx new file mode 100644 index 000000000..d10d60d41 --- /dev/null +++ b/oox/inc/drawingml/textbodypropertiescontext.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 INCLUDED_OOX_DRAWINGML_TEXTBODYPROPERTIESCONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_TEXTBODYPROPERTIESCONTEXT_HXX + +#include <oox/core/contexthandler2.hxx> +#include <oox/drawingml/drawingmltypes.hxx> + +namespace oox::drawingml { + +struct TextBodyProperties; + +class TextBodyPropertiesContext final : public ::oox::core::ContextHandler2 +{ +public: + TextBodyPropertiesContext( ::oox::core::ContextHandler2Helper const & rParent, + const ::oox::AttributeList& rAttributes, + TextBodyProperties& rTextBodyProp ); + + TextBodyPropertiesContext(::oox::core::ContextHandler2Helper const& rParent, + const ::oox::AttributeList& rAttributes, const ShapePtr& pShapePtr); + + virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; + +private: + TextBodyProperties& mrTextBodyProp; + ShapePtr mpShapePtr; +}; + +} + +#endif // INCLUDED_OOX_DRAWINGML_TEXTBODYPROPERTIESCONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/textcharacterproperties.hxx b/oox/inc/drawingml/textcharacterproperties.hxx new file mode 100644 index 000000000..49d412569 --- /dev/null +++ b/oox/inc/drawingml/textcharacterproperties.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 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TEXTCHARACTERPROPERTIES_HXX +#define INCLUDED_OOX_DRAWINGML_TEXTCHARACTERPROPERTIES_HXX + +#include <oox/helper/helper.hxx> +#include <oox/helper/propertymap.hxx> +#include <oox/drawingml/color.hxx> +#include <drawingml/textfont.hxx> + +#include <drawingml/fillproperties.hxx> +#include <drawingml/lineproperties.hxx> + +namespace oox { class PropertySet; } + +namespace oox::drawingml { + + +struct TextCharacterProperties +{ + PropertyMap maHyperlinkPropertyMap; + TextFont maLatinFont; + TextFont maLatinThemeFont; + TextFont maAsianFont; + TextFont maAsianThemeFont; + TextFont maComplexFont; + TextFont maComplexThemeFont; + TextFont maSymbolFont; + Color maUnderlineColor; + Color maHighlightColor; + OptValue< OUString > moLang; + OptValue< sal_Int32 > moHeight; + /// If a font scale has to be applied manually to moHeight. + OptValue< double > moFontScale; + OptValue< sal_Int32 > moSpacing; + OptValue< sal_Int32 > moUnderline; + OptValue< sal_Int32 > moBaseline; + OptValue< sal_Int32 > moStrikeout; + OptValue< sal_Int32 > moCaseMap; + OptValue< bool > moBold; + OptValue< bool > moItalic; + OptValue< bool > moUnderlineLineFollowText; + OptValue< bool > moUnderlineFillFollowText; + OptValue<LineProperties> moTextOutlineProperties; + + FillProperties maFillProperties; + /// Set if there was a property set that alters run visually during import + bool mbHasVisualRunProperties; + + std::vector<css::beans::PropertyValue> maTextEffectsProperties; + + /** Overwrites all members that are explicitly set in rSourceProps. */ + void assignUsed( const TextCharacterProperties& rSourceProps ); + + /** Returns the current character size. If possible the masterstyle should + have been applied before, otherwise the character size can be zero and + the default value is returned. */ + float getCharHeightPoints( float fDefault ) const; + + /** Writes the properties to the passed property map. */ + void pushToPropMap( + PropertyMap& rPropMap, + const ::oox::core::XmlFilterBase& rFilter ) const; + + /** Writes the properties to the passed property set. */ + void pushToPropSet( + PropertySet& rPropSet, + const ::oox::core::XmlFilterBase& rFilter ) const; + + TextCharacterProperties() : mbHasVisualRunProperties(false) {} +}; + + +} // namespace oox::drawingml + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/textcharacterpropertiescontext.hxx b/oox/inc/drawingml/textcharacterpropertiescontext.hxx new file mode 100644 index 000000000..b2df1b926 --- /dev/null +++ b/oox/inc/drawingml/textcharacterpropertiescontext.hxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TEXTCHARACTERPROPERTIESCONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_TEXTCHARACTERPROPERTIESCONTEXT_HXX + +#include <oox/core/contexthandler2.hxx> + +namespace oox::drawingml { + +struct TextCharacterProperties; + +class TextCharacterPropertiesContext final : public ::oox::core::ContextHandler2 +{ +public: + TextCharacterPropertiesContext( ::oox::core::ContextHandler2Helper const & rParent, + const ::oox::AttributeList& rAttribs, + TextCharacterProperties& rTextCharacterProperties ); + virtual ~TextCharacterPropertiesContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; + +private: + TextCharacterProperties& mrTextCharacterProperties; +}; + +} + +#endif // INCLUDED_OOX_DRAWINGML_TEXTCHARACTERPROPERTIESCONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/texteffectscontext.hxx b/oox/inc/drawingml/texteffectscontext.hxx new file mode 100644 index 000000000..9305bccce --- /dev/null +++ b/oox/inc/drawingml/texteffectscontext.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TEXTEFFECTSCONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_TEXTEFFECTSCONTEXT_HXX + +#include <com/sun/star/beans/PropertyValue.hpp> + +#include <oox/helper/grabbagstack.hxx> +#include <oox/core/contexthandler2.hxx> +#include <memory> +#include <vector> + +namespace oox::drawingml { + +class TextEffectsContext final : public oox::core::ContextHandler2 +{ +public: + TextEffectsContext(oox::core::ContextHandler2Helper const & rParent, + sal_Int32 aElementToken, + std::vector<css::beans::PropertyValue>& rTextEffectsProperties); + virtual ~TextEffectsContext() override; + + virtual void onStartElement(const oox::AttributeList& rAttribs) override; + virtual void onEndElement() override; + + virtual oox::core::ContextHandlerRef onCreateContext(sal_Int32 Element, const oox::AttributeList& rAttribs) override; + +private: + void processAttributes(const AttributeList& rAttribs); + void pushAttributeToGrabBag (sal_Int32 aAttributeId, const OUString& rElementName, const AttributeList& rAttribs); + + std::vector<css::beans::PropertyValue>& mrTextEffectsProperties; + std::unique_ptr<oox::GrabBagStack> mpGrabBagStack; + sal_Int32 mnCurrentElement; +}; + +} + +#endif // INCLUDED_OOX_DRAWINGML_TEXTEFFECTSCONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/textfield.hxx b/oox/inc/drawingml/textfield.hxx new file mode 100644 index 000000000..c26a8518c --- /dev/null +++ b/oox/inc/drawingml/textfield.hxx @@ -0,0 +1,74 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TEXTFIELD_HXX +#define INCLUDED_OOX_DRAWINGML_TEXTFIELD_HXX + +#include <drawingml/textrun.hxx> +#include <drawingml/textparagraphproperties.hxx> + +enum class SvxTimeFormat; +enum class SvxDateFormat; + +namespace oox::drawingml { + +struct TextCharacterProperties; + +class TextField final + : public TextRun +{ +public: + TextField(); + + TextParagraphProperties& getTextParagraphProperties() { return maTextParagraphProperties; } + const TextParagraphProperties& getTextParagraphProperties() const { return maTextParagraphProperties; } + + void setType( const OUString& sType ) { msType = sType; } + const OUString& getType() const { return msType; } + void setUuid( const OUString & sUuid ) { msUuid = sUuid; } + const OUString& getUuid() const { return msUuid; } + + virtual sal_Int32 insertAt( + const ::oox::core::XmlFilterBase& rFilterBase, + const css::uno::Reference < css::text::XText > & xText, + const css::uno::Reference < css::text::XTextCursor > &xAt, + const TextCharacterProperties& rTextCharacterStyle, + float nDefaultCharHeight) const override; + + /** Gets the corresponding LO Date format for given OOXML datetime field type + * + * @param rDateTimeType PPTX datetime field type e.g. datetime3 + */ + static SvxDateFormat getLODateFormat( std::u16string_view rDateTimeType ); + /** Gets the corresponding LO Time format for given OOXML datetime field type + * + * @param rDateTimeType PPTX datetime field type e.g. datetime3 + */ + static SvxTimeFormat getLOTimeFormat( std::u16string_view rDateTimeType ); +private: + TextParagraphProperties maTextParagraphProperties; + OUString msType; + OUString msUuid; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/textfieldcontext.hxx b/oox/inc/drawingml/textfieldcontext.hxx new file mode 100644 index 000000000..3bb8a3ccd --- /dev/null +++ b/oox/inc/drawingml/textfieldcontext.hxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TEXTFIELDCONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_TEXTFIELDCONTEXT_HXX + +#include <oox/core/contexthandler2.hxx> + +namespace oox::drawingml { + +class TextField; + +class TextFieldContext final + : public ::oox::core::ContextHandler2 +{ +public: + TextFieldContext( ::oox::core::ContextHandler2Helper const & rParent, + const ::oox::AttributeList& rAttributes, + TextField& rTextField); + virtual void onEndElement( ) override; + virtual void onCharacters( const OUString& aChars ) override; + virtual ::oox::core::ContextHandlerRef onCreateContext( + sal_Int32 aElementToken, const ::oox::AttributeList& rAttributes ) override; + +private: + TextField& mrTextField; + bool mbIsInText; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/textfont.hxx b/oox/inc/drawingml/textfont.hxx new file mode 100644 index 000000000..6bdf13ab8 --- /dev/null +++ b/oox/inc/drawingml/textfont.hxx @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TEXTFONT_HXX +#define INCLUDED_OOX_DRAWINGML_TEXTFONT_HXX + +#include <rtl/ustring.hxx> + +namespace oox { class AttributeList; } +namespace oox::core { class XmlFilterBase; } + +namespace oox::drawingml { + + +/** carries a CT_TextFont*/ +class TextFont +{ +public: + explicit TextFont(); + + /** Sets attributes from the passed attribute list. */ + void setAttributes( const AttributeList& rAttribs ); + + /** Sets font name and init other attributes. */ + void setAttributes( const OUString& rFontName ); + + /** Overwrites this text font with the passed text font, if it is used. */ + void assignIfUsed( const TextFont& rTextFont ); + + /** Returns the font name, pitch, and family; tries to resolve theme + placeholder names, e.g. '+mj-lt' for the major latin theme font. */ + bool getFontData( + OUString& rFontName, + sal_Int16& rnFontPitch, + sal_Int16& rnFontFamily, + const ::oox::core::XmlFilterBase& rFilter ) const; + +private: + bool implGetFontData( + OUString& rFontName, + sal_Int16& rnFontPitch, + sal_Int16& rnFontFamily ) const; + +private: + OUString maTypeface; + OUString maPanose; + sal_Int32 mnPitch; + sal_Int32 mnCharset; +}; + + +} // namespace oox::drawingml + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/textliststyle.hxx b/oox/inc/drawingml/textliststyle.hxx new file mode 100644 index 000000000..464e48756 --- /dev/null +++ b/oox/inc/drawingml/textliststyle.hxx @@ -0,0 +1,74 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TEXTLISTSTYLE_HXX +#define INCLUDED_OOX_DRAWINGML_TEXTLISTSTYLE_HXX + +#include <drawingml/textparagraphproperties.hxx> +#include <array> + +namespace oox::drawingml +{ +constexpr int NUM_TEXT_LIST_STYLE_ENTRIES = 9; +typedef std::array<TextParagraphProperties, NUM_TEXT_LIST_STYLE_ENTRIES> + TextParagraphPropertiesArray; + +class TextListStyle +{ +public: + TextListStyle(); + ~TextListStyle(); + + TextListStyle(const TextListStyle& rStyle); + TextListStyle& operator=(const TextListStyle& rStyle); + + void apply(const TextListStyle& rTextListStyle); + + const TextParagraphPropertiesArray& getListStyle() const { return maListStyle; }; + TextParagraphPropertiesArray& getListStyle() { return maListStyle; }; + + const TextParagraphPropertiesArray& getAggregationListStyle() const + { + return maAggregationListStyle; + }; + TextParagraphPropertiesArray& getAggregationListStyle() { return maAggregationListStyle; }; + + /// Flags ListStyle as having a non-empty lstStyle tag on import + void setHasListStyleOnImport() { mbHasListStyleOnImport = true; } + /** Returns whether the lstStyle tag was non-empty on import + * + * @return true if list style has its own noninherited properties. + */ + bool hasListStyleOnImport() const { return mbHasListStyleOnImport; } + +#ifdef DBG_UTIL + void dump() const; +#endif + +private: + TextParagraphPropertiesArray maListStyle; + TextParagraphPropertiesArray maAggregationListStyle; + /// Set if ListStyle has a non-empty lstStyle tag on import + bool mbHasListStyleOnImport; +}; +} + +#endif // INCLUDED_OOX_DRAWINGML_TEXTLISTSTYLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/textliststylecontext.hxx b/oox/inc/drawingml/textliststylecontext.hxx new file mode 100644 index 000000000..52b2a08cb --- /dev/null +++ b/oox/inc/drawingml/textliststylecontext.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TEXTLISTSTYLECONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_TEXTLISTSTYLECONTEXT_HXX + +#include <drawingml/textliststyle.hxx> +#include <oox/core/contexthandler2.hxx> + +namespace oox::drawingml { + +class TextListStyleContext final : public ::oox::core::ContextHandler2 +{ +public: + TextListStyleContext( ::oox::core::ContextHandler2Helper const & rParent, TextListStyle& rTextListStyle ); + virtual ~TextListStyleContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; + +private: + TextListStyle& mrTextListStyle; +}; + +} + +#endif // INCLUDED_OOX_DRAWINGML_TEXTLISTSTYLECONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/textparagraph.hxx b/oox/inc/drawingml/textparagraph.hxx new file mode 100644 index 000000000..4920c99da --- /dev/null +++ b/oox/inc/drawingml/textparagraph.hxx @@ -0,0 +1,108 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TEXTPARAGRAPH_HXX +#define INCLUDED_OOX_DRAWINGML_TEXTPARAGRAPH_HXX + +#include <memory> +#include <com/sun/star/text/XTextCursor.hpp> +#include <com/sun/star/text/XText.hpp> + +#include <oox/core/xmlfilterbase.hxx> +#include <oox/helper/refvector.hxx> +#include <drawingml/textrun.hxx> +#include <drawingml/textliststyle.hxx> +#include <drawingml/textparagraphproperties.hxx> + +// The height the bullet is relative to is different in OOXML +#define OOX_BULLET_LIST_SCALE_FACTOR 0.7f + +namespace oox::formulaimport { + class XmlStreamBuilder; +} + +namespace oox::drawingml { + +typedef RefVector< TextRun > TextRunVector; + +class TextParagraph +{ +public: + TextParagraph(); + ~TextParagraph(); + + TextRunVector& getRuns() { return maRuns; } + const TextRunVector& getRuns() const { return maRuns; } + void addRun( const TextRunPtr & pRun ) { maRuns.push_back( pRun ); } + + TextParagraphProperties& getProperties() { return maProperties; } + const TextParagraphProperties& getProperties() const { return maProperties; } + /// Flags the textparagraph as having a pPr tag in it + void setHasProperties() { mbHasProperties = true; } + /// Returns whether the textparagraph had an pPr tag in it during import + bool hasProperties() const { return mbHasProperties; } + + TextCharacterProperties& getEndProperties() { return maEndProperties; } + const TextCharacterProperties& getEndProperties() const { return maEndProperties; } + + TextCharacterProperties getCharacterStyle( + const TextCharacterProperties& rTextStyleProperties, + const TextListStyle& rMasterTextListStyle, + const TextListStyle& rTextListStyle) const; + + TextParagraphProperties* getParagraphStyle( + const TextListStyle& rTextListStyle) const; + + void insertAt( + const ::oox::core::XmlFilterBase& rFilterBase, + const css::uno::Reference < css::text::XText > & xText, + const css::uno::Reference < css::text::XTextCursor > &xAt, + const TextCharacterProperties& rTextStyleProperties, + const TextListStyle& rMasterTextListStyle, + const TextListStyle& rTextListStyle, + bool bFirst, + float nDefaultCharHeight, + sal_Int32 nAutofitFontScale) const; + + bool HasMathXml() const + { + return m_pMathXml != nullptr; + } + formulaimport::XmlStreamBuilder & GetMathXml(); + + /** Returns whether textparagraph had a rPr tag in it that alters it visually + * + * For instance _lang_ doesn't have a visual effect. + */ + bool hasVisualRunProperties() const; + +private: + TextParagraphProperties maProperties; + bool mbHasProperties; + TextCharacterProperties maEndProperties; + TextRunVector maRuns; + // temporarily store this here + std::unique_ptr<formulaimport::XmlStreamBuilder> m_pMathXml; +}; + +} + +#endif // INCLUDED_OOX_DRAWINGML_TEXTPARAGRAPH_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/textparagraphproperties.hxx b/oox/inc/drawingml/textparagraphproperties.hxx new file mode 100644 index 000000000..083b61e37 --- /dev/null +++ b/oox/inc/drawingml/textparagraphproperties.hxx @@ -0,0 +1,136 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIES_HXX +#define INCLUDED_OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIES_HXX + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <drawingml/textcharacterproperties.hxx> +#include <com/sun/star/style/ParagraphAdjust.hpp> +#include <drawingml/textfont.hxx> +#include <drawingml/textspacing.hxx> +#include <optional> + +namespace com::sun::star { + namespace graphic { class XGraphic; } +} + +namespace oox::drawingml { + +class BulletList +{ +public: + BulletList( ); + bool is() const; + void apply( const BulletList& ); + void pushToPropMap( const ::oox::core::XmlFilterBase* pFilterBase, PropertyMap& xPropMap ) const; + void setBulletChar( const OUString & sChar ); + void setStartAt( sal_Int32 nStartAt ){ mnStartAt <<= static_cast< sal_Int16 >( nStartAt ); } + void setType( sal_Int32 nType ); + void setNone( ); + void setSuffixParenBoth(); + void setSuffixParenRight(); + void setSuffixPeriod(); + void setSuffixNone(); + void setSuffixMinusRight(); + void setBulletSize(sal_Int16 nSize); + void setBulletAspectRatio(double nAspectRatio); + void setFontSize(sal_Int16 nSize); + void setStyleName( const OUString& rStyleName ) { maStyleName <<= rStyleName; } + void setGraphic( css::uno::Reference< css::graphic::XGraphic > const & rXGraphic ); + + std::shared_ptr< ::oox::drawingml::Color > maBulletColorPtr; + css::uno::Any mbBulletColorFollowText; + css::uno::Any mbBulletFontFollowText; + css::uno::Any mbBulletSizeFollowText; + ::oox::drawingml::TextFont maBulletFont; + css::uno::Any msBulletChar; + css::uno::Any mnStartAt; + css::uno::Any mnNumberingType; + css::uno::Any msNumberingPrefix; + css::uno::Any msNumberingSuffix; + css::uno::Any mnSize; + css::uno::Any mnAspectRatio; // Width/Height + css::uno::Any mnFontSize; + css::uno::Any maStyleName; + css::uno::Any maGraphic; +}; + +class TextParagraphProperties +{ +public: + + TextParagraphProperties(); + + void setLevel( sal_Int16 nLevel ) { mnLevel = nLevel; } + sal_Int16 getLevel( ) const { return mnLevel; } + PropertyMap& getTextParagraphPropertyMap() { return maTextParagraphPropertyMap; } + BulletList& getBulletList() { return maBulletList; } + TextCharacterProperties& getTextCharacterProperties() { return maTextCharacterProperties; } + const TextCharacterProperties& getTextCharacterProperties() const { return maTextCharacterProperties; } + + TextSpacing& getParaTopMargin() { return maParaTopMargin; } + TextSpacing& getParaBottomMargin() { return maParaBottomMargin; } + std::optional< sal_Int32 >& getParaLeftMargin(){ return moParaLeftMargin; } + std::optional< sal_Int32 >& getFirstLineIndentation(){ return moFirstLineIndentation; } + + std::optional< css::style::ParagraphAdjust >& getParaAdjust() { return moParaAdjust; } + void setParaAdjust( css::style::ParagraphAdjust nParaAdjust ) { moParaAdjust = nParaAdjust; } + + TextSpacing& getLineSpacing() { return maLineSpacing; } + void setLineSpacing( const TextSpacing& rLineSpacing ) { maLineSpacing = rLineSpacing; } + + void apply( const TextParagraphProperties& rSourceProps ); + void pushToPropSet( const ::oox::core::XmlFilterBase* pFilterBase, + const css::uno::Reference < css::beans::XPropertySet > & xPropSet, + PropertyMap& rioBulletList, + const BulletList* pMasterBuList, + bool bApplyBulletList, + float fFontSize, + sal_Int32 nAutofitFontScale = 100000, + bool bPushDefaultValues = false ) const; + + /** Returns the largest character size of this paragraph. If possible the + masterstyle should have been applied before, otherwise the character + size can be zero and the default value is returned. */ + float getCharHeightPoints( float fDefault ) const; + +#ifdef DBG_UTIL + void dump() const; +#endif + +private: + + TextCharacterProperties maTextCharacterProperties; + PropertyMap maTextParagraphPropertyMap; + BulletList maBulletList; + TextSpacing maParaTopMargin; + TextSpacing maParaBottomMargin; + std::optional< sal_Int32 > moParaLeftMargin; + std::optional< sal_Int32 > moFirstLineIndentation; + std::optional< css::style::ParagraphAdjust > moParaAdjust; + sal_Int16 mnLevel; + TextSpacing maLineSpacing; +}; + +} + +#endif // INCLUDED_OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/textparagraphpropertiescontext.hxx b/oox/inc/drawingml/textparagraphpropertiescontext.hxx new file mode 100644 index 000000000..33b8493aa --- /dev/null +++ b/oox/inc/drawingml/textparagraphpropertiescontext.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 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIESCONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIESCONTEXT_HXX + +#include <vector> + +#include <com/sun/star/style/TabStop.hpp> +#include <drawingml/textparagraphproperties.hxx> +#include <oox/core/contexthandler2.hxx> + +namespace oox::drawingml { + +class TextParagraphPropertiesContext final : public ::oox::core::ContextHandler2 +{ +public: + TextParagraphPropertiesContext( ::oox::core::ContextHandler2Helper const & rParent, + const ::oox::AttributeList& rAttributes, + TextParagraphProperties& rTextParagraphProperties ); + virtual ~TextParagraphPropertiesContext() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; + +private: + TextParagraphProperties& mrTextParagraphProperties; + BulletList& mrBulletList; + std::vector< css::style::TabStop > maTabList; + std::shared_ptr< BlipFillProperties > mxBlipProps; +}; + +} + +#endif // INCLUDED_OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIESCONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/textrun.hxx b/oox/inc/drawingml/textrun.hxx new file mode 100644 index 000000000..b3d1fe041 --- /dev/null +++ b/oox/inc/drawingml/textrun.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 INCLUDED_OOX_DRAWINGML_TEXTRUN_HXX +#define INCLUDED_OOX_DRAWINGML_TEXTRUN_HXX + +#include <memory> + +#include <com/sun/star/text/XTextCursor.hpp> +#include <com/sun/star/text/XText.hpp> +#include <drawingml/textcharacterproperties.hxx> + +namespace oox::drawingml { + +class TextRun +{ +public: + TextRun(); + virtual ~TextRun(); + + OUString& getText() { return msText; } + const OUString& getText() const { return msText; } + + TextCharacterProperties& getTextCharacterProperties() { return maTextCharacterProperties; } + const TextCharacterProperties& getTextCharacterProperties() const { return maTextCharacterProperties; } + + void setLineBreak() { mbIsLineBreak = true; } + bool isLineBreak() const { return mbIsLineBreak; } + + /** Returns whether the textrun had properties that alter it visually in its rPr tag + * + * For instance _lang_ doesn't have a visual effect. + */ + bool hasVisualRunProperties() const { return maTextCharacterProperties.mbHasVisualRunProperties; } + + virtual sal_Int32 insertAt( + const ::oox::core::XmlFilterBase& rFilterBase, + const css::uno::Reference < css::text::XText >& xText, + const css::uno::Reference < css::text::XTextCursor >& xAt, + const TextCharacterProperties& rTextCharacterStyle, + float nDefaultCharHeight) const; + +private: + OUString msText; + TextCharacterProperties maTextCharacterProperties; + bool mbIsLineBreak; +}; + +typedef std::shared_ptr< TextRun > TextRunPtr; + +} + +#endif // INCLUDED_OOX_DRAWINGML_TEXTRUN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/textspacing.hxx b/oox/inc/drawingml/textspacing.hxx new file mode 100644 index 000000000..c40e53fcf --- /dev/null +++ b/oox/inc/drawingml/textspacing.hxx @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TEXTSPACING_HXX +#define INCLUDED_OOX_DRAWINGML_TEXTSPACING_HXX + +#include <com/sun/star/style/LineSpacing.hpp> +#include <com/sun/star/style/LineSpacingMode.hpp> +#include <oox/drawingml/drawingmltypes.hxx> + +namespace oox::drawingml { + + + /** carries a CT_TextSpacing */ + class TextSpacing + { + public: + enum class Unit { + Points = 0, + Percent + }; + TextSpacing() + : nUnit( Unit::Points ), nValue( 0 ), bHasValue( false ), bExactValue( false ) + { + } + TextSpacing( sal_Int32 nPoints ) : nUnit( Unit::Points ), nValue( nPoints ), bHasValue( true ), bExactValue ( false ){}; + css::style::LineSpacing toLineSpacing() const + { + css::style::LineSpacing aSpacing; + if (nUnit == Unit::Percent) + aSpacing.Mode = css::style::LineSpacingMode::PROP; + else if (bExactValue) + aSpacing.Mode = css::style::LineSpacingMode::FIX; + else + aSpacing.Mode = css::style::LineSpacingMode::MINIMUM; + aSpacing.Height = static_cast< sal_Int16 >( nUnit == Unit::Percent ? nValue / 1000 : nValue ); + return aSpacing; + } + sal_Int32 toMargin( float fFontSize ) const + { + if ( nUnit == Unit::Percent ) + return GetTextSpacingPoint(static_cast<sal_Int32>((fFontSize*nValue)/1000)); + else + return nValue; + } + Unit nUnit; + sal_Int32 nValue; + bool bHasValue; + bool bExactValue; + }; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/themeelementscontext.hxx b/oox/inc/drawingml/themeelementscontext.hxx new file mode 100644 index 000000000..4c113762e --- /dev/null +++ b/oox/inc/drawingml/themeelementscontext.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_THEMEELEMENTSCONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_THEMEELEMENTSCONTEXT_HXX + +#include <oox/core/contexthandler2.hxx> + +namespace oox::drawingml +{ +class Theme; + +class ThemeElementsContext final : public oox::core::ContextHandler2 +{ +public: + ThemeElementsContext(::oox::core::ContextHandler2Helper const& rParent, Theme& rTheme); + virtual ::oox::core::ContextHandlerRef + onCreateContext(sal_Int32 nElement, const ::oox::AttributeList& rAttribs) override; + +private: + Theme& mrTheme; +}; + +} // namespace oox::drawingml + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/drawingml/transform2dcontext.hxx b/oox/inc/drawingml/transform2dcontext.hxx new file mode 100644 index 000000000..f54b02493 --- /dev/null +++ b/oox/inc/drawingml/transform2dcontext.hxx @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_DRAWINGML_TRANSFORM2DCONTEXT_HXX +#define INCLUDED_OOX_DRAWINGML_TRANSFORM2DCONTEXT_HXX + +#include <oox/core/contexthandler2.hxx> + +namespace oox::drawingml { + +class Shape; + +/** context to import a CT_Transform2D */ +class Transform2DContext final : public ::oox::core::ContextHandler2 +{ +public: + Transform2DContext( ::oox::core::ContextHandler2Helper const & rParent, + const ::oox::AttributeList& rAttributes, Shape& rShape, bool btxXfrm = false ) noexcept; + virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; + +private: + Shape& mrShape; + bool mbtxXfrm; +}; + +} // namespace oox::drawingml + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/ooxresid.hxx b/oox/inc/ooxresid.hxx new file mode 100644 index 000000000..c374b6645 --- /dev/null +++ b/oox/inc/ooxresid.hxx @@ -0,0 +1,20 @@ +/* -*- 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/. + */ + +#ifndef INCLUDED_OOX_INC_RESID_HXX +#define INCLUDED_OOX_INC_RESID_HXX + +#include <rtl/ustring.hxx> +#include <unotools/resmgr.hxx> + +OUString OoxResId(TranslateId aId); +OUString URLResId(TranslateId aId); + +#endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/oox/inc/pch/precompiled_oox.cxx b/oox/inc/pch/precompiled_oox.cxx new file mode 100644 index 000000000..52dbf23b5 --- /dev/null +++ b/oox/inc/pch/precompiled_oox.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_oox.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/pch/precompiled_oox.hxx b/oox/inc/pch/precompiled_oox.hxx new file mode 100644 index 000000000..691c0fc5c --- /dev/null +++ b/oox/inc/pch/precompiled_oox.hxx @@ -0,0 +1,285 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If 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-09-28 05:37:38 using: + ./bin/update_pch oox oox --cutoff=6 --exclude:system --exclude:module --include:local + + If after updating build fails, use the following command to locate conflicting headers: + ./bin/update_pch_bisect ./oox/inc/pch/precompiled_oox.hxx "make oox.build" --find-conflicts +*/ + +#include <sal/config.h> +#if PCH_LEVEL >= 1 +#include <algorithm> +#include <array> +#include <cassert> +#include <cmath> +#include <cstddef> +#include <cstdlib> +#include <functional> +#include <iomanip> +#include <limits.h> +#include <limits> +#include <map> +#include <math.h> +#include <memory> +#include <new> +#include <optional> +#include <ostream> +#include <set> +#include <string.h> +#include <string_view> +#include <type_traits> +#include <unordered_map> +#include <unordered_set> +#include <utility> +#include <vector> +#include <boost/algorithm/string.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.hxx> +#include <osl/thread.h> +#include <rtl/bootstrap.hxx> +#include <rtl/character.hxx> +#include <rtl/cipher.h> +#include <rtl/digest.h> +#include <rtl/instance.hxx> +#include <rtl/locale.h> +#include <rtl/math.h> +#include <rtl/math.hxx> +#include <rtl/random.h> +#include <rtl/ref.hxx> +#include <rtl/strbuf.hxx> +#include <rtl/string.h> +#include <rtl/string.hxx> +#include <rtl/stringconcat.hxx> +#include <rtl/stringutils.hxx> +#include <rtl/tencinfo.h> +#include <rtl/textenc.h> +#include <rtl/uri.hxx> +#include <rtl/ustrbuf.hxx> +#include <rtl/ustring.h> +#include <rtl/ustring.hxx> +#include <sal/log.hxx> +#include <sal/saldllapi.h> +#include <sal/types.h> +#include <vcl/bitmap.hxx> +#include <vcl/cairo.hxx> +#include <vcl/devicecoordinate.hxx> +#include <vcl/dllapi.h> +#include <vcl/fntstyle.hxx> +#include <vcl/font.hxx> +#include <vcl/mapmod.hxx> +#include <vcl/metaactiontypes.hxx> +#include <vcl/outdev.hxx> +#include <vcl/region.hxx> +#include <vcl/rendercontext/AddFontSubstituteFlags.hxx> +#include <vcl/rendercontext/AntialiasingFlags.hxx> +#include <vcl/rendercontext/DrawGridFlags.hxx> +#include <vcl/rendercontext/DrawImageFlags.hxx> +#include <vcl/rendercontext/DrawModeFlags.hxx> +#include <vcl/rendercontext/DrawTextFlags.hxx> +#include <vcl/rendercontext/GetDefaultFontFlags.hxx> +#include <vcl/rendercontext/ImplMapRes.hxx> +#include <vcl/rendercontext/InvertFlags.hxx> +#include <vcl/rendercontext/RasterOp.hxx> +#include <vcl/rendercontext/SalLayoutFlags.hxx> +#include <vcl/rendercontext/State.hxx> +#include <vcl/rendercontext/SystemTextColorFlags.hxx> +#include <vcl/salnativewidgets.hxx> +#include <vcl/vclreferencebase.hxx> +#include <vcl/wall.hxx> +#endif // PCH_LEVEL >= 2 +#if PCH_LEVEL >= 3 +#include <basegfx/basegfxdllapi.h> +#include <basegfx/color/bcolor.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/numeric/ftools.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/tuple/b3dtuple.hxx> +#include <basegfx/vector/b2enums.hxx> +#include <com/sun/star/awt/DeviceInfo.hpp> +#include <com/sun/star/awt/FontWeight.hpp> +#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/beans/PropertyState.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/chart2/XChartDocument.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp> +#include <com/sun/star/drawing/FillStyle.hpp> +#include <com/sun/star/drawing/Hatch.hpp> +#include <com/sun/star/drawing/LineCap.hpp> +#include <com/sun/star/drawing/LineStyle.hpp> +#include <com/sun/star/drawing/XDrawPage.hpp> +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/drawing/XShapes.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/io/XOutputStream.hpp> +#include <com/sun/star/io/XSeekable.hpp> +#include <com/sun/star/io/XStream.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/LineSpacing.hpp> +#include <com/sun/star/style/LineSpacingMode.hpp> +#include <com/sun/star/style/ParagraphAdjust.hpp> +#include <com/sun/star/text/WritingMode.hpp> +#include <com/sun/star/text/XText.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/RuntimeException.hpp> +#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/Type.hxx> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/uno/genfunc.hxx> +#include <com/sun/star/util/DateTime.hpp> +#include <com/sun/star/xml/sax/FastToken.hpp> +#include <com/sun/star/xml/sax/XFastAttributeList.hpp> +#include <com/sun/star/xml/sax/XFastContextHandler.hpp> +#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp> +#include <com/sun/star/xml/sax/XFastSAXSerializable.hpp> +#include <comphelper/comphelperdllapi.h> +#include <comphelper/processfactory.hxx> +#include <comphelper/sequence.hxx> +#include <comphelper/sequenceashashmap.hxx> +#include <comphelper/storagehelper.hxx> +#include <cppu/cppudllapi.h> +#include <cppu/unotype.hxx> +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/implbase_ex.hxx> +#include <cppuhelper/supportsservice.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/weakref.hxx> +#include <drawingml/chart/chartcontextbase.hxx> +#include <drawingml/chart/chartspacemodel.hxx> +#include <drawingml/chart/converterbase.hxx> +#include <drawingml/chart/objectformatter.hxx> +#include <drawingml/chart/titlemodel.hxx> +#include <drawingml/colorchoicecontext.hxx> +#include <drawingml/customshapeproperties.hxx> +#include <drawingml/fillproperties.hxx> +#include <drawingml/lineproperties.hxx> +#include <drawingml/misccontexts.hxx> +#include <drawingml/shapepropertiescontext.hxx> +#include <drawingml/table/tablestylepart.hxx> +#include <drawingml/textbody.hxx> +#include <drawingml/textbodycontext.hxx> +#include <drawingml/textcharacterproperties.hxx> +#include <drawingml/textfont.hxx> +#include <drawingml/textparagraph.hxx> +#include <drawingml/textspacing.hxx> +#include <filter/msfilter/msfilterdllapi.h> +#include <i18nlangtag/lang.h> +#include <o3tl/cow_wrapper.hxx> +#include <o3tl/safeint.hxx> +#include <o3tl/typed_flags_set.hxx> +#include <o3tl/unit_conversion.hxx> +#include <sax/fastattribs.hxx> +#include <sax/fshelper.hxx> +#include <sax/saxdllapi.h> +#include <svl/poolitem.hxx> +#include <svl/svldllapi.h> +#include <svl/typedwhich.hxx> +#include <svx/msdffdef.hxx> +#include <svx/svdobjkind.hxx> +#include <svx/svdtypes.hxx> +#include <svx/svxdllapi.h> +#include <tools/color.hxx> +#include <tools/degree.hxx> +#include <tools/diagnose_ex.h> +#include <tools/fldunit.hxx> +#include <tools/fontenum.hxx> +#include <tools/fract.hxx> +#include <tools/gen.hxx> +#include <tools/link.hxx> +#include <tools/long.hxx> +#include <tools/mapunit.hxx> +#include <tools/poly.hxx> +#include <tools/ref.hxx> +#include <tools/solar.h> +#include <tools/stream.hxx> +#include <tools/toolsdllapi.h> +#include <typelib/typedescription.h> +#include <uno/data.h> +#include <uno/sequence2.h> +#include <unotools/fontdefs.hxx> +#include <unotools/resmgr.hxx> +#include <unotools/syslocale.hxx> +#include <unotools/unotoolsdllapi.h> +#endif // PCH_LEVEL >= 3 +#if PCH_LEVEL >= 4 +#include <oox/core/contexthandler.hxx> +#include <oox/core/contexthandler2.hxx> +#include <oox/core/fragmenthandler.hxx> +#include <oox/core/fragmenthandler2.hxx> +#include <oox/core/relations.hxx> +#include <oox/core/xmlfilterbase.hxx> +#include <oox/dllapi.h> +#include <oox/drawingml/chart/chartconverter.hxx> +#include <oox/drawingml/chart/datasourcemodel.hxx> +#include <oox/drawingml/chart/modelbase.hxx> +#include <oox/drawingml/clrscheme.hxx> +#include <oox/drawingml/color.hxx> +#include <oox/drawingml/drawingmltypes.hxx> +#include <oox/drawingml/graphicshapecontext.hxx> +#include <oox/drawingml/shape.hxx> +#include <oox/drawingml/shapepropertymap.hxx> +#include <oox/drawingml/theme.hxx> +#include <oox/export/utils.hxx> +#include <oox/helper/attributelist.hxx> +#include <oox/helper/binaryinputstream.hxx> +#include <oox/helper/binaryoutputstream.hxx> +#include <oox/helper/binarystreambase.hxx> +#include <oox/helper/containerhelper.hxx> +#include <oox/helper/graphichelper.hxx> +#include <oox/helper/helper.hxx> +#include <oox/helper/modelobjecthelper.hxx> +#include <oox/helper/propertymap.hxx> +#include <oox/helper/propertyset.hxx> +#include <oox/helper/refmap.hxx> +#include <oox/helper/refvector.hxx> +#include <oox/helper/storagebase.hxx> +#include <oox/helper/textinputstream.hxx> +#include <oox/ole/olestorage.hxx> +#include <oox/ppt/comments.hxx> +#include <oox/ppt/headerfooter.hxx> +#include <oox/ppt/pptshape.hxx> +#include <oox/ppt/slidepersist.hxx> +#include <oox/token/namespaces.hxx> +#include <oox/token/properties.hxx> +#include <oox/token/tokenmap.hxx> +#include <oox/token/tokens.hxx> +#include <oox/vml/vmldrawing.hxx> +#include <oox/vml/vmlshape.hxx> +#include <oox/vml/vmlshapecontainer.hxx> +#endif // PCH_LEVEL >= 4 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/inc/strings.hrc b/oox/inc/strings.hrc new file mode 100644 index 000000000..cd107aa36 --- /dev/null +++ b/oox/inc/strings.hrc @@ -0,0 +1,19 @@ +/* -*- 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/. + */ + +#ifndef OOX_STRINGS_HRC +#define OOX_STRINGS_HRC + +#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String)) + +#define STR_DIAGRAM_TITLE NC_("STR_DIAGRAM_TITLE", "Chart Title") +#define STR_DIAGRAM_AXISTITLE NC_("STR_DIAGRAM_AXISTITLE", "Axis Title") +#define STR_SLIDE_NAME NC_("STR_SLIDE_NAME", "Slide" ) +#endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |