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 : ScPivotLayoutTreeListBase* mpPreviouslyFocusedListBox;
48 : ScPivotLayoutTreeListBase* mpCurrentlyFocusedListBox;
49 :
50 : private:
51 : ScViewData* mpViewData;
52 : ScDocument* mpDocument;
53 :
54 : bool mbNewPivotTable;
55 :
56 : ScPivotLayoutTreeListLabel* mpListBoxField;
57 : ScPivotLayoutTreeList* mpListBoxPage;
58 : ScPivotLayoutTreeList* mpListBoxColumn;
59 : ScPivotLayoutTreeList* mpListBoxRow;
60 : ScPivotLayoutTreeListData* mpListBoxData;
61 :
62 : CheckBox* mpCheckIgnoreEmptyRows;
63 : CheckBox* mpCheckTotalColumns;
64 : CheckBox* mpCheckAddFilter;
65 : CheckBox* mpCheckIdentifyCategories;
66 : CheckBox* mpCheckTotalRows;
67 : CheckBox* mpCheckDrillToDetail;
68 :
69 : RadioButton* mpSourceRadioNamedRange;
70 : RadioButton* mpSourceRadioSelection;
71 :
72 : ListBox* mpSourceListBox;
73 : formula::RefEdit* mpSourceEdit;
74 : formula::RefButton* mpSourceButton;
75 :
76 : RadioButton* mpDestinationRadioNewSheet;
77 : RadioButton* mpDestinationRadioNamedRange;
78 : RadioButton* mpDestinationRadioSelection;
79 :
80 : ListBox* mpDestinationListBox;
81 : formula::RefEdit* mpDestinationEdit;
82 : formula::RefButton* mpDestinationButton;
83 :
84 : PushButton* mpBtnOK;
85 : CancelButton* mpBtnCancel;
86 :
87 : 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 :
99 : ScPivotParam maPivotParameters;
100 :
101 : // UI
102 : void SetupSource();
103 : void SetupDestination();
104 : void FillValuesToListBoxes();
105 :
106 : // Other
107 : bool GetDestination(ScRange& aDestinationRange, bool& bToNewSheet);
108 :
109 : public:
110 : ScPivotLayoutDialog(SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, vcl::Window* pParent,
111 : ScViewData* pViewData, const ScDPObject* pPivotTableObject, bool bCreateNewPivotTable);
112 : virtual ~ScPivotLayoutDialog();
113 :
114 : virtual void SetReference(const ScRange& rReferenceRange, ScDocument* pDocument) SAL_OVERRIDE;
115 : virtual void SetActive() SAL_OVERRIDE;
116 : virtual bool IsRefInputMode() const SAL_OVERRIDE;
117 :
118 : void ItemInserted(ScItemValue* pItemValue, ScPivotLayoutTreeList::SvPivotTreeListType eType);
119 :
120 : void UpdateSourceRange();
121 :
122 : bool ApplyChanges();
123 : void ApplySaveData(ScDPSaveData& rSaveData);
124 : void ApplyLabelData(ScDPSaveData& rSaveData);
125 :
126 : ScItemValue* GetItem(SCCOL nColumn);
127 : bool IsDataElement(SCCOL nColumn);
128 :
129 : ScDPLabelData* GetLabelData(SCCOL nColumn);
130 0 : ScDPLabelDataVector& GetLabelDataVector() { return maPivotParameters.maLabelArray;}
131 : void PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames);
132 : };
133 :
134 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
135 :
136 : #endif
|