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_TITLECONVERTER_HXX
21 #define INCLUDED_OOX_DRAWINGML_CHART_TITLECONVERTER_HXX
22 
23 #include <drawingml/chart/converterbase.hxx>
24 
25 namespace com::sun::star {
26     namespace chart2 { class XDiagram; }
27     namespace chart2 { class XFormattedString; }
28     namespace chart2 { class XTitled; }
29     namespace chart2::data { class XDataSequence; }
30 }
31 
32 namespace oox::drawingml { struct TextCharacterProperties; }
33 
34 namespace oox::drawingml::chart {
35 
36 
37 struct TextModel;
38 
39 class TextConverter final : public ConverterBase< TextModel >
40 {
41 public:
42     explicit            TextConverter( const ConverterRoot& rParent, TextModel& rModel );
43     virtual             ~TextConverter() override;
44 
45     /** Creates a data sequence object from the contained text data. */
46     css::uno::Reference< css::chart2::data::XDataSequence >
47                         createDataSequence( const OUString& rRole );
48     /** Creates a sequence of formatted string objects. */
49     css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > >
50                         createStringSequence(
51                             const OUString& rDefaultText,
52                             const ModelRef< TextBody >& rxTextProp,
53                             ObjectType eObjType );
54 
55 private:
56     css::uno::Reference< css::chart2::XFormattedString >
57                         appendFormattedString(
58                             ::std::vector< css::uno::Reference< css::chart2::XFormattedString > >& orStringVec,
59                             const OUString& rString,
60                             bool bAddNewLine ) const;
61 };
62 
63 
64 struct TitleModel;
65 
66 class TitleConverter final : public ConverterBase< TitleModel >
67 {
68 public:
69     explicit            TitleConverter( const ConverterRoot& rParent, TitleModel& rModel );
70     virtual             ~TitleConverter() override;
71 
72     /** Creates a title text object and attaches it at the passed interface. */
73     void                convertFromModel(
74                             const css::uno::Reference< css::chart2::XTitled >& rxTitled,
75                             const OUString& rAutoTitle, ObjectType eObjType,
76                             sal_Int32 nMainIdx = -1, sal_Int32 nSubIdx = -1 );
77 };
78 
79 
80 struct LegendModel;
81 
82 class LegendConverter final : public ConverterBase< LegendModel >
83 {
84 public:
85     explicit            LegendConverter( const ConverterRoot& rParent, LegendModel& rModel );
86     virtual             ~LegendConverter() override;
87 
88     /** Creates a legend object and attaches it at the passed diagram. */
89     void                convertFromModel(
90                             const css::uno::Reference< css::chart2::XDiagram >& rxDiagram );
91 
92 private:
93     void                legendEntriesFormatting(const css::uno::Reference<css::chart2::XDiagram>& rxDiagram);
94 };
95 
96 
97 } // namespace oox::drawingml::chart
98 
99 #endif
100 
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
102