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 : #include "dlg_InsertAxis_Grid.hxx"
21 : #include "dlg_InsertAxis_Grid.hrc"
22 :
23 : #include "ResId.hxx"
24 : #include "chartview/ChartSfxItemIds.hxx"
25 : #include "HelpIds.hrc"
26 : #include "NoWarningThisInCTOR.hxx"
27 : #include "ObjectNameProvider.hxx"
28 :
29 : // header for class SfxBoolItem
30 : #include <svl/eitem.hxx>
31 :
32 : //.............................................................................
33 : namespace chart
34 : {
35 : //.............................................................................
36 :
37 0 : InsertAxisOrGridDialogData::InsertAxisOrGridDialogData()
38 : : aPossibilityList(6)
39 0 : , aExistenceList(6)
40 : {
41 0 : sal_Int32 nN = 0;
42 0 : for(nN=6;nN--;)
43 0 : aPossibilityList[nN]=true;
44 0 : for(nN=6;nN--;)
45 0 : aExistenceList[nN]=false;
46 0 : }
47 :
48 : //==============================
49 : //
50 : // SchAxisDlg
51 : //
52 : //==============================
53 :
54 0 : SchAxisDlg::SchAxisDlg( Window* pWindow
55 : , const InsertAxisOrGridDialogData& rInput, sal_Bool bAxisDlg )
56 : :
57 : ModalDialog( pWindow, SchResId( DLG_AXIS_OR_GRID )),
58 :
59 : aFlPrimary( this, SchResId( FL_PRIMARY_AXIS )),
60 : aFlPrimaryGrid( this, SchResId( FL_PRIMARY_GRID )),
61 : aCbPrimaryX( this, SchResId( CB_X_PRIMARY )),
62 : aCbPrimaryY( this, SchResId( CB_Y_PRIMARY )),
63 : aCbPrimaryZ( this, SchResId( CB_Z_PRIMARY )),
64 :
65 : aFlSecondary( this, SchResId( FL_SECONDARY_AXIS )),
66 : aFlSecondaryGrid( this, SchResId( FL_SECONDARY_GRID )),
67 : aCbSecondaryX( this, SchResId( CB_X_SECONDARY )),
68 : aCbSecondaryY( this, SchResId( CB_Y_SECONDARY )),
69 : aCbSecondaryZ( this, SchResId( CB_Z_SECONDARY )),
70 :
71 : aPbOK( this, SchResId( BTN_OK )),
72 : aPbCancel( this, SchResId( BTN_CANCEL )),
73 0 : aPbHelp( this, SchResId( BTN_HELP ))
74 :
75 : //rOutAttrs( rInAttrs )
76 : {
77 0 : FreeResource();
78 0 : if(!bAxisDlg)
79 : {
80 0 : SetHelpId( HID_INSERT_GRIDS );
81 0 : SetText( ObjectNameProvider::getName(OBJECTTYPE_GRID,true) );
82 :
83 0 : aCbPrimaryX.SetHelpId( HID_SCH_CB_XGRID );
84 0 : aCbPrimaryY.SetHelpId( HID_SCH_CB_YGRID );
85 0 : aCbPrimaryZ.SetHelpId( HID_SCH_CB_ZGRID );
86 0 : aCbSecondaryX.SetHelpId( HID_SCH_CB_SECONDARY_XGRID );
87 0 : aCbSecondaryY.SetHelpId( HID_SCH_CB_SECONDARY_YGRID );
88 0 : aCbSecondaryZ.SetHelpId( HID_SCH_CB_SECONDARY_ZGRID );
89 :
90 0 : aFlPrimary.Hide();
91 0 : aFlSecondary.Hide();
92 0 : aFlPrimaryGrid.Show();
93 0 : aFlSecondaryGrid.Show();
94 : }
95 : else
96 : {
97 0 : SetText( ObjectNameProvider::getName(OBJECTTYPE_AXIS,true) );
98 :
99 : //todo: remove if secondary z axis are possible somewhere
100 : {
101 0 : aCbSecondaryZ.Hide();
102 :
103 0 : Size aSize( GetSizePixel() );
104 0 : aSize.Height() -= ( aCbSecondaryZ.GetPosPixel().Y() - aCbSecondaryY.GetPosPixel().Y() );
105 0 : SetSizePixel(aSize);
106 : }
107 : }
108 :
109 0 : aCbPrimaryX.Check( rInput.aExistenceList[0] );
110 0 : aCbPrimaryY.Check( rInput.aExistenceList[1] );
111 0 : aCbPrimaryZ.Check( rInput.aExistenceList[2] );
112 0 : aCbSecondaryX.Check( rInput.aExistenceList[3] );
113 0 : aCbSecondaryY.Check( rInput.aExistenceList[4] );
114 0 : aCbSecondaryZ.Check( rInput.aExistenceList[5] );
115 :
116 0 : aCbPrimaryX.Enable( rInput.aPossibilityList[0] );
117 0 : aCbPrimaryY.Enable( rInput.aPossibilityList[1] );
118 0 : aCbPrimaryZ.Enable( rInput.aPossibilityList[2] );
119 0 : aCbSecondaryX.Enable( rInput.aPossibilityList[3] );
120 0 : aCbSecondaryY.Enable( rInput.aPossibilityList[4] );
121 0 : aCbSecondaryZ.Enable( rInput.aPossibilityList[5] );
122 0 : }
123 :
124 0 : SchAxisDlg::~SchAxisDlg()
125 : {
126 0 : }
127 :
128 0 : void SchAxisDlg::getResult( InsertAxisOrGridDialogData& rOutput )
129 : {
130 0 : rOutput.aExistenceList[0]=aCbPrimaryX.IsChecked();
131 0 : rOutput.aExistenceList[1]=aCbPrimaryY.IsChecked();
132 0 : rOutput.aExistenceList[2]=aCbPrimaryZ.IsChecked();
133 0 : rOutput.aExistenceList[3]=aCbSecondaryX.IsChecked();
134 0 : rOutput.aExistenceList[4]=aCbSecondaryY.IsChecked();
135 0 : rOutput.aExistenceList[5]=aCbSecondaryZ.IsChecked();
136 0 : }
137 :
138 0 : SchGridDlg::SchGridDlg( Window* pParent, const InsertAxisOrGridDialogData& rInput )
139 0 : : SchAxisDlg( pParent, rInput, false )//rInAttrs, b3D, bNet, bSecondaryX, bSecondaryY, false )
140 : {
141 0 : }
142 :
143 0 : SchGridDlg::~SchGridDlg()
144 : {
145 0 : }
146 :
147 : //.............................................................................
148 : } //namespace chart
149 : //.............................................................................
150 :
151 :
152 :
153 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|