[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.2' - 6 commits - extras/source sc/Library_sc.mk sc/source sc/uiconfig sc/UIConfig_scalc.mk

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Wed Apr 16 07:29:16 PDT 2014


 extras/source/glade/libreoffice-catalog.xml.in  |    9 
 sc/Library_sc.mk                                |    5 
 sc/UIConfig_scalc.mk                            |    1 
 sc/source/ui/dbgui/PivotLayoutDialog.cxx        |  696 ++++++++++++++++++++
 sc/source/ui/dbgui/PivotLayoutTreeList.cxx      |  138 ++++
 sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx  |  139 ++++
 sc/source/ui/dbgui/PivotLayoutTreeListData.cxx  |  265 +++++++
 sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx |   90 ++
 sc/source/ui/inc/PivotLayoutDialog.hxx          |  141 ++++
 sc/source/ui/inc/PivotLayoutTreeList.hxx        |   36 +
 sc/source/ui/inc/PivotLayoutTreeListBase.hxx    |   76 ++
 sc/source/ui/inc/PivotLayoutTreeListData.hxx    |   41 +
 sc/source/ui/inc/PivotLayoutTreeListLabel.hxx   |   37 +
 sc/source/ui/view/tabvwshc.cxx                  |   12 
 sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui  |  816 ++++++++++++++++++++++++
 15 files changed, 2495 insertions(+), 7 deletions(-)

New commits:
commit 8d38fb3a9a22646d8f5d6d00f44aee963c5eeb67
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Wed Apr 16 16:22:41 2014 +0200

    pivot: backport fixes
    
    Change-Id: I105fedacc3a10fadeaf799899edf1205cc142035

diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
index c5dcd93..0bcbf87 100644
--- a/sc/source/ui/dbgui/PivotLayoutDialog.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
@@ -366,7 +366,7 @@ void ScPivotLayoutDialog::SetReference(const ScRange& rReferenceRange, ScDocumen
     }
 }
 
-bool ScPivotLayoutDialog::IsRefInputMode() const
+sal_Bool ScPivotLayoutDialog::IsRefInputMode() const
 {
     return mbDialogLostFocus;
 }
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
index bae0b63..059d217 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
@@ -57,7 +57,7 @@ OUString lclFunctName(const sal_uInt16 nFunctionMask)
     return OUString();
 }
 
-bool ScPivotLayoutTreeList::DoubleClickHdl()
+sal_Bool ScPivotLayoutTreeList::DoubleClickHdl()
 {
     ScItemValue* pCurrentItemValue = (ScItemValue*) GetCurEntry()->GetUserData();
     ScPivotFuncData& rCurrentFunctionData = pCurrentItemValue->maFunctionData;
@@ -76,7 +76,7 @@ bool ScPivotLayoutTreeList::DoubleClickHdl()
     mpParent->PushDataFieldNames(aDataFieldNames);
 
     boost::scoped_ptr<AbstractScDPSubtotalDlg> pDialog(
-        pFactory->CreateScDPSubtotalDlg(this, mpParent->maPivotTableObject, *pCurrentLabelData, rCurrentFunctionData, aDataFieldNames, true));
+        pFactory->CreateScDPSubtotalDlg(this, RID_SCDLG_PIVOTSUBT, mpParent->maPivotTableObject, *pCurrentLabelData, rCurrentFunctionData, aDataFieldNames, true));
 
     if (pDialog->Execute() == RET_OK)
     {
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
index 5e1f320..f4201dc 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
@@ -48,7 +48,7 @@ sal_Int8 ScPivotLayoutTreeListBase::AcceptDrop(const AcceptDropEvent& rEvent)
     return SvTreeListBox::AcceptDrop(rEvent);
 }
 
-bool ScPivotLayoutTreeListBase::NotifyAcceptDrop(SvTreeListEntry* /*pEntry*/)
+sal_Bool ScPivotLayoutTreeListBase::NotifyAcceptDrop(SvTreeListEntry* /*pEntry*/)
 {
     return true;
 }
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
index 4b101e5..2d53653 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
@@ -71,7 +71,7 @@ ScPivotLayoutTreeListData::ScPivotLayoutTreeListData(Window* pParent, WinBits nB
 ScPivotLayoutTreeListData::~ScPivotLayoutTreeListData()
 {}
 
-bool ScPivotLayoutTreeListData::DoubleClickHdl()
+sal_Bool ScPivotLayoutTreeListData::DoubleClickHdl()
 {
     ScItemValue* pCurrentItemValue = (ScItemValue*) GetCurEntry()->GetUserData();
     ScPivotFuncData& rCurrentFunctionData = pCurrentItemValue->maFunctionData;
@@ -84,7 +84,7 @@ bool ScPivotLayoutTreeListData::DoubleClickHdl()
     ScAbstractDialogFactory* pFactory = ScAbstractDialogFactory::Create();
 
     boost::scoped_ptr<AbstractScDPFunctionDlg> pDialog(
-        pFactory->CreateScDPFunctionDlg(this, mpParent->GetLabelDataVector(), *pCurrentLabelData, rCurrentFunctionData));
+        pFactory->CreateScDPFunctionDlg(this, RID_SCDLG_DPDATAFIELD, mpParent->GetLabelDataVector(), *pCurrentLabelData, rCurrentFunctionData));
 
     if (pDialog->Execute() == RET_OK)
     {
diff --git a/sc/source/ui/inc/PivotLayoutDialog.hxx b/sc/source/ui/inc/PivotLayoutDialog.hxx
index 4f4d37c..f27c47a 100644
--- a/sc/source/ui/inc/PivotLayoutDialog.hxx
+++ b/sc/source/ui/inc/PivotLayoutDialog.hxx
@@ -26,6 +26,8 @@
 #include "PivotLayoutTreeListData.hxx"
 #include "PivotLayoutTreeListLabel.hxx"
 
+#define TREELIST_APPEND ULONG_MAX
+
 class ScItemValue
 {
 public:
@@ -115,7 +117,7 @@ public:
 
     virtual void SetReference(const ScRange& rReferenceRange, ScDocument* pDocument) SAL_OVERRIDE;
     virtual void SetActive() SAL_OVERRIDE;
-    virtual bool IsRefInputMode() const SAL_OVERRIDE;
+    virtual sal_Bool IsRefInputMode() const SAL_OVERRIDE;
 
     void ItemInserted(ScItemValue* pItemValue, ScPivotLayoutTreeList::SvPivotTreeListType eType);
 
diff --git a/sc/source/ui/inc/PivotLayoutTreeList.hxx b/sc/source/ui/inc/PivotLayoutTreeList.hxx
index 7b805ac4..12ce1cc 100644
--- a/sc/source/ui/inc/PivotLayoutTreeList.hxx
+++ b/sc/source/ui/inc/PivotLayoutTreeList.hxx
@@ -19,7 +19,7 @@ class ScPivotLayoutTreeList : public ScPivotLayoutTreeListBase
 public:
     ScPivotLayoutTreeList(Window* pParent, WinBits nBits);
     virtual ~ScPivotLayoutTreeList();
-    virtual bool DoubleClickHdl() SAL_OVERRIDE;
+    virtual sal_Bool DoubleClickHdl() SAL_OVERRIDE;
 
     void Setup(ScPivotLayoutDialog* pParent, SvPivotTreeListType eType);
     void FillFields(ScPivotFieldVector& rFieldVector);
diff --git a/sc/source/ui/inc/PivotLayoutTreeListBase.hxx b/sc/source/ui/inc/PivotLayoutTreeListBase.hxx
index b8f226d..4de9e42 100644
--- a/sc/source/ui/inc/PivotLayoutTreeListBase.hxx
+++ b/sc/source/ui/inc/PivotLayoutTreeListBase.hxx
@@ -47,7 +47,7 @@ public:
     virtual ~ScPivotLayoutTreeListBase();
 
     virtual sal_Int8 AcceptDrop(const AcceptDropEvent& rEvent) SAL_OVERRIDE;
-    virtual bool NotifyAcceptDrop(SvTreeListEntry* pEntry) SAL_OVERRIDE;
+    virtual sal_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,
diff --git a/sc/source/ui/inc/PivotLayoutTreeListData.hxx b/sc/source/ui/inc/PivotLayoutTreeListData.hxx
index f7d9f5c..00ddee0 100644
--- a/sc/source/ui/inc/PivotLayoutTreeListData.hxx
+++ b/sc/source/ui/inc/PivotLayoutTreeListData.hxx
@@ -22,7 +22,7 @@ private:
 public:
     ScPivotLayoutTreeListData(Window* pParent, WinBits nBits);
     virtual ~ScPivotLayoutTreeListData();
-    virtual bool DoubleClickHdl() SAL_OVERRIDE;
+    virtual sal_Bool DoubleClickHdl() SAL_OVERRIDE;
 
     void FillDataField(ScPivotFieldVector& rDataFields);
     void PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames);
commit 51df84db04d4f01b45bc038fccf8876458b9fbb8
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Thu Apr 3 21:38:48 2014 +0200

    pivot: duplicate data field handling
    
    Change-Id: I3d367b8b638217f18143118df00324f21a0470f2

diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
index df2682c..4b101e5 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
@@ -88,15 +88,15 @@ bool ScPivotLayoutTreeListData::DoubleClickHdl()
 
     if (pDialog->Execute() == RET_OK)
     {
-        if (rCurrentFunctionData.mnFuncMask != pDialog->GetFuncMask())
-        {
-            rCurrentFunctionData.mnDupCount = rCurrentFunctionData.mnDupCount + 1;
-        }
-        rCurrentFunctionData.mnFuncMask = pCurrentLabelData->mnFuncMask = pDialog->GetFuncMask();
+        rCurrentFunctionData.mnFuncMask = pDialog->GetFuncMask();
+        pCurrentLabelData->mnFuncMask = pDialog->GetFuncMask();
+
         rCurrentFunctionData.maFieldRef = pDialog->GetFieldRef();
 
         ScDPLabelData* pDFData = mpParent->GetLabelData(rCurrentFunctionData.mnCol);
 
+        AdjustDuplicateCount(pCurrentItemValue);
+
         OUString sDataItemName = lclCreateDataItemName(
                                     rCurrentFunctionData.mnFuncMask,
                                     pDFData->maName,
@@ -132,15 +132,15 @@ void ScPivotLayoutTreeListData::FillDataField(ScPivotFieldVector& rDataFields)
 
         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);
+        AdjustDuplicateCount(pItemValue);
+        OUString sDataItemName = lclCreateDataItemName(pItemValue->maFunctionData.mnFuncMask,
+                                                       pItemValue->maName,
+                                                       pItemValue->maFunctionData.mnDupCount);
 
-        SvTreeListEntry* pEntry = InsertEntry(sDataItemName);
-        pEntry->SetUserData(pItemValue);
+        maDataItemValues.push_back(pItemValue);
+        InsertEntry(sDataItemName, NULL, false, TREELIST_APPEND, pItemValue);
     }
 }
 
@@ -205,6 +205,8 @@ void ScPivotLayoutTreeListData::InsertEntryForItem(ScItemValue* pItemValue, sal_
         rFunctionData.mnFuncMask = PIVOT_FUNC_SUM;
     }
 
+    AdjustDuplicateCount(pDataItemValue);
+
     OUString sDataName = lclCreateDataItemName(
                             rFunctionData.mnFuncMask,
                             pDataItemValue->maName,
@@ -213,6 +215,39 @@ void ScPivotLayoutTreeListData::InsertEntryForItem(ScItemValue* pItemValue, sal_
     InsertEntry(sDataName, NULL, sal_False, nPosition, pDataItemValue);
 }
 
+void ScPivotLayoutTreeListData::AdjustDuplicateCount(ScItemValue* pInputItemValue)
+{
+    ScPivotFuncData& rInputFunctionData = pInputItemValue->maFunctionData;
+
+    bool bFoundDuplicate = false;
+
+    rInputFunctionData.mnDupCount = 0;
+    sal_uInt8 nMaxDuplicateCount = 0;
+
+    SvTreeListEntry* pEachEntry;
+    for (pEachEntry = First(); pEachEntry != NULL; pEachEntry = Next(pEachEntry))
+    {
+        ScItemValue* pItemValue = (ScItemValue*) pEachEntry->GetUserData();
+        if (pItemValue == pInputItemValue)
+            continue;
+
+        ScPivotFuncData& rFunctionData = pItemValue->maFunctionData;
+
+        if (rFunctionData.mnCol      == rInputFunctionData.mnCol &&
+            rFunctionData.mnFuncMask == rInputFunctionData.mnFuncMask)
+        {
+            bFoundDuplicate = true;
+            if(rFunctionData.mnDupCount > nMaxDuplicateCount)
+                nMaxDuplicateCount = rFunctionData.mnDupCount;
+        }
+    }
+
+    if(bFoundDuplicate)
+    {
+        rInputFunctionData.mnDupCount = nMaxDuplicateCount + 1;
+    }
+}
+
 void ScPivotLayoutTreeListData::KeyInput(const KeyEvent& rKeyEvent)
 {
     KeyCode aCode = rKeyEvent.GetKeyCode();
diff --git a/sc/source/ui/inc/PivotLayoutTreeListData.hxx b/sc/source/ui/inc/PivotLayoutTreeListData.hxx
index d58b077..f7d9f5c 100644
--- a/sc/source/ui/inc/PivotLayoutTreeListData.hxx
+++ b/sc/source/ui/inc/PivotLayoutTreeListData.hxx
@@ -31,6 +31,8 @@ protected:
     virtual void InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* pTarget) SAL_OVERRIDE;
     virtual void InsertEntryForItem(ScItemValue* pItemValue, sal_uLong nPosition) SAL_OVERRIDE;
 
+    void AdjustDuplicateCount(ScItemValue* pInputItemValue);
+
     virtual void KeyInput(const KeyEvent& rKeyEvent) SAL_OVERRIDE;
 };
 
commit 6514d0c24955ab316b5e81b30b3c5854814e8876
Author: Tomaž Vajngerl <tomaz.vajngerl at 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 267b7f5..c5dcd93 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;
@@ -171,6 +175,7 @@ ScPivotLayoutDialog::ScPivotLayoutDialog(
 
     FillValuesToListBoxes();
 
+    // Initialize Options
     const ScDPSaveData* pSaveData = maPivotTableObject.GetSaveData();
     if (pSaveData == NULL)
     {
@@ -461,65 +466,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)
@@ -552,9 +600,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)
@@ -567,6 +615,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 8c76aff..bae0b63 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 82cd93a..df2682c 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 e5eb4aa..4f4d37c 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 49afbe5129ec593b4c0a2804ebf4c25c79c406e7
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Apr 2 19:37:46 2014 +0200

    Pivot dialog: Make it resemble the old dialog a bit.
    
    No idea what is best here :-) - MSO is more like what it was before this
    change, OTOH this layout looks more as the final pivot table, which (in my
    eyes) makes it easier to use.
    
    Conflicts:
    	sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui
    
    Change-Id: I5acb8c151139688c71b06d07006499513a17bdb9

diff --git a/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui b/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui
index e1a7b9e..90b62d6 100644
--- a/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui
+++ b/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
 <interface>
-  <requires lib="gtk+" version="3.0"/>
+  <!-- interface-requires gtk+ 3.0 -->
   <!-- interface-requires LibreOffice 1.0 -->
   <object class="GtkDialog" id="PivotTableLayout">
     <property name="can_focus">False</property>
@@ -68,281 +67,452 @@
           </packing>
         </child>
         <child>
-          <object class="GtkGrid" id="grid1">
+          <object class="GtkBox" id="box1">
             <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>
+            <property name="orientation">vertical</property>
+            <property name="spacing">6</property>
             <child>
-              <object class="GtkLabel" id="label1">
+              <object class="GtkBox" id="box2">
                 <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>
+                <property name="border_width">6</property>
+                <property name="spacing">6</property>
                 <child>
-                  <object class="scuilo-ScPivotLayoutTreeList" id="listbox-column">
-                    <property name="width_request">200</property>
-                    <property name="height_request">100</property>
+                  <object class="GtkGrid" id="grid7">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
+                    <property name="can_focus">False</property>
                     <property name="hexpand">True</property>
                     <property name="vexpand">True</property>
-                    <child internal-child="selection">
-                      <object class="GtkTreeSelection" id="Pivot Table List-selection6"/>
+                    <property name="row_spacing">6</property>
+                    <property name="column_spacing">6</property>
+                    <child>
+                      <object class="GtkBox" id="box4">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GtkLabel" id="label3">
+                            <property name="visible">True</property>
+                            <property name="can_focus">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="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <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-selection"/>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </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>
-                  </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 class="GtkBox" id="box5">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="vexpand">True</property>
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GtkLabel" id="label5">
+                            <property name="visible">True</property>
+                            <property name="can_focus">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="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="scuilo-ScPivotLayoutTreeListData" id="listbox-data">
+                            <property name="width_request">240</property>
+                            <property name="height_request">120</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 Data List-selection"/>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </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>
-              <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 class="GtkBox" id="box6">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GtkLabel" id="label4">
+                            <property name="visible">True</property>
+                            <property name="can_focus">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="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="scuilo-ScPivotLayoutTreeList" id="listbox-row">
+                            <property name="width_request">180</property>
+                            <property name="height_request">100</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="vexpand">True</property>
+                            <child internal-child="selection">
+                              <object class="GtkTreeSelection" id="Pivot Table List-selection4"/>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </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="GtkBox" id="box7">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GtkLabel" id="label2">
+                            <property name="visible">True</property>
+                            <property name="can_focus">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="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <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="Pivot Table List-selection5"/>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="left_attach">0</property>
+                        <property name="top_attach">0</property>
+                        <property name="width">2</property>
+                        <property name="height">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <placeholder/>
                     </child>
                   </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
                 </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>
+                  <object class="GtkBox" id="box3">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="hexpand">True</property>
+                    <property name="can_focus">False</property>
                     <property name="vexpand">True</property>
-                    <child internal-child="selection">
-                      <object class="GtkTreeSelection" id="Tree List-selection1"/>
+                    <property name="orientation">vertical</property>
+                    <property name="spacing">6</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="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="scuilo-ScPivotLayoutTreeListLabel" id="listbox-fields">
+                        <property name="width_request">180</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 Label List-selection"/>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
                     </child>
                   </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
                 </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>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="label5">
+              <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="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>
+                <property name="hexpand">True</property>
+                <property name="label" translatable="yes">Drag the items into the desired position</property>
                 <attributes>
-                  <attribute name="weight" value="bold"/>
+                  <attribute name="underline" value="True"/>
                 </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>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
               </packing>
             </child>
             <child>
-              <object class="GtkScrolledWindow" id="scrolledwindow5">
+              <object class="GtkExpander" id="expander2">
                 <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>
+                  <object class="GtkGrid" id="grid5">
                     <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"/>
+                    <property name="can_focus">False</property>
+                    <property name="margin_left">12</property>
+                    <property name="border_width">12</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="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="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="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="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="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="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>
+                <child type="label">
+                  <object class="GtkLabel" id="label11">
+                    <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">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>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
               </packing>
             </child>
             <child>
@@ -353,6 +523,7 @@
                   <object class="GtkGrid" id="grid2">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
+                    <property name="margin_left">12</property>
                     <property name="hexpand">True</property>
                     <property name="vexpand">True</property>
                     <property name="row_spacing">6</property>
@@ -385,7 +556,6 @@
                                     <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>
@@ -403,7 +573,6 @@
                                     <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>
@@ -419,6 +588,8 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="hexpand">True</property>
+                                    <property name="invisible_char">●</property>
+                                    <property name="invisible_char_set">True</property>
                                   </object>
                                   <packing>
                                     <property name="left_attach">1</property>
@@ -431,7 +602,7 @@
                                   <object class="foruilo-RefButton" id="destination-button">
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
-                                    <property name="receives_default">False</property>
+                                    <property name="receives_default">True</property>
                                   </object>
                                   <packing>
                                     <property name="left_attach">2</property>
@@ -459,7 +630,6 @@
                                     <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>
@@ -535,6 +705,8 @@
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="hexpand">True</property>
+                                    <property name="invisible_char">●</property>
+                                    <property name="invisible_char_set">True</property>
                                   </object>
                                   <packing>
                                     <property name="left_attach">1</property>
@@ -547,7 +719,7 @@
                                   <object class="foruilo-RefButton" id="source-button">
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
-                                    <property name="receives_default">False</property>
+                                    <property name="receives_default">True</property>
                                   </object>
                                   <packing>
                                     <property name="left_attach">2</property>
@@ -621,159 +793,9 @@
                 </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>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">3</property>
               </packing>
             </child>
           </object>
@@ -785,5 +807,10 @@
         </child>
       </object>
     </child>
+    <action-widgets>
+      <action-widget response="0">ok</action-widget>
+      <action-widget response="0">apply</action-widget>
+      <action-widget response="0">close</action-widget>
+    </action-widgets>
   </object>
 </interface>
commit 48d54caa57760c85f9492430db2d81417390aea6
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Mon Mar 31 10:10:25 2014 +0200

    pivot layout dialog: remove SAL_OVERRIDE from destructors
    
    Change-Id: Icdb048a2ad9c49308213c3bb57f540e4ff567593

diff --git a/sc/source/ui/inc/PivotLayoutDialog.hxx b/sc/source/ui/inc/PivotLayoutDialog.hxx
index b3eaa14..e5eb4aa 100644
--- a/sc/source/ui/inc/PivotLayoutDialog.hxx
+++ b/sc/source/ui/inc/PivotLayoutDialog.hxx
@@ -111,7 +111,7 @@ private:
 public:
     ScPivotLayoutDialog(SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, Window* pParent,
                              ScViewData* pViewData, const ScDPObject* pPivotTableObject, bool bCreateNewPivotTable);
-    virtual ~ScPivotLayoutDialog() SAL_OVERRIDE;
+    virtual ~ScPivotLayoutDialog();
 
     virtual void SetReference(const ScRange& rReferenceRange, ScDocument* pDocument) SAL_OVERRIDE;
     virtual void SetActive() SAL_OVERRIDE;
diff --git a/sc/source/ui/inc/PivotLayoutTreeList.hxx b/sc/source/ui/inc/PivotLayoutTreeList.hxx
index 00caefe..7b805ac4 100644
--- a/sc/source/ui/inc/PivotLayoutTreeList.hxx
+++ b/sc/source/ui/inc/PivotLayoutTreeList.hxx
@@ -18,7 +18,7 @@ class ScPivotLayoutTreeList : public ScPivotLayoutTreeListBase
 {
 public:
     ScPivotLayoutTreeList(Window* pParent, WinBits nBits);
-    virtual ~ScPivotLayoutTreeList() SAL_OVERRIDE;
+    virtual ~ScPivotLayoutTreeList();
     virtual bool DoubleClickHdl() SAL_OVERRIDE;
 
     void Setup(ScPivotLayoutDialog* pParent, SvPivotTreeListType eType);
diff --git a/sc/source/ui/inc/PivotLayoutTreeListBase.hxx b/sc/source/ui/inc/PivotLayoutTreeListBase.hxx
index b44303f..b8f226d 100644
--- a/sc/source/ui/inc/PivotLayoutTreeListBase.hxx
+++ b/sc/source/ui/inc/PivotLayoutTreeListBase.hxx
@@ -44,7 +44,7 @@ public:
     void Setup(ScPivotLayoutDialog* pParent);
 
     ScPivotLayoutTreeListBase(Window* pParent, WinBits nBits, SvPivotTreeListType eType = UNDEFINED);
-    virtual ~ScPivotLayoutTreeListBase() SAL_OVERRIDE;
+    virtual ~ScPivotLayoutTreeListBase();
 
     virtual sal_Int8 AcceptDrop(const AcceptDropEvent& rEvent) SAL_OVERRIDE;
     virtual bool NotifyAcceptDrop(SvTreeListEntry* pEntry) SAL_OVERRIDE;
diff --git a/sc/source/ui/inc/PivotLayoutTreeListData.hxx b/sc/source/ui/inc/PivotLayoutTreeListData.hxx
index d6a9953..8ba5569 100644
--- a/sc/source/ui/inc/PivotLayoutTreeListData.hxx
+++ b/sc/source/ui/inc/PivotLayoutTreeListData.hxx
@@ -21,7 +21,7 @@ private:
 
 public:
     ScPivotLayoutTreeListData(Window* pParent, WinBits nBits);
-    virtual ~ScPivotLayoutTreeListData() SAL_OVERRIDE;
+    virtual ~ScPivotLayoutTreeListData();
     virtual bool DoubleClickHdl() SAL_OVERRIDE;
 
     void FillDataField(ScPivotFieldVector& rDataFields);
diff --git a/sc/source/ui/inc/PivotLayoutTreeListLabel.hxx b/sc/source/ui/inc/PivotLayoutTreeListLabel.hxx
index 6a13906..7eb8f52 100644
--- a/sc/source/ui/inc/PivotLayoutTreeListLabel.hxx
+++ b/sc/source/ui/inc/PivotLayoutTreeListLabel.hxx
@@ -22,7 +22,7 @@ private:
 
 public:
     ScPivotLayoutTreeListLabel(Window* pParent, WinBits nBits);
-    virtual ~ScPivotLayoutTreeListLabel() SAL_OVERRIDE;
+    virtual ~ScPivotLayoutTreeListLabel();
     void FillLabelFields(ScDPLabelDataVector& rLabelVector);
     ScItemValue* GetItem(SCCOL nColumn);
     bool IsDataItem(SCCOL nColumn);
commit c1dcce3113f34d409fbac0ee7ba6da5b4e0f3fb8
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Sun Mar 30 21:12:27 2014 +0200

    pivot: new pivot table layout dialog
    
    This commit adds a new pivot table layout dialog which was implemented
    from scratch. Instead of custom controls this one uses list boxes
    for field entries which greatly reduces the code. It also fixes
    some visual and behaviour bugs and adds the possibility to edit the
    "Data" field.
    
    Conflicts:
    	sc/UIConfig_scalc.mk
    
    Change-Id: I6c01252acee5a2e8910e40e65904504d00e03057

diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index 55da1eb..eba8080 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -439,6 +439,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 b7041b8..9ec6b96 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -396,6 +396,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 8f28b61..b41ae0f 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -106,6 +106,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
 	sc/uiconfig/scalc/ui/optsortlists \
 	sc/uiconfig/scalc/ui/pagetemplatedialog \
 	sc/uiconfig/scalc/ui/paratemplatedialog \
+	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 0000000..267b7f5
--- /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:

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list