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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_chart2.hxx"
26 
27 #include "BarPositionHelper.hxx"
28 #include "Linear3DTransformation.hxx"
29 #include "ViewDefines.hxx"
30 #include "CommonConverters.hxx"
31 #include "DateHelper.hxx"
32 #include <com/sun/star/chart/TimeUnit.hpp>
33 
34 //.............................................................................
35 namespace chart
36 {
37 //.............................................................................
38 using namespace ::com::sun::star;
39 using namespace ::com::sun::star::chart2;
40 
BarPositionHelper(bool)41 BarPositionHelper::BarPositionHelper( bool /* bSwapXAndY */ )
42         : CategoryPositionHelper( 1 )
43 {
44     AllowShiftXAxisPos(true);
45     AllowShiftZAxisPos(true);
46 }
47 
BarPositionHelper(const BarPositionHelper & rSource)48 BarPositionHelper::BarPositionHelper( const BarPositionHelper& rSource )
49         : CategoryPositionHelper( rSource )
50         , PlottingPositionHelper( rSource )
51 {
52 }
53 
~BarPositionHelper()54 BarPositionHelper::~BarPositionHelper()
55 {
56 }
57 
clone() const58 PlottingPositionHelper* BarPositionHelper::clone() const
59 {
60     BarPositionHelper* pRet = new BarPositionHelper(*this);
61     return pRet;
62 }
63 
updateSeriesCount(double fSeriesCount)64 void BarPositionHelper::updateSeriesCount( double fSeriesCount )
65 {
66     m_fSeriesCount = fSeriesCount;
67 }
68 
getScaledSlotPos(double fUnscaledLogicX,double fSeriesNumber) const69 double BarPositionHelper::getScaledSlotPos( double fUnscaledLogicX, double fSeriesNumber ) const
70 {
71     if( m_bDateAxis )
72         fUnscaledLogicX = DateHelper::RasterizeDateValue( fUnscaledLogicX, m_aNullDate, m_nTimeResolution );
73     double fScaledLogicX(fUnscaledLogicX);
74     doLogicScaling(&fScaledLogicX,NULL,NULL);
75     fScaledLogicX = CategoryPositionHelper::getScaledSlotPos( fScaledLogicX, fSeriesNumber );
76     return fScaledLogicX;
77 
78 }
79 
setScaledCategoryWidth(double fScaledCategoryWidth)80 void BarPositionHelper::setScaledCategoryWidth( double fScaledCategoryWidth )
81 {
82     m_fScaledCategoryWidth = fScaledCategoryWidth;
83     CategoryPositionHelper::setCategoryWidth( m_fScaledCategoryWidth );
84 }
85 //.............................................................................
86 } //namespace chart
87 //.............................................................................
88