summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngrid Halama <iha@openoffice.org>2010-04-01 20:29:01 +0200
committerIngrid Halama <iha@openoffice.org>2010-04-01 20:29:01 +0200
commit5b0fcb960d8b6d49faf40a442b69036bd8efa688 (patch)
tree7ee7b8f462480a93285b4c8029acbfe7d4496000
parentf549461066693eb19fdf8bbb4139bcb5e70eca77 (diff)
chartpositioning: #i100778# correct ODF behaviour
-rw-r--r--xmloff/inc/SchXMLImport.hxx1
-rw-r--r--xmloff/inc/xmlnmspe.hxx3
-rw-r--r--xmloff/inc/xmloff/xmltoken.hxx2
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx12
-rw-r--r--xmloff/source/chart/SchXMLImport.cxx3
-rw-r--r--xmloff/source/chart/SchXMLPlotAreaContext.cxx16
-rw-r--r--xmloff/source/chart/SchXMLTools.cxx4
-rw-r--r--xmloff/source/chart/SchXMLTools.hxx2
-rw-r--r--xmloff/source/core/xmltoken.cxx2
9 files changed, 27 insertions, 18 deletions
diff --git a/xmloff/inc/SchXMLImport.hxx b/xmloff/inc/SchXMLImport.hxx
index 1e1089805a28..065b268b3b46 100644
--- a/xmloff/inc/SchXMLImport.hxx
+++ b/xmloff/inc/SchXMLImport.hxx
@@ -69,6 +69,7 @@ enum SchXMLChartElemTokenMap
enum SchXMLPlotAreaElemTokenMap
{
+ XML_TOK_PA_EXCLUDING_POSITION_EXT,
XML_TOK_PA_EXCLUDING_POSITION,
XML_TOK_PA_AXIS,
XML_TOK_PA_SERIES,
diff --git a/xmloff/inc/xmlnmspe.hxx b/xmloff/inc/xmlnmspe.hxx
index 49c484a1ab17..e7891b36ef17 100644
--- a/xmloff/inc/xmlnmspe.hxx
+++ b/xmloff/inc/xmlnmspe.hxx
@@ -87,8 +87,9 @@ const sal_uInt16 XML_NAMESPACE_##prefix##_EXT_IDX = key;
XML_NAMESPACE_EXT( OFFICE, 37U )
XML_NAMESPACE_EXT( TABLE, 38U )
+XML_NAMESPACE_EXT( CHART, 39U )
-#define _XML_OLD_NAMESPACE_BASE 39U
+#define _XML_OLD_NAMESPACE_BASE 40U
// namespaces used in the technical preview (SO 5.2)
XML_OLD_NAMESPACE( FO, 0U )
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
index ccb3adf74941..681aaaeff82e 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -3096,6 +3096,8 @@ namespace xmloff { namespace token {
XML_DOES_NOT_END_WITH,
//chart
+ XML_NP_CHART_EXT,
+ XML_N_CHART_EXT,
XML_EXCLUDING_POSITION,
XML_PREFER_EXCLUDING_POSITION,
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index 51541c6df637..cc281c165cb3 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -2085,6 +2085,12 @@ void SchXMLExportHelper_Impl::exportPlotArea(
void SchXMLExportHelper_Impl::exportExcludingPosition( const uno::Reference< chart::XDiagram >& xDiagram )
{
+ const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() );
+ if( nCurrentODFVersion <= SvtSaveOptions::ODFVER_012 )//do not export to ODF 1.2 or older
+ return;
+ if( nCurrentODFVersion != SvtSaveOptions::ODFVER_LATEST )//export only if extensions are enabled //todo: change this dependent on fileformat evolution
+ return;
+
Reference< chart::XDiagramPositioning > xDiaPos( xDiagram, uno::UNO_QUERY );
DBG_ASSERT( xDiaPos.is(), "Invalid xDiaPos as parameter" );
if( !xDiaPos.is() )
@@ -2098,9 +2104,9 @@ void SchXMLExportHelper_Impl::exportExcludingPosition( const uno::Reference< cha
rtl::OUStringBuffer sStringBuffer;
SvXMLUnitConverter::convertBool( sStringBuffer, bPreferExcludingPositioning );
String aString( sStringBuffer.makeStringAndClear() );
- mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_PREFER_EXCLUDING_POSITION, aString );
+ mrExport.AddAttribute( XML_NAMESPACE_CHART_EXT, XML_PREFER_EXCLUDING_POSITION, aString );//todo: change to chart namespace in future - dependent on fileformat
- SvXMLElementExport aExcludingPosition( mrExport, XML_NAMESPACE_CHART, XML_EXCLUDING_POSITION, sal_True, sal_True );
+ SvXMLElementExport aExcludingPosition( mrExport, XML_NAMESPACE_CHART_EXT, XML_EXCLUDING_POSITION, sal_True, sal_True );//todo: change to chart namespace in future - dependent on fileformat
}
void SchXMLExportHelper_Impl::exportAxes(
@@ -3646,6 +3652,8 @@ SchXMLExport::SchXMLExport(
maAutoStylePool( *this ),
maExportHelper( *this, maAutoStylePool )
{
+ if( getDefaultVersion() == SvtSaveOptions::ODFVER_LATEST )
+ _GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART_EXT), GetXMLToken(XML_N_CHART_EXT), XML_NAMESPACE_CHART_EXT);
}
diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx
index 2fc23926ef1e..501f92953663 100644
--- a/xmloff/source/chart/SchXMLImport.cxx
+++ b/xmloff/source/chart/SchXMLImport.cxx
@@ -281,6 +281,7 @@ const SvXMLTokenMap& SchXMLImportHelper::GetPlotAreaElemTokenMap()
{
static __FAR_DATA SvXMLTokenMapEntry aPlotAreaElemTokenMap[] =
{
+ { XML_NAMESPACE_CHART_EXT, XML_EXCLUDING_POSITION, XML_TOK_PA_EXCLUDING_POSITION_EXT },
{ XML_NAMESPACE_CHART, XML_EXCLUDING_POSITION, XML_TOK_PA_EXCLUDING_POSITION },
{ XML_NAMESPACE_CHART, XML_AXIS, XML_TOK_PA_AXIS },
{ XML_NAMESPACE_CHART, XML_SERIES, XML_TOK_PA_SERIES },
@@ -658,6 +659,7 @@ SchXMLImport::SchXMLImport(
SvXMLImport( xServiceFactory, nImportFlags )
{
GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART_EXT), GetXMLToken(XML_N_CHART_EXT), XML_NAMESPACE_CHART_EXT);
mbIsGraphicLoadOnDemandSupported = false;
}
@@ -671,6 +673,7 @@ SchXMLImport::SchXMLImport(
: SvXMLImport( xServiceFactory, xModel, rGrfContainer )
{
GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
+ GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART_EXT), GetXMLToken(XML_N_CHART_EXT), XML_NAMESPACE_CHART_EXT);
// get status indicator (if requested)
if( bShowProgress )
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
index 8f0767c3b6b9..3792deefebbd 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -520,6 +520,7 @@ SvXMLImportContext* SchXMLPlotAreaContext::CreateChildContext(
switch( rTokenMap.Get( nPrefix, rLocalName ))
{
+ case XML_TOK_PA_EXCLUDING_POSITION_EXT:
case XML_TOK_PA_EXCLUDING_POSITION:
{
pContext = new SchXMLExcludingPositionContext( GetImport(), nPrefix, rLocalName, m_aInnerPositioning );
@@ -703,7 +704,7 @@ void SchXMLPlotAreaContext::EndElement()
}
else if( bOuterSize )
{
- if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan3_4( GetImport().GetModel() ) ) //old version of OOo did write a wrong rectangle for the diagram size
+ if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan3_3( GetImport().GetModel() ) ) //old version of OOo did write a wrong rectangle for the diagram size
xDiaPos->setDiagramPositionIncludingAxesAndAxisTitles( m_aOuterPositioning.getRectangle() );
else
xDiaPos->setDiagramPositionIncludingAxes( m_aOuterPositioning.getRectangle() );
@@ -1743,18 +1744,11 @@ bool SchXMLPositonAttributesHelper::readPositioningAttribute( sal_uInt16 nPrefix
else
bReturn = false;
}
- else if( XML_NAMESPACE_CHART == nPrefix )
+ else if( IsXMLToken( rLocalName, XML_PREFER_EXCLUDING_POSITION ) )
{
- //Attribute( XML_NAMESPACE_CHART, XML_PREFER_EXCLUDING_POSITION
-
sal_Bool bPreferExcludingPosition = false;
- if( IsXMLToken( rLocalName, XML_PREFER_EXCLUDING_POSITION ) )
- {
- m_rImport.GetMM100UnitConverter().convertBool( bPreferExcludingPosition, rValue );
- m_bAutoPosition = m_bAutoSize = !bPreferExcludingPosition;
- }
- else
- bReturn = false;
+ m_rImport.GetMM100UnitConverter().convertBool( bPreferExcludingPosition, rValue );
+ m_bAutoPosition = m_bAutoSize = !bPreferExcludingPosition;
}
else
bReturn = false;
diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx
index f836f1c1de7c..c6fb4d0ca013 100644
--- a/xmloff/source/chart/SchXMLTools.cxx
+++ b/xmloff/source/chart/SchXMLTools.cxx
@@ -705,7 +705,7 @@ void setBuildIDAtImportInfo( uno::Reference< frame::XModel > xModel, Reference<
SvXMLMetaDocumentContext::setBuildId( aGenerator, xImportInfo );
}
-bool isDocumentGeneratedWithOpenOfficeOlderThan3_4( const uno::Reference< frame::XModel >& xChartModel )
+bool isDocumentGeneratedWithOpenOfficeOlderThan3_3( const uno::Reference< frame::XModel >& xChartModel )
{
bool bResult = isDocumentGeneratedWithOpenOfficeOlderThan3_0( xChartModel );
if( !bResult )
@@ -719,8 +719,6 @@ bool isDocumentGeneratedWithOpenOfficeOlderThan3_4( const uno::Reference< frame:
bResult= true;
else if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/320m") ) ) != -1 )
bResult= true;
- else if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/330m") ) ) != -1 )
- bResult= true;
}
}
return bResult;
diff --git a/xmloff/source/chart/SchXMLTools.hxx b/xmloff/source/chart/SchXMLTools.hxx
index 4912eb5d286e..382e6c5cc16f 100644
--- a/xmloff/source/chart/SchXMLTools.hxx
+++ b/xmloff/source/chart/SchXMLTools.hxx
@@ -54,7 +54,7 @@ namespace SchXMLTools
bool isDocumentGeneratedWithOpenOfficeOlderThan2_3( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
bool isDocumentGeneratedWithOpenOfficeOlderThan2_4( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
bool isDocumentGeneratedWithOpenOfficeOlderThan3_0( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
- bool isDocumentGeneratedWithOpenOfficeOlderThan3_4( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
+ bool isDocumentGeneratedWithOpenOfficeOlderThan3_3( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel);
void setBuildIDAtImportInfo( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel
, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xImportInfo );
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 7ea75b1868d3..2fb65535964c 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3096,6 +3096,8 @@ namespace xmloff { namespace token {
TOKEN( "ends-with", XML_ENDS_WITH ),
TOKEN( "does-not-end-with", XML_DOES_NOT_END_WITH ),
+ TOKEN( "chartooo", XML_NP_CHART_EXT ),
+ TOKEN( "http://openoffice.org/2010/chart", XML_N_CHART_EXT ),
TOKEN( "excluding-position", XML_EXCLUDING_POSITION ),
TOKEN( "prefer-excluding-position", XML_PREFER_EXCLUDING_POSITION ),