diff options
-rw-r--r-- | extras/source/glade/libreoffice-catalog.xml.in | 9 | ||||
-rw-r--r-- | sc/Library_sc.mk | 5 | ||||
-rw-r--r-- | sc/UIConfig_scalc.mk | 1 | ||||
-rw-r--r-- | sc/source/ui/dbgui/PivotLayoutDialog.cxx | 643 | ||||
-rw-r--r-- | sc/source/ui/dbgui/PivotLayoutTreeList.cxx | 125 | ||||
-rw-r--r-- | sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx | 151 | ||||
-rw-r--r-- | sc/source/ui/dbgui/PivotLayoutTreeListData.cxx | 204 | ||||
-rw-r--r-- | sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx | 90 | ||||
-rw-r--r-- | sc/source/ui/inc/PivotLayoutDialog.hxx | 136 | ||||
-rw-r--r-- | sc/source/ui/inc/PivotLayoutTreeList.hxx | 36 | ||||
-rw-r--r-- | sc/source/ui/inc/PivotLayoutTreeListBase.hxx | 76 | ||||
-rw-r--r-- | sc/source/ui/inc/PivotLayoutTreeListData.hxx | 37 | ||||
-rw-r--r-- | sc/source/ui/inc/PivotLayoutTreeListLabel.hxx | 37 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwshc.cxx | 12 | ||||
-rw-r--r-- | sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui | 789 |
15 files changed, 2344 insertions, 7 deletions
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index 45a167844abe..aae22609d57e 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -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"/> diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index 9aebd4521d7c..5c3801320071 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -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 \ diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk index 37ce1064060d..534b21bfacae 100644 --- a/sc/UIConfig_scalc.mk +++ b/sc/UIConfig_scalc.mk @@ -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 \ diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx b/sc/source/ui/dbgui/PivotLayoutDialog.cxx new file mode 100644 index 000000000000..267b7f58fe18 --- /dev/null +++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx @@ -0,0 +1,643 @@ +/* -*- 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 <reffact.hxx> +#include <svtools/treelistentry.hxx> + +#include "rangeutl.hxx" +#include "uiitems.hxx" + +#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp> + +using namespace css::uno; +using namespace css::sheet; + +ScItemValue::ScItemValue(OUString aName, SCCOL nColumn, sal_uInt16 nFunctionMask) : + maName(aName), + maFunctionData(nColumn, nFunctionMask), + mpOriginalItemValue(this) +{} + +ScItemValue::ScItemValue(ScItemValue* pInputItemValue) : + maName(pInputItemValue->maName), + maFunctionData(pInputItemValue->maFunctionData), + mpOriginalItemValue(this) +{} + +ScItemValue::~ScItemValue() +{} + +namespace +{ + +OUString lclGetNameForNamedRange(ScRange aRange, ScDocument* pDocument) +{ + OUString aName; + + ScRangeName* pRangeName = pDocument->GetRangeName(); + if (pRangeName == NULL) + return aName; + + const ScRangeData* pData = pRangeName->findByRange(aRange); + if (pData == NULL) + return aName; + + return pData->GetName(); +} + +ScRange lclGetRangeForNamedRange(OUString aName, ScDocument* pDocument) +{ + ScRange aInvalidRange(ScAddress::INITIALIZE_INVALID); + ScRangeName* pRangeName = pDocument->GetRangeName(); + if (pRangeName == NULL) + return aInvalidRange; + + const ScRangeData* pData = pRangeName->findByUpperName(aName.toAsciiUpperCase()); + if (pData == NULL) + return aInvalidRange; + + ScRange aRange; + if (pData->IsReference(aRange)) + return aRange; + + return aInvalidRange; +} + +} + +ScPivotLayoutDialog::ScPivotLayoutDialog( + SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, Window* pParent, + ScViewData* pViewData, const ScDPObject* pPivotTableObject, bool bNewPivotTable) : + ScAnyRefDlg (pSfxBindings, pChildWindow, pParent, "PivotTableLayout", "modules/scalc/ui/pivottablelayoutdialog.ui"), + maPivotTableObject (*pPivotTableObject), + mpViewData (pViewData), + mpDocument (pViewData->GetDocument()), + mbNewPivotTable (bNewPivotTable), + maAddressDetails (mpDocument->GetAddressConvention(), 0, 0), + mbDialogLostFocus (false) +{ + Link aLink; + + get(mpListBoxField, "listbox-fields"); + get(mpListBoxPage, "listbox-page"); + get(mpListBoxColumn, "listbox-column"); + get(mpListBoxRow, "listbox-row"); + get(mpListBoxData, "listbox-data"); + + get(mpCheckIgnoreEmptyRows, "check-ignore-empty-rows"); + get(mpCheckTotalColumns, "check-total-columns"); + get(mpCheckAddFilter, "check-add-filter"); + get(mpCheckIdentifyCategories, "check-identify-categories"); + get(mpCheckTotalRows, "check-total-rows"); + get(mpCheckDrillToDetail, "check-drill-to-details"); + + get(mpButtonOk, "ok"); + get(mpButtonApply, "apply"); + get(mpButtonClose, "close"); + + get(mpSourceRadioNamedRange, "source-radio-named-range"); + get(mpSourceRadioSelection, "source-radio-selection"); + get(mpSourceListBox, "source-list"); + get(mpSourceEdit, "source-edit"); + get(mpSourceButton, "source-button"); + + get(mpDestinationRadioNewSheet, "destination-radio-new-sheet"); + get(mpDestinationRadioNamedRange, "destination-radio-named-range"); + get(mpDestinationRadioSelection, "destination-radio-selection"); + get(mpDestinationListBox, "destination-list"); + get(mpDestinationEdit, "destination-edit"); + get(mpDestinationButton, "destination-button"); + + // Source UI + aLink = LINK(this, ScPivotLayoutDialog, ToggleSource); + mpSourceRadioNamedRange->SetToggleHdl(aLink); + mpSourceRadioSelection->SetToggleHdl(aLink); + + mpSourceEdit->SetReferences(this, mpSourceRadioSelection); + mpSourceButton->SetReferences(this, mpSourceEdit); + + aLink = LINK(this, ScPivotLayoutDialog, GetFocusHandler); + mpSourceEdit->SetGetFocusHdl(aLink); + mpSourceButton->SetGetFocusHdl(aLink); + + aLink = LINK(this, ScPivotLayoutDialog, LoseFocusHandler); + mpSourceEdit->SetLoseFocusHdl(aLink); + mpSourceButton->SetLoseFocusHdl(aLink); + + mpSourceEdit->SetModifyHdl(LINK(this, ScPivotLayoutDialog, SourceEditModified)); + mpSourceListBox->SetSelectHdl(LINK(this, ScPivotLayoutDialog, SourceEditModified)); + + // Destination UI + aLink = LINK(this, ScPivotLayoutDialog, ToggleDestination); + mpDestinationRadioNewSheet->SetToggleHdl(aLink); + mpDestinationRadioNamedRange->SetToggleHdl(aLink); + mpDestinationRadioSelection->SetToggleHdl(aLink); + + mpDestinationEdit->SetReferences(this, mpDestinationRadioNewSheet); + mpDestinationButton->SetReferences(this, mpDestinationEdit); + + aLink = LINK(this, ScPivotLayoutDialog, GetFocusHandler); + mpDestinationEdit->SetGetFocusHdl(aLink); + mpDestinationButton->SetGetFocusHdl(aLink); + + aLink = LINK(this, ScPivotLayoutDialog, LoseFocusHandler); + mpDestinationEdit->SetLoseFocusHdl(aLink); + mpDestinationButton->SetLoseFocusHdl(aLink); + + // Buttons + mpButtonOk->SetClickHdl( LINK(this, ScPivotLayoutDialog, OkClicked)); + mpButtonClose->SetClickHdl(LINK(this, ScPivotLayoutDialog, CloseClicked)); + mpButtonApply->SetClickHdl(LINK(this, ScPivotLayoutDialog, ApplyClicked)); + + // Initialize Data + maPivotTableObject.FillOldParam(maPivotParameters); + maPivotTableObject.FillLabelData(maPivotParameters); + + mpListBoxField->Setup (this); + mpListBoxPage->Setup (this, ScPivotLayoutTreeList::PAGE_LIST); + mpListBoxColumn->Setup(this, ScPivotLayoutTreeList::COLUMN_LIST); + mpListBoxRow->Setup (this, ScPivotLayoutTreeList::ROW_LIST); + mpListBoxData->Setup (this); + + FillValuesToListBoxes(); + + const ScDPSaveData* pSaveData = maPivotTableObject.GetSaveData(); + if (pSaveData == NULL) + { + mpCheckAddFilter->Check(false); + mpCheckDrillToDetail->Check(false); + } + else + { + mpCheckAddFilter->Check(pSaveData->GetFilterButton()); + mpCheckDrillToDetail->Check(pSaveData->GetDrillDown()); + } + + mpCheckIgnoreEmptyRows->Check(maPivotParameters.bIgnoreEmptyRows); + mpCheckIdentifyCategories->Check(maPivotParameters.bDetectCategories); + mpCheckTotalColumns->Check(maPivotParameters.bMakeTotalCol); + mpCheckTotalRows->Check(maPivotParameters.bMakeTotalRow); + + SetupSource(); + SetupDestination(); +} + +ScPivotLayoutDialog::~ScPivotLayoutDialog() +{} + +void ScPivotLayoutDialog::SetupSource() +{ + mpSourceListBox->Clear(); + + ScRange aSourceRange; + OUString sSourceNamedRangeName; + + if (maPivotTableObject.GetSheetDesc()) + { + const ScSheetSourceDesc* pSheetSourceDesc = maPivotTableObject.GetSheetDesc(); + aSourceRange = pSheetSourceDesc->GetSourceRange(); + + if(!aSourceRange.IsValid()) + { + // Source is probably a DB Range + mpSourceRadioNamedRange->Disable(); + mpSourceRadioSelection->Disable(); + ToggleSource(NULL); + return; + } + else + { + OUString aSourceRangeName = aSourceRange.Format(SCR_ABS_3D, mpDocument, maAddressDetails); + mpSourceEdit->SetText(aSourceRangeName); + } + } + else + { + mpSourceRadioNamedRange->Disable(); + mpSourceRadioSelection->Disable(); + ToggleSource(NULL); + return; + } + + // Setup Named Ranges + bool bIsNamedRange = false; + + ScAreaNameIterator aIterator(mpDocument); + OUString aEachName; + ScRange aEachRange; + + while (aIterator.Next(aEachName, aEachRange)) + { + if (!aIterator.WasDBName()) + { + mpSourceListBox->InsertEntry(aEachName); + if (aEachRange == aSourceRange) + { + sSourceNamedRangeName = aEachName; + bIsNamedRange = true; + } + } + } + + if (bIsNamedRange) + { + mpSourceListBox->SelectEntry(sSourceNamedRangeName, true); + mpSourceRadioNamedRange->Check(true); + } + else + { + mpSourceListBox->SelectEntryPos(0, true); + mpSourceRadioSelection->Check(true); + } + + // If entries - select first entry, otherwise disable the radio button. + if (mpSourceListBox->GetEntryCount() <= 0) + mpSourceRadioNamedRange->Disable(); + + ToggleSource(NULL); +} + +void ScPivotLayoutDialog::SetupDestination() +{ + mpDestinationListBox->Clear(); + + // Fill up named ranges + ScAreaNameIterator aIterator(mpDocument); + OUString aName; + ScRange aRange; + + while (aIterator.Next(aName, aRange)) + { + if (!aIterator.WasDBName()) + { + mpDestinationListBox->InsertEntry(aName); + } + } + + // If entries - select first entry, otherwise disable the radio button. + if (mpDestinationListBox->GetEntryCount() > 0) + mpDestinationListBox->SelectEntryPos(0, true); + else + mpDestinationRadioNamedRange->Disable(); + + // + if (mbNewPivotTable) + { + mpDestinationRadioNewSheet->Check(true); + } + else + { + if (maPivotParameters.nTab != MAXTAB + 1) + { + ScAddress aAddress(maPivotParameters.nCol, maPivotParameters.nRow, maPivotParameters.nTab); + OUString aAddressString = aAddress.Format(SCA_VALID | SCA_TAB_3D | SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB_ABSOLUTE, mpDocument, maAddressDetails); + mpDestinationEdit->SetText(aAddressString); + mpDestinationRadioSelection->Check(true); + } + } + + ToggleDestination(NULL); +} + +void ScPivotLayoutDialog::FillValuesToListBoxes() +{ + mpListBoxField->FillLabelFields(maPivotParameters.maLabelArray); + mpListBoxData->FillDataField(maPivotParameters.maDataFields); + mpListBoxColumn->FillFields(maPivotParameters.maColFields); + mpListBoxRow->FillFields(maPivotParameters.maRowFields); + mpListBoxPage->FillFields(maPivotParameters.maPageFields); +} + +void ScPivotLayoutDialog::SetActive() +{ + if (mbDialogLostFocus) + { + mbDialogLostFocus = false; + if(mpActiveEdit != NULL) + { + mpActiveEdit->GrabFocus(); + if (mpActiveEdit == mpSourceEdit) + UpdateSourceRange(); + } + } + else + { + GrabFocus(); + } + + RefInputDone(); +} + +void ScPivotLayoutDialog::SetReference(const ScRange& rReferenceRange, ScDocument* pDocument) +{ + if (!mbDialogLostFocus) + return; + + if (mpActiveEdit == NULL) + return; + + if (rReferenceRange.aStart != rReferenceRange.aEnd) + RefInputStart(mpActiveEdit); + + OUString aReferenceString = rReferenceRange.Format(SCR_ABS_3D, pDocument, maAddressDetails); + + if (mpActiveEdit == mpSourceEdit) + { + mpSourceEdit->SetRefString(aReferenceString); + } + else if (mpActiveEdit == mpDestinationEdit) + { + mpDestinationEdit->SetRefString(aReferenceString); + } +} + +bool ScPivotLayoutDialog::IsRefInputMode() const +{ + return mbDialogLostFocus; +} + +void ScPivotLayoutDialog::ItemInserted(ScItemValue* pItemValue, ScPivotLayoutTreeList::SvPivotTreeListType eType) +{ + if (pItemValue == NULL) + return; + + switch (eType) + { + case ScPivotLayoutTreeList::ROW_LIST: + case ScPivotLayoutTreeList::COLUMN_LIST: + case ScPivotLayoutTreeList::PAGE_LIST: + { + mpListBoxRow->RemoveEntryForItem(pItemValue); + mpListBoxColumn->RemoveEntryForItem(pItemValue); + mpListBoxPage->RemoveEntryForItem(pItemValue); + } + case ScPivotLayoutTreeList::LABEL_LIST: + { + mpListBoxRow->RemoveEntryForItem(pItemValue); + mpListBoxColumn->RemoveEntryForItem(pItemValue); + mpListBoxPage->RemoveEntryForItem(pItemValue); + mpListBoxData->RemoveEntryForItem(pItemValue); + } + break; + default: + break; + } +} + +void ScPivotLayoutDialog::UpdateSourceRange() +{ + ScSheetSourceDesc aSourceSheet = *maPivotTableObject.GetSheetDesc(); + + if (mpSourceRadioNamedRange->IsChecked()) + { + OUString aEntryString = mpSourceListBox->GetSelectEntry(); + ScRange aSourceRange = lclGetRangeForNamedRange(aEntryString, mpDocument); + if (!aSourceRange.IsValid() || aSourceSheet.GetSourceRange() == aSourceRange) + return; + aSourceSheet.SetRangeName(aEntryString); + } + else if (mpSourceRadioSelection->IsChecked()) + { + OUString aSourceString = mpSourceEdit->GetText(); + ScRange aSourceRange; + sal_uInt16 nResult = aSourceRange.Parse(aSourceString, mpDocument, maAddressDetails); + + bool bIsValid = (nResult & SCA_VALID) == SCA_VALID; // aSourceString is valid + + mpSourceEdit->SetRefValid(true); + + if (bIsValid) + { + ScRefAddress aStart; + ScRefAddress aEnd; + + ConvertDoubleRef(mpDocument, aSourceString, 1, aStart, aEnd, maAddressDetails); + aSourceRange.aStart = aStart.GetAddress(); + aSourceRange.aEnd = aEnd.GetAddress(); + } + else + { + aSourceRange = lclGetRangeForNamedRange(aSourceString, mpDocument); + } + + if (!aSourceRange.IsValid()) + { + mpSourceEdit->SetRefValid(false); + return; + } + + if (aSourceSheet.GetSourceRange() == aSourceRange) + return; + + aSourceSheet.SetSourceRange(aSourceRange); + if (aSourceSheet.CheckSourceRange() != 0) + { + mpSourceEdit->SetRefValid(false); + return; + } + } + else + { + return; + } + + maPivotTableObject.SetSheetDesc(aSourceSheet); + maPivotTableObject.FillOldParam(maPivotParameters); + maPivotTableObject.FillLabelData(maPivotParameters); + + FillValuesToListBoxes(); +} + +bool ScPivotLayoutDialog::ApplyChanges() +{ + ScDPSaveData aSaveData; + aSaveData.SetIgnoreEmptyRows(mpCheckIgnoreEmptyRows->IsChecked()); + aSaveData.SetRepeatIfEmpty(mpCheckIdentifyCategories->IsChecked()); + aSaveData.SetColumnGrand(mpCheckTotalColumns->IsChecked()); + aSaveData.SetRowGrand(mpCheckTotalRows->IsChecked()); + aSaveData.SetFilterButton(mpCheckAddFilter->IsChecked()); + aSaveData.SetDrillDown(mpCheckDrillToDetail->IsChecked()); + + Reference<XDimensionsSupplier> xSource = maPivotTableObject.GetSource(); + + ScPivotFieldVector aPageFieldVector; + mpListBoxPage->PushEntriesToPivotFieldVector(aPageFieldVector); + ScDPObject::ConvertOrientation(aSaveData, aPageFieldVector, DataPilotFieldOrientation_PAGE, + xSource, maPivotParameters.maLabelArray); + + ScPivotFieldVector aColFieldVector; + mpListBoxColumn->PushEntriesToPivotFieldVector(aColFieldVector); + ScDPObject::ConvertOrientation(aSaveData, aColFieldVector, DataPilotFieldOrientation_COLUMN, + xSource, maPivotParameters.maLabelArray); + + ScPivotFieldVector aRowFieldVector; + mpListBoxRow->PushEntriesToPivotFieldVector(aRowFieldVector); + ScDPObject::ConvertOrientation(aSaveData, aRowFieldVector, DataPilotFieldOrientation_ROW, + xSource, maPivotParameters.maLabelArray); + + ScPivotFieldVector aDataFieldVector; + mpListBoxData->PushEntriesToPivotFieldVector(aDataFieldVector); + ScDPObject::ConvertOrientation(aSaveData, aDataFieldVector, DataPilotFieldOrientation_DATA, + xSource, maPivotParameters.maLabelArray, + &aColFieldVector, &aRowFieldVector, &aPageFieldVector); + + + ScRange aDestinationRange; + bool bToNewSheet = false; + + if (!GetDestination(aDestinationRange, bToNewSheet)) + return false; + + SetDispatcherLock(false); + SwitchToDocument(); + + sal_uInt16 nWhichPivot = SC_MOD()->GetPool().GetWhich(SID_PIVOT_TABLE); + ScPivotItem aPivotItem(nWhichPivot, &aSaveData, &aDestinationRange, bToNewSheet); + mpViewData->GetViewShell()->SetDialogDPObject(new ScDPObject(maPivotTableObject)); + + SfxDispatcher* pDispatcher = GetBindings().GetDispatcher(); + SfxCallMode nCallMode = SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD; + const SfxPoolItem* pResult = pDispatcher->Execute(SID_PIVOT_TABLE, nCallMode, &aPivotItem, NULL, 0); + + if (pResult != NULL) + { + const SfxBoolItem* pItem = reinterpret_cast<const SfxBoolItem*>(pResult); + if (pItem) + { + return pItem->GetValue(); + } + } + + SetDispatcherLock(true); + return true; +} + +bool ScPivotLayoutDialog::GetDestination(ScRange& aDestinationRange, bool& bToNewSheet) +{ + bToNewSheet = false; + + if (mpDestinationRadioNamedRange->IsChecked()) + { + OUString aName = mpDestinationListBox->GetSelectEntry(); + aDestinationRange = lclGetRangeForNamedRange(aName, mpDocument); + if (!aDestinationRange.IsValid()) + return false; + } + else if (mpDestinationRadioSelection->IsChecked()) + { + ScAddress aAddress; + aAddress.Parse(mpDestinationEdit->GetText(), mpDocument, maAddressDetails); + aDestinationRange = ScRange(aAddress); + } + else + { + bToNewSheet = true; + aDestinationRange = ScRange(maPivotParameters.nCol, maPivotParameters.nRow, maPivotParameters.nTab); + } + return true; +} + +ScItemValue* ScPivotLayoutDialog::GetItem(SCCOL nColumn) +{ + return mpListBoxField->GetItem(nColumn); +} + +bool ScPivotLayoutDialog::IsDataItem(SCCOL nColumn) +{ + return mpListBoxField->IsDataItem(nColumn); +} + +ScDPLabelData* ScPivotLayoutDialog::GetLabelData(SCCOL nColumn) +{ + return &maPivotParameters.maLabelArray[nColumn]; +} + +ScDPLabelDataVector& ScPivotLayoutDialog::GetLabelDataVector() +{ + return maPivotParameters.maLabelArray; +} + +IMPL_LINK( ScPivotLayoutDialog, OkClicked, PushButton*, /*pButton*/ ) +{ + if (ApplyChanges()) + CloseClicked(NULL); + return 0; +} + +IMPL_LINK( ScPivotLayoutDialog, ApplyClicked, PushButton*, /*pButton*/ ) +{ + ApplyChanges(); + return 0; +} + +IMPL_LINK( ScPivotLayoutDialog, CloseClicked, PushButton*, /*pButton*/ ) +{ + DoClose( ScPivotLayoutWrapper::GetChildWindowId() ); + return 0; +} + +IMPL_LINK(ScPivotLayoutDialog, GetFocusHandler, Control*, pCtrl) +{ + mpActiveEdit = NULL; + + if (pCtrl == (Control*) mpSourceEdit || + pCtrl == (Control*) mpSourceButton) + { + mpActiveEdit = mpSourceEdit; + } + else if (pCtrl == (Control*) mpDestinationEdit || + pCtrl == (Control*) mpDestinationButton) + { + mpActiveEdit = mpDestinationEdit; + } + + if (mpActiveEdit) + mpActiveEdit->SetSelection(Selection(0, SELECTION_MAX)); + + return 0; +} + +IMPL_LINK_NOARG(ScPivotLayoutDialog, LoseFocusHandler) +{ + mbDialogLostFocus = !IsActive(); + return 0; +} + +IMPL_LINK_NOARG(ScPivotLayoutDialog, SourceEditModified) +{ + UpdateSourceRange(); + return 0; +} + +IMPL_LINK_NOARG(ScPivotLayoutDialog, ToggleSource) +{ + bool bNamedRange = mpSourceRadioNamedRange->IsChecked(); + bool bSelection = mpSourceRadioSelection->IsChecked(); + mpSourceListBox->Enable(bNamedRange); + mpSourceButton->Enable(bSelection); + mpSourceEdit->Enable(bSelection); + UpdateSourceRange(); + return 0; +} + +IMPL_LINK_NOARG(ScPivotLayoutDialog, ToggleDestination) +{ + bool bNamedRange = mpDestinationRadioNamedRange->IsChecked(); + bool bSelection = mpDestinationRadioSelection->IsChecked(); + mpDestinationListBox->Enable(bNamedRange); + mpDestinationButton->Enable(bSelection); + mpDestinationEdit->Enable(bSelection); + return 0; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx new file mode 100644 index 000000000000..8c76aff6a9a0 --- /dev/null +++ b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx @@ -0,0 +1,125 @@ +/* -*- 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: */ diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx new file mode 100644 index 000000000000..ee5b44a5dd7c --- /dev/null +++ b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx @@ -0,0 +1,151 @@ +/* -*- 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: */ diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx new file mode 100644 index 000000000000..82cd93adf1f2 --- /dev/null +++ b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx @@ -0,0 +1,204 @@ +/* -*- 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: */ diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx new file mode 100644 index 000000000000..023f3ce56fb4 --- /dev/null +++ b/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx @@ -0,0 +1,90 @@ +/* -*- 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: */ 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 diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index 20c0ab12c4e1..ac7b7a0a5797 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -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; diff --git a/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui b/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui new file mode 100644 index 000000000000..e1a7b9eb23d8 --- /dev/null +++ b/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui @@ -0,0 +1,789 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.16.1 --> +<interface> + <requires lib="gtk+" version="3.0"/> + <!-- interface-requires LibreOffice 1.0 --> + <object class="GtkDialog" id="PivotTableLayout"> + <property name="can_focus">False</property> + <property name="title" translatable="yes">Pivot Table Layout</property> + <property name="type_hint">dialog</property> + <property name="use_header_bar">0</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox1"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">2</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area1"> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="apply"> + <property name="label">gtk-apply</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="close"> + <property name="label">gtk-close</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="xpad">4</property> + <property name="label" translatable="yes">Available Fields:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">listbox-fields</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkScrolledWindow" id="scrolledwindow2"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="shadow_type">in</property> + <child> + <object class="scuilo-ScPivotLayoutTreeList" id="listbox-column"> + <property name="width_request">200</property> + <property name="height_request">100</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="Pivot Table List-selection6"/> + </child> + </object> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkScrolledWindow" id="scrolledwindow3"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="shadow_type">in</property> + <child> + <object class="scuilo-ScPivotLayoutTreeListData" id="listbox-data"> + <property name="width_request">200</property> + <property name="height_request">100</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="Tree List-selection4"/> + </child> + </object> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">3</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkScrolledWindow" id="scrolledwindow4"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="shadow_type">in</property> + <child> + <object class="scuilo-ScPivotLayoutTreeList" id="listbox-row"> + <property name="width_request">200</property> + <property name="height_request">100</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="Tree List-selection3"/> + </child> + </object> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">3</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkScrolledWindow" id="scrolledwindow1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="shadow_type">in</property> + <child> + <object class="scuilo-ScPivotLayoutTreeList" id="listbox-page"> + <property name="width_request">200</property> + <property name="height_request">100</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="Tree List-selection1"/> + </child> + </object> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">False</property> + <property name="vexpand">False</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="xpad">4</property> + <property name="label" translatable="yes">Page Fields:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">listbox-page</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">False</property> + <property name="vexpand">False</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="xpad">4</property> + <property name="label" translatable="yes">Column Fields:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">listbox-column</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">False</property> + <property name="vexpand">False</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="xpad">4</property> + <property name="label" translatable="yes">Row Fields:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">listbox-row</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">False</property> + <property name="vexpand">False</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="xpad">4</property> + <property name="label" translatable="yes">Data Fields:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">listbox-data</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkScrolledWindow" id="scrolledwindow5"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="shadow_type">in</property> + <child> + <object class="scuilo-ScPivotLayoutTreeListLabel" id="listbox-fields"> + <property name="width_request">200</property> + <property name="height_request">150</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="Pivot Table List-selection"/> + </child> + </object> + </child> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">3</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label6"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">False</property> + <property name="vexpand">False</property> + <property name="label" translatable="yes">Drag the items into the desired position</property> + <attributes> + <attribute name="underline" value="True"/> + </attributes> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">4</property> + <property name="width">3</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkExpander" id="expander1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <child> + <object class="GtkGrid" id="grid2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkFrame" id="frame1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="left_padding">12</property> + <child> + <object class="GtkGrid" id="grid3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkRadioButton" id="destination-radio-new-sheet"> + <property name="label" translatable="yes">New sheet</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + <property name="group">destination-radio-named-range</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">3</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="destination-radio-selection"> + <property name="label" translatable="yes">Selection</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + <property name="group">destination-radio-new-sheet</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="foruilo-RefEdit" id="destination-edit"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="foruilo-RefButton" id="destination-button"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="destination-list"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + <property name="width">2</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="destination-radio-named-range"> + <property name="label" translatable="yes">Named range</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + <property name="group">destination-radio-selection</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label8"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Destination</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="frame2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="left_padding">12</property> + <child> + <object class="GtkGrid" id="grid4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkRadioButton" id="source-radio-selection"> + <property name="label" translatable="yes">Selection</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + <property name="group">source-radio-named-range</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="foruilo-RefEdit" id="source-edit"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="foruilo-RefButton" id="source-button"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="source-radio-named-range"> + <property name="label" translatable="yes">Named range</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + <property name="group">source-radio-selection</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="source-list"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">2</property> + <property name="height">1</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label9"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Source</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label7"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Source and Destination</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">6</property> + <property name="width">3</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="frame3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="left_padding">12</property> + <child> + <object class="GtkGrid" id="grid5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkCheckButton" id="check-ignore-empty-rows"> + <property name="label" translatable="yes">Ignore empty rows</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="hexpand">True</property> + <property name="vexpand">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="check-identify-categories"> + <property name="label" translatable="yes">Identify categories</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="hexpand">True</property> + <property name="vexpand">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="check-total-rows"> + <property name="label" translatable="yes">Total rows</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="hexpand">True</property> + <property name="vexpand">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="check-total-columns"> + <property name="label" translatable="yes">Total columns</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="hexpand">True</property> + <property name="vexpand">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="check-add-filter"> + <property name="label" translatable="yes">Add filter</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="hexpand">True</property> + <property name="vexpand">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="check-drill-to-details"> + <property name="label" translatable="yes">Enable drill to details</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="hexpand">True</property> + <property name="vexpand">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label10"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Options</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">5</property> + <property name="width">3</property> + <property name="height">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + </object> +</interface> |