summaryrefslogtreecommitdiff
path: root/sc/source/ui/inc/pvlaydlg.hxx
blob: d6f12e8c5d49e58eb56ed4a6847259656aca9104 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/

#ifndef SC_PVLAYDLG_HXX
#define SC_PVLAYDLG_HXX

#include <memory>
#include <vector>

#include <formula/funcutl.hxx>
#include <svtools/stdctrl.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/morebtn.hxx>
#include <vcl/scrbar.hxx>

#include "anyrefdg.hxx"
#include "fieldwnd.hxx"

// ============================================================================

class ScViewData;
class ScDocument;
class ScRangeData;
class ScDPObject;

// ============================================================================

class ScPivotLayoutDlg : public ScAnyRefDlg
{
public:
                        ScPivotLayoutDlg(
                            SfxBindings* pB,
                            SfxChildWindow* pCW,
                            Window* pParent,
                            const ScDPObject& rDPObject );
    virtual             ~ScPivotLayoutDlg();

    ScDPLabelData*      GetLabelData( SCCOL nCol, size_t* pnIndex = 0 );
    String              GetFuncString( sal_uInt16& rnFuncMask, bool bIsValue = true );

    void                NotifyStartTracking( ScPivotFieldWindow& rSourceWindow );
    void                NotifyDoubleClick( ScPivotFieldWindow& rSourceWindow );
    void                NotifyFieldRemoved( ScPivotFieldWindow& rSourceWindow );

protected:
    virtual void        Tracking( const TrackingEvent& rTEvt );
    virtual void        SetReference( const ScRange& rRef, ScDocument* pDoc );
    virtual sal_Bool    IsRefInputMode() const;
    virtual void        SetActive();
    virtual sal_Bool    Close();

private:
    /** Returns the localized function name for the specified (1-based) resource index. */
    inline const String& GetFuncName( sal_uInt16 nFuncIdx ) const { return maFuncNames[ nFuncIdx - 1 ]; }
    /** Returns the specified field window. */
    ScPivotFieldWindow& GetFieldWindow( ScPivotFieldType eFieldType );

    /** Fills the field windows from the current pivot table settings. */
    void                InitFieldWindows();
    /** Sets focus to the specified field window, if it is not empty. */
    void                GrabFieldFocus( ScPivotFieldWindow& rFieldWindow );

    /** Returns true, if the specified field can be inserted into the specified field window. */
    bool                IsInsertAllowed( const ScPivotFieldWindow& rSourceWindow, const ScPivotFieldWindow& rTargetWindow );
    /** Moves the selected field in the source window to the specified window. */
    bool                MoveField( ScPivotFieldWindow& rSourceWindow, ScPivotFieldWindow& rTargetWindow, size_t nInsertIndex, bool bMoveExisting );

    // Handler
    DECL_LINK( ClickHdl, PushButton * );
    DECL_LINK( OkHdl, OKButton * );
    DECL_LINK( CancelHdl, CancelButton * );
    DECL_LINK( MoreClickHdl, MoreButton * );
    DECL_LINK( EdOutModifyHdl, Edit * );
    DECL_LINK( EdInModifyHdl, Edit * );
    DECL_LINK( SelAreaHdl, ListBox * );
    DECL_LINK( ChildEventListener, VclWindowEvent* );

private:
    typedef ::std::auto_ptr< ScDPObject > ScDPObjectPtr;

    FixedLine           maFlLayout;
    ScrollBar           maScrPage;
    FixedText           maFtPage;
    ScPivotFieldWindow  maWndPage;
    ScrollBar           maScrCol;
    FixedText           maFtCol;
    ScPivotFieldWindow  maWndCol;
    ScrollBar           maScrRow;
    FixedText           maFtRow;
    ScPivotFieldWindow  maWndRow;
    ScrollBar           maScrData;
    FixedText           maFtData;
    ScPivotFieldWindow  maWndData;
    FixedLine           maFlSelect;
    ScrollBar           maScrSelect;
    ScPivotFieldWindow  maWndSelect;
    FixedInfo           maFtInfo;

    FixedLine           maFlAreas;
    FixedText           maFtInArea;
    ::formula::RefEdit  maEdInPos;
    ::formula::RefButton maRbInPos;
    ListBox             maLbOutPos;
    FixedText           maFtOutArea;
    formula::RefEdit    maEdOutPos;
    formula::RefButton  maRbOutPos;
    CheckBox            maBtnIgnEmptyRows;
    CheckBox            maBtnDetectCat;
    CheckBox            maBtnTotalCol;
    CheckBox            maBtnTotalRow;
    CheckBox            maBtnFilter;
    CheckBox            maBtnDrillDown;

    OKButton            maBtnOk;
    CancelButton        maBtnCancel;
    HelpButton          maBtnHelp;
    PushButton          maBtnRemove;
    PushButton          maBtnOptions;
    MoreButton          maBtnMore;

    ::std::vector< String > maFuncNames;    /// Localized function names from resource.

    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.

    ScViewData*         mpViewData;
    ScDocument*         mpDoc;
    ScPivotFieldWindow* mpFocusWindow;      /// Pointer to the field window that currently has the focus.
    ScPivotFieldWindow* mpTrackingWindow;   /// Pointer to the field window that has started mouse tracking.
    ScPivotFieldWindow* mpDropWindow;       /// Pointer to the field window that shows an insertion cursor.
    ::formula::RefEdit* mpActiveEdit;
    bool                mbRefInputMode;
};

// ============================================================================

#endif