LibreOffice Module reportdesign (master)  1
xmlExport.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <memory>
21 #include "xmlExport.hxx"
22 #include "xmlAutoStyle.hxx"
23 #include <xmloff/xmltoken.hxx>
24 #include <xmloff/xmlnamespace.hxx>
25 #include <xmloff/xmluconv.hxx>
26 #include <xmloff/namespacemap.hxx>
27 #include <xmloff/txtprmap.hxx>
28 #include <xmloff/numehelp.hxx>
29 #include "xmlHelper.hxx"
30 #include <strings.hxx>
31 #include "xmlPropertyHandler.hxx"
32 #include <com/sun/star/util/NumberFormat.hpp>
33 #include <com/sun/star/util/MeasureUnit.hpp>
34 #include <com/sun/star/report/GroupOn.hpp>
35 #include <com/sun/star/report/XFixedText.hpp>
36 #include <com/sun/star/report/XImageControl.hpp>
37 #include <com/sun/star/report/XShape.hpp>
38 #include <com/sun/star/report/XFunction.hpp>
39 #include <com/sun/star/awt/FontDescriptor.hpp>
40 #include <com/sun/star/table/BorderLine2.hpp>
41 #include <com/sun/star/table/BorderLineStyle.hpp>
42 #include <com/sun/star/report/XFixedLine.hpp>
43 #include <RptDef.hxx>
44 #include <vcl/svapp.hxx>
45 #include <osl/diagnose.h>
46 #include <tools/color.hxx>
47 
48 #define DEFAULT_LINE_WIDTH 2
49 
50 namespace rptxml
51 {
52  using namespace xmloff;
53  using namespace comphelper;
54  using namespace ::com::sun::star;
55  using namespace ::com::sun::star::report;
56  using namespace ::com::sun::star::uno;
57  using namespace ::com::sun::star::util;
58  using namespace ::com::sun::star::xml;
59 
60 
65  extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
67  css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
68  {
69  return cppu::acquire(new ORptExport(context,
70  "com.sun.star.comp.report.XMLSettingsExporter",
71  SvXMLExportFlags::SETTINGS ));
72  }
73 
78  extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
80  css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
81  {
82  return cppu::acquire(new ORptExport(context,
83  "com.sun.star.comp.report.XMLContentExporter",
84  SvXMLExportFlags::CONTENT ));
85  }
86 
91  extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
93  css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
94  {
95  return cppu::acquire(new ORptExport(context,
96  "com.sun.star.comp.report.XMLStylesExporter",
97  SvXMLExportFlags::STYLES | SvXMLExportFlags::MASTERSTYLES | SvXMLExportFlags::AUTOSTYLES |
98  SvXMLExportFlags::FONTDECLS|SvXMLExportFlags::OASIS ));
99  }
100 
105  extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
107  css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
108  {
109  return cppu::acquire(new ORptExport(context,
110  "com.sun.star.comp.report.XMLMetaExporter",
111  SvXMLExportFlags::META ));
112  }
113 
118  extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
120  css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
121  {
122  return cppu::acquire(new ORptExport(context,
123  "com.sun.star.comp.report.XMLFullExporter",
124  SvXMLExportFlags::ALL));
125  }
126 
127  namespace {
128 
129  class OSpecialHandleXMLExportPropertyMapper : public SvXMLExportPropertyMapper
130  {
131  public:
132  explicit OSpecialHandleXMLExportPropertyMapper(const rtl::Reference< XMLPropertySetMapper >& rMapper) : SvXMLExportPropertyMapper(rMapper )
133  {
134  }
137  virtual void handleSpecialItem(
138  SvXMLAttributeList& /*rAttrList*/,
139  const XMLPropertyState& /*rProperty*/,
140  const SvXMLUnitConverter& /*rUnitConverter*/,
141  const SvXMLNamespaceMap& /*rNamespaceMap*/,
142  const ::std::vector< XMLPropertyState >* /*pProperties*/ = nullptr,
143  sal_uInt32 /*nIdx*/ = 0 ) const override
144  {
145  // nothing to do here
146  }
147  };
148 
149  }
150 
152 {
153  for (auto& rEntry : _rGrid)
154  {
155  ORptExport::TGrid::iterator aRowIter = rEntry.second.begin();
156  ORptExport::TGrid::const_iterator aRowEnd = rEntry.second.end();
157  for (; aRowIter != aRowEnd; ++aRowIter)
158  {
159  if ( aRowIter->first )
160  {
161  sal_Int32 nColIndex = 0;
162  for (const auto& rCell : aRowIter->second)
163  {
164  if ( rCell.nRowSpan > 1 )
165  {
166  sal_Int32 nColSpan = rCell.nColSpan;
167  for (sal_Int32 i = 1; i < rCell.nRowSpan; ++i)
168  {
169  (aRowIter+i)->second[nColIndex].nColSpan = nColSpan;
170  }
171  }
172  ++nColIndex;
173  }
174  }
175  }
176  }
177 }
178 
179 ORptExport::ORptExport(const Reference< XComponentContext >& _rxContext, OUString const & implementationName, SvXMLExportFlags nExportFlag)
180 : SvXMLExport( _rxContext, implementationName, util::MeasureUnit::MM_100TH, XML_REPORT, SvXMLExportFlags::OASIS)
181 ,m_bAllreadyFilled(false)
182 {
183  setExportFlags( SvXMLExportFlags::OASIS | nExportFlag);
184  GetMM100UnitConverter().SetCoreMeasureUnit(css::util::MeasureUnit::MM_100TH);
185  GetMM100UnitConverter().SetXMLMeasureUnit(css::util::MeasureUnit::CM);
186 
187  // (getExportFlags() & EXPORT_CONTENT) != 0 ? : XML_N_OOO
190 
196 
197 
198  if( getExportFlags() & (SvXMLExportFlags::STYLES|SvXMLExportFlags::MASTERSTYLES|SvXMLExportFlags::AUTOSTYLES|SvXMLExportFlags::FONTDECLS) )
200 
201  if( getExportFlags() & (SvXMLExportFlags::META|SvXMLExportFlags::STYLES|SvXMLExportFlags::MASTERSTYLES|SvXMLExportFlags::AUTOSTYLES|SvXMLExportFlags::CONTENT|SvXMLExportFlags::SCRIPTS|SvXMLExportFlags::SETTINGS) )
202  {
204  }
205  if( getExportFlags() & SvXMLExportFlags::SETTINGS )
206  {
208  }
209 
210  if( getExportFlags() & (SvXMLExportFlags::STYLES|SvXMLExportFlags::MASTERSTYLES|SvXMLExportFlags::AUTOSTYLES|SvXMLExportFlags::CONTENT|SvXMLExportFlags::FONTDECLS) )
211  {
213  }
214  // RDFa: needed for content and header/footer styles
215  if( getExportFlags() & (SvXMLExportFlags::STYLES|SvXMLExportFlags::AUTOSTYLES|SvXMLExportFlags::MASTERSTYLES|SvXMLExportFlags::CONTENT) )
216  {
218  // loext, needed for paragraphs inside shapes
220  {
224  }
225  }
226  // GRDDL: to convert RDFa and meta.xml to RDF
227  if( getExportFlags() & (SvXMLExportFlags::META|SvXMLExportFlags::STYLES|SvXMLExportFlags::AUTOSTYLES|SvXMLExportFlags::MASTERSTYLES|SvXMLExportFlags::CONTENT) )
228  {
230  }
231 
234 
237 
238 
240  rtl::Reference < XMLPropertyHandlerFactory> xFac = new ::xmloff::OControlPropertyHandlerFactory();
241  rtl::Reference < XMLPropertySetMapper > xTableStylesPropertySetMapper1 = new XMLPropertySetMapper(OXMLHelper::GetTableStyleProps(),xFac, true);
242  rtl::Reference < XMLPropertySetMapper > xTableStylesPropertySetMapper2 = new XMLTextPropertySetMapper(TextPropMap::TABLE_DEFAULTS, true );
243  xTableStylesPropertySetMapper1->AddMapperEntry(xTableStylesPropertySetMapper2);
244 
245  m_xTableStylesExportPropertySetMapper = new SvXMLExportPropertyMapper(xTableStylesPropertySetMapper1);
246 
248  m_xCellStylesExportPropertySetMapper = new OSpecialHandleXMLExportPropertyMapper(m_xCellStylesPropertySetMapper);
250 
252  m_xColumnStylesExportPropertySetMapper = new OSpecialHandleXMLExportPropertyMapper(xColumnStylesPropertySetMapper);
253 
255  m_xRowStylesExportPropertySetMapper = new OSpecialHandleXMLExportPropertyMapper(xRowStylesPropertySetMapper);
256 
257  rtl::Reference < XMLPropertySetMapper > xPropMapper(new XMLTextPropertySetMapper( TextPropMap::PARA, true ));
258  m_xParaPropMapper = new OSpecialHandleXMLExportPropertyMapper( xPropMapper);
259 
260  const OUString& sFamily( GetXMLToken(XML_PARAGRAPH) );
261  GetAutoStylePool()->AddFamily( XmlStyleFamily::TEXT_PARAGRAPH, sFamily,
262  m_xParaPropMapper, "P" );
263 
264  GetAutoStylePool()->AddFamily(XmlStyleFamily::TABLE_CELL, XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME,
266  GetAutoStylePool()->AddFamily(XmlStyleFamily::TABLE_COLUMN, XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME,
268  GetAutoStylePool()->AddFamily(XmlStyleFamily::TABLE_ROW, XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME,
270  GetAutoStylePool()->AddFamily(XmlStyleFamily::TABLE_TABLE, XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME,
272 }
273 
274 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
276  css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
277 {
278  return cppu::acquire(new ORptExport(context,
279  "com.sun.star.comp.report.ExportFilter",
280  SvXMLExportFlags::CONTENT | SvXMLExportFlags::AUTOSTYLES | SvXMLExportFlags::FONTDECLS));
281 }
282 
283 
284 void ORptExport::exportFunctions(const Reference<XIndexAccess>& _xFunctions)
285 {
286  const sal_Int32 nCount = _xFunctions->getCount();
287  for (sal_Int32 i = 0; i< nCount; ++i)
288  {
289  uno::Reference< report::XFunction> xFunction(_xFunctions->getByIndex(i),uno::UNO_QUERY_THROW);
290  exportFunction(xFunction);
291  }
292 }
293 
294 void ORptExport::exportFunction(const uno::Reference< XFunction>& _xFunction)
295 {
296  exportFormula(XML_FORMULA,_xFunction->getFormula());
297  beans::Optional< OUString> aInitial = _xFunction->getInitialFormula();
298  if ( aInitial.IsPresent && !aInitial.Value.isEmpty() )
299  exportFormula(XML_INITIAL_FORMULA ,aInitial.Value );
300  AddAttribute( XML_NAMESPACE_REPORT, XML_NAME , _xFunction->getName() );
301  if ( _xFunction->getPreEvaluated() )
303  if ( _xFunction->getDeepTraversing() )
305 
306  SvXMLElementExport aFunction(*this,XML_NAMESPACE_REPORT, XML_FUNCTION, true, true);
307 }
308 
309 void ORptExport::exportMasterDetailFields(const Reference<XReportComponent>& _xReportComponent)
310 {
311  const uno::Sequence< OUString> aMasterFields = _xReportComponent->getMasterFields();
312  if ( !aMasterFields.hasElements() )
313  return;
314 
316  const uno::Sequence< OUString> aDetailFields = _xReportComponent->getDetailFields();
317 
318  OSL_ENSURE(aDetailFields.getLength() == aMasterFields.getLength(),"not equal length for master and detail fields!");
319 
320  const OUString* pDetailFieldsIter = aDetailFields.getConstArray();
321  for(const OUString& rMasterField : aMasterFields)
322  {
323  AddAttribute( XML_NAMESPACE_REPORT, XML_MASTER , rMasterField );
324  if ( !pDetailFieldsIter->isEmpty() )
325  AddAttribute( XML_NAMESPACE_REPORT, XML_DETAIL , *pDetailFieldsIter );
327  ++pDetailFieldsIter;
328  }
329 }
330 
331 void ORptExport::exportReport(const Reference<XReportDefinition>& _xReportDefinition)
332 {
333  if ( !_xReportDefinition.is() )
334  return;
335 
336  exportFunctions(_xReportDefinition->getFunctions());
337  exportGroupsExpressionAsFunction(_xReportDefinition->getGroups());
338 
339  if ( _xReportDefinition->getReportHeaderOn() )
340  {
341  SvXMLElementExport aGroupSection(*this,XML_NAMESPACE_REPORT, XML_REPORT_HEADER, true, true);
342  exportSection(_xReportDefinition->getReportHeader());
343  }
344  if ( _xReportDefinition->getPageHeaderOn() )
345  {
346  OUStringBuffer sValue;
347  sal_Int16 nRet = _xReportDefinition->getPageHeaderOption();
349  if ( SvXMLUnitConverter::convertEnum( sValue, nRet,aXML_EnumMap ) )
350  AddAttribute(XML_NAMESPACE_REPORT, XML_PAGE_PRINT_OPTION,sValue.makeStringAndClear());
351 
352  SvXMLElementExport aGroupSection(*this,XML_NAMESPACE_REPORT, XML_PAGE_HEADER, true, true);
353  exportSection(_xReportDefinition->getPageHeader(),true);
354  }
355 
356  exportGroup(_xReportDefinition,0);
357 
358  if ( _xReportDefinition->getPageFooterOn() )
359  {
360  OUStringBuffer sValue;
361  sal_Int16 nRet = _xReportDefinition->getPageFooterOption();
363  if ( SvXMLUnitConverter::convertEnum( sValue, nRet,aXML_EnumMap ) )
364  AddAttribute(XML_NAMESPACE_REPORT, XML_PAGE_PRINT_OPTION,sValue.makeStringAndClear());
365  SvXMLElementExport aGroupSection(*this,XML_NAMESPACE_REPORT, XML_PAGE_FOOTER, true, true);
366  exportSection(_xReportDefinition->getPageFooter(),true);
367  }
368  if ( _xReportDefinition->getReportFooterOn() )
369  {
370  SvXMLElementExport aGroupSection(*this,XML_NAMESPACE_REPORT, XML_REPORT_FOOTER, true, true);
371  exportSection(_xReportDefinition->getReportFooter());
372  }
373 }
374 
375 void ORptExport::exportComponent(const Reference<XReportComponent>& _xReportComponent)
376 {
377  OSL_ENSURE(_xReportComponent.is(),"No component interface!");
378  if ( !_xReportComponent.is() )
379  return;
380 
381  AddAttribute(XML_NAMESPACE_DRAW, XML_NAME,_xReportComponent->getName());
382 
384 }
385 
386 void ORptExport::exportFormatConditions(const Reference<XReportControlModel>& _xReportElement)
387 {
388  OSL_ENSURE(_xReportElement.is(),"_xReportElement is NULL -> GPF");
389  const sal_Int32 nCount = _xReportElement->getCount();
390  try
391  {
392  for (sal_Int32 i = 0; i < nCount ; ++i)
393  {
394  uno::Reference< report::XFormatCondition > xCond(_xReportElement->getByIndex(i),uno::UNO_QUERY);
395  if ( !xCond->getEnabled() )
397 
398  AddAttribute(XML_NAMESPACE_REPORT, XML_FORMULA,xCond->getFormula());
399 
402  }
403  }
404  catch(uno::Exception&)
405  {
406  OSL_FAIL("Can not access format condition!");
407  }
408 }
409 
410 void ORptExport::exportReportElement(const Reference<XReportControlModel>& _xReportElement)
411 {
412  OSL_ENSURE(_xReportElement.is(),"_xReportElement is NULL -> GPF");
413  if ( !_xReportElement->getPrintWhenGroupChange() )
415 
416  if ( !_xReportElement->getPrintRepeatedValues() )
418 
420  if ( _xReportElement->getCount() )
421  {
422  exportFormatConditions(_xReportElement);
423  }
424 
425  OUString sExpr = _xReportElement->getConditionalPrintExpression();
426  if ( !sExpr.isEmpty() )
427  {
428  exportFormula(XML_FORMULA,sExpr);
430  }
431 
432  // only export when parent exists
433  uno::Reference< report::XSection> xParent(_xReportElement->getParent(),uno::UNO_QUERY);
434  if ( xParent.is() )
435  exportComponent(_xReportElement);
436 }
437 
438 static void lcl_calculate(const ::std::vector<sal_Int32>& _aPosX,const ::std::vector<sal_Int32>& _aPosY,ORptExport::TGrid& _rColumns)
439 {
440  sal_Int32 nCountX = _aPosX.size() - 1;
441  sal_Int32 nCountY = _aPosY.size() - 1;
442  for (sal_Int32 j = 0; j < nCountY; ++j)
443  {
444  sal_Int32 nHeight = _aPosY[j+1] - _aPosY[j];
445  if ( nHeight )
446  for (sal_Int32 i = 0; i < nCountX ; ++i)
447  {
448  _rColumns[j].second[i] = ORptExport::TCell(1,1);
449  _rColumns[j].second[i].bSet = true;
450  }
451  }
452 }
453 
454 void ORptExport::collectStyleNames(XmlStyleFamily _nFamily,const ::std::vector< sal_Int32>& _aSize, std::vector<OUString>& _rStyleNames)
455 {
456  ::std::vector< XMLPropertyState > aPropertyStates;
457  aPropertyStates.emplace_back(0);
458  ::std::vector<sal_Int32>::const_iterator aIter = _aSize.begin();
459  ::std::vector<sal_Int32>::const_iterator aIter2 = aIter + 1;
460  ::std::vector<sal_Int32>::const_iterator aEnd = _aSize.end();
461  for (;aIter2 != aEnd ; ++aIter,++aIter2)
462  {
463  sal_Int32 nValue = static_cast<sal_Int32>(*aIter2 - *aIter);
464  aPropertyStates[0].maValue <<= nValue;
465  _rStyleNames.push_back(GetAutoStylePool()->Add(_nFamily, aPropertyStates ));
466  }
467 }
468 
469 void ORptExport::collectStyleNames(XmlStyleFamily _nFamily, const ::std::vector< sal_Int32>& _aSize, const ::std::vector< sal_Int32>& _aSizeAutoGrow, std::vector<OUString>& _rStyleNames)
470 {
471  ::std::vector< XMLPropertyState > aPropertyStates;
472  aPropertyStates.emplace_back(0);
473  ::std::vector<sal_Int32>::const_iterator aIter = _aSize.begin();
474  ::std::vector<sal_Int32>::const_iterator aIter2 = aIter + 1;
475  ::std::vector<sal_Int32>::const_iterator aEnd = _aSize.end();
476  for (;aIter2 != aEnd; ++aIter, ++aIter2)
477  {
478  sal_Int32 nValue = static_cast<sal_Int32>(*aIter2 - *aIter);
479  aPropertyStates[0].maValue <<= nValue;
480  // note: there cannot be 0-height rows, because a call to std::unique has removed them
481  // it cannot be predicted that the size of _aSizeAutoGrow has any relation to the size of
482  // _aSize, because of the same std::unique operation (and _aSizeAutoGrow wasn't even the same
483  // size before that), so the matching element in _aSizeAutoGrow has to be found by lookup.
484  ::std::vector<sal_Int32>::const_iterator aAutoGrow = ::std::find(_aSizeAutoGrow.begin(), _aSizeAutoGrow.end(), *aIter2);
485  bool bAutoGrow = aAutoGrow != _aSizeAutoGrow.end();
486  // the mnIndex is into the array returned by OXMLHelper::GetRowStyleProps()
487  aPropertyStates[0].mnIndex = bAutoGrow ? 1 : 0;
488  _rStyleNames.push_back(GetAutoStylePool()->Add(_nFamily, aPropertyStates));
489  }
490 }
491 
492 void ORptExport::exportSectionAutoStyle(const Reference<XSection>& _xProp)
493 {
494  OSL_ENSURE(_xProp != nullptr,"Section is NULL -> GPF");
495  exportAutoStyle(_xProp);
496 
497  Reference<XReportDefinition> xReport = _xProp->getReportDefinition();
498  const awt::Size aSize = rptui::getStyleProperty<awt::Size>(xReport,PROPERTY_PAPERSIZE);
499  const sal_Int32 nOffset = rptui::getStyleProperty<sal_Int32>(xReport,PROPERTY_LEFTMARGIN);
500  const sal_Int32 nCount = _xProp->getCount();
501 
502  ::std::vector<sal_Int32> aColumnPos;
503  aColumnPos.reserve(2*(nCount + 1));
504  aColumnPos.push_back(nOffset);
505  aColumnPos.push_back(aSize.Width - rptui::getStyleProperty<sal_Int32>(xReport,PROPERTY_RIGHTMARGIN));
506 
507  ::std::vector<sal_Int32> aRowPos;
508  aRowPos.reserve(2*(nCount + 1));
509  aRowPos.push_back(0);
510  aRowPos.push_back(_xProp->getHeight());
511 
512 
513  ::std::vector<sal_Int32> aRowPosAutoGrow;
514  aRowPosAutoGrow.reserve(2 * (nCount + 1));
515 
516 
517  sal_Int32 i;
518  for (i = 0 ; i< nCount ; ++i)
519  {
520  Reference<XReportComponent> xReportElement(_xProp->getByIndex(i),uno::UNO_QUERY);
521  uno::Reference< XShape> xShape(xReportElement,uno::UNO_QUERY);
522  if ( xShape.is() )
523  continue;
524  OSL_ENSURE( xReportElement.is(),"NULL Element in Section!" );
525  if ( !xReportElement.is() )
526  continue;
527  sal_Int32 nX = xReportElement->getPositionX();
528  aColumnPos.push_back(nX);
529  Reference<XFixedLine> xFixedLine(xReportElement,uno::UNO_QUERY);
530  if ( xFixedLine.is() && xFixedLine->getOrientation() == 1 ) // vertical
531  {
532  sal_Int32 nWidth = static_cast<sal_Int32>(xReportElement->getWidth()*0.5);
533  nX += nWidth;
534  aColumnPos.push_back(nX);
535  nX += xReportElement->getWidth() - nWidth;
536  }
537  else
538  nX += xReportElement->getWidth();
539  aColumnPos.push_back(nX); // --nX why?
540 
541  sal_Int32 nY = xReportElement->getPositionY();
542  aRowPos.push_back(nY);
543  nY += xReportElement->getHeight();
544  aRowPos.push_back(nY); // --nY why?
545  bool bAutoGrow = xReportElement->getAutoGrow();
546  if (bAutoGrow)
547  {
548  // the resulting table row ending at nY should auto-grow
549  aRowPosAutoGrow.push_back(nY);
550  }
551  }
552 
553  ::std::sort(aColumnPos.begin(),aColumnPos.end(),::std::less<sal_Int32>());
554  aColumnPos.erase(::std::unique(aColumnPos.begin(),aColumnPos.end()),aColumnPos.end());
555 
556  // note: the aRowPos contains top and bottom position of every report control; we now compute the
557  // top of every row in the resulting table, by sorting and eliminating unnecessary duplicate
558  // positions. (the same for the columns in the preceding lines.)
559  ::std::sort(aRowPos.begin(),aRowPos.end(),::std::less<sal_Int32>());
560  aRowPos.erase(::std::unique(aRowPos.begin(),aRowPos.end()),aRowPos.end());
561 
562  TSectionsGrid::iterator aInsert = m_aSectionsGrid.emplace(
563  _xProp.get(),
564  TGrid(aRowPos.size() - 1,TGrid::value_type(false,TRow(aColumnPos.size() - 1)))
565  ).first;
566  lcl_calculate(aColumnPos,aRowPos,aInsert->second);
567 
568  TGridStyleMap::iterator aPos = m_aColumnStyleNames.emplace(_xProp.get(),std::vector<OUString>()).first;
569  collectStyleNames(XmlStyleFamily::TABLE_COLUMN,aColumnPos,aPos->second);
570  aPos = m_aRowStyleNames.emplace(_xProp.get(),std::vector<OUString>()).first;
571  collectStyleNames(XmlStyleFamily::TABLE_ROW, aRowPos, aRowPosAutoGrow, aPos->second);
572 
573  sal_Int32 x1 = 0;
574  sal_Int32 y1 = 0;
575  sal_Int32 x2 = 0;
576  sal_Int32 y2 = 0;
577  sal_Int32 xi = 0;
578  sal_Int32 yi = 0;
579  bool isOverlap = false;
580 
581  for (i = 0 ; i< nCount ; ++i)
582  {
583  Reference<XReportComponent> xReportElement(_xProp->getByIndex(i),uno::UNO_QUERY);
584  uno::Reference< XShape> xShape(xReportElement,uno::UNO_QUERY);
585  if ( xShape.is() )
586  continue;
587  sal_Int32 nPos = xReportElement->getPositionX();
588  x1 = (::std::find(aColumnPos.begin(),aColumnPos.end(),nPos) - aColumnPos.begin());
589  Reference<XFixedLine> xFixedLine(xReportElement,uno::UNO_QUERY);
590  if ( xFixedLine.is() && xFixedLine->getOrientation() == 1 ) // vertical
591  nPos += static_cast<sal_Int32>(xReportElement->getWidth()*0.5);
592  else
593  nPos += xReportElement->getWidth(); // -1 why
594  x2 = (::std::find(aColumnPos.begin(),aColumnPos.end(),nPos) - aColumnPos.begin());
595 
596  nPos = xReportElement->getPositionY();
597  y1 = (::std::find(aRowPos.begin(),aRowPos.end(),nPos) - aRowPos.begin());
598  nPos += xReportElement->getHeight(); // -1 why?
599  y2 = (::std::find(aRowPos.begin(),aRowPos.end(),nPos) - aRowPos.begin());
600 
601  isOverlap = false;
602  yi = y1;
603  while(yi < y2 && !isOverlap) // find overlapping controls
604  {
605  xi = x1;
606  while(xi < x2 && !isOverlap)
607  {
608  if ( aInsert->second[yi].second[xi].xElement.is() )
609  {
610  isOverlap = true;
611  }
612  ++xi;
613  }
614  ++yi;
615  }
616 
617  if (!isOverlap)
618  {
619  yi = y1;
620  while(yi < y2)
621  {
622  xi = x1;
623  while(xi < x2)
624  {
625  aInsert->second[yi].second[xi] = TCell();
626  ++xi;
627  }
628  aInsert->second[yi].first = true;
629  ++yi;
630  }
631 
632  if (x2 - x1 != 0 && y2 - y1 != 0)
633  {
634  sal_Int32 nColSpan = x2 - x1;
635  sal_Int32 nRowSpan = y2 - y1;
636  aInsert->second[y1].second[x1] =
637  TCell(
638  nColSpan,
639  nRowSpan,
640  xReportElement
641  );
642  }
643  }
644  }
645 
648 }
649 
650 void ORptExport::exportReportComponentAutoStyles(const Reference<XSection>& _xProp)
651 {
652  const sal_Int32 nCount = _xProp->getCount();
653  for (sal_Int32 i = 0 ; i< nCount ; ++i)
654  {
655  const Reference<XReportComponent> xReportElement(_xProp->getByIndex(i),uno::UNO_QUERY);
656  const Reference< report::XShape > xShape(xReportElement,uno::UNO_QUERY);
657  if ( xShape.is() )
658  {
660  xShapeExport->seekShapes(_xProp);
661  SolarMutexGuard aGuard;
662  xShapeExport->collectShapeAutoStyles(xShape);
663  }
664  else
665  {
666  exportAutoStyle(xReportElement.get());
667 
668  Reference<XFormattedField> xFormattedField(xReportElement,uno::UNO_QUERY);
669  if ( xFormattedField.is() )
670  {
671  try
672  {
673  const sal_Int32 nFormatCount = xFormattedField->getCount();
674  for (sal_Int32 j = 0; j < nFormatCount ; ++j)
675  {
676  uno::Reference< report::XFormatCondition > xCond(xFormattedField->getByIndex(j),uno::UNO_QUERY);
677  exportAutoStyle(xCond.get(),xFormattedField);
678  }
679  }
680  catch(uno::Exception&)
681  {
682  OSL_FAIL("Can not access format condition!");
683  }
684  }
685  }
686  }
687 }
688 
689 void ORptExport::exportSection(const Reference<XSection>& _xSection,bool bHeader)
690 {
691  OSL_ENSURE(_xSection.is(),"Section is NULL -> GPF");
692  AddAttribute(XML_NAMESPACE_TABLE, XML_NAME,_xSection->getName());
693 
694  if ( !_xSection->getVisible() )
696 
697  if ( !bHeader )
698  {
699  OUStringBuffer sValue;
700  sal_Int16 nRet = _xSection->getForceNewPage();
702  if ( SvXMLUnitConverter::convertEnum( sValue, nRet,aXML_EnumMap ) )
703  AddAttribute(XML_NAMESPACE_REPORT, XML_FORCE_NEW_PAGE,sValue.makeStringAndClear());
704 
705  nRet = _xSection->getNewRowOrCol();
706  if ( SvXMLUnitConverter::convertEnum( sValue, nRet,aXML_EnumMap ) )
707  AddAttribute(XML_NAMESPACE_REPORT, XML_FORCE_NEW_COLUMN,sValue.makeStringAndClear());
708  if ( _xSection->getKeepTogether() )
710  }
711 
712  exportStyleName(_xSection.get(),GetAttrList(),m_sTableStyle);
713 
715  SvXMLElementExport aComponents(*this,XML_NAMESPACE_TABLE, XML_TABLE, true, true);
716 
717  OUString sExpr = _xSection->getConditionalPrintExpression();
718  if ( !sExpr.isEmpty() )
719  {
720  exportFormula(XML_FORMULA,sExpr);
722  }
723 
724  exportContainer(_xSection);
725 }
726 
727 void ORptExport::exportTableColumns(const Reference< XSection>& _xSection)
728 {
729  SvXMLElementExport aColumns(*this,XML_NAMESPACE_TABLE, XML_TABLE_COLUMNS, true, true);
730  TGridStyleMap::const_iterator aColFind = m_aColumnStyleNames.find(_xSection);
731  OSL_ENSURE(aColFind != m_aColumnStyleNames.end(),"ORptExport::exportTableColumns: Section not found in m_aColumnStyleNames!");
732  if ( aColFind == m_aColumnStyleNames.end() )
733  return;
734 
735  for (auto& aCol : aColFind->second)
736  {
738  SvXMLElementExport aColumn(*this,XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, true, true);
739  }
740 }
741 
742 void ORptExport::exportContainer(const Reference< XSection>& _xSection)
743 {
744  OSL_ENSURE(_xSection.is(),"Section is NULL -> GPF");
745 
746  exportTableColumns(_xSection);
747 
748  TSectionsGrid::const_iterator aFind = m_aSectionsGrid.find(_xSection);
749  OSL_ENSURE(aFind != m_aSectionsGrid.end(),"ORptExport::exportContainer: Section not found in grid!");
750  if ( aFind == m_aSectionsGrid.end() )
751  return;
752  TGrid::const_iterator aRowIter = aFind->second.begin();
753  TGrid::const_iterator aRowEnd = aFind->second.end();
754 
755  TGridStyleMap::const_iterator aRowFind = m_aRowStyleNames.find(_xSection);
756  auto aHeightIter = aRowFind->second.cbegin();
757  OSL_ENSURE(aRowFind->second.size() == aFind->second.size(),"Different count for rows");
758 
759  bool bShapeHandled = false;
760  ::std::map<sal_Int32,sal_Int32> aRowSpan;
761  for (sal_Int32 j = 0; aRowIter != aRowEnd; ++aRowIter,++j,++aHeightIter)
762  {
763  AddAttribute( m_sTableStyle,*aHeightIter );
764  SvXMLElementExport aRow(*this,XML_NAMESPACE_TABLE, XML_TABLE_ROW, true, true);
765  if ( aRowIter->first )
766  {
767  ::std::vector< TCell >::const_iterator aColIter = aRowIter->second.begin();
768  ::std::vector< TCell >::const_iterator aColEnd = aRowIter->second.end();
769  sal_Int32 nEmptyCellColSpan = 0;
770  for (; aColIter != aColEnd; ++aColIter)
771  {
772  bool bCoveredCell = false;
773  sal_Int32 nColSpan = 0;
774  sal_Int32 nColIndex = aColIter - aRowIter->second.begin();
775  ::std::map<sal_Int32,sal_Int32>::iterator aRowSpanFind = aRowSpan.find(nColIndex);
776  if ( aRowSpanFind != aRowSpan.end() )
777  {
778  nColSpan = 1;
779  if ( !--(aRowSpanFind->second) )
780  aRowSpan.erase(aRowSpanFind);
781 
782  if ( aColIter->nColSpan > 1 )
783  nColSpan += aColIter->nColSpan - 1;
784 
785  bCoveredCell = true;
786  aColIter = aColIter + (aColIter->nColSpan - 1);
787  }
788  else if ( aColIter->bSet )
789  {
790  if ( nEmptyCellColSpan > 0 )
791  {
792  AddAttribute( XML_NAMESPACE_TABLE,XML_NUMBER_COLUMNS_SPANNED, OUString::number(nEmptyCellColSpan) );
793  bCoveredCell = true;
794  nColSpan = nEmptyCellColSpan - 1;
795  nEmptyCellColSpan = 0;
796  }
797  sal_Int32 nSpan = aColIter->nColSpan;
798  if ( nSpan > 1 )
799  {
800  AddAttribute( XML_NAMESPACE_TABLE,XML_NUMBER_COLUMNS_SPANNED, OUString::number(nSpan) );
801  nColSpan = nSpan - 1;
802  bCoveredCell = true;
803  }
804  nSpan = aColIter->nRowSpan;
805  if ( nSpan > 1 )
806  {
807  AddAttribute( XML_NAMESPACE_TABLE,XML_NUMBER_ROWS_SPANNED, OUString::number(nSpan) );
808  aRowSpan[nColIndex] = nSpan - 1;
809  }
810  if ( aColIter->xElement.is() )
811  exportStyleName(aColIter->xElement.get(),GetAttrList(),m_sTableStyle);
812 
813  // start <table:table-cell>
814  Reference<XFormattedField> xFormattedField(aColIter->xElement,uno::UNO_QUERY);
815  if ( xFormattedField.is() )
816  {
817  sal_Int32 nFormatKey = xFormattedField->getFormatKey();
819  bool bIsStandard = false;
820  sal_Int16 nCellType = aHelper.GetCellType(nFormatKey,bIsStandard);
821  // "Standard" means "no format set, value could be anything",
822  // so don't set a format attribute in this case.
823  // P.S.: "Standard" is called "General" in some languages
824  if (!bIsStandard)
825  {
826  if ( nCellType == util::NumberFormat::TEXT )
827  aHelper.SetNumberFormatAttributes("", u"");
828  else
829  aHelper.SetNumberFormatAttributes(nFormatKey, 0.0, false);
830  }
831  }
832  SvXMLElementExport aCell(*this,XML_NAMESPACE_TABLE, XML_TABLE_CELL, true, false);
833 
834  if ( aColIter->xElement.is() )
835  {
836  // start <text:p>
837  SvXMLElementExport aParagraphContent(*this,XML_NAMESPACE_TEXT, XML_P, true, false);
838  Reference<XServiceInfo> xElement(aColIter->xElement,uno::UNO_QUERY);
839 
840  if ( !bShapeHandled )
841  {
842  bShapeHandled = true;
843  exportShapes(_xSection,false);
844  }
845  uno::Reference< XShape > xShape(xElement,uno::UNO_QUERY);
846  uno::Reference< XFixedLine > xFixedLine(xElement,uno::UNO_QUERY);
847  if ( !xShape.is() && !xFixedLine.is() )
848  {
849  Reference<XReportControlModel> xReportElement(xElement,uno::UNO_QUERY);
850  Reference<XReportDefinition> xReportDefinition(xElement,uno::UNO_QUERY);
851  Reference< XImageControl > xImage(xElement,uno::UNO_QUERY);
852  Reference<XSection> xSection(xElement,uno::UNO_QUERY);
853 
855  bool bExportData = false;
856  if ( xElement->supportsService(SERVICE_FIXEDTEXT) )
857  {
858  eToken = XML_FIXED_CONTENT;
859  }
860  else if ( xElement->supportsService(SERVICE_FORMATTEDFIELD) )
861  {
862  eToken = XML_FORMATTED_TEXT;
863  bExportData = true;
864  }
865  else if ( xElement->supportsService(SERVICE_IMAGECONTROL) )
866  {
867  eToken = XML_IMAGE;
868  OUString sTargetLocation = xImage->getImageURL();
869  if ( !sTargetLocation.isEmpty() )
870  {
871  sTargetLocation = GetRelativeReference(sTargetLocation);
873  }
874  bExportData = true;
875  OUStringBuffer sValue;
876  const SvXMLEnumMapEntry<sal_Int16>* aXML_ImageScaleEnumMap = OXMLHelper::GetImageScaleOptions();
877  if ( SvXMLUnitConverter::convertEnum( sValue, xImage->getScaleMode(),aXML_ImageScaleEnumMap ) )
878  AddAttribute(XML_NAMESPACE_REPORT, XML_SCALE, sValue.makeStringAndClear() );
879  }
880  else if ( xReportDefinition.is() )
881  {
882  eToken = XML_SUB_DOCUMENT;
883  }
884 
885  if ( bExportData )
886  {
887  const bool bPageSet = exportFormula(XML_FORMULA,xReportElement->getDataField());
888  if ( bPageSet )
889  eToken = XML_FIXED_CONTENT;
890  else if ( eToken == XML_IMAGE )
891  AddAttribute(XML_NAMESPACE_REPORT, XML_PRESERVE_IRI, xImage->getPreserveIRI() ? XML_TRUE : XML_FALSE );
892  }
893 
894  {
895  // start <report:eToken>
896  SvXMLElementExport aComponents(*this,XML_NAMESPACE_REPORT, eToken, false, false);
897  if ( eToken == XML_FIXED_CONTENT )
898  exportParagraph(xReportElement);
899  if ( xReportElement.is() )
900  exportReportElement(xReportElement);
901 
902  if (eToken == XML_SUB_DOCUMENT && xReportDefinition.is())
903  {
904  SvXMLElementExport aOfficeElement( *this, XML_NAMESPACE_OFFICE, XML_BODY, true, true );
905  SvXMLElementExport aElem( *this, true,
907  true, true );
908 
909  exportReportAttributes(xReportDefinition);
910  exportReport(xReportDefinition);
911  }
912  else if ( xSection.is() )
913  exportSection(xSection);
914  }
915  }
916  }
917  else if ( !bShapeHandled )
918  {
919  bShapeHandled = true;
920  exportShapes(_xSection);
921  }
922  aColIter = aColIter + (aColIter->nColSpan - 1);
923  }
924  else
925  ++nEmptyCellColSpan;
926  if ( bCoveredCell )
927  {
928  for (sal_Int32 k = 0; k < nColSpan; ++k)
929  {
931  }
932 
933  }
934  }
935  if ( nEmptyCellColSpan )
936  {
937  {
938  AddAttribute( XML_NAMESPACE_TABLE,XML_NUMBER_COLUMNS_SPANNED, OUString::number(nEmptyCellColSpan) );
939  SvXMLElementExport aCell(*this,XML_NAMESPACE_TABLE, XML_TABLE_CELL, true, true);
940  if ( !bShapeHandled )
941  {
942  bShapeHandled = true;
943  exportShapes(_xSection);
944  }
945  }
946  for (sal_Int32 k = 0; k < nEmptyCellColSpan; ++k)
947  {
948  SvXMLElementExport aCoveredCell(*this,XML_NAMESPACE_TABLE, XML_COVERED_TABLE_CELL, true, true);
949  }
950  }
951  }
952  else
953  { // empty rows
954  sal_Int32 nEmptyCellColSpan = aRowIter->second.size();
955  if ( nEmptyCellColSpan )
956  {
957  {
958  AddAttribute( XML_NAMESPACE_TABLE,XML_NUMBER_COLUMNS_SPANNED, OUString::number(nEmptyCellColSpan) );
959  SvXMLElementExport aCell(*this,XML_NAMESPACE_TABLE, XML_TABLE_CELL, true, true);
960  if ( !bShapeHandled )
961  {
962  bShapeHandled = true;
963  exportShapes(_xSection);
964  }
965  }
966  for (sal_Int32 k = 1; k < nEmptyCellColSpan; ++k)
967  {
968  SvXMLElementExport aCoveredCell(*this,XML_NAMESPACE_TABLE, XML_COVERED_TABLE_CELL, true, true);
969  }
970  }
971  }
972  }
973 }
974 
975 OUString ORptExport::convertFormula(const OUString& _sFormula)
976 {
977  OUString sFormula = _sFormula;
978  if ( _sFormula == "rpt:" )
979  sFormula.clear();
980  return sFormula;
981 }
982 
983 bool ORptExport::exportFormula(enum ::xmloff::token::XMLTokenEnum eName,const OUString& _sFormula)
984 {
985  const OUString sFieldData = convertFormula(_sFormula);
986  sal_Int32 nPageNumberIndex = sFieldData.indexOf("PageNumber()");
987  sal_Int32 nPageCountIndex = sFieldData.indexOf("PageCount()");
988  bool bRet = nPageNumberIndex != -1 || nPageCountIndex != -1;
989  if ( !bRet )
990  AddAttribute(XML_NAMESPACE_REPORT, eName,sFieldData);
991 
992  return bRet;
993 }
994 
995 void ORptExport::exportStyleName(XPropertySet* _xProp,SvXMLAttributeList& _rAtt,const OUString& _sName)
996 {
997  Reference<XPropertySet> xFind(_xProp);
998  TPropertyStyleMap::const_iterator aFind = m_aAutoStyleNames.find(xFind);
999  if ( aFind != m_aAutoStyleNames.end() )
1000  {
1001  _rAtt.AddAttribute( _sName,
1002  aFind->second );
1003  m_aAutoStyleNames.erase(aFind);
1004  }
1005 }
1006 
1007 void ORptExport::exportGroup(const Reference<XReportDefinition>& _xReportDefinition,sal_Int32 _nPos,bool _bExportAutoStyle)
1008 {
1009  if ( !_xReportDefinition.is() )
1010  return;
1011 
1012  Reference< XGroups > xGroups = _xReportDefinition->getGroups();
1013  if ( !xGroups.is() )
1014  return;
1015 
1016  sal_Int32 nCount = xGroups->getCount();
1017  if ( _nPos >= 0 && _nPos < nCount )
1018  {
1019  Reference<XGroup> xGroup(xGroups->getByIndex(_nPos),uno::UNO_QUERY);
1020  OSL_ENSURE(xGroup.is(),"No Group prepare for GPF");
1021  if ( _bExportAutoStyle )
1022  {
1023  if ( xGroup->getHeaderOn() )
1024  exportSectionAutoStyle(xGroup->getHeader());
1025  exportGroup(_xReportDefinition,_nPos+1,_bExportAutoStyle);
1026  if ( xGroup->getFooterOn() )
1027  exportSectionAutoStyle(xGroup->getFooter());
1028  }
1029  else
1030  {
1031  if ( xGroup->getSortAscending() )
1033 
1034  if ( xGroup->getStartNewColumn() )
1036  if ( xGroup->getResetPageNumber() )
1038 
1039  const OUString sField = xGroup->getExpression();
1040  OUString sExpression = sField;
1041  if ( !sExpression.isEmpty() )
1042  {
1043  sal_Int32 nIndex = sExpression.indexOf('"');
1044  while ( nIndex > -1 )
1045  {
1046  sExpression = sExpression.replaceAt(nIndex, 1, "\"\"");
1047  nIndex = sExpression.indexOf('"',nIndex+2);
1048  }
1049 
1050  TGroupFunctionMap::const_iterator aGroupFind = m_aGroupFunctionMap.find(xGroup);
1051  if ( aGroupFind != m_aGroupFunctionMap.end() )
1052  sExpression = aGroupFind->second->getName();
1053  sExpression = "rpt:HASCHANGED(\"" + sExpression + "\")";
1054  }
1057  sal_Int16 nRet = xGroup->getKeepTogether();
1058  OUStringBuffer sValue;
1059  const SvXMLEnumMapEntry<sal_Int16>* aXML_KeepTogetherEnumMap = OXMLHelper::GetKeepTogetherOptions();
1060  if ( SvXMLUnitConverter::convertEnum( sValue, nRet, aXML_KeepTogetherEnumMap ) )
1061  AddAttribute(XML_NAMESPACE_REPORT, XML_KEEP_TOGETHER,sValue.makeStringAndClear());
1062 
1063  SvXMLElementExport aGroup(*this,XML_NAMESPACE_REPORT, XML_GROUP, true, true);
1064  exportFunctions(xGroup->getFunctions());
1065  if ( xGroup->getHeaderOn() )
1066  {
1067  Reference<XSection> xSection = xGroup->getHeader();
1068  if ( xSection->getRepeatSection() )
1070  SvXMLElementExport aGroupSection(*this,XML_NAMESPACE_REPORT, XML_GROUP_HEADER, true, true);
1071  exportSection(xSection);
1072  }
1073  exportGroup(_xReportDefinition,_nPos+1,_bExportAutoStyle);
1074  if ( xGroup->getFooterOn() )
1075  {
1076  Reference<XSection> xSection = xGroup->getFooter();
1077  if ( xSection->getRepeatSection() )
1079  SvXMLElementExport aGroupSection(*this,XML_NAMESPACE_REPORT, XML_GROUP_FOOTER, true, true);
1080  exportSection(xSection);
1081  }
1082  }
1083  }
1084  else if ( _bExportAutoStyle )
1085  {
1086  exportSectionAutoStyle(_xReportDefinition->getDetail());
1087  }
1088  else
1089  {
1090  SvXMLElementExport aGroupSection(*this,XML_NAMESPACE_REPORT, XML_DETAIL, true, true);
1091  exportSection(_xReportDefinition->getDetail());
1092  }
1093 }
1094 
1095 void ORptExport::exportAutoStyle(XPropertySet* _xProp,const Reference<XFormattedField>& _xParentFormattedField)
1096 {
1097  const uno::Reference<report::XReportControlFormat> xFormat(_xProp,uno::UNO_QUERY);
1098  if ( xFormat.is() )
1099  {
1100  try
1101  {
1102  const awt::FontDescriptor aFont = xFormat->getFontDescriptor();
1103  OSL_ENSURE(!aFont.Name.isEmpty(),"No Font Name !");
1104  GetFontAutoStylePool()->Add(aFont.Name,aFont.StyleName,static_cast<FontFamily>(aFont.Family),
1105  static_cast<FontPitch>(aFont.Pitch),aFont.CharSet );
1106  }
1107  catch(beans::UnknownPropertyException&)
1108  {
1109  // not interested in
1110  }
1111  }
1112  const uno::Reference< report::XShape> xShape(_xProp,uno::UNO_QUERY);
1113  if ( xShape.is() )
1114  {
1115  ::std::vector<XMLPropertyState> aPropertyStates(m_xParaPropMapper->Filter(*this, _xProp));
1116  if ( !aPropertyStates.empty() )
1117  m_aAutoStyleNames.emplace( _xProp,GetAutoStylePool()->Add( XmlStyleFamily::TEXT_PARAGRAPH, aPropertyStates ));
1118  }
1119  ::std::vector<XMLPropertyState> aPropertyStates(m_xCellStylesExportPropertySetMapper->Filter(*this, _xProp));
1120  Reference<XFixedLine> xFixedLine(_xProp,uno::UNO_QUERY);
1121  if ( xFixedLine.is() )
1122  {
1123  uno::Reference<beans::XPropertySet> xBorderProp = OXMLHelper::createBorderPropertySet();
1124  table::BorderLine2 aValue;
1125  aValue.Color = sal_uInt32(COL_BLACK);
1126  aValue.InnerLineWidth = aValue.LineDistance = 0;
1127  aValue.OuterLineWidth = DEFAULT_LINE_WIDTH;
1128  aValue.LineStyle = table::BorderLineStyle::SOLID;
1129  aValue.LineWidth = DEFAULT_LINE_WIDTH;
1130 
1131  awt::Point aPos = xFixedLine->getPosition();
1132  awt::Size aSize = xFixedLine->getSize();
1133  sal_Int32 nSectionHeight = xFixedLine->getSection()->getHeight();
1134 
1135  OUString sBorderProp;
1136  ::std::vector< OUString> aProps;
1137  if ( xFixedLine->getOrientation() == 1 ) // vertical
1138  {
1139  // check if border should be left
1140  if ( !aPos.X )
1141  {
1142  sBorderProp = PROPERTY_BORDERLEFT;
1143  aProps.emplace_back(PROPERTY_BORDERRIGHT);
1144  }
1145  else
1146  {
1147  sBorderProp = PROPERTY_BORDERRIGHT;
1148  aProps.emplace_back(PROPERTY_BORDERLEFT);
1149  }
1150  aProps.emplace_back(PROPERTY_BORDERTOP);
1151  aProps.emplace_back(PROPERTY_BORDERBOTTOM);
1152  }
1153  else // horizontal
1154  {
1155  // check if border should be bottom
1156  if ( (aPos.Y + aSize.Height) == nSectionHeight )
1157  {
1158  sBorderProp = PROPERTY_BORDERBOTTOM;
1159  aProps.emplace_back(PROPERTY_BORDERTOP);
1160  }
1161  else
1162  {
1163  sBorderProp = PROPERTY_BORDERTOP;
1164  aProps.emplace_back(PROPERTY_BORDERBOTTOM);
1165  }
1166  aProps.emplace_back(PROPERTY_BORDERRIGHT);
1167  aProps.emplace_back(PROPERTY_BORDERLEFT);
1168  }
1169 
1170  xBorderProp->setPropertyValue(sBorderProp,uno::makeAny(aValue));
1171 
1172  aValue.Color = aValue.OuterLineWidth = aValue.LineWidth = 0;
1173  aValue.LineStyle = table::BorderLineStyle::NONE;
1174  uno::Any aEmpty;
1175  aEmpty <<= aValue;
1176  for (auto const& it : aProps)
1177  {
1178  xBorderProp->setPropertyValue(it, aEmpty);
1179  }
1180 
1181  ::std::vector<XMLPropertyState> aBorderStates(m_xCellStylesExportPropertySetMapper->Filter(*this, xBorderProp));
1182  aPropertyStates.insert( aPropertyStates.end(), aBorderStates.begin(), aBorderStates.end() );
1183  }
1184  else
1185  {
1186  const Reference<XFormattedField> xFormattedField(_xProp,uno::UNO_QUERY);
1187  if ( (_xParentFormattedField.is() || xFormattedField.is()) && !aPropertyStates.empty() )
1188  {
1189  sal_Int32 nNumberFormat = 0;
1190  if ( _xParentFormattedField.is() )
1191  nNumberFormat = _xParentFormattedField->getFormatKey();
1192  else
1193  nNumberFormat = xFormattedField->getFormatKey();
1194  {
1195  sal_Int32 nStyleMapIndex = m_xCellStylesExportPropertySetMapper->getPropertySetMapper()->FindEntryIndex( CTF_RPT_NUMBERFORMAT );
1196  addDataStyle(nNumberFormat);
1197  XMLPropertyState aNumberStyleState( nStyleMapIndex, uno::makeAny( getDataStyleName(nNumberFormat) ) );
1198  auto const iter(::std::find_if(
1199  aPropertyStates.begin(), aPropertyStates.end(),
1200  [nStyleMapIndex] (XMLPropertyState const& rItem)
1201  { return rItem.mnIndex == nStyleMapIndex; } ));
1202  if (iter == aPropertyStates.end())
1203  {
1204  aPropertyStates.push_back( aNumberStyleState );
1205  }
1206  else
1207  { // there is already a property but it has the wrong type
1208  // (integer not string); TODO: can we prevent it
1209  // getting added earlier?
1210  (*iter) = aNumberStyleState;
1211  }
1212  }
1213  }
1214  }
1215 
1216  if ( !aPropertyStates.empty() )
1217  m_aAutoStyleNames.emplace( _xProp,GetAutoStylePool()->Add( XmlStyleFamily::TABLE_CELL, aPropertyStates ));
1218 }
1219 
1220 void ORptExport::exportAutoStyle(const Reference<XSection>& _xProp)
1221 {
1222  ::std::vector<XMLPropertyState> aPropertyStates(m_xTableStylesExportPropertySetMapper->Filter(*this, _xProp));
1223  if ( !aPropertyStates.empty() )
1224  m_aAutoStyleNames.emplace( _xProp.get(),GetAutoStylePool()->Add( XmlStyleFamily::TABLE_TABLE, aPropertyStates ));
1225 }
1226 
1228 {
1229  Reference<XReportDefinition> xProp(getReportDefinition());
1230  exportReportAttributes(xProp);
1231 }
1232 
1233 void ORptExport::exportReportAttributes(const Reference<XReportDefinition>& _xReport)
1234 {
1235  if ( !_xReport.is() )
1236  return;
1237 
1238  OUStringBuffer sValue;
1239  const SvXMLEnumMapEntry<sal_Int32>* aXML_CommandTypeEnumMap = OXMLHelper::GetCommandTypeOptions();
1240  if ( SvXMLUnitConverter::convertEnum( sValue, _xReport->getCommandType(), aXML_CommandTypeEnumMap ) )
1241  AddAttribute(XML_NAMESPACE_REPORT, XML_COMMAND_TYPE,sValue.makeStringAndClear());
1242 
1243  OUString sCommand = _xReport->getCommand();
1244  if ( !sCommand.isEmpty() )
1246 
1247  OUString sFilter( _xReport->getFilter() );
1248  if ( !sFilter.isEmpty() )
1250 
1251  AddAttribute(XML_NAMESPACE_OFFICE, XML_MIMETYPE,_xReport->getMimeType());
1252 
1253  bool bEscapeProcessing( _xReport->getEscapeProcessing() );
1254  if ( !bEscapeProcessing )
1256 
1257  OUString sName = _xReport->getCaption();
1258  if ( !sName.isEmpty() )
1260  sName = _xReport->getName();
1261  if ( !sName.isEmpty() )
1263 }
1264 
1266 {
1268 }
1269 
1271 {
1272  GetPageExport()->exportMasterStyles( true );
1273 }
1274 
1276 {
1277  if ( m_bAllreadyFilled )
1278  return;
1279 
1280  m_bAllreadyFilled = true;
1281  Reference<XReportDefinition> xProp(getReportDefinition());
1282  if ( !xProp.is() )
1283  return;
1284 
1285  uno::Reference< report::XSection> xParent(xProp->getParent(),uno::UNO_QUERY);
1286  if ( xParent.is() )
1287  exportAutoStyle(xProp.get());
1288 
1289  if ( xProp->getReportHeaderOn() )
1290  exportSectionAutoStyle(xProp->getReportHeader());
1291  if ( xProp->getPageHeaderOn() )
1292  exportSectionAutoStyle(xProp->getPageHeader());
1293 
1294  exportGroup(xProp,0,true);
1295 
1296  if ( xProp->getPageFooterOn() )
1297  exportSectionAutoStyle(xProp->getPageFooter());
1298  if ( xProp->getReportFooterOn() )
1299  exportSectionAutoStyle(xProp->getReportFooter());
1300 }
1301 
1303 {
1304  // there are no styles that require their own autostyles
1305  if ( getExportFlags() & SvXMLExportFlags::CONTENT )
1306  {
1308  GetAutoStylePool()->exportXML(XmlStyleFamily::TABLE_TABLE);
1309  GetAutoStylePool()->exportXML(XmlStyleFamily::TABLE_COLUMN);
1310  GetAutoStylePool()->exportXML(XmlStyleFamily::TABLE_ROW);
1311  GetAutoStylePool()->exportXML(XmlStyleFamily::TABLE_CELL);
1312  exportDataStyles();
1313  GetShapeExport()->exportAutoStyles();
1314  }
1315  // exported in _ExportMasterStyles
1316  if( getExportFlags() & SvXMLExportFlags::MASTERSTYLES )
1317  GetPageExport()->collectAutoStyles( false );
1318  if( getExportFlags() & SvXMLExportFlags::MASTERSTYLES )
1319  GetPageExport()->exportAutoStyles();
1320 }
1321 
1323 {
1325 
1326  // write draw:style-name for object graphic-styles
1327  GetShapeExport()->ExportGraphicDefaults();
1328 }
1329 
1331 {
1332  return new OXMLAutoStylePoolP(*this);
1333 }
1334 
1335 void SAL_CALL ORptExport::setSourceDocument( const Reference< XComponent >& xDoc )
1336 {
1337  m_xReportDefinition.set(xDoc,UNO_QUERY_THROW);
1339 }
1340 
1342 {
1343  GetFontAutoStylePool(); // make sure the pool is created
1346 }
1347 
1348 void ORptExport::exportParagraph(const Reference< XReportControlModel >& _xReportElement)
1349 {
1350  OSL_PRECOND(_xReportElement.is(),"Element is null!");
1351  // start <text:p>
1352  SvXMLElementExport aParagraphContent(*this,XML_NAMESPACE_TEXT, XML_P, false, false);
1353  if ( Reference<XFormattedField>(_xReportElement,uno::UNO_QUERY).is() )
1354  {
1355  OUString sFieldData = _xReportElement->getDataField();
1356  static const char s_sPageNumber[] = "PageNumber()";
1357  static const char s_sReportPrefix[] = "rpt:";
1358  sFieldData = sFieldData.copy(strlen(s_sReportPrefix));
1359  sal_Int32 nPageNumberIndex = sFieldData.indexOf(s_sPageNumber);
1360  if ( nPageNumberIndex != -1 )
1361  {
1362  sal_Int32 nIndex = 0;
1363  do
1364  {
1365  OUString sToken = sFieldData.getToken( 0, '&', nIndex );
1366  sToken = sToken.trim();
1367  if ( !sToken.isEmpty() )
1368  {
1369  if ( sToken == s_sPageNumber )
1370  {
1372  SvXMLElementExport aPageNumber(*this,XML_NAMESPACE_TEXT, XML_PAGE_NUMBER, false, false);
1373  Characters("1");
1374  }
1375  else if ( sToken == "PageCount()" )
1376  {
1377  SvXMLElementExport aPageNumber(*this,XML_NAMESPACE_TEXT, XML_PAGE_COUNT, false, false);
1378  Characters("1");
1379  }
1380  else
1381  {
1382 
1383  if ( sToken.startsWith("\"") && sToken.endsWith("\"") )
1384  sToken = sToken.copy(1,sToken.getLength()-2);
1385 
1386  bool bPrevCharIsSpace = false;
1387  GetTextParagraphExport()->exportCharacterData(sToken, bPrevCharIsSpace);
1388  }
1389  }
1390  }
1391  while ( nIndex >= 0 );
1392  }
1393  }
1394  Reference< XFixedText > xFT(_xReportElement,UNO_QUERY);
1395  if ( xFT.is() )
1396  {
1397  OUString sExpr = xFT->getLabel();
1398  bool bPrevCharIsSpace = false; // FIXME this looks quite broken - does the corresponding import filter do whitespace collapsing at all?
1399  GetTextParagraphExport()->exportCharacterData(sExpr, bPrevCharIsSpace);
1400  }
1401 }
1402 
1404 {
1406  return pShapeExport;
1407 }
1408 
1409 void ORptExport::exportShapes(const Reference< XSection>& _xSection,bool _bAddParagraph)
1410 {
1412  xShapeExport->seekShapes(_xSection);
1413  const sal_Int32 nCount = _xSection->getCount();
1414  ::std::unique_ptr<SvXMLElementExport> pParagraphContent;
1415  if ( _bAddParagraph )
1416  pParagraphContent.reset(new SvXMLElementExport(*this,XML_NAMESPACE_TEXT, XML_P, true, false));
1417 
1418  awt::Point aRefPoint;
1419  aRefPoint.X = rptui::getStyleProperty<sal_Int32>(_xSection->getReportDefinition(),PROPERTY_LEFTMARGIN);
1420  for (sal_Int32 i = 0; i < nCount; ++i)
1421  {
1422  uno::Reference< XShape > xShape(_xSection->getByIndex(i),uno::UNO_QUERY);
1423  if ( xShape.is() )
1424  {
1425  ::std::unique_ptr<SvXMLElementExport> pSubDocument;
1426  uno::Reference< frame::XModel> xModel(xShape->getPropertyValue("Model"),uno::UNO_QUERY);
1427  if ( xModel.is() ) // special handling for chart object
1428  {
1429  pSubDocument.reset(new SvXMLElementExport(*this,XML_NAMESPACE_REPORT, XML_SUB_DOCUMENT, false, false));
1430  exportMasterDetailFields(xShape);
1431  exportReportElement(xShape);
1432  }
1433 
1435  xShapeExport->exportShape(xShape, SEF_DEFAULT|XMLShapeExportFlags::NO_WS,&aRefPoint);
1436  }
1437  }
1438 }
1439 
1440 void ORptExport::exportGroupsExpressionAsFunction(const Reference< XGroups>& _xGroups)
1441 {
1442  if ( !_xGroups.is() )
1443  return;
1444 
1445  uno::Reference< XFunctions> xFunctions = _xGroups->getReportDefinition()->getFunctions();
1446  const sal_Int32 nCount = _xGroups->getCount();
1447  for (sal_Int32 i = 0; i < nCount; ++i)
1448  {
1449  uno::Reference< XGroup> xGroup(_xGroups->getByIndex(i),uno::UNO_QUERY_THROW);
1450  const ::sal_Int16 nGroupOn = xGroup->getGroupOn();
1451  if ( nGroupOn != report::GroupOn::DEFAULT )
1452  {
1453  uno::Reference< XFunction> xFunction = xFunctions->createFunction();
1454  OUString sFunction,sPrefix,sPostfix;
1455  OUString sExpression = xGroup->getExpression();
1456  OUString sFunctionName;
1457  OUString sInitialFormula;
1458  switch(nGroupOn)
1459  {
1460  case report::GroupOn::PREFIX_CHARACTERS:
1461  sFunction = "LEFT";
1462  sPrefix = ";" + OUString::number(xGroup->getGroupInterval());
1463  break;
1464  case report::GroupOn::YEAR:
1465  sFunction = "YEAR";
1466  break;
1467  case report::GroupOn::QUARTAL:
1468  sFunction = "INT((MONTH";
1469  sPostfix = "-1)/3)+1";
1470  sFunctionName = "QUARTAL_" + sExpression;
1471  break;
1472  case report::GroupOn::MONTH:
1473  sFunction = "MONTH";
1474  break;
1475  case report::GroupOn::WEEK:
1476  sFunction = "WEEK";
1477  break;
1478  case report::GroupOn::DAY:
1479  sFunction = "DAY";
1480  break;
1481  case report::GroupOn::HOUR:
1482  sFunction = "HOUR";
1483  break;
1484  case report::GroupOn::MINUTE:
1485  sFunction = "MINUTE";
1486  break;
1487  case report::GroupOn::INTERVAL:
1488  {
1489  sFunction = "INT";
1490  uno::Reference< XFunction> xCountFunction = xFunctions->createFunction();
1491  xCountFunction->setInitialFormula(beans::Optional< OUString>(true,OUString("rpt:0")));
1492  OUString sCountName = sFunction + "_count_" + sExpression;
1493  xCountFunction->setName(sCountName);
1494  xCountFunction->setFormula( "rpt:[" + sCountName + "] + 1" );
1495  exportFunction(xCountFunction);
1496  sExpression = sCountName;
1497  // The reference to sCountName in the formula of sFunctionName refers to the *old* value
1498  // so we need to expand the formula of sCountName
1499  sPrefix = " + 1) / " + OUString::number(xGroup->getGroupInterval());
1500  sFunctionName = sFunction + "_" + sExpression;
1501  sFunction += "(";
1502  sInitialFormula = "rpt:0";
1503  }
1504  break;
1505  default:
1506  ;
1507  }
1508  if ( sFunctionName.isEmpty() )
1509  sFunctionName = sFunction + "_" + sExpression;
1510  if ( !sFunction.isEmpty() )
1511  {
1512  const sal_Unicode pReplaceChars[] = { '(',')',';',',','+','-','[',']','/','*'};
1513  for(sal_Unicode ch : pReplaceChars)
1514  sFunctionName = sFunctionName.replace(ch,'_');
1515 
1516  xFunction->setName(sFunctionName);
1517  if ( !sInitialFormula.isEmpty() )
1518  xFunction->setInitialFormula(beans::Optional< OUString>(true, sInitialFormula));
1519  sFunction = "rpt:" + sFunction + "([" + sExpression + "]";
1520 
1521  if ( !sPrefix.isEmpty() )
1522  sFunction += sPrefix;
1523  sFunction += ")";
1524  if ( !sPostfix.isEmpty() )
1525  sFunction += sPostfix;
1526  xFunction->setFormula(sFunction);
1527  exportFunction(xFunction);
1528  m_aGroupFunctionMap.emplace(xGroup,xFunction);
1529  }
1530  }
1531  }
1532 }
1533 
1534 
1535 }// rptxml
1536 
1537 
1538 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
XML_NP_GRDDL
#define XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME
XML_NP_XHTML
XML_NP_RPT
#define PROPERTY_BORDERLEFT
Definition: strings.hxx:282
void exportReportElement(const Reference< XReportControlModel > &_xReportElement)
Definition: xmlExport.cxx:410
static void lcl_adjustColumnSpanOverRows(ORptExport::TSectionsGrid &_rGrid)
Definition: xmlExport.cxx:151
XML_REPORT_HEADER
sal_Int32 nIndex
void collectComponentStyles()
Definition: xmlExport.cxx:1275
XML_NUMBER_ROWS_SPANNED
virtual void ExportStyles_(bool bUsed) override
Definition: xmlExport.cxx:1322
constexpr sal_uInt16 XML_NAMESPACE_OFFICE
XML_STYLE_NAME
XML_MASTER_DETAIL_FIELD
rtl::Reference< XMLShapeExport > const & GetShapeExport()
XML_GROUP_HEADER
rtl::Reference< XMLPropertyHandlerFactory > m_xPropHdlFactory
Definition: xmlExport.hxx:99
void exportContainer(const Reference< XSection > &_xSection)
Definition: xmlExport.cxx:742
#define PROPERTY_RIGHTMARGIN
Definition: strings.hxx:105
XML_NP_FO
::std::map< Reference< XPropertySet >,TGrid > TSectionsGrid
Definition: xmlExport.hxx:82
XML_PRE_EVALUATED
void exportStyleName(XPropertySet *_xProp, SvXMLAttributeList &_rAtt, const OUString &_sName)
Definition: xmlExport.cxx:995
XML_GROUP_FOOTER
XML_ANCHOR_TYPE
XML_N_TABLE
#define SERVICE_IMAGECONTROL
Definition: strings.hxx:24
XML_NAME
XML_PAGE_COUNT
TPropertyStyleMap m_aAutoStyleNames
Definition: xmlExport.hxx:87
rtl::Reference< SvXMLExportPropertyMapper > m_xRowStylesExportPropertySetMapper
Definition: xmlExport.hxx:97
XML_COMMAND_TYPE
static const XMLPropertyMapEntry * GetColumnStyleProps()
Definition: xmlHelper.cxx:176
rtl::Reference< XMLTextParagraphExport > const & GetTextParagraphExport()
const SvXMLUnitConverter & GetMM100UnitConverter() const
SvXMLExportFlags
virtual SvXMLAutoStylePoolP * CreateAutoStylePool() override
Definition: xmlExport.cxx:1330
XML_GROUP_EXPRESSION
virtual void SAL_CALL setSourceDocument(const css::uno::Reference< css::lang::XComponent > &xDoc) override
TSectionsGrid m_aSectionsGrid
Definition: xmlExport.hxx:85
static const SvXMLEnumMapEntry< sal_Int16 > * GetReportPrintOptions()
Definition: xmlHelper.cxx:186
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * reportdesign_ORptMetaExportHelper_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Exports only meta data.
Definition: xmlExport.cxx:106
#define XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_PREFIX
void exportAutoStyle(XPropertySet *_xProp, const Reference< XFormattedField > &_xParentFormattedField=Reference< XFormattedField >())
Definition: xmlExport.cxx:1095
XML_RESET_PAGE_NUMBER
constexpr sal_uInt16 XML_NAMESPACE_XLINK
static const SvXMLEnumMapEntry< sal_Int16 > * GetForceNewPageOptions()
Definition: xmlHelper.cxx:198
constexpr sal_uInt16 XML_NAMESPACE_OOO
static const XMLPropertyMapEntry * GetRowStyleProps()
Definition: xmlHelper.cxx:165
void SetXMLMeasureUnit(sal_Int16 const eXMLMeasureUnit)
constexpr sal_uInt16 XML_NAMESPACE_LO_EXT
XML_N_OOO
virtual void SAL_CALL setSourceDocument(const css::uno::Reference< css::lang::XComponent > &xDoc) override
Definition: xmlExport.cxx:1335
XML_BODY
XML_FORCE_NEW_COLUMN
XML_DEEP_TRAVERSING
#define DEFAULT_LINE_WIDTH
Definition: xmlExport.cxx:48
constexpr sal_uInt16 XML_NAMESPACE_NUMBER
TGroupFunctionMap m_aGroupFunctionMap
Definition: xmlExport.hxx:90
virtual void ExportStyles_(bool bUsed)
#define XML_STYLE_FAMILY_TABLE_CELL_STYLES_PREFIX
#define PROPERTY_BORDERRIGHT
Definition: strings.hxx:283
XML_NP_NUMBER
XML_IMAGE
SvXMLAttributeList & GetAttrList()
XmlStyleFamily
sal_uInt16 sal_Unicode
void SetCoreMeasureUnit(sal_Int16 const eCoreMeasureUnit)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * reportdesign_ORptExport_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Definition: xmlExport.cxx:275
XML_TABLE_CELL
XML_TABLE
OUString m_sCellStyle
Definition: xmlExport.hxx:93
#define PROPERTY_LEFTMARGIN
Definition: strings.hxx:104
XML_N_STYLE
XML_ESCAPE_PROCESSING
static OUString convertFormula(const OUString &_sFormula)
Definition: xmlExport.cxx:975
int nCount
void AddAttribute(sal_uInt16 nPrefix, const char *pName, const OUString &rValue)
XML_NP_XLINK
virtual void ExportMasterStyles_() override
Definition: xmlExport.cxx:1270
constexpr sal_uInt16 XML_NAMESPACE_FORM
static css::uno::Reference< css::beans::XPropertySet > createBorderPropertySet()
Definition: xmlHelper.cxx:317
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * reportdesign_ODBFullExportHelper_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Exports all.
Definition: xmlExport.cxx:119
TGridStyleMap m_aRowStyleNames
Definition: xmlExport.hxx:89
XML_NP_OFFICE
XML_GROUP
XML_NUMBER_COLUMNS_SPANNED
OUString GetRelativeReference(const OUString &rValue)
virtual OUString getDataStyleName(const sal_Int32 nNumberFormat, bool bTimeFormat=false) const
#define XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME
XML_FORMAT_CONDITION
XML_N_TEXT
constexpr sal_uInt16 XML_NAMESPACE_DRAW
static const SvXMLEnumMapEntry< sal_Int32 > * GetCommandTypeOptions()
Definition: xmlHelper.cxx:221
XML_FALSE
const char * sName
XML_N_NUMBER
void exportParagraph(const Reference< XReportControlModel > &_xReportElement)
Definition: xmlExport.cxx:1348
OUString m_sTableStyle
Definition: xmlExport.hxx:92
static void lcl_calculate(const ::std::vector< sal_Int32 > &_aPosX, const ::std::vector< sal_Int32 > &_aPosY, ORptExport::TGrid &_rColumns)
Definition: xmlExport.cxx:438
XML_INITIAL_FORMULA
TGridStyleMap m_aColumnStyleNames
Definition: xmlExport.hxx:88
constexpr sal_uInt16 XML_NAMESPACE_CONFIG
XML_N_GRDDL
XML_N_OFFICE
SvtSaveOptions::ODFSaneDefaultVersion getSaneDefaultVersion() const
OUString sPrefix
XML_N_LO_EXT
constexpr sal_uInt16 XML_NAMESPACE_SVG
XML_CAPTION
#define SERVICE_FORMATTEDFIELD
Definition: strings.hxx:23
virtual XMLShapeExport * CreateShapeExport() override
Definition: xmlExport.cxx:1403
XML_REPORT_FOOTER
XML_N_DRAW
XML_PAGE_HEADER
XML_TABLE_ROW
constexpr sal_uInt16 XML_NAMESPACE_FO
int i
XML_PRINT_REPEATED_VALUES
XML_MASTER_DETAIL_FIELDS
#define PROPERTY_PAPERSIZE
Definition: strings.hxx:62
XML_MASTER
constexpr sal_uInt16 XML_NAMESPACE_TEXT
XML_NP_DRAW
XML_NP_CONFIG
void exportShapes(const Reference< XSection > &_xSection, bool _bAddParagraph=true)
Definition: xmlExport.cxx:1409
css::uno::Reference< css::util::XNumberFormatsSupplier > & GetNumberFormatsSupplier()
XML_DETAIL
::std::vector< TCell > TRow
Definition: xmlExport.hxx:80
Any aHelper
rtl::Reference< SvXMLExportPropertyMapper > m_xTableStylesExportPropertySetMapper
Definition: xmlExport.hxx:94
XML_COMMAND
#define XML_STYLE_FAMILY_TABLE_TABLE_STYLES_PREFIX
XML_FORMATTED_TEXT
rtl::Reference< SvXMLExportPropertyMapper > m_xColumnStylesExportPropertySetMapper
Definition: xmlExport.hxx:96
float u
XML_NP_TEXT
constexpr sal_uInt16 XML_NAMESPACE_GRDDL
#define SEF_DEFAULT
constexpr sal_uInt16 XML_NAMESPACE_XHTML
XML_VISIBLE
static rtl::Reference< XMLPropertySetMapper > GetCellStylePropertyMap(bool _bOldFormat, bool bForExport)
Definition: xmlHelper.cxx:107
OUString GetQNameByKey(sal_uInt16 nKey, const OUString &rLocalName, bool bCache=true) const
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * reportdesign_ORptContentExportHelper_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Exports only content.
Definition: xmlExport.cxx:79
Reference< XReportDefinition > m_xReportDefinition
Definition: xmlExport.hxx:102
XML_NP_FORM
static const SvXMLEnumMapEntry< sal_Int16 > * GetImageScaleOptions()
Definition: xmlHelper.cxx:370
virtual void ExportContent_() override
Definition: xmlExport.cxx:1265
const SvXMLNamespaceMap & GetNamespaceMap() const
XML_COVERED_TABLE_CELL
XML_NP_LO_EXT
void exportFormatConditions(const Reference< XReportControlModel > &_xReportElement)
Definition: xmlExport.cxx:386
virtual void exportDataStyles()
void exportComponent(const Reference< XReportComponent > &_xReportComponent)
Definition: xmlExport.cxx:375
bool exportFormula(enum::xmloff::token::XMLTokenEnum eName, const OUString &_sFormula)
Definition: xmlExport.cxx:983
XML_FORCE_NEW_PAGE
XML_SORT_ASCENDING
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * reportdesign_ORptExportHelper_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Exports only settings.
Definition: xmlExport.cxx:66
rtl::Reference< XMLPropertySetMapper > m_xCellStylesPropertySetMapper
Definition: xmlExport.hxx:101
constexpr sal_uInt16 XML_NAMESPACE_TABLE
virtual void ExportAutoStyles_() override
Definition: xmlExport.cxx:1302
XML_START_NEW_COLUMN
XML_NP_TABLE
sal_Int16 GetCellType(const sal_Int32 nNumberFormat, OUString &sCurrency, bool &bIsStandard)
XML_PAGE_FOOTER
SvXMLNamespaceMap & GetNamespaceMap_()
static const XMLPropertyMapEntry * GetTableStyleProps()
Definition: xmlHelper.cxx:154
XML_N_FORM
#define PROPERTY_BORDERTOP
Definition: strings.hxx:284
XML_PRESERVE_IRI
XML_TABLE_COLUMNS
XML_NP_STYLE
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
rtl::Reference< SvXMLAutoStylePoolP > const & GetAutoStylePool()
XML_FILTER
#define PROPERTY_BORDERBOTTOM
Definition: strings.hxx:285
constexpr sal_uInt16 XML_NAMESPACE_REPORT
rtl::Reference< XMLFontAutoStylePool > const & GetFontAutoStylePool()
XML_NP_SVG
XML_REPORT_COMPONENT
XML_PAGE_NUMBER
virtual void ExportFontDecls_() override
Definition: xmlExport.cxx:1341
XML_N_XLINK
void Characters(const OUString &rChars)
#define XML_STYLE_FAMILY_TABLE_ROW_STYLES_PREFIX
XML_FIXED_CONTENT
XML_P
void exportTableColumns(const Reference< XSection > &_xSection)
Definition: xmlExport.cxx:727
::std::vector< ::std::pair< bool, TRow > > TGrid
Definition: xmlExport.hxx:81
XML_PAGE_PRINT_OPTION
sal_uInt16 Add(const OUString &rPrefix, const OUString &rName, sal_uInt16 nKey=XML_NAMESPACE_UNKNOWN)
static bool convertEnum(EnumT &rEnum, std::u16string_view rValue, const SvXMLEnumMapEntry< EnumT > *pMap)
void setExportFlags(SvXMLExportFlags nExportFlags)
const Reference< XReportDefinition > & getReportDefinition() const
Definition: xmlExport.hxx:151
XML_PRINT_WHEN_GROUP_CHANGE
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
static const SvXMLEnumMapEntry< sal_Int16 > * GetKeepTogetherOptions()
Definition: xmlHelper.cxx:210
XML_ENABLED
XML_TABLE_COLUMN
XML_KEEP_TOGETHER
#define XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME
ORptExport(const Reference< XComponentContext > &_rxContext, OUString const &implementationName, SvXMLExportFlags nExportFlag)
Definition: xmlExport.cxx:179
XML_SCALE
XML_REPEAT_SECTION
void exportGroupsExpressionAsFunction(const Reference< XGroups > &_xGroups)
Definition: xmlExport.cxx:1440
XML_N_SVG_COMPAT
XML_PARAGRAPH
XML_IMAGE_DATA
XML_TRUE
rtl::Reference< XMLPageExport > const & GetPageExport()
XML_N_CONFIG
void exportGroup(const Reference< XReportDefinition > &_xReportDefinition, sal_Int32 _nPos, bool _bExportAutoStyle=false)
Definition: xmlExport.cxx:1007
static SvXMLExportPropertyMapper * CreateShapeExtPropMapper(SvXMLExport &rExport)
#define XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME
XML_N_XHTML
void AddAttribute(const OUString &sName, const OUString &sValue)
static SvXMLExportPropertyMapper * CreateParaExtPropMapper(SvXMLExport &rExport)
XML_REPORT
Reference< XModel > xModel
void exportFunctions(const Reference< XIndexAccess > &_xFunctions)
Definition: xmlExport.cxx:284
rtl::Reference< SvXMLExportPropertyMapper > m_xCellStylesExportPropertySetMapper
Definition: xmlExport.hxx:95
XML_MIMETYPE
void exportFunction(const Reference< XFunction > &_xFunction)
Definition: xmlExport.cxx:294
XML_SECTION
void exportReport(const Reference< XReportDefinition > &_xReportDefinition)
Definition: xmlExport.cxx:331
void exportReportAttributes(const Reference< XReportDefinition > &_xReport)
Definition: xmlExport.cxx:1233
XMLTokenEnum eToken
void exportSection(const Reference< XSection > &_xProp, bool bHeader=false)
Definition: xmlExport.cxx:689
rtl::Reference< SvXMLExportPropertyMapper > m_xParaPropMapper
Definition: xmlExport.hxx:98
XML_SUB_DOCUMENT
void collectStyleNames(XmlStyleFamily _nFamily, const ::std::vector< sal_Int32 > &_aSize, std::vector< OUString > &_rStyleNames)
Definition: xmlExport.cxx:454
virtual void addDataStyle(const sal_Int32 nNumberFormat, bool bTimeFormat=false)
XML_FUNCTION
SvXMLExportFlags getExportFlags() const
XML_SORT_EXPRESSION
void exportSectionAutoStyle(const Reference< XSection > &_xProp)
Definition: xmlExport.cxx:492
XML_N_FO_COMPAT
virtual void ExportFontDecls_()
constexpr sal_uInt16 XML_NAMESPACE_STYLE
XML_NP_OOO
void exportMasterDetailFields(const Reference< XReportComponent > &_xReportComponent)
Definition: xmlExport.cxx:309
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * reportdesign_ORptStylesExportHelper_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Exports only styles.
Definition: xmlExport.cxx:92
sal_uInt16 nPos
virtual void SetBodyAttributes() override
Definition: xmlExport.cxx:1227
#define SERVICE_FIXEDTEXT
Definition: strings.hxx:22
sal_Int16 nValue
XML_SELECT_PAGE
void SetNumberFormatAttributes(const sal_Int32 nNumberFormat, const double &rValue, bool bExportValue=true, sal_uInt16 nNamespace=XML_NAMESPACE_OFFICE, bool bExportCurrencySymbol=true)
XML_CONDITIONAL_PRINT_EXPRESSION
#define CTF_RPT_NUMBERFORMAT
Definition: xmlHelper.hxx:29
XML_N_RPT
XML_REPORT_ELEMENT
XML_FORMULA
void exportReportComponentAutoStyles(const Reference< XSection > &_xProp)
Definition: xmlExport.cxx:650