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