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 _CHART2_VIEW_LABELPOSITIONHELPER_HXX
25 #define _CHART2_VIEW_LABELPOSITIONHELPER_HXX
26 
27 #include "LabelAlignment.hxx"
28 #include "PropertyMapper.hxx"
29 #include <com/sun/star/awt/Point.hpp>
30 #include <com/sun/star/drawing/Position3D.hpp>
31 #include <com/sun/star/drawing/XShapes.hpp>
32 
33 //.............................................................................
34 namespace chart
35 {
36 //.............................................................................
37 
38 //-----------------------------------------------------------------------------
39 /**
40 */
41 class PlottingPositionHelper;
42 class ShapeFactory;
43 
44 class LabelPositionHelper
45 {
46 public:
47     LabelPositionHelper(
48         PlottingPositionHelper* pPosHelper
49         , sal_Int32 nDimensionCount
50         , const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xLogicTarget
51         , ShapeFactory* pShapeFactory );
52     virtual ~LabelPositionHelper();
53 
54     ::com::sun::star::awt::Point transformSceneToScreenPosition(
55             const ::com::sun::star::drawing::Position3D& rScenePosition3D ) const;
56 
57     static void changeTextAdjustment( tAnySequence& rPropValues, const tNameSequence& rPropNames, LabelAlignment eAlignment);
58     static void doDynamicFontResize(  tAnySequence& rPropValues, const tNameSequence& rPropNames
59                     , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisModelProps
60                     , const ::com::sun::star::awt::Size& rNewReferenceSize );
61 
62     static void correctPositionForRotation( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape2DText
63                     , LabelAlignment eLabelAlignment, const double fRotationAngle, bool bRotateAroundCenter );
64 
65 private:
66     LabelPositionHelper();
67 
68 protected:
69     PlottingPositionHelper*  m_pPosHelper;
70     sal_Int32                m_nDimensionCount;
71 
72 private:
73     //these members are only necessary for transformation from 3D to 2D
74     ::com::sun::star::uno::Reference<
75                     ::com::sun::star::drawing::XShapes >    m_xLogicTarget;
76     ShapeFactory*                                           m_pShapeFactory;
77 };
78 
79 //.............................................................................
80 } //namespace chart
81 //.............................................................................
82 #endif
83