summaryrefslogtreecommitdiff
path: root/sc/source/ui/inc
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-03-30 21:12:27 +0200
committerTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-03-31 09:44:44 +0200
commit4f1f8b8e993b98095bf50c9e432fb0400d318b1f (patch)
tree8d24af3abd975baa0924fe28a4dca9f0dfb0c638 /sc/source/ui/inc
parent4b83eb0a08934922cc7aad0b259706b5c5dfadde (diff)
pivot: new pivot table layout dialog
This commit adds a new pivot table layout dialog which was implemented from scratch. Instead of custom controls this one uses list boxes for field entries which greatly reduces the code. It also fixes some visual and behaviour bugs and adds the possibility to edit the "Data" field. Change-Id: I6c01252acee5a2e8910e40e65904504d00e03057
Diffstat (limited to 'sc/source/ui/inc')
-rw-r--r--sc/source/ui/inc/PivotLayoutDialog.hxx136
-rw-r--r--sc/source/ui/inc/PivotLayoutTreeList.hxx36
-rw-r--r--sc/source/ui/inc/PivotLayoutTreeListBase.hxx76
-rw-r--r--sc/source/ui/inc/PivotLayoutTreeListData.hxx37
-rw-r--r--sc/source/ui/inc/PivotLayoutTreeListLabel.hxx37
5 files changed, 322 insertions, 0 deletions
diff --git a/sc/source/ui/inc/PivotLayoutDialog.hxx b/sc/source/ui/inc/PivotLayoutDialog.hxx
new file mode 100644
index 000000000000..b3eaa14b6979
--- /dev/null
+++ b/sc/source/ui/inc/PivotLayoutDialog.hxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef PIVOTLAYOUTDIALOG_HXX
+#define PIVOTLAYOUTDIALOG_HXX
+
+#include <boost/ptr_container/ptr_vector.hpp>
+
+#include <svx/checklbx.hxx>
+#include <vcl/lstbox.hxx>
+#include "anyrefdg.hxx"
+#include "dpobject.hxx"
+#include "dpsave.hxx"
+#include "dpshttab.hxx"
+#include "document.hxx"
+#include "viewdata.hxx"
+
+#include "PivotLayoutTreeList.hxx"
+#include "PivotLayoutTreeListData.hxx"
+#include "PivotLayoutTreeListLabel.hxx"
+
+class ScItemValue
+{
+public:
+ OUString maName;
+ ScPivotFuncData maFunctionData;
+ ScItemValue* mpOriginalItemValue;
+
+ ScItemValue(OUString aName, SCCOL nColumn, sal_uInt16 nFunctionMask);
+ ScItemValue(ScItemValue* pInputItemValue);
+
+ virtual ~ScItemValue();
+};
+
+class ScPivotLayoutDialog : public ScAnyRefDlg
+{
+public:
+ ScDPObject maPivotTableObject;
+
+ ScPivotLayoutTreeListBase* mpPreviouslyFocusedListBox;
+ ScPivotLayoutTreeListBase* mpCurrentlyFocusedListBox;
+
+private:
+ ScViewData* mpViewData;
+ ScDocument* mpDocument;
+
+ bool mbNewPivotTable;
+
+ ScPivotLayoutTreeListLabel* mpListBoxField;
+ ScPivotLayoutTreeList* mpListBoxPage;
+ ScPivotLayoutTreeList* mpListBoxColumn;
+ ScPivotLayoutTreeList* mpListBoxRow;
+ ScPivotLayoutTreeListData* mpListBoxData;
+
+ CheckBox* mpCheckIgnoreEmptyRows;
+ CheckBox* mpCheckTotalColumns;
+ CheckBox* mpCheckAddFilter;
+ CheckBox* mpCheckIdentifyCategories;
+ CheckBox* mpCheckTotalRows;
+ CheckBox* mpCheckDrillToDetail;
+
+ RadioButton* mpSourceRadioNamedRange;
+ RadioButton* mpSourceRadioSelection;
+
+ ListBox* mpSourceListBox;
+ formula::RefEdit* mpSourceEdit;
+ formula::RefButton* mpSourceButton;
+
+ RadioButton* mpDestinationRadioNewSheet;
+ RadioButton* mpDestinationRadioNamedRange;
+ RadioButton* mpDestinationRadioSelection;
+
+ ListBox* mpDestinationListBox;
+ formula::RefEdit* mpDestinationEdit;
+ formula::RefButton* mpDestinationButton;
+
+ PushButton* mpButtonApply;
+ OKButton* mpButtonOk;
+ CloseButton* mpButtonClose;
+
+ formula::RefEdit* mpActiveEdit;
+ ScAddress::Details maAddressDetails;
+ bool mbDialogLostFocus;
+
+ DECL_LINK(OkClicked, PushButton*);
+ DECL_LINK(CloseClicked, PushButton*);
+ DECL_LINK(ApplyClicked, PushButton*);
+ DECL_LINK(GetFocusHandler, Control*);
+ DECL_LINK(LoseFocusHandler, void*);
+ DECL_LINK(ToggleSource, void*);
+ DECL_LINK(ToggleDestination, void*);
+ DECL_LINK(SourceEditModified, void*);
+
+ ScPivotParam maPivotParameters;
+
+ // UI
+ void SetupSource();
+ void SetupDestination();
+ void FillValuesToListBoxes();
+
+ // Other
+ bool GetDestination(ScRange& aDestinationRange, bool& bToNewSheet);
+
+public:
+ ScPivotLayoutDialog(SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, Window* pParent,
+ ScViewData* pViewData, const ScDPObject* pPivotTableObject, bool bCreateNewPivotTable);
+ virtual ~ScPivotLayoutDialog() SAL_OVERRIDE;
+
+ virtual void SetReference(const ScRange& rReferenceRange, ScDocument* pDocument) SAL_OVERRIDE;
+ virtual void SetActive() SAL_OVERRIDE;
+ virtual bool IsRefInputMode() const SAL_OVERRIDE;
+
+ void ItemInserted(ScItemValue* pItemValue, ScPivotLayoutTreeList::SvPivotTreeListType eType);
+
+ void UpdateSourceRange();
+
+ bool ApplyChanges();
+
+ ScItemValue* GetItem(SCCOL nColumn);
+ bool IsDataItem(SCCOL nColumn);
+
+ ScDPLabelData* GetLabelData(SCCOL nColumn);
+ ScDPLabelDataVector& GetLabelDataVector();
+};
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
+#endif
diff --git a/sc/source/ui/inc/PivotLayoutTreeList.hxx b/sc/source/ui/inc/PivotLayoutTreeList.hxx
new file mode 100644
index 000000000000..00caefe58e4b
--- /dev/null
+++ b/sc/source/ui/inc/PivotLayoutTreeList.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef PIVOTLAYOUTTREELIST_HXX
+#define PIVOTLAYOUTTREELIST_HXX
+
+#include "PivotLayoutTreeListBase.hxx"
+#include <boost/ptr_container/ptr_vector.hpp>
+
+class ScPivotLayoutTreeList : public ScPivotLayoutTreeListBase
+{
+public:
+ ScPivotLayoutTreeList(Window* pParent, WinBits nBits);
+ virtual ~ScPivotLayoutTreeList() SAL_OVERRIDE;
+ virtual bool DoubleClickHdl() SAL_OVERRIDE;
+
+ void Setup(ScPivotLayoutDialog* pParent, SvPivotTreeListType eType);
+ void FillFields(ScPivotFieldVector& rFieldVector);
+
+protected:
+ virtual void InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* pTarget) SAL_OVERRIDE;
+ virtual void InsertEntryForItem(ScItemValue* pItemValue, sal_uLong nPosition) SAL_OVERRIDE;
+
+ virtual void KeyInput(const KeyEvent& rKeyEvent) SAL_OVERRIDE;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
+#endif
diff --git a/sc/source/ui/inc/PivotLayoutTreeListBase.hxx b/sc/source/ui/inc/PivotLayoutTreeListBase.hxx
new file mode 100644
index 000000000000..b44303f747e1
--- /dev/null
+++ b/sc/source/ui/inc/PivotLayoutTreeListBase.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef PIVOTLAYOUTTREELISTBASE_HXX
+#define PIVOTLAYOUTTREELISTBASE_HXX
+
+#include <svtools/treelistbox.hxx>
+
+#include <boost/ptr_container/ptr_vector.hpp>
+#include <vcl/builder.hxx>
+
+#include "pivot.hxx"
+
+class ScPivotLayoutDialog;
+class ScItemValue;
+
+class ScPivotLayoutTreeListBase : public SvTreeListBox
+{
+public:
+ enum SvPivotTreeListType
+ {
+ UNDEFINED,
+ LABEL_LIST,
+ PAGE_LIST,
+ ROW_LIST,
+ COLUMN_LIST,
+ DATA_LIST
+ };
+private:
+ bool mbIsInternalDrag;
+
+protected:
+ SvPivotTreeListType meType;
+ ScPivotLayoutDialog* mpParent;
+
+public:
+ void Setup(ScPivotLayoutDialog* pParent);
+
+ ScPivotLayoutTreeListBase(Window* pParent, WinBits nBits, SvPivotTreeListType eType = UNDEFINED);
+ virtual ~ScPivotLayoutTreeListBase() SAL_OVERRIDE;
+
+ virtual sal_Int8 AcceptDrop(const AcceptDropEvent& rEvent) SAL_OVERRIDE;
+ virtual bool NotifyAcceptDrop(SvTreeListEntry* pEntry) SAL_OVERRIDE;
+ virtual sal_Bool NotifyMoving(SvTreeListEntry* pTarget, SvTreeListEntry* pSource,
+ SvTreeListEntry*& rpNewParent, sal_uLong& rNewChildPos) SAL_OVERRIDE;
+ virtual sal_Bool NotifyCopying(SvTreeListEntry* pTarget, SvTreeListEntry* pSource,
+ SvTreeListEntry*& rpNewParent, sal_uLong& rNewChildPos) SAL_OVERRIDE;
+ virtual DragDropMode NotifyStartDrag(TransferDataContainer& aTransferDataContainer,
+ SvTreeListEntry* pEntry) SAL_OVERRIDE;
+ virtual void DragFinished(sal_Int8 nDropAction) SAL_OVERRIDE;
+
+ virtual void GetFocus() SAL_OVERRIDE;
+ virtual void LoseFocus() SAL_OVERRIDE;
+
+ void PushEntriesToPivotFieldVector(ScPivotFieldVector& rVector);
+
+ void RemoveEntryForItem(ScItemValue* pItemValue);
+
+ virtual bool HasEntry(SvTreeListEntry* pEntry);
+
+protected:
+ virtual void InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* pTarget);
+
+ virtual void InsertEntryForItem(ScItemValue* pItemValue, sal_uLong nPosition);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
+#endif
diff --git a/sc/source/ui/inc/PivotLayoutTreeListData.hxx b/sc/source/ui/inc/PivotLayoutTreeListData.hxx
new file mode 100644
index 000000000000..d6a99535128a
--- /dev/null
+++ b/sc/source/ui/inc/PivotLayoutTreeListData.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef PIVOTLAYOUTTREELISTDATA_HXX
+#define PIVOTLAYOUTTREELISTDATA_HXX
+
+#include "PivotLayoutTreeListBase.hxx"
+#include <boost/ptr_container/ptr_vector.hpp>
+
+class ScPivotLayoutTreeListData : public ScPivotLayoutTreeListBase
+{
+private:
+ boost::ptr_vector<ScItemValue> maDataItemValues;
+
+public:
+ ScPivotLayoutTreeListData(Window* pParent, WinBits nBits);
+ virtual ~ScPivotLayoutTreeListData() SAL_OVERRIDE;
+ virtual bool DoubleClickHdl() SAL_OVERRIDE;
+
+ void FillDataField(ScPivotFieldVector& rDataFields);
+protected:
+ virtual void InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* pTarget) SAL_OVERRIDE;
+ virtual void InsertEntryForItem(ScItemValue* pItemValue, sal_uLong nPosition) SAL_OVERRIDE;
+
+ virtual void KeyInput(const KeyEvent& rKeyEvent) SAL_OVERRIDE;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
+#endif
diff --git a/sc/source/ui/inc/PivotLayoutTreeListLabel.hxx b/sc/source/ui/inc/PivotLayoutTreeListLabel.hxx
new file mode 100644
index 000000000000..6a13906d4a5e
--- /dev/null
+++ b/sc/source/ui/inc/PivotLayoutTreeListLabel.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef PIVOTLAYOUTTREELISTLABEL_HXX
+#define PIVOTLAYOUTTREELISTLABEL_HXX
+
+#include "PivotLayoutTreeListBase.hxx"
+#include <boost/ptr_container/ptr_vector.hpp>
+
+class ScPivotLayoutTreeListLabel : public ScPivotLayoutTreeListBase
+{
+private:
+ boost::ptr_vector<ScItemValue> maItemValues;
+ SCCOL maDataItem;
+
+public:
+ ScPivotLayoutTreeListLabel(Window* pParent, WinBits nBits);
+ virtual ~ScPivotLayoutTreeListLabel() SAL_OVERRIDE;
+ void FillLabelFields(ScDPLabelDataVector& rLabelVector);
+ ScItemValue* GetItem(SCCOL nColumn);
+ bool IsDataItem(SCCOL nColumn);
+
+protected:
+ virtual void InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* pTarget) SAL_OVERRIDE;
+ virtual void KeyInput(const KeyEvent& rKeyEvent) SAL_OVERRIDE;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
+#endif