1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef OOX_DRAWINGML_CHART_TITLECONVERTER_HXX
25 #define OOX_DRAWINGML_CHART_TITLECONVERTER_HXX
26 
27 #include "oox/drawingml/chart/converterbase.hxx"
28 
29 namespace com { namespace sun { namespace star {
30     namespace chart2 { class XDiagram; }
31     namespace chart2 { class XFormattedString; }
32     namespace chart2 { class XTitled; }
33     namespace chart2 { namespace data { class XDataSequence; } }
34 } } }
35 
36 namespace oox { namespace drawingml { struct TextCharacterProperties; } }
37 
38 namespace oox {
39 namespace drawingml {
40 namespace chart {
41 
42 // ============================================================================
43 
44 struct TextModel;
45 
46 class TextConverter : public ConverterBase< TextModel >
47 {
48 public:
49     explicit            TextConverter( const ConverterRoot& rParent, TextModel& rModel );
50     virtual             ~TextConverter();
51 
52     /** Creates a data sequence object from the contained text data. */
53     ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >
54                         createDataSequence( const ::rtl::OUString& rRole );
55     /** Creates a sequence of formatted string objects. */
56     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XFormattedString > >
57                         createStringSequence(
58                             const ::rtl::OUString& rDefaultText,
59                             const ModelRef< TextBody >& rxTextProp,
60                             ObjectType eObjType );
61 
62 private:
63     ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XFormattedString >
64                         appendFormattedString(
65                             ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XFormattedString > >& orStringVec,
66                             const ::rtl::OUString& rString,
67                             bool bAddNewLine ) const;
68 };
69 
70 // ============================================================================
71 
72 struct TitleModel;
73 
74 class TitleConverter : public ConverterBase< TitleModel >
75 {
76 public:
77     explicit            TitleConverter( const ConverterRoot& rParent, TitleModel& rModel );
78     virtual             ~TitleConverter();
79 
80     /** Creates a title text object and attaches it at the passed interface. */
81     void                convertFromModel(
82                             const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitled >& rxTitled,
83                             const ::rtl::OUString& rAutoTitle, ObjectType eObjType,
84                             sal_Int32 nMainIdx = -1, sal_Int32 nSubIdx = -1 );
85 };
86 
87 // ============================================================================
88 
89 struct LegendModel;
90 
91 class LegendConverter : public ConverterBase< LegendModel >
92 {
93 public:
94     explicit            LegendConverter( const ConverterRoot& rParent, LegendModel& rModel );
95     virtual             ~LegendConverter();
96 
97     /** Creates a legend object and attaches it at the passed diagram. */
98     void                convertFromModel(
99                             const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& rxDiagram );
100 };
101 
102 // ============================================================================
103 
104 } // namespace chart
105 } // namespace drawingml
106 } // namespace oox
107 
108 #endif
109