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 #ifndef SC_PVLAYDLG_HXX 29 #define SC_PVLAYDLG_HXX 30 31 #include <memory> 32 #include <vector> 33 34 #include <formula/funcutl.hxx> 35 #include <svtools/stdctrl.hxx> 36 #include <vcl/lstbox.hxx> 37 #include <vcl/morebtn.hxx> 38 #include <vcl/scrbar.hxx> 39 40 #include "anyrefdg.hxx" 41 #include "fieldwnd.hxx" 42 43 // ============================================================================ 44 45 class ScViewData; 46 class ScDocument; 47 class ScRangeData; 48 class ScDPObject; 49 50 // ============================================================================ 51 52 class ScPivotLayoutDlg : public ScAnyRefDlg 53 { 54 public: 55 ScPivotLayoutDlg( 56 SfxBindings* pB, 57 SfxChildWindow* pCW, 58 Window* pParent, 59 const ScDPObject& rDPObject ); 60 virtual ~ScPivotLayoutDlg(); 61 62 ScDPLabelData* GetLabelData( SCCOL nCol, size_t* pnIndex = 0 ); 63 String GetFuncString( sal_uInt16& rnFuncMask, bool bIsValue = true ); 64 65 void NotifyStartTracking( ScPivotFieldWindow& rSourceWindow ); 66 void NotifyDoubleClick( ScPivotFieldWindow& rSourceWindow ); 67 void NotifyFieldRemoved( ScPivotFieldWindow& rSourceWindow ); 68 69 protected: 70 virtual void Tracking( const TrackingEvent& rTEvt ); 71 virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ); 72 virtual sal_Bool IsRefInputMode() const; 73 virtual void SetActive(); 74 virtual sal_Bool Close(); 75 76 private: 77 /** Returns the localized function name for the specified (1-based) resource index. */ 78 inline const String& GetFuncName( sal_uInt16 nFuncIdx ) const { return maFuncNames[ nFuncIdx - 1 ]; } 79 /** Returns the specified field window. */ 80 ScPivotFieldWindow& GetFieldWindow( ScPivotFieldType eFieldType ); 81 82 /** Fills the field windows from the current pivot table settings. */ 83 void InitFieldWindows(); 84 /** Sets focus to the specified field window, if it is not empty. */ 85 void GrabFieldFocus( ScPivotFieldWindow& rFieldWindow ); 86 87 /** Returns true, if the specified field can be inserted into the specified field window. */ 88 bool IsInsertAllowed( const ScPivotFieldWindow& rSourceWindow, const ScPivotFieldWindow& rTargetWindow ); 89 /** Moves the selected field in the source window to the specified window. */ 90 bool MoveField( ScPivotFieldWindow& rSourceWindow, ScPivotFieldWindow& rTargetWindow, size_t nInsertIndex, bool bMoveExisting ); 91 92 // Handler 93 DECL_LINK( ClickHdl, PushButton * ); 94 DECL_LINK( OkHdl, OKButton * ); 95 DECL_LINK( CancelHdl, CancelButton * ); 96 DECL_LINK( MoreClickHdl, MoreButton * ); 97 DECL_LINK( EdOutModifyHdl, Edit * ); 98 DECL_LINK( EdInModifyHdl, Edit * ); 99 DECL_LINK( SelAreaHdl, ListBox * ); 100 DECL_LINK( ChildEventListener, VclWindowEvent* ); 101 102 private: 103 typedef ::std::auto_ptr< ScDPObject > ScDPObjectPtr; 104 105 FixedLine maFlLayout; 106 ScrollBar maScrPage; 107 FixedText maFtPage; 108 ScPivotFieldWindow maWndPage; 109 ScrollBar maScrCol; 110 FixedText maFtCol; 111 ScPivotFieldWindow maWndCol; 112 ScrollBar maScrRow; 113 FixedText maFtRow; 114 ScPivotFieldWindow maWndRow; 115 ScrollBar maScrData; 116 FixedText maFtData; 117 ScPivotFieldWindow maWndData; 118 FixedLine maFlSelect; 119 ScrollBar maScrSelect; 120 ScPivotFieldWindow maWndSelect; 121 FixedInfo maFtInfo; 122 123 FixedLine maFlAreas; 124 FixedText maFtInArea; 125 ::formula::RefEdit maEdInPos; 126 ::formula::RefButton maRbInPos; 127 ListBox maLbOutPos; 128 FixedText maFtOutArea; 129 formula::RefEdit maEdOutPos; 130 formula::RefButton maRbOutPos; 131 CheckBox maBtnIgnEmptyRows; 132 CheckBox maBtnDetectCat; 133 CheckBox maBtnTotalCol; 134 CheckBox maBtnTotalRow; 135 CheckBox maBtnFilter; 136 CheckBox maBtnDrillDown; 137 138 OKButton maBtnOk; 139 CancelButton maBtnCancel; 140 HelpButton maBtnHelp; 141 PushButton maBtnRemove; 142 PushButton maBtnOptions; 143 MoreButton maBtnMore; 144 145 ::std::vector< String > maFuncNames; /// Localized function names from resource. 146 147 ScDPObjectPtr mxDlgDPObject; /// Clone of the pivot table object this dialog is based on. 148 ScPivotParam maPivotData; /// The pivot table field configuration. 149 ScDPLabelDataVector maLabelData; /// Information about all dimensions. 150 151 ScViewData* mpViewData; 152 ScDocument* mpDoc; 153 ScPivotFieldWindow* mpFocusWindow; /// Pointer to the field window that currently has the focus. 154 ScPivotFieldWindow* mpTrackingWindow; /// Pointer to the field window that has started mouse tracking. 155 ScPivotFieldWindow* mpDropWindow; /// Pointer to the field window that shows an insertion cursor. 156 ::formula::RefEdit* mpActiveEdit; 157 bool mbRefInputMode; 158 }; 159 160 // ============================================================================ 161 162 #endif 163