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