Kaydet (Commit) 9ccdf4d8 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

tdf#108022, don't overwrite chart export information

Change-Id: I47d8a817022829c8cada614469303e440f377299
Reviewed-on: https://gerrit.libreoffice.org/63536
Tested-by: Jenkins
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst ec914194
......@@ -4835,8 +4835,7 @@ bool DocxAttributeOutput::WriteOLEChart( const SdrObject* pSdrObj, const Size& r
if (!SotExchange::IsChart(aClassID))
return false;
m_postponedChart = pSdrObj;
m_postponedChartSize = rSize;
m_aPostponedCharts.push_back(std::pair<const SdrObject*, Size>(pSdrObj, rSize));
return true;
}
......@@ -4845,10 +4844,13 @@ bool DocxAttributeOutput::WriteOLEChart( const SdrObject* pSdrObj, const Size& r
*/
void DocxAttributeOutput::WritePostponedChart()
{
if(m_postponedChart == nullptr)
if (m_aPostponedCharts.empty())
return;
for (const auto& itr : m_aPostponedCharts)
{
uno::Reference< chart2::XChartDocument > xChartDoc;
uno::Reference< drawing::XShape > xShape( const_cast<SdrObject*>(m_postponedChart)->getUnoShape(), uno::UNO_QUERY );
uno::Reference< drawing::XShape > xShape( const_cast<SdrObject*>(itr.first)->getUnoShape(), uno::UNO_QUERY );
if( xShape.is() )
{
uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY );
......@@ -4865,8 +4867,8 @@ void DocxAttributeOutput::WritePostponedChart()
XML_distT, "0", XML_distB, "0", XML_distL, "0", XML_distR, "0",
FSEND );
OString aWidth( OString::number( TwipsToEMU( m_postponedChartSize.Width() ) ) );
OString aHeight( OString::number( TwipsToEMU( m_postponedChartSize.Height() ) ) );
OString aWidth( OString::number( TwipsToEMU( itr.second.Width() ) ) );
OString aHeight( OString::number( TwipsToEMU( itr.second.Height() ) ) );
m_pSerializer->singleElementNS( XML_wp, XML_extent,
XML_cx, aWidth.getStr(),
XML_cy, aHeight.getStr(),
......@@ -4919,7 +4921,9 @@ void DocxAttributeOutput::WritePostponedChart()
m_pSerializer->endElementNS( XML_w, XML_drawing );
}
m_postponedChart = nullptr;
}
m_aPostponedCharts.clear();
}
bool DocxAttributeOutput::WriteOLEMath( const SwOLENode& rOLENode )
......@@ -9150,7 +9154,6 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, const FSHelperPtr
m_nFieldsInHyperlink( 0 ),
m_bExportingOutline(false),
m_nChartCount(0),
m_postponedChart( nullptr ),
pendingPlaceholder( nullptr ),
m_postitFieldsMaxId( 0 ),
m_anchorId( 1 ),
......
......@@ -877,8 +877,7 @@ private:
std::vector<const SwOLENode*> m_aPostponedMaths;
/// count charts consistently for unit tests
unsigned int m_nChartCount;
const SdrObject* m_postponedChart;
Size m_postponedChartSize;
std::vector<std::pair<const SdrObject*, Size>> m_aPostponedCharts;
std::vector<const SdrObject*> m_aPostponedFormControls;
std::vector<PostponedDrawing> m_aPostponedActiveXControls;
const SwField* pendingPlaceholder;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment