diff options
author | Thomas Benisch <tbe@openoffice.org> | 2010-09-29 17:20:24 +0200 |
---|---|---|
committer | Thomas Benisch <tbe@openoffice.org> | 2010-09-29 17:20:24 +0200 |
commit | bcb76b83b7ac714d5476e7f066f465a4bfb88b77 (patch) | |
tree | 920cdab0db87ac8d61988f37b1716f7eead07149 /xmloff | |
parent | 9880b2493d6ee7057a67d011d937096b604ab5dd (diff) | |
parent | bd1092ebc0b329883d1c079d598a73f3af4cd548 (diff) |
chartextensibility: merge with DEV300_m88
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/inc/xmloff/xmltoken.hxx | 6 | ||||
-rw-r--r-- | xmloff/source/chart/PropertyMap.hxx | 2 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLExport.cxx | 42 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLTableContext.cxx | 70 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLTools.cxx | 23 | ||||
-rw-r--r-- | xmloff/source/chart/SchXMLTools.hxx | 2 | ||||
-rw-r--r-- | xmloff/source/core/RDFaExportHelper.cxx | 37 | ||||
-rw-r--r-- | xmloff/source/core/xmltoken.cxx | 10 | ||||
-rw-r--r-- | xmloff/source/draw/ximpcustomshape.cxx | 1 | ||||
-rw-r--r-- | xmloff/source/text/XMLTextMarkImportContext.cxx | 1 |
10 files changed, 166 insertions, 28 deletions
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx index d892c10f4f5d..80238a075973 100644 --- a/xmloff/inc/xmloff/xmltoken.hxx +++ b/xmloff/inc/xmloff/xmltoken.hxx @@ -3107,6 +3107,12 @@ namespace xmloff { namespace token { XML_N_CHART_EXT, XML_COORDINATE_REGION, + XML_DIAGONAL_BL_TR_WIDTHS, + XML_DIAGONAL_TL_BR_WIDTHS, + + XML_OUTSIDE_MINIMUM,//#i114142# + XML_OUTSIDE_MAXIMUM,//#i114142# + XML_TOKEN_END }; diff --git a/xmloff/source/chart/PropertyMap.hxx b/xmloff/source/chart/PropertyMap.hxx index 0616040148b5..79a59ab6910f 100644 --- a/xmloff/source/chart/PropertyMap.hxx +++ b/xmloff/source/chart/PropertyMap.hxx @@ -223,6 +223,8 @@ SvXMLEnumMapEntry aXMLChartAxisLabelPositionEnumMap[] = { ::xmloff::token::XML_NEAR_AXIS_OTHER_SIDE, ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS_OTHER_SIDE }, { ::xmloff::token::XML_OUTSIDE_START, ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START }, { ::xmloff::token::XML_OUTSIDE_END, ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END }, + { ::xmloff::token::XML_OUTSIDE_MINIMUM, ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START },//#i114142# + { ::xmloff::token::XML_OUTSIDE_MAXIMUM, ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END },//#i114142# { ::xmloff::token::XML_TOKEN_INVALID, 0 } }; diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index b9d9a20b336a..a5cb0a1f8ec3 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -1703,20 +1703,16 @@ void SchXMLExportHelper_Impl::exportTable() { mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_STRING ); SvXMLElementExport aCell( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True ); - // write the original range name as id into the local table - // to allow a correct re-association when copying via clipboard + exportText( *aIt ); + if( nC < nComplexCount ) + lcl_exportComplexLabel( rComplexColumnDescriptions[nC++], mrExport ); if( !bHasOwnData && aColumnDescriptions_RangeIter != aColumnDescriptions_RangeEnd ) { + // remind the original range to allow a correct re-association when copying via clipboard if ((*aColumnDescriptions_RangeIter).getLength()) - { - mrExport.AddAttributeIdLegacy(XML_NAMESPACE_TEXT, - *aColumnDescriptions_RangeIter); - } + SchXMLTools::exportRangeToSomewhere( mrExport, *aColumnDescriptions_RangeIter ); ++aColumnDescriptions_RangeIter; } - exportText( *aIt ); - if( nC < nComplexCount ) - lcl_exportComplexLabel( rComplexColumnDescriptions[nC++], mrExport ); } OSL_ASSERT( bHasOwnData || aColumnDescriptions_RangeIter == aColumnDescriptions_RangeEnd ); } // closing row and header-rows elements @@ -1740,17 +1736,15 @@ void SchXMLExportHelper_Impl::exportTable() SvXMLElementExport aCell( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True ); if( aRowDescriptionsIter != aData.aRowDescriptions.end()) { - // write the original range name as id into the local table - // to allow a correct re-association when copying via clipboard - if( !bHasOwnData && aRowDescriptions_RangeIter != aRowDescriptions_RangeEnd ) - { - mrExport.AddAttributeIdLegacy(XML_NAMESPACE_TEXT, - *aRowDescriptions_RangeIter++); - } exportText( *aRowDescriptionsIter ); ++aRowDescriptionsIter; if( nC < nComplexCount ) lcl_exportComplexLabel( rComplexRowDescriptions[nC++], mrExport ); + if( !bHasOwnData && aRowDescriptions_RangeIter != aRowDescriptions_RangeEnd ) + { + // remind the original range to allow a correct re-association when copying via clipboard + SchXMLTools::exportRangeToSomewhere( mrExport, *aRowDescriptions_RangeIter++ ); + } } } @@ -1763,19 +1757,15 @@ void SchXMLExportHelper_Impl::exportTable() mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_FLOAT ); mrExport.AddAttribute( XML_NAMESPACE_OFFICE, XML_VALUE, msString ); SvXMLElementExport aCell( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True ); - // write the original range name as id into the local table to - // allow a correct re-association when copying via clipboard + exportText( msString, false ); // do not convert tabs and lfs if( ( !bHasOwnData && aDataRangeIter != aDataRangeEndIter ) && - ( mbRowSourceColumns || (aColIt == aRowIt->begin())) ) + ( mbRowSourceColumns || (aColIt == aRowIt->begin()) ) ) { + // remind the original range to allow a correct re-association when copying via clipboard if ((*aDataRangeIter).getLength()) - { - mrExport.AddAttributeIdLegacy(XML_NAMESPACE_TEXT, - *aDataRangeIter); - } + SchXMLTools::exportRangeToSomewhere( mrExport, *aDataRangeIter ); ++aDataRangeIter; } - exportText( msString, false ); // do not convert tabs and lfs } } } @@ -3078,6 +3068,10 @@ void SchXMLExportHelper_Impl::exportSeries( { // add style name attribute AddAutoStyleAttribute( aPropertyStates ); + + const SvtSaveOptions::ODFDefaultVersion nCurrentVersion( SvtSaveOptions().GetODFDefaultVersion() ); + if( nCurrentVersion >= SvtSaveOptions::ODFVER_012 ) + mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_DIMENSION, XML_Y );//#i114149# SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_ERROR_INDICATOR, sal_True, sal_True ); } else // autostyles diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx index 5f5e36bcfed5..0ab86919b6cc 100644 --- a/xmloff/source/chart/SchXMLTableContext.cxx +++ b/xmloff/source/chart/SchXMLTableContext.cxx @@ -34,6 +34,7 @@ #include "SchXMLImport.hxx" #include "SchXMLTools.hxx" #include "transporttypes.hxx" +#include "XMLStringBufferImportContext.hxx" #include <tools/debug.hxx> #include <rtl/math.hxx> #include "xmlnmspe.hxx" @@ -694,6 +695,35 @@ SvXMLImportContext* SchXMLTableRowContext::CreateChildContext( return pContext; } +//--------------------------------------------------------------------------------------------------- +//--------------------------------------------------------------------------------------------------- + +class SchXMLRangeSomewhereContext : public SvXMLImportContext +{ +//#i113950# previously the range was exported to attribute text:id, +//but that attribute does not allow arbitrary strings anymore +//so we need to find an alternative to save that range info for copy/paste scenario ... +//-> use description at an empty group element for now + +private: + ::rtl::OUString& mrRangeString; + ::rtl::OUStringBuffer maRangeStringBuffer; + +public: + SchXMLRangeSomewhereContext( SvXMLImport& rImport, + const ::rtl::OUString& rLocalName, + ::rtl::OUString& rRangeString ); + virtual ~SchXMLRangeSomewhereContext(); + + virtual SvXMLImportContext* CreateChildContext( + USHORT nPrefix, + const ::rtl::OUString& rLocalName, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList ); + virtual void EndElement(); +}; + +//--------------------------------------------------------------------------------------------------- +//--------------------------------------------------------------------------------------------------- // ======================================== // classes for cells and their content @@ -785,11 +815,18 @@ SvXMLImportContext* SchXMLTableCellContext::CreateChildContext( pContext = new SchXMLTextListContext( GetImport(), rLocalName, *rCell.pComplexString ); mbReadText = sal_False;//don't apply text from <text:p> } - // <text:p> element - read text and range-id + // <text:p> element - read text (and range from text:id old version) else if( nPrefix == XML_NAMESPACE_TEXT && IsXMLToken( rLocalName, XML_P ) ) { pContext = new SchXMLParagraphContext( GetImport(), rLocalName, maCellContent, &maRangeId ); } + // <draw:g> element - read range + else if( nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_G ) ) + { + //#i113950# previously the range was exported to attribute text:id, but that attribute does not allow arbitrary strings anymore + //so we need to find an alternative to save that range info for copy/paste scenario ... -> use description at an empty group element for now + pContext = new SchXMLRangeSomewhereContext( GetImport(), rLocalName, maRangeId ); + } else { pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); @@ -1168,3 +1205,34 @@ void SchXMLTableHelper::switchRangesFromOuterToInternalIfNecessary( } } +//--------------------------------------------------------------------------------------------------- + +SchXMLRangeSomewhereContext::SchXMLRangeSomewhereContext( SvXMLImport& rImport, + const OUString& rLocalName, + OUString& rRangeString ) : + SvXMLImportContext( rImport, XML_NAMESPACE_TEXT, rLocalName ), + mrRangeString( rRangeString ) +{ +} + +SchXMLRangeSomewhereContext::~SchXMLRangeSomewhereContext() +{ +} + +SvXMLImportContext* SchXMLRangeSomewhereContext::CreateChildContext( + USHORT nPrefix, + const OUString& rLocalName, + const uno::Reference< xml::sax::XAttributeList >& ) +{ + if( XML_NAMESPACE_SVG == nPrefix && IsXMLToken( rLocalName, XML_DESC ) ) + { + return new XMLStringBufferImportContext( + GetImport(), nPrefix, rLocalName, maRangeStringBuffer ); + } + return new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); +} + +void SchXMLRangeSomewhereContext::EndElement() +{ + mrRangeString = maRangeStringBuffer.makeStringAndClear(); +} diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx index 582e5aead326..b2a90e534771 100644 --- a/xmloff/source/chart/SchXMLTools.cxx +++ b/xmloff/source/chart/SchXMLTools.cxx @@ -600,6 +600,29 @@ void exportText( SvXMLExport& rExport, const OUString& rText, bool bConvertTabsL } } +void exportRangeToSomewhere( SvXMLExport& rExport, const ::rtl::OUString& rValue ) +{ + //with issue #i366# and CWS chart20 ranges for error bars were introduced + //to keep them during copy paste from calc to impress for example it + //was necessary to introduce a mapping between the used ranges within calc and the data written to the local table + //this is why we write this ranges here + + //#i113950# first the range was exported to attribute text:id, but that attribute does not allow arbitrary strings anymore within ODF 1.2 + //as an alternative the range info is now saved into the description at an empty group element (not very nice, but ODF conform) + + const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() ); + if( nCurrentODFVersion == SvtSaveOptions::ODFVER_010 || nCurrentODFVersion == SvtSaveOptions::ODFVER_011 ) + return;//svg:desc is not allowed at draw:g in ODF1.0; but as the ranges for error bars are anyhow not allowed within ODF1.0 nor ODF1.1 we do not need the information + + SvXMLElementExport aEmptyShapeGroup( rExport, XML_NAMESPACE_DRAW, + ::xmloff::token::GetXMLToken( ::xmloff::token::XML_G ), + sal_True, sal_False ); + SvXMLElementExport aDescription( rExport, XML_NAMESPACE_SVG, + ::xmloff::token::GetXMLToken( ::xmloff::token::XML_DESC ), + sal_True, sal_False ); + rExport.GetDocHandler()->characters( rValue ); +} + Reference< chart2::XRegressionCurve > getRegressionCurve( const Reference< chart2::XDataSeries > & xDataSeries ) { diff --git a/xmloff/source/chart/SchXMLTools.hxx b/xmloff/source/chart/SchXMLTools.hxx index bcc39ae3d114..d8841bf3861b 100644 --- a/xmloff/source/chart/SchXMLTools.hxx +++ b/xmloff/source/chart/SchXMLTools.hxx @@ -105,6 +105,8 @@ namespace SchXMLTools void exportText( SvXMLExport& rExport, const ::rtl::OUString& rText, bool bConvertTabsLFs ); + void exportRangeToSomewhere( SvXMLExport& rExport, const ::rtl::OUString& rValue ); + /** returns the properties of the equation of the first regression curve that is no mean-value line */ diff --git a/xmloff/source/core/RDFaExportHelper.cxx b/xmloff/source/core/RDFaExportHelper.cxx index 593e2d1f29e6..f603d21258fd 100644 --- a/xmloff/source/core/RDFaExportHelper.cxx +++ b/xmloff/source/core/RDFaExportHelper.cxx @@ -37,6 +37,8 @@ #include <comphelper/stlunosequence.hxx> #include <comphelper/stl_types.hxx> +#include <com/sun/star/uri/XUriReference.hpp> +#include <com/sun/star/uri/XUriReferenceFactory.hpp> #include <com/sun/star/rdf/Statement.hpp> #include <com/sun/star/rdf/URIs.hpp> #include <com/sun/star/rdf/URI.hpp> @@ -85,6 +87,39 @@ makeCURIE(SvXMLExport * i_pExport, return buf.makeStringAndClear(); } +// #i112473# SvXMLExport::GetRelativeReference() not right for RDF on SaveAs +// because the URIs in the repository are not rewritten on SaveAs, the +// URI of the loaded document has to be used, not the URI of the target doc. +static ::rtl::OUString +getRelativeReference(SvXMLExport const& rExport, ::rtl::OUString const& rURI) +{ + uno::Reference< rdf::XURI > const xModelURI( + rExport.GetModel(), uno::UNO_QUERY_THROW ); + ::rtl::OUString const baseURI( xModelURI->getStringValue() ); + + uno::Reference<uno::XComponentContext> const xContext( + rExport.GetComponentContext()); + uno::Reference<lang::XMultiComponentFactory> const xServiceFactory( + xContext->getServiceManager(), uno::UNO_SET_THROW); + uno::Reference<uri::XUriReferenceFactory> const xUriFactory( + xServiceFactory->createInstanceWithContext( + ::rtl::OUString::createFromAscii( + "com.sun.star.uri.UriReferenceFactory"), xContext), + uno::UNO_QUERY_THROW); + + uno::Reference< uri::XUriReference > const xBaseURI( + xUriFactory->parse(baseURI), uno::UNO_SET_THROW ); + uno::Reference< uri::XUriReference > const xAbsoluteURI( + xUriFactory->parse(rURI), uno::UNO_SET_THROW ); + uno::Reference< uri::XUriReference > const xRelativeURI( + xUriFactory->makeRelative(xBaseURI, xAbsoluteURI, true, true, false), + uno::UNO_SET_THROW ); + ::rtl::OUString const relativeURI(xRelativeURI->getUriReference()); + + return relativeURI; +} + + //////////////////////////////////////////////////////////////////////////// RDFaExportHelper::RDFaExportHelper(SvXMLExport & i_rExport) @@ -145,7 +180,7 @@ RDFaExportHelper::AddRDFa( static const sal_Unicode s_OpenBracket ('['); static const sal_Unicode s_CloseBracket(']'); const ::rtl::OUString about( xSubjectURI.is() - ? m_rExport.GetRelativeReference(xSubjectURI->getStringValue()) + ? getRelativeReference(m_rExport, xSubjectURI->getStringValue()) : ::rtl::OUStringBuffer().append(s_OpenBracket).append( LookupBlankNode(xSubjectBNode)).append(s_CloseBracket) .makeStringAndClear() diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 2e92c4a6a97d..d65bafe583df 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3082,8 +3082,8 @@ namespace xmloff { namespace token { TOKEN( "axis-label-position", XML_AXIS_LABEL_POSITION ), TOKEN( "near-axis", XML_NEAR_AXIS ), TOKEN( "near-axis-other-side", XML_NEAR_AXIS_OTHER_SIDE ), - TOKEN( "outside-minimum", XML_OUTSIDE_START ), - TOKEN( "outside-maximum", XML_OUTSIDE_END ), + TOKEN( "outside-start", XML_OUTSIDE_START ), + TOKEN( "outside-end", XML_OUTSIDE_END ), TOKEN( "tick-mark-position", XML_TICK_MARK_POSITION ), TOKEN( "at-labels", XML_AT_LABELS ), TOKEN( "at-axis", XML_AT_AXIS ), @@ -3107,6 +3107,12 @@ namespace xmloff { namespace token { TOKEN( "http://openoffice.org/2010/chart", XML_N_CHART_EXT ), TOKEN( "coordinate-region", XML_COORDINATE_REGION ), + TOKEN( "diagonal-bl-tr-widths", XML_DIAGONAL_BL_TR_WIDTHS ), + TOKEN( "diagonal-tl-br-widths", XML_DIAGONAL_TL_BR_WIDTHS ), + + TOKEN( "outside-minimum", XML_OUTSIDE_MINIMUM ), + TOKEN( "outside-maximum", XML_OUTSIDE_MAXIMUM ), + #if OSL_DEBUG_LEVEL > 0 { 0, NULL, NULL, XML_TOKEN_END } #else diff --git a/xmloff/source/draw/ximpcustomshape.cxx b/xmloff/source/draw/ximpcustomshape.cxx index 9d7856348516..98255edf68d0 100644 --- a/xmloff/source/draw/ximpcustomshape.cxx +++ b/xmloff/source/draw/ximpcustomshape.cxx @@ -708,6 +708,7 @@ void GetEnhancedPath( std::vector< com::sun::star::beans::PropertyValue >& rDest case '8' : case '9' : case '.' : + case '-' : { com::sun::star::drawing::EnhancedCustomShapeParameterPair aPair; if ( GetNextParameter( aPair.First, nIndex, rValue ) && diff --git a/xmloff/source/text/XMLTextMarkImportContext.cxx b/xmloff/source/text/XMLTextMarkImportContext.cxx index af51f5f56d98..00cdce37f4d5 100644 --- a/xmloff/source/text/XMLTextMarkImportContext.cxx +++ b/xmloff/source/text/XMLTextMarkImportContext.cxx @@ -116,6 +116,7 @@ XMLTextMarkImportContext::XMLTextMarkImportContext( const OUString& rLocalName ) : SvXMLImportContext(rImport, nPrefix, rLocalName) , m_rHelper(rHlp) + , m_bHaveAbout(false) { } |