xref: /aoo41x/main/sc/source/ui/inc/pvlaydlg.hxx (revision 38d50f7b)
1*38d50f7bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*38d50f7bSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*38d50f7bSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*38d50f7bSAndrew Rist  * distributed with this work for additional information
6*38d50f7bSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*38d50f7bSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*38d50f7bSAndrew Rist  * "License"); you may not use this file except in compliance
9*38d50f7bSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*38d50f7bSAndrew Rist  *
11*38d50f7bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*38d50f7bSAndrew Rist  *
13*38d50f7bSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*38d50f7bSAndrew Rist  * software distributed under the License is distributed on an
15*38d50f7bSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*38d50f7bSAndrew Rist  * KIND, either express or implied.  See the License for the
17*38d50f7bSAndrew Rist  * specific language governing permissions and limitations
18*38d50f7bSAndrew Rist  * under the License.
19*38d50f7bSAndrew Rist  *
20*38d50f7bSAndrew Rist  *************************************************************/
21*38d50f7bSAndrew Rist 
22*38d50f7bSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SC_PVLAYDLG_HXX
25cdf0e10cSrcweir #define SC_PVLAYDLG_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <memory>
28cdf0e10cSrcweir #include <vector>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <formula/funcutl.hxx>
31cdf0e10cSrcweir #include <svtools/stdctrl.hxx>
32cdf0e10cSrcweir #include <vcl/lstbox.hxx>
33cdf0e10cSrcweir #include <vcl/morebtn.hxx>
34cdf0e10cSrcweir #include <vcl/scrbar.hxx>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #include "anyrefdg.hxx"
37cdf0e10cSrcweir #include "fieldwnd.hxx"
38cdf0e10cSrcweir 
39cdf0e10cSrcweir // ============================================================================
40cdf0e10cSrcweir 
41cdf0e10cSrcweir class ScViewData;
42cdf0e10cSrcweir class ScDocument;
43cdf0e10cSrcweir class ScRangeData;
44cdf0e10cSrcweir class ScDPObject;
45cdf0e10cSrcweir 
46cdf0e10cSrcweir // ============================================================================
47cdf0e10cSrcweir 
48cdf0e10cSrcweir class ScPivotLayoutDlg : public ScAnyRefDlg
49cdf0e10cSrcweir {
50cdf0e10cSrcweir public:
51cdf0e10cSrcweir                         ScPivotLayoutDlg(
52cdf0e10cSrcweir                             SfxBindings* pB,
53cdf0e10cSrcweir                             SfxChildWindow* pCW,
54cdf0e10cSrcweir                             Window* pParent,
55cdf0e10cSrcweir                             const ScDPObject& rDPObject );
56cdf0e10cSrcweir     virtual             ~ScPivotLayoutDlg();
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     ScDPLabelData*      GetLabelData( SCCOL nCol, size_t* pnIndex = 0 );
59cdf0e10cSrcweir     String              GetFuncString( sal_uInt16& rnFuncMask, bool bIsValue = true );
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     void                NotifyStartTracking( ScPivotFieldWindow& rSourceWindow );
62cdf0e10cSrcweir     void                NotifyDoubleClick( ScPivotFieldWindow& rSourceWindow );
63cdf0e10cSrcweir     void                NotifyFieldRemoved( ScPivotFieldWindow& rSourceWindow );
64cdf0e10cSrcweir 
65cdf0e10cSrcweir protected:
66cdf0e10cSrcweir     virtual void        Tracking( const TrackingEvent& rTEvt );
67cdf0e10cSrcweir     virtual void        SetReference( const ScRange& rRef, ScDocument* pDoc );
68cdf0e10cSrcweir     virtual sal_Bool    IsRefInputMode() const;
69cdf0e10cSrcweir     virtual void        SetActive();
70cdf0e10cSrcweir     virtual sal_Bool    Close();
71cdf0e10cSrcweir 
72cdf0e10cSrcweir private:
73cdf0e10cSrcweir     /** Returns the localized function name for the specified (1-based) resource index. */
GetFuncName(sal_uInt16 nFuncIdx) const74cdf0e10cSrcweir     inline const String& GetFuncName( sal_uInt16 nFuncIdx ) const { return maFuncNames[ nFuncIdx - 1 ]; }
75cdf0e10cSrcweir     /** Returns the specified field window. */
76cdf0e10cSrcweir     ScPivotFieldWindow& GetFieldWindow( ScPivotFieldType eFieldType );
77cdf0e10cSrcweir 
78cdf0e10cSrcweir     /** Fills the field windows from the current pivot table settings. */
79cdf0e10cSrcweir     void                InitFieldWindows();
80cdf0e10cSrcweir     /** Sets focus to the specified field window, if it is not empty. */
81cdf0e10cSrcweir     void                GrabFieldFocus( ScPivotFieldWindow& rFieldWindow );
82cdf0e10cSrcweir 
83cdf0e10cSrcweir     /** Returns true, if the specified field can be inserted into the specified field window. */
84cdf0e10cSrcweir     bool                IsInsertAllowed( const ScPivotFieldWindow& rSourceWindow, const ScPivotFieldWindow& rTargetWindow );
85cdf0e10cSrcweir     /** Moves the selected field in the source window to the specified window. */
86cdf0e10cSrcweir     bool                MoveField( ScPivotFieldWindow& rSourceWindow, ScPivotFieldWindow& rTargetWindow, size_t nInsertIndex, bool bMoveExisting );
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 	// Handler
89cdf0e10cSrcweir     DECL_LINK( ClickHdl, PushButton * );
90cdf0e10cSrcweir 	DECL_LINK( OkHdl, OKButton * );
91cdf0e10cSrcweir 	DECL_LINK( CancelHdl, CancelButton * );
92cdf0e10cSrcweir 	DECL_LINK( MoreClickHdl, MoreButton * );
93cdf0e10cSrcweir 	DECL_LINK( EdOutModifyHdl, Edit * );
94cdf0e10cSrcweir     DECL_LINK( EdInModifyHdl, Edit * );
95cdf0e10cSrcweir 	DECL_LINK( SelAreaHdl, ListBox * );
96cdf0e10cSrcweir     DECL_LINK( ChildEventListener, VclWindowEvent* );
97cdf0e10cSrcweir 
98cdf0e10cSrcweir private:
99cdf0e10cSrcweir     typedef ::std::auto_ptr< ScDPObject > ScDPObjectPtr;
100cdf0e10cSrcweir 
101cdf0e10cSrcweir     FixedLine           maFlLayout;
102cdf0e10cSrcweir     ScrollBar           maScrPage;
103cdf0e10cSrcweir     FixedText           maFtPage;
104cdf0e10cSrcweir     ScPivotFieldWindow  maWndPage;
105cdf0e10cSrcweir     ScrollBar           maScrCol;
106cdf0e10cSrcweir     FixedText           maFtCol;
107cdf0e10cSrcweir     ScPivotFieldWindow  maWndCol;
108cdf0e10cSrcweir     ScrollBar           maScrRow;
109cdf0e10cSrcweir     FixedText           maFtRow;
110cdf0e10cSrcweir     ScPivotFieldWindow  maWndRow;
111cdf0e10cSrcweir     ScrollBar           maScrData;
112cdf0e10cSrcweir     FixedText           maFtData;
113cdf0e10cSrcweir     ScPivotFieldWindow  maWndData;
114cdf0e10cSrcweir     FixedLine           maFlSelect;
115cdf0e10cSrcweir     ScrollBar           maScrSelect;
116cdf0e10cSrcweir     ScPivotFieldWindow  maWndSelect;
117cdf0e10cSrcweir     FixedInfo           maFtInfo;
118cdf0e10cSrcweir 
119cdf0e10cSrcweir     FixedLine           maFlAreas;
120cdf0e10cSrcweir     FixedText           maFtInArea;
121cdf0e10cSrcweir     ::formula::RefEdit  maEdInPos;
122cdf0e10cSrcweir     ::formula::RefButton maRbInPos;
123cdf0e10cSrcweir     ListBox             maLbOutPos;
124cdf0e10cSrcweir     FixedText           maFtOutArea;
125cdf0e10cSrcweir     formula::RefEdit    maEdOutPos;
126cdf0e10cSrcweir     formula::RefButton  maRbOutPos;
127cdf0e10cSrcweir     CheckBox            maBtnIgnEmptyRows;
128cdf0e10cSrcweir     CheckBox            maBtnDetectCat;
129cdf0e10cSrcweir     CheckBox            maBtnTotalCol;
130cdf0e10cSrcweir     CheckBox            maBtnTotalRow;
131cdf0e10cSrcweir     CheckBox            maBtnFilter;
132cdf0e10cSrcweir     CheckBox            maBtnDrillDown;
133cdf0e10cSrcweir 
134cdf0e10cSrcweir     OKButton            maBtnOk;
135cdf0e10cSrcweir     CancelButton        maBtnCancel;
136cdf0e10cSrcweir     HelpButton          maBtnHelp;
137cdf0e10cSrcweir     PushButton          maBtnRemove;
138cdf0e10cSrcweir     PushButton          maBtnOptions;
139cdf0e10cSrcweir     MoreButton          maBtnMore;
140cdf0e10cSrcweir 
141cdf0e10cSrcweir     ::std::vector< String > maFuncNames;    /// Localized function names from resource.
142cdf0e10cSrcweir 
143cdf0e10cSrcweir     ScDPObjectPtr       mxDlgDPObject;      /// Clone of the pivot table object this dialog is based on.
144cdf0e10cSrcweir     ScPivotParam        maPivotData;        /// The pivot table field configuration.
145cdf0e10cSrcweir     ScDPLabelDataVector maLabelData;        /// Information about all dimensions.
146cdf0e10cSrcweir 
147cdf0e10cSrcweir     ScViewData*         mpViewData;
148cdf0e10cSrcweir     ScDocument*         mpDoc;
149cdf0e10cSrcweir     ScPivotFieldWindow* mpFocusWindow;      /// Pointer to the field window that currently has the focus.
150cdf0e10cSrcweir     ScPivotFieldWindow* mpTrackingWindow;   /// Pointer to the field window that has started mouse tracking.
151cdf0e10cSrcweir     ScPivotFieldWindow* mpDropWindow;       /// Pointer to the field window that shows an insertion cursor.
152cdf0e10cSrcweir     ::formula::RefEdit* mpActiveEdit;
153cdf0e10cSrcweir     bool                mbRefInputMode;
154cdf0e10cSrcweir };
155cdf0e10cSrcweir 
156cdf0e10cSrcweir // ============================================================================
157cdf0e10cSrcweir 
158cdf0e10cSrcweir #endif
159