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 "res_BarGeometry.hxx"
28 #include "ResourceIds.hrc"
29 #include "Strings.hrc"
30 #include "ResId.hxx"
31 
32 #ifndef _SVT_CONTROLDIMS_HRC_
33 #include <svtools/controldims.hrc>
34 #endif
35 
36 //.............................................................................
37 namespace chart
38 {
39 //.............................................................................
40 
BarGeometryResources(Window * pWindow)41 BarGeometryResources::BarGeometryResources( Window* pWindow )
42     : m_aFT_Geometry( pWindow, pWindow->GetStyle() )
43 	, m_aLB_Geometry( pWindow, SchResId( LB_BAR_GEOMETRY ) )
44 {
45     m_aFT_Geometry.SetText( String( SchResId( STR_BAR_GEOMETRY )) );
46     m_aFT_Geometry.SetSizePixel( m_aFT_Geometry.CalcMinimumSize() );
47 	m_aLB_Geometry.SetAccessibleName(m_aFT_Geometry.GetText());
48 	m_aLB_Geometry.SetAccessibleRelationLabeledBy(&m_aFT_Geometry);
49 }
SetPosPixel(const Point & rPosition)50 void BarGeometryResources::SetPosPixel( const Point& rPosition )
51 {
52     Window* pWindow( m_aFT_Geometry.GetParent() );
53 
54     Size aDistanceSize( 2,2 );
55     if( pWindow )
56         aDistanceSize = Size( pWindow->LogicToPixel( Size(0,RSC_SP_CTRL_DESC_Y), MapMode(MAP_APPFONT) ) );
57 
58     m_aFT_Geometry.SetPosPixel( rPosition );
59     m_aLB_Geometry.SetPosPixel( Point( rPosition.X()+aDistanceSize.Width(), rPosition.Y()+m_aFT_Geometry.GetSizePixel().Height()+aDistanceSize.Height()) );
60 }
GetSizePixel() const61 Size BarGeometryResources::GetSizePixel() const
62 {
63     long nHeight = m_aLB_Geometry.GetPosPixel().Y()
64         - m_aFT_Geometry.GetPosPixel().Y();
65     nHeight += m_aLB_Geometry.GetSizePixel().Height();
66 
67     long nWidth = m_aLB_Geometry.GetSizePixel().Width();
68     if( nWidth < m_aFT_Geometry.GetSizePixel().Width() )
69         nWidth = m_aFT_Geometry.GetSizePixel().Width();
70 
71     return Size( nHeight, nWidth );
72 }
~BarGeometryResources()73 BarGeometryResources::~BarGeometryResources()
74 {
75 }
76 
SetSelectHdl(const Link & rLink)77 void BarGeometryResources::SetSelectHdl( const Link& rLink )
78 {
79     m_aLB_Geometry.SetSelectHdl( rLink );
80 }
81 
Show(bool bShow)82 void BarGeometryResources::Show( bool bShow )
83 {
84     m_aFT_Geometry.Show( bShow );
85     m_aLB_Geometry.Show( bShow );
86 }
Enable(bool bEnable)87 void BarGeometryResources::Enable( bool bEnable )
88 {
89     m_aFT_Geometry.Enable( bEnable );
90     m_aLB_Geometry.Enable( bEnable );
91 }
92 
GetSelectEntryCount() const93 sal_uInt16 BarGeometryResources::GetSelectEntryCount() const
94 {
95     return m_aLB_Geometry.GetSelectEntryCount();
96 }
GetSelectEntryPos() const97 sal_uInt16 BarGeometryResources::GetSelectEntryPos() const
98 {
99     return m_aLB_Geometry.GetSelectEntryPos();
100 }
SelectEntryPos(sal_uInt16 nPos)101 void BarGeometryResources::SelectEntryPos( sal_uInt16 nPos )
102 {
103     if( nPos < m_aLB_Geometry.GetEntryCount() )
104         m_aLB_Geometry.SelectEntryPos( nPos );
105 }
106 
107 //.............................................................................
108 } //namespace chart
109 //.............................................................................
110 
111