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