merge the formfield patch from ooo-build
[ooovba.git] / chart2 / source / controller / dialogs / res_BarGeometry.cxx
blobd6253831f0a8448b61bf470ddffee6dc5714643a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: res_BarGeometry.cxx,v $
10 * $Revision: 1.3.44.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_chart2.hxx"
34 #include "res_BarGeometry.hxx"
35 #include "ResourceIds.hrc"
36 #include "Strings.hrc"
37 #include "ResId.hxx"
39 #ifndef _SVT_CONTROLDIMS_HRC_
40 #include <svtools/controldims.hrc>
41 #endif
43 //.............................................................................
44 namespace chart
46 //.............................................................................
48 BarGeometryResources::BarGeometryResources( Window* pWindow )
49 : m_aFT_Geometry( pWindow, pWindow->GetStyle() )
50 , m_aLB_Geometry( pWindow, SchResId( LB_BAR_GEOMETRY ) )
52 m_aFT_Geometry.SetText( String( SchResId( STR_BAR_GEOMETRY )) );
53 m_aFT_Geometry.SetSizePixel( m_aFT_Geometry.CalcMinimumSize() );
55 void BarGeometryResources::SetPosPixel( const Point& rPosition )
57 Window* pWindow( m_aFT_Geometry.GetParent() );
59 Size aDistanceSize( 2,2 );
60 if( pWindow )
61 aDistanceSize = Size( pWindow->LogicToPixel( Size(0,RSC_SP_CTRL_DESC_Y), MapMode(MAP_APPFONT) ) );
63 m_aFT_Geometry.SetPosPixel( rPosition );
64 m_aLB_Geometry.SetPosPixel( Point( rPosition.X()+aDistanceSize.Width(), rPosition.Y()+m_aFT_Geometry.GetSizePixel().Height()+aDistanceSize.Height()) );
66 Size BarGeometryResources::GetSizePixel() const
68 long nHeight = m_aLB_Geometry.GetPosPixel().Y()
69 - m_aFT_Geometry.GetPosPixel().Y();
70 nHeight += m_aLB_Geometry.GetSizePixel().Height();
72 long nWidth = m_aLB_Geometry.GetSizePixel().Width();
73 if( nWidth < m_aFT_Geometry.GetSizePixel().Width() )
74 nWidth = m_aFT_Geometry.GetSizePixel().Width();
76 return Size( nHeight, nWidth );
78 BarGeometryResources::~BarGeometryResources()
82 void BarGeometryResources::SetSelectHdl( const Link& rLink )
84 m_aLB_Geometry.SetSelectHdl( rLink );
87 void BarGeometryResources::Show( bool bShow )
89 m_aFT_Geometry.Show( bShow );
90 m_aLB_Geometry.Show( bShow );
92 void BarGeometryResources::Enable( bool bEnable )
94 m_aFT_Geometry.Enable( bEnable );
95 m_aLB_Geometry.Enable( bEnable );
98 USHORT BarGeometryResources::GetSelectEntryCount() const
100 return m_aLB_Geometry.GetSelectEntryCount();
102 USHORT BarGeometryResources::GetSelectEntryPos() const
104 return m_aLB_Geometry.GetSelectEntryPos();
106 void BarGeometryResources::SelectEntryPos( USHORT nPos )
108 if( nPos < m_aLB_Geometry.GetEntryCount() )
109 m_aLB_Geometry.SelectEntryPos( nPos );
112 //.............................................................................
113 } //namespace chart
114 //.............................................................................