Kaydet (Commit) 4f1f8b8e authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

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
üst 4b83eb0a
......@@ -523,6 +523,15 @@
<glade-widget-class title="Glossary Tree List" name="swuilo-SwGlTreeListBox"
generic-name="Glossary Tree List" parent="GtkTreeView"
icon-name="widget-gtk-treeview"/>
<glade-widget-class title="Pivot Table List" name="scuilo-ScPivotLayoutTreeList"
generic-name="Pivot Table List" parent="GtkTreeView"
icon-name="widget-gtk-treeview"/>
<glade-widget-class title="Pivot Table Label List" name="scuilo-ScPivotLayoutTreeListLabel"
generic-name="Pivot Table Label List" parent="GtkTreeView"
icon-name="widget-gtk-treeview"/>
<glade-widget-class title="Pivot Table Data List" name="scuilo-ScPivotLayoutTreeListData"
generic-name="Pivot Table Data List" parent="GtkTreeView"
icon-name="widget-gtk-treeview"/>
<glade-widget-class title="Dial Control" name="svxlo-DialControl"
generic-name="Dial Control" parent="GtkSpinner"
icon-name="widget-gtk-spinner"/>
......
......@@ -397,6 +397,11 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/dbgui/imoptdlg \
$(if $(filter TRUE,$(MPL_SUBSET)),, \
sc/source/ui/dbgui/pvlaydlg) \
sc/source/ui/dbgui/PivotLayoutDialog \
sc/source/ui/dbgui/PivotLayoutTreeListBase \
sc/source/ui/dbgui/PivotLayoutTreeListData \
sc/source/ui/dbgui/PivotLayoutTreeListLabel \
sc/source/ui/dbgui/PivotLayoutTreeList \
sc/source/ui/dbgui/sfiltdlg \
sc/source/ui/dialogs/searchresults \
sc/source/ui/docshell/arealink \
......
......@@ -129,6 +129,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/pivotfielddialog \
sc/uiconfig/scalc/ui/pivotfilterdialog \
sc/uiconfig/scalc/ui/pivottablelayout \
sc/uiconfig/scalc/ui/pivottablelayoutdialog \
sc/uiconfig/scalc/ui/printareasdialog \
sc/uiconfig/scalc/ui/printeroptions \
sc/uiconfig/scalc/ui/protectsheetdlg \
......
This diff is collapsed.
/* -*- 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/.
*
* This file incorporates work covered by the following license notice:
*/
#include "PivotLayoutTreeList.hxx"
#include "PivotLayoutDialog.hxx"
#include <svtools/treelistentry.hxx>
#include "pivot.hxx"
#include "scabstdlg.hxx"
using namespace std;
extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeScPivotLayoutTreeList(Window *pParent, VclBuilder::stringmap& )
{
return new ScPivotLayoutTreeList(pParent, WB_BORDER | WB_TABSTOP | WB_CLIPCHILDREN | WB_FORCE_MAKEVISIBLE);
}
ScPivotLayoutTreeList::ScPivotLayoutTreeList(Window* pParent, WinBits nBits) :
ScPivotLayoutTreeListBase(pParent, nBits)
{}
ScPivotLayoutTreeList::~ScPivotLayoutTreeList()
{}
void ScPivotLayoutTreeList::Setup(ScPivotLayoutDialog* pParent, SvPivotTreeListType eType)
{
mpParent = pParent;
meType = eType;
}
bool ScPivotLayoutTreeList::DoubleClickHdl()
{
ScItemValue* pCurrentItemValue = (ScItemValue*) GetCurEntry()->GetUserData();
ScPivotFuncData& rCurrentFunctionData = pCurrentItemValue->maFunctionData;
SCCOL nCurrentColumn = rCurrentFunctionData.mnCol;
ScDPLabelData* pCurrentLabelData = mpParent->GetLabelData(nCurrentColumn);
if (!pCurrentLabelData)
return false;
ScAbstractDialogFactory* pFactory = ScAbstractDialogFactory::Create();
vector<ScDPName> aDataFieldNames;
SvTreeListEntry* pLoopEntry;
for (pLoopEntry = First(); pLoopEntry != NULL; pLoopEntry = Next(pLoopEntry))
{
ScItemValue* pEachItemValue = (ScItemValue*) pLoopEntry->GetUserData();
SCCOL nColumn = pEachItemValue->maFunctionData.mnCol;
ScDPLabelData* pDFData = mpParent->GetLabelData(nColumn);
if (pDFData == NULL && pDFData->maName.isEmpty())
continue;
aDataFieldNames.push_back(ScDPName(pDFData->maName, pDFData->maLayoutName, pDFData->mnDupCount));
}
boost::scoped_ptr<AbstractScDPSubtotalDlg> pDialog(
pFactory->CreateScDPSubtotalDlg(this, mpParent->maPivotTableObject, *pCurrentLabelData, rCurrentFunctionData, aDataFieldNames, true));
if (pDialog->Execute() == RET_OK)
{
pDialog->FillLabelData(*pCurrentLabelData);
rCurrentFunctionData.mnFuncMask = pCurrentLabelData->mnFuncMask;
}
return true;
}
void ScPivotLayoutTreeList::FillFields(ScPivotFieldVector& rFieldVector)
{
Clear();
ScPivotFieldVector::iterator it;
for (it = rFieldVector.begin(); it != rFieldVector.end(); ++it)
{
ScPivotField& rField = *it;
ScItemValue* pItemValue = mpParent->GetItem(rField.nCol);
InsertEntry(pItemValue->maName, NULL, sal_False, TREELIST_APPEND, pItemValue);
}
}
void ScPivotLayoutTreeList::InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* pTarget)
{
ScItemValue* pItemValue = (ScItemValue*) pSource->GetUserData();
ScItemValue* pOriginalItemValue = pItemValue->mpOriginalItemValue;
// Don't allow to add "Data" element to page fields
if(meType == PAGE_LIST && mpParent->IsDataItem(pItemValue->maFunctionData.mnCol))
return;
mpParent->ItemInserted(pOriginalItemValue, meType);
sal_uLong nPosition = (pTarget == NULL) ? TREELIST_APPEND : GetModel()->GetAbsPos(pTarget) + 1;
InsertEntryForItem(pOriginalItemValue, nPosition);
}
void ScPivotLayoutTreeList::InsertEntryForItem(ScItemValue* pItemValue, sal_uLong nPosition)
{
OUString rName = pItemValue->maName;
InsertEntry(rName, NULL, sal_False, nPosition, pItemValue);
}
void ScPivotLayoutTreeList::KeyInput(const KeyEvent& rKeyEvent)
{
KeyCode aCode = rKeyEvent.GetKeyCode();
sal_uInt16 nCode = aCode.GetCode();
switch (nCode)
{
case KEY_DELETE:
GetModel()->Remove(GetCurEntry());
return;
}
SvTreeListBox::KeyInput(rKeyEvent);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*
* This file incorporates work covered by the following license notice:
*/
#include "PivotLayoutTreeListBase.hxx"
#include "PivotLayoutDialog.hxx"
#include <reffact.hxx>
#include <svtools/treelistentry.hxx>
#include "scabstdlg.hxx"
using namespace std;
ScPivotLayoutTreeListBase::ScPivotLayoutTreeListBase(Window* pParent, WinBits nBits, SvPivotTreeListType eType) :
SvTreeListBox(pParent, nBits),
meType(eType)
{
SetHighlightRange();
SetDragDropMode(SV_DRAGDROP_CTRL_MOVE | SV_DRAGDROP_APP_MOVE | SV_DRAGDROP_APP_DROP);
}
ScPivotLayoutTreeListBase::~ScPivotLayoutTreeListBase()
{}
void ScPivotLayoutTreeListBase::Setup(ScPivotLayoutDialog* pParent)
{
mpParent = pParent;
}
DragDropMode ScPivotLayoutTreeListBase::NotifyStartDrag(TransferDataContainer& /*aTransferDataContainer*/,
SvTreeListEntry* /*pEntry*/ )
{
return GetDragDropMode();
}
void ScPivotLayoutTreeListBase::DragFinished(sal_Int8 /*nDropAction*/)
{}
sal_Int8 ScPivotLayoutTreeListBase::AcceptDrop(const AcceptDropEvent& rEvent)
{
return SvTreeListBox::AcceptDrop(rEvent);
}
bool ScPivotLayoutTreeListBase::NotifyAcceptDrop(SvTreeListEntry* /*pEntry*/)
{
return true;
}
sal_Bool ScPivotLayoutTreeListBase::NotifyMoving(SvTreeListEntry* pTarget, SvTreeListEntry* pSource,
SvTreeListEntry*& /*rpNewParent*/, sal_uLong& /*rNewChildPos*/)
{
InsertEntryForSourceTarget(pSource, pTarget);
return sal_False;
}
sal_Bool ScPivotLayoutTreeListBase::NotifyCopying(SvTreeListEntry* /*pTarget*/, SvTreeListEntry* /*pSource*/,
SvTreeListEntry*& /*rpNewParent*/, sal_uLong& /*rNewChildPos*/)
{
return sal_False;
}
bool ScPivotLayoutTreeListBase::HasEntry(SvTreeListEntry* pEntry)
{
SvTreeListEntry* pEachEntry;
for (pEachEntry = First(); pEachEntry != NULL; pEachEntry = Next(pEachEntry))
{
if(pEachEntry == pEntry)
return true;
}
return false;
}
void ScPivotLayoutTreeListBase::PushEntriesToPivotFieldVector(ScPivotFieldVector& rVector)
{
SvTreeListEntry* pEachEntry;
for (pEachEntry = First(); pEachEntry != NULL; pEachEntry = Next(pEachEntry))
{
ScItemValue* pItemValue = (ScItemValue*) pEachEntry->GetUserData();
ScPivotFuncData& rFunctionData = pItemValue->maFunctionData;
ScPivotField aField;
aField.nCol = rFunctionData.mnCol;
aField.mnOriginalDim = rFunctionData.mnOriginalDim;
if (rFunctionData.mnFuncMask == PIVOT_FUNC_NONE ||
rFunctionData.mnFuncMask == PIVOT_FUNC_AUTO)
{
aField.nFuncMask = PIVOT_FUNC_SUM;
}
else
{
aField.nFuncMask = rFunctionData.mnFuncMask;
}
aField.mnDupCount = rFunctionData.mnDupCount;
aField.maFieldRef = rFunctionData.maFieldRef;
rVector.push_back(aField);
}
}
void ScPivotLayoutTreeListBase::InsertEntryForSourceTarget(SvTreeListEntry* /*pSource*/, SvTreeListEntry* /*pTarget*/)
{}
void ScPivotLayoutTreeListBase::InsertEntryForItem(ScItemValue* /*pItemValue*/, sal_uLong /*nPosition*/)
{}
void ScPivotLayoutTreeListBase::RemoveEntryForItem(ScItemValue* pItemValue)
{
SvTreeListEntry* pEachEntry;
for (pEachEntry = First(); pEachEntry != NULL; pEachEntry = Next(pEachEntry))
{
ScItemValue* pEachItemValue = (ScItemValue*) pEachEntry->GetUserData();
if (pEachItemValue == pItemValue)
{
GetModel()->Remove(pEachEntry);
return;
}
}
}
void ScPivotLayoutTreeListBase::GetFocus()
{
SvTreeListBox::GetFocus();
if( GetGetFocusFlags() & GETFOCUS_MNEMONIC )
{
SvTreeListEntry* pEntry = mpParent->mpPreviouslyFocusedListBox->GetCurEntry();
InsertEntryForSourceTarget(pEntry, NULL);
if(mpParent->mpPreviouslyFocusedListBox != NULL)
mpParent->mpPreviouslyFocusedListBox->GrabFocus();
}
mpParent->mpCurrentlyFocusedListBox = this;
}
void ScPivotLayoutTreeListBase::LoseFocus()
{
SvTreeListBox::LoseFocus();
mpParent->mpPreviouslyFocusedListBox = this;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*
* This file incorporates work covered by the following license notice:
*/
#include "PivotLayoutTreeListData.hxx"
#include "PivotLayoutDialog.hxx"
#include <svtools/treelistentry.hxx>
#include "pivot.hxx"
#include "scabstdlg.hxx"
using namespace std;
extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeScPivotLayoutTreeListData(Window *pParent, VclBuilder::stringmap& )
{
return new ScPivotLayoutTreeListData(pParent, WB_BORDER | WB_TABSTOP | WB_CLIPCHILDREN | WB_FORCE_MAKEVISIBLE);
}
namespace
{
OUString lclGetFunctionMaskName(const sal_uInt16 nFunctionMask)
{
switch (nFunctionMask)
{
case PIVOT_FUNC_SUM: return OUString("Sum");
case PIVOT_FUNC_COUNT: return OUString("Count");
case PIVOT_FUNC_AVERAGE: return OUString("Mean");
case PIVOT_FUNC_MAX: return OUString("Max");
case PIVOT_FUNC_MIN: return OUString("Min");
case PIVOT_FUNC_PRODUCT: return OUString("Product");
case PIVOT_FUNC_COUNT_NUM: return OUString("Count");
case PIVOT_FUNC_STD_DEV: return OUString("StDev");
case PIVOT_FUNC_STD_DEVP: return OUString("StDevP");
case PIVOT_FUNC_STD_VAR: return OUString("Var");
case PIVOT_FUNC_STD_VARP: return OUString("VarP");
default:
break;
}
return OUString();
}
OUString lclCreateDataItemName(const sal_uInt16 nFunctionMask, const OUString& rName, const sal_uInt8 nDuplicationCount)
{
OUStringBuffer aBuffer;
aBuffer.append(lclGetFunctionMaskName(nFunctionMask));
aBuffer.append(" - ");
aBuffer.append(rName);
if(nDuplicationCount > 0)
{
aBuffer.append(" ");
aBuffer.append(OUString::number(nDuplicationCount));
}
return aBuffer.makeStringAndClear();
}
} // anonymous namespace
ScPivotLayoutTreeListData::ScPivotLayoutTreeListData(Window* pParent, WinBits nBits) :
ScPivotLayoutTreeListBase(pParent, nBits, DATA_LIST)
{}
ScPivotLayoutTreeListData::~ScPivotLayoutTreeListData()
{}
bool ScPivotLayoutTreeListData::DoubleClickHdl()
{
ScItemValue* pCurrentItemValue = (ScItemValue*) GetCurEntry()->GetUserData();
ScPivotFuncData& rCurrentFunctionData = pCurrentItemValue->maFunctionData;
SCCOL nCurrentColumn = rCurrentFunctionData.mnCol;
ScDPLabelData* pCurrentLabelData = mpParent->GetLabelData(nCurrentColumn);
if (!pCurrentLabelData)
return false;
ScAbstractDialogFactory* pFactory = ScAbstractDialogFactory::Create();
boost::scoped_ptr<AbstractScDPFunctionDlg> pDialog(
pFactory->CreateScDPFunctionDlg(this, mpParent->GetLabelDataVector(), *pCurrentLabelData, rCurrentFunctionData));
if (pDialog->Execute() == RET_OK)
{
if (rCurrentFunctionData.mnFuncMask != pDialog->GetFuncMask())
{
rCurrentFunctionData.mnDupCount = rCurrentFunctionData.mnDupCount + 1;
}
rCurrentFunctionData.mnFuncMask = pCurrentLabelData->mnFuncMask = pDialog->GetFuncMask();
rCurrentFunctionData.maFieldRef = pDialog->GetFieldRef();
ScDPLabelData* pDFData = mpParent->GetLabelData(rCurrentFunctionData.mnCol);
OUString sDataItemName = lclCreateDataItemName(
rCurrentFunctionData.mnFuncMask,
pDFData->maName,
rCurrentFunctionData.mnDupCount);
SetEntryText(GetCurEntry(), sDataItemName);
}
return true;
}
void ScPivotLayoutTreeListData::FillDataField(ScPivotFieldVector& rDataFields)
{
Clear();
maDataItemValues.clear();
ScPivotFieldVector::iterator it;
for (it = rDataFields.begin(); it != rDataFields.end(); ++it)
{
ScPivotField& rField = *it;
if (rField.nCol == PIVOT_DATA_FIELD)
continue;
SCCOL nColumn;
if (rField.mnOriginalDim >= 0)
nColumn = rField.mnOriginalDim;
else
nColumn = rField.nCol;
ScItemValue* pOriginalItemValue = mpParent->GetItem(nColumn);
ScItemValue* pItemValue = new ScItemValue(pOriginalItemValue->maName, nColumn, rField.nFuncMask);
pItemValue->mpOriginalItemValue = pOriginalItemValue;
pItemValue->maFunctionData.mnOriginalDim = rField.mnOriginalDim;
pItemValue->maFunctionData.mnDupCount = rField.mnDupCount;
pItemValue->maFunctionData.maFieldRef = rField.maFieldRef;
maDataItemValues.push_back(pItemValue);
OUString sDataItemName = lclCreateDataItemName(rField.nFuncMask, pItemValue->maName, rField.mnDupCount);
SvTreeListEntry* pEntry = InsertEntry(sDataItemName);
pEntry->SetUserData(pItemValue);
}
}
void ScPivotLayoutTreeListData::InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* pTarget)
{
ScItemValue* pItemValue = (ScItemValue*) pSource->GetUserData();
if(mpParent->IsDataItem(pItemValue->maFunctionData.mnCol))
return;
if (HasEntry(pSource))
{
OUString rText = GetEntryText(pSource);
GetModel()->Remove(pSource);
sal_uLong nPosition = (pTarget == NULL) ? TREELIST_APPEND : GetModel()->GetAbsPos(pTarget) + 1;
InsertEntry(rText, NULL, sal_False, nPosition, pItemValue);
}
else
{
sal_uLong nPosition = (pTarget == NULL) ? TREELIST_APPEND : GetModel()->GetAbsPos(pTarget) + 1;
InsertEntryForItem(pItemValue->mpOriginalItemValue, nPosition);
}
}
void ScPivotLayoutTreeListData::InsertEntryForItem(ScItemValue* pItemValue, sal_uLong nPosition)
{
ScItemValue* pDataItemValue = new ScItemValue(pItemValue);
pDataItemValue->mpOriginalItemValue = pItemValue;
maDataItemValues.push_back(pDataItemValue);
ScPivotFuncData& rFunctionData = pDataItemValue->maFunctionData;
if (rFunctionData.mnFuncMask == PIVOT_FUNC_NONE ||
rFunctionData.mnFuncMask == PIVOT_FUNC_AUTO)
{
rFunctionData.mnFuncMask = PIVOT_FUNC_SUM;
}
OUString sDataName = lclCreateDataItemName(
rFunctionData.mnFuncMask,
pDataItemValue->maName,
rFunctionData.mnDupCount);
InsertEntry(sDataName, NULL, sal_False, nPosition, pDataItemValue);
}
void ScPivotLayoutTreeListData::KeyInput(const KeyEvent& rKeyEvent)
{
KeyCode aCode = rKeyEvent.GetKeyCode();
sal_uInt16 nCode = aCode.GetCode();
switch (nCode)
{
case KEY_DELETE:
GetModel()->Remove(GetCurEntry());
return;
}
SvTreeListBox::KeyInput(rKeyEvent);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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/.
*
* This file incorporates work covered by the following license notice:
*/
#include "PivotLayoutTreeListLabel.hxx"
#include "PivotLayoutDialog.hxx"
#include <svtools/treelistentry.hxx>
#include "pivot.hxx"
#include "scabstdlg.hxx"
using namespace std;
extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeScPivotLayoutTreeListLabel(Window *pParent, VclBuilder::stringmap& )
{
return new ScPivotLayoutTreeListLabel(pParent, WB_BORDER | WB_TABSTOP | WB_CLIPCHILDREN | WB_FORCE_MAKEVISIBLE);
}
ScPivotLayoutTreeListLabel::ScPivotLayoutTreeListLabel(Window* pParent, WinBits nBits) :
ScPivotLayoutTreeListBase(pParent, nBits, LABEL_LIST)
{}
ScPivotLayoutTreeListLabel::~ScPivotLayoutTreeListLabel()
{}
void ScPivotLayoutTreeListLabel::FillLabelFields(ScDPLabelDataVector& rLabelVector)
{
Clear();
maItemValues.clear();
ScDPLabelDataVector::iterator it;
for (it = rLabelVector.begin(); it != rLabelVector.end(); ++it)
{
const ScDPLabelData& rLabelData = *it;
ScItemValue* pValue = new ScItemValue(rLabelData.maName, rLabelData.mnCol, rLabelData.mnFuncMask);
maItemValues.push_back(pValue);
if (rLabelData.mbDataLayout)
{
maDataItem = maItemValues.size() - 1;
}
if (rLabelData.mnOriginalDim < 0 && !rLabelData.mbDataLayout)
{
SvTreeListEntry* pEntry = InsertEntry(rLabelData.maName);
pEntry->SetUserData(pValue);
}
}
}
void ScPivotLayoutTreeListLabel::InsertEntryForSourceTarget(SvTreeListEntry* /*pSource*/, SvTreeListEntry* /*pTarget*/)
{
if(mpParent->mpPreviouslyFocusedListBox != this)
mpParent->mpPreviouslyFocusedListBox->RemoveSelection();
}
bool ScPivotLayoutTreeListLabel::IsDataItem(SCCOL nColumn)
{
return (nColumn == PIVOT_DATA_FIELD || nColumn == maDataItem);
}
ScItemValue* ScPivotLayoutTreeListLabel::GetItem(SCCOL nColumn)
{
if (nColumn == PIVOT_DATA_FIELD)
return &maItemValues[maDataItem];
return &maItemValues[nColumn];
}
void ScPivotLayoutTreeListLabel::KeyInput(const KeyEvent& rKeyEvent)
{
KeyCode aCode = rKeyEvent.GetKeyCode();
sal_uInt16 nCode = aCode.GetCode();
switch (nCode)
{
case KEY_DELETE:
GetModel()->Remove(GetCurEntry());
return;
}
SvTreeListBox::KeyInput(rKeyEvent);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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
/* -*- 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
/* -*- 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
/* -*- 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
/* -*- 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
......@@ -71,6 +71,8 @@
#include "MovingAverageDialog.hxx"
#include "TTestDialog.hxx"
#include "PivotLayoutDialog.hxx"
#include <config_orcus.h>
......@@ -387,20 +389,16 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog(
case SID_OPENDLG_PIVOTTABLE:
{
#if ! MPL_HAVE_SUBSET
// all settings must be in pDialogDPObject
if( pDialogDPObject )
{
// Check for an existing datapilot output.
ScViewData* pViewData = GetViewData();
ScDPObject* pObj = pDoc->GetDPAtCursor(
pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo());
GetViewData()->SetRefTabNo( GetViewData()->GetTabNo() );
pResult = new ScPivotLayoutDlg( pB, pCW, pParent, *pDialogDPObject, pObj == NULL);
pViewData->SetRefTabNo( pViewData->GetTabNo() );
ScDPObject* pObj = pDoc->GetDPAtCursor(pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo());
pResult = new ScPivotLayoutDialog(pB, pCW, pParent, pViewData, pDialogDPObject, pObj == NULL);
}
#endif
}
break;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment