xref: /AOO41X/main/chart2/source/controller/dialogs/dlg_InsertAxis_Grid.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_chart2.hxx"
30*cdf0e10cSrcweir #include "dlg_InsertAxis_Grid.hxx"
31*cdf0e10cSrcweir #include "dlg_InsertAxis_Grid.hrc"
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include "ResId.hxx"
34*cdf0e10cSrcweir #include "chartview/ChartSfxItemIds.hxx"
35*cdf0e10cSrcweir #include "SchSlotIds.hxx"
36*cdf0e10cSrcweir #include "HelpIds.hrc"
37*cdf0e10cSrcweir #include "NoWarningThisInCTOR.hxx"
38*cdf0e10cSrcweir #include "ObjectNameProvider.hxx"
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir // header for class SfxBoolItem
41*cdf0e10cSrcweir #include <svl/eitem.hxx>
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir //.............................................................................
44*cdf0e10cSrcweir namespace chart
45*cdf0e10cSrcweir {
46*cdf0e10cSrcweir //.............................................................................
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir InsertAxisOrGridDialogData::InsertAxisOrGridDialogData()
49*cdf0e10cSrcweir         : aPossibilityList(6)
50*cdf0e10cSrcweir         , aExistenceList(6)
51*cdf0e10cSrcweir {
52*cdf0e10cSrcweir     sal_Int32 nN = 0;
53*cdf0e10cSrcweir     for(nN=6;nN--;)
54*cdf0e10cSrcweir         aPossibilityList[nN]=true;
55*cdf0e10cSrcweir     for(nN=6;nN--;)
56*cdf0e10cSrcweir         aExistenceList[nN]=false;
57*cdf0e10cSrcweir }
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir //==============================
60*cdf0e10cSrcweir //
61*cdf0e10cSrcweir // SchAxisDlg
62*cdf0e10cSrcweir //
63*cdf0e10cSrcweir //==============================
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir SchAxisDlg::SchAxisDlg( Window* pWindow
66*cdf0e10cSrcweir                        , const InsertAxisOrGridDialogData& rInput, sal_Bool bAxisDlg )
67*cdf0e10cSrcweir                        :
68*cdf0e10cSrcweir 		ModalDialog( pWindow, SchResId( DLG_AXIS_OR_GRID )),
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir 		aFlPrimary( this, SchResId( FL_PRIMARY_AXIS )),
71*cdf0e10cSrcweir         aFlPrimaryGrid( this, SchResId( FL_PRIMARY_GRID )),
72*cdf0e10cSrcweir 		aCbPrimaryX( this, SchResId( CB_X_PRIMARY )),
73*cdf0e10cSrcweir 		aCbPrimaryY( this, SchResId( CB_Y_PRIMARY )),
74*cdf0e10cSrcweir 		aCbPrimaryZ( this, SchResId( CB_Z_PRIMARY )),
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir 		aFlSecondary( this, SchResId( FL_SECONDARY_AXIS )),
77*cdf0e10cSrcweir         aFlSecondaryGrid( this, SchResId( FL_SECONDARY_GRID )),
78*cdf0e10cSrcweir 		aCbSecondaryX( this, SchResId( CB_X_SECONDARY )),
79*cdf0e10cSrcweir 		aCbSecondaryY( this, SchResId( CB_Y_SECONDARY )),
80*cdf0e10cSrcweir         aCbSecondaryZ( this, SchResId( CB_Z_SECONDARY )),
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir 		aPbOK( this, SchResId( BTN_OK )),
83*cdf0e10cSrcweir 		aPbCancel( this, SchResId( BTN_CANCEL )),
84*cdf0e10cSrcweir 		aPbHelp( this, SchResId( BTN_HELP ))
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir 		//rOutAttrs( rInAttrs )
87*cdf0e10cSrcweir {
88*cdf0e10cSrcweir     FreeResource();
89*cdf0e10cSrcweir     if(!bAxisDlg)
90*cdf0e10cSrcweir     {
91*cdf0e10cSrcweir         SetHelpId( HID_INSERT_GRIDS );
92*cdf0e10cSrcweir         SetText( ObjectNameProvider::getName(OBJECTTYPE_GRID,true) );
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir         aCbPrimaryX.SetHelpId( HID_SCH_CB_XGRID );
95*cdf0e10cSrcweir         aCbPrimaryY.SetHelpId( HID_SCH_CB_YGRID );
96*cdf0e10cSrcweir         aCbPrimaryZ.SetHelpId( HID_SCH_CB_ZGRID );
97*cdf0e10cSrcweir         aCbSecondaryX.SetHelpId( HID_SCH_CB_SECONDARY_XGRID );
98*cdf0e10cSrcweir         aCbSecondaryY.SetHelpId( HID_SCH_CB_SECONDARY_YGRID );
99*cdf0e10cSrcweir         aCbSecondaryZ.SetHelpId( HID_SCH_CB_SECONDARY_ZGRID );
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir         aFlPrimary.Hide();
102*cdf0e10cSrcweir         aFlSecondary.Hide();
103*cdf0e10cSrcweir         aFlPrimaryGrid.Show();
104*cdf0e10cSrcweir         aFlSecondaryGrid.Show();
105*cdf0e10cSrcweir     }
106*cdf0e10cSrcweir     else
107*cdf0e10cSrcweir     {
108*cdf0e10cSrcweir         SetText( ObjectNameProvider::getName(OBJECTTYPE_AXIS,true) );
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir         //todo: remove if secondary z axis are possible somewhere
111*cdf0e10cSrcweir         {
112*cdf0e10cSrcweir             aCbSecondaryZ.Hide();
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir             Size aSize( GetSizePixel() );
115*cdf0e10cSrcweir             //aSize.Height() -= aCbSecondaryZ.GetSizePixel().Height();
116*cdf0e10cSrcweir             aSize.Height() -= ( aCbSecondaryZ.GetPosPixel().Y() - aCbSecondaryY.GetPosPixel().Y() );
117*cdf0e10cSrcweir             SetSizePixel(aSize);
118*cdf0e10cSrcweir         }
119*cdf0e10cSrcweir     }
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir     aCbPrimaryX.Check( rInput.aExistenceList[0] );
122*cdf0e10cSrcweir     aCbPrimaryY.Check( rInput.aExistenceList[1] );
123*cdf0e10cSrcweir     aCbPrimaryZ.Check( rInput.aExistenceList[2] );
124*cdf0e10cSrcweir     aCbSecondaryX.Check( rInput.aExistenceList[3] );
125*cdf0e10cSrcweir     aCbSecondaryY.Check( rInput.aExistenceList[4] );
126*cdf0e10cSrcweir     aCbSecondaryZ.Check( rInput.aExistenceList[5] );
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir     aCbPrimaryX.Enable( rInput.aPossibilityList[0] );
129*cdf0e10cSrcweir     aCbPrimaryY.Enable( rInput.aPossibilityList[1] );
130*cdf0e10cSrcweir     aCbPrimaryZ.Enable( rInput.aPossibilityList[2] );
131*cdf0e10cSrcweir     aCbSecondaryX.Enable( rInput.aPossibilityList[3] );
132*cdf0e10cSrcweir     aCbSecondaryY.Enable( rInput.aPossibilityList[4] );
133*cdf0e10cSrcweir     aCbSecondaryZ.Enable( rInput.aPossibilityList[5] );
134*cdf0e10cSrcweir }
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir SchAxisDlg::~SchAxisDlg()
137*cdf0e10cSrcweir {
138*cdf0e10cSrcweir }
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir void SchAxisDlg::getResult( InsertAxisOrGridDialogData& rOutput )
141*cdf0e10cSrcweir {
142*cdf0e10cSrcweir     rOutput.aExistenceList[0]=aCbPrimaryX.IsChecked();
143*cdf0e10cSrcweir     rOutput.aExistenceList[1]=aCbPrimaryY.IsChecked();
144*cdf0e10cSrcweir     rOutput.aExistenceList[2]=aCbPrimaryZ.IsChecked();
145*cdf0e10cSrcweir     rOutput.aExistenceList[3]=aCbSecondaryX.IsChecked();
146*cdf0e10cSrcweir     rOutput.aExistenceList[4]=aCbSecondaryY.IsChecked();
147*cdf0e10cSrcweir     rOutput.aExistenceList[5]=aCbSecondaryZ.IsChecked();
148*cdf0e10cSrcweir }
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir SchGridDlg::SchGridDlg( Window* pParent, const InsertAxisOrGridDialogData& rInput )
151*cdf0e10cSrcweir                 : SchAxisDlg( pParent, rInput, false )//rInAttrs, b3D, bNet, bSecondaryX, bSecondaryY, false )
152*cdf0e10cSrcweir {
153*cdf0e10cSrcweir }
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir SchGridDlg::~SchGridDlg()
156*cdf0e10cSrcweir {
157*cdf0e10cSrcweir }
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir //.............................................................................
160*cdf0e10cSrcweir } //namespace chart
161*cdf0e10cSrcweir //.............................................................................
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir 
165