From ec712408961a4a2efc667a7af83a21209907f9eb Mon Sep 17 00:00:00 2001 From: Ingrid Halama Date: Fri, 20 Nov 2009 11:58:22 +0100 Subject: chartpositioning: #i100778# chart positioning excluding labels --- xmloff/source/chart/SchXMLExport.cxx | 351 ++++++++++++++++++++------ xmloff/source/chart/SchXMLImport.cxx | 1 + xmloff/source/chart/SchXMLPlotAreaContext.cxx | 194 +++++++++++--- xmloff/source/chart/SchXMLPlotAreaContext.hxx | 59 ++++- xmloff/source/core/xmltoken.cxx | 3 + xmloff/source/draw/shapeexport2.cxx | 22 -- 6 files changed, 488 insertions(+), 142 deletions(-) (limited to 'xmloff/source') diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index f7cf82abe974..5232c757ccb7 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -81,6 +81,7 @@ #include #include #include +#include #include #include @@ -120,6 +121,162 @@ using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Any; +// ======================================== +// 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 elements + void exportAutoStyles(); + + /** export the element corresponding to rChartDoc + if bIncludeTable is true, the chart data is exported as + 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 exportExcludingPosition( 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 ); + /// interchanges rows and columns of the sequence given + void swapDataArray( com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< double > >& rSequence ); + /// 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; +}; + namespace { Reference< uno::XComponentContext > lcl_getComponentContext() @@ -369,7 +526,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; @@ -386,7 +543,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; @@ -468,10 +625,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->first.is()) @@ -610,7 +767,7 @@ template< class T > }; -typedef ::std::map< sal_Int32, SchXMLExportHelper::tLabelValuesDataPair > +typedef ::std::map< sal_Int32, SchXMLExportHelper_Impl::tLabelValuesDataPair > lcl_DataSequenceMap; struct lcl_SequenceToMapElement : @@ -642,7 +799,7 @@ private: }; void lcl_PrepareInternalSequencesForTableExport( - SchXMLExportHelper::tDataSequenceCont & rInOutSequences, bool bHasCategories ) + SchXMLExportHelper_Impl::tDataSequenceCont & rInOutSequences, bool bHasCategories ) { lcl_DataSequenceMap aIndexSequenceMap; const sal_Int32 nOffset = bHasCategories ? 1 : 0; @@ -660,7 +817,7 @@ void lcl_PrepareInternalSequencesForTableExport( // 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 ); } @@ -668,21 +825,21 @@ void lcl_PrepareInternalSequencesForTableExport( lcl_TableData lcl_getDataForLocalTable( - const SchXMLExportHelper::tDataSequenceCont & aPassedSequences, bool bHasCategoryLabels, + const SchXMLExportHelper_Impl::tDataSequenceCont & aPassedSequences, bool bHasCategoryLabels, bool bSwap, bool bHasOwnData, const Reference< chart2::data::XRangeXMLConversion > & xRangeConversion ) { lcl_TableData aResult; - SchXMLExportHelper::tDataSequenceCont aSequencesToExport( aPassedSequences ); + SchXMLExportHelper_Impl::tDataSequenceCont aSequencesToExport( aPassedSequences ); if( bHasOwnData ) lcl_PrepareInternalSequencesForTableExport( aSequencesToExport, bHasCategoryLabels ); - 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 ); if( bHasCategoryLabels ) { @@ -876,7 +1033,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 ), @@ -945,56 +1148,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(); @@ -1019,7 +1188,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 ) { @@ -1455,7 +1624,7 @@ void SchXMLExportHelper::parseDocument( Reference< chart::XChartDocument >& rCha delete pElChart; } -void SchXMLExportHelper::exportTable() +void SchXMLExportHelper_Impl::exportTable() { // table element // ------------- @@ -1593,7 +1762,7 @@ void SchXMLExportHelper::exportTable() OSL_ASSERT( bHasOwnData || (aFirstColumnRangeIter == aFirstColumnRangeEndIter) ); } -void SchXMLExportHelper::exportPlotArea( +void SchXMLExportHelper_Impl::exportPlotArea( Reference< chart::XDiagram > xDiagram, Reference< chart2::XDiagram > xNewDiagram, const awt::Size & rPageSize, @@ -1753,9 +1922,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 + exportExcludingPosition( xDiagram ); + // light sources (inside plot area element) if( bIs3DChart && rShapeExport.is()) @@ -1916,7 +2088,27 @@ void SchXMLExportHelper::exportPlotArea( delete pElPlotArea; } -void SchXMLExportHelper::exportAxes( +void SchXMLExportHelper_Impl::exportExcludingPosition( const uno::Reference< chart::XDiagram >& xDiagram ) +{ + 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) ); + + sal_Bool bPreferExcludingPositioning = xDiaPos->isExcludingDiagramPositioning(); + rtl::OUStringBuffer sStringBuffer; + SvXMLUnitConverter::convertBool( sStringBuffer, bPreferExcludingPositioning ); + String aString( sStringBuffer.makeStringAndClear() ); + mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_PREFER_EXCLUDING_POSITION, aString ); + + SvXMLElementExport aExcludingPosition( mrExport, XML_NAMESPACE_CHART, XML_EXCLUDING_POSITION, sal_True, sal_True ); +} + +void SchXMLExportHelper_Impl::exportAxes( const Reference< chart::XDiagram > & xDiagram, const Reference< chart2::XDiagram > & xNewDiagram, sal_Bool bExportContent ) @@ -2518,7 +2710,7 @@ void SchXMLExportHelper::exportAxes( } } -void SchXMLExportHelper::exportSeries( +void SchXMLExportHelper_Impl::exportSeries( const Reference< chart2::XDiagram > & xNewDiagram, const awt::Size & rPageSize, sal_Bool bExportContent, @@ -2887,7 +3079,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, @@ -2994,7 +3186,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, @@ -3112,7 +3304,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, @@ -3360,7 +3552,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 ) @@ -3380,7 +3572,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(); @@ -3391,13 +3583,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(); @@ -3408,13 +3600,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 ); @@ -3425,7 +3617,7 @@ awt::Size SchXMLExportHelper::getPageSize( const Reference< chart2::XChartDocume return aSize; } -void SchXMLExportHelper::swapDataArray( Sequence< Sequence< double > >& rSequence ) +void SchXMLExportHelper_Impl::swapDataArray( Sequence< Sequence< double > >& rSequence ) { sal_Int32 nOuterSize = rSequence.getLength(); sal_Int32 nInnerSize = rSequence[0].getLength(); // assume that all subsequences have same length @@ -3443,13 +3635,13 @@ void SchXMLExportHelper::swapDataArray( Sequence< Sequence< double > >& rSequenc rSequence = aResult; } -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() ) { @@ -3460,7 +3652,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 ); } @@ -3493,7 +3685,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 ); } @@ -3516,8 +3708,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 { @@ -3566,13 +3758,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); @@ -3585,7 +3777,7 @@ void SchXMLExport::_ExportContent() } } } - maExportHelper.exportChart( xChartDoc, bIncludeTable ); + maExportHelper.m_pImpl->exportChart( xChartDoc, bIncludeTable ); } else { @@ -3600,7 +3792,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 dd955e6d69d5..1087845f965e 100644 --- a/xmloff/source/chart/SchXMLImport.cxx +++ b/xmloff/source/chart/SchXMLImport.cxx @@ -285,6 +285,7 @@ const SvXMLTokenMap& SchXMLImportHelper::GetPlotAreaElemTokenMap() { static __FAR_DATA SvXMLTokenMapEntry aPlotAreaElemTokenMap[] = { + { XML_NAMESPACE_CHART, XML_EXCLUDING_POSITION, XML_TOK_PA_EXCLUDING_POSITION }, { XML_NAMESPACE_CHART, XML_AXIS, XML_TOK_PA_AXIS }, { XML_NAMESPACE_CHART, XML_SERIES, XML_TOK_PA_SERIES }, { XML_NAMESPACE_CHART, XML_WALL, XML_TOK_PA_WALL }, diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx index 8bb4712b4159..37fa8249d9c8 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx @@ -64,6 +64,7 @@ #include #include #include +#include #include #include @@ -202,8 +203,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), @@ -299,15 +300,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(); @@ -323,20 +315,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; @@ -372,9 +354,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 ); @@ -429,14 +408,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() ) ) @@ -551,6 +523,12 @@ SvXMLImportContext* SchXMLPlotAreaContext::CreateChildContext( switch( rTokenMap.Get( nPrefix, rLocalName )) { + case XML_TOK_PA_EXCLUDING_POSITION: + { + pContext = new SchXMLExcludingPositionContext( GetImport(), nPrefix, rLocalName, m_aInnerPositioning ); + } + break; + case XML_TOK_PA_AXIS: { bool bAddMissingXAxisForNetCharts = false; @@ -714,13 +692,14 @@ 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_aInnerPositioning.hasPosSize() ) + xDiaPos->setDiagramPositionExcludingAxes( m_aInnerPositioning.getRectangle() ); + else if( m_aOuterPositioning.hasPosSize() ) + xDiaPos->setDiagramPositionIncludingAxesAndAxesTitles( m_aOuterPositioning.getRectangle() ); } CorrectAxisPositions(); @@ -1680,6 +1659,143 @@ 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 && !m_bAutoSize; +} +bool SchXMLPositonAttributesHelper::hasPosition() const +{ + return m_bHasPositionX && m_bHasPositionY && !m_bAutoPosition; +} +bool SchXMLPositonAttributesHelper::hasPosSize() const +{ + return hasPosition() && hasSize(); +} +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 if( XML_NAMESPACE_CHART == nPrefix ) + { + //Attribute( XML_NAMESPACE_CHART, XML_PREFER_EXCLUDING_POSITION + + sal_Bool bPreferExcludingPosition = false; + if( IsXMLToken( rLocalName, XML_PREFER_EXCLUDING_POSITION ) ) + { + m_rImport.GetMM100UnitConverter().convertBool( bPreferExcludingPosition, rValue ); + m_bAutoPosition = m_bAutoSize = !bPreferExcludingPosition; + } + else + bReturn = false; + } + 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; + } +} + +// ======================================== + +SchXMLExcludingPositionContext::SchXMLExcludingPositionContext( + SvXMLImport& rImport + , sal_uInt16 nPrefix + , const rtl::OUString& rLocalName + , SchXMLPositonAttributesHelper& rPositioning ) + : SvXMLImportContext( rImport, nPrefix, rLocalName ) + , m_rPositioning( rPositioning ) +{ +} + +SchXMLExcludingPositionContext::~SchXMLExcludingPositionContext() +{ +} + +void SchXMLExcludingPositionContext::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 ed01ad2fa8da..af6f600200d5 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.hxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.hxx @@ -69,6 +69,42 @@ 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; + ::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: @@ -113,10 +149,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; @@ -219,6 +253,23 @@ public: // ---------------------------------------- +class SchXMLExcludingPositionContext : public SvXMLImportContext +{ +public: + SchXMLExcludingPositionContext( + SvXMLImport& rImport + , sal_uInt16 nPrefix + , const rtl::OUString& rLocalName + , SchXMLPositonAttributesHelper& rPositioning ); + virtual ~SchXMLExcludingPositionContext(); + 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/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index ae95763f1936..8b0155d1b08a 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3095,6 +3095,9 @@ namespace xmloff { namespace token { TOKEN( "ends-with", XML_ENDS_WITH ), TOKEN( "does-not-end-with", XML_DOES_NOT_END_WITH ), + TOKEN( "excluding-position", XML_EXCLUDING_POSITION ), + TOKEN( "prefer-excluding-position", XML_PREFER_EXCLUDING_POSITION ), + #if OSL_DEBUG_LEVEL > 0 { 0, NULL, NULL, XML_TOKEN_END } #else diff --git a/xmloff/source/draw/shapeexport2.cxx b/xmloff/source/draw/shapeexport2.cxx index b2e81d333fba..b55942cfb00c 100644 --- a/xmloff/source/draw/shapeexport2.cxx +++ b/xmloff/source/draw/shapeexport2.cxx @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -1250,27 +1249,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); - } - } -*/ } ////////////////////////////////////////////////////////////////////////////// -- cgit From ef09592d5ae968b7337863bb1a3538944ed1a960 Mon Sep 17 00:00:00 2001 From: os Date: Wed, 10 Feb 2010 13:23:01 +0100 Subject: #i107225# combined characters: prevent unwanted merge of consecutive fields --- xmloff/source/text/txtimp.cxx | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'xmloff/source') diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 7817fa7c4c19..cf8f6ee13e82 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -110,7 +110,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; static __FAR_DATA SvXMLTokenMapEntry aTextElemTokenMap[] = @@ -1355,8 +1355,29 @@ OUString XMLTextImportHelper::SetStyleAndAttrs( Reference xTextContent(xTmp, UNO_QUERY); if (xText.is() && xRange.is()) { - xText->insertTextContent( xRange, xTextContent, + // #i107225# the combined characters need to be inserted first + // the selected text has to be removed afterwards + 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; + } + } } } } -- cgit From 33ef17ed7207b82d8e6fe1fa4ddaec676092d0f1 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Tue, 2 Mar 2010 19:50:13 +0100 Subject: added Visible property for shapes --- xmloff/source/core/xmlexp.cxx | 2 +- xmloff/source/core/xmlimp.cxx | 4 ++++ xmloff/source/core/xmltoken.cxx | 6 ++++++ xmloff/source/draw/sdxmlexp.cxx | 9 +++++++-- xmloff/source/draw/shapeexport.cxx | 31 +++++++++++++++++++++++++++++++ xmloff/source/draw/ximpshap.cxx | 23 ++++++++++++++++++++++- xmloff/source/draw/ximpshap.hxx | 3 +++ 7 files changed, 74 insertions(+), 4 deletions(-) (limited to 'xmloff/source') diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 2eaaeceb444e..e3a55c93a546 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -320,7 +320,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); diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index 6a7dcf496722..deeb0e0a20ec 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -100,6 +100,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..aa61f3408541 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 ), @@ -2552,6 +2555,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 ), diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index bc6f72abd2b0..849a3f884714 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_12 ) { _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(); @@ -2806,7 +2811,7 @@ void SdXMLExport::collectAnnotationAutoStyles( const Reference& xDraw void SdXMLExport::exportAnnotations( const Reference& 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/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 709677c6ae07..7c01d533cfd8 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -79,6 +79,8 @@ XMLShapeExport::XMLShapeExport(SvXMLExport& rExp, // #88546# init to FALSE mbHandleProgressBar( sal_False ), msZIndex( RTL_CONSTASCII_USTRINGPARAM("ZOrder") ), + msPrintable( RTL_CONSTASCII_USTRINGPARAM("Pintable") ), + msVisible( RTL_CONSTASCII_USTRINGPARAM("Visible") ), msEmptyPres( RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), msModel( RTL_CONSTASCII_USTRINGPARAM("Model") ), msStartShape( RTL_CONSTASCII_USTRINGPARAM("StartShape") ), @@ -666,6 +668,35 @@ 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 ) ) + { + try + { + sal_Bool bVisible = sal_True; + sal_Bool bPrintable = sal_True; + + xSet->getPropertyValue(msVisible) >>= bVisible; + xSet->getPropertyValue(msPrintable) >>= bPrintable; + + XMLTokenEnum eDisplayToken = XML_TOKEN_INVALID; + switch( (bVisible << 1) | bPrintable ) + { + 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()) diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index f4e7c1466ecd..14d73153f191 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) { } @@ -429,6 +431,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())) @@ -761,7 +777,7 @@ 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 ) + if( (XML_NAMESPACE_DRAW == nPrefix) || (XML_NAMESPACE_DRAW_EXT == nPrefix) ) { if( IsXMLToken( rLocalName, XML_ZINDEX ) ) { @@ -791,6 +807,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 ) { 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(); -- cgit From b7792cd554c3144c1cc2b06bb7ceb467bc771230 Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Thu, 4 Mar 2010 16:38:48 +0100 Subject: #i161701# fixing typo --- xmloff/source/draw/sdxmlexp.cxx | 2 +- xmloff/source/draw/shapeexport.cxx | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'xmloff/source') diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index 849a3f884714..53a2f3cc4454 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -641,7 +641,7 @@ void SAL_CALL SdXMLExport::setSourceDocument( const Reference< lang::XComponent GetXMLToken(XML_N_ANIMATION), XML_NAMESPACE_ANIMATION); - if( getDefaultVersion() > SvtSaveOptions::ODFVER_12 ) + if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) { _GetNamespaceMap().Add( GetXMLToken(XML_NP_OFFICE_EXT), diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 7c01d533cfd8..f76fc87f87e1 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -79,7 +79,7 @@ XMLShapeExport::XMLShapeExport(SvXMLExport& rExp, // #88546# init to FALSE mbHandleProgressBar( sal_False ), msZIndex( RTL_CONSTASCII_USTRINGPARAM("ZOrder") ), - msPrintable( RTL_CONSTASCII_USTRINGPARAM("Pintable") ), + msPrintable( RTL_CONSTASCII_USTRINGPARAM("Printable") ), msVisible( RTL_CONSTASCII_USTRINGPARAM("Visible") ), msEmptyPres( RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), msModel( RTL_CONSTASCII_USTRINGPARAM("Model") ), @@ -671,6 +671,9 @@ 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; @@ -680,7 +683,8 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape xSet->getPropertyValue(msPrintable) >>= bPrintable; XMLTokenEnum eDisplayToken = XML_TOKEN_INVALID; - switch( (bVisible << 1) | bPrintable ) + const unsigned short nDisplay = (bVisible ? 2 : 0) | (bPrintable ? 1 : 0); + switch( nDisplay ) { case 0: eDisplayToken = XML_NONE; break; case 1: eDisplayToken = XML_PRINTER; break; -- cgit From b7db16a355f9bfbab65e1a88e1e4dede35bf7357 Mon Sep 17 00:00:00 2001 From: Ingrid Halama Date: Wed, 31 Mar 2010 18:43:41 +0200 Subject: chartpositioning: #i98398# treat diagram size without title sizes (correct ODF import/export, correct diagram sizing per mouse, correct API for import) --- xmloff/source/chart/SchXMLPlotAreaContext.cxx | 25 ++++++++++++++++++++----- xmloff/source/chart/SchXMLPlotAreaContext.hxx | 1 + xmloff/source/chart/SchXMLTools.cxx | 21 +++++++++++++++++++++ xmloff/source/chart/SchXMLTools.hxx | 1 + 4 files changed, 43 insertions(+), 5 deletions(-) (limited to 'xmloff/source') diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx index 7b7802a8f295..3621789099b6 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx @@ -693,10 +693,21 @@ void SchXMLPlotAreaContext::EndElement() uno::Reference< chart::XDiagramPositioning > xDiaPos( mxDiagram, uno::UNO_QUERY ); if( xDiaPos.is()) { + bool bOuterSize = m_aOuterPositioning.hasPosSize() && !m_aOuterPositioning.isAutomatic(); if( m_aInnerPositioning.hasPosSize() ) - xDiaPos->setDiagramPositionExcludingAxes( m_aInnerPositioning.getRectangle() ); - else if( m_aOuterPositioning.hasPosSize() ) - xDiaPos->setDiagramPositionIncludingAxesAndAxesTitles( m_aOuterPositioning.getRectangle() ); + { + if( !m_aInnerPositioning.isAutomatic() ) + xDiaPos->setDiagramPositionExcludingAxes( m_aInnerPositioning.getRectangle() ); + else if( bOuterSize ) + xDiaPos->setDiagramPositionIncludingAxes( m_aOuterPositioning.getRectangle() ); + } + else if( bOuterSize ) + { + if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan3_4( GetImport().GetModel() ) ) //old version of OOo did write a wrong rectangle for the diagram size + xDiaPos->setDiagramPositionIncludingAxesAndAxesTitles( m_aOuterPositioning.getRectangle() ); + else + xDiaPos->setDiagramPositionIncludingAxes( m_aOuterPositioning.getRectangle() ); + } } CorrectAxisPositions(); @@ -1675,16 +1686,20 @@ SchXMLPositonAttributesHelper::~SchXMLPositonAttributesHelper() bool SchXMLPositonAttributesHelper::hasSize() const { - return m_bHasSizeWidth && m_bHasSizeHeight && !m_bAutoSize; + return m_bHasSizeWidth && m_bHasSizeHeight; } bool SchXMLPositonAttributesHelper::hasPosition() const { - return m_bHasPositionX && m_bHasPositionY && !m_bAutoPosition; + 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; diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.hxx b/xmloff/source/chart/SchXMLPlotAreaContext.hxx index 632abe209188..cb986d7e7a3d 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.hxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.hxx @@ -78,6 +78,7 @@ public: void readAutomaticPositioningProperties( XMLPropStyleContext* pPropStyleContext, const SvXMLStylesContext* pStylesCtxt ); bool hasPosSize() const; + bool isAutomatic() const; ::com::sun::star::awt::Rectangle getRectangle() const; diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx index f5059f979b63..f836f1c1de7c 100644 --- a/xmloff/source/chart/SchXMLTools.cxx +++ b/xmloff/source/chart/SchXMLTools.cxx @@ -705,6 +705,27 @@ void setBuildIDAtImportInfo( uno::Reference< frame::XModel > xModel, Reference< SvXMLMetaDocumentContext::setBuildId( aGenerator, xImportInfo ); } +bool isDocumentGeneratedWithOpenOfficeOlderThan3_4( 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 ) + 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; + else if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/330m") ) ) != -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 35ac3ff72f1b..4912eb5d286e 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_4( 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 ); -- cgit From f549461066693eb19fdf8bbb4139bcb5e70eca77 Mon Sep 17 00:00:00 2001 From: Ingrid Halama Date: Wed, 31 Mar 2010 20:07:14 +0200 Subject: chartpositioning: #i100778# fixed typo --- xmloff/source/chart/SchXMLPlotAreaContext.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xmloff/source') diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx index 3621789099b6..8f0767c3b6b9 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx @@ -704,7 +704,7 @@ void SchXMLPlotAreaContext::EndElement() else if( bOuterSize ) { if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan3_4( GetImport().GetModel() ) ) //old version of OOo did write a wrong rectangle for the diagram size - xDiaPos->setDiagramPositionIncludingAxesAndAxesTitles( m_aOuterPositioning.getRectangle() ); + xDiaPos->setDiagramPositionIncludingAxesAndAxisTitles( m_aOuterPositioning.getRectangle() ); else xDiaPos->setDiagramPositionIncludingAxes( m_aOuterPositioning.getRectangle() ); } -- cgit From 5b0fcb960d8b6d49faf40a442b69036bd8efa688 Mon Sep 17 00:00:00 2001 From: Ingrid Halama Date: Thu, 1 Apr 2010 20:29:01 +0200 Subject: chartpositioning: #i100778# correct ODF behaviour --- xmloff/source/chart/SchXMLExport.cxx | 12 ++++++++++-- xmloff/source/chart/SchXMLImport.cxx | 3 +++ xmloff/source/chart/SchXMLPlotAreaContext.cxx | 16 +++++----------- xmloff/source/chart/SchXMLTools.cxx | 4 +--- xmloff/source/chart/SchXMLTools.hxx | 2 +- xmloff/source/core/xmltoken.cxx | 2 ++ 6 files changed, 22 insertions(+), 17 deletions(-) (limited to 'xmloff/source') diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 51541c6df637..cc281c165cb3 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -2085,6 +2085,12 @@ void SchXMLExportHelper_Impl::exportPlotArea( void SchXMLExportHelper_Impl::exportExcludingPosition( const uno::Reference< chart::XDiagram >& xDiagram ) { + const SvtSaveOptions::ODFDefaultVersion nCurrentODFVersion( SvtSaveOptions().GetODFDefaultVersion() ); + if( nCurrentODFVersion <= SvtSaveOptions::ODFVER_012 )//do not export to ODF 1.2 or older + return; + if( nCurrentODFVersion != SvtSaveOptions::ODFVER_LATEST )//export only if extensions are enabled //todo: change this dependent on fileformat evolution + return; + Reference< chart::XDiagramPositioning > xDiaPos( xDiagram, uno::UNO_QUERY ); DBG_ASSERT( xDiaPos.is(), "Invalid xDiaPos as parameter" ); if( !xDiaPos.is() ) @@ -2098,9 +2104,9 @@ void SchXMLExportHelper_Impl::exportExcludingPosition( const uno::Reference< cha rtl::OUStringBuffer sStringBuffer; SvXMLUnitConverter::convertBool( sStringBuffer, bPreferExcludingPositioning ); String aString( sStringBuffer.makeStringAndClear() ); - mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_PREFER_EXCLUDING_POSITION, aString ); + mrExport.AddAttribute( XML_NAMESPACE_CHART_EXT, XML_PREFER_EXCLUDING_POSITION, aString );//todo: change to chart namespace in future - dependent on fileformat - SvXMLElementExport aExcludingPosition( mrExport, XML_NAMESPACE_CHART, XML_EXCLUDING_POSITION, sal_True, sal_True ); + SvXMLElementExport aExcludingPosition( mrExport, XML_NAMESPACE_CHART_EXT, XML_EXCLUDING_POSITION, sal_True, sal_True );//todo: change to chart namespace in future - dependent on fileformat } void SchXMLExportHelper_Impl::exportAxes( @@ -3646,6 +3652,8 @@ SchXMLExport::SchXMLExport( maAutoStylePool( *this ), maExportHelper( *this, maAutoStylePool ) { + if( getDefaultVersion() == SvtSaveOptions::ODFVER_LATEST ) + _GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART_EXT), GetXMLToken(XML_N_CHART_EXT), XML_NAMESPACE_CHART_EXT); } diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx index 2fc23926ef1e..501f92953663 100644 --- a/xmloff/source/chart/SchXMLImport.cxx +++ b/xmloff/source/chart/SchXMLImport.cxx @@ -281,6 +281,7 @@ const SvXMLTokenMap& SchXMLImportHelper::GetPlotAreaElemTokenMap() { static __FAR_DATA SvXMLTokenMapEntry aPlotAreaElemTokenMap[] = { + { XML_NAMESPACE_CHART_EXT, XML_EXCLUDING_POSITION, XML_TOK_PA_EXCLUDING_POSITION_EXT }, { XML_NAMESPACE_CHART, XML_EXCLUDING_POSITION, XML_TOK_PA_EXCLUDING_POSITION }, { XML_NAMESPACE_CHART, XML_AXIS, XML_TOK_PA_AXIS }, { XML_NAMESPACE_CHART, XML_SERIES, XML_TOK_PA_SERIES }, @@ -658,6 +659,7 @@ SchXMLImport::SchXMLImport( SvXMLImport( xServiceFactory, nImportFlags ) { GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK ); + GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART_EXT), GetXMLToken(XML_N_CHART_EXT), XML_NAMESPACE_CHART_EXT); mbIsGraphicLoadOnDemandSupported = false; } @@ -671,6 +673,7 @@ SchXMLImport::SchXMLImport( : SvXMLImport( xServiceFactory, xModel, rGrfContainer ) { GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK ); + GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART_EXT), GetXMLToken(XML_N_CHART_EXT), XML_NAMESPACE_CHART_EXT); // get status indicator (if requested) if( bShowProgress ) diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx index 8f0767c3b6b9..3792deefebbd 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx @@ -520,6 +520,7 @@ SvXMLImportContext* SchXMLPlotAreaContext::CreateChildContext( switch( rTokenMap.Get( nPrefix, rLocalName )) { + case XML_TOK_PA_EXCLUDING_POSITION_EXT: case XML_TOK_PA_EXCLUDING_POSITION: { pContext = new SchXMLExcludingPositionContext( GetImport(), nPrefix, rLocalName, m_aInnerPositioning ); @@ -703,7 +704,7 @@ void SchXMLPlotAreaContext::EndElement() } else if( bOuterSize ) { - if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan3_4( GetImport().GetModel() ) ) //old version of OOo did write a wrong rectangle for the diagram size + if( SchXMLTools::isDocumentGeneratedWithOpenOfficeOlderThan3_3( GetImport().GetModel() ) ) //old version of OOo did write a wrong rectangle for the diagram size xDiaPos->setDiagramPositionIncludingAxesAndAxisTitles( m_aOuterPositioning.getRectangle() ); else xDiaPos->setDiagramPositionIncludingAxes( m_aOuterPositioning.getRectangle() ); @@ -1743,18 +1744,11 @@ bool SchXMLPositonAttributesHelper::readPositioningAttribute( sal_uInt16 nPrefix else bReturn = false; } - else if( XML_NAMESPACE_CHART == nPrefix ) + else if( IsXMLToken( rLocalName, XML_PREFER_EXCLUDING_POSITION ) ) { - //Attribute( XML_NAMESPACE_CHART, XML_PREFER_EXCLUDING_POSITION - sal_Bool bPreferExcludingPosition = false; - if( IsXMLToken( rLocalName, XML_PREFER_EXCLUDING_POSITION ) ) - { - m_rImport.GetMM100UnitConverter().convertBool( bPreferExcludingPosition, rValue ); - m_bAutoPosition = m_bAutoSize = !bPreferExcludingPosition; - } - else - bReturn = false; + m_rImport.GetMM100UnitConverter().convertBool( bPreferExcludingPosition, rValue ); + m_bAutoPosition = m_bAutoSize = !bPreferExcludingPosition; } else bReturn = false; diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx index f836f1c1de7c..c6fb4d0ca013 100644 --- a/xmloff/source/chart/SchXMLTools.cxx +++ b/xmloff/source/chart/SchXMLTools.cxx @@ -705,7 +705,7 @@ void setBuildIDAtImportInfo( uno::Reference< frame::XModel > xModel, Reference< SvXMLMetaDocumentContext::setBuildId( aGenerator, xImportInfo ); } -bool isDocumentGeneratedWithOpenOfficeOlderThan3_4( const uno::Reference< frame::XModel >& xChartModel ) +bool isDocumentGeneratedWithOpenOfficeOlderThan3_3( const uno::Reference< frame::XModel >& xChartModel ) { bool bResult = isDocumentGeneratedWithOpenOfficeOlderThan3_0( xChartModel ); if( !bResult ) @@ -719,8 +719,6 @@ bool isDocumentGeneratedWithOpenOfficeOlderThan3_4( const uno::Reference< frame: bResult= true; else if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/320m") ) ) != -1 ) bResult= true; - else if( aGenerator.indexOf( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OpenOffice.org_project/330m") ) ) != -1 ) - bResult= true; } } return bResult; diff --git a/xmloff/source/chart/SchXMLTools.hxx b/xmloff/source/chart/SchXMLTools.hxx index 4912eb5d286e..382e6c5cc16f 100644 --- a/xmloff/source/chart/SchXMLTools.hxx +++ b/xmloff/source/chart/SchXMLTools.hxx @@ -54,7 +54,7 @@ namespace SchXMLTools bool isDocumentGeneratedWithOpenOfficeOlderThan2_3( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel); bool isDocumentGeneratedWithOpenOfficeOlderThan2_4( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel); bool isDocumentGeneratedWithOpenOfficeOlderThan3_0( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel); - bool isDocumentGeneratedWithOpenOfficeOlderThan3_4( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel); + bool isDocumentGeneratedWithOpenOfficeOlderThan3_3( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel); void setBuildIDAtImportInfo( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel , ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xImportInfo ); diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 7ea75b1868d3..2fb65535964c 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3096,6 +3096,8 @@ namespace xmloff { namespace token { TOKEN( "ends-with", XML_ENDS_WITH ), TOKEN( "does-not-end-with", XML_DOES_NOT_END_WITH ), + TOKEN( "chartooo", XML_NP_CHART_EXT ), + TOKEN( "http://openoffice.org/2010/chart", XML_N_CHART_EXT ), TOKEN( "excluding-position", XML_EXCLUDING_POSITION ), TOKEN( "prefer-excluding-position", XML_PREFER_EXCLUDING_POSITION ), -- cgit From 21cf3286fe2d239cc8697258b1af4e7294cc6607 Mon Sep 17 00:00:00 2001 From: Ingrid Halama Date: Tue, 6 Apr 2010 11:47:20 +0200 Subject: chartpositioning: #i100778# correct ODF behaviour --- xmloff/source/chart/SchXMLTools.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'xmloff/source') diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx index c6fb4d0ca013..4456fbec7cb1 100644 --- a/xmloff/source/chart/SchXMLTools.cxx +++ b/xmloff/source/chart/SchXMLTools.cxx @@ -714,7 +714,11 @@ bool isDocumentGeneratedWithOpenOfficeOlderThan3_3( const uno::Reference< frame: 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 ) - bResult= true; + { + sal_Int32 nBuilId = lcl_getBuildIDFromGenerator( lcl_getGeneratorFromModel(xChartModel) ); + if( nBuilId>0 && nBuilId<9488 ) //9488 is build id of dev300m75 + 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 ) -- cgit From 838c91c229efff4a846fb8d6efd0211b999adf56 Mon Sep 17 00:00:00 2001 From: Ingrid Halama Date: Wed, 14 Apr 2010 12:21:27 +0200 Subject: chartpositioning: #i100778# correct ODF behaviour --- xmloff/source/chart/SchXMLExport.cxx | 4 ++-- xmloff/source/chart/SchXMLImport.cxx | 4 ++-- xmloff/source/chart/SchXMLPlotAreaContext.cxx | 6 +++--- xmloff/source/chart/SchXMLTools.cxx | 2 +- xmloff/source/core/xmltoken.cxx | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) (limited to 'xmloff/source') diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index cc281c165cb3..9f0653cd44d9 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -2104,9 +2104,9 @@ void SchXMLExportHelper_Impl::exportExcludingPosition( const uno::Reference< cha rtl::OUStringBuffer sStringBuffer; SvXMLUnitConverter::convertBool( sStringBuffer, bPreferExcludingPositioning ); String aString( sStringBuffer.makeStringAndClear() ); - mrExport.AddAttribute( XML_NAMESPACE_CHART_EXT, XML_PREFER_EXCLUDING_POSITION, aString );//todo: change to chart namespace in future - dependent on fileformat + mrExport.AddAttribute( XML_NAMESPACE_CHART_EXT, XML_PREFER_COORDINATE_REGION, aString );//todo: change to chart namespace in future - dependent on fileformat - SvXMLElementExport aExcludingPosition( mrExport, XML_NAMESPACE_CHART_EXT, XML_EXCLUDING_POSITION, sal_True, sal_True );//todo: change to chart namespace in future - dependent on fileformat + SvXMLElementExport aExcludingPosition( mrExport, XML_NAMESPACE_CHART_EXT, XML_COORDINATE_REGION, sal_True, sal_True );//todo: change to chart namespace in future - dependent on fileformat } void SchXMLExportHelper_Impl::exportAxes( diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx index 501f92953663..587070202c9c 100644 --- a/xmloff/source/chart/SchXMLImport.cxx +++ b/xmloff/source/chart/SchXMLImport.cxx @@ -281,8 +281,8 @@ const SvXMLTokenMap& SchXMLImportHelper::GetPlotAreaElemTokenMap() { static __FAR_DATA SvXMLTokenMapEntry aPlotAreaElemTokenMap[] = { - { XML_NAMESPACE_CHART_EXT, XML_EXCLUDING_POSITION, XML_TOK_PA_EXCLUDING_POSITION_EXT }, - { XML_NAMESPACE_CHART, XML_EXCLUDING_POSITION, XML_TOK_PA_EXCLUDING_POSITION }, + { XML_NAMESPACE_CHART_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 }, diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx index 3792deefebbd..75fc4b2b5cdb 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx @@ -520,8 +520,8 @@ SvXMLImportContext* SchXMLPlotAreaContext::CreateChildContext( switch( rTokenMap.Get( nPrefix, rLocalName )) { - case XML_TOK_PA_EXCLUDING_POSITION_EXT: - case XML_TOK_PA_EXCLUDING_POSITION: + case XML_TOK_PA_COORDINATE_REGION_EXT: + case XML_TOK_PA_COORDINATE_REGION: { pContext = new SchXMLExcludingPositionContext( GetImport(), nPrefix, rLocalName, m_aInnerPositioning ); } @@ -1744,7 +1744,7 @@ bool SchXMLPositonAttributesHelper::readPositioningAttribute( sal_uInt16 nPrefix else bReturn = false; } - else if( IsXMLToken( rLocalName, XML_PREFER_EXCLUDING_POSITION ) ) + else if( IsXMLToken( rLocalName, XML_PREFER_COORDINATE_REGION ) ) { sal_Bool bPreferExcludingPosition = false; m_rImport.GetMM100UnitConverter().convertBool( bPreferExcludingPosition, rValue ); diff --git a/xmloff/source/chart/SchXMLTools.cxx b/xmloff/source/chart/SchXMLTools.cxx index 4456fbec7cb1..f6e33a946acd 100644 --- a/xmloff/source/chart/SchXMLTools.cxx +++ b/xmloff/source/chart/SchXMLTools.cxx @@ -716,7 +716,7 @@ bool isDocumentGeneratedWithOpenOfficeOlderThan3_3( const uno::Reference< frame: 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<9488 ) //9488 is build id of dev300m75 + 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 ) diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 2fb65535964c..2ee9176bb080 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3098,8 +3098,8 @@ namespace xmloff { namespace token { TOKEN( "chartooo", XML_NP_CHART_EXT ), TOKEN( "http://openoffice.org/2010/chart", XML_N_CHART_EXT ), - TOKEN( "excluding-position", XML_EXCLUDING_POSITION ), - TOKEN( "prefer-excluding-position", XML_PREFER_EXCLUDING_POSITION ), + TOKEN( "coordinate-region", XML_COORDINATE_REGION ), + TOKEN( "prefer-coordinate-region", XML_PREFER_COORDINATE_REGION ), #if OSL_DEBUG_LEVEL > 0 { 0, NULL, NULL, XML_TOKEN_END } -- cgit From e5fca8fd92fed0b7b719645c461ffe89401ff62a Mon Sep 17 00:00:00 2001 From: Ingrid Halama Date: Wed, 5 May 2010 18:16:33 +0200 Subject: chartpositioning: #i100778# simplify user interface: reduce sizing options to new excluding mode only --- xmloff/source/chart/SchXMLExport.cxx | 16 ++++-------- xmloff/source/chart/SchXMLPlotAreaContext.cxx | 35 ++++++++++----------------- xmloff/source/chart/SchXMLPlotAreaContext.hxx | 6 ++--- xmloff/source/core/xmltoken.cxx | 1 - 4 files changed, 21 insertions(+), 37 deletions(-) (limited to 'xmloff/source') diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index 9f0653cd44d9..03ef351b2047 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -199,7 +199,7 @@ public: const ::com::sun::star::awt::Size & rPageSize, sal_Bool bExportContent, sal_Bool bIncludeTable ); - void exportExcludingPosition( const com::sun::star::uno::Reference< com::sun::star::chart::XDiagram >& xDiagram ); + 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 ); @@ -1921,7 +1921,7 @@ void SchXMLExportHelper_Impl::exportPlotArea( pElPlotArea = new SvXMLElementExport( mrExport, XML_NAMESPACE_CHART, XML_PLOT_AREA, sal_True, sal_True ); //inner position rectangle element - exportExcludingPosition( xDiagram ); + exportCoordinateRegion( xDiagram ); // light sources (inside plot area element) if( bIs3DChart && @@ -2083,12 +2083,12 @@ void SchXMLExportHelper_Impl::exportPlotArea( delete pElPlotArea; } -void SchXMLExportHelper_Impl::exportExcludingPosition( const uno::Reference< chart::XDiagram >& xDiagram ) +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 //todo: change this dependent on fileformat evolution + 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 ); @@ -2100,13 +2100,7 @@ void SchXMLExportHelper_Impl::exportExcludingPosition( const uno::Reference< cha addPosition( awt::Point(aRect.X,aRect.Y) ); addSize( awt::Size(aRect.Width,aRect.Height) ); - sal_Bool bPreferExcludingPositioning = xDiaPos->isExcludingDiagramPositioning(); - rtl::OUStringBuffer sStringBuffer; - SvXMLUnitConverter::convertBool( sStringBuffer, bPreferExcludingPositioning ); - String aString( sStringBuffer.makeStringAndClear() ); - mrExport.AddAttribute( XML_NAMESPACE_CHART_EXT, XML_PREFER_COORDINATE_REGION, aString );//todo: change to chart namespace in future - dependent on fileformat - - SvXMLElementExport aExcludingPosition( mrExport, XML_NAMESPACE_CHART_EXT, XML_COORDINATE_REGION, sal_True, sal_True );//todo: change to chart namespace in future - dependent on fileformat + 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( diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx b/xmloff/source/chart/SchXMLPlotAreaContext.cxx index 75fc4b2b5cdb..011e9228612e 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx @@ -523,7 +523,7 @@ SvXMLImportContext* SchXMLPlotAreaContext::CreateChildContext( case XML_TOK_PA_COORDINATE_REGION_EXT: case XML_TOK_PA_COORDINATE_REGION: { - pContext = new SchXMLExcludingPositionContext( GetImport(), nPrefix, rLocalName, m_aInnerPositioning ); + pContext = new SchXMLCoordinateRegionContext( GetImport(), nPrefix, rLocalName, m_aInnerPositioning ); } break; @@ -694,20 +694,17 @@ void SchXMLPlotAreaContext::EndElement() uno::Reference< chart::XDiagramPositioning > xDiaPos( mxDiagram, uno::UNO_QUERY ); if( xDiaPos.is()) { - bool bOuterSize = m_aOuterPositioning.hasPosSize() && !m_aOuterPositioning.isAutomatic(); - if( m_aInnerPositioning.hasPosSize() ) + if( !m_aOuterPositioning.isAutomatic() ) { - if( !m_aInnerPositioning.isAutomatic() ) + if( m_aInnerPositioning.hasPosSize() ) xDiaPos->setDiagramPositionExcludingAxes( m_aInnerPositioning.getRectangle() ); - else if( bOuterSize ) - xDiaPos->setDiagramPositionIncludingAxes( m_aOuterPositioning.getRectangle() ); - } - else if( bOuterSize ) - { - 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() ); + 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() ); + } } } @@ -1744,12 +1741,6 @@ bool SchXMLPositonAttributesHelper::readPositioningAttribute( sal_uInt16 nPrefix else bReturn = false; } - else if( IsXMLToken( rLocalName, XML_PREFER_COORDINATE_REGION ) ) - { - sal_Bool bPreferExcludingPosition = false; - m_rImport.GetMM100UnitConverter().convertBool( bPreferExcludingPosition, rValue ); - m_bAutoPosition = m_bAutoSize = !bPreferExcludingPosition; - } else bReturn = false; @@ -1771,7 +1762,7 @@ void SchXMLPositonAttributesHelper::readAutomaticPositioningProperties( XMLPropS // ======================================== -SchXMLExcludingPositionContext::SchXMLExcludingPositionContext( +SchXMLCoordinateRegionContext::SchXMLCoordinateRegionContext( SvXMLImport& rImport , sal_uInt16 nPrefix , const rtl::OUString& rLocalName @@ -1781,11 +1772,11 @@ SchXMLExcludingPositionContext::SchXMLExcludingPositionContext( { } -SchXMLExcludingPositionContext::~SchXMLExcludingPositionContext() +SchXMLCoordinateRegionContext::~SchXMLCoordinateRegionContext() { } -void SchXMLExcludingPositionContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList ) +void SchXMLCoordinateRegionContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList ) { // parse attributes sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0; diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.hxx b/xmloff/source/chart/SchXMLPlotAreaContext.hxx index cb986d7e7a3d..1f0de466dcb1 100644 --- a/xmloff/source/chart/SchXMLPlotAreaContext.hxx +++ b/xmloff/source/chart/SchXMLPlotAreaContext.hxx @@ -251,15 +251,15 @@ public: // ---------------------------------------- -class SchXMLExcludingPositionContext : public SvXMLImportContext +class SchXMLCoordinateRegionContext : public SvXMLImportContext { public: - SchXMLExcludingPositionContext( + SchXMLCoordinateRegionContext( SvXMLImport& rImport , sal_uInt16 nPrefix , const rtl::OUString& rLocalName , SchXMLPositonAttributesHelper& rPositioning ); - virtual ~SchXMLExcludingPositionContext(); + virtual ~SchXMLCoordinateRegionContext(); virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); private: diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 2ee9176bb080..2af9966bc351 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -3099,7 +3099,6 @@ namespace xmloff { namespace token { TOKEN( "chartooo", XML_NP_CHART_EXT ), TOKEN( "http://openoffice.org/2010/chart", XML_N_CHART_EXT ), TOKEN( "coordinate-region", XML_COORDINATE_REGION ), - TOKEN( "prefer-coordinate-region", XML_PREFER_COORDINATE_REGION ), #if OSL_DEBUG_LEVEL > 0 { 0, NULL, NULL, XML_TOKEN_END } -- cgit From 3bf9010a46b16a7927ccf20537157387e79f8565 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 10 May 2010 18:54:44 +0200 Subject: sw33bf04: #i111381#: OValuePropertiesMetaData: apply patch by tono --- xmloff/source/forms/valueproperties.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xmloff/source') 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: -- cgit From e5ca3aca239fb7a95044e69f29294664ac60c8ec Mon Sep 17 00:00:00 2001 From: os Date: Mon, 7 Jun 2010 13:29:03 +0200 Subject: rebase to m80 --- xmloff/source/text/txtimp.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xmloff/source') diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index ca369f85b01d..87710d310d76 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -1825,7 +1825,7 @@ OUString XMLTextImportHelper::SetStyleAndAttrs( { // #i107225# the combined characters need to be inserted first // the selected text has to be removed afterwards - xText->insertTextContent( xRange->getStart(), xTextContent, sal_True ); + m_pImpl->m_xText->insertTextContent( xRange->getStart(), xTextContent, sal_True ); if( xRange->getString().getLength() ) { -- cgit