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