Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include "res_BarGeometry.hxx"
22 : #include "ResourceIds.hrc"
23 : #include "Strings.hrc"
24 : #include "ResId.hxx"
25 :
26 : #include <svtools/controldims.hrc>
27 :
28 : //.............................................................................
29 : namespace chart
30 : {
31 : //.............................................................................
32 :
33 0 : BarGeometryResources::BarGeometryResources( Window* pWindow )
34 : : m_aFT_Geometry( pWindow, pWindow->GetStyle() )
35 0 : , m_aLB_Geometry( pWindow, SchResId( LB_BAR_GEOMETRY ) )
36 : {
37 0 : m_aFT_Geometry.SetText( String( SchResId( STR_BAR_GEOMETRY )) );
38 0 : m_aFT_Geometry.SetSizePixel( m_aFT_Geometry.CalcMinimumSize() );
39 0 : m_aLB_Geometry.SetAccessibleName(m_aFT_Geometry.GetText());
40 0 : m_aLB_Geometry.SetAccessibleRelationLabeledBy(&m_aFT_Geometry);
41 0 : }
42 0 : void BarGeometryResources::SetPosPixel( const Point& rPosition )
43 : {
44 0 : Window* pWindow( m_aFT_Geometry.GetParent() );
45 :
46 0 : Size aDistanceSize( 2,2 );
47 0 : if( pWindow )
48 0 : aDistanceSize = Size( pWindow->LogicToPixel( Size(0,RSC_SP_CTRL_DESC_Y), MapMode(MAP_APPFONT) ) );
49 :
50 0 : m_aFT_Geometry.SetPosPixel( rPosition );
51 0 : m_aLB_Geometry.SetPosPixel( Point( rPosition.X()+aDistanceSize.Width(), rPosition.Y()+m_aFT_Geometry.GetSizePixel().Height()+aDistanceSize.Height()) );
52 0 : }
53 0 : Size BarGeometryResources::GetSizePixel() const
54 : {
55 0 : long nHeight = m_aLB_Geometry.GetPosPixel().Y()
56 0 : - m_aFT_Geometry.GetPosPixel().Y();
57 0 : nHeight += m_aLB_Geometry.GetSizePixel().Height();
58 :
59 0 : long nWidth = m_aLB_Geometry.GetSizePixel().Width();
60 0 : if( nWidth < m_aFT_Geometry.GetSizePixel().Width() )
61 0 : nWidth = m_aFT_Geometry.GetSizePixel().Width();
62 :
63 0 : return Size( nHeight, nWidth );
64 : }
65 0 : BarGeometryResources::~BarGeometryResources()
66 : {
67 0 : }
68 :
69 0 : void BarGeometryResources::SetSelectHdl( const Link& rLink )
70 : {
71 0 : m_aLB_Geometry.SetSelectHdl( rLink );
72 0 : }
73 :
74 0 : void BarGeometryResources::Show( bool bShow )
75 : {
76 0 : m_aFT_Geometry.Show( bShow );
77 0 : m_aLB_Geometry.Show( bShow );
78 0 : }
79 0 : void BarGeometryResources::Enable( bool bEnable )
80 : {
81 0 : m_aFT_Geometry.Enable( bEnable );
82 0 : m_aLB_Geometry.Enable( bEnable );
83 0 : }
84 :
85 0 : sal_uInt16 BarGeometryResources::GetSelectEntryCount() const
86 : {
87 0 : return m_aLB_Geometry.GetSelectEntryCount();
88 : }
89 0 : sal_uInt16 BarGeometryResources::GetSelectEntryPos() const
90 : {
91 0 : return m_aLB_Geometry.GetSelectEntryPos();
92 : }
93 0 : void BarGeometryResources::SelectEntryPos( sal_uInt16 nPos )
94 : {
95 0 : if( nPos < m_aLB_Geometry.GetEntryCount() )
96 0 : m_aLB_Geometry.SelectEntryPos( nPos );
97 0 : }
98 :
99 : //.............................................................................
100 : } //namespace chart
101 : //.............................................................................
102 :
103 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|