LibreOffice Module oox (master)  1
chartdrawingfragment.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_OOX_DRAWINGML_CHART_CHARTDRAWINGFRAGMENT_HXX
21 #define INCLUDED_OOX_DRAWINGML_CHART_CHARTDRAWINGFRAGMENT_HXX
22 
24 #include <oox/drawingml/shape.hxx>
25 
26 namespace oox::drawingml::chart {
27 
28 
31 {
32  double mfX;
33  double mfY;
34 
35  AnchorPosModel() : mfX( -1.0 ), mfY( -1.0 ) {}
36  bool isValid() const { return (0.0 <= mfX) && (mfX <= 1.0) && (0.0 <= mfY) && (mfY <= 1.0); }
37 };
38 
39 
41 struct AnchorSizeModel : public EmuSize
42 {
43  AnchorSizeModel() : EmuSize( -1, -1 ) {}
44  bool isValid() const { return (Width >= 0) && (Height >= 0); }
45 };
46 
47 
52 {
53 public:
54  explicit ShapeAnchor( bool bRelSize );
55 
57  void importExt( const AttributeList& rAttribs );
59  void setPos( sal_Int32 nElement, sal_Int32 nParentContext, const OUString& rValue );
60 
62  EmuRectangle calcAnchorRectEmu( const EmuRectangle& rChartRect ) const;
63 
64 private:
68  bool mbRelSize;
69 };
70 
74 {
75 public:
76  explicit ChartDrawingFragment(
77  ::oox::core::XmlFilterBase& rFilter,
78  const OUString& rFragmentPath,
79  const css::uno::Reference< css::drawing::XShapes >& rxDrawPage,
80  const css::awt::Size& rChartSize,
81  const css::awt::Point& rShapesOffset,
82  bool bOleSupport );
83  virtual ~ChartDrawingFragment() override;
84 
85  virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
86  virtual void onCharacters( const OUString& rChars ) override;
87  virtual void onEndElement() override;
88 
89 private:
90  css::uno::Reference< css::drawing::XShapes >
93  std::shared_ptr< ShapeAnchor > mxAnchor;
95  bool mbOleSupport;
96 };
97 
98 
99 } // namespace oox::drawingml::chart
100 
101 #endif
102 
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool mbRelSize
Shape size, if anchor has absolute size.
::oox::drawingml::ShapePtr mxShape
Drawing page of this sheet.
virtual void onEndElement() override
Will be called when the current element is about to be left.
css::uno::Reference< css::drawing::XShapes > mxDrawPage
void importExt(const AttributeList &rAttribs)
Imports the absolute anchor size from the cdr:ext element.
bool mbOleSupport
Position and size of the chart object for embedded shapes (in EMUs).
EmuRectangle maChartRectEmu
Current anchor of top-level shape.
A structure for a size with 64-bit integer components.
AnchorSizeModel maSize
Bottom-right position relative to chart object.
css::uno::Any const & rValue
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
Will be called to create a context handler for the passed element.
Contains the position of a shape in the chart object.
double mfY
X coordinate relative to chart object (0.0 to 1.0).
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)
void setPos(sal_Int32 nElement, sal_Int32 nParentContext, const OUString &rValue)
Sets the relative anchor position from the cdr:from or cdr:to element.
Provides access to attribute values of an element.
AnchorPosModel()
Y coordinate relative to chart object (0.0 to 1.0).
AnchorPosModel maTo
Top-left position relative to chart object.
virtual void onCharacters(const OUString &rChars) override
Will be called before a new child element starts, or if the current element is about to be left...
::rtl::Reference< ContextHandler > ContextHandlerRef
A structure for a rectangle with 64-bit integer components.
std::shared_ptr< ShapeAnchor > mxAnchor
Current top-level shape.
std::shared_ptr< Shape > ShapePtr
Handler for a chart drawing fragment (c:userShapes root element).
Relative shape position in a chart object.
EmuRectangle calcAnchorRectEmu(const EmuRectangle &rChartRect) const
Calculates the resulting shape anchor in EMUs.
Absolute shape size in a chart object (in EMUs).