summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/xmloff/xmltoken.hxx1
-rw-r--r--sc/inc/dpsave.hxx1
-rw-r--r--sc/source/core/data/dpsave.cxx13
-rw-r--r--sc/source/filter/xml/XMLExportDataPilot.cxx12
-rw-r--r--sc/source/filter/xml/xmldpimp.cxx11
-rw-r--r--sc/source/filter/xml/xmlimprt.cxx1
-rw-r--r--sc/source/filter/xml/xmlimprt.hxx1
-rw-r--r--xmloff/source/core/xmltoken.cxx1
8 files changed, 40 insertions, 1 deletions
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 64a0826632b2..4ad2936c0610 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -994,6 +994,7 @@ namespace xmloff { namespace token {
XML_IDEOGRAPH_ALPHA,
XML_IGNORE_CASE,
XML_IGNORE_EMPTY_ROWS,
+ XML_IGNORE_SELECTED_PAGE, // used for ODF compatibility
XML_ILLUSTRATION_INDEX,
XML_ILLUSTRATION_INDEX_ENTRY_TEMPLATE,
XML_ILLUSTRATION_INDEX_SOURCE,
diff --git a/sc/inc/dpsave.hxx b/sc/inc/dpsave.hxx
index 20d5ffb3867e..9973b991faee 100644
--- a/sc/inc/dpsave.hxx
+++ b/sc/inc/dpsave.hxx
@@ -203,6 +203,7 @@ public:
void SetLayoutInfo(const ::com::sun::star::sheet::DataPilotFieldLayoutInfo* pNew);
void SetCurrentPage( const OUString* pPage ); // NULL = no selection (all)
+ OUString GetCurrentPage() const; // only for ODF compatibility
sal_uInt16 GetOrientation() const
{ return nOrientation; }
diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx
index 93e98399d181..fc8651536825 100644
--- a/sc/source/core/data/dpsave.cxx
+++ b/sc/source/core/data/dpsave.cxx
@@ -509,6 +509,19 @@ void ScDPSaveDimension::SetCurrentPage( const OUString* pPage )
}
}
+OUString ScDPSaveDimension::GetCurrentPage() const
+{
+ MemberList::const_iterator it = maMemberList.begin(), itEnd = maMemberList.end();
+ for (; it != itEnd; ++it)
+ {
+ const ScDPSaveMember* pMem = *it;
+ if (pMem->GetIsVisible())
+ return pMem->GetName();
+ }
+
+ return OUString();
+}
+
ScDPSaveMember* ScDPSaveDimension::GetExistingMemberByName(const OUString& rName)
{
MemberHash::const_iterator res = maMemberHash.find (rName);
diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx b/sc/source/filter/xml/XMLExportDataPilot.cxx
index 09a33908e2fe..793bec5de0a8 100644
--- a/sc/source/filter/xml/XMLExportDataPilot.cxx
+++ b/sc/source/filter/xml/XMLExportDataPilot.cxx
@@ -690,8 +690,9 @@ void ScXMLExportDataPilot::WriteDimension(ScDPSaveDimension* pDim, const ScDPDim
if (pDim->IsDataLayout())
rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_IS_DATA_LAYOUT_FIELD, XML_TRUE);
OUString sValueStr;
+ sheet::DataPilotFieldOrientation eOrientation = (sheet::DataPilotFieldOrientation) pDim->GetOrientation();
ScXMLConverter::GetStringFromOrientation( sValueStr,
- (sheet::DataPilotFieldOrientation) pDim->GetOrientation() );
+ eOrientation);
if( !sValueStr.isEmpty() )
rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_ORIENTATION, sValueStr );
if (pDim->GetUsedHierarchy() != 1)
@@ -704,6 +705,15 @@ void ScXMLExportDataPilot::WriteDimension(ScDPSaveDimension* pDim, const ScDPDim
(sheet::GeneralFunction) pDim->GetFunction() );
rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_FUNCTION, sValueStr);
+ if (eOrientation == sheet::DataPilotFieldOrientation_PAGE)
+ {
+ if (rExport.getDefaultVersion() > SvtSaveOptions::ODFVER_012)
+ {
+ rExport.AddAttribute(XML_NAMESPACE_LO_EXT, XML_IGNORE_SELECTED_PAGE, "true");
+ }
+ rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_SELECTED_PAGE, pDim->GetCurrentPage());
+ }
+
SvXMLElementExport aElemDPF(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_FIELD, true, true);
WriteLevels(pDim);
WriteFieldReference(pDim);
diff --git a/sc/source/filter/xml/xmldpimp.cxx b/sc/source/filter/xml/xmldpimp.cxx
index c080158c301a..0ee00a0320fc 100644
--- a/sc/source/filter/xml/xmldpimp.cxx
+++ b/sc/source/filter/xml/xmldpimp.cxx
@@ -1000,6 +1000,7 @@ ScXMLDataPilotFieldContext::ScXMLDataPilotFieldContext( ScXMLImport& rImport,
{
bool bHasName = false;
bool bDataLayout = false;
+ bool bIgnoreSelectedPage = false;
OUString aDisplayName;
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetDataPilotFieldAttrTokenMap();
@@ -1046,6 +1047,11 @@ ScXMLDataPilotFieldContext::ScXMLDataPilotFieldContext( ScXMLImport& rImport,
bSelectedPage = true;
}
break;
+ case XML_TOK_DATA_PILOT_FIELD_ATTR_IGNORE_SELECTED_PAGE:
+ {
+ bIgnoreSelectedPage = true;
+ }
+ break;
case XML_TOK_DATA_PILOT_FIELD_ATTR_USED_HIERARCHY :
{
nUsedHierarchy = sValue.toInt32();
@@ -1053,6 +1059,11 @@ ScXMLDataPilotFieldContext::ScXMLDataPilotFieldContext( ScXMLImport& rImport,
break;
}
}
+
+ // use the new extension elements
+ if (bIgnoreSelectedPage)
+ bSelectedPage = false;
+
if (bHasName)
{
pDim = new ScDPSaveDimension(sName, bDataLayout);
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 72fd4fbe84f0..695f84799136 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -1682,6 +1682,7 @@ const SvXMLTokenMap& ScXMLImport::GetDataPilotFieldAttrTokenMap()
{ XML_NAMESPACE_TABLE, XML_FUNCTION, XML_TOK_DATA_PILOT_FIELD_ATTR_FUNCTION },
{ XML_NAMESPACE_TABLE, XML_ORIENTATION, XML_TOK_DATA_PILOT_FIELD_ATTR_ORIENTATION },
{ XML_NAMESPACE_TABLE, XML_SELECTED_PAGE, XML_TOK_DATA_PILOT_FIELD_ATTR_SELECTED_PAGE },
+ { XML_NAMESPACE_LO_EXT, XML_IGNORE_SELECTED_PAGE, XML_TOK_DATA_PILOT_FIELD_ATTR_IGNORE_SELECTED_PAGE },
{ XML_NAMESPACE_TABLE, XML_USED_HIERARCHY, XML_TOK_DATA_PILOT_FIELD_ATTR_USED_HIERARCHY },
XML_TOKEN_MAP_END
};
diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx
index 53435a898aff..766ab01a6927 100644
--- a/sc/source/filter/xml/xmlimprt.hxx
+++ b/sc/source/filter/xml/xmlimprt.hxx
@@ -640,6 +640,7 @@ enum ScXMLDataPilotFieldAttrTokens
XML_TOK_DATA_PILOT_FIELD_ATTR_FUNCTION,
XML_TOK_DATA_PILOT_FIELD_ATTR_ORIENTATION,
XML_TOK_DATA_PILOT_FIELD_ATTR_SELECTED_PAGE,
+ XML_TOK_DATA_PILOT_FIELD_ATTR_IGNORE_SELECTED_PAGE,
XML_TOK_DATA_PILOT_FIELD_ATTR_USED_HIERARCHY
};
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index eb88687553ce..2f7352d9de27 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -999,6 +999,7 @@ namespace xmloff { namespace token {
TOKEN( "ideograph-alpha", XML_IDEOGRAPH_ALPHA ),
TOKEN( "ignore-case", XML_IGNORE_CASE ),
TOKEN( "ignore-empty-rows", XML_IGNORE_EMPTY_ROWS ),
+ TOKEN( "ignore-selected-page", XML_IGNORE_SELECTED_PAGE ),
TOKEN( "illustration-index", XML_ILLUSTRATION_INDEX ),
TOKEN( "illustration-index-entry-template", XML_ILLUSTRATION_INDEX_ENTRY_TEMPLATE ),
TOKEN( "illustration-index-source", XML_ILLUSTRATION_INDEX_SOURCE ),