1*cde9e8dcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*cde9e8dcSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*cde9e8dcSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*cde9e8dcSAndrew Rist  * distributed with this work for additional information
6*cde9e8dcSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*cde9e8dcSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*cde9e8dcSAndrew Rist  * "License"); you may not use this file except in compliance
9*cde9e8dcSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*cde9e8dcSAndrew Rist  *
11*cde9e8dcSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*cde9e8dcSAndrew Rist  *
13*cde9e8dcSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*cde9e8dcSAndrew Rist  * software distributed under the License is distributed on an
15*cde9e8dcSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*cde9e8dcSAndrew Rist  * KIND, either express or implied.  See the License for the
17*cde9e8dcSAndrew Rist  * specific language governing permissions and limitations
18*cde9e8dcSAndrew Rist  * under the License.
19*cde9e8dcSAndrew Rist  *
20*cde9e8dcSAndrew Rist  *************************************************************/
21*cde9e8dcSAndrew Rist 
22*cde9e8dcSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_chart2.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "res_BarGeometry.hxx"
28cdf0e10cSrcweir #include "ResourceIds.hrc"
29cdf0e10cSrcweir #include "Strings.hrc"
30cdf0e10cSrcweir #include "ResId.hxx"
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #ifndef _SVT_CONTROLDIMS_HRC_
33cdf0e10cSrcweir #include <svtools/controldims.hrc>
34cdf0e10cSrcweir #endif
35cdf0e10cSrcweir 
36cdf0e10cSrcweir //.............................................................................
37cdf0e10cSrcweir namespace chart
38cdf0e10cSrcweir {
39cdf0e10cSrcweir //.............................................................................
40cdf0e10cSrcweir 
BarGeometryResources(Window * pWindow)41cdf0e10cSrcweir BarGeometryResources::BarGeometryResources( Window* pWindow )
42cdf0e10cSrcweir     : m_aFT_Geometry( pWindow, pWindow->GetStyle() )
43cdf0e10cSrcweir 	, m_aLB_Geometry( pWindow, SchResId( LB_BAR_GEOMETRY ) )
44cdf0e10cSrcweir {
45cdf0e10cSrcweir     m_aFT_Geometry.SetText( String( SchResId( STR_BAR_GEOMETRY )) );
46cdf0e10cSrcweir     m_aFT_Geometry.SetSizePixel( m_aFT_Geometry.CalcMinimumSize() );
47cdf0e10cSrcweir 	m_aLB_Geometry.SetAccessibleName(m_aFT_Geometry.GetText());
48cdf0e10cSrcweir 	m_aLB_Geometry.SetAccessibleRelationLabeledBy(&m_aFT_Geometry);
49cdf0e10cSrcweir }
SetPosPixel(const Point & rPosition)50cdf0e10cSrcweir void BarGeometryResources::SetPosPixel( const Point& rPosition )
51cdf0e10cSrcweir {
52cdf0e10cSrcweir     Window* pWindow( m_aFT_Geometry.GetParent() );
53cdf0e10cSrcweir 
54cdf0e10cSrcweir     Size aDistanceSize( 2,2 );
55cdf0e10cSrcweir     if( pWindow )
56cdf0e10cSrcweir         aDistanceSize = Size( pWindow->LogicToPixel( Size(0,RSC_SP_CTRL_DESC_Y), MapMode(MAP_APPFONT) ) );
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     m_aFT_Geometry.SetPosPixel( rPosition );
59cdf0e10cSrcweir     m_aLB_Geometry.SetPosPixel( Point( rPosition.X()+aDistanceSize.Width(), rPosition.Y()+m_aFT_Geometry.GetSizePixel().Height()+aDistanceSize.Height()) );
60cdf0e10cSrcweir }
GetSizePixel() const61cdf0e10cSrcweir Size BarGeometryResources::GetSizePixel() const
62cdf0e10cSrcweir {
63cdf0e10cSrcweir     long nHeight = m_aLB_Geometry.GetPosPixel().Y()
64cdf0e10cSrcweir         - m_aFT_Geometry.GetPosPixel().Y();
65cdf0e10cSrcweir     nHeight += m_aLB_Geometry.GetSizePixel().Height();
66cdf0e10cSrcweir 
67cdf0e10cSrcweir     long nWidth = m_aLB_Geometry.GetSizePixel().Width();
68cdf0e10cSrcweir     if( nWidth < m_aFT_Geometry.GetSizePixel().Width() )
69cdf0e10cSrcweir         nWidth = m_aFT_Geometry.GetSizePixel().Width();
70cdf0e10cSrcweir 
71cdf0e10cSrcweir     return Size( nHeight, nWidth );
72cdf0e10cSrcweir }
~BarGeometryResources()73cdf0e10cSrcweir BarGeometryResources::~BarGeometryResources()
74cdf0e10cSrcweir {
75cdf0e10cSrcweir }
76cdf0e10cSrcweir 
SetSelectHdl(const Link & rLink)77cdf0e10cSrcweir void BarGeometryResources::SetSelectHdl( const Link& rLink )
78cdf0e10cSrcweir {
79cdf0e10cSrcweir     m_aLB_Geometry.SetSelectHdl( rLink );
80cdf0e10cSrcweir }
81cdf0e10cSrcweir 
Show(bool bShow)82cdf0e10cSrcweir void BarGeometryResources::Show( bool bShow )
83cdf0e10cSrcweir {
84cdf0e10cSrcweir     m_aFT_Geometry.Show( bShow );
85cdf0e10cSrcweir     m_aLB_Geometry.Show( bShow );
86cdf0e10cSrcweir }
Enable(bool bEnable)87cdf0e10cSrcweir void BarGeometryResources::Enable( bool bEnable )
88cdf0e10cSrcweir {
89cdf0e10cSrcweir     m_aFT_Geometry.Enable( bEnable );
90cdf0e10cSrcweir     m_aLB_Geometry.Enable( bEnable );
91cdf0e10cSrcweir }
92cdf0e10cSrcweir 
GetSelectEntryCount() const93cdf0e10cSrcweir sal_uInt16 BarGeometryResources::GetSelectEntryCount() const
94cdf0e10cSrcweir {
95cdf0e10cSrcweir     return m_aLB_Geometry.GetSelectEntryCount();
96cdf0e10cSrcweir }
GetSelectEntryPos() const97cdf0e10cSrcweir sal_uInt16 BarGeometryResources::GetSelectEntryPos() const
98cdf0e10cSrcweir {
99cdf0e10cSrcweir     return m_aLB_Geometry.GetSelectEntryPos();
100cdf0e10cSrcweir }
SelectEntryPos(sal_uInt16 nPos)101cdf0e10cSrcweir void BarGeometryResources::SelectEntryPos( sal_uInt16 nPos )
102cdf0e10cSrcweir {
103cdf0e10cSrcweir     if( nPos < m_aLB_Geometry.GetEntryCount() )
104cdf0e10cSrcweir         m_aLB_Geometry.SelectEntryPos( nPos );
105cdf0e10cSrcweir }
106cdf0e10cSrcweir 
107cdf0e10cSrcweir //.............................................................................
108cdf0e10cSrcweir } //namespace chart
109cdf0e10cSrcweir //.............................................................................
110cdf0e10cSrcweir 
111