xref: /aoo4110/main/chart2/source/inc/TitleHelper.hxx (revision b1cdbd2c)
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 #ifndef _CHART2_TOOLS_TITLEHELPER_HXX
24 #define _CHART2_TOOLS_TITLEHELPER_HXX
25 
26 #include "ReferenceSizeProvider.hxx"
27 #include "charttoolsdllapi.hxx"
28 #include <com/sun/star/chart2/XTitled.hpp>
29 #include <com/sun/star/frame/XModel.hpp>
30 #include <com/sun/star/uno/XComponentContext.hpp>
31 #include <com/sun/star/chart2/XDiagram.hpp>
32 
33 //.............................................................................
34 namespace chart
35 {
36 //.............................................................................
37 
38 class OOO_DLLPUBLIC_CHARTTOOLS TitleHelper
39 {
40 public:
41     enum eTitleType
42     {
43         TITLE_BEGIN = 0,
44         MAIN_TITLE = 0,
45         SUB_TITLE,
46         X_AXIS_TITLE,
47         Y_AXIS_TITLE,
48         Z_AXIS_TITLE,
49         SECONDARY_X_AXIS_TITLE,
50         SECONDARY_Y_AXIS_TITLE,
51         NORMAL_TITLE_END,
52 
53         //it is intended that this both types are after NORMAL_TITLE_END
54         TITLE_AT_STANDARD_X_AXIS_POSITION, //equals the Y_AXIS_TITLE for barchart
55         TITLE_AT_STANDARD_Y_AXIS_POSITION  //equals the X_AXIS_TITLE for barchart
56     };
57 
58     static ::com::sun::star::uno::Reference<
59             ::com::sun::star::chart2::XTitle >
60         getTitle( eTitleType nTitleIndex
61                     , const ::com::sun::star::uno::Reference<
62                     ::com::sun::star::frame::XModel >& xModel );
63 
64     static ::com::sun::star::uno::Reference<
65             ::com::sun::star::chart2::XTitle >
66         createTitle(  eTitleType nTitleIndex
67                     , const rtl::OUString& rTitleText
68                     , const ::com::sun::star::uno::Reference<
69                             ::com::sun::star::frame::XModel >& xModel
70                     , const ::com::sun::star::uno::Reference<
71                             ::com::sun::star::uno::XComponentContext > & xContext
72                     , ReferenceSizeProvider * pRefSizeProvider = 0 );
73 
74     static void removeTitle( eTitleType nTitleIndex
75                     , const ::com::sun::star::uno::Reference<
76                             ::com::sun::star::frame::XModel >& xModel );
77 
78     static rtl::OUString getCompleteString( const ::com::sun::star::uno::Reference<
79         ::com::sun::star::chart2::XTitle >& xTitle );
80     static void setCompleteString( const rtl::OUString& rNewText
81         , const ::com::sun::star::uno::Reference<
82             ::com::sun::star::chart2::XTitle >& xTitle
83         , const ::com::sun::star::uno::Reference<
84             ::com::sun::star::uno::XComponentContext > & xContext
85         , float * pDefaultCharHeight = 0 );
86 
87     static bool getTitleType( eTitleType& rType
88                     , const ::com::sun::star::uno::Reference<
89                         ::com::sun::star::chart2::XTitle >& xTitle
90                     , const ::com::sun::star::uno::Reference<
91                         ::com::sun::star::frame::XModel >& xModel );
92 };
93 
94 //.............................................................................
95 } //namespace chart
96 //.............................................................................
97 #endif
98