1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_chart2.hxx"
30 
31 #include "res_BarGeometry.hxx"
32 #include "ResourceIds.hrc"
33 #include "Strings.hrc"
34 #include "ResId.hxx"
35 
36 #ifndef _SVT_CONTROLDIMS_HRC_
37 #include <svtools/controldims.hrc>
38 #endif
39 
40 //.............................................................................
41 namespace chart
42 {
43 //.............................................................................
44 
45 BarGeometryResources::BarGeometryResources( Window* pWindow )
46     : m_aFT_Geometry( pWindow, pWindow->GetStyle() )
47 	, m_aLB_Geometry( pWindow, SchResId( LB_BAR_GEOMETRY ) )
48 {
49     m_aFT_Geometry.SetText( String( SchResId( STR_BAR_GEOMETRY )) );
50     m_aFT_Geometry.SetSizePixel( m_aFT_Geometry.CalcMinimumSize() );
51 	m_aLB_Geometry.SetAccessibleName(m_aFT_Geometry.GetText());
52 	m_aLB_Geometry.SetAccessibleRelationLabeledBy(&m_aFT_Geometry);
53 }
54 void BarGeometryResources::SetPosPixel( const Point& rPosition )
55 {
56     Window* pWindow( m_aFT_Geometry.GetParent() );
57 
58     Size aDistanceSize( 2,2 );
59     if( pWindow )
60         aDistanceSize = Size( pWindow->LogicToPixel( Size(0,RSC_SP_CTRL_DESC_Y), MapMode(MAP_APPFONT) ) );
61 
62     m_aFT_Geometry.SetPosPixel( rPosition );
63     m_aLB_Geometry.SetPosPixel( Point( rPosition.X()+aDistanceSize.Width(), rPosition.Y()+m_aFT_Geometry.GetSizePixel().Height()+aDistanceSize.Height()) );
64 }
65 Size BarGeometryResources::GetSizePixel() const
66 {
67     long nHeight = m_aLB_Geometry.GetPosPixel().Y()
68         - m_aFT_Geometry.GetPosPixel().Y();
69     nHeight += m_aLB_Geometry.GetSizePixel().Height();
70 
71     long nWidth = m_aLB_Geometry.GetSizePixel().Width();
72     if( nWidth < m_aFT_Geometry.GetSizePixel().Width() )
73         nWidth = m_aFT_Geometry.GetSizePixel().Width();
74 
75     return Size( nHeight, nWidth );
76 }
77 BarGeometryResources::~BarGeometryResources()
78 {
79 }
80 
81 void BarGeometryResources::SetSelectHdl( const Link& rLink )
82 {
83     m_aLB_Geometry.SetSelectHdl( rLink );
84 }
85 
86 void BarGeometryResources::Show( bool bShow )
87 {
88     m_aFT_Geometry.Show( bShow );
89     m_aLB_Geometry.Show( bShow );
90 }
91 void BarGeometryResources::Enable( bool bEnable )
92 {
93     m_aFT_Geometry.Enable( bEnable );
94     m_aLB_Geometry.Enable( bEnable );
95 }
96 
97 sal_uInt16 BarGeometryResources::GetSelectEntryCount() const
98 {
99     return m_aLB_Geometry.GetSelectEntryCount();
100 }
101 sal_uInt16 BarGeometryResources::GetSelectEntryPos() const
102 {
103     return m_aLB_Geometry.GetSelectEntryPos();
104 }
105 void BarGeometryResources::SelectEntryPos( sal_uInt16 nPos )
106 {
107     if( nPos < m_aLB_Geometry.GetEntryCount() )
108         m_aLB_Geometry.SelectEntryPos( nPos );
109 }
110 
111 //.............................................................................
112 } //namespace chart
113 //.............................................................................
114 
115