Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : */
10 :
11 : #ifndef INCLUDED_SC_SOURCE_UI_INC_PIVOTLAYOUTDIALOG_HXX
12 : #define INCLUDED_SC_SOURCE_UI_INC_PIVOTLAYOUTDIALOG_HXX
13 :
14 : #include <boost/ptr_container/ptr_vector.hpp>
15 :
16 : #include <svx/checklbx.hxx>
17 : #include <vcl/lstbox.hxx>
18 : #include "anyrefdg.hxx"
19 : #include "dpobject.hxx"
20 : #include "dpsave.hxx"
21 : #include "dpshttab.hxx"
22 : #include "document.hxx"
23 : #include "viewdata.hxx"
24 :
25 : #include "PivotLayoutTreeList.hxx"
26 : #include "PivotLayoutTreeListData.hxx"
27 : #include "PivotLayoutTreeListLabel.hxx"
28 :
29 : class ScItemValue
30 : {
31 : public:
32 : OUString maName;
33 : ScPivotFuncData maFunctionData;
34 : ScItemValue* mpOriginalItemValue;
35 :
36 : ScItemValue(OUString const & aName, SCCOL nColumn, sal_uInt16 nFunctionMask);
37 : ScItemValue(ScItemValue* pInputItemValue);
38 :
39 : virtual ~ScItemValue();
40 : };
41 :
42 : class ScPivotLayoutDialog : public ScAnyRefDlg
43 : {
44 : public:
45 : ScDPObject maPivotTableObject;
46 :
47 : VclPtr<ScPivotLayoutTreeListBase> mpPreviouslyFocusedListBox;
48 : VclPtr<ScPivotLayoutTreeListBase> mpCurrentlyFocusedListBox;
49 :
50 : private:
51 : ScViewData* mpViewData;
52 : ScDocument* mpDocument;
53 :
54 : bool mbNewPivotTable;
55 :
56 : VclPtr<ScPivotLayoutTreeListLabel> mpListBoxField;
57 : VclPtr<ScPivotLayoutTreeList> mpListBoxPage;
58 : VclPtr<ScPivotLayoutTreeList> mpListBoxColumn;
59 : VclPtr<ScPivotLayoutTreeList> mpListBoxRow;
60 : VclPtr<ScPivotLayoutTreeListData> mpListBoxData;
61 :
62 : VclPtr<CheckBox> mpCheckIgnoreEmptyRows;
63 : VclPtr<CheckBox> mpCheckTotalColumns;
64 : VclPtr<CheckBox> mpCheckAddFilter;
65 : VclPtr<CheckBox> mpCheckIdentifyCategories;
66 : VclPtr<CheckBox> mpCheckTotalRows;
67 : VclPtr<CheckBox> mpCheckDrillToDetail;
68 :
69 : VclPtr<RadioButton> mpSourceRadioNamedRange;
70 : VclPtr<RadioButton> mpSourceRadioSelection;
71 :
72 : VclPtr<ListBox> mpSourceListBox;
73 : VclPtr<formula::RefEdit> mpSourceEdit;
74 : VclPtr<formula::RefButton> mpSourceButton;
75 :
76 : VclPtr<RadioButton> mpDestinationRadioNewSheet;
77 : VclPtr<RadioButton> mpDestinationRadioNamedRange;
78 : VclPtr<RadioButton> mpDestinationRadioSelection;
79 :
80 : VclPtr<ListBox> mpDestinationListBox;
81 : VclPtr<formula::RefEdit> mpDestinationEdit;
82 : VclPtr<formula::RefButton> mpDestinationButton;
83 :
84 : VclPtr<PushButton> mpBtnOK;
85 : VclPtr<CancelButton> mpBtnCancel;
86 :
87 : VclPtr<formula::RefEdit> mpActiveEdit;
88 : ScAddress::Details maAddressDetails;
89 : bool mbDialogLostFocus;
90 :
91 : DECL_LINK(CancelClicked, PushButton*);
92 : DECL_LINK(OKClicked, PushButton*);
93 : DECL_LINK(GetFocusHandler, Control*);
94 : DECL_LINK(LoseFocusHandler, void*);
95 : DECL_LINK(ToggleSource, void*);
96 : DECL_LINK(ToggleDestination, void*);
97 : DECL_LINK(SourceEditModified, void*);
98 : virtual bool Close() SAL_OVERRIDE;
99 :
100 : ScPivotParam maPivotParameters;
101 :
102 : // UI
103 : void SetupSource();
104 : void SetupDestination();
105 : void FillValuesToListBoxes();
106 :
107 : // Other
108 : bool GetDestination(ScRange& aDestinationRange, bool& bToNewSheet);
109 :
110 : public:
111 : ScPivotLayoutDialog(SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, vcl::Window* pParent,
112 : ScViewData* pViewData, const ScDPObject* pPivotTableObject, bool bCreateNewPivotTable);
113 : virtual ~ScPivotLayoutDialog();
114 : virtual void dispose() SAL_OVERRIDE;
115 :
116 : virtual void SetReference(const ScRange& rReferenceRange, ScDocument* pDocument) SAL_OVERRIDE;
117 : virtual void SetActive() SAL_OVERRIDE;
118 : virtual bool IsRefInputMode() const SAL_OVERRIDE;
119 :
120 : void ItemInserted(ScItemValue* pItemValue, ScPivotLayoutTreeList::SvPivotTreeListType eType);
121 :
122 : void UpdateSourceRange();
123 :
124 : bool ApplyChanges();
125 : void ApplySaveData(ScDPSaveData& rSaveData);
126 : void ApplyLabelData(ScDPSaveData& rSaveData);
127 :
128 : ScItemValue* GetItem(SCCOL nColumn);
129 : bool IsDataElement(SCCOL nColumn);
130 :
131 : ScDPLabelData* GetLabelData(SCCOL nColumn);
132 0 : ScDPLabelDataVector& GetLabelDataVector() { return maPivotParameters.maLabelArray;}
133 : void PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames);
134 : };
135 :
136 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
137 :
138 : #endif
|