sc/source/ui/dbgui/PivotLayoutDialog.cxx | 117 +++++++++++++++++------- sc/source/ui/dbgui/PivotLayoutTreeList.cxx | 41 +++++--- sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx | 18 --- sc/source/ui/dbgui/PivotLayoutTreeListData.cxx | 28 +++++ sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx | 2 sc/source/ui/inc/PivotLayoutDialog.hxx | 5 - sc/source/ui/inc/PivotLayoutTreeListData.hxx | 2 sc/source/ui/inc/PivotLayoutTreeListLabel.hxx | 2 sc/uiconfig/scalc/ui/datafieldoptionsdialog.ui | 6 - vcl/source/window/window2.cxx | 7 + 10 files changed, 160 insertions(+), 68 deletions(-)
New commits: commit 8302e1221ec4b023db319f5048195e45369b9848 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.com> Date: Thu Apr 3 11:35:20 2014 +0200 pivot: In "Data Field Options" dialog change Add -> Ok Change-Id: Ie6b1670445fd15e2ba791b13e4b6cd6803b2b9df diff --git a/sc/uiconfig/scalc/ui/datafieldoptionsdialog.ui b/sc/uiconfig/scalc/ui/datafieldoptionsdialog.ui index e71439a..9f532a2 100644 --- a/sc/uiconfig/scalc/ui/datafieldoptionsdialog.ui +++ b/sc/uiconfig/scalc/ui/datafieldoptionsdialog.ui @@ -25,8 +25,8 @@ <property name="can_focus">False</property> <property name="layout_style">end</property> <child> - <object class="GtkButton" id="add"> - <property name="label">gtk-add</property> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> @@ -552,7 +552,7 @@ </object> </child> <action-widgets> - <action-widget response="0">add</action-widget> + <action-widget response="0">ok</action-widget> <action-widget response="0">close</action-widget> <action-widget response="0">help</action-widget> </action-widgets> commit 19d71217aba8700dac913c278767d6e387ce65a1 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.com> Date: Thu Apr 3 11:33:04 2014 +0200 pivot: Apply changes made in "Data Field" and "Data Field Options" Change-Id: If8560d47c5b4e64367c441237c1e38f964cf6825 diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx b/sc/source/ui/dbgui/PivotLayoutDialog.cxx index 48b4874..4acc758 100644 --- a/sc/source/ui/dbgui/PivotLayoutDialog.cxx +++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx @@ -16,8 +16,12 @@ #include "rangeutl.hxx" #include "uiitems.hxx" +#include "dputil.hxx" + +#include <vector> #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp> +#include <com/sun/star/sheet/DataPilotFieldSortMode.hpp> using namespace css::uno; using namespace css::sheet; @@ -156,6 +160,7 @@ ScPivotLayoutDialog::ScPivotLayoutDialog( FillValuesToListBoxes(); + // Initialize Options const ScDPSaveData* pSaveData = maPivotTableObject.GetSaveData(); if (pSaveData == NULL) { @@ -446,65 +451,108 @@ void ScPivotLayoutDialog::UpdateSourceRange() 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()); + ApplySaveData(aSaveData); + ApplyLabelData(aSaveData); + + 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(&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; +} + +void ScPivotLayoutDialog::ApplySaveData(ScDPSaveData& rSaveData) +{ + rSaveData.SetIgnoreEmptyRows(mpCheckIgnoreEmptyRows->IsChecked()); + rSaveData.SetRepeatIfEmpty(mpCheckIdentifyCategories->IsChecked()); + rSaveData.SetColumnGrand(mpCheckTotalColumns->IsChecked()); + rSaveData.SetRowGrand(mpCheckTotalRows->IsChecked()); + rSaveData.SetFilterButton(mpCheckAddFilter->IsChecked()); + rSaveData.SetDrillDown(mpCheckDrillToDetail->IsChecked()); Reference<XDimensionsSupplier> xSource = maPivotTableObject.GetSource(); ScPivotFieldVector aPageFieldVector; mpListBoxPage->PushEntriesToPivotFieldVector(aPageFieldVector); - ScDPObject::ConvertOrientation(aSaveData, aPageFieldVector, DataPilotFieldOrientation_PAGE, + ScDPObject::ConvertOrientation(rSaveData, aPageFieldVector, DataPilotFieldOrientation_PAGE, xSource, maPivotParameters.maLabelArray); ScPivotFieldVector aColFieldVector; mpListBoxColumn->PushEntriesToPivotFieldVector(aColFieldVector); - ScDPObject::ConvertOrientation(aSaveData, aColFieldVector, DataPilotFieldOrientation_COLUMN, + ScDPObject::ConvertOrientation(rSaveData, aColFieldVector, DataPilotFieldOrientation_COLUMN, xSource, maPivotParameters.maLabelArray); ScPivotFieldVector aRowFieldVector; mpListBoxRow->PushEntriesToPivotFieldVector(aRowFieldVector); - ScDPObject::ConvertOrientation(aSaveData, aRowFieldVector, DataPilotFieldOrientation_ROW, + ScDPObject::ConvertOrientation(rSaveData, aRowFieldVector, DataPilotFieldOrientation_ROW, xSource, maPivotParameters.maLabelArray); ScPivotFieldVector aDataFieldVector; mpListBoxData->PushEntriesToPivotFieldVector(aDataFieldVector); - ScDPObject::ConvertOrientation(aSaveData, aDataFieldVector, DataPilotFieldOrientation_DATA, + ScDPObject::ConvertOrientation(rSaveData, aDataFieldVector, DataPilotFieldOrientation_DATA, xSource, maPivotParameters.maLabelArray, &aColFieldVector, &aRowFieldVector, &aPageFieldVector); +} +void ScPivotLayoutDialog::ApplyLabelData(ScDPSaveData& rSaveData) +{ + ScDPLabelDataVector::const_iterator it; + ScDPLabelDataVector& rLabelDataVector = GetLabelDataVector(); - ScRange aDestinationRange; - bool bToNewSheet = false; + for (it = rLabelDataVector.begin(); it != rLabelDataVector.end(); ++it) + { + const ScDPLabelData& pLabelData = *it; - if (!GetDestination(aDestinationRange, bToNewSheet)) - return false; + OUString aUnoName = ScDPUtil::createDuplicateDimensionName(pLabelData.maName, pLabelData.mnDupCount); + ScDPSaveDimension* pSaveDimensions = rSaveData.GetExistingDimensionByName(aUnoName); - SetDispatcherLock(false); - SwitchToDocument(); + if (pSaveDimensions == NULL) + continue; - sal_uInt16 nWhichPivot = SC_MOD()->GetPool().GetWhich(SID_PIVOT_TABLE); - ScPivotItem aPivotItem(nWhichPivot, &aSaveData, &aDestinationRange, bToNewSheet); - mpViewData->GetViewShell()->SetDialogDPObject(new ScDPObject(maPivotTableObject)); + pSaveDimensions->SetUsedHierarchy(pLabelData.mnUsedHier); + pSaveDimensions->SetShowEmpty(pLabelData.mbShowAll); + pSaveDimensions->SetSortInfo(&pLabelData.maSortInfo); + pSaveDimensions->SetLayoutInfo(&pLabelData.maLayoutInfo); + pSaveDimensions->SetAutoShowInfo(&pLabelData.maShowInfo); - SfxDispatcher* pDispatcher = GetBindings().GetDispatcher(); - SfxCallMode nCallMode = SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD; - const SfxPoolItem* pResult = pDispatcher->Execute(SID_PIVOT_TABLE, nCallMode, &aPivotItem, NULL, 0); + bool bManualSort = (pLabelData.maSortInfo.Mode == DataPilotFieldSortMode::MANUAL); - if (pResult != NULL) - { - const SfxBoolItem* pItem = reinterpret_cast<const SfxBoolItem*>(pResult); - if (pItem) + std::vector<ScDPLabelData::Member>::const_iterator itMember; + for (itMember = pLabelData.maMembers.begin(); itMember != pLabelData.maMembers.end(); ++itMember) { - return pItem->GetValue(); + const ScDPLabelData::Member& rLabelMember = *itMember; + ScDPSaveMember* pMember = pSaveDimensions->GetMemberByName(rLabelMember.maName); + + if (bManualSort || !rLabelMember.mbVisible || !rLabelMember.mbShowDetails) + { + pMember->SetIsVisible(rLabelMember.mbVisible); + pMember->SetShowDetails(rLabelMember.mbShowDetails); + } } } - - SetDispatcherLock(true); - return true; } bool ScPivotLayoutDialog::GetDestination(ScRange& aDestinationRange, bool& bToNewSheet) @@ -537,9 +585,9 @@ ScItemValue* ScPivotLayoutDialog::GetItem(SCCOL nColumn) return mpListBoxField->GetItem(nColumn); } -bool ScPivotLayoutDialog::IsDataItem(SCCOL nColumn) +bool ScPivotLayoutDialog::IsDataElement(SCCOL nColumn) { - return mpListBoxField->IsDataItem(nColumn); + return mpListBoxField->IsDataElement(nColumn); } ScDPLabelData* ScPivotLayoutDialog::GetLabelData(SCCOL nColumn) @@ -552,6 +600,11 @@ ScDPLabelDataVector& ScPivotLayoutDialog::GetLabelDataVector() return maPivotParameters.maLabelArray; } +void ScPivotLayoutDialog::PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames) +{ + return mpListBoxData->PushDataFieldNames(rDataFieldNames); +} + IMPL_LINK( ScPivotLayoutDialog, OkClicked, PushButton*, /*pButton*/ ) { if (ApplyChanges()) diff --git a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx index 9eae737..bdfae54 100644 --- a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx +++ b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx @@ -36,11 +36,35 @@ void ScPivotLayoutTreeList::Setup(ScPivotLayoutDialog* pParent, SvPivotTreeListT meType = eType; } +OUString lclFunctName(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(); +} + bool ScPivotLayoutTreeList::DoubleClickHdl() { ScItemValue* pCurrentItemValue = (ScItemValue*) GetCurEntry()->GetUserData(); ScPivotFuncData& rCurrentFunctionData = pCurrentItemValue->maFunctionData; + if (mpParent->IsDataElement(rCurrentFunctionData.mnCol)) + return false; + SCCOL nCurrentColumn = rCurrentFunctionData.mnCol; ScDPLabelData* pCurrentLabelData = mpParent->GetLabelData(nCurrentColumn); if (!pCurrentLabelData) @@ -49,18 +73,7 @@ bool ScPivotLayoutTreeList::DoubleClickHdl() 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)); - } + mpParent->PushDataFieldNames(aDataFieldNames); boost::scoped_ptr<AbstractScDPSubtotalDlg> pDialog( pFactory->CreateScDPSubtotalDlg(this, mpParent->maPivotTableObject, *pCurrentLabelData, rCurrentFunctionData, aDataFieldNames, true)); @@ -68,7 +81,7 @@ bool ScPivotLayoutTreeList::DoubleClickHdl() if (pDialog->Execute() == RET_OK) { pDialog->FillLabelData(*pCurrentLabelData); - rCurrentFunctionData.mnFuncMask = pCurrentLabelData->mnFuncMask; + rCurrentFunctionData.mnFuncMask = pDialog->GetFuncMask(); } return true; @@ -93,7 +106,7 @@ void ScPivotLayoutTreeList::InsertEntryForSourceTarget(SvTreeListEntry* pSource, ScItemValue* pOriginalItemValue = pItemValue->mpOriginalItemValue; // Don't allow to add "Data" element to page fields - if(meType == PAGE_LIST && mpParent->IsDataItem(pItemValue->maFunctionData.mnCol)) + if(meType == PAGE_LIST && mpParent->IsDataElement(pItemValue->maFunctionData.mnCol)) return; mpParent->ItemInserted(pOriginalItemValue, meType); diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx index ee5b44a..5e1f320 100644 --- a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx +++ b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx @@ -86,23 +86,11 @@ void ScPivotLayoutTreeListBase::PushEntriesToPivotFieldVector(ScPivotFieldVector 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; - + aField.nFuncMask = rFunctionData.mnFuncMask; + aField.mnDupCount = rFunctionData.mnDupCount; + aField.maFieldRef = rFunctionData.maFieldRef; rVector.push_back(aField); } } diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx index 8ef80b0..012781a 100644 --- a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx +++ b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx @@ -144,11 +144,37 @@ void ScPivotLayoutTreeListData::FillDataField(ScPivotFieldVector& rDataFields) } } +void ScPivotLayoutTreeListData::PushDataFieldNames(vector<ScDPName>& rDataFieldNames) +{ + SvTreeListEntry* pLoopEntry; + for (pLoopEntry = First(); pLoopEntry != NULL; pLoopEntry = Next(pLoopEntry)) + { + ScItemValue* pEachItemValue = (ScItemValue*) pLoopEntry->GetUserData(); + SCCOL nColumn = pEachItemValue->maFunctionData.mnCol; + + ScDPLabelData* pLabelData = mpParent->GetLabelData(nColumn); + + if (pLabelData == NULL && pLabelData->maName.isEmpty()) + continue; + + OUString sLayoutName = pLabelData->maLayoutName; + if (sLayoutName.isEmpty()) + { + sLayoutName = lclCreateDataItemName( + pEachItemValue->maFunctionData.mnFuncMask, + pEachItemValue->maName, + pEachItemValue->maFunctionData.mnDupCount); + } + + rDataFieldNames.push_back(ScDPName(pLabelData->maName, sLayoutName, pLabelData->mnDupCount)); + } +} + void ScPivotLayoutTreeListData::InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* pTarget) { ScItemValue* pItemValue = (ScItemValue*) pSource->GetUserData(); - if(mpParent->IsDataItem(pItemValue->maFunctionData.mnCol)) + if(mpParent->IsDataElement(pItemValue->maFunctionData.mnCol)) return; if (HasEntry(pSource)) diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx index 023f3ce..6617b0b 100644 --- a/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx +++ b/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx @@ -61,7 +61,7 @@ void ScPivotLayoutTreeListLabel::InsertEntryForSourceTarget(SvTreeListEntry* /*p mpParent->mpPreviouslyFocusedListBox->RemoveSelection(); } -bool ScPivotLayoutTreeListLabel::IsDataItem(SCCOL nColumn) +bool ScPivotLayoutTreeListLabel::IsDataElement(SCCOL nColumn) { return (nColumn == PIVOT_DATA_FIELD || nColumn == maDataItem); } diff --git a/sc/source/ui/inc/PivotLayoutDialog.hxx b/sc/source/ui/inc/PivotLayoutDialog.hxx index b7ad9cd..23099a4 100644 --- a/sc/source/ui/inc/PivotLayoutDialog.hxx +++ b/sc/source/ui/inc/PivotLayoutDialog.hxx @@ -122,12 +122,15 @@ public: void UpdateSourceRange(); bool ApplyChanges(); + void ApplySaveData(ScDPSaveData& rSaveData); + void ApplyLabelData(ScDPSaveData& rSaveData); ScItemValue* GetItem(SCCOL nColumn); - bool IsDataItem(SCCOL nColumn); + bool IsDataElement(SCCOL nColumn); ScDPLabelData* GetLabelData(SCCOL nColumn); ScDPLabelDataVector& GetLabelDataVector(); + void PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames); }; diff --git a/sc/source/ui/inc/PivotLayoutTreeListData.hxx b/sc/source/ui/inc/PivotLayoutTreeListData.hxx index 8ba5569..d58b077 100644 --- a/sc/source/ui/inc/PivotLayoutTreeListData.hxx +++ b/sc/source/ui/inc/PivotLayoutTreeListData.hxx @@ -25,6 +25,8 @@ public: virtual bool DoubleClickHdl() SAL_OVERRIDE; void FillDataField(ScPivotFieldVector& rDataFields); + void PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames); + protected: virtual void InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* pTarget) SAL_OVERRIDE; virtual void InsertEntryForItem(ScItemValue* pItemValue, sal_uLong nPosition) SAL_OVERRIDE; diff --git a/sc/source/ui/inc/PivotLayoutTreeListLabel.hxx b/sc/source/ui/inc/PivotLayoutTreeListLabel.hxx index 7eb8f52..656fb49 100644 --- a/sc/source/ui/inc/PivotLayoutTreeListLabel.hxx +++ b/sc/source/ui/inc/PivotLayoutTreeListLabel.hxx @@ -25,7 +25,7 @@ public: virtual ~ScPivotLayoutTreeListLabel(); void FillLabelFields(ScDPLabelDataVector& rLabelVector); ScItemValue* GetItem(SCCOL nColumn); - bool IsDataItem(SCCOL nColumn); + bool IsDataElement(SCCOL nColumn); protected: virtual void InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* pTarget) SAL_OVERRIDE; commit e748cf70977bbdd2d869bdeab1921ee68238dca4 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.com> Date: Tue Apr 1 23:08:03 2014 +0200 vcl: apply font height if defined as "size" attribute in .ui Change-Id: I28719b16fb47a618420195640f4f75a79ca889ea diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 6b5b558..e2330a9 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -1785,6 +1785,13 @@ bool Window::set_font_attribute(const OString &rKey, const OString &rValue) aFont.SetUnderline(UNDERLINE_SINGLE); SetControlFont(aFont); } + else if (rKey == "size") + { + Font aFont(GetControlFont()); + sal_Int32 nHeight = rValue.toInt32() / 1000; + aFont.SetHeight(nHeight); + SetControlFont(aFont); + } else { SAL_INFO("vcl.layout", "unhandled font attribute: " << rKey.getStr());
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits