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