diff options
author | Mathias Bauer <mba@openoffice.org> | 2010-07-13 14:38:37 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2010-07-13 14:38:37 +0200 |
commit | 8eea0b1b4ba5f07a89fb2bacb39f1c8d9c3039e6 (patch) | |
tree | 874f33673af3b17a40de1980f31ead2c8272a155 /xmloff | |
parent | f24b1da07ebfbc95e76af93fc9c7133f7d52daa5 (diff) | |
parent | a2e7c2e0d002d75a6b77a629a4e904ab54bf8375 (diff) |
CWS changehid: resync to m84
Diffstat (limited to 'xmloff')
58 files changed, 991 insertions, 500 deletions
diff --git a/xmloff/inc/SchXMLExport.hxx b/xmloff/inc/SchXMLExport.hxx index d6227754a5f2..49a471a31729 100644 --- a/xmloff/inc/SchXMLExport.hxx +++ b/xmloff/inc/SchXMLExport.hxx @@ -81,7 +81,7 @@ public: void SetProgress( sal_Int32 nPercentage ); - UniReference< XMLPropertySetMapper > GetPropertySetMapper() const { return maExportHelper.GetPropertySetMapper(); } + UniReference< XMLPropertySetMapper > GetPropertySetMapper() const; // XServiceInfo ( : SvXMLExport ) virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); diff --git a/xmloff/inc/SchXMLImport.hxx b/xmloff/inc/SchXMLImport.hxx index 858371a1805b..7168b2b811a8 100644 --- a/xmloff/inc/SchXMLImport.hxx +++ b/xmloff/inc/SchXMLImport.hxx @@ -69,6 +69,8 @@ enum SchXMLChartElemTokenMap enum SchXMLPlotAreaElemTokenMap { + XML_TOK_PA_COORDINATE_REGION_EXT, + XML_TOK_PA_COORDINATE_REGION, XML_TOK_PA_AXIS, XML_TOK_PA_SERIES, XML_TOK_PA_WALL, diff --git a/xmloff/inc/xmlnmspe.hxx b/xmloff/inc/xmlnmspe.hxx index 49c484a1ab17..7b7b7e131ec7 100644 --- a/xmloff/inc/xmlnmspe.hxx +++ b/xmloff/inc/xmlnmspe.hxx @@ -87,8 +87,10 @@ const sal_uInt16 XML_NAMESPACE_##prefix##_EXT_IDX = key; XML_NAMESPACE_EXT( OFFICE, 37U ) XML_NAMESPACE_EXT( TABLE, 38U ) +XML_NAMESPACE_EXT( CHART, 39U ) +XML_NAMESPACE_EXT( DRAW, 40U ) -#define _XML_OLD_NAMESPACE_BASE 39U +#define _XML_OLD_NAMESPACE_BASE 41U // namespaces used in the technical preview (SO 5.2) XML_OLD_NAMESPACE( FO, 0U ) diff --git a/xmloff/inc/xmloff/SchXMLExportHelper.hxx b/xmloff/inc/xmloff/SchXMLExportHelper.hxx index 64f579a7c252..bf60d44d63fd 100644 --- a/xmloff/inc/xmloff/SchXMLExportHelper.hxx +++ b/xmloff/inc/xmloff/SchXMLExportHelper.hxx @@ -40,41 +40,9 @@ #include <queue> #include <vector> -namespace com { namespace sun { namespace star { - namespace chart { - class XDiagram; - class XChartDocument; - struct ChartSeriesAddress; - } - namespace chart2 { - class XDiagram; - class XChartDocument; - class XDataSeries; - namespace data - { - class XDataProvider; - class XDataSequence; - } - } - namespace drawing { - class XShape; - class XShapes; - } - namespace task { - class XStatusIndicator; - } - namespace frame { - class XModel; - } - namespace xml { - namespace sax { - class XAttributeList; -}}}}} - class SvXMLAutoStylePoolP; -class XMLChartExportPropertyMapper; class SvXMLExport; -class XMLPropertyHandlerFactory; +class SchXMLExportHelper_Impl; /** With this class you can export a <chart:chart> element containing its data as <table:table> element or without internal table. In @@ -84,153 +52,22 @@ class XMLPropertyHandlerFactory; class XMLOFF_DLLPUBLIC SchXMLExportHelper : public UniRefBase { public: - // first: data sequence for label, second: data sequence for values. - typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >, - ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > > tLabelValuesDataPair; - typedef ::std::vector< tLabelValuesDataPair > tDataSequenceCont; - -private: - SvXMLExport& mrExport; - SvXMLAutoStylePoolP& mrAutoStylePool; - UniReference< XMLPropertyHandlerFactory > mxPropertyHandlerFactory; - UniReference< XMLPropertySetMapper > mxPropertySetMapper; - UniReference< XMLChartExportPropertyMapper > mxExpPropMapper; - - rtl::OUString msTableName; - rtl::OUStringBuffer msStringBuffer; - rtl::OUString msString; - - // members filled by InitRangeSegmentationProperties (retrieved from DataProvider) - sal_Bool mbHasSeriesLabels; - sal_Bool mbHasCategoryLabels; //if the categories are only automatically generated this will be false - sal_Bool mbRowSourceColumns; - rtl::OUString msChartAddress; - rtl::OUString msTableNumberList; - ::com::sun::star::uno::Sequence< sal_Int32 > maSequenceMapping; - - rtl::OUString msCLSID; - - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxAdditionalShapes; - - tDataSequenceCont m_aDataSequencesToExport; - rtl::OUString maCategoriesRange; - - /** first parseDocument: collect autostyles and store names in this queue - second parseDocument: export content and use names from this queue - */ - ::std::queue< ::rtl::OUString > maAutoStyleNameQueue; - SAL_DLLPRIVATE void CollectAutoStyle( - const std::vector< XMLPropertyState >& aStates ); - SAL_DLLPRIVATE void AddAutoStyleAttribute( - const std::vector< XMLPropertyState >& aStates ); - - SAL_DLLPRIVATE SvXMLAutoStylePoolP& GetAutoStylePoolP() - { return mrAutoStylePool; } - - /// if bExportContent is false the auto-styles are collected - SAL_DLLPRIVATE void parseDocument( com::sun::star::uno::Reference< - com::sun::star::chart::XChartDocument >& rChartDoc, - sal_Bool bExportContent, - sal_Bool bIncludeTable = sal_False ); - SAL_DLLPRIVATE void exportTable(); - SAL_DLLPRIVATE void exportPlotArea( - com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > xDiagram, - com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > xNewDiagram, - const ::com::sun::star::awt::Size & rPageSize, - sal_Bool bExportContent, - sal_Bool bIncludeTable ); - SAL_DLLPRIVATE void exportAxes( const com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > & xDiagram, - const com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > & xNewDiagram, - sal_Bool bExportContent ); - - SAL_DLLPRIVATE void exportSeries( - const com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > & xNewDiagram, - const ::com::sun::star::awt::Size & rPageSize, - sal_Bool bExportContent, - sal_Bool bHasTwoYAxes ); - SAL_DLLPRIVATE void exportCandleStickSeries( - const ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XDataSeries > > & aSeriesSeq, - const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XDiagram > & xDiagram, - sal_Bool bJapaneseCandleSticks, - sal_Bool bExportContent ); - SAL_DLLPRIVATE void exportDataPoints( - const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > & xSeriesProperties, - sal_Int32 nSeriesLength, - const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XDiagram > & xDiagram, - sal_Bool bExportContent ); - SAL_DLLPRIVATE void exportRegressionCurve( - const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XDataSeries > & xSeries, - const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > & xSeriesProp, - const ::com::sun::star::awt::Size & rPageSize, - sal_Bool bExportContent ); - - /// add svg position as attribute for current element - SAL_DLLPRIVATE void addPosition( const ::com::sun::star::awt::Point & rPosition ); - SAL_DLLPRIVATE void addPosition( com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape ); - /// add svg size as attribute for current element - SAL_DLLPRIVATE void addSize( const ::com::sun::star::awt::Size & rSize ); - SAL_DLLPRIVATE void addSize( com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape ); - /// fills the member msString with the appropriate String (i.e. "A3") - SAL_DLLPRIVATE void getCellAddress( sal_Int32 nCol, sal_Int32 nRow ); - /// exports a string as a paragraph element - SAL_DLLPRIVATE void exportText( const ::rtl::OUString& rText, bool bConvertTabsLFs = false ); - SAL_DLLPRIVATE void exportErrorBarRanges(); - - SAL_DLLPRIVATE SchXMLExportHelper(SchXMLExportHelper &); // not defined - SAL_DLLPRIVATE void operator =(SchXMLExportHelper &); // not defined - -public: SchXMLExportHelper( SvXMLExport& rExport, SvXMLAutoStylePoolP& rASPool ); virtual ~SchXMLExportHelper(); - // auto-styles - /// parse chart and collect all auto-styles used in current pool - void collectAutoStyles( com::sun::star::uno::Reference< - com::sun::star::chart::XChartDocument > rChartDoc ); - /// write the styles collected into the current pool as <style:style> elements - void exportAutoStyles(); - - /** export the <chart:chart> element corresponding to rChartDoc - if bIncludeTable is true, the chart data is exported as <table:table> - element (inside the chart element). - - Otherwise the external references stored in the chart document are used - for writing the corresponding attributes at series - - All attributes contained in xAttrList are written at the chart element, - which ist the outer element of a chart. So these attributes can easily - be parsed again by the container - */ - void exportChart( com::sun::star::uno::Reference< - com::sun::star::chart::XChartDocument > rChartDoc, - sal_Bool bIncludeTable ); - /// returns the string corresponding to the current FileFormat CLSID for Chart const rtl::OUString& getChartCLSID(); - UniReference< XMLPropertySetMapper > GetPropertySetMapper() const { return mxPropertySetMapper; } - - void SetChartRangeAddress( const ::rtl::OUString& rAddress ) - { msChartAddress = rAddress; } - void SetTableNumberList( const ::rtl::OUString& rList ) - { msTableNumberList = rList; } - - void InitRangeSegmentationProperties( - const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XChartDocument > & xChartDoc ); +private: + SchXMLExportHelper(); // not defined + SchXMLExportHelper(SchXMLExportHelper &); // not defined + void operator =(SchXMLExportHelper &); // not defined - ::com::sun::star::awt::Size getPageSize( - const ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XChartDocument > & xChartDoc ) const; +private: + SchXMLExportHelper_Impl* m_pImpl; + friend class SchXMLExport; }; #endif // _XMLOFF_SCH_XMLEXPORTHELPER_HXX_ diff --git a/xmloff/inc/xmloff/XMLEventExport.hxx b/xmloff/inc/xmloff/XMLEventExport.hxx index 4a8a8b8d45b5..b0ec63b45b35 100644 --- a/xmloff/inc/xmloff/XMLEventExport.hxx +++ b/xmloff/inc/xmloff/XMLEventExport.hxx @@ -73,6 +73,8 @@ class XMLOFF_DLLPUBLIC XMLEventExport HandlerMap aHandlerMap; NameMap aNameTranslationMap; + bool bExtNamespace; + public: XMLEventExport(SvXMLExport& rExport, const XMLEventNameTranslation* pTranslationTable = NULL); @@ -104,6 +106,12 @@ public: ::com::sun::star::container::XNameAccess> & xAccess, sal_Bool bUseWhitespace = sal_True); + /// export the events, but write <officeooo:events> element + /// (for new file format additions) + void ExportExt( ::com::sun::star::uno::Reference< + ::com::sun::star::container::XNameAccess> & xAccess, + sal_Bool bUseWhitespace = sal_True); + /// export a single event (writes <office:events> element) void ExportSingleEvent( ::com::sun::star::uno::Sequence< diff --git a/xmloff/inc/xmloff/shapeexport.hxx b/xmloff/inc/xmloff/shapeexport.hxx index 1b30658ef89c..e583a208fd83 100644 --- a/xmloff/inc/xmloff/shapeexport.hxx +++ b/xmloff/inc/xmloff/shapeexport.hxx @@ -111,7 +111,8 @@ enum XmlShapeType XmlShapeTypePresPageShape, // "com.sun.star.presentation.PageShape" XmlShapeTypePresOLE2Shape, // "com.sun.star.presentation.OLE2Shape" XmlShapeTypePresChartShape, // "com.sun.star.presentation.ChartShape" - XmlShapeTypePresSheetShape, // "com.sun.star.presentation.OLE2Shape" + XmlShapeTypePresSheetShape, // "com.sun.star.presentation.CalcShape" + XmlShapeTypePresTableShape, // "com.sun.star.presentation.TableShape" XmlShapeTypePresOrgChartShape, // "com.sun.star.presentation.OrgChartShape" XmlShapeTypePresNotesShape, // "com.sun.star.presentation.NotesShape" XmlShapeTypeHandoutShape, // "com.sun.star.presentation.HandoutShape" @@ -121,8 +122,9 @@ enum XmlShapeType XmlShapeTypePresSlideNumberShape, // "com.sun.star.presentation.SlideNumberShape" XmlShapeTypePresDateTimeShape, // "com.sun.star.presentation.DateTimeShape" - XmlShapeTypeDrawCustomShape, // "com.sun.star.draw.CustomShape" - XmlShapeTypeDrawMediaShape, // "com.sun.star.draw.MediaShape" + XmlShapeTypeDrawCustomShape, // "com.sun.star.drawing.CustomShape" + XmlShapeTypeDrawMediaShape, // "com.sun.star.drawing.MediaShape" + XmlShapeTypePresMediaShape, // "com.sun.star.presentation.MediaShape" XmlShapeTypeDrawTableShape, // "com.sun.star.drawing.TableShape" @@ -189,6 +191,9 @@ private: SAL_DLLPRIVATE UniReference< SvXMLExportPropertyMapper > GetPropertySetMapper() const { return mxPropertySetMapper; } const rtl::OUString msZIndex; + const rtl::OUString msPrintable; + const rtl::OUString msVisible; + const rtl::OUString msEmptyPres; const rtl::OUString msModel; const rtl::OUString msStartShape; diff --git a/xmloff/inc/xmloff/txtimp.hxx b/xmloff/inc/xmloff/txtimp.hxx index 02750f76dcc6..75310d90f0ae 100644 --- a/xmloff/inc/xmloff/txtimp.hxx +++ b/xmloff/inc/xmloff/txtimp.hxx @@ -262,11 +262,11 @@ enum XMLTextPAttrTokens XML_TOK_TEXT_P_PROPERTY, XML_TOK_TEXT_P_CONTENT, XML_TOK_TEXT_P_DATATYPE, + XML_TOK_TEXT_P_TEXTID, XML_TOK_TEXT_P_STYLE_NAME, XML_TOK_TEXT_P_COND_STYLE_NAME, XML_TOK_TEXT_P_LEVEL, XML_TOK_TEXT_P_CLASS_NAMES, - XML_TOK_TEXT_P_ID, XML_TOK_TEXT_P_IS_LIST_HEADER, XML_TOK_TEXT_P_RESTART_NUMBERING, XML_TOK_TEXT_P_START_VALUE, diff --git a/xmloff/inc/xmloff/xmlexp.hxx b/xmloff/inc/xmloff/xmlexp.hxx index 0459fcc7b13a..03903f38a331 100644 --- a/xmloff/inc/xmloff/xmlexp.hxx +++ b/xmloff/inc/xmloff/xmlexp.hxx @@ -590,6 +590,12 @@ public: /// name of stream in package, e.g., "content.xml" ::rtl::OUString GetStreamName() const; + // FIXME: this is only for legacy stuff that has not yet been adapted + // to implement XMetadatable; this can write duplicate IDs! + /// add xml:id and legacy namespace id + void SAL_DLLPRIVATE AddAttributeIdLegacy( + sal_uInt16 const nLegacyPrefix, ::rtl::OUString const& rValue); + /// add xml:id attribute (for RDF metadata) void AddAttributeXmlId(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> const & i_xIfc); diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx index 82dc69e59ee3..d892c10f4f5d 100644 --- a/xmloff/inc/xmloff/xmltoken.hxx +++ b/xmloff/inc/xmloff/xmltoken.hxx @@ -148,6 +148,9 @@ namespace xmloff { namespace token { XML_NP_TABLE_EXT, XML_N_TABLE_EXT, + XML_NP_DRAW_EXT, + XML_N_DRAW_EXT, + // units XML_UNIT_MM, XML_UNIT_M, @@ -1705,6 +1708,7 @@ namespace xmloff { namespace token { XML_SYMBOL_IMAGE_NAME, XML_SYMBOL_WIDTH, XML_SYSTEM, + XML_TAB_COLOR, XML_TAB_STOP, XML_TAB_STOP_DISTANCE, XML_TAB_STOPS, @@ -2548,6 +2552,9 @@ namespace xmloff { namespace token { XML_DIMENSION, XML_VALIDATION_NAME, + XML_SCREEN, + XML_PRINTER, + // XForms tokens // already defined: XML_ACTION, XML_VERSION, XML_ENCODING, // XML_REPLACE, XML_SEPARATOR, XML_TYPE, XML_ID @@ -3095,6 +3102,11 @@ namespace xmloff { namespace token { XML_ENDS_WITH, XML_DOES_NOT_END_WITH, + //chart + XML_NP_CHART_EXT, + XML_N_CHART_EXT, + XML_COORDINATE_REGION, + XML_TOKEN_END }; diff --git a/xmloff/qa/unoapi/knownissues.xcl b/xmloff/qa/unoapi/knownissues.xcl index 401d33d9a889..ac15aad11e71 100644 --- a/xmloff/qa/unoapi/knownissues.xcl +++ b/xmloff/qa/unoapi/knownissues.xcl @@ -10,17 +10,6 @@ xmloff.Impress.XMLImporter::com::sun::star::xml::sax::XDocumentHandler xmloff.Impress.XMLMetaImporter::com::sun::star::xml::sax::XDocumentHandler xmloff.Impress.XMLStylesImporter::com::sun::star::xml::sax::XDocumentHandler -### i86555 ### -xmloff.Chart.XMLExporter::com::sun::star::document::XFilter -xmloff.Chart.XMLContentExporter::com::sun::star::document::XFilter -xmloff.Impress.XMLSettingsExporter::com::sun::star::document::XFilter -xmloff.Impress.XMLMetaExporter::com::sun::star::document::XFilter -xmloff.Impress.XMLImporter::com::sun::star::document::XFilter -xmloff.Impress.XMLExporter::com::sun::star::document::XFilter -xmloff.Draw.XMLContentExporter::com::sun::star::document::XFilter -xmloff.Draw.XMLMetaExporter::com::sun::star::document::XFilter -xmloff.Draw.XMLSettingsImporter::com::sun::star::document::XFilter - ### i87695 ### xmloff.Draw.XMLStylesExporter xmloff.Impress.XMLStylesExporter diff --git a/xmloff/qa/unoapi/xmloff.sce b/xmloff/qa/unoapi/xmloff.sce index aa61a2449680..69166aec6204 100644 --- a/xmloff/qa/unoapi/xmloff.sce +++ b/xmloff/qa/unoapi/xmloff.sce @@ -1,26 +1,26 @@ --o xmloff.Chart.XMLContentExporter --o xmloff.Chart.XMLContentImporter --o xmloff.Chart.XMLExporter --o xmloff.Chart.XMLImporter --o xmloff.Chart.XMLStylesExporter --o xmloff.Chart.XMLStylesImporter +#111102# -o xmloff.Chart.XMLContentExporter +#111102# -o xmloff.Chart.XMLContentImporter +#111102# -o xmloff.Chart.XMLExporter +#111102# -o xmloff.Chart.XMLImporter +#111102# -o xmloff.Chart.XMLStylesExporter +#111102# #i112047 -o xmloff.Chart.XMLStylesImporter -o xmloff.Draw.XMLContentExporter -o xmloff.Draw.XMLContentImporter -o xmloff.Draw.XMLExporter -o xmloff.Draw.XMLImporter -o xmloff.Draw.XMLMetaExporter --o xmloff.Draw.XMLMetaImporter --o xmloff.Draw.XMLSettingsExporter --o xmloff.Draw.XMLSettingsImporter +#i111200 -o xmloff.Draw.XMLMetaImporter +#i111287 -o xmloff.Draw.XMLSettingsExporter +#i111287 -o xmloff.Draw.XMLSettingsImporter #i87695 -o xmloff.Draw.XMLStylesExporter -o xmloff.Draw.XMLStylesImporter --o xmloff.Impress.XMLContentExporter +#i111224 -o xmloff.Impress.XMLContentExporter -o xmloff.Impress.XMLContentImporter --o xmloff.Impress.XMLExporter --o xmloff.Impress.XMLImporter +#i112048 -o xmloff.Impress.XMLExporter +#i111111# -o xmloff.Impress.XMLImporter -o xmloff.Impress.XMLMetaExporter -o xmloff.Impress.XMLMetaImporter --o xmloff.Impress.XMLSettingsExporter --o xmloff.Impress.XMLSettingsImporter +#i111287 -o xmloff.Impress.XMLSettingsExporter +#i111287 -o xmloff.Impress.XMLSettingsImporter #i87695 -o xmloff.Impress.XMLStylesExporter -o xmloff.Impress.XMLStylesImporter diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 8154d284f628..c4abc4172959 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -41,9 +41,7 @@ #include <tools/globname.hxx> #include <sot/clsids.hxx> -#ifndef _SVTOOLS_NMSPMAP_HXX #include <xmloff/nmspmap.hxx> -#endif #include "xmlnmspe.hxx" #include <xmloff/xmltoken.hxx> #include <xmloff/families.hxx> @@ -78,6 +76,7 @@ #include <com/sun/star/chart/X3DDisplay.hpp> #include <com/sun/star/chart/XStatisticDisplay.hpp> #include <com/sun/star/chart/XSecondAxisTitleSupplier.hpp> +#include <com/sun/star/chart/XDiagramPositioning.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/XDiagram.hpp> @@ -118,6 +117,161 @@ using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Any; using ::std::vector; +// ======================================== +// class SchXMLExportHelper_Impl +// ======================================== + +class SchXMLExportHelper_Impl +{ +public: + // first: data sequence for label, second: data sequence for values. + typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >, + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > > tLabelValuesDataPair; + typedef ::std::vector< tLabelValuesDataPair > tDataSequenceCont; + +public: + SchXMLExportHelper_Impl( SvXMLExport& rExport, + SvXMLAutoStylePoolP& rASPool ); + + virtual ~SchXMLExportHelper_Impl(); + + // auto-styles + /// parse chart and collect all auto-styles used in current pool + void collectAutoStyles( com::sun::star::uno::Reference< + com::sun::star::chart::XChartDocument > rChartDoc ); + + /// write the styles collected into the current pool as <style:style> elements + void exportAutoStyles(); + + /** export the <chart:chart> element corresponding to rChartDoc + if bIncludeTable is true, the chart data is exported as <table:table> + element (inside the chart element). + + Otherwise the external references stored in the chart document are used + for writing the corresponding attributes at series + + All attributes contained in xAttrList are written at the chart element, + which ist the outer element of a chart. So these attributes can easily + be parsed again by the container + */ + void exportChart( com::sun::star::uno::Reference< + com::sun::star::chart::XChartDocument > rChartDoc, + sal_Bool bIncludeTable ); + + UniReference< XMLPropertySetMapper > GetPropertySetMapper() const; + + void SetChartRangeAddress( const ::rtl::OUString& rAddress ) + { msChartAddress = rAddress; } + void SetTableNumberList( const ::rtl::OUString& rList ) + { msTableNumberList = rList; } + + void InitRangeSegmentationProperties( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument > & xChartDoc ); + + ::com::sun::star::awt::Size getPageSize( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument > & xChartDoc ) const; + + /** first parseDocument: collect autostyles and store names in this queue + second parseDocument: export content and use names from this queue + */ + ::std::queue< ::rtl::OUString > maAutoStyleNameQueue; + void CollectAutoStyle( + const std::vector< XMLPropertyState >& aStates ); + void AddAutoStyleAttribute( + const std::vector< XMLPropertyState >& aStates ); + + SvXMLAutoStylePoolP& GetAutoStylePoolP() + { return mrAutoStylePool; } + + /// if bExportContent is false the auto-styles are collected + void parseDocument( com::sun::star::uno::Reference< + com::sun::star::chart::XChartDocument >& rChartDoc, + sal_Bool bExportContent, + sal_Bool bIncludeTable = sal_False ); + void exportTable(); + void exportPlotArea( + com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > xDiagram, + com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > xNewDiagram, + const ::com::sun::star::awt::Size & rPageSize, + sal_Bool bExportContent, + sal_Bool bIncludeTable ); + void exportCoordinateRegion( const com::sun::star::uno::Reference< com::sun::star::chart::XDiagram >& xDiagram ); + void exportAxes( const com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > & xDiagram, + const com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > & xNewDiagram, + sal_Bool bExportContent ); + + void exportSeries( + const com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > & xNewDiagram, + const ::com::sun::star::awt::Size & rPageSize, + sal_Bool bExportContent, + sal_Bool bHasTwoYAxes ); + void exportCandleStickSeries( + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > > & aSeriesSeq, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram, + sal_Bool bJapaneseCandleSticks, + sal_Bool bExportContent ); + void exportDataPoints( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > & xSeriesProperties, + sal_Int32 nSeriesLength, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram, + sal_Bool bExportContent ); + void exportRegressionCurve( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > & xSeries, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > & xSeriesProp, + const ::com::sun::star::awt::Size & rPageSize, + sal_Bool bExportContent ); + + /// add svg position as attribute for current element + void addPosition( const ::com::sun::star::awt::Point & rPosition ); + void addPosition( com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape ); + /// add svg size as attribute for current element + void addSize( const ::com::sun::star::awt::Size & rSize ); + void addSize( com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape ); + /// fills the member msString with the appropriate String (i.e. "A3") + void getCellAddress( sal_Int32 nCol, sal_Int32 nRow ); + /// exports a string as a paragraph element + void exportText( const ::rtl::OUString& rText, bool bConvertTabsLFs = false ); + void exportErrorBarRanges(); + + SchXMLExportHelper_Impl(SchXMLExportHelper_Impl &); // not defined + void operator =(SchXMLExportHelper_Impl &); // not defined + +public: + SvXMLExport& mrExport; + SvXMLAutoStylePoolP& mrAutoStylePool; + UniReference< XMLPropertyHandlerFactory > mxPropertyHandlerFactory; + UniReference< XMLPropertySetMapper > mxPropertySetMapper; + UniReference< XMLChartExportPropertyMapper > mxExpPropMapper; + + rtl::OUString msTableName; + rtl::OUStringBuffer msStringBuffer; + rtl::OUString msString; + + // members filled by InitRangeSegmentationProperties (retrieved from DataProvider) + sal_Bool mbHasSeriesLabels; + sal_Bool mbHasCategoryLabels; //if the categories are only automatically generated this will be false + sal_Bool mbRowSourceColumns; + rtl::OUString msChartAddress; + rtl::OUString msTableNumberList; + ::com::sun::star::uno::Sequence< sal_Int32 > maSequenceMapping; + + rtl::OUString msCLSID; + + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxAdditionalShapes; + + tDataSequenceCont m_aDataSequencesToExport; + rtl::OUString maCategoriesRange; +}; + namespace { Reference< uno::XComponentContext > lcl_getComponentContext() @@ -356,7 +510,7 @@ tLabelAndValueRange lcl_getLabelAndValueRangeByRole( const Sequence< Reference< chart2::data::XLabeledDataSequence > > & aSeqCnt, const OUString & rRole, const Reference< chart2::XChartDocument > & xDoc, - SchXMLExportHelper::tDataSequenceCont & rOutSequencesToExport ) + SchXMLExportHelper_Impl::tDataSequenceCont & rOutSequencesToExport ) { tLabelAndValueRange aResult; @@ -373,7 +527,7 @@ tLabelAndValueRange lcl_getLabelAndValueRangeByRole( aResult.second = lcl_ConvertRange( xValueSeq->getSourceRangeRepresentation(), xDoc ); if( xLabelSeq.is() || xValueSeq.is()) - rOutSequencesToExport.push_back( SchXMLExportHelper::tLabelValuesDataPair( xLabelSeq, xValueSeq )); + rOutSequencesToExport.push_back( SchXMLExportHelper_Impl::tLabelValuesDataPair( xLabelSeq, xValueSeq )); } return aResult; @@ -455,10 +609,10 @@ OUString lcl_getLabelString( const Reference< chart2::data::XDataSequence > & xL } sal_Int32 lcl_getMaxSequenceLength( - const SchXMLExportHelper::tDataSequenceCont & rContainer ) + const SchXMLExportHelper_Impl::tDataSequenceCont & rContainer ) { sal_Int32 nResult = 0; - for( SchXMLExportHelper::tDataSequenceCont::const_iterator aIt( rContainer.begin()); + for( SchXMLExportHelper_Impl::tDataSequenceCont::const_iterator aIt( rContainer.begin()); aIt != rContainer.end(); ++aIt ) { if( aIt->second.is()) @@ -573,7 +727,7 @@ template< class T > }; -typedef ::std::map< sal_Int32, SchXMLExportHelper::tLabelValuesDataPair > +typedef ::std::map< sal_Int32, SchXMLExportHelper_Impl::tLabelValuesDataPair > lcl_DataSequenceMap; struct lcl_SequenceToMapElement : @@ -596,7 +750,7 @@ struct lcl_SequenceToMapElement : }; void lcl_ReorderInternalSequencesAccordingToTheirRangeName( - SchXMLExportHelper::tDataSequenceCont & rInOutSequences ) + SchXMLExportHelper_Impl::tDataSequenceCont & rInOutSequences ) { lcl_DataSequenceMap aIndexSequenceMap; ::std::transform( rInOutSequences.begin(), rInOutSequences.end(), @@ -613,7 +767,7 @@ void lcl_ReorderInternalSequencesAccordingToTheirRangeName( // fill empty columns for( ; nIndex < aIt->first; ++nIndex ) rInOutSequences.push_back( - SchXMLExportHelper::tDataSequenceCont::value_type( 0, 0 )); + SchXMLExportHelper_Impl::tDataSequenceCont::value_type( 0, 0 )); OSL_ASSERT( nIndex == aIt->first ); rInOutSequences.push_back( aIt->second ); } @@ -621,7 +775,7 @@ void lcl_ReorderInternalSequencesAccordingToTheirRangeName( lcl_TableData lcl_getDataForLocalTable( - const SchXMLExportHelper::tDataSequenceCont & aSequencesToExport, + const SchXMLExportHelper_Impl::tDataSequenceCont & aSequencesToExport, const Reference< chart::XComplexDescriptionAccess >& xComplexDescriptionAccess, const OUString& rCategoriesRange, bool bSeriesFromColumns, @@ -643,10 +797,10 @@ lcl_TableData lcl_getDataForLocalTable( aResult.aComplexRowDescriptions = xComplexDescriptionAccess->getComplexRowDescriptions(); } - SchXMLExportHelper::tDataSequenceCont::size_type nNumSequences = aSequencesToExport.size(); - SchXMLExportHelper::tDataSequenceCont::const_iterator aBegin( aSequencesToExport.begin()); - SchXMLExportHelper::tDataSequenceCont::const_iterator aEnd( aSequencesToExport.end()); - SchXMLExportHelper::tDataSequenceCont::const_iterator aIt( aBegin ); + SchXMLExportHelper_Impl::tDataSequenceCont::size_type nNumSequences = aSequencesToExport.size(); + SchXMLExportHelper_Impl::tDataSequenceCont::const_iterator aBegin( aSequencesToExport.begin()); + SchXMLExportHelper_Impl::tDataSequenceCont::const_iterator aEnd( aSequencesToExport.end()); + SchXMLExportHelper_Impl::tDataSequenceCont::const_iterator aIt( aBegin ); size_t nMaxSequenceLength( lcl_getMaxSequenceLength( aSequencesToExport )); size_t nCategoriesLength( aSimpleCategories.getLength() ); @@ -834,7 +988,53 @@ struct SchXMLDataPointStruct // class SchXMLExportHelper // ======================================== -SchXMLExportHelper::SchXMLExportHelper( +SchXMLExportHelper::SchXMLExportHelper( SvXMLExport& rExport, SvXMLAutoStylePoolP& rASPool ) + : m_pImpl( new SchXMLExportHelper_Impl( rExport, rASPool ) ) +{ +} + +SchXMLExportHelper::~SchXMLExportHelper() +{ + delete m_pImpl; +} + +const OUString& SchXMLExportHelper::getChartCLSID() +{ + return m_pImpl->msCLSID; +} + +UniReference< XMLPropertySetMapper > SchXMLExportHelper_Impl::GetPropertySetMapper() const +{ + return mxPropertySetMapper; +} + +void SchXMLExportHelper_Impl::exportAutoStyles() +{ + if( mxExpPropMapper.is()) + { + //ToDo: when embedded in calc/writer this is not necessary because the + // numberformatter is shared between both documents + mrExport.exportAutoDataStyles(); + + // export chart auto styles + mrAutoStylePool.exportXML( + XML_STYLE_FAMILY_SCH_CHART_ID + , mrExport.GetDocHandler(), + mrExport.GetMM100UnitConverter(), + mrExport.GetNamespaceMap() + ); + + // export auto styles for additional shapes + mrExport.GetShapeExport()->exportAutoStyles(); + // and for text in additional shapes + mrExport.GetTextParagraphExport()->exportTextAutoStyles(); + } +} + +// private methods +// --------------- + +SchXMLExportHelper_Impl::SchXMLExportHelper_Impl( SvXMLExport& rExport, SvXMLAutoStylePoolP& rASPool ) : mrExport( rExport ), @@ -903,56 +1103,22 @@ SchXMLExportHelper::SchXMLExportHelper( String( 'T' )); } -SchXMLExportHelper::~SchXMLExportHelper() {} - -const OUString& SchXMLExportHelper::getChartCLSID() +SchXMLExportHelper_Impl::~SchXMLExportHelper_Impl() { - return msCLSID; } -void SchXMLExportHelper::exportAutoStyles() +void SchXMLExportHelper_Impl::collectAutoStyles( Reference< chart::XChartDocument > rChartDoc ) { - if( mxExpPropMapper.is()) - { - //ToDo: when embedded in calc/writer this is not necessary because the - // numberformatter is shared between both documents - mrExport.exportAutoDataStyles(); - - // export chart auto styles - mrAutoStylePool.exportXML( - XML_STYLE_FAMILY_SCH_CHART_ID - , mrExport.GetDocHandler(), - mrExport.GetMM100UnitConverter(), - mrExport.GetNamespaceMap() - ); - - // export auto styles for additional shapes - mrExport.GetShapeExport()->exportAutoStyles(); - // and for text in additional shapes - mrExport.GetTextParagraphExport()->exportTextAutoStyles(); - } -} - -void SchXMLExportHelper::collectAutoStyles( Reference< chart::XChartDocument > rChartDoc ) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogContext, "xmloff", "bm", "::SchXMLExportHelper::collectAutoStyles" ); - parseDocument( rChartDoc, sal_False ); } -void SchXMLExportHelper::exportChart( Reference< chart::XChartDocument > rChartDoc, +void SchXMLExportHelper_Impl::exportChart( Reference< chart::XChartDocument > rChartDoc, sal_Bool bIncludeTable ) { - RTL_LOGFILE_CONTEXT_AUTHOR( aLogContext, "xmloff", "bm", "::SchXMLExportHelper::exportChart" ); - parseDocument( rChartDoc, sal_True, bIncludeTable ); DBG_ASSERT( maAutoStyleNameQueue.empty(), "There are still remaining autostyle names in the queue" ); } - -// private methods -// --------------- - ::rtl::OUString lcl_GetStringFromNumberSequence( const ::com::sun::star::uno::Sequence< sal_Int32 >& rSequenceMapping, bool bRemoveOneFromEachIndex /*should be true if having categories*/ ) { const sal_Int32* pArray = rSequenceMapping.getConstArray(); @@ -977,7 +1143,7 @@ void SchXMLExportHelper::exportChart( Reference< chart::XChartDocument > rChartD } /// if bExportContent is false the auto-styles are collected -void SchXMLExportHelper::parseDocument( Reference< chart::XChartDocument >& rChartDoc, +void SchXMLExportHelper_Impl::parseDocument( Reference< chart::XChartDocument >& rChartDoc, sal_Bool bExportContent, sal_Bool bIncludeTable ) { @@ -1427,7 +1593,7 @@ void lcl_exportComplexLabel( const Sequence< OUString >& rComplexLabel, SvXMLExp } } -void SchXMLExportHelper::exportTable() +void SchXMLExportHelper_Impl::exportTable() { // table element // ------------- @@ -1526,8 +1692,11 @@ void SchXMLExportHelper::exportTable() // to allow a correct re-association when copying via clipboard if( !bHasOwnData && aColumnDescriptions_RangeIter != aColumnDescriptions_RangeEnd ) { - if( (*aColumnDescriptions_RangeIter).getLength()) - mrExport.AddAttribute( XML_NAMESPACE_TEXT, XML_ID, *aColumnDescriptions_RangeIter ); + if ((*aColumnDescriptions_RangeIter).getLength()) + { + mrExport.AddAttributeIdLegacy(XML_NAMESPACE_TEXT, + *aColumnDescriptions_RangeIter); + } ++aColumnDescriptions_RangeIter; } exportText( *aIt ); @@ -1559,7 +1728,10 @@ void SchXMLExportHelper::exportTable() // 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.AddAttribute( XML_NAMESPACE_TEXT, XML_ID, *aRowDescriptions_RangeIter++ ); + { + mrExport.AddAttributeIdLegacy(XML_NAMESPACE_TEXT, + *aRowDescriptions_RangeIter++); + } exportText( *aRowDescriptionsIter ); ++aRowDescriptionsIter; if( nC < nComplexCount ) @@ -1581,8 +1753,11 @@ void SchXMLExportHelper::exportTable() if( ( !bHasOwnData && aDataRangeIter != aDataRangeEndIter ) && ( mbRowSourceColumns || (aColIt == aRowIt->begin())) ) { - if( (*aDataRangeIter).getLength()) - mrExport.AddAttribute( XML_NAMESPACE_TEXT, XML_ID, *aDataRangeIter ); + if ((*aDataRangeIter).getLength()) + { + mrExport.AddAttributeIdLegacy(XML_NAMESPACE_TEXT, + *aDataRangeIter); + } ++aDataRangeIter; } exportText( msString, false ); // do not convert tabs and lfs @@ -1595,7 +1770,7 @@ void SchXMLExportHelper::exportTable() OSL_ASSERT( bHasOwnData || (aRowDescriptions_RangeIter == aRowDescriptions_RangeEnd) ); } -void SchXMLExportHelper::exportPlotArea( +void SchXMLExportHelper_Impl::exportPlotArea( Reference< chart::XDiagram > xDiagram, Reference< chart2::XDiagram > xNewDiagram, const awt::Size & rPageSize, @@ -1755,9 +1930,12 @@ void SchXMLExportHelper::exportPlotArea( } } - // element + // plot-area element pElPlotArea = new SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_PLOT_AREA, sal_True, sal_True ); + //inner position rectangle element + exportCoordinateRegion( xDiagram ); + // light sources (inside plot area element) if( bIs3DChart && rShapeExport.is()) @@ -1918,7 +2096,27 @@ void SchXMLExportHelper::exportPlotArea( delete pElPlotArea; } -void SchXMLExportHelper::exportAxes( +void SchXMLExportHelper_Impl::exportCoordinateRegion( 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 //#i100778# 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() ) + return; + + awt::Rectangle aRect( xDiaPos->calculateDiagramPositionExcludingAxes() ); + addPosition( awt::Point(aRect.X,aRect.Y) ); + addSize( awt::Size(aRect.Width,aRect.Height) ); + + SvXMLElementExport aCoordinateRegion( mrExport, XML_NAMESPACE_CHART_EXT, XML_COORDINATE_REGION, sal_True, sal_True );//#i100778# todo: change to chart namespace in future - dependent on fileformat +} + +void SchXMLExportHelper_Impl::exportAxes( const Reference< chart::XDiagram > & xDiagram, const Reference< chart2::XDiagram > & xNewDiagram, sal_Bool bExportContent ) @@ -2520,7 +2718,7 @@ void SchXMLExportHelper::exportAxes( } } -void SchXMLExportHelper::exportSeries( +void SchXMLExportHelper_Impl::exportSeries( const Reference< chart2::XDiagram > & xNewDiagram, const awt::Size & rPageSize, sal_Bool bExportContent, @@ -2889,7 +3087,7 @@ void SchXMLExportHelper::exportSeries( } } -void SchXMLExportHelper::exportRegressionCurve( +void SchXMLExportHelper_Impl::exportRegressionCurve( const Reference< chart2::XDataSeries > & xSeries, const Reference< beans::XPropertySet > & xSeriesProp, const awt::Size & rPageSize, @@ -2996,7 +3194,7 @@ void SchXMLExportHelper::exportRegressionCurve( } } -void SchXMLExportHelper::exportCandleStickSeries( +void SchXMLExportHelper_Impl::exportCandleStickSeries( const Sequence< Reference< chart2::XDataSeries > > & aSeriesSeq, const Reference< chart2::XDiagram > & xDiagram, sal_Bool bJapaneseCandleSticks, @@ -3114,7 +3312,7 @@ void SchXMLExportHelper::exportCandleStickSeries( } } -void SchXMLExportHelper::exportDataPoints( +void SchXMLExportHelper_Impl::exportDataPoints( const uno::Reference< beans::XPropertySet > & xSeriesProperties, sal_Int32 nSeriesLength, const uno::Reference< chart2::XDiagram > & xDiagram, @@ -3362,7 +3560,7 @@ void SchXMLExportHelper::exportDataPoints( } -void SchXMLExportHelper::getCellAddress( sal_Int32 nCol, sal_Int32 nRow ) +void SchXMLExportHelper_Impl::getCellAddress( sal_Int32 nCol, sal_Int32 nRow ) { msStringBuffer.append( (sal_Unicode)'.' ); if( nCol < 26 ) @@ -3382,7 +3580,7 @@ void SchXMLExportHelper::getCellAddress( sal_Int32 nCol, sal_Int32 nRow ) msStringBuffer.append( nRow + (sal_Int32)1 ); } -void SchXMLExportHelper::addPosition( const awt::Point & rPosition ) +void SchXMLExportHelper_Impl::addPosition( const awt::Point & rPosition ) { mrExport.GetMM100UnitConverter().convertMeasure( msStringBuffer, rPosition.X ); msString = msStringBuffer.makeStringAndClear(); @@ -3393,13 +3591,13 @@ void SchXMLExportHelper::addPosition( const awt::Point & rPosition ) mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_Y, msString ); } -void SchXMLExportHelper::addPosition( Reference< drawing::XShape > xShape ) +void SchXMLExportHelper_Impl::addPosition( Reference< drawing::XShape > xShape ) { if( xShape.is()) addPosition( xShape->getPosition()); } -void SchXMLExportHelper::addSize( const awt::Size & rSize ) +void SchXMLExportHelper_Impl::addSize( const awt::Size & rSize ) { mrExport.GetMM100UnitConverter().convertMeasure( msStringBuffer, rSize.Width ); msString = msStringBuffer.makeStringAndClear(); @@ -3410,13 +3608,13 @@ void SchXMLExportHelper::addSize( const awt::Size & rSize ) mrExport.AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT, msString ); } -void SchXMLExportHelper::addSize( Reference< drawing::XShape > xShape ) +void SchXMLExportHelper_Impl::addSize( Reference< drawing::XShape > xShape ) { if( xShape.is()) addSize( xShape->getSize() ); } -awt::Size SchXMLExportHelper::getPageSize( const Reference< chart2::XChartDocument > & xChartDoc ) const +awt::Size SchXMLExportHelper_Impl::getPageSize( const Reference< chart2::XChartDocument > & xChartDoc ) const { awt::Size aSize( 8000, 7000 ); uno::Reference< embed::XVisualObject > xVisualObject( xChartDoc, uno::UNO_QUERY ); @@ -3427,13 +3625,13 @@ awt::Size SchXMLExportHelper::getPageSize( const Reference< chart2::XChartDocume return aSize; } -void SchXMLExportHelper::CollectAutoStyle( const std::vector< XMLPropertyState >& aStates ) +void SchXMLExportHelper_Impl::CollectAutoStyle( const std::vector< XMLPropertyState >& aStates ) { if( !aStates.empty() ) maAutoStyleNameQueue.push( GetAutoStylePoolP().Add( XML_STYLE_FAMILY_SCH_CHART_ID, aStates )); } -void SchXMLExportHelper::AddAutoStyleAttribute( const std::vector< XMLPropertyState >& aStates ) +void SchXMLExportHelper_Impl::AddAutoStyleAttribute( const std::vector< XMLPropertyState >& aStates ) { if( !aStates.empty() ) { @@ -3444,7 +3642,7 @@ void SchXMLExportHelper::AddAutoStyleAttribute( const std::vector< XMLPropertySt } } -void SchXMLExportHelper::exportText( const OUString& rText, bool bConvertTabsLFs ) +void SchXMLExportHelper_Impl::exportText( const OUString& rText, bool bConvertTabsLFs ) { SchXMLTools::exportText( mrExport, rText, bConvertTabsLFs ); } @@ -3461,6 +3659,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); } @@ -3477,7 +3677,7 @@ SchXMLExport::~SchXMLExport() sal_uInt32 SchXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) { Reference< chart2::XChartDocument > xChartDoc( GetModel(), uno::UNO_QUERY ); - maExportHelper.InitRangeSegmentationProperties( xChartDoc ); + maExportHelper.m_pImpl->InitRangeSegmentationProperties( xChartDoc ); return SvXMLExport::exportDoc( eClass ); } @@ -3500,8 +3700,8 @@ void SchXMLExport::_ExportAutoStyles() Reference< chart::XChartDocument > xChartDoc( GetModel(), uno::UNO_QUERY ); if( xChartDoc.is()) { - maExportHelper.collectAutoStyles( xChartDoc ); - maExportHelper.exportAutoStyles(); + maExportHelper.m_pImpl->collectAutoStyles( xChartDoc ); + maExportHelper.m_pImpl->exportAutoStyles(); } else { @@ -3550,13 +3750,13 @@ void SchXMLExport::_ExportContent() aAny = xProp->getPropertyValue( OUString::createFromAscii( "ChartRangeAddress" )); aAny >>= sChartAddress; - maExportHelper.SetChartRangeAddress( sChartAddress ); + maExportHelper.m_pImpl->SetChartRangeAddress( sChartAddress ); OUString sTableNumberList; aAny = xProp->getPropertyValue( OUString::createFromAscii( "TableNumberList" )); aAny >>= sTableNumberList; - maExportHelper.SetTableNumberList( sTableNumberList ); + maExportHelper.m_pImpl->SetTableNumberList( sTableNumberList ); // do not include own table if there are external addresses bIncludeTable = (sChartAddress.getLength() == 0); @@ -3569,7 +3769,7 @@ void SchXMLExport::_ExportContent() } } } - maExportHelper.exportChart( xChartDoc, bIncludeTable ); + maExportHelper.m_pImpl->exportChart( xChartDoc, bIncludeTable ); } else { @@ -3584,7 +3784,12 @@ void SchXMLExport::SetProgress( sal_Int32 nPercentage ) mxStatusIndicator->setValue( nPercentage ); } -void SchXMLExportHelper::InitRangeSegmentationProperties( const Reference< chart2::XChartDocument > & xChartDoc ) +UniReference< XMLPropertySetMapper > SchXMLExport::GetPropertySetMapper() const +{ + return maExportHelper.m_pImpl->GetPropertySetMapper(); +} + +void SchXMLExportHelper_Impl::InitRangeSegmentationProperties( const Reference< chart2::XChartDocument > & xChartDoc ) { if( xChartDoc.is()) try diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx index 6afbaecb551c..587070202c9c 100644 --- a/xmloff/source/chart/SchXMLImport.cxx +++ b/xmloff/source/chart/SchXMLImport.cxx @@ -281,6 +281,8 @@ const SvXMLTokenMap& SchXMLImportHelper::GetPlotAreaElemTokenMap() { static __FAR_DATA SvXMLTokenMapEntry aPlotAreaElemTokenMap[] = { + { XML_NAMESPACE_CHART_EXT, XML_COORDINATE_REGION, XML_TOK_PA_COORDINATE_REGION_EXT }, + { XML_NAMESPACE_CHART, XML_COORDINATE_REGION, XML_TOK_PA_COORDINATE_REGION }, { XML_NAMESPACE_CHART, XML_AXIS, XML_TOK_PA_AXIS }, { XML_NAMESPACE_CHART, XML_SERIES, XML_TOK_PA_SERIES }, { XML_NAMESPACE_CHART, XML_WALL, XML_TOK_PA_WALL }, @@ -657,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; } @@ -670,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/SchXMLParagraphContext.cxx b/xmloff/source/chart/SchXMLParagraphContext.cxx index 646d82e4ab79..972bc9016d4f 100644 --- a/xmloff/source/chart/SchXMLParagraphContext.cxx +++ b/xmloff/source/chart/SchXMLParagraphContext.cxx @@ -60,6 +60,7 @@ void SchXMLParagraphContext::StartElement( const uno::Reference< xml::sax::XAttr { sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0; rtl::OUString aValue; + bool bHaveXmlId( false ); for( sal_Int16 i = 0; i < nAttrCount; i++ ) { @@ -67,11 +68,20 @@ void SchXMLParagraphContext::StartElement( const uno::Reference< xml::sax::XAttr rtl::OUString aLocalName; USHORT nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); - if( nPrefix == XML_NAMESPACE_TEXT && - IsXMLToken( aLocalName, XML_ID ) ) + if (IsXMLToken(aLocalName, XML_ID)) { - (*mpId) = xAttrList->getValueByIndex( i ); - break; // we only need this attribute + if (nPrefix == XML_NAMESPACE_XML) + { + (*mpId) = xAttrList->getValueByIndex( i ); + bHaveXmlId = true; + } + if (nPrefix == XML_NAMESPACE_TEXT) + { // text:id shall be ignored if xml:id exists + if (!bHaveXmlId) + { + (*mpId) = xAttrList->getValueByIndex( i ); + } + } } } } diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx index ec5c4b2130c1..9b6731f78da3 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx @@ -61,6 +61,7 @@ #include <com/sun/star/chart/ChartDataRowSource.hpp> #include <com/sun/star/chart/X3DDisplay.hpp> #include <com/sun/star/chart/XStatisticDisplay.hpp> +#include <com/sun/star/chart/XDiagramPositioning.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp> @@ -199,8 +200,8 @@ SchXMLPlotAreaContext::SchXMLPlotAreaContext( mnSeries( 0 ), m_aGlobalSeriesImportInfo( rAllRangeAddressesAvailable ), maSceneImportHelper( rImport ), - mbHasSize(false), - mbHasPosition(false), + m_aOuterPositioning( rImport ), + m_aInnerPositioning( rImport ), mbPercentStacked(false), m_bAxisPositionAttributeImported(false), m_rXLinkHRefAttributeToIndicateDataProvider(rXLinkHRefAttributeToIndicateDataProvider), @@ -296,15 +297,6 @@ SchXMLPlotAreaContext::~SchXMLPlotAreaContext() void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList ) { - uno::Any aTransMatrixAny; - - // initialize size and position - uno::Reference< drawing::XShape > xDiaShape( mxDiagram, uno::UNO_QUERY ); - bool bHasSizeWidth = false; - bool bHasSizeHeight = false; - bool bHasPositionX = false; - bool bHasPositionY = false; - // parse attributes sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0; const SvXMLTokenMap& rAttrTokenMap = mrImportHelper.GetPlotAreaAttrTokenMap(); @@ -320,20 +312,10 @@ void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttri switch( rAttrTokenMap.Get( nPrefix, aLocalName )) { case XML_TOK_PA_X: - GetImport().GetMM100UnitConverter().convertMeasure( maPosition.X, aValue ); - bHasPositionX = true; - break; case XML_TOK_PA_Y: - GetImport().GetMM100UnitConverter().convertMeasure( maPosition.Y, aValue ); - bHasPositionY = true; - break; case XML_TOK_PA_WIDTH: - GetImport().GetMM100UnitConverter().convertMeasure( maSize.Width, aValue ); - bHasSizeWidth = true; - break; case XML_TOK_PA_HEIGHT: - GetImport().GetMM100UnitConverter().convertMeasure( maSize.Height, aValue ); - bHasSizeHeight = true; + m_aOuterPositioning.readPositioningAttribute( nPrefix, aLocalName, aValue ); break; case XML_TOK_PA_STYLE_NAME: msAutoStyleName = aValue; @@ -369,9 +351,6 @@ void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttri } } - mbHasSize = bHasSizeWidth && bHasSizeHeight; - mbHasPosition = bHasPositionX && bHasPositionY; - if( ! mxNewDoc.is()) { uno::Reference< beans::XPropertySet > xDocProp( mrImportHelper.GetChartDocument(), uno::UNO_QUERY ); @@ -426,14 +405,7 @@ void SchXMLPlotAreaContext::StartElement( const uno::Reference< xml::sax::XAttri ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Lines")), pPropStyleContext, pStylesCtxt ); //handle automatic position and size - bool bAutoSize = false; - bool bAutoPosition = false; - SchXMLTools::getPropertyFromContext( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutomaticSize")), pPropStyleContext, pStylesCtxt ) >>= bAutoSize; - SchXMLTools::getPropertyFromContext( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutomaticPosition")), pPropStyleContext, pStylesCtxt ) >>= bAutoPosition; - mbHasSize = mbHasSize && !bAutoSize; - mbHasPosition = mbHasPosition && !bAutoPosition; + m_aOuterPositioning.readAutomaticPositioningProperties( pPropStyleContext, pStylesCtxt ); //correct default starting angle for old 3D pies if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan3_0( GetImport().GetModel() ) ) @@ -548,6 +520,13 @@ SvXMLImportContext* SchXMLPlotAreaContext::CreateChildContext( switch( rTokenMap.Get( nPrefix, rLocalName )) { + case XML_TOK_PA_COORDINATE_REGION_EXT: + case XML_TOK_PA_COORDINATE_REGION: + { + pContext = new SchXMLCoordinateRegionContext( GetImport(), nPrefix, rLocalName, m_aInnerPositioning ); + } + break; + case XML_TOK_PA_AXIS: { bool bAddMissingXAxisForNetCharts = false; @@ -711,13 +690,22 @@ void SchXMLPlotAreaContext::EndElement() } // set changed size and position after properties (esp. 3d) - uno::Reference< drawing::XShape > xDiaShape( mxDiagram, uno::UNO_QUERY ); - if( xDiaShape.is()) + + uno::Reference< chart::XDiagramPositioning > xDiaPos( mxDiagram, uno::UNO_QUERY ); + if( xDiaPos.is()) { - if( mbHasSize ) - xDiaShape->setSize( maSize ); - if( mbHasPosition ) - xDiaShape->setPosition( maPosition ); + if( !m_aOuterPositioning.isAutomatic() ) + { + if( m_aInnerPositioning.hasPosSize() ) + xDiaPos->setDiagramPositionExcludingAxes( m_aInnerPositioning.getRectangle() ); + else if( m_aOuterPositioning.hasPosSize() ) + { + 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() ); + } + } } CorrectAxisPositions(); @@ -1249,18 +1237,23 @@ void SchXMLAxisContext::CreateAxis() case SCH_XML_AXIS_Z: { + bool bSettingZAxisSuccedded = false; try { - xDiaProp->setPropertyValue( - rtl::OUString::createFromAscii( "HasZAxis" ), aTrueBool ); + rtl::OUString sHasZAxis( rtl::OUString::createFromAscii( "HasZAxis" ) ); + xDiaProp->setPropertyValue( sHasZAxis, aTrueBool ); + xDiaProp->getPropertyValue( sHasZAxis ) >>= bSettingZAxisSuccedded; } catch( beans::UnknownPropertyException & ) { DBG_ERROR( "Couldn't turn on z axis" ); } - uno::Reference< chart::XAxisZSupplier > xSuppl( mxDiagram, uno::UNO_QUERY ); - if( xSuppl.is()) - xProp = xSuppl->getZAxis(); + if( bSettingZAxisSuccedded ) + { + uno::Reference< chart::XAxisZSupplier > xSuppl( mxDiagram, uno::UNO_QUERY ); + if( xSuppl.is()) + xProp = xSuppl->getZAxis(); + } } break; case SCH_XML_AXIS_UNDEF: @@ -1681,6 +1674,134 @@ void SchXMLCategoriesContext::StartElement( const uno::Reference< xml::sax::XAtt // ======================================== +SchXMLPositonAttributesHelper::SchXMLPositonAttributesHelper( SvXMLImport& rImporter ) + : m_rImport( rImporter ) + , m_aPosition(0,0) + , m_aSize(0,0) + , m_bHasSizeWidth( false ) + , m_bHasSizeHeight( false ) + , m_bHasPositionX( false ) + , m_bHasPositionY( false ) + , m_bAutoSize( false ) + , m_bAutoPosition( false ) +{ +} + +SchXMLPositonAttributesHelper::~SchXMLPositonAttributesHelper() +{ +} + +bool SchXMLPositonAttributesHelper::hasSize() const +{ + return m_bHasSizeWidth && m_bHasSizeHeight; +} +bool SchXMLPositonAttributesHelper::hasPosition() const +{ + return m_bHasPositionX && m_bHasPositionY; +} +bool SchXMLPositonAttributesHelper::hasPosSize() const +{ + return hasPosition() && hasSize(); +} +bool SchXMLPositonAttributesHelper::isAutomatic() const +{ + return m_bAutoSize || m_bAutoPosition; +} +awt::Point SchXMLPositonAttributesHelper::getPosition() const +{ + return m_aPosition; +} +awt::Size SchXMLPositonAttributesHelper::getSize() const +{ + return m_aSize; +} +awt::Rectangle SchXMLPositonAttributesHelper::getRectangle() const +{ + return awt::Rectangle( m_aPosition.X, m_aPosition.Y, m_aSize.Width, m_aSize.Height ); +} + +bool SchXMLPositonAttributesHelper::readPositioningAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) +{ + //returns true if the attribute was proccessed + bool bReturn = true; + + if( XML_NAMESPACE_SVG == nPrefix ) + { + if( IsXMLToken( rLocalName, XML_X ) ) + { + m_rImport.GetMM100UnitConverter().convertMeasure( m_aPosition.X, rValue ); + m_bHasPositionX = true; + } + else if( IsXMLToken( rLocalName, XML_Y ) ) + { + m_rImport.GetMM100UnitConverter().convertMeasure( m_aPosition.Y, rValue ); + m_bHasPositionY = true; + } + else if( IsXMLToken( rLocalName, XML_WIDTH ) ) + { + m_rImport.GetMM100UnitConverter().convertMeasure( m_aSize.Width, rValue ); + m_bHasSizeWidth = true; + } + else if( IsXMLToken( rLocalName, XML_HEIGHT ) ) + { + m_rImport.GetMM100UnitConverter().convertMeasure( m_aSize.Height, rValue ); + m_bHasSizeHeight = true; + } + else + bReturn = false; + } + else + bReturn = false; + + return bReturn; +} + + +void SchXMLPositonAttributesHelper::readAutomaticPositioningProperties( XMLPropStyleContext* pPropStyleContext, const SvXMLStylesContext* pStylesCtxt ) +{ + if( pPropStyleContext && pStylesCtxt ) + { + //handle automatic position and size + SchXMLTools::getPropertyFromContext( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutomaticSize")), pPropStyleContext, pStylesCtxt ) >>= m_bAutoSize; + SchXMLTools::getPropertyFromContext( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AutomaticPosition")), pPropStyleContext, pStylesCtxt ) >>= m_bAutoPosition; + } +} + +// ======================================== + +SchXMLCoordinateRegionContext::SchXMLCoordinateRegionContext( + SvXMLImport& rImport + , sal_uInt16 nPrefix + , const rtl::OUString& rLocalName + , SchXMLPositonAttributesHelper& rPositioning ) + : SvXMLImportContext( rImport, nPrefix, rLocalName ) + , m_rPositioning( rPositioning ) +{ +} + +SchXMLCoordinateRegionContext::~SchXMLCoordinateRegionContext() +{ +} + +void SchXMLCoordinateRegionContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList ) +{ + // parse attributes + sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0; + + for( sal_Int16 i = 0; i < nAttrCount; i++ ) + { + rtl::OUString sAttrName = xAttrList->getNameByIndex( i ); + rtl::OUString aLocalName; + rtl::OUString aValue = xAttrList->getValueByIndex( i ); + USHORT nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); + m_rPositioning.readPositioningAttribute( nPrefix, aLocalName, aValue ); + } +} + +// ======================================== + SchXMLWallFloorContext::SchXMLWallFloorContext( SchXMLImportHelper& rImpHelper, SvXMLImport& rImport, diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.hxx b/xmloff/source/chart/SchXMLPlotAreaContext.hxx index 56aa3e78c814..1f0de466dcb1 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.hxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.hxx @@ -66,6 +66,43 @@ private: SchXML3DSceneAttributesHelper(); }; +// ---------------------------------------- + +class SchXMLPositonAttributesHelper +{ +public: + SchXMLPositonAttributesHelper( SvXMLImport& rImporter ); + ~SchXMLPositonAttributesHelper(); + + bool readPositioningAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); + void readAutomaticPositioningProperties( XMLPropStyleContext* pPropStyleContext, const SvXMLStylesContext* pStylesCtxt ); + + bool hasPosSize() const; + bool isAutomatic() const; + ::com::sun::star::awt::Rectangle getRectangle() const; + + +private: + bool hasSize() const; + bool hasPosition() const; + ::com::sun::star::awt::Size getSize() const; + ::com::sun::star::awt::Point getPosition() const; + + SvXMLImport& m_rImport; + + ::com::sun::star::awt::Point m_aPosition; + ::com::sun::star::awt::Size m_aSize; + + bool m_bHasSizeWidth; + bool m_bHasSizeHeight; + bool m_bHasPositionX; + bool m_bHasPositionY; + sal_Bool m_bAutoSize; + sal_Bool m_bAutoPosition; +}; + +// ---------------------------------------- + class SchXMLPlotAreaContext : public SvXMLImportContext { public: @@ -110,10 +147,8 @@ private: GlobalSeriesImportInfo m_aGlobalSeriesImportInfo; SchXML3DSceneAttributesHelper maSceneImportHelper; - ::com::sun::star::awt::Size maSize; - ::com::sun::star::awt::Point maPosition; - bool mbHasSize; - bool mbHasPosition; + SchXMLPositonAttributesHelper m_aOuterPositioning;//including axes and axes titles + SchXMLPositonAttributesHelper m_aInnerPositioning;//excluding axes and axes titles bool mbPercentStacked; bool m_bAxisPositionAttributeImported; ::rtl::OUString msAutoStyleName; @@ -216,6 +251,23 @@ public: // ---------------------------------------- +class SchXMLCoordinateRegionContext : public SvXMLImportContext +{ +public: + SchXMLCoordinateRegionContext( + SvXMLImport& rImport + , sal_uInt16 nPrefix + , const rtl::OUString& rLocalName + , SchXMLPositonAttributesHelper& rPositioning ); + virtual ~SchXMLCoordinateRegionContext(); + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + +private: + SchXMLPositonAttributesHelper& m_rPositioning; +}; + +// ---------------------------------------- + class SchXMLWallFloorContext : public SvXMLImportContext { public: diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx index 32fe36197a32..582e5aead326 100644 --- a/xmloff/source/chart/SchXMLTools.cxx +++ b/xmloff/source/chart/SchXMLTools.cxx @@ -757,6 +757,29 @@ void setBuildIDAtImportInfo( uno::Reference< frame::XModel > xModel, Reference< SvXMLMetaDocumentContext::setBuildId( aGenerator, xImportInfo ); } +bool isDocumentGeneratedWithOpenOfficeOlderThan3_3( const uno::Reference< frame::XModel >& xChartModel ) +{ + bool bResult = isDocumentGeneratedWithOpenOfficeOlderThan3_0( xChartModel ); + if( !bResult ) + { + ::rtl::OUString aGenerator( lcl_getGeneratorFromModel(xChartModel) ); + if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/3") ) ) != -1 ) + { + if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/300m") ) ) != -1 ) + { + sal_Int32 nBuilId = lcl_getBuildIDFromGenerator( lcl_getGeneratorFromModel(xChartModel) ); + if( nBuilId>0 && nBuilId<9491 ) //9491 is build id of dev300m76 + bResult= true; + } + else if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/310m") ) ) != -1 ) + bResult= true; + else if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/320m") ) ) != -1 ) + bResult= true; + } + } + return bResult; +} + bool isDocumentGeneratedWithOpenOfficeOlderThan3_0( const uno::Reference< frame::XModel >& xChartModel ) { bool bResult = isDocumentGeneratedWithOpenOfficeOlderThan2_3( xChartModel ); diff --git a/xmloff/source/chart/SchXMLTools.hxx b/xmloff/source/chart/SchXMLTools.hxx index 0b77d8e6d38a..bcc39ae3d114 100644 --- a/xmloff/source/chart/SchXMLTools.hxx +++ b/xmloff/source/chart/SchXMLTools.hxx @@ -54,6 +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_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/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 4c52cc2ce4cb..b1ba8520c1db 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -387,7 +387,7 @@ void SvXMLExport::_InitCtor() mpNamespaceMap->Add( GetXMLToken(XML_NP_OOOC), GetXMLToken(XML_N_OOOC), XML_NAMESPACE_OOOC ); mpNamespaceMap->Add( GetXMLToken(XML_NP_OF), GetXMLToken(XML_N_OF), XML_NAMESPACE_OF ); - if (getDefaultVersion() == SvtSaveOptions::ODFVER_LATEST) + if (getDefaultVersion() > SvtSaveOptions::ODFVER_012) { mpNamespaceMap->Add( GetXMLToken(XML_NP_TABLE_EXT), GetXMLToken(XML_N_TABLE_EXT), XML_NAMESPACE_TABLE_EXT); @@ -2535,6 +2535,22 @@ SvtSaveOptions::ODFDefaultVersion SvXMLExport::getDefaultVersion() const } void +SvXMLExport::AddAttributeIdLegacy( + sal_uInt16 const nLegacyPrefix, ::rtl::OUString const& rValue) +{ + switch (getDefaultVersion()) { + case SvtSaveOptions::ODFVER_011: // fall thru + case SvtSaveOptions::ODFVER_010: break; + default: // ODF 1.2: xml:id + AddAttribute(XML_NAMESPACE_XML, XML_ID, rValue); + } + // in ODF 1.1 this was form:id, anim:id, draw:id, or text:id + // backward compatibility: in ODF 1.2 write _both_ id attrs + AddAttribute(nLegacyPrefix, XML_ID, rValue); + // FIXME: this function simply assumes that rValue is unique +} + +void SvXMLExport::AddAttributeXmlId(uno::Reference<uno::XInterface> const & i_xIfc) { // check version >= 1.2 diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index 597a1d50b0f9..c791fe4077d4 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -99,6 +99,7 @@ sal_Char __READONLY_DATA sXML_np__text[] = "_text"; sal_Char __READONLY_DATA sXML_np__table[] = "_table"; sal_Char __READONLY_DATA sXML_np__table_ext[] = "_table_ooo"; sal_Char __READONLY_DATA sXML_np__draw[] = "_draw"; +sal_Char __READONLY_DATA sXML_np__draw_ext[] = "_draw_ooo"; sal_Char __READONLY_DATA sXML_np__dr3d[] = "_dr3d"; sal_Char __READONLY_DATA sXML_np__fo[] = "_fo"; sal_Char __READONLY_DATA sXML_np__xlink[] = "_xlink"; @@ -263,6 +264,9 @@ void SvXMLImport::_InitCtor() mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__draw ) ), GetXMLToken(XML_N_DRAW), XML_NAMESPACE_DRAW ); + mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__draw_ext ) ), + GetXMLToken(XML_N_DRAW_EXT), + XML_NAMESPACE_DRAW_EXT ); mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM (sXML_np__dr3d ) ), GetXMLToken(XML_N_DR3D), XML_NAMESPACE_DR3D ); diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 9b2fb9eea891..2e92c4a6a97d 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -156,6 +156,9 @@ namespace xmloff { namespace token { TOKEN( "tableooo", XML_NP_TABLE_EXT ), TOKEN( "http://openoffice.org/2009/table", XML_N_TABLE_EXT ), + TOKEN( "drawooo", XML_NP_DRAW_EXT ), + TOKEN( "http://openoffice.org/2010/draw", XML_N_DRAW_EXT ), + // units TOKEN( "mm", XML_UNIT_MM ), TOKEN( "m", XML_UNIT_M ), @@ -1713,6 +1716,7 @@ namespace xmloff { namespace token { TOKEN( "symbol-image-name", XML_SYMBOL_IMAGE_NAME ), TOKEN( "symbol-width", XML_SYMBOL_WIDTH ), TOKEN( "system", XML_SYSTEM ), + TOKEN( "tab-color", XML_TAB_COLOR ), TOKEN( "tab-stop", XML_TAB_STOP ), TOKEN( "tab-stop-distance", XML_TAB_STOP_DISTANCE ), TOKEN( "tab-stops", XML_TAB_STOPS ), @@ -2552,6 +2556,9 @@ namespace xmloff { namespace token { TOKEN( "dimension", XML_DIMENSION ), TOKEN( "validation-name", XML_VALIDATION_NAME ), + TOKEN( "screen", XML_SCREEN ), + TOKEN( "printer", XML_PRINTER ), + // XForms token TOKEN( "model", XML_MODEL ), TOKEN( "schema", XML_SCHEMA ), @@ -3096,6 +3103,10 @@ 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( "coordinate-region", XML_COORDINATE_REGION ), + #if OSL_DEBUG_LEVEL > 0 { 0, NULL, NULL, XML_TOKEN_END } #else diff --git a/xmloff/source/draw/animationexport.cxx b/xmloff/source/draw/animationexport.cxx index 7ebcef8ffde4..eaf83444114c 100644 --- a/xmloff/source/draw/animationexport.cxx +++ b/xmloff/source/draw/animationexport.cxx @@ -28,24 +28,14 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" -#ifndef _COM_SUN_STAR_ANIMATIONS_XAnimateColor_HPP_ #include <com/sun/star/animations/XAnimateColor.hpp> -#endif -#ifndef _COM_SUN_STAR_ANIMATIONS_XAnimateSet_HPP_ #include <com/sun/star/animations/XAnimateSet.hpp> -#endif #include <com/sun/star/animations/XCommand.hpp> #include <com/sun/star/animations/Timing.hpp> #include <com/sun/star/animations/Event.hpp> -#ifndef _COM_SUN_STAR_ANIMATIONS_XAnimateMotion_HPP_ #include <com/sun/star/animations/XAnimateMotion.hpp> -#endif -#ifndef _COM_SUN_STAR_ANIMATIONS_XAnimateTransform_HPP_ #include <com/sun/star/animations/XAnimateTransform.hpp> -#endif -#ifndef _COM_SUN_STAR_ANIMATIONS_XTransitionFilter_HPP_ #include <com/sun/star/animations/XTransitionFilter.hpp> -#endif #include <com/sun/star/animations/XIterateContainer.hpp> #include <com/sun/star/animations/XAudio.hpp> #include <com/sun/star/animations/AnimationColorSpace.hpp> @@ -64,19 +54,12 @@ #include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/presentation/EffectNodeType.hpp> -#ifndef _COM_SUN_STAR_PRESENTATION_EffectPresetClass_HPP_ #include <com/sun/star/presentation/EffectPresetClass.hpp> -#endif -#ifndef _COM_SUN_STAR_PRESENTATION_ParagraphTarget_HPP_ #include <com/sun/star/presentation/ParagraphTarget.hpp> -#endif #include <com/sun/star/presentation/TextAnimationType.hpp> #include <com/sun/star/presentation/ShapeAnimationSubType.hpp> #include <com/sun/star/presentation/EffectCommands.hpp> - -#ifndef _COM_SUN_STAR_DRAWING_XShape_HPP_ #include <com/sun/star/drawing/XShape.hpp> -#endif #include <tools/debug.hxx> #include <tools/time.hxx> @@ -780,7 +763,10 @@ void AnimationsExporterImpl::exportNode( const Reference< XAnimationNode >& xNod const OUString& rExportIdentifier = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xNode ); if( rExportIdentifier.getLength() ) - mrExport.AddAttribute( XML_NAMESPACE_ANIMATION, XML_ID, rExportIdentifier ); + { + mrExport.AddAttributeIdLegacy( + XML_NAMESPACE_ANIMATION, rExportIdentifier); + } Any aTemp( xNode->getBegin() ); if( aTemp.hasValue() ) diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx index 4fc6bc93302b..17bba5170c79 100644 --- a/xmloff/source/draw/animationimport.cxx +++ b/xmloff/source/draw/animationimport.cxx @@ -47,18 +47,14 @@ #include <com/sun/star/animations/XAudio.hpp> #include <com/sun/star/animations/ValuePair.hpp> #include <com/sun/star/animations/AnimationColorSpace.hpp> -#ifndef _COM_SUN_STAR_PRESENTATION_EffectPresetClass_HPP_ #include <com/sun/star/presentation/EffectPresetClass.hpp> -#endif #include <com/sun/star/animations/Timing.hpp> #include <com/sun/star/animations/Event.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/xml/sax/XAttributeList.hpp> #include <com/sun/star/text/XTextCursor.hpp> #include <com/sun/star/text/XTextRangeCompare.hpp> -#ifndef _COM_SUN_STAR_PRESENTATION_ParagraphTarget_HPP_ #include <com/sun/star/presentation/ParagraphTarget.hpp> -#endif #include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/animations/EventTrigger.hpp> @@ -237,7 +233,8 @@ enum AnimationNodeAttributes ANA_IterateType, ANA_IterateInterval, ANA_Formula, - ANA_ID, + ANA_ANIMID, + ANA_XMLID, ANA_Group_Id, ANA_Command, ANA_Volume @@ -294,8 +291,8 @@ const SvXMLTokenMap& AnimationsImportHelperImpl::getAnimationNodeAttributeTokenM { XML_NAMESPACE_ANIMATION, XML_ITERATE_TYPE, (sal_uInt16)ANA_IterateType }, { XML_NAMESPACE_ANIMATION, XML_ITERATE_INTERVAL, (sal_uInt16)ANA_IterateInterval }, { XML_NAMESPACE_ANIMATION, XML_FORMULA, (sal_uInt16)ANA_Formula }, - { XML_NAMESPACE_ANIMATION, XML_ID, (sal_uInt16)ANA_ID }, - { XML_NAMESPACE_XML, XML_ID, (sal_uInt16)ANA_ID }, + { XML_NAMESPACE_ANIMATION, XML_ID, (sal_uInt16)ANA_ANIMID }, + { XML_NAMESPACE_XML, XML_ID, (sal_uInt16)ANA_XMLID }, { XML_NAMESPACE_PRESENTATION, XML_GROUP_ID, (sal_uInt16)ANA_Group_Id }, { XML_NAMESPACE_ANIMATION, XML_AUDIO_LEVEL, (sal_uInt16)ANA_Volume }, { XML_NAMESPACE_ANIMATION, XML_COMMAND, (sal_uInt16)ANA_Command }, @@ -808,6 +805,8 @@ void AnimationNodeContext::init_node( const ::com::sun::star::uno::Reference< : std::list< NamedValue > aUserData; XMLTokenEnum meAttributeName = XML_TOKEN_INVALID; OUString aFrom, aBy, aTo, aValues; + bool bHaveXmlId( false ); + OUString sXmlId; const sal_Int16 nCount = xAttrList.is() ? xAttrList->getLength() : 0; sal_uInt16 nEnum; @@ -1054,13 +1053,15 @@ void AnimationNodeContext::init_node( const ::com::sun::star::uno::Reference< : } break; - case ANA_ID: + case ANA_ANIMID: { - if( rValue.getLength() ) - { - Reference< XInterface > xRef( mxNode, UNO_QUERY ); - GetImport().getInterfaceToIdentifierMapper().registerReference( rValue, xRef ); - } + if (!bHaveXmlId) { sXmlId = rValue; } + } + break; + case ANA_XMLID: + { + sXmlId = rValue; + bHaveXmlId = true; } break; @@ -1251,6 +1252,13 @@ void AnimationNodeContext::init_node( const ::com::sun::star::uno::Reference< : } } + if (sXmlId.getLength()) + { + Reference< XInterface > const xRef( mxNode, UNO_QUERY ); + GetImport().getInterfaceToIdentifierMapper().registerReference( + sXmlId, xRef ); + } + sal_Int32 nUserDataCount = aUserData.size(); if( nUserDataCount ) { diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index bc6f72abd2b0..862326495a70 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -641,12 +641,17 @@ void SAL_CALL SdXMLExport::setSourceDocument( const Reference< lang::XComponent GetXMLToken(XML_N_ANIMATION), XML_NAMESPACE_ANIMATION); - if( getDefaultVersion() == SvtSaveOptions::ODFVER_LATEST ) + if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) { _GetNamespaceMap().Add( GetXMLToken(XML_NP_OFFICE_EXT), GetXMLToken(XML_N_OFFICE_EXT), XML_NAMESPACE_OFFICE_EXT); + + _GetNamespaceMap().Add( + GetXMLToken(XML_NP_DRAW_EXT), + GetXMLToken(XML_N_DRAW_EXT), + XML_NAMESPACE_DRAW_EXT); } GetShapeExport()->enableLayerExport(); @@ -2011,7 +2016,9 @@ void SdXMLExport::_ExportContent() // write draw:id const OUString aPageId = getInterfaceToIdentifierMapper().getIdentifier( xDrawPage ); if( aPageId.getLength() != 0 ) - AddAttribute ( XML_NAMESPACE_DRAW, XML_ID, aPageId ); + { + AddAttributeIdLegacy(XML_NAMESPACE_DRAW, aPageId); + } // write page SvXMLElementExport aDPG(*this, XML_NAMESPACE_DRAW, XML_PAGE, sal_True, sal_True); @@ -2806,7 +2813,7 @@ void SdXMLExport::collectAnnotationAutoStyles( const Reference<XDrawPage>& xDraw void SdXMLExport::exportAnnotations( const Reference<XDrawPage>& xDrawPage ) { // do not export in ODF 1.2 or older - if( getDefaultVersion() != SvtSaveOptions::ODFVER_LATEST ) + if( getDefaultVersion() <= SvtSaveOptions::ODFVER_012 ) return; Reference< XAnnotationAccess > xAnnotationAccess( xDrawPage, UNO_QUERY ); diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx index 8ec97697b138..76942cf817db 100644 --- a/xmloff/source/draw/sdxmlimp.cxx +++ b/xmloff/source/draw/sdxmlimp.cxx @@ -665,8 +665,8 @@ const SvXMLTokenMap& SdXMLImport::GetDrawPageAttrTokenMap() { XML_NAMESPACE_DRAW, XML_STYLE_NAME, XML_TOK_DRAWPAGE_STYLE_NAME }, { XML_NAMESPACE_DRAW, XML_MASTER_PAGE_NAME, XML_TOK_DRAWPAGE_MASTER_PAGE_NAME }, { XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, XML_TOK_DRAWPAGE_PAGE_LAYOUT_NAME }, - { XML_NAMESPACE_DRAW, XML_ID, XML_TOK_DRAWPAGE_ID }, - { XML_NAMESPACE_XML, XML_ID, XML_TOK_DRAWPAGE_ID }, + { XML_NAMESPACE_DRAW, XML_ID, XML_TOK_DRAWPAGE_DRAWID }, + { XML_NAMESPACE_XML, XML_ID, XML_TOK_DRAWPAGE_XMLID }, { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_DRAWPAGE_HREF }, { XML_NAMESPACE_PRESENTATION, XML_USE_HEADER_NAME, XML_TOK_DRAWPAGE_USE_HEADER_NAME }, { XML_NAMESPACE_PRESENTATION, XML_USE_FOOTER_NAME, XML_TOK_DRAWPAGE_USE_FOOTER_NAME }, diff --git a/xmloff/source/draw/sdxmlimp_impl.hxx b/xmloff/source/draw/sdxmlimp_impl.hxx index 1c0b883c9b59..d1cd0df80563 100644 --- a/xmloff/source/draw/sdxmlimp_impl.hxx +++ b/xmloff/source/draw/sdxmlimp_impl.hxx @@ -130,7 +130,8 @@ enum SdXMLDrawPageAttrTokenMap XML_TOK_DRAWPAGE_STYLE_NAME, XML_TOK_DRAWPAGE_MASTER_PAGE_NAME, XML_TOK_DRAWPAGE_PAGE_LAYOUT_NAME, - XML_TOK_DRAWPAGE_ID, + XML_TOK_DRAWPAGE_DRAWID, + XML_TOK_DRAWPAGE_XMLID, XML_TOK_DRAWPAGE_HREF, XML_TOK_DRAWPAGE_USE_HEADER_NAME, XML_TOK_DRAWPAGE_USE_FOOTER_NAME, diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 3ec0d01ff1e5..d3dd99967ae9 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -47,9 +47,7 @@ #include <xmloff/xmluconv.hxx> #include "PropertySetMerger.hxx" -#ifndef _XMLOFF_SHAPEEXPORT_HXX #include <xmloff/shapeexport.hxx> -#endif #include "sdpropls.hxx" #include "sdxmlexp_impl.hxx" #include <xmloff/families.hxx> @@ -85,6 +83,8 @@ XMLShapeExport::XMLShapeExport(SvXMLExport& rExp, // #88546# init to FALSE mbHandleProgressBar( sal_False ), msZIndex( RTL_CONSTASCII_USTRINGPARAM("ZOrder") ), + msPrintable( RTL_CONSTASCII_USTRINGPARAM("Printable") ), + msVisible( RTL_CONSTASCII_USTRINGPARAM("Visible") ), msEmptyPres( RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), msModel( RTL_CONSTASCII_USTRINGPARAM("Model") ), msStartShape( RTL_CONSTASCII_USTRINGPARAM("StartShape") ), @@ -473,6 +473,7 @@ void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShap mrExport.getInterfaceToIdentifierMapper().registerReference( xConnection ); break; } + case XmlShapeTypePresTableShape: case XmlShapeTypeDrawTableShape: { try @@ -677,7 +678,9 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape uno::Reference< uno::XInterface > xRef( xShape, uno::UNO_QUERY ); const OUString& rShapeId = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xRef ); if( rShapeId.getLength() ) - mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_ID, rShapeId ); + { + mrExport.AddAttributeIdLegacy(XML_NAMESPACE_DRAW, rShapeId); + } } // -------------------------- @@ -704,6 +707,39 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape } } + // export draw:display (do not export in ODF 1.2 or older) + if( xSet.is() && ( mrExport.getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) ) + { + if( aShapeInfo.meShapeType != XmlShapeTypeDrawPageShape && aShapeInfo.meShapeType != XmlShapeTypePresPageShape && + aShapeInfo.meShapeType != XmlShapeTypeHandoutShape ) + + try + { + sal_Bool bVisible = sal_True; + sal_Bool bPrintable = sal_True; + + xSet->getPropertyValue(msVisible) >>= bVisible; + xSet->getPropertyValue(msPrintable) >>= bPrintable; + + XMLTokenEnum eDisplayToken = XML_TOKEN_INVALID; + const unsigned short nDisplay = (bVisible ? 2 : 0) | (bPrintable ? 1 : 0); + switch( nDisplay ) + { + case 0: eDisplayToken = XML_NONE; break; + case 1: eDisplayToken = XML_PRINTER; break; + case 2: eDisplayToken = XML_SCREEN; break; + // case 3: eDisplayToken = XML_ALWAYS break; this is the default + } + + if( eDisplayToken != XML_TOKEN_INVALID ) + mrExport.AddAttribute(XML_NAMESPACE_DRAW_EXT, XML_DISPLAY, eDisplayToken ); + } + catch( uno::Exception& ) + { + DBG_ERROR( "XMLShapeExport::exportShape(), exception caught!" ); + } + } + // #82003# test export count // #91587# ALWAYS increment since now ALL to be exported shapes are counted. if(mrExport.GetShapeExport()->IsHandleProgressBarEnabled()) @@ -797,6 +833,7 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape break; } + case XmlShapeTypePresTableShape: case XmlShapeTypeDrawTableShape: { ImpExportTableShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint ); @@ -866,6 +903,7 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape break; } + case XmlShapeTypePresMediaShape: case XmlShapeTypeDrawMediaShape: { ImpExportMediaShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint ); @@ -1125,7 +1163,7 @@ void XMLShapeExport::ImpCalcShapeType(const uno::Reference< drawing::XShape >& x // get info about presentation shape uno::Reference <beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY); - if(xPropSet.is()) + if(xPropSet.is()) try { rtl::OUString sCLSID; if(xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID"))) >>= sCLSID) @@ -1137,16 +1175,22 @@ void XMLShapeExport::ImpCalcShapeType(const uno::Reference< drawing::XShape >& x } } } + catch( uno::Exception& ) + { + DBG_ERROR( "XMLShapeExport::ImpCalcShapeType(), expected ole shape to have the CLSID property?" ); + } } else if(aType.EqualsAscii("Chart", 26, 5)) { eShapeType = XmlShapeTypePresChartShape; } else if(aType.EqualsAscii("OrgChart", 26, 8)) { eShapeType = XmlShapeTypePresOrgChartShape; } - else if(aType.EqualsAscii("TableShape", 26, 10)) { eShapeType = XmlShapeTypePresSheetShape; } + else if(aType.EqualsAscii("CalcShape", 26, 9)) { eShapeType = XmlShapeTypePresSheetShape; } + else if(aType.EqualsAscii("TableShape", 26, 10)) { eShapeType = XmlShapeTypePresTableShape; } else if(aType.EqualsAscii("Notes", 26, 5)) { eShapeType = XmlShapeTypePresNotesShape; } else if(aType.EqualsAscii("HandoutShape", 26, 12)) { eShapeType = XmlShapeTypeHandoutShape; } else if(aType.EqualsAscii("HeaderShape", 26, 11)) { eShapeType = XmlShapeTypePresHeaderShape; } else if(aType.EqualsAscii("FooterShape", 26, 11)) { eShapeType = XmlShapeTypePresFooterShape; } else if(aType.EqualsAscii("SlideNumberShape", 26, 16)) { eShapeType = XmlShapeTypePresSlideNumberShape; } else if(aType.EqualsAscii("DateTimeShape", 26, 13)) { eShapeType = XmlShapeTypePresDateTimeShape; } + else if(aType.EqualsAscii("MediaShape", 26, 10)) { eShapeType = XmlShapeTypePresMediaShape; } } } } diff --git a/xmloff/source/draw/shapeexport2.cxx b/xmloff/source/draw/shapeexport2.cxx index fb1d15f57350..d13b5e24e2db 100644 --- a/xmloff/source/draw/shapeexport2.cxx +++ b/xmloff/source/draw/shapeexport2.cxx @@ -31,7 +31,6 @@ #include <com/sun/star/text/XText.hpp> #include <com/sun/star/container/XNamed.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp> -#include <com/sun/star/chart/XChartDocument.hpp> #include <com/sun/star/drawing/CircleKind.hpp> #include <com/sun/star/drawing/ConnectorType.hpp> #include <com/sun/star/drawing/XControlShape.hpp> @@ -1247,27 +1246,6 @@ void XMLShapeExport::ImpExportChartShape( SvXMLAttributeList* pAttrList ) { ImpExportOLE2Shape( xShape, eShapeType, nFeatures, pRefPoint, pAttrList ); -/* - // Transformation - ImpExportNewTrans(xPropSet, nFeatures, pRefPoint); - - uno::Reference< chart::XChartDocument > xChartDoc; - if( !bIsEmptyPresObj ) - xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Model") ) ) >>= xChartDoc; - - if( xChartDoc.is() ) - { - // export chart data if the flag is not set (default) - sal_Bool bExportOwnData = ( nFeatures & SEF_EXPORT_NO_CHART_DATA ) == 0; - mrExport.GetChartExport()->exportChart( xChartDoc, bExportOwnData ); - } - else - { - // write chart object (fake for now, replace later) - SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_CHART, XML_CHART, sal_True, sal_True); - } - } -*/ } ////////////////////////////////////////////////////////////////////////////// @@ -1996,7 +1974,7 @@ void XMLShapeExport::ImpExportPluginShape( void XMLShapeExport::ImpExportMediaShape( const uno::Reference< drawing::XShape >& xShape, - XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint) + XmlShapeType eShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint) { const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); if(xPropSet.is()) @@ -2004,6 +1982,9 @@ void XMLShapeExport::ImpExportMediaShape( // Transformation ImpExportNewTrans(xPropSet, nFeatures, pRefPoint); + if(eShapeType == XmlShapeTypePresMediaShape) + ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_OBJECT) ); + sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, XML_FRAME, bCreateNewline, sal_True ); diff --git a/xmloff/source/draw/shapeexport4.cxx b/xmloff/source/draw/shapeexport4.cxx index 710d343ba42c..3f52fcd50084 100644 --- a/xmloff/source/draw/shapeexport4.cxx +++ b/xmloff/source/draw/shapeexport4.cxx @@ -1095,7 +1095,7 @@ void XMLShapeExport::ImpExportCustomShape( } } -void XMLShapeExport::ImpExportTableShape( const uno::Reference< drawing::XShape >& xShape, XmlShapeType /*eShapeType*/, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint ) +void XMLShapeExport::ImpExportTableShape( const uno::Reference< drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint ) { uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); uno::Reference< container::XNamed > xNamed(xShape, uno::UNO_QUERY); @@ -1109,8 +1109,8 @@ void XMLShapeExport::ImpExportTableShape( const uno::Reference< drawing::XShape sal_Bool bIsEmptyPresObj = sal_False; // presentation settings -// if(eShapeType == XmlShapeTypePresTableShape) -// bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_TABLE) ); + if(eShapeType == XmlShapeTypePresTableShape) + bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_TABLE) ); const bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); const bool bExportEmbedded(0 != (mrExport.getExportFlags() & EXPORT_EMBEDDED)); diff --git a/xmloff/source/draw/ximpbody.cxx b/xmloff/source/draw/ximpbody.cxx index 9b5290254b46..af5fef0ff9dc 100644 --- a/xmloff/source/draw/ximpbody.cxx +++ b/xmloff/source/draw/ximpbody.cxx @@ -62,6 +62,9 @@ SdXMLDrawPageContext::SdXMLDrawPageContext( SdXMLImport& rImport, : SdXMLGenericPageContext( rImport, nPrfx, rLocalName, xAttrList, rShapes ) , mbHadSMILNodes( false ) { + bool bHaveXmlId( false ); + OUString sXmlId; + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; for(sal_Int16 i=0; i < nAttrCount; i++) @@ -109,13 +112,17 @@ SdXMLDrawPageContext::SdXMLDrawPageContext( SdXMLImport& rImport, maUseDateTimeDeclName = sValue; break; } - - case XML_TOK_DRAWPAGE_ID: + case XML_TOK_DRAWPAGE_DRAWID: { - uno::Reference< uno::XInterface > xRef( rShapes.get() ); - GetImport().getInterfaceToIdentifierMapper().registerReference( sValue, xRef ); - break; + if (!bHaveXmlId) { sXmlId = sValue; } } + break; + case XML_TOK_DRAWPAGE_XMLID: + { + sXmlId = sValue; + bHaveXmlId = true; + } + break; case XML_TOK_DRAWPAGE_HREF: { maHREF = sValue; @@ -124,6 +131,12 @@ SdXMLDrawPageContext::SdXMLDrawPageContext( SdXMLImport& rImport, } } + if (sXmlId.getLength()) + { + uno::Reference< uno::XInterface > const xRef( rShapes.get() ); + GetImport().getInterfaceToIdentifierMapper().registerReference( + sXmlId, xRef ); + } GetImport().GetShapeImport()->startPage( rShapes ); uno::Reference< drawing::XDrawPage > xShapeDrawPage(rShapes, uno::UNO_QUERY); diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx index becfd05b1963..6c715b5ad77a 100644 --- a/xmloff/source/draw/ximppage.cxx +++ b/xmloff/source/draw/ximppage.cxx @@ -339,6 +339,9 @@ void SdXMLGenericPageContext::EndElement() else if( aDateTimeFormat.getLength() ) { const SdXMLStylesContext* pStyles = dynamic_cast< const SdXMLStylesContext* >( GetSdImport().GetShapeImport()->GetStylesContext() ); + if( !pStyles ) + pStyles = dynamic_cast< const SdXMLStylesContext* >( GetSdImport().GetShapeImport()->GetAutoStylesContext() ); + if( pStyles ) { const SdXMLNumberFormatImportContext* pSdNumStyle = diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 365fb000389e..b073e1e28d40 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -167,6 +167,8 @@ SdXMLShapeContext::SdXMLShapeContext( , mnZOrder(-1) , maSize(1, 1) , maPosition(0, 0) +, mbVisible(true) +, mbPrintable(true) { } @@ -444,6 +446,20 @@ void SdXMLShapeContext::AddShape(uno::Reference< drawing::XShape >& xShape) xMultiPropertyStates->setAllPropertiesToDefault(); } + if( !mbVisible || !mbPrintable ) try + { + uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY_THROW ); + if( !mbVisible ) + xSet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Visible" ) ), uno::Any( sal_False ) ); + + if( !mbPrintable ) + xSet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Printable" ) ), uno::Any( sal_False ) ); + } + catch( Exception& ) + { + DBG_ERROR( "SdXMLShapeContext::AddShape(), exception caught!" ); + } + // #107848# if(!mbTemporaryShape && (!GetImport().HasTextImport() || !GetImport().GetTextImport()->IsInsideDeleteContext())) @@ -776,7 +792,8 @@ void SdXMLShapeContext::SetThumbnail() // this is called from the parent group for each unparsed attribute in the attribute list void SdXMLShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) { - if( XML_NAMESPACE_DRAW == nPrefix ) + bool bHaveXmlId( false ); + if( (XML_NAMESPACE_DRAW == nPrefix) || (XML_NAMESPACE_DRAW_EXT == nPrefix) ) { if( IsXMLToken( rLocalName, XML_ZINDEX ) ) { @@ -784,7 +801,7 @@ void SdXMLShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUStr } else if( IsXMLToken( rLocalName, XML_ID ) ) { - maShapeId = rValue; + if (!bHaveXmlId) { maShapeId = rValue; }; } else if( IsXMLToken( rLocalName, XML_NAME ) ) { @@ -806,6 +823,11 @@ void SdXMLShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUStr { mnTransform.SetString(rValue, GetImport().GetMM100UnitConverter()); } + else if( IsXMLToken( rLocalName, XML_DISPLAY ) ) + { + mbVisible = IsXMLToken( rValue, XML_ALWAYS ) || IsXMLToken( rValue, XML_SCREEN ); + mbPrintable = IsXMLToken( rValue, XML_ALWAYS ) || IsXMLToken( rValue, XML_PRINTER ); + } } else if( XML_NAMESPACE_PRESENTATION == nPrefix ) { @@ -877,6 +899,7 @@ void SdXMLShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUStr if( IsXMLToken( rLocalName, XML_ID ) ) { maShapeId = rValue; + bHaveXmlId = true; } } } @@ -2563,7 +2586,7 @@ void SdXMLObjectShapeContext::StartElement( const ::com::sun::star::uno::Referen } else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_TABLE ) ) { - pService = "com.sun.star.presentation.TableShape"; + pService = "com.sun.star.presentation.CalcShape"; } else if( IsXMLToken( maPresentationClass, XML_PRESENTATION_OBJECT ) ) { @@ -2920,8 +2943,21 @@ void SdXMLPluginShapeContext::StartElement( const ::com::sun::star::uno::Referen const char* pService; + sal_Bool bIsPresShape = sal_False; + if( mbMedia ) + { pService = "com.sun.star.drawing.MediaShape"; + + bIsPresShape = maPresentationClass.getLength() && GetImport().GetShapeImport()->IsPresentationShapesSupported(); + if( bIsPresShape ) + { + if( IsXMLToken( maPresentationClass, XML_PRESENTATION_OBJECT ) ) + { + pService = "com.sun.star.presentation.MediaShape"; + } + } + } else pService = "com.sun.star.drawing.PluginShape"; @@ -2931,6 +2967,23 @@ void SdXMLPluginShapeContext::StartElement( const ::com::sun::star::uno::Referen { SetLayer(); + if(bIsPresShape) + { + uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY ); + if(xProps.is()) + { + uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() ); + if( xPropsInfo.is() ) + { + if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ))) + xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( sal_False ) ); + + if( mbIsUserTransformed && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ))) + xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ), ::cppu::bool2any( sal_False ) ); + } + } + } + // set pos, size, shear and rotate SetTransformation(); GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes ); @@ -3554,8 +3607,7 @@ void SdXMLTableShapeContext::StartElement( const ::com::sun::star::uno::Referenc { const char* pService = "com.sun.star.drawing.TableShape"; - sal_Bool bIsPresShape = sal_False; //maPresentationClass.getLength() && GetImport().GetShapeImport()->IsPresentationShapesSupported(); -/* + sal_Bool bIsPresShape = maPresentationClass.getLength() && GetImport().GetShapeImport()->IsPresentationShapesSupported(); if( bIsPresShape ) { if( IsXMLToken( maPresentationClass, XML_PRESENTATION_TABLE ) ) @@ -3563,7 +3615,7 @@ void SdXMLTableShapeContext::StartElement( const ::com::sun::star::uno::Referenc pService = "com.sun.star.presentation.TableShape"; } } -*/ + AddShape( pService ); if( mxShape.is() ) diff --git a/xmloff/source/draw/ximpshap.hxx b/xmloff/source/draw/ximpshap.hxx index 18453a8936af..bf15534fc260 100644 --- a/xmloff/source/draw/ximpshap.hxx +++ b/xmloff/source/draw/ximpshap.hxx @@ -83,6 +83,9 @@ protected: com::sun::star::awt::Size maSize; com::sun::star::awt::Point maPosition; + bool mbVisible; + bool mbPrintable; + /** if bSupportsStyle is false, auto styles will be set but not a style */ void SetStyle( bool bSupportsStyle = true ); void SetLayer(); diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx index 9baf402e5ea7..115b06c4c2ad 100644 --- a/xmloff/source/forms/elementexport.cxx +++ b/xmloff/source/forms/elementexport.cxx @@ -313,10 +313,8 @@ namespace xmloff if (CCA_CONTROL_ID & m_nIncludeCommon) { OSL_ENSURE(m_sControlId.getLength(), "OControlExport::exportInnerAttributes: have no control id for the control!"); - AddAttribute( - OAttributeMetaData::getCommonControlAttributeNamespace(CCA_CONTROL_ID), - OAttributeMetaData::getCommonControlAttributeName(CCA_CONTROL_ID), - m_sControlId); + m_rContext.getGlobalContext().AddAttributeIdLegacy( + XML_NAMESPACE_FORM, m_sControlId); #if OSL_DEBUG_LEVEL > 0 // reset the bit for later checking m_nIncludeCommon = m_nIncludeCommon & ~CCA_CONTROL_ID; @@ -693,7 +691,7 @@ namespace xmloff if (m_nIncludeCommon & CCA_TARGET_LOCATION) { - exportTargetLocationAttribute(); + exportTargetLocationAttribute(false); #if OSL_DEBUG_LEVEL > 0 // reset the bit for later checking m_nIncludeCommon = m_nIncludeCommon & ~CCA_TARGET_LOCATION; @@ -2035,6 +2033,9 @@ namespace xmloff OAttributeMetaData::getFormAttributeNamespace(eStringPropertyIds[i]), OAttributeMetaData::getFormAttributeName(eStringPropertyIds[i]), aStringPropertyNames[i]); + + // #i112082# xlink:type is added as part of exportTargetLocationAttribute + // now export the data source name or databaselocation or connection resource ::rtl::OUString sPropValue; m_xProps->getPropertyValue( PROPERTY_DATASOURCENAME ) >>= sPropValue; @@ -2134,7 +2135,7 @@ namespace xmloff // the target frame exportTargetFrameAttribute(); // the target URL - exportTargetLocationAttribute(); + exportTargetLocationAttribute(true); // #i110911# add type attribute (for form, but not for control) // master fields exportStringSequenceAttribute( diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx index a39576bd2184..b946c4a20941 100644 --- a/xmloff/source/forms/elementimport.cxx +++ b/xmloff/source/forms/elementimport.cxx @@ -586,12 +586,21 @@ namespace xmloff //--------------------------------------------------------------------- void OControlImport::handleAttribute(sal_uInt16 _nNamespaceKey, const ::rtl::OUString& _rLocalName, const ::rtl::OUString& _rValue) { - static const sal_Char* pControlIdAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCA_CONTROL_ID); static const sal_Char* pLinkedCellAttributeName = OAttributeMetaData::getBindingAttributeName(BA_LINKED_CELL); - if ( !m_sControlId.getLength() && _rLocalName.equalsAscii( pControlIdAttributeName ) ) + if (IsXMLToken(_rLocalName, XML_ID)) { // it's the control id - m_sControlId = _rValue; + if (XML_NAMESPACE_XML == _nNamespaceKey) + { + m_sControlId = _rValue; + } + else if (XML_NAMESPACE_FORM == _nNamespaceKey) + { + if (!m_sControlId.getLength()) + { + m_sControlId = _rValue; + } + } } else if ( _rLocalName.equalsAscii( pLinkedCellAttributeName ) ) { // it's the address of a spreadsheet cell diff --git a/xmloff/source/forms/formattributes.cxx b/xmloff/source/forms/formattributes.cxx index fbe388a6a81a..0e2ef69ab9f8 100644 --- a/xmloff/source/forms/formattributes.cxx +++ b/xmloff/source/forms/formattributes.cxx @@ -53,7 +53,7 @@ namespace xmloff case CCA_NAME: return "name"; case CCA_SERVICE_NAME: return "control-implementation"; case CCA_BUTTON_TYPE: return "button-type"; - case CCA_CONTROL_ID: return "id"; +// disabled(AddAttributeIdLegacy) case CCA_CONTROL_ID: return "id"; case CCA_CURRENT_SELECTED: return "current-selected"; case CCA_CURRENT_VALUE: return "current-value"; case CCA_DISABLED: return "disabled"; diff --git a/xmloff/source/forms/propertyexport.cxx b/xmloff/source/forms/propertyexport.cxx index 1586c9a7a439..2a485566cf9d 100644 --- a/xmloff/source/forms/propertyexport.cxx +++ b/xmloff/source/forms/propertyexport.cxx @@ -420,7 +420,7 @@ namespace xmloff } //--------------------------------------------------------------------- - void OPropertyExport::exportRelativeTargetLocation(const ConstAsciiString& _sPropertyName,sal_Int32 _nProperty) + void OPropertyExport::exportRelativeTargetLocation(const ConstAsciiString& _sPropertyName,sal_Int32 _nProperty,bool _bAddType) { DBG_CHECK_PROPERTY( _sPropertyName, ::rtl::OUString ); @@ -433,6 +433,10 @@ namespace xmloff ,OAttributeMetaData::getCommonControlAttributeName(_nProperty) , sTargetLocation); + // #i110911# add xlink:type="simple" if required + if (_bAddType) + AddAttribute(XML_NAMESPACE_XLINK, token::XML_TYPE, token::XML_SIMPLE); + exportedProperty(_sPropertyName); } //--------------------------------------------------------------------- diff --git a/xmloff/source/forms/propertyexport.hxx b/xmloff/source/forms/propertyexport.hxx index 5e1f683e339d..ab17912e4df4 100644 --- a/xmloff/source/forms/propertyexport.hxx +++ b/xmloff/source/forms/propertyexport.hxx @@ -69,7 +69,7 @@ namespace xmloff StringSet m_aRemainingProps; // see examinePersistence - void exportRelativeTargetLocation(const ConstAsciiString& _sPropertyName,sal_Int32 _nProperty); + void exportRelativeTargetLocation(const ConstAsciiString& _sPropertyName,sal_Int32 _nProperty,bool _bAddType); protected: IFormsExportContext& m_rContext; @@ -230,8 +230,10 @@ namespace xmloff <p>The value of this attribute is extracted from the TargetURL property of the object given.</p> <p>The property needs a special handling because the URL's need to be made relative</p> + + <p>If _bAddType is set, an additional xlink:type="simple" attribute is also added.</p> */ - inline void exportTargetLocationAttribute() { exportRelativeTargetLocation(PROPERTY_TARGETURL,CCA_TARGET_LOCATION); } + inline void exportTargetLocationAttribute(bool _bAddType) { exportRelativeTargetLocation(PROPERTY_TARGETURL,CCA_TARGET_LOCATION,_bAddType); } /** add the form:image attribute to the export context. @@ -239,7 +241,7 @@ namespace xmloff <p>The property needs a special handling because the URL's need to be made relative</p> */ - inline void exportImageDataAttribute() { exportRelativeTargetLocation(PROPERTY_IMAGEURL,CCA_IMAGE_DATA); } + inline void exportImageDataAttribute() { exportRelativeTargetLocation(PROPERTY_IMAGEURL,CCA_IMAGE_DATA,false); } /** flag the style properties as 'already exported' diff --git a/xmloff/source/forms/propertyimport.cxx b/xmloff/source/forms/propertyimport.cxx index 597798f01ce7..45fa2f5b4744 100644 --- a/xmloff/source/forms/propertyimport.cxx +++ b/xmloff/source/forms/propertyimport.cxx @@ -363,7 +363,7 @@ void OPropertyImport::handleAttribute(sal_uInt16 /*_nNamespaceKey*/, const ::rtl implPushBackPropertyValue( aNewValue ); } #if OSL_DEBUG_LEVEL > 0 - else + else if (!token::IsXMLToken(_rLocalName, token::XML_TYPE)) // xlink:type is valid but ignored for <form:form> { ::rtl::OString sMessage( "OPropertyImport::handleAttribute: Can't handle the following:\n" ); sMessage += ::rtl::OString( " Attribute name: " ); diff --git a/xmloff/source/forms/valueproperties.cxx b/xmloff/source/forms/valueproperties.cxx index 3515dcf96010..1c44db963944 100644 --- a/xmloff/source/forms/valueproperties.cxx +++ b/xmloff/source/forms/valueproperties.cxx @@ -116,7 +116,7 @@ namespace xmloff void OValuePropertiesMetaData::getValueLimitPropertyNames(sal_Int16 _nFormComponentType, sal_Char const * & _rpMinValuePropertyName, sal_Char const * & _rpMaxValuePropertyName) { - _rpMinValuePropertyName = _rpMinValuePropertyName = NULL; + _rpMinValuePropertyName = _rpMaxValuePropertyName = NULL; switch (_nFormComponentType) { case FormComponentType::DATEFIELD: diff --git a/xmloff/source/meta/xmlmetae.cxx b/xmloff/source/meta/xmlmetae.cxx index 8aa0a4054821..aab4686339ba 100644 --- a/xmloff/source/meta/xmlmetae.cxx +++ b/xmloff/source/meta/xmlmetae.cxx @@ -475,7 +475,9 @@ SvXMLMetaExport::startElement(const ::rtl::OUString & i_rName, } // finally, start the element - mrExport.StartElement(i_rName, sal_True); //FIXME:whitespace? + // #i107240# no whitespace here, because the DOM may already contain + // whitespace, which is not cleared when loading and thus accumulates. + mrExport.StartElement(i_rName, (m_level > 1) ? sal_False : sal_True); ++m_level; } diff --git a/xmloff/source/script/XMLEventExport.cxx b/xmloff/source/script/XMLEventExport.cxx index e7c716a39372..f126fd566e94 100644 --- a/xmloff/source/script/XMLEventExport.cxx +++ b/xmloff/source/script/XMLEventExport.cxx @@ -62,7 +62,8 @@ using ::xmloff::token::XML_EVENT_LISTENERS; XMLEventExport::XMLEventExport(SvXMLExport& rExp, const XMLEventNameTranslation* pTranslationTable) : sEventType(RTL_CONSTASCII_USTRINGPARAM("EventType")), - rExport(rExp) + rExport(rExp), + bExtNamespace(false) { AddTranslationTable(pTranslationTable); } @@ -175,6 +176,16 @@ void XMLEventExport::Export( Reference<XNameAccess> & rAccess, } } +void XMLEventExport::ExportExt( Reference<XNameAccess> & rAccess, + sal_Bool bWhitespace ) +{ + // set bExtNamespace flag to use XML_NAMESPACE_OFFICE_EXT namespace + // for events element (not for child elements) + bExtNamespace = true; + Export(rAccess, bWhitespace); + bExtNamespace = false; // reset for future Export calls +} + /// export a singular event and wirte <office:events> container void XMLEventExport::ExportSingleEvent( Sequence<PropertyValue>& rEventValues, @@ -270,13 +281,17 @@ void XMLEventExport::StartElement(sal_Bool bWhitespace) { rExport.IgnorableWhitespace(); } - rExport.StartElement( XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, + sal_uInt16 nNamespace = bExtNamespace ? XML_NAMESPACE_OFFICE_EXT + : XML_NAMESPACE_OFFICE; + rExport.StartElement( nNamespace, XML_EVENT_LISTENERS, bWhitespace); } void XMLEventExport::EndElement(sal_Bool bWhitespace) { - rExport.EndElement(XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, bWhitespace); + sal_uInt16 nNamespace = bExtNamespace ? XML_NAMESPACE_OFFICE_EXT + : XML_NAMESPACE_OFFICE; + rExport.EndElement(nNamespace, XML_EVENT_LISTENERS, bWhitespace); if (bWhitespace) { rExport.IgnorableWhitespace(); @@ -343,6 +358,10 @@ const XMLEventNameTranslation aStandardEventTable[] = { "OnFieldMerge", XML_NAMESPACE_OFFICE, "field-merge" }, { "OnFieldMergeFinished", XML_NAMESPACE_OFFICE, "field-merge-finished" }, { "OnLayoutFinished", XML_NAMESPACE_OFFICE, "layout-finished" }, + { "OnDoubleClick", XML_NAMESPACE_OFFICE, "dblclick" }, + { "OnRightClick", XML_NAMESPACE_OFFICE, "contextmenu" }, + { "OnChange", XML_NAMESPACE_OFFICE, "content-changed" }, + { "OnCalculate", XML_NAMESPACE_OFFICE, "calculated" }, { NULL, 0, 0 } }; diff --git a/xmloff/source/script/XMLScriptExportHandler.cxx b/xmloff/source/script/XMLScriptExportHandler.cxx index 724b6b0d2337..e04467d1e491 100644 --- a/xmloff/source/script/XMLScriptExportHandler.cxx +++ b/xmloff/source/script/XMLScriptExportHandler.cxx @@ -75,6 +75,9 @@ void XMLScriptExportHandler::Export( OUString sTmp; rValues[i].Value >>= sTmp; rExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sTmp); + + // #i110911# xlink:type="simple" is required + rExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE); } // else: disregard } diff --git a/xmloff/source/style/XMLFontAutoStylePool.cxx b/xmloff/source/style/XMLFontAutoStylePool.cxx index 68f77790ac49..dcc81ccf9f89 100644 --- a/xmloff/source/style/XMLFontAutoStylePool.cxx +++ b/xmloff/source/style/XMLFontAutoStylePool.cxx @@ -27,18 +27,19 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" + #include <tools/debug.hxx> #include <svl/cntnrsrt.hxx> #include <tools/fontenum.hxx> + #include "xmlnmspe.hxx" #include <xmloff/xmltoken.hxx> #include <xmloff/xmluconv.hxx> -#ifndef _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX #include "fonthdl.hxx" -#endif #include <xmloff/xmlexp.hxx> #include <xmloff/XMLFontAutoStylePool.hxx> + using ::rtl::OUString; using ::rtl::OUStringBuffer; diff --git a/xmloff/source/style/XMLFontStylesContext.cxx b/xmloff/source/style/XMLFontStylesContext.cxx index 37b8aa2196f3..49dd6ddac91e 100644 --- a/xmloff/source/style/XMLFontStylesContext.cxx +++ b/xmloff/source/style/XMLFontStylesContext.cxx @@ -28,25 +28,20 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" -#ifndef _COM_SUN_STAR_AWT_FONTFAMILY_HPP #include <com/sun/star/awt/FontFamily.hpp> -#endif -#ifndef _COM_SUN_STAR_AWT_FONTPITCH_HPP #include <com/sun/star/awt/FontPitch.hpp> -#endif + +#include <rtl/logfile.hxx> + #include <xmloff/nmspmap.hxx> #include "xmlnmspe.hxx" #include <xmloff/xmltoken.hxx> -#ifndef _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX #include "fonthdl.hxx" -#endif #include <xmloff/xmlimp.hxx> #include <xmloff/maptype.hxx> - -#ifndef _XMLOFF_XMLFONTSTYLESCONTEXT_HXX #include <xmloff/XMLFontStylesContext.hxx> -#endif -#include <rtl/logfile.hxx> + + using ::rtl::OUString; using ::rtl::OUStringBuffer; diff --git a/xmloff/source/style/fonthdl.cxx b/xmloff/source/style/fonthdl.cxx index 4d47ae9b996c..89ad6e9db8b8 100644 --- a/xmloff/source/style/fonthdl.cxx +++ b/xmloff/source/style/fonthdl.cxx @@ -28,9 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" -#ifndef _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX #include <fonthdl.hxx> -#endif #include <xmloff/xmltoken.hxx> #include <xmloff/xmluconv.hxx> #include <rtl/ustrbuf.hxx> diff --git a/xmloff/source/style/fonthdl.hxx b/xmloff/source/style/fonthdl.hxx index 49d027579af3..18ddae73af14 100644 --- a/xmloff/source/style/fonthdl.hxx +++ b/xmloff/source/style/fonthdl.hxx @@ -25,8 +25,8 @@ * ************************************************************************/ -#ifndef _XMLOFF_PROPERTYHANDLER_FONTYPES_HXX -#define _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX +#ifndef XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX +#define XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX #include <xmloff/xmlprhdl.hxx> @@ -79,4 +79,4 @@ public: }; -#endif // _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX +#endif // XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX diff --git a/xmloff/source/style/prhdlfac.cxx b/xmloff/source/style/prhdlfac.cxx index af5448040896..27af64469daf 100644 --- a/xmloff/source/style/prhdlfac.cxx +++ b/xmloff/source/style/prhdlfac.cxx @@ -27,10 +27,13 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" + #include <com/sun/star/drawing/ColorMode.hpp> #include <com/sun/star/text/HorizontalAdjust.hpp> #include <com/sun/star/text/WritingMode2.hpp> + #include <tools/debug.hxx> + #include <xmloff/prhdlfac.hxx> #include <xmloff/xmltypes.hxx> #include <xmloff/xmltoken.hxx> @@ -39,9 +42,7 @@ #include <xmloff/XMLConstantsPropertyHandler.hxx> #include "cdouthdl.hxx" #include "csmaphdl.hxx" -#ifndef _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX #include "fonthdl.hxx" -#endif #include "kernihdl.hxx" #include <postuhdl.hxx> #include "shadwhdl.hxx" diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx index 681fff7ea229..5bc581c7af0b 100644 --- a/xmloff/source/style/xmlnume.cxx +++ b/xmloff/source/style/xmlnume.cxx @@ -27,15 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" -#include <rtl/ustrbuf.hxx> -#include <tools/debug.hxx> -#include <xmloff/nmspmap.hxx> -#include "xmlnmspe.hxx" -#include <xmloff/xmltoken.hxx> -#include <xmloff/xmluconv.hxx> -#ifndef _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX -#include "fonthdl.hxx" -#endif + #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/style/NumberingType.hpp> #include <com/sun/star/style/XStyle.hpp> @@ -52,11 +44,22 @@ // <-- #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> + +#include <rtl/ustrbuf.hxx> + +#include <tools/debug.hxx> + +#include <xmloff/nmspmap.hxx> +#include "xmlnmspe.hxx" +#include <xmloff/xmltoken.hxx> +#include <xmloff/xmluconv.hxx> +#include "fonthdl.hxx" #include "XMLTextListAutoStylePool.hxx" #include <xmloff/xmlnume.hxx> #include <xmloff/xmlexp.hxx> #include <tools/fontenum.hxx> + using ::rtl::OUString; using ::rtl::OUStringBuffer; @@ -294,9 +297,12 @@ void SvxXMLNumRuleExport::exportLevelStyle( INT32 nLevel, OUStringBuffer sTmp; sTmp.append( nLevel + 1 ); GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_LEVEL, sTmp.makeStringAndClear() ); - if( sTextStyleName.getLength() > 0 ) + // #i110694#: no style-name on list-level-style-image + if ((sTextStyleName.getLength() > 0) && (NumberingType::BITMAP != eType)) + { GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME, GetExport().EncodeStyleName( sTextStyleName ) ); + } if( sPrefix.getLength() > 0 ) GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_NUM_PREFIX, sPrefix ); if( sSuffix.getLength() > 0 ) diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx index d64c22be0179..7306c7d5f0de 100644 --- a/xmloff/source/style/xmlnumi.cxx +++ b/xmloff/source/style/xmlnumi.cxx @@ -27,16 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_xmloff.hxx" -#include <rtl/ustrbuf.hxx> -#include <tools/urlobj.hxx> -#include <tools/debug.hxx> -#include <tools/fontenum.hxx> -#include <xmloff/xmltkmap.hxx> -#include <xmloff/nmspmap.hxx> -#include "xmlnmspe.hxx" -#include <xmloff/xmlimp.hxx> -#include <xmloff/XMLBase64ImportContext.hxx> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/awt/Size.hpp> @@ -51,26 +42,33 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/style/XStyle.hpp> #include <com/sun/star/io/XOutputStream.hpp> + +#include <rtl/ustrbuf.hxx> + +#include <tools/urlobj.hxx> +#include <tools/debug.hxx> +#include <tools/fontenum.hxx> + +#include <xmloff/xmltkmap.hxx> +#include <xmloff/nmspmap.hxx> +#include "xmlnmspe.hxx" +#include <xmloff/xmlimp.hxx> +#include <xmloff/XMLBase64ImportContext.hxx> #include <xmloff/xmltoken.hxx> #include "i18nmap.hxx" #include <xmloff/xmluconv.hxx> -#ifndef _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX #include "fonthdl.hxx" -#endif -#ifndef _XMLOFF_XMLFONTSTYLESCONTEXT_HXX #include <xmloff/XMLFontStylesContext.hxx> -#endif -#ifndef _XMLOFF_FAMILIES_HXX #include <xmloff/families.hxx> -#endif #include <xmloff/maptype.hxx> - #include <xmloff/xmlnumi.hxx> #define _SVSTDARR_USHORTS #include <svl/svstdarr.hxx> + + using ::rtl::OUString; using ::rtl::OUStringBuffer; diff --git a/xmloff/source/table/XMLTableExport.cxx b/xmloff/source/table/XMLTableExport.cxx index 7affab134134..ad3a1f96752f 100644 --- a/xmloff/source/table/XMLTableExport.cxx +++ b/xmloff/source/table/XMLTableExport.cxx @@ -353,6 +353,8 @@ static bool has_states( const std::vector< XMLPropertyState >& xPropStates ) // get the current row Reference< XCellRange > xCellRange( xIndexAccess->getByIndex(rowIndex), UNO_QUERY_THROW ); + OUString sDefaultCellStyle; + // table:style-name if( pTableInfo.get() ) { @@ -360,11 +362,11 @@ static bool has_states( const std::vector< XMLPropertyState >& xPropStates ) const OUString sStyleName( pTableInfo->maRowStyleMap[xKey] ); if( sStyleName.getLength() ) mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_STYLE_NAME, sStyleName ); - } - const OUString sDefaultCellStyle( pTableInfo->maDefaultRowCellStyles[rowIndex] ); - if( sDefaultCellStyle.getLength() ) - mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DEFAULT_CELL_STYLE_NAME, sDefaultCellStyle ); + sDefaultCellStyle = pTableInfo->maDefaultRowCellStyles[rowIndex]; + if( sDefaultCellStyle.getLength() ) + mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_DEFAULT_CELL_STYLE_NAME, sDefaultCellStyle ); + } // write row element SvXMLElementExport tableRowElement( mrExport, XML_NAMESPACE_TABLE, XML_TABLE_ROW, sal_True, sal_True ); diff --git a/xmloff/source/text/XMLChangedRegionImportContext.cxx b/xmloff/source/text/XMLChangedRegionImportContext.cxx index 7e46c66442f4..52e4ccc8e048 100644 --- a/xmloff/source/text/XMLChangedRegionImportContext.cxx +++ b/xmloff/source/text/XMLChangedRegionImportContext.cxx @@ -68,6 +68,7 @@ void XMLChangedRegionImportContext::StartElement( const Reference<XAttributeList> & xAttrList) { // process attributes: id + bool bHaveXmlId( false ); sal_Int16 nLength = xAttrList->getLength(); for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++) { @@ -77,11 +78,19 @@ void XMLChangedRegionImportContext::StartElement( &sLocalName ); const OUString sValue = xAttrList->getValueByIndex(nAttr); - if ( XML_NAMESPACE_TEXT == nPrefix ) + if (XML_NAMESPACE_XML == nPrefix) { - if( IsXMLToken( sLocalName, XML_ID ) ) + if (IsXMLToken(sLocalName, XML_ID)) { sID = sValue; + bHaveXmlId = true; + } + } + else if (XML_NAMESPACE_TEXT == nPrefix) + { + if (IsXMLToken(sLocalName, XML_ID)) + { + if (!bHaveXmlId) { sID = sValue; } } else if( IsXMLToken( sLocalName, XML_MERGE_LAST_PARAGRAPH ) ) { diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx index d4ab361f1688..67970330f3ef 100644 --- a/xmloff/source/text/XMLRedlineExport.cxx +++ b/xmloff/source/text/XMLRedlineExport.cxx @@ -374,7 +374,7 @@ void XMLRedlineExport::ExportChangedRegion( const Reference<XPropertySet> & rPropSet) { // Redline-ID - rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_ID, GetRedlineID(rPropSet) ); + rExport.AddAttributeIdLegacy(XML_NAMESPACE_TEXT, GetRedlineID(rPropSet)); // merge-last-paragraph Any aAny = rPropSet->getPropertyValue(sMergeLastPara); diff --git a/xmloff/source/text/XMLSectionExport.cxx b/xmloff/source/text/XMLSectionExport.cxx index 0a0437426a3c..7cf96abea2e2 100644 --- a/xmloff/source/text/XMLSectionExport.cxx +++ b/xmloff/source/text/XMLSectionExport.cxx @@ -917,7 +917,7 @@ void XMLSectionExport::ExportBaseIndexSource( void XMLSectionExport::ExportBaseIndexBody( SectionTypeEnum - #ifdef DBG_UTIL + #if OSL_DEBUG_LEVEL > 0 eType #endif , diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 8c5cf9e83237..87710d310d76 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -119,7 +119,7 @@ using namespace ::com::sun::star::lang; using namespace ::xmloff::token; using ::com::sun::star::util::DateTime; using namespace ::com::sun::star::ucb; - +using namespace ::com::sun::star; using ::comphelper::UStringLess; @@ -343,11 +343,11 @@ static __FAR_DATA SvXMLTokenMapEntry aTextPAttrTokenMap[] = { XML_NAMESPACE_XHTML, XML_PROPERTY, XML_TOK_TEXT_P_PROPERTY }, { XML_NAMESPACE_XHTML, XML_CONTENT, XML_TOK_TEXT_P_CONTENT }, { XML_NAMESPACE_XHTML, XML_DATATYPE, XML_TOK_TEXT_P_DATATYPE }, + { XML_NAMESPACE_TEXT, XML_ID, XML_TOK_TEXT_P_TEXTID }, { XML_NAMESPACE_TEXT, XML_STYLE_NAME, XML_TOK_TEXT_P_STYLE_NAME }, { XML_NAMESPACE_TEXT, XML_COND_STYLE_NAME, XML_TOK_TEXT_P_COND_STYLE_NAME }, { XML_NAMESPACE_TEXT, XML_OUTLINE_LEVEL,XML_TOK_TEXT_P_LEVEL }, - { XML_NAMESPACE_TEXT, XML_ID, XML_TOK_TEXT_P_ID }, { XML_NAMESPACE_TEXT, XML_IS_LIST_HEADER,XML_TOK_TEXT_P_IS_LIST_HEADER }, { XML_NAMESPACE_TEXT, XML_RESTART_NUMBERING,XML_TOK_TEXT_P_RESTART_NUMBERING }, { XML_NAMESPACE_TEXT, XML_START_VALUE,XML_TOK_TEXT_P_START_VALUE }, @@ -1823,8 +1823,28 @@ OUString XMLTextImportHelper::SetStyleAndAttrs( Reference<XTextContent> xTextContent(xTmp, UNO_QUERY); if (m_pImpl->m_xText.is() && xRange.is()) { - m_pImpl->m_xText->insertTextContent( - xRange, xTextContent, sal_True); + // #i107225# the combined characters need to be inserted first + // the selected text has to be removed afterwards + m_pImpl->m_xText->insertTextContent( xRange->getStart(), xTextContent, sal_True ); + + if( xRange->getString().getLength() ) + { + try + { + uno::Reference< text::XTextCursor > xCrsr = xRange->getText()->createTextCursorByRange( xRange->getStart() ); + xCrsr->goLeft( 1, true ); + uno::Reference< beans::XPropertySet> xCrsrProperties( xCrsr, uno::UNO_QUERY_THROW ); + //the hard properties of the removed text need to be applied to the combined characters field + pStyle->FillPropertySet( xCrsrProperties ); + xCrsr->collapseToEnd(); + xCrsr->gotoRange( xRange->getEnd(), true ); + xCrsr->setString( ::rtl::OUString() ); + } + catch( const uno::Exception& rEx ) + { + (void)rEx; + } + } } } } diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index 61559549c6e7..140656fd4298 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -1998,7 +1998,18 @@ void XMLTextParagraphExport::exportParagraph( { const OUString& rIdentifier = GetExport().getInterfaceToIdentifierMapper().getIdentifier( xRef ); if( rIdentifier.getLength() ) - GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_ID, rIdentifier ); + { + // FIXME: this is just temporary until EditEngine + // paragraphs implement XMetadatable. + // then that must be used and not the mapper, because + // when both can be used we get two xml:id! + uno::Reference<rdf::XMetadatable> const xMeta(xRef, + uno::UNO_QUERY); + OSL_ENSURE(!xMeta.is(), "paragraph that implements " + "XMetadatable used in interfaceToIdentifierMapper?"); + GetExport().AddAttributeIdLegacy(XML_NAMESPACE_TEXT, + rIdentifier); + } } OUString sAutoStyle( sStyle ); diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx index a2f6c4a01f27..566c94ed166a 100644 --- a/xmloff/source/text/txtparai.cxx +++ b/xmloff/source/text/txtparai.cxx @@ -1917,6 +1917,7 @@ XMLParaContext::XMLParaContext( const SvXMLTokenMap& rTokenMap = GetImport().GetTextImport()->GetTextPAttrTokenMap(); + bool bHaveXmlId( false ); OUString aCondStyleName, sClassNames; sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; @@ -1933,6 +1934,7 @@ XMLParaContext::XMLParaContext( { case XML_TOK_TEXT_P_XMLID: m_sXmlId = rValue; + bHaveXmlId = true; break; case XML_TOK_TEXT_P_ABOUT: m_sAbout = rValue; @@ -1947,6 +1949,9 @@ XMLParaContext::XMLParaContext( case XML_TOK_TEXT_P_DATATYPE: m_sDatatype = rValue; break; + case XML_TOK_TEXT_P_TEXTID: + if (!bHaveXmlId) { m_sXmlId = rValue; } + break; case XML_TOK_TEXT_P_STYLE_NAME: sStyleName = rValue; break; @@ -1979,9 +1984,6 @@ XMLParaContext::XMLParaContext( } } break; - case XML_TOK_TEXT_P_ID: - sId = rValue; - break; case XML_TOK_TEXT_P_RESTART_NUMBERING: { sal_Bool bBool; @@ -2020,14 +2022,17 @@ XMLParaContext::~XMLParaContext() // if we have an id set for this paragraph, get a cursor for this // paragraph and register it with the given identifier - if( sId.getLength() ) + // FIXME: this is just temporary, and should be removed when + // EditEngine paragraphs implement XMetadatable! + if (m_sXmlId.getLength()) { Reference < XTextCursor > xIdCursor( xTxtImport->GetText()->createTextCursorByRange( xStart ) ); if( xIdCursor.is() ) { xIdCursor->gotoRange( xEnd, sal_True ); Reference< XInterface > xRef( xIdCursor, UNO_QUERY ); - GetImport().getInterfaceToIdentifierMapper().registerReference( sId, xRef ); + GetImport().getInterfaceToIdentifierMapper().registerReference( + m_sXmlId, xRef); } } diff --git a/xmloff/source/text/txtparai.hxx b/xmloff/source/text/txtparai.hxx index 9c911a5b639c..ecd593ca3d4f 100644 --- a/xmloff/source/text/txtparai.hxx +++ b/xmloff/source/text/txtparai.hxx @@ -46,7 +46,6 @@ class XMLParaContext : public SvXMLImportContext ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextRange > xStart; // xub_StrLen nStart; ::rtl::OUString sStyleName; - ::rtl::OUString sId; ::rtl::OUString m_sXmlId; ::rtl::OUString m_sAbout; ::rtl::OUString m_sProperty; |