From 8c8402061bb3908d195e3d1b462409d8bcc8e279 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Tue, 18 Dec 2012 12:57:35 -0500 Subject: Refactored pivot table dialog code for better modularity. Moved much of the field area specific storage from the parent dialog to its child field area control. It's much cleaner this way. Change-Id: I603fbebc2d9d62742a3808d6f72ca23357d84046 --- sc/source/ui/inc/pvlaydlg.hxx | 54 ++++++++++--------------------------------- 1 file changed, 12 insertions(+), 42 deletions(-) (limited to 'sc/source/ui/inc/pvlaydlg.hxx') diff --git a/sc/source/ui/inc/pvlaydlg.hxx b/sc/source/ui/inc/pvlaydlg.hxx index 678ccbaba486..31bed6b4bfaf 100644 --- a/sc/source/ui/inc/pvlaydlg.hxx +++ b/sc/source/ui/inc/pvlaydlg.hxx @@ -80,8 +80,6 @@ class ScDPObject; class ScPivotLayoutDlg : public ScAnyRefDlg { - typedef boost::ptr_vector ScDPFuncDataVec; - /** data source type */ enum DataSrcType { SRC_REF, /// range reference @@ -146,14 +144,10 @@ private: void InitWndData(const std::vector& rFields); void InitFieldWindow ( const ::std::vector& rFields, ScPivotFieldType eType ); void AdjustDlgSize(); - Point DlgPos2WndPos ( const Point& rPt, Window& rWnd ); - ScDPLabelData* GetLabelData ( SCsCOL nCol, size_t* pPos = NULL ); + ScDPLabelData* GetLabelData( SCCOL nCol ); rtl::OUString GetLabelString(SCsCOL nCol); bool IsOrientationAllowed( SCsCOL nCol, ScPivotFieldType eType ); rtl::OUString GetFuncString( sal_uInt16& rFuncMask, bool bIsValue = true ); - bool Contains( ScDPFuncDataVec* pArr, const ScPivotFuncData& rData, size_t& nAt ); - void Remove ( ScDPFuncDataVec* pArr, size_t nAt ); - void Insert ( ScDPFuncDataVec* pArr, const ScPivotFuncData& rFData, size_t nAt ); void AddField ( size_t nFromIndex, ScPivotFieldType eToType, const Point& rAtPos ); @@ -168,7 +162,11 @@ private: ::std::vector& rRowFields, ::std::vector& rDataFields ); - void UpdateSrcRange(); + void UpdateSrcRange(); + void UpdateOutputPos(); + void OutputPosUpdated(); + void MoreBtnClicked(); + void RepaintFieldWindows(); /** @@ -185,17 +183,6 @@ private: void GetOtherFieldWindows( ScPivotFieldType eType, ScDPFieldControlBase*& rpWnd1, ScDPFieldControlBase*& rpWnd2); - ScDPFuncDataVec* GetFieldDataArray(ScPivotFieldType eType); - - /** - * Like GetOtherFieldWindows(), get pointers to data arrays of the fields - * that are not the specified field type. - */ - void GetOtherDataArrays( - ScPivotFieldType eType, ScDPFuncDataVec*& rpArr1, ScDPFuncDataVec*& rpArr2); - - sal_uInt8 GetNextDupCount(const ScDPFuncDataVec& rArr, const ScPivotFuncData& rData, size_t nDataIndex) const; - // Handler DECL_LINK( ClickHdl, PushButton * ); DECL_LINK( OkHdl, void * ); @@ -204,17 +191,9 @@ private: DECL_LINK( EdOutModifyHdl, void * ); DECL_LINK( EdInModifyHdl, void * ); DECL_LINK( SelAreaHdl, void * ); - DECL_LINK( GetFocusHdl, formula::RefEdit* ); + DECL_LINK( GetRefEditFocusHdl, formula::RefEdit* ); private: - struct FieldRect - { - const Rectangle* mpRect; - ScPivotFieldType meType; - - FieldRect(const Rectangle* pRect, ScPivotFieldType eType); - }; - typedef boost::scoped_ptr ScDPObjectPtr; FixedLine maFlLayout; @@ -229,6 +208,8 @@ private: ScDPSelectFieldControl maWndSelect; FixedInfo maFtInfo; + std::vector maFieldCtrls; + FixedLine maFlAreas; FixedText maFtInArea; ::formula::RefEdit maEdInPos; @@ -251,6 +232,7 @@ private: PushButton maBtnOptions; MoreButton maBtnMore; std::vector maFuncNames; /// Localized function names from resource. + boost::ptr_vector maRefStrs; /// Reference strings stored with the output list box. ScDPObjectPtr mxDlgDPObject; /// Clone of the pivot table object this dialog is based on. ScPivotParam maPivotData; /// The pivot table field configuration. ScDPLabelDataVector maLabelData; /// Information about all dimensions. @@ -261,27 +243,15 @@ private: const rtl::OUString maStrUndefined; const rtl::OUString maStrNewTable; + rtl::OUString maOutputRefStr; /// Used only for caching in UI. ScPivotFieldType meDnDFromType; size_t mnDnDFromIndex; bool mbIsDrag; - Rectangle maRectPage; - Rectangle maRectRow; - Rectangle maRectCol; - Rectangle maRectData; - Rectangle maRectSelect; - std::vector maFieldRects; - - ScPivotFieldType meLastActiveType; /// Type of last active area. + ScPivotFieldType meLastActiveType; /// Type of last active area. size_t mnOffset; /// Offset of first field in TYPE_SELECT area. - ScDPFuncDataVec maSelectArr; - ScDPFuncDataVec maPageArr; - ScDPFuncDataVec maColArr; - ScDPFuncDataVec maRowArr; - ScDPFuncDataVec maDataArr; - ScRange maOldRange; bool mbRefInputMode; }; -- cgit