[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Wed Dec 11 08:10:45 PST 2013
sc/source/filter/xml/xmldpimp.cxx | 33 ++++++++++++++++++++++++++++++++-
sc/source/filter/xml/xmldpimp.hxx | 7 +++++++
2 files changed, 39 insertions(+), 1 deletion(-)
New commits:
commit 5618ac8ccddbff67b4b27a9c08f97d3bf2bcec3f
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Tue Dec 10 12:50:48 2013 -0500
fdo#66969: Set selected page name after building all dimension members.
Because the new implementation relies on the visiblity flag of the
dimension members, they need to exist before setting currently selected
page, which is still used in documents generated by the older version of
LibreOffice.
Change-Id: I6cec5fd3d2165f714fc01b596d3761890d87a4ff
(cherry picked from commit 2e1b90a4272defb917b23e2e360e171114d6fa4d)
Reviewed-on: https://gerrit.libreoffice.org/7027
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
diff --git a/sc/source/filter/xml/xmldpimp.cxx b/sc/source/filter/xml/xmldpimp.cxx
index 83f58f7..825060c 100644
--- a/sc/source/filter/xml/xmldpimp.cxx
+++ b/sc/source/filter/xml/xmldpimp.cxx
@@ -412,6 +412,11 @@ void ScXMLDataPilotTableContext::SetButtons()
pDPObject->RefreshAfterLoad();
}
+void ScXMLDataPilotTableContext::SetSelectedPage( const OUString& rDimName, const OUString& rSelected )
+{
+ maSelectedPages.insert(SelectedPagesType::value_type(rDimName, rSelected));
+}
+
void ScXMLDataPilotTableContext::AddDimension(ScDPSaveDimension* pDim)
{
if (pDPSave)
@@ -548,10 +553,36 @@ void ScXMLDataPilotTableContext::EndElement()
if ( pDPCollection->GetByName(pDPObject->GetName()) )
pDPObject->SetName( String() ); // ignore the invalid name, create a new name in AfterXMLLoading
+ ProcessSelectedPages();
+
pDPCollection->InsertNewTable(pDPObject);
SetButtons();
}
+void ScXMLDataPilotTableContext::ProcessSelectedPages()
+{
+ // Set selected pages after building all dimension members.
+ if (!pDPObject)
+ return;
+
+ pDPObject->BuildAllDimensionMembers();
+ ScDPSaveData* pSaveData = pDPObject->GetSaveData();
+ if (!pSaveData)
+ return;
+
+ SelectedPagesType::const_iterator it = maSelectedPages.begin(), itEnd = maSelectedPages.end();
+ for (; it != itEnd; ++it)
+ {
+ const OUString& rDimName = it->first;
+ const OUString& rSelected = it->second;
+ ScDPSaveDimension* pDim = pSaveData->GetExistingDimensionByName(rDimName);
+ if (!pDim)
+ continue;
+
+ pDim->SetCurrentPage(&rSelected);
+ }
+}
+
void ScXMLDataPilotTableContext::SetGrandTotal(
XMLTokenEnum eOrientation, bool bVisible, const OUString& rDisplayName)
{
@@ -1111,7 +1142,7 @@ void ScXMLDataPilotFieldContext::EndElement()
pDim->SetOrientation(nOrientation);
if (bSelectedPage)
{
- pDim->SetCurrentPage(&sSelectedPage);
+ pDataPilotTable->SetSelectedPage(pDim->GetName(), sSelectedPage);
}
pDataPilotTable->AddDimension(pDim);
if (bIsGroupField)
diff --git a/sc/source/filter/xml/xmldpimp.hxx b/sc/source/filter/xml/xmldpimp.hxx
index 1aa851d..32f878d 100644
--- a/sc/source/filter/xml/xmldpimp.hxx
+++ b/sc/source/filter/xml/xmldpimp.hxx
@@ -71,6 +71,8 @@ public:
class ScXMLDataPilotTableContext : public SvXMLImportContext
{
+ typedef boost::unordered_map<OUString, OUString, OUStringHash> SelectedPagesType;
+
struct GrandTotalItem
{
OUString maDisplayName;
@@ -114,9 +116,13 @@ class ScXMLDataPilotTableContext : public SvXMLImportContext
bool bDrillDown:1;
bool bHeaderGridLayout:1;
+ SelectedPagesType maSelectedPages;
+
const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
+ void ProcessSelectedPages();
+
public:
ScXMLDataPilotTableContext( ScXMLImport& rImport, sal_uInt16 nPrfx,
@@ -151,6 +157,7 @@ public:
void AddGroupDim(const ScDPSaveNumGroupDimension& aNumGroupDim);
void AddGroupDim(const ScDPSaveGroupDimension& aGroupDim);
void SetButtons();
+ void SetSelectedPage( const OUString& rDimName, const OUString& rSelected );
};
class ScXMLDPSourceSQLContext : public SvXMLImportContext
More information about the Libreoffice-commits
mailing list