LibreOffice Module oox (master) 1
converterbase.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_CONVERTERBASE_HXX
21#define INCLUDED_OOX_DRAWINGML_CHART_CONVERTERBASE_HXX
22
24
25namespace com::sun::star {
26 namespace awt { struct Rectangle; }
27 namespace awt { struct Size; }
28 namespace chart2 { class XChartDocument; }
29 namespace chart2 { class XTitle; }
30 namespace drawing { class XShape; }
31 namespace uno { class XComponentContext; }
32}
33namespace oox::core { class XmlFilterBase; }
34
35namespace oox::drawingml::chart {
36
37class ChartConverter;
38struct ChartSpaceModel;
39struct ConverterData;
40
41
42const sal_Int32 API_PRIM_AXESSET = 0;
43const sal_Int32 API_SECN_AXESSET = 1;
44
45const sal_Int32 API_X_AXIS = 0;
46const sal_Int32 API_Y_AXIS = 1;
47const sal_Int32 API_Z_AXIS = 2;
48
49
51{
52public:
53 explicit ConverterRoot(
55 ChartConverter& rChartConverter,
56 const ChartSpaceModel& rChartModel,
57 const css::uno::Reference< css::chart2::XChartDocument >& rxChartDoc,
58 const css::awt::Size& rChartSize );
59 virtual ~ConverterRoot();
60
61 ConverterRoot(ConverterRoot const &) = default;
65
67 css::uno::Reference< css::uno::XInterface >
68 createInstance( const OUString& rServiceName ) const;
69 css::uno::Reference< css::uno::XComponentContext > const &
70 getComponentContext() const;
71
72protected:
78 css::uno::Reference< css::chart2::XChartDocument > const &
79 getChartDocument() const;
81 const css::awt::Size& getChartSize() const;
83 static css::awt::Size getDefaultPageSize() { return css::awt::Size(16000, 9000); }
86
90 const css::uno::Reference< css::chart2::XTitle >& rxTitle,
91 const ModelRef< LayoutModel >& rxLayout, ObjectType eObjType,
92 sal_Int32 nMainIdx, sal_Int32 nSubIdx );
95
96private:
97 std::shared_ptr< ConverterData > mxData;
98};
99
100
104template< typename ModelType >
106{
107public:
108 const ModelType& getModel() const { return mrModel; }
109
110protected:
111 explicit ConverterBase( const ConverterRoot& rParent, ModelType& rModel ) :
112 ConverterRoot( rParent ), mrModel( rModel ) {}
113 virtual ~ConverterBase() override {}
114
115protected:
116 ModelType& mrModel;
117};
118
119
122class LayoutConverter final : public ConverterBase< LayoutModel >
123{
124public:
125 explicit LayoutConverter( const ConverterRoot& rParent, LayoutModel& rModel );
126 virtual ~LayoutConverter() override;
127
130 bool calcAbsRectangle( css::awt::Rectangle& orRect ) const;
131
134 bool convertFromModel( PropertySet& rPropSet );
135
138 const css::uno::Reference< css::drawing::XShape >& rxShape,
139 double fRotationAngle );
140 bool getAutoLayout() const {return mrModel.mbAutoLayout;}
141};
142
143
144} // namespace oox::drawingml::chart
145
146#endif
147
148/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
A wrapper for a UNO property set.
Definition: propertyset.hxx:58
Base class of all converter classes.
const ModelType & getModel() const
ConverterBase(const ConverterRoot &rParent, ModelType &rModel)
::oox::core::XmlFilterBase & getFilter() const
Returns the filter object of the imported/exported document.
css::uno::Reference< css::chart2::XChartDocument > const & getChartDocument() const
Returns the API chart document model.
ChartConverter & getChartConverter() const
Returns the chart converter.
const css::awt::Size & getChartSize() const
Returns the position and size of the chart shape in 1/100 mm.
ConverterRoot & operator=(ConverterRoot const &)=default
void convertTitlePositions()
Converts the positions of the main title and all axis titles.
void registerTitleLayout(const css::uno::Reference< css::chart2::XTitle > &rxTitle, const ModelRef< LayoutModel > &rxLayout, ObjectType eObjType, sal_Int32 nMainIdx, sal_Int32 nSubIdx)
Registers a title object and its layout data, needed for conversion of the title position using the o...
ConverterRoot(ConverterRoot &&)=default
ObjectFormatter & getFormatter() const
Returns the object formatter.
static css::awt::Size getDefaultPageSize()
Returns the default position and size of the chart shape in 1/100 mm.
ConverterRoot(ConverterRoot const &)=default
std::shared_ptr< ConverterData > mxData
css::uno::Reference< css::uno::XInterface > createInstance(const OUString &rServiceName) const
Creates an instance for the passed service name, using the process service factory.
ConverterRoot(::oox::core::XmlFilterBase &rFilter, ChartConverter &rChartConverter, const ChartSpaceModel &rChartModel, const css::uno::Reference< css::chart2::XChartDocument > &rxChartDoc, const css::awt::Size &rChartSize)
css::uno::Reference< css::uno::XComponentContext > const & getComponentContext() const
A layout converter calculates positions and sizes for various chart objects.
LayoutConverter(const ConverterRoot &rParent, LayoutModel &rModel)
bool calcAbsRectangle(css::awt::Rectangle &orRect) const
Tries to calculate the absolute position and size from the contained OOXML layout model.
void convertFromModel(const css::uno::Reference< css::drawing::XShape > &rxShape, double fRotationAngle)
Tries to set the position from the contained OOXML layout model.
bool convertFromModel(PropertySet &rPropSet)
Tries to set the position and size from the contained OOXML layout model.
const sal_Int32 API_Y_AXIS
const sal_Int32 API_PRIM_AXESSET
const sal_Int32 API_X_AXIS
ObjectType
Enumerates different object types for specific automatic formatting behaviour.
const sal_Int32 API_SECN_AXESSET
const sal_Int32 API_Z_AXIS
bool mbAutoLayout
Layout target for plot area.
Definition: modelbase.hxx:112