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 <o3tl/safeint.hxx>
22 #include "xmlExport.hxx"
23 #include "xmlAutoStyle.hxx"
24 #include <xmloff/xmltoken.hxx>
25 #include <xmloff/xmlnamespace.hxx>
26 #include <xmloff/xmluconv.hxx>
27 #include <xmloff/namespacemap.hxx>
28 #include <xmloff/txtprmap.hxx>
29 #include <xmloff/numehelp.hxx>
30 #include "xmlHelper.hxx"
31 #include <strings.hxx>
32 #include "xmlPropertyHandler.hxx"
33 #include <com/sun/star/util/NumberFormat.hpp>
34 #include <com/sun/star/util/MeasureUnit.hpp>
35 #include <com/sun/star/report/GroupOn.hpp>
36 #include <com/sun/star/report/XFixedText.hpp>
37 #include <com/sun/star/report/XImageControl.hpp>
38 #include <com/sun/star/report/XShape.hpp>
39 #include <com/sun/star/report/XFunction.hpp>
40 #include <com/sun/star/awt/FontDescriptor.hpp>
41 #include <com/sun/star/table/BorderLine2.hpp>
42 #include <com/sun/star/table/BorderLineStyle.hpp>
43 #include <com/sun/star/report/XFixedLine.hpp>
44 #include <RptDef.hxx>
45 #include <vcl/svapp.hxx>
46 #include <osl/diagnose.h>
47 #include <tools/color.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  {
503  nOffset,
504  aSize.Width - rptui::getStyleProperty<sal_Int32>(xReport,PROPERTY_RIGHTMARGIN)
505  };
506  aColumnPos.reserve(2*(nCount + 1));
507 
508  ::std::vector<sal_Int32> aRowPos
509  {
510  0,
511  o3tl::narrowing<sal_Int32>(_xProp->getHeight())
512  };
513  aRowPos.reserve(2*(nCount + 1));
514 
515 
516  ::std::vector<sal_Int32> aRowPosAutoGrow;
517  aRowPosAutoGrow.reserve(2 * (nCount + 1));
518 
519 
520  sal_Int32 i;
521  for (i = 0 ; i< nCount ; ++i)
522  {
523  Reference<XReportComponent> xReportElement(_xProp->getByIndex(i),uno::UNO_QUERY);
524  uno::Reference< XShape> xShape(xReportElement,uno::UNO_QUERY);
525  if ( xShape.is() )
526  continue;
527  OSL_ENSURE( xReportElement.is(),"NULL Element in Section!" );
528  if ( !xReportElement.is() )
529  continue;
530  sal_Int32 nX = xReportElement->getPositionX();
531  aColumnPos.push_back(nX);
532  Reference<XFixedLine> xFixedLine(xReportElement,uno::UNO_QUERY);
533  if ( xFixedLine.is() && xFixedLine->getOrientation() == 1 ) // vertical
534  {
535  sal_Int32 nWidth = static_cast<sal_Int32>(xReportElement->getWidth()*0.5);
536  nX += nWidth;
537  aColumnPos.push_back(nX);
538  nX += xReportElement->getWidth() - nWidth;
539  }
540  else
541  nX += xReportElement->getWidth();
542  aColumnPos.push_back(nX); // --nX why?
543 
544  sal_Int32 nY = xReportElement->getPositionY();
545  aRowPos.push_back(nY);
546  nY += xReportElement->getHeight();
547  aRowPos.push_back(nY); // --nY why?
548  bool bAutoGrow = xReportElement->getAutoGrow();
549  if (bAutoGrow)
550  {
551  // the resulting table row ending at nY should auto-grow
552  aRowPosAutoGrow.push_back(nY);
553  }
554  }
555 
556  ::std::sort(aColumnPos.begin(),aColumnPos.end(),::std::less<sal_Int32>());
557  aColumnPos.erase(::std::unique(aColumnPos.begin(),aColumnPos.end()),aColumnPos.end());
558 
559  // note: the aRowPos contains top and bottom position of every report control; we now compute the
560  // top of every row in the resulting table, by sorting and eliminating unnecessary duplicate
561  // positions. (the same for the columns in the preceding lines.)
562  ::std::sort(aRowPos.begin(),aRowPos.end(),::std::less<sal_Int32>());
563  aRowPos.erase(::std::unique(aRowPos.begin(),aRowPos.end()),aRowPos.end());
564 
565  TSectionsGrid::iterator aInsert = m_aSectionsGrid.emplace(
566  _xProp.get(),
567  TGrid(aRowPos.size() - 1,TGrid::value_type(false,TRow(aColumnPos.size() - 1)))
568  ).first;
569  lcl_calculate(aColumnPos,aRowPos,aInsert->second);
570 
571  TGridStyleMap::iterator aPos = m_aColumnStyleNames.emplace(_xProp.get(),std::vector<OUString>()).first;
572  collectStyleNames(XmlStyleFamily::TABLE_COLUMN,aColumnPos,aPos->second);
573  aPos = m_aRowStyleNames.emplace(_xProp.get(),std::vector<OUString>()).first;
574  collectStyleNames(XmlStyleFamily::TABLE_ROW, aRowPos, aRowPosAutoGrow, aPos->second);
575 
576  sal_Int32 x1 = 0;
577  sal_Int32 y1 = 0;
578  sal_Int32 x2 = 0;
579  sal_Int32 y2 = 0;
580  sal_Int32 xi = 0;
581  sal_Int32 yi = 0;
582  bool isOverlap = false;
583 
584  for (i = 0 ; i< nCount ; ++i)
585  {
586  Reference<XReportComponent> xReportElement(_xProp->getByIndex(i),uno::UNO_QUERY);
587  uno::Reference< XShape> xShape(xReportElement,uno::UNO_QUERY);
588  if ( xShape.is() )
589  continue;
590  sal_Int32 nPos = xReportElement->getPositionX();
591  x1 = (::std::find(aColumnPos.begin(),aColumnPos.end(),nPos) - aColumnPos.begin());
592  Reference<XFixedLine> xFixedLine(xReportElement,uno::UNO_QUERY);
593  if ( xFixedLine.is() && xFixedLine->getOrientation() == 1 ) // vertical
594  nPos += static_cast<sal_Int32>(xReportElement->getWidth()*0.5);
595  else
596  nPos += xReportElement->getWidth(); // -1 why
597  x2 = (::std::find(aColumnPos.begin(),aColumnPos.end(),nPos) - aColumnPos.begin());
598 
599  nPos = xReportElement->getPositionY();
600  y1 = (::std::find(aRowPos.begin(),aRowPos.end(),nPos) - aRowPos.begin());
601  nPos += xReportElement->getHeight(); // -1 why?
602  y2 = (::std::find(aRowPos.begin(),aRowPos.end(),nPos) - aRowPos.begin());
603 
604  isOverlap = false;
605  yi = y1;
606  while(yi < y2 && !isOverlap) // find overlapping controls
607  {
608  xi = x1;
609  while(xi < x2 && !isOverlap)
610  {
611  if ( aInsert->second[yi].second[xi].xElement.is() )
612  {
613  isOverlap = true;
614  }
615  ++xi;
616  }
617  ++yi;
618  }
619 
620  if (!isOverlap)
621  {
622  yi = y1;
623  while(yi < y2)
624  {
625  xi = x1;
626  while(xi < x2)
627  {
628  aInsert->second[yi].second[xi] = TCell();
629  ++xi;
630  }
631  aInsert->second[yi].first = true;
632  ++yi;
633  }
634 
635  if (x2 - x1 != 0 && y2 - y1 != 0)
636  {
637  sal_Int32 nColSpan = x2 - x1;
638  sal_Int32 nRowSpan = y2 - y1;
639  aInsert->second[y1].second[x1] =
640  TCell(
641  nColSpan,
642  nRowSpan,
643  xReportElement
644  );
645  }
646  }
647  }
648 
651 }
652 
653 void ORptExport::exportReportComponentAutoStyles(const Reference<XSection>& _xProp)
654 {
655  const sal_Int32 nCount = _xProp->getCount();
656  for (sal_Int32 i = 0 ; i< nCount ; ++i)
657  {
658  const Reference<XReportComponent> xReportElement(_xProp->getByIndex(i),uno::UNO_QUERY);
659  const Reference< report::XShape > xShape(xReportElement,uno::UNO_QUERY);
660  if ( xShape.is() )
661  {
663  xShapeExport->seekShapes(_xProp);
664  SolarMutexGuard aGuard;
665  xShapeExport->collectShapeAutoStyles(xShape);
666  }
667  else
668  {
669  exportAutoStyle(xReportElement.get());
670 
671  Reference<XFormattedField> xFormattedField(xReportElement,uno::UNO_QUERY);
672  if ( xFormattedField.is() )
673  {
674  try
675  {
676  const sal_Int32 nFormatCount = xFormattedField->getCount();
677  for (sal_Int32 j = 0; j < nFormatCount ; ++j)
678  {
679  uno::Reference< report::XFormatCondition > xCond(xFormattedField->getByIndex(j),uno::UNO_QUERY);
680  exportAutoStyle(xCond.get(),xFormattedField);
681  }
682  }
683  catch(uno::Exception&)
684  {
685  OSL_FAIL("Can not access format condition!");
686  }
687  }
688  }
689  }
690 }
691 
692 void ORptExport::exportSection(const Reference<XSection>& _xSection,bool bHeader)
693 {
694  OSL_ENSURE(_xSection.is(),"Section is NULL -> GPF");
695  AddAttribute(XML_NAMESPACE_TABLE, XML_NAME,_xSection->getName());
696 
697  if ( !_xSection->getVisible() )
699 
700  if ( !bHeader )
701  {
702  OUStringBuffer sValue;
703  sal_Int16 nRet = _xSection->getForceNewPage();
705  if ( SvXMLUnitConverter::convertEnum( sValue, nRet,aXML_EnumMap ) )
706  AddAttribute(XML_NAMESPACE_REPORT, XML_FORCE_NEW_PAGE,sValue.makeStringAndClear());
707 
708  nRet = _xSection->getNewRowOrCol();
709  if ( SvXMLUnitConverter::convertEnum( sValue, nRet,aXML_EnumMap ) )
710  AddAttribute(XML_NAMESPACE_REPORT, XML_FORCE_NEW_COLUMN,sValue.makeStringAndClear());
711  if ( _xSection->getKeepTogether() )
713  }
714 
715  exportStyleName(_xSection.get(),GetAttrList(),m_sTableStyle);
716 
718  SvXMLElementExport aComponents(*this,XML_NAMESPACE_TABLE, XML_TABLE, true, true);
719 
720  OUString sExpr = _xSection->getConditionalPrintExpression();
721  if ( !sExpr.isEmpty() )
722  {
723  exportFormula(XML_FORMULA,sExpr);
725  }
726 
727  exportContainer(_xSection);
728 }
729 
730 void ORptExport::exportTableColumns(const Reference< XSection>& _xSection)
731 {
732  SvXMLElementExport aColumns(*this,XML_NAMESPACE_TABLE, XML_TABLE_COLUMNS, true, true);
733  TGridStyleMap::const_iterator aColFind = m_aColumnStyleNames.find(_xSection);
734  OSL_ENSURE(aColFind != m_aColumnStyleNames.end(),"ORptExport::exportTableColumns: Section not found in m_aColumnStyleNames!");
735  if ( aColFind == m_aColumnStyleNames.end() )
736  return;
737 
738  for (auto& aCol : aColFind->second)
739  {
741  SvXMLElementExport aColumn(*this,XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, true, true);
742  }
743 }
744 
745 void ORptExport::exportContainer(const Reference< XSection>& _xSection)
746 {
747  OSL_ENSURE(_xSection.is(),"Section is NULL -> GPF");
748 
749  exportTableColumns(_xSection);
750 
751  TSectionsGrid::const_iterator aFind = m_aSectionsGrid.find(_xSection);
752  OSL_ENSURE(aFind != m_aSectionsGrid.end(),"ORptExport::exportContainer: Section not found in grid!");
753  if ( aFind == m_aSectionsGrid.end() )
754  return;
755  TGrid::const_iterator aRowIter = aFind->second.begin();
756  TGrid::const_iterator aRowEnd = aFind->second.end();
757 
758  TGridStyleMap::const_iterator aRowFind = m_aRowStyleNames.find(_xSection);
759  auto aHeightIter = aRowFind->second.cbegin();
760  OSL_ENSURE(aRowFind->second.size() == aFind->second.size(),"Different count for rows");
761 
762  bool bShapeHandled = false;
763  ::std::map<sal_Int32,sal_Int32> aRowSpan;
764  for (sal_Int32 j = 0; aRowIter != aRowEnd; ++aRowIter,++j,++aHeightIter)
765  {
766  AddAttribute( m_sTableStyle,*aHeightIter );
767  SvXMLElementExport aRow(*this,XML_NAMESPACE_TABLE, XML_TABLE_ROW, true, true);
768  if ( aRowIter->first )
769  {
770  ::std::vector< TCell >::const_iterator aColIter = aRowIter->second.begin();
771  ::std::vector< TCell >::const_iterator aColEnd = aRowIter->second.end();
772  sal_Int32 nEmptyCellColSpan = 0;
773  for (; aColIter != aColEnd; ++aColIter)
774  {
775  bool bCoveredCell = false;
776  sal_Int32 nColSpan = 0;
777  sal_Int32 nColIndex = aColIter - aRowIter->second.begin();
778  ::std::map<sal_Int32,sal_Int32>::iterator aRowSpanFind = aRowSpan.find(nColIndex);
779  if ( aRowSpanFind != aRowSpan.end() )
780  {
781  nColSpan = 1;
782  if ( !--(aRowSpanFind->second) )
783  aRowSpan.erase(aRowSpanFind);
784 
785  if ( aColIter->nColSpan > 1 )
786  nColSpan += aColIter->nColSpan - 1;
787 
788  bCoveredCell = true;
789  aColIter = aColIter + (aColIter->nColSpan - 1);
790  }
791  else if ( aColIter->bSet )
792  {
793  if ( nEmptyCellColSpan > 0 )
794  {
795  AddAttribute( XML_NAMESPACE_TABLE,XML_NUMBER_COLUMNS_SPANNED, OUString::number(nEmptyCellColSpan) );
796  bCoveredCell = true;
797  nColSpan = nEmptyCellColSpan - 1;
798  nEmptyCellColSpan = 0;
799  }
800  sal_Int32 nSpan = aColIter->nColSpan;
801  if ( nSpan > 1 )
802  {
803  AddAttribute( XML_NAMESPACE_TABLE,XML_NUMBER_COLUMNS_SPANNED, OUString::number(nSpan) );
804  nColSpan = nSpan - 1;
805  bCoveredCell = true;
806  }
807  nSpan = aColIter->nRowSpan;
808  if ( nSpan > 1 )
809  {
810  AddAttribute( XML_NAMESPACE_TABLE,XML_NUMBER_ROWS_SPANNED, OUString::number(nSpan) );
811  aRowSpan[nColIndex] = nSpan - 1;
812  }
813  if ( aColIter->xElement.is() )
814  exportStyleName(aColIter->xElement.get(),GetAttrList(),m_sTableStyle);
815 
816  // start <table:table-cell>
817  Reference<XFormattedField> xFormattedField(aColIter->xElement,uno::UNO_QUERY);
818  if ( xFormattedField.is() )
819  {
820  sal_Int32 nFormatKey = xFormattedField->getFormatKey();
822  bool bIsStandard = false;
823  sal_Int16 nCellType = aHelper.GetCellType(nFormatKey,bIsStandard);
824  // "Standard" means "no format set, value could be anything",
825  // so don't set a format attribute in this case.
826  // P.S.: "Standard" is called "General" in some languages
827  if (!bIsStandard)
828  {
829  if ( nCellType == util::NumberFormat::TEXT )
830  aHelper.SetNumberFormatAttributes("", u"");
831  else
832  aHelper.SetNumberFormatAttributes(nFormatKey, 0.0, false);
833  }
834  }
835  SvXMLElementExport aCell(*this,XML_NAMESPACE_TABLE, XML_TABLE_CELL, true, false);
836 
837  if ( aColIter->xElement.is() )
838  {
839  // start <text:p>
840  SvXMLElementExport aParagraphContent(*this,XML_NAMESPACE_TEXT, XML_P, true, false);
841  Reference<XServiceInfo> xElement(aColIter->xElement,uno::UNO_QUERY);
842 
843  if ( !bShapeHandled )
844  {
845  bShapeHandled = true;
846  exportShapes(_xSection,false);
847  }
848  uno::Reference< XShape > xShape(xElement,uno::UNO_QUERY);
849  uno::Reference< XFixedLine > xFixedLine(xElement,uno::UNO_QUERY);
850  if ( !xShape.is() && !xFixedLine.is() )
851  {
852  Reference<XReportControlModel> xReportElement(xElement,uno::UNO_QUERY);
853  Reference<XReportDefinition> xReportDefinition(xElement,uno::UNO_QUERY);
854  Reference< XImageControl > xImage(xElement,uno::UNO_QUERY);
855  Reference<XSection> xSection(xElement,uno::UNO_QUERY);
856 
858  bool bExportData = false;
859  if ( xElement->supportsService(SERVICE_FIXEDTEXT) )
860  {
861  eToken = XML_FIXED_CONTENT;
862  }
863  else if ( xElement->supportsService(SERVICE_FORMATTEDFIELD) )
864  {
865  eToken = XML_FORMATTED_TEXT;
866  bExportData = true;
867  }
868  else if ( xElement->supportsService(SERVICE_IMAGECONTROL) )
869  {
870  eToken = XML_IMAGE;
871  OUString sTargetLocation = xImage->getImageURL();
872  if ( !sTargetLocation.isEmpty() )
873  {
874  sTargetLocation = GetRelativeReference(sTargetLocation);
876  }
877  bExportData = true;
878  OUStringBuffer sValue;
879  const SvXMLEnumMapEntry<sal_Int16>* aXML_ImageScaleEnumMap = OXMLHelper::GetImageScaleOptions();
880  if ( SvXMLUnitConverter::convertEnum( sValue, xImage->getScaleMode(),aXML_ImageScaleEnumMap ) )
881  AddAttribute(XML_NAMESPACE_REPORT, XML_SCALE, sValue.makeStringAndClear() );
882  }
883  else if ( xReportDefinition.is() )
884  {
885  eToken = XML_SUB_DOCUMENT;
886  }
887 
888  if ( bExportData )
889  {
890  const bool bPageSet = exportFormula(XML_FORMULA,xReportElement->getDataField());
891  if ( bPageSet )
892  eToken = XML_FIXED_CONTENT;
893  else if ( eToken == XML_IMAGE )
894  AddAttribute(XML_NAMESPACE_REPORT, XML_PRESERVE_IRI, xImage->getPreserveIRI() ? XML_TRUE : XML_FALSE );
895  }
896 
897  {
898  // start <report:eToken>
899  SvXMLElementExport aComponents(*this,XML_NAMESPACE_REPORT, eToken, false, false);
900  if ( eToken == XML_FIXED_CONTENT )
901  exportParagraph(xReportElement);
902  if ( xReportElement.is() )
903  exportReportElement(xReportElement);
904 
905  if (eToken == XML_SUB_DOCUMENT && xReportDefinition.is())
906  {
907  SvXMLElementExport aOfficeElement( *this, XML_NAMESPACE_OFFICE, XML_BODY, true, true );
908  SvXMLElementExport aElem( *this, true,
910  true, true );
911 
912  exportReportAttributes(xReportDefinition);
913  exportReport(xReportDefinition);
914  }
915  else if ( xSection.is() )
916  exportSection(xSection);
917  }
918  }
919  }
920  else if ( !bShapeHandled )
921  {
922  bShapeHandled = true;
923  exportShapes(_xSection);
924  }
925  aColIter = aColIter + (aColIter->nColSpan - 1);
926  }
927  else
928  ++nEmptyCellColSpan;
929  if ( bCoveredCell )
930  {
931  for (sal_Int32 k = 0; k < nColSpan; ++k)
932  {
934  }
935 
936  }
937  }
938  if ( nEmptyCellColSpan )
939  {
940  {
941  AddAttribute( XML_NAMESPACE_TABLE,XML_NUMBER_COLUMNS_SPANNED, OUString::number(nEmptyCellColSpan) );
942  SvXMLElementExport aCell(*this,XML_NAMESPACE_TABLE, XML_TABLE_CELL, true, true);
943  if ( !bShapeHandled )
944  {
945  bShapeHandled = true;
946  exportShapes(_xSection);
947  }
948  }
949  for (sal_Int32 k = 0; k < nEmptyCellColSpan; ++k)
950  {
951  SvXMLElementExport aCoveredCell(*this,XML_NAMESPACE_TABLE, XML_COVERED_TABLE_CELL, true, true);
952  }
953  }
954  }
955  else
956  { // empty rows
957  sal_Int32 nEmptyCellColSpan = aRowIter->second.size();
958  if ( nEmptyCellColSpan )
959  {
960  {
961  AddAttribute( XML_NAMESPACE_TABLE,XML_NUMBER_COLUMNS_SPANNED, OUString::number(nEmptyCellColSpan) );
962  SvXMLElementExport aCell(*this,XML_NAMESPACE_TABLE, XML_TABLE_CELL, true, true);
963  if ( !bShapeHandled )
964  {
965  bShapeHandled = true;
966  exportShapes(_xSection);
967  }
968  }
969  for (sal_Int32 k = 1; k < nEmptyCellColSpan; ++k)
970  {
971  SvXMLElementExport aCoveredCell(*this,XML_NAMESPACE_TABLE, XML_COVERED_TABLE_CELL, true, true);
972  }
973  }
974  }
975  }
976 }
977 
978 OUString ORptExport::convertFormula(const OUString& _sFormula)
979 {
980  OUString sFormula = _sFormula;
981  if ( _sFormula == "rpt:" )
982  sFormula.clear();
983  return sFormula;
984 }
985 
986 bool ORptExport::exportFormula(enum ::xmloff::token::XMLTokenEnum eName,const OUString& _sFormula)
987 {
988  const OUString sFieldData = convertFormula(_sFormula);
989  sal_Int32 nPageNumberIndex = sFieldData.indexOf("PageNumber()");
990  sal_Int32 nPageCountIndex = sFieldData.indexOf("PageCount()");
991  bool bRet = nPageNumberIndex != -1 || nPageCountIndex != -1;
992  if ( !bRet )
993  AddAttribute(XML_NAMESPACE_REPORT, eName,sFieldData);
994 
995  return bRet;
996 }
997 
998 void ORptExport::exportStyleName(XPropertySet* _xProp,SvXMLAttributeList& _rAtt,const OUString& _sName)
999 {
1000  Reference<XPropertySet> xFind(_xProp);
1001  TPropertyStyleMap::const_iterator aFind = m_aAutoStyleNames.find(xFind);
1002  if ( aFind != m_aAutoStyleNames.end() )
1003  {
1004  _rAtt.AddAttribute( _sName,
1005  aFind->second );
1006  m_aAutoStyleNames.erase(aFind);
1007  }
1008 }
1009 
1010 void ORptExport::exportGroup(const Reference<XReportDefinition>& _xReportDefinition,sal_Int32 _nPos,bool _bExportAutoStyle)
1011 {
1012  if ( !_xReportDefinition.is() )
1013  return;
1014 
1015  Reference< XGroups > xGroups = _xReportDefinition->getGroups();
1016  if ( !xGroups.is() )
1017  return;
1018 
1019  sal_Int32 nCount = xGroups->getCount();
1020  if ( _nPos >= 0 && _nPos < nCount )
1021  {
1022  Reference<XGroup> xGroup(xGroups->getByIndex(_nPos),uno::UNO_QUERY);
1023  OSL_ENSURE(xGroup.is(),"No Group prepare for GPF");
1024  if ( _bExportAutoStyle )
1025  {
1026  if ( xGroup->getHeaderOn() )
1027  exportSectionAutoStyle(xGroup->getHeader());
1028  exportGroup(_xReportDefinition,_nPos+1,_bExportAutoStyle);
1029  if ( xGroup->getFooterOn() )
1030  exportSectionAutoStyle(xGroup->getFooter());
1031  }
1032  else
1033  {
1034  if ( xGroup->getSortAscending() )
1036 
1037  if ( xGroup->getStartNewColumn() )
1039  if ( xGroup->getResetPageNumber() )
1041 
1042  const OUString sField = xGroup->getExpression();
1043  OUString sExpression = sField;
1044  if ( !sExpression.isEmpty() )
1045  {
1046  sal_Int32 nIndex = sExpression.indexOf('"');
1047  while ( nIndex > -1 )
1048  {
1049  sExpression = sExpression.replaceAt(nIndex, 1, "\"\"");
1050  nIndex = sExpression.indexOf('"',nIndex+2);
1051  }
1052 
1053  TGroupFunctionMap::const_iterator aGroupFind = m_aGroupFunctionMap.find(xGroup);
1054  if ( aGroupFind != m_aGroupFunctionMap.end() )
1055  sExpression = aGroupFind->second->getName();
1056  sExpression = "rpt:HASCHANGED(\"" + sExpression + "\")";
1057  }
1060  sal_Int16 nRet = xGroup->getKeepTogether();
1061  OUStringBuffer sValue;
1062  const SvXMLEnumMapEntry<sal_Int16>* aXML_KeepTogetherEnumMap = OXMLHelper::GetKeepTogetherOptions();
1063  if ( SvXMLUnitConverter::convertEnum( sValue, nRet, aXML_KeepTogetherEnumMap ) )
1064  AddAttribute(XML_NAMESPACE_REPORT, XML_KEEP_TOGETHER,sValue.makeStringAndClear());
1065 
1066  SvXMLElementExport aGroup(*this,XML_NAMESPACE_REPORT, XML_GROUP, true, true);
1067  exportFunctions(xGroup->getFunctions());
1068  if ( xGroup->getHeaderOn() )
1069  {
1070  Reference<XSection> xSection = xGroup->getHeader();
1071  if ( xSection->getRepeatSection() )
1073  SvXMLElementExport aGroupSection(*this,XML_NAMESPACE_REPORT, XML_GROUP_HEADER, true, true);
1074  exportSection(xSection);
1075  }
1076  exportGroup(_xReportDefinition,_nPos+1,_bExportAutoStyle);
1077  if ( xGroup->getFooterOn() )
1078  {
1079  Reference<XSection> xSection = xGroup->getFooter();
1080  if ( xSection->getRepeatSection() )
1082  SvXMLElementExport aGroupSection(*this,XML_NAMESPACE_REPORT, XML_GROUP_FOOTER, true, true);
1083  exportSection(xSection);
1084  }
1085  }
1086  }
1087  else if ( _bExportAutoStyle )
1088  {
1089  exportSectionAutoStyle(_xReportDefinition->getDetail());
1090  }
1091  else
1092  {
1093  SvXMLElementExport aGroupSection(*this,XML_NAMESPACE_REPORT, XML_DETAIL, true, true);
1094  exportSection(_xReportDefinition->getDetail());
1095  }
1096 }
1097 
1098 void ORptExport::exportAutoStyle(XPropertySet* _xProp,const Reference<XFormattedField>& _xParentFormattedField)
1099 {
1100  const uno::Reference<report::XReportControlFormat> xFormat(_xProp,uno::UNO_QUERY);
1101  if ( xFormat.is() )
1102  {
1103  try
1104  {
1105  const awt::FontDescriptor aFont = xFormat->getFontDescriptor();
1106  OSL_ENSURE(!aFont.Name.isEmpty(),"No Font Name !");
1107  GetFontAutoStylePool()->Add(aFont.Name,aFont.StyleName,static_cast<FontFamily>(aFont.Family),
1108  static_cast<FontPitch>(aFont.Pitch),aFont.CharSet );
1109  }
1110  catch(beans::UnknownPropertyException&)
1111  {
1112  // not interested in
1113  }
1114  }
1115  const uno::Reference< report::XShape> xShape(_xProp,uno::UNO_QUERY);
1116  if ( xShape.is() )
1117  {
1118  ::std::vector<XMLPropertyState> aPropertyStates(m_xParaPropMapper->Filter(*this, _xProp));
1119  if ( !aPropertyStates.empty() )
1120  m_aAutoStyleNames.emplace( _xProp,GetAutoStylePool()->Add( XmlStyleFamily::TEXT_PARAGRAPH, std::move(aPropertyStates) ));
1121  }
1122  ::std::vector<XMLPropertyState> aPropertyStates(m_xCellStylesExportPropertySetMapper->Filter(*this, _xProp));
1123  Reference<XFixedLine> xFixedLine(_xProp,uno::UNO_QUERY);
1124  if ( xFixedLine.is() )
1125  {
1126  uno::Reference<beans::XPropertySet> xBorderProp = OXMLHelper::createBorderPropertySet();
1127  table::BorderLine2 aValue;
1128  aValue.Color = sal_uInt32(COL_BLACK);
1129  aValue.InnerLineWidth = aValue.LineDistance = 0;
1130  aValue.OuterLineWidth = DEFAULT_LINE_WIDTH;
1131  aValue.LineStyle = table::BorderLineStyle::SOLID;
1132  aValue.LineWidth = DEFAULT_LINE_WIDTH;
1133 
1134  awt::Point aPos = xFixedLine->getPosition();
1135  awt::Size aSize = xFixedLine->getSize();
1136  sal_Int32 nSectionHeight = xFixedLine->getSection()->getHeight();
1137 
1138  OUString sBorderProp;
1139  ::std::vector< OUString> aProps;
1140  if ( xFixedLine->getOrientation() == 1 ) // vertical
1141  {
1142  // check if border should be left
1143  if ( !aPos.X )
1144  {
1145  sBorderProp = PROPERTY_BORDERLEFT;
1146  aProps.emplace_back(PROPERTY_BORDERRIGHT);
1147  }
1148  else
1149  {
1150  sBorderProp = PROPERTY_BORDERRIGHT;
1151  aProps.emplace_back(PROPERTY_BORDERLEFT);
1152  }
1153  aProps.emplace_back(PROPERTY_BORDERTOP);
1154  aProps.emplace_back(PROPERTY_BORDERBOTTOM);
1155  }
1156  else // horizontal
1157  {
1158  // check if border should be bottom
1159  if ( (aPos.Y + aSize.Height) == nSectionHeight )
1160  {
1161  sBorderProp = PROPERTY_BORDERBOTTOM;
1162  aProps.emplace_back(PROPERTY_BORDERTOP);
1163  }
1164  else
1165  {
1166  sBorderProp = PROPERTY_BORDERTOP;
1167  aProps.emplace_back(PROPERTY_BORDERBOTTOM);
1168  }
1169  aProps.emplace_back(PROPERTY_BORDERRIGHT);
1170  aProps.emplace_back(PROPERTY_BORDERLEFT);
1171  }
1172 
1173  xBorderProp->setPropertyValue(sBorderProp,uno::makeAny(aValue));
1174 
1175  aValue.Color = aValue.OuterLineWidth = aValue.LineWidth = 0;
1176  aValue.LineStyle = table::BorderLineStyle::NONE;
1177  uno::Any aEmpty;
1178  aEmpty <<= aValue;
1179  for (auto const& it : aProps)
1180  {
1181  xBorderProp->setPropertyValue(it, aEmpty);
1182  }
1183 
1184  ::std::vector<XMLPropertyState> aBorderStates(m_xCellStylesExportPropertySetMapper->Filter(*this, xBorderProp));
1185  aPropertyStates.insert( aPropertyStates.end(), aBorderStates.begin(), aBorderStates.end() );
1186  }
1187  else
1188  {
1189  const Reference<XFormattedField> xFormattedField(_xProp,uno::UNO_QUERY);
1190  if ( (_xParentFormattedField.is() || xFormattedField.is()) && !aPropertyStates.empty() )
1191  {
1192  sal_Int32 nNumberFormat = 0;
1193  if ( _xParentFormattedField.is() )
1194  nNumberFormat = _xParentFormattedField->getFormatKey();
1195  else
1196  nNumberFormat = xFormattedField->getFormatKey();
1197  {
1198  sal_Int32 nStyleMapIndex = m_xCellStylesExportPropertySetMapper->getPropertySetMapper()->FindEntryIndex( CTF_RPT_NUMBERFORMAT );
1199  addDataStyle(nNumberFormat);
1200  XMLPropertyState aNumberStyleState( nStyleMapIndex, uno::makeAny( getDataStyleName(nNumberFormat) ) );
1201  auto const iter(::std::find_if(
1202  aPropertyStates.begin(), aPropertyStates.end(),
1203  [nStyleMapIndex] (XMLPropertyState const& rItem)
1204  { return rItem.mnIndex == nStyleMapIndex; } ));
1205  if (iter == aPropertyStates.end())
1206  {
1207  aPropertyStates.push_back( aNumberStyleState );
1208  }
1209  else
1210  { // there is already a property but it has the wrong type
1211  // (integer not string); TODO: can we prevent it
1212  // getting added earlier?
1213  (*iter) = aNumberStyleState;
1214  }
1215  }
1216  }
1217  }
1218 
1219  if ( !aPropertyStates.empty() )
1220  m_aAutoStyleNames.emplace( _xProp,GetAutoStylePool()->Add( XmlStyleFamily::TABLE_CELL, std::move(aPropertyStates) ));
1221 }
1222 
1223 void ORptExport::exportAutoStyle(const Reference<XSection>& _xProp)
1224 {
1225  ::std::vector<XMLPropertyState> aPropertyStates(m_xTableStylesExportPropertySetMapper->Filter(*this, _xProp));
1226  if ( !aPropertyStates.empty() )
1227  m_aAutoStyleNames.emplace( _xProp.get(),GetAutoStylePool()->Add( XmlStyleFamily::TABLE_TABLE, std::move(aPropertyStates) ));
1228 }
1229 
1231 {
1232  Reference<XReportDefinition> xProp(getReportDefinition());
1233  exportReportAttributes(xProp);
1234 }
1235 
1236 void ORptExport::exportReportAttributes(const Reference<XReportDefinition>& _xReport)
1237 {
1238  if ( !_xReport.is() )
1239  return;
1240 
1241  OUStringBuffer sValue;
1242  const SvXMLEnumMapEntry<sal_Int32>* aXML_CommandTypeEnumMap = OXMLHelper::GetCommandTypeOptions();
1243  if ( SvXMLUnitConverter::convertEnum( sValue, _xReport->getCommandType(), aXML_CommandTypeEnumMap ) )
1244  AddAttribute(XML_NAMESPACE_REPORT, XML_COMMAND_TYPE,sValue.makeStringAndClear());
1245 
1246  OUString sCommand = _xReport->getCommand();
1247  if ( !sCommand.isEmpty() )
1249 
1250  OUString sFilter( _xReport->getFilter() );
1251  if ( !sFilter.isEmpty() )
1253 
1254  AddAttribute(XML_NAMESPACE_OFFICE, XML_MIMETYPE,_xReport->getMimeType());
1255 
1256  bool bEscapeProcessing( _xReport->getEscapeProcessing() );
1257  if ( !bEscapeProcessing )
1259 
1260  OUString sName = _xReport->getCaption();
1261  if ( !sName.isEmpty() )
1263  sName = _xReport->getName();
1264  if ( !sName.isEmpty() )
1266 }
1267 
1269 {
1271 }
1272 
1274 {
1275  GetPageExport()->exportMasterStyles( true );
1276 }
1277 
1279 {
1280  if ( m_bAllreadyFilled )
1281  return;
1282 
1283  m_bAllreadyFilled = true;
1284  Reference<XReportDefinition> xProp(getReportDefinition());
1285  if ( !xProp.is() )
1286  return;
1287 
1288  uno::Reference< report::XSection> xParent(xProp->getParent(),uno::UNO_QUERY);
1289  if ( xParent.is() )
1290  exportAutoStyle(xProp.get());
1291 
1292  if ( xProp->getReportHeaderOn() )
1293  exportSectionAutoStyle(xProp->getReportHeader());
1294  if ( xProp->getPageHeaderOn() )
1295  exportSectionAutoStyle(xProp->getPageHeader());
1296 
1297  exportGroup(xProp,0,true);
1298 
1299  if ( xProp->getPageFooterOn() )
1300  exportSectionAutoStyle(xProp->getPageFooter());
1301  if ( xProp->getReportFooterOn() )
1302  exportSectionAutoStyle(xProp->getReportFooter());
1303 }
1304 
1306 {
1307  // there are no styles that require their own autostyles
1308  if ( getExportFlags() & SvXMLExportFlags::CONTENT )
1309  {
1311  GetAutoStylePool()->exportXML(XmlStyleFamily::TABLE_TABLE);
1312  GetAutoStylePool()->exportXML(XmlStyleFamily::TABLE_COLUMN);
1313  GetAutoStylePool()->exportXML(XmlStyleFamily::TABLE_ROW);
1314  GetAutoStylePool()->exportXML(XmlStyleFamily::TABLE_CELL);
1315  exportDataStyles();
1316  GetShapeExport()->exportAutoStyles();
1317  }
1318  // exported in _ExportMasterStyles
1319  if( getExportFlags() & SvXMLExportFlags::MASTERSTYLES )
1320  GetPageExport()->collectAutoStyles( false );
1321  if( getExportFlags() & SvXMLExportFlags::MASTERSTYLES )
1322  GetPageExport()->exportAutoStyles();
1323 }
1324 
1326 {
1328 
1329  // write draw:style-name for object graphic-styles
1330  GetShapeExport()->ExportGraphicDefaults();
1331 }
1332 
1334 {
1335  return new OXMLAutoStylePoolP(*this);
1336 }
1337 
1338 void SAL_CALL ORptExport::setSourceDocument( const Reference< XComponent >& xDoc )
1339 {
1340  m_xReportDefinition.set(xDoc,UNO_QUERY_THROW);
1342 }
1343 
1345 {
1346  GetFontAutoStylePool(); // make sure the pool is created
1349 }
1350 
1351 void ORptExport::exportParagraph(const Reference< XReportControlModel >& _xReportElement)
1352 {
1353  OSL_PRECOND(_xReportElement.is(),"Element is null!");
1354  // start <text:p>
1355  SvXMLElementExport aParagraphContent(*this,XML_NAMESPACE_TEXT, XML_P, false, false);
1356  if ( Reference<XFormattedField>(_xReportElement,uno::UNO_QUERY).is() )
1357  {
1358  OUString sFieldData = _xReportElement->getDataField();
1359  static const char s_sPageNumber[] = "PageNumber()";
1360  static const char s_sReportPrefix[] = "rpt:";
1361  sFieldData = sFieldData.copy(strlen(s_sReportPrefix));
1362  sal_Int32 nPageNumberIndex = sFieldData.indexOf(s_sPageNumber);
1363  if ( nPageNumberIndex != -1 )
1364  {
1365  sal_Int32 nIndex = 0;
1366  do
1367  {
1368  OUString sToken = sFieldData.getToken( 0, '&', nIndex );
1369  sToken = sToken.trim();
1370  if ( !sToken.isEmpty() )
1371  {
1372  if ( sToken == s_sPageNumber )
1373  {
1375  SvXMLElementExport aPageNumber(*this,XML_NAMESPACE_TEXT, XML_PAGE_NUMBER, false, false);
1376  Characters("1");
1377  }
1378  else if ( sToken == "PageCount()" )
1379  {
1380  SvXMLElementExport aPageNumber(*this,XML_NAMESPACE_TEXT, XML_PAGE_COUNT, false, false);
1381  Characters("1");
1382  }
1383  else
1384  {
1385 
1386  if ( sToken.startsWith("\"") && sToken.endsWith("\"") )
1387  sToken = sToken.copy(1,sToken.getLength()-2);
1388 
1389  bool bPrevCharIsSpace = false;
1390  GetTextParagraphExport()->exportCharacterData(sToken, bPrevCharIsSpace);
1391  }
1392  }
1393  }
1394  while ( nIndex >= 0 );
1395  }
1396  }
1397  Reference< XFixedText > xFT(_xReportElement,UNO_QUERY);
1398  if ( xFT.is() )
1399  {
1400  OUString sExpr = xFT->getLabel();
1401  bool bPrevCharIsSpace = false; // FIXME this looks quite broken - does the corresponding import filter do whitespace collapsing at all?
1402  GetTextParagraphExport()->exportCharacterData(sExpr, bPrevCharIsSpace);
1403  }
1404 }
1405 
1407 {
1409  return pShapeExport;
1410 }
1411 
1412 void ORptExport::exportShapes(const Reference< XSection>& _xSection,bool _bAddParagraph)
1413 {
1415  xShapeExport->seekShapes(_xSection);
1416  const sal_Int32 nCount = _xSection->getCount();
1417  ::std::unique_ptr<SvXMLElementExport> pParagraphContent;
1418  if ( _bAddParagraph )
1419  pParagraphContent.reset(new SvXMLElementExport(*this,XML_NAMESPACE_TEXT, XML_P, true, false));
1420 
1421  awt::Point aRefPoint;
1422  aRefPoint.X = rptui::getStyleProperty<sal_Int32>(_xSection->getReportDefinition(),PROPERTY_LEFTMARGIN);
1423  for (sal_Int32 i = 0; i < nCount; ++i)
1424  {
1425  uno::Reference< XShape > xShape(_xSection->getByIndex(i),uno::UNO_QUERY);
1426  if ( xShape.is() )
1427  {
1428  ::std::unique_ptr<SvXMLElementExport> pSubDocument;
1429  uno::Reference< frame::XModel> xModel(xShape->getPropertyValue("Model"),uno::UNO_QUERY);
1430  if ( xModel.is() ) // special handling for chart object
1431  {
1432  pSubDocument.reset(new SvXMLElementExport(*this,XML_NAMESPACE_REPORT, XML_SUB_DOCUMENT, false, false));
1433  exportMasterDetailFields(xShape);
1434  exportReportElement(xShape);
1435  }
1436 
1438  xShapeExport->exportShape(xShape, SEF_DEFAULT|XMLShapeExportFlags::NO_WS,&aRefPoint);
1439  }
1440  }
1441 }
1442 
1443 void ORptExport::exportGroupsExpressionAsFunction(const Reference< XGroups>& _xGroups)
1444 {
1445  if ( !_xGroups.is() )
1446  return;
1447 
1448  uno::Reference< XFunctions> xFunctions = _xGroups->getReportDefinition()->getFunctions();
1449  const sal_Int32 nCount = _xGroups->getCount();
1450  for (sal_Int32 i = 0; i < nCount; ++i)
1451  {
1452  uno::Reference< XGroup> xGroup(_xGroups->getByIndex(i),uno::UNO_QUERY_THROW);
1453  const ::sal_Int16 nGroupOn = xGroup->getGroupOn();
1454  if ( nGroupOn != report::GroupOn::DEFAULT )
1455  {
1456  uno::Reference< XFunction> xFunction = xFunctions->createFunction();
1457  OUString sFunction,sPrefix,sPostfix;
1458  OUString sExpression = xGroup->getExpression();
1459  OUString sFunctionName;
1460  OUString sInitialFormula;
1461  switch(nGroupOn)
1462  {
1463  case report::GroupOn::PREFIX_CHARACTERS:
1464  sFunction = "LEFT";
1465  sPrefix = ";" + OUString::number(xGroup->getGroupInterval());
1466  break;
1467  case report::GroupOn::YEAR:
1468  sFunction = "YEAR";
1469  break;
1470  case report::GroupOn::QUARTAL:
1471  sFunction = "INT((MONTH";
1472  sPostfix = "-1)/3)+1";
1473  sFunctionName = "QUARTAL_" + sExpression;
1474  break;
1475  case report::GroupOn::MONTH:
1476  sFunction = "MONTH";
1477  break;
1478  case report::GroupOn::WEEK:
1479  sFunction = "WEEK";
1480  break;
1481  case report::GroupOn::DAY:
1482  sFunction = "DAY";
1483  break;
1484  case report::GroupOn::HOUR:
1485  sFunction = "HOUR";
1486  break;
1487  case report::GroupOn::MINUTE:
1488  sFunction = "MINUTE";
1489  break;
1490  case report::GroupOn::INTERVAL:
1491  {
1492  sFunction = "INT";
1493  uno::Reference< XFunction> xCountFunction = xFunctions->createFunction();
1494  xCountFunction->setInitialFormula(beans::Optional< OUString>(true,OUString("rpt:0")));
1495  OUString sCountName = sFunction + "_count_" + sExpression;
1496  xCountFunction->setName(sCountName);
1497  xCountFunction->setFormula( "rpt:[" + sCountName + "] + 1" );
1498  exportFunction(xCountFunction);
1499  sExpression = sCountName;
1500  // The reference to sCountName in the formula of sFunctionName refers to the *old* value
1501  // so we need to expand the formula of sCountName
1502  sPrefix = " + 1) / " + OUString::number(xGroup->getGroupInterval());
1503  sFunctionName = sFunction + "_" + sExpression;
1504  sFunction += "(";
1505  sInitialFormula = "rpt:0";
1506  }
1507  break;
1508  default:
1509  ;
1510  }
1511  if ( sFunctionName.isEmpty() )
1512  sFunctionName = sFunction + "_" + sExpression;
1513  if ( !sFunction.isEmpty() )
1514  {
1515  const sal_Unicode pReplaceChars[] = { '(',')',';',',','+','-','[',']','/','*'};
1516  for(sal_Unicode ch : pReplaceChars)
1517  sFunctionName = sFunctionName.replace(ch,'_');
1518 
1519  xFunction->setName(sFunctionName);
1520  if ( !sInitialFormula.isEmpty() )
1521  xFunction->setInitialFormula(beans::Optional< OUString>(true, sInitialFormula));
1522  sFunction = "rpt:" + sFunction + "([" + sExpression + "]";
1523 
1524  if ( !sPrefix.isEmpty() )
1525  sFunction += sPrefix;
1526  sFunction += ")";
1527  if ( !sPostfix.isEmpty() )
1528  sFunction += sPostfix;
1529  xFunction->setFormula(sFunction);
1530  exportFunction(xFunction);
1531  m_aGroupFunctionMap.emplace(xGroup,xFunction);
1532  }
1533  }
1534  }
1535 }
1536 
1537 
1538 }// rptxml
1539 
1540 
1541 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
XML_GROUP
#define XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_NAME
XML_KEEP_TOGETHER
XML_PAGE_PRINT_OPTION
#define PROPERTY_BORDERLEFT
Definition: strings.hxx:282
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:1278
XML_NUMBER_COLUMNS_SPANNED
XML_REPORT_ELEMENT
virtual void ExportStyles_(bool bUsed) override
Definition: xmlExport.cxx:1325
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:745
#define PROPERTY_RIGHTMARGIN
Definition: strings.hxx:105
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:998
XML_COMMAND_TYPE
#define SERVICE_IMAGECONTROL
Definition: strings.hxx:24
XML_N_OOO
XML_N_DRAW
TPropertyStyleMap m_aAutoStyleNames
Definition: xmlExport.hxx:87
rtl::Reference< SvXMLExportPropertyMapper > m_xRowStylesExportPropertySetMapper
Definition: xmlExport.hxx:97
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:1333
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:107
XML_N_STYLE
#define XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_PREFIX
XML_PAGE_NUMBER
void exportAutoStyle(XPropertySet *_xProp, const Reference< XFormattedField > &_xParentFormattedField=Reference< XFormattedField >())
Definition: xmlExport.cxx:1098
constexpr sal_uInt16 XML_NAMESPACE_XLINK
XML_SELECT_PAGE
static const SvXMLEnumMapEntry< sal_Int16 > * GetForceNewPageOptions()
Definition: xmlHelper.cxx:198
constexpr sal_uInt16 XML_NAMESPACE_OOO
XML_FORMAT_CONDITION
static const XMLPropertyMapEntry * GetRowStyleProps()
Definition: xmlHelper.cxx:165
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:1338
#define DEFAULT_LINE_WIDTH
Definition: xmlExport.cxx:49
constexpr sal_uInt16 XML_NAMESPACE_NUMBER
TGroupFunctionMap m_aGroupFunctionMap
Definition: xmlExport.hxx:90
XML_GROUP_FOOTER
XML_NUMBER_ROWS_SPANNED
virtual void ExportStyles_(bool bUsed)
XML_PRESERVE_IRI
#define XML_STYLE_FAMILY_TABLE_CELL_STYLES_PREFIX
#define PROPERTY_BORDERRIGHT
Definition: strings.hxx:283
SvXMLAttributeList & GetAttrList()
XmlStyleFamily
sal_uInt16 sal_Unicode
XML_MASTER_DETAIL_FIELD
XML_FORMATTED_TEXT
void SetCoreMeasureUnit(sal_Int16 const eCoreMeasureUnit)
XML_FORMULA
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:104
XML_SORT_EXPRESSION
XML_IMAGE_DATA
static OUString convertFormula(const OUString &_sFormula)
Definition: xmlExport.cxx:978
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:1273
XML_N_RPT
constexpr sal_uInt16 XML_NAMESPACE_FORM
XML_CAPTION
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: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
#define XML_STYLE_FAMILY_TABLE_CELL_STYLES_NAME
XML_NP_XHTML
constexpr sal_uInt16 XML_NAMESPACE_DRAW
static const SvXMLEnumMapEntry< sal_Int32 > * GetCommandTypeOptions()
Definition: xmlHelper.cxx:221
const char * sName
void exportParagraph(const Reference< XReportControlModel > &_xReportElement)
Definition: xmlExport.cxx:1351
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
XML_TABLE_ROW
constexpr sal_uInt16 XML_NAMESPACE_SVG
#define SERVICE_FORMATTEDFIELD
Definition: strings.hxx:23
virtual XMLShapeExport * CreateShapeExport() override
Definition: xmlExport.cxx:1406
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:1412
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
#define XML_STYLE_FAMILY_TABLE_TABLE_STYLES_PREFIX
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:107
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:370
XML_SORT_ASCENDING
virtual void ExportContent_() override
Definition: xmlExport.cxx:1268
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:986
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:1305
sal_Int16 GetCellType(const sal_Int32 nNumberFormat, OUString &sCurrency, bool &bIsStandard)
SvXMLNamespaceMap & GetNamespaceMap_()
static const XMLPropertyMapEntry * GetTableStyleProps()
Definition: xmlHelper.cxx:154
XML_PAGE_FOOTER
#define PROPERTY_BORDERTOP
Definition: strings.hxx:284
const OUString & GetXMLToken(enum XMLTokenEnum eToken)
rtl::Reference< SvXMLAutoStylePoolP > const & GetAutoStylePool()
#define PROPERTY_BORDERBOTTOM
Definition: strings.hxx:285
constexpr sal_uInt16 XML_NAMESPACE_REPORT
rtl::Reference< XMLFontAutoStylePool > const & GetFontAutoStylePool()
virtual void ExportFontDecls_() override
Definition: xmlExport.cxx:1344
void Characters(const OUString &rChars)
#define XML_STYLE_FAMILY_TABLE_ROW_STYLES_PREFIX
XML_MASTER
void exportTableColumns(const Reference< XSection > &_xSection)
Definition: xmlExport.cxx:730
::std::vector< ::std::pair< bool, TRow > > TGrid
Definition: xmlExport.hxx:81
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:210
XML_STYLE_NAME
XML_IMAGE
XML_SUB_DOCUMENT
XML_N_SVG_COMPAT
#define XML_STYLE_FAMILY_TABLE_ROW_STYLES_NAME
ORptExport(const Reference< XComponentContext > &_rxContext, OUString const &implementationName, SvXMLExportFlags nExportFlag)
Definition: xmlExport.cxx:180
void exportGroupsExpressionAsFunction(const Reference< XGroups > &_xGroups)
Definition: xmlExport.cxx:1443
XML_REPORT_FOOTER
rtl::Reference< XMLPageExport > const & GetPageExport()
XML_FIXED_CONTENT
void exportGroup(const Reference< XReportDefinition > &_xReportDefinition, sal_Int32 _nPos, bool _bExportAutoStyle=false)
Definition: xmlExport.cxx:1010
static SvXMLExportPropertyMapper * CreateShapeExtPropMapper(SvXMLExport &rExport)
#define XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME
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
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
void exportReportAttributes(const Reference< XReportDefinition > &_xReport)
Definition: xmlExport.cxx:1236
XMLTokenEnum eToken
XML_NP_OFFICE
XML_PAGE_COUNT
XML_VISIBLE
void exportSection(const Reference< XSection > &_xProp, bool bHeader=false)
Definition: xmlExport.cxx:692
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:1230
#define SERVICE_FIXEDTEXT
Definition: strings.hxx:22
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
XML_N_FORM
void exportReportComponentAutoStyles(const Reference< XSection > &_xProp)
Definition: xmlExport.cxx:653