LibreOffice Module sdext (master)  1
drawtreevisiting.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 
21 #include <pdfiprocessor.hxx>
22 #include <xmlemitter.hxx>
23 #include <pdfihelper.hxx>
24 #include <imagecontainer.hxx>
25 #include "style.hxx"
26 #include "drawtreevisiting.hxx"
27 #include <genericelements.hxx>
28 
30 #include <osl/diagnose.h>
31 #include <rtl/math.hxx>
32 #include <com/sun/star/i18n/BreakIterator.hpp>
33 #include <com/sun/star/i18n/CharacterClassification.hpp>
34 #include <com/sun/star/i18n/ScriptType.hpp>
35 #include <com/sun/star/i18n/DirectionProperty.hpp>
36 
37 #include <string.h>
38 
39 using namespace ::com::sun::star;
40 using namespace ::com::sun::star::lang;
41 using namespace ::com::sun::star::i18n;
42 using namespace ::com::sun::star::uno;
43 
44 namespace pdfi
45 {
46 
47 const Reference< XBreakIterator >& DrawXmlOptimizer::GetBreakIterator()
48 {
49  if ( !mxBreakIter.is() )
50  {
51  Reference< XComponentContext > xContext( m_rProcessor.m_xContext, uno::UNO_SET_THROW );
52  mxBreakIter = BreakIterator::create(xContext);
53  }
54  return mxBreakIter;
55 }
56 
57 const Reference< XCharacterClassification >& DrawXmlEmitter::GetCharacterClassification()
58 {
59  if ( !mxCharClass.is() )
60  {
61  Reference< XComponentContext > xContext( m_rEmitContext.m_xContext, uno::UNO_SET_THROW );
62  mxCharClass = CharacterClassification::create(xContext);
63  }
64  return mxCharClass;
65 }
66 
67 void DrawXmlEmitter::visit( HyperlinkElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
68 {
69  if( elem.Children.empty() )
70  return;
71 
72  const char* pType = dynamic_cast<DrawElement*>(elem.Children.front().get()) ? "draw:a" : "text:a";
73 
74  PropertyMap aProps;
75  aProps[ "xlink:type" ] = "simple";
76  aProps[ "xlink:href" ] = elem.URI;
77  aProps[ "office:target-frame-name" ] = "_blank";
78  aProps[ "xlink:show" ] = "new";
79 
80  m_rEmitContext.rEmitter.beginTag( pType, aProps );
81  auto this_it = elem.Children.begin();
82  while( this_it != elem.Children.end() && this_it->get() != &elem )
83  {
84  (*this_it)->visitedBy( *this, this_it );
85  ++this_it;
86  }
88 }
89 
90 void DrawXmlEmitter::visit( TextElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
91 {
92  if( elem.Text.isEmpty() )
93  return;
94 
95  OUString strSpace(u' ');
96  OUString strNbSpace(u'\x00A0');
97  OUString tabSpace(u'\x0009');
98  PropertyMap aProps;
99  if( elem.StyleId != -1 )
100  {
101  aProps[ OUString( "text:style-name" ) ] =
103  }
104 
105  OUString str(elem.Text.getStr());
106 
107  // Check for RTL
108  bool isRTL = false;
110  if( xCC.is() )
111  {
112  for(int i=1; i< elem.Text.getLength(); i++)
113  {
114  css::i18n::DirectionProperty nType = static_cast<css::i18n::DirectionProperty>(xCC->getCharacterDirection( str, i ));
115  if ( nType == css::i18n::DirectionProperty_RIGHT_TO_LEFT ||
116  nType == css::i18n::DirectionProperty_RIGHT_TO_LEFT_ARABIC ||
117  nType == css::i18n::DirectionProperty_RIGHT_TO_LEFT_EMBEDDING ||
118  nType == css::i18n::DirectionProperty_RIGHT_TO_LEFT_OVERRIDE
119  )
120  isRTL = true;
121  }
122  }
123 
124  if (isRTL) // If so, reverse string
125  str = PDFIProcessor::mirrorString( str );
126 
127  m_rEmitContext.rEmitter.beginTag( "text:span", aProps );
128 
129  for(int i=0; i< elem.Text.getLength(); i++)
130  {
131  OUString strToken= str.copy(i,1) ;
132  if( strSpace == strToken || strNbSpace == strToken )
133  {
134  aProps[ "text:c" ] = "1";
135  m_rEmitContext.rEmitter.beginTag( "text:s", aProps );
136  m_rEmitContext.rEmitter.endTag( "text:s");
137  }
138  else
139  {
140  if( tabSpace == strToken )
141  {
142  m_rEmitContext.rEmitter.beginTag( "text:tab", aProps );
143  m_rEmitContext.rEmitter.endTag( "text:tab");
144  }
145  else
146  {
147  m_rEmitContext.rEmitter.write( strToken );
148  }
149  }
150  }
151 
152  auto this_it = elem.Children.begin();
153  while( this_it != elem.Children.end() && this_it->get() != &elem )
154  {
155  (*this_it)->visitedBy( *this, this_it );
156  ++this_it;
157  }
158 
159  m_rEmitContext.rEmitter.endTag( "text:span" );
160 }
161 
162 void DrawXmlEmitter::visit( ParagraphElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
163 {
164  PropertyMap aProps;
165  if( elem.StyleId != -1 )
166  {
167  aProps[ "text:style-name" ] = m_rEmitContext.rStyles.getStyleName( elem.StyleId );
168  }
169  const char* pTagType = "text:p";
170  if( elem.Type == ParagraphElement::Headline )
171  pTagType = "text:h";
172  m_rEmitContext.rEmitter.beginTag( pTagType, aProps );
173 
174  auto this_it = elem.Children.begin();
175  while( this_it != elem.Children.end() && this_it->get() != &elem )
176  {
177  (*this_it)->visitedBy( *this, this_it );
178  ++this_it;
179  }
180 
181  m_rEmitContext.rEmitter.endTag( pTagType );
182 }
183 
185  PropertyMap& rProps,
186  const EmitContext& rEmitContext,
187  bool bWasTransformed
188  )
189 {
190  rProps[ "draw:z-index" ] = OUString::number( rElem.ZOrder );
191  rProps[ "draw:style-name"] = rEmitContext.rStyles.getStyleName( rElem.StyleId );
192 
193  if (rElem.IsForText)
194  rProps["draw:text-style-name"] = rEmitContext.rStyles.getStyleName(rElem.TextStyleId);
195 
196  const GraphicsContext& rGC =
197  rEmitContext.rProcessor.getGraphicsContext( rElem.GCId );
198 
199  if (bWasTransformed)
200  {
201  rProps[ "svg:x" ] = convertPixelToUnitString(rElem.x);
202  rProps[ "svg:y" ] = convertPixelToUnitString(rElem.y);
203  rProps[ "svg:width" ] = convertPixelToUnitString(rElem.w);
204  rProps[ "svg:height" ] = convertPixelToUnitString(rElem.h);
205  }
206  else
207  {
208  OUStringBuffer aBuf(256);
209 
211 
212  if (rElem.MirrorVertical)
213  {
215  mat2.translate(0, -0.5);
216  mat2.scale(1, -1);
217  mat2.translate(0, 0.5);
218  mat = mat * mat2;
219  }
220 
221  double scale = convPx2mm(100);
222  mat.scale(scale, scale);
223 
224  aBuf.append("matrix(");
225  aBuf.append(mat.get(0, 0));
226  aBuf.append(' ');
227  aBuf.append(mat.get(1, 0));
228  aBuf.append(' ');
229  aBuf.append(mat.get(0, 1));
230  aBuf.append(' ');
231  aBuf.append(mat.get(1, 1));
232  aBuf.append(' ');
233  aBuf.append(mat.get(0, 2));
234  aBuf.append(' ');
235  aBuf.append(mat.get(1, 2));
236  aBuf.append(")");
237 
238  rProps["draw:transform"] = aBuf.makeStringAndClear();
239  }
240 }
241 
242 void DrawXmlEmitter::visit( FrameElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
243 {
244  if( elem.Children.empty() )
245  return;
246 
247  bool bTextBox = (dynamic_cast<ParagraphElement*>(elem.Children.front().get()) != nullptr);
248  PropertyMap aFrameProps;
249  fillFrameProps( elem, aFrameProps, m_rEmitContext, false );
250  m_rEmitContext.rEmitter.beginTag( "draw:frame", aFrameProps );
251  if( bTextBox )
252  m_rEmitContext.rEmitter.beginTag( "draw:text-box", PropertyMap() );
253 
254  auto this_it = elem.Children.begin();
255  while( this_it != elem.Children.end() && this_it->get() != &elem )
256  {
257  (*this_it)->visitedBy( *this, this_it );
258  ++this_it;
259  }
260 
261  if( bTextBox )
262  m_rEmitContext.rEmitter.endTag( "draw:text-box" );
263  m_rEmitContext.rEmitter.endTag( "draw:frame" );
264 }
265 
266 void DrawXmlEmitter::visit( PolyPolyElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
267 {
268  elem.updateGeometry();
269  /* note:
270  * aw recommends using 100dth of mm in all respects since the xml import
271  * (a) is buggy (see issue 37213)
272  * (b) is optimized for 100dth of mm and does not scale itself then,
273  * this does not gain us speed but makes for smaller rounding errors since
274  * the xml importer coordinates are integer based
275  */
276  for (sal_uInt32 i = 0; i< elem.PolyPoly.count(); i++)
277  {
278  basegfx::B2DPolygon b2dPolygon = elem.PolyPoly.getB2DPolygon( i );
279 
280  for ( sal_uInt32 j = 0; j< b2dPolygon.count(); j++ )
281  {
283  basegfx::B2DPoint nextPoint;
284  point = b2dPolygon.getB2DPoint( j );
285 
286  basegfx::B2DPoint prevPoint = b2dPolygon.getPrevControlPoint( j ) ;
287 
288  point.setX( convPx2mmPrec2( point.getX() )*100.0 );
289  point.setY( convPx2mmPrec2( point.getY() )*100.0 );
290 
291  if ( b2dPolygon.isPrevControlPointUsed( j ) )
292  {
293  prevPoint.setX( convPx2mmPrec2( prevPoint.getX() )*100.0 );
294  prevPoint.setY( convPx2mmPrec2( prevPoint.getY() )*100.0 );
295  }
296 
297  if ( b2dPolygon.isNextControlPointUsed( j ) )
298  {
299  nextPoint = b2dPolygon.getNextControlPoint( j ) ;
300  nextPoint.setX( convPx2mmPrec2( nextPoint.getX() )*100.0 );
301  nextPoint.setY( convPx2mmPrec2( nextPoint.getY() )*100.0 );
302  }
303 
304  b2dPolygon.setB2DPoint( j, point );
305 
306  if ( b2dPolygon.isPrevControlPointUsed( j ) )
307  b2dPolygon.setPrevControlPoint( j , prevPoint ) ;
308 
309  if ( b2dPolygon.isNextControlPointUsed( j ) )
310  b2dPolygon.setNextControlPoint( j , nextPoint ) ;
311  }
312 
313  elem.PolyPoly.setB2DPolygon( i, b2dPolygon );
314  }
315 
316  PropertyMap aProps;
317  // PDFIProcessor transforms geometrical objects, not images and text
318  // so we need to tell fillFrameProps here that the transformation for
319  // a PolyPolyElement was already applied (aside from translation)
320  fillFrameProps( elem, aProps, m_rEmitContext, true );
321  OUStringBuffer aBuf( 64 );
322  aBuf.append( "0 0 " );
323  aBuf.append( convPx2mmPrec2(elem.w)*100.0 );
324  aBuf.append( ' ' );
325  aBuf.append( convPx2mmPrec2(elem.h)*100.0 );
326  aProps[ "svg:viewBox" ] = aBuf.makeStringAndClear();
327  aProps[ "svg:d" ] = basegfx::utils::exportToSvgD( elem.PolyPoly, false, true, false );
328 
329  m_rEmitContext.rEmitter.beginTag( "draw:path", aProps );
330  m_rEmitContext.rEmitter.endTag( "draw:path" );
331 }
332 
333 void DrawXmlEmitter::visit( ImageElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
334 {
335  PropertyMap aImageProps;
336  m_rEmitContext.rEmitter.beginTag( "draw:image", aImageProps );
337  m_rEmitContext.rEmitter.beginTag( "office:binary-data", PropertyMap() );
339  m_rEmitContext.rEmitter.endTag( "office:binary-data" );
340  m_rEmitContext.rEmitter.endTag( "draw:image" );
341 }
342 
343 void DrawXmlEmitter::visit( PageElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
344 {
345  PropertyMap aPageProps;
346  aPageProps[ "draw:master-page-name" ] = m_rEmitContext.rStyles.getStyleName( elem.StyleId );
347 
348  m_rEmitContext.rEmitter.beginTag("draw:page", aPageProps);
349 
351  m_rEmitContext.xStatusIndicator->setValue( elem.PageNumber );
352 
353  auto this_it = elem.Children.begin();
354  while( this_it != elem.Children.end() && this_it->get() != &elem )
355  {
356  (*this_it)->visitedBy( *this, this_it );
357  ++this_it;
358  }
359 
360  m_rEmitContext.rEmitter.endTag("draw:page");
361 }
362 
363 void DrawXmlEmitter::visit( DocumentElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator&)
364 {
365  m_rEmitContext.rEmitter.beginTag( "office:body", PropertyMap() );
366  m_rEmitContext.rEmitter.beginTag( m_bWriteDrawDocument ? "office:drawing" : "office:presentation",
367  PropertyMap() );
368 
369  auto this_it = elem.Children.begin();
370  while( this_it != elem.Children.end() && this_it->get() != &elem )
371  {
372  (*this_it)->visitedBy( *this, this_it );
373  ++this_it;
374  }
375 
376  m_rEmitContext.rEmitter.endTag( m_bWriteDrawDocument ? "office:drawing" : "office:presentation" );
377  m_rEmitContext.rEmitter.endTag( "office:body" );
378 }
379 
380 
381 void DrawXmlOptimizer::visit( HyperlinkElement&, const std::list< std::unique_ptr<Element> >::const_iterator& )
382 {
383 }
384 
385 void DrawXmlOptimizer::visit( TextElement&, const std::list< std::unique_ptr<Element> >::const_iterator&)
386 {
387 }
388 
389 void DrawXmlOptimizer::visit( FrameElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
390 {
391  elem.applyToChildren(*this);
392 }
393 
394 void DrawXmlOptimizer::visit( ImageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& )
395 {
396 }
397 
398 void DrawXmlOptimizer::visit( PolyPolyElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& elemIt )
399 {
400  /* note: optimize two consecutive PolyPolyElements that
401  * have the same path but one of which is a stroke while
402  * the other is a fill
403  */
404  if( !elem.Parent )
405  return;
406 
407  // find following PolyPolyElement in parent's children list
408  if( elemIt == elem.Parent->Children.end() )
409  return;
410  auto next_it = elemIt;
411  ++next_it;
412  if( next_it == elem.Parent->Children.end() )
413  return;
414 
415  PolyPolyElement* pNext = dynamic_cast<PolyPolyElement*>(next_it->get());
416  // TODO(F2): this comparison fails for OOo-generated polygons with beziers.
417  if( !pNext || pNext->PolyPoly != elem.PolyPoly )
418  return;
419 
420  const GraphicsContext& rNextGC =
422  const GraphicsContext& rThisGC =
424 
425  if( !(rThisGC.BlendMode == rNextGC.BlendMode &&
426  rThisGC.Flatness == rNextGC.Flatness &&
427  rThisGC.Transformation == rNextGC.Transformation &&
428  rThisGC.Clip == rNextGC.Clip &&
429  rThisGC.FillColor.Red == rNextGC.FillColor.Red &&
430  rThisGC.FillColor.Green== rNextGC.FillColor.Green &&
431  rThisGC.FillColor.Blue == rNextGC.FillColor.Blue &&
432  rThisGC.FillColor.Alpha== rNextGC.FillColor.Alpha &&
433  pNext->Action == PATH_STROKE &&
434  (elem.Action == PATH_FILL || elem.Action == PATH_EOFILL)) )
435  return;
436 
437  GraphicsContext aGC = rThisGC;
438  aGC.LineJoin = rNextGC.LineJoin;
439  aGC.LineCap = rNextGC.LineCap;
440  aGC.LineWidth = rNextGC.LineWidth;
441  aGC.MiterLimit= rNextGC.MiterLimit;
442  aGC.DashArray = rNextGC.DashArray;
443  aGC.LineColor = rNextGC.LineColor;
444  elem.GCId = m_rProcessor.getGCId( aGC );
445 
446  elem.Action |= pNext->Action;
447 
448  elem.Children.splice( elem.Children.end(), pNext->Children );
449  elem.Parent->Children.erase(next_it);
450 }
451 
452 void DrawXmlOptimizer::visit( ParagraphElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
453 {
454  optimizeTextElements( elem );
455 
456  elem.applyToChildren(*this);
457 }
458 
459 void DrawXmlOptimizer::visit( PageElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
460 {
461  if( m_rProcessor.getStatusIndicator().is() )
462  m_rProcessor.getStatusIndicator()->setValue( elem.PageNumber );
463 
464  // resolve hyperlinks
465  elem.resolveHyperlinks();
466 
467  elem.resolveFontStyles( m_rProcessor ); // underlines and such
468 
469  // FIXME: until hyperlinks and font effects are adjusted for
470  // geometrical search handle them before sorting
472 
473  // find paragraphs in text
474  ParagraphElement* pCurPara = nullptr;
475  std::list< std::unique_ptr<Element> >::iterator page_element, next_page_element;
476  next_page_element = elem.Children.begin();
477  double fCurLineHeight = 0.0; // average height of text items in current para
478  int nCurLineElements = 0; // number of line contributing elements in current para
479  double line_left = elem.w, line_right = 0.0;
480  double column_width = elem.w*0.75; // estimate text width
481  // TODO: guess columns
482  while( next_page_element != elem.Children.end() )
483  {
484  page_element = next_page_element++;
485  ParagraphElement* pPagePara = dynamic_cast<ParagraphElement*>(page_element->get());
486  if( pPagePara )
487  {
488  pCurPara = pPagePara;
489  // adjust line height and text items
490  fCurLineHeight = 0.0;
491  nCurLineElements = 0;
492  for( const auto& rxChild : pCurPara->Children )
493  {
494  TextElement* pTestText = dynamic_cast<TextElement*>(rxChild.get());
495  if( pTestText )
496  {
497  fCurLineHeight = (fCurLineHeight*double(nCurLineElements) + pTestText->h)/double(nCurLineElements+1);
498  nCurLineElements++;
499  }
500  }
501  continue;
502  }
503 
504  HyperlinkElement* pLink = dynamic_cast<HyperlinkElement*>(page_element->get());
505  DrawElement* pDraw = dynamic_cast<DrawElement*>(page_element->get());
506  if( ! pDraw && pLink && ! pLink->Children.empty() )
507  pDraw = dynamic_cast<DrawElement*>(pLink->Children.front().get() );
508  if( pDraw )
509  {
510  // insert small drawing objects as character, else leave them page bound
511 
512  bool bInsertToParagraph = false;
513  // first check if this is either inside the paragraph
514  if( pCurPara && pDraw->y < pCurPara->y + pCurPara->h )
515  {
516  if( pDraw->h < fCurLineHeight * 1.5 )
517  {
518  bInsertToParagraph = true;
519  fCurLineHeight = (fCurLineHeight*double(nCurLineElements) + pDraw->h)/double(nCurLineElements+1);
520  nCurLineElements++;
521  // mark draw element as character
522  pDraw->isCharacter = true;
523  }
524  }
525  // or perhaps the draw element begins a new paragraph
526  else if( next_page_element != elem.Children.end() )
527  {
528  TextElement* pText = dynamic_cast<TextElement*>(next_page_element->get());
529  if( ! pText )
530  {
531  ParagraphElement* pPara = dynamic_cast<ParagraphElement*>(next_page_element->get());
532  if( pPara && ! pPara->Children.empty() )
533  pText = dynamic_cast<TextElement*>(pPara->Children.front().get());
534  }
535  if( pText && // check there is a text
536  pDraw->h < pText->h*1.5 && // and it is approx the same height
537  // and either upper or lower edge of pDraw is inside text's vertical range
538  ( ( pDraw->y >= pText->y && pDraw->y <= pText->y+pText->h ) ||
539  ( pDraw->y+pDraw->h >= pText->y && pDraw->y+pDraw->h <= pText->y+pText->h )
540  )
541  )
542  {
543  bInsertToParagraph = true;
544  fCurLineHeight = pDraw->h;
545  nCurLineElements = 1;
546  line_left = pDraw->x;
547  line_right = pDraw->x + pDraw->w;
548  // begin a new paragraph
549  pCurPara = nullptr;
550  // mark draw element as character
551  pDraw->isCharacter = true;
552  }
553  }
554 
555  if( ! bInsertToParagraph )
556  {
557  pCurPara = nullptr;
558  continue;
559  }
560  }
561 
562  TextElement* pText = dynamic_cast<TextElement*>(page_element->get());
563  if( ! pText && pLink && ! pLink->Children.empty() )
564  pText = dynamic_cast<TextElement*>(pLink->Children.front().get());
565  if( pText )
566  {
567  Element* pGeo = pLink ? static_cast<Element*>(pLink) :
568  static_cast<Element*>(pText);
569  if( pCurPara )
570  {
571  // there was already a text element, check for a new paragraph
572  if( nCurLineElements > 0 )
573  {
574  // if the new text is significantly distant from the paragraph
575  // begin a new paragraph
576  if( pGeo->y > pCurPara->y + pCurPara->h + fCurLineHeight*0.5 )
577  pCurPara = nullptr; // insert new paragraph
578  else if( pGeo->y > (pCurPara->y+pCurPara->h - fCurLineHeight*0.05) )
579  {
580  // new paragraph if either the last line of the paragraph
581  // was significantly shorter than the paragraph as a whole
582  if( (line_right - line_left) < pCurPara->w*0.75 )
583  pCurPara = nullptr;
584  // or the last line was significantly smaller than the column width
585  else if( (line_right - line_left) < column_width*0.75 )
586  pCurPara = nullptr;
587  }
588  }
589 
590 
591  }
592 
593 
594  // update line height/width
595  if( pCurPara )
596  {
597  fCurLineHeight = (fCurLineHeight*double(nCurLineElements) + pGeo->h)/double(nCurLineElements+1);
598  nCurLineElements++;
599  if( pGeo->x < line_left )
600  line_left = pGeo->x;
601  if( pGeo->x+pGeo->w > line_right )
602  line_right = pGeo->x+pGeo->w;
603  }
604  else
605  {
606  fCurLineHeight = pGeo->h;
607  nCurLineElements = 1;
608  line_left = pGeo->x;
609  line_right = pGeo->x + pGeo->w;
610  }
611  }
612 
613 
614  // move element to current paragraph
615  if (! pCurPara ) // new paragraph, insert one
616  {
617  pCurPara = ElementFactory::createParagraphElement( nullptr );
618  // set parent
619  pCurPara->Parent = &elem;
620  //insert new paragraph before current element
621  page_element = elem.Children.insert( page_element, std::unique_ptr<Element>(pCurPara) );
622  // forward iterator to current element again
623  ++ page_element;
624  // update next_element which is now invalid
625  next_page_element = page_element;
626  ++ next_page_element;
627  }
628  Element* pCurEle = page_element->get();
629  Element::setParent( page_element, pCurPara );
630  OSL_ENSURE( !pText || pCurEle == pText || pCurEle == pLink, "paragraph child list in disorder" );
631  if( pText || pDraw )
632  pCurPara->updateGeometryWith( pCurEle );
633  }
634 
635  // process children
636  elem.applyToChildren(*this);
637 }
638 
639 static bool isSpaces(TextElement* pTextElem)
640 {
641  for (sal_Int32 i = 0; i != pTextElem->Text.getLength(); ++i) {
642  if (pTextElem->Text[i] != ' ') {
643  return false;
644  }
645  }
646  return true;
647 }
648 
649 static bool notTransformed(const GraphicsContext& GC)
650 {
651  return
652  rtl::math::approxEqual(GC.Transformation.get(0,0), 100.00) &&
653  GC.Transformation.get(1,0) == 0.00 &&
654  GC.Transformation.get(0,1) == 0.00 &&
655  rtl::math::approxEqual(GC.Transformation.get(1,1), -100.00);
656 }
657 
659 {
660  if( rParent.Children.empty() ) // this should not happen
661  {
662  OSL_FAIL( "empty paragraph optimized" );
663  return;
664  }
665 
666  // concatenate child elements with same font id
667  auto next = rParent.Children.begin();
668  auto it = next++;
669 
670  while( next != rParent.Children.end() )
671  {
672  bool bConcat = false;
673  TextElement* pCur = dynamic_cast<TextElement*>(it->get());
674 
675  if( pCur )
676  {
677  TextElement* pNext = dynamic_cast<TextElement*>(next->get());
678  bool isComplex = false;
679  OUString str(pCur->Text.getStr());
680  for(int i=0; i< str.getLength(); i++)
681  {
682  sal_Int16 nType = GetBreakIterator()->getScriptType( str, i );
683  if (nType == css::i18n::ScriptType::COMPLEX)
684  isComplex = true;
685  }
686  bool bPara = strspn("ParagraphElement", typeid(rParent).name());
687  ParagraphElement* pPara = dynamic_cast<ParagraphElement*>(&rParent);
688  if (bPara && pPara && isComplex)
689  pPara->bRtl = true;
690  if( pNext )
691  {
692  const GraphicsContext& rCurGC = m_rProcessor.getGraphicsContext( pCur->GCId );
693  const GraphicsContext& rNextGC = m_rProcessor.getGraphicsContext( pNext->GCId );
694 
695  // line and space optimization; works only in strictly horizontal mode
696 
697  // concatenate consecutive text elements unless there is a
698  // font or text color or matrix change, leave a new span in that case
699  if( (pCur->FontId == pNext->FontId || isSpaces(pNext)) &&
700  rCurGC.FillColor.Red == rNextGC.FillColor.Red &&
701  rCurGC.FillColor.Green == rNextGC.FillColor.Green &&
702  rCurGC.FillColor.Blue == rNextGC.FillColor.Blue &&
703  rCurGC.FillColor.Alpha == rNextGC.FillColor.Alpha &&
704  (rCurGC.Transformation == rNextGC.Transformation || notTransformed(rNextGC))
705  )
706  {
707  pCur->updateGeometryWith( pNext );
708  // append text to current element
709  pCur->Text.append( pNext->Text );
710 
711  str = pCur->Text.getStr();
712  for(int i=0; i< str.getLength(); i++)
713  {
714  sal_Int16 nType = GetBreakIterator()->getScriptType( str, i );
715  if (nType == css::i18n::ScriptType::COMPLEX)
716  isComplex = true;
717  }
718  if (bPara && pPara && isComplex)
719  pPara->bRtl = true;
720  // append eventual children to current element
721  // and clear children (else the children just
722  // appended to pCur would be destroyed)
723  pCur->Children.splice( pCur->Children.end(), pNext->Children );
724  // get rid of the now useless element
725  rParent.Children.erase( next );
726  bConcat = true;
727  }
728  }
729  }
730  else if( dynamic_cast<HyperlinkElement*>(it->get()) )
731  optimizeTextElements( **it );
732  if ( bConcat )
733  next = it;
734  else
735  ++it;
736  ++next;
737  }
738 }
739 
740 void DrawXmlOptimizer::visit( DocumentElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator&)
741 {
742  elem.applyToChildren(*this);
743 }
744 
745 
746 void DrawXmlFinalizer::visit( PolyPolyElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
747 {
748  // xxx TODO copied from DrawElement
750 
751  PropertyMap aProps;
752  aProps[ "style:family" ] = "graphic";
753  aProps[ "style:parent-style-name" ] = "standard";
754  // generate standard graphic style if necessary
756 
757  PropertyMap aGCProps;
758  if (elem.Action & PATH_STROKE)
759  {
761  if (rGC.DashArray.size() < 2)
762  {
763  aGCProps[ "draw:stroke" ] = "solid";
764  }
765  else
766  {
768  FillDashStyleProps(props, rGC.DashArray, scale);
769  StyleContainer::Style style("draw:stroke-dash", props);
770 
771  aGCProps[ "draw:stroke" ] = "dash";
772  aGCProps[ "draw:stroke-dash" ] =
775  }
776 
777  aGCProps[ "svg:stroke-color" ] = getColorString(rGC.LineColor);
778  if (rGC.LineColor.Alpha != 1.0)
779  aGCProps["svg:stroke-opacity"] = getPercentString(rGC.LineColor.Alpha * 100.0);
780  aGCProps[ "svg:stroke-width" ] = convertPixelToUnitString(rGC.LineWidth * scale);
781  aGCProps[ "draw:stroke-linejoin" ] = rGC.GetLineJoinString();
782  aGCProps[ "svg:stroke-linecap" ] = rGC.GetLineCapString();
783  }
784  else
785  {
786  aGCProps[ "draw:stroke" ] = "none";
787  }
788 
789  // TODO(F1): check whether stuff could be emulated by gradient/bitmap/hatch
790  if( elem.Action & (PATH_FILL | PATH_EOFILL) )
791  {
792  aGCProps[ "draw:fill" ] = "solid";
793  aGCProps[ "draw:fill-color" ] = getColorString(rGC.FillColor);
794  if (rGC.FillColor.Alpha != 1.0)
795  aGCProps["draw:opacity"] = getPercentString(rGC.FillColor.Alpha * 100.0);
796  }
797  else
798  {
799  aGCProps[ "draw:fill" ] = "none";
800  }
801 
802  StyleContainer::Style aStyle( "style:style", aProps );
803  StyleContainer::Style aSubStyle( "style:graphic-properties", aGCProps );
804  aStyle.SubStyles.push_back( &aSubStyle );
805 
806  elem.StyleId = m_rStyleContainer.getStyleId( aStyle );
807 }
808 
809 void DrawXmlFinalizer::visit( HyperlinkElement&, const std::list< std::unique_ptr<Element> >::const_iterator& )
810 {
811 }
812 
813 static void SetFontsizeProperties(PropertyMap& props, double fontSize)
814 {
815  OUString aFSize = OUString::number(fontSize * 72 / PDFI_OUTDEV_RESOLUTION) + "pt";
816  props["fo:font-size"] = aFSize;
817  props["style:font-size-asian"] = aFSize;
818  props["style:font-size-complex"] = aFSize;
819 }
820 
821 void DrawXmlFinalizer::visit( TextElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
822 {
823  const FontAttributes& rFont = m_rProcessor.getFont( elem.FontId );
824  PropertyMap aProps;
825  aProps[ "style:family" ] = "text";
826 
827  PropertyMap aFontProps;
828 
829  // family name
830  aFontProps[ "fo:font-family" ] = rFont.familyName;
831  aFontProps[ "style:font-family-complex" ] = rFont.familyName;
832 
833  // bold
834  if( rFont.isBold )
835  {
836  aFontProps[ "fo:font-weight" ] = "bold";
837  aFontProps[ "fo:font-weight-asian" ] = "bold";
838  aFontProps[ "style:font-weight-complex" ] = "bold";
839  }
840  // italic
841  if( rFont.isItalic )
842  {
843  aFontProps[ "fo:font-style" ] = "italic";
844  aFontProps[ "fo:font-style-asian" ] = "italic";
845  aFontProps[ "style:font-style-complex" ] = "italic";
846  }
847  // underline
848  if( rFont.isUnderline )
849  {
850  aFontProps[ "style:text-underline-style" ] = "solid";
851  aFontProps[ "style:text-underline-width" ] = "auto";
852  aFontProps[ "style:text-underline-color" ] = "font-color";
853  }
854  // outline
855  if( rFont.isOutline )
856  {
857  aFontProps[ "style:text-outline" ] = "true";
858  }
859 
860  // size
861  SetFontsizeProperties(aFontProps, rFont.size);
862 
863  // color
865  aFontProps[ "fo:color" ] = getColorString( rFont.isOutline ? rGC.LineColor : rGC.FillColor );
866 
867  // scale
868  double fRotate, fShearX;
869  basegfx::B2DTuple aScale, aTranslation;
870  rGC.Transformation.decompose(aScale, aTranslation, fRotate, fShearX);
871  double textScale = 100 * aScale.getX() / aScale.getY();
872  if (((textScale >= 1) && (textScale <= 99)) ||
873  ((textScale >= 101) && (textScale <= 999)))
874  {
875  aFontProps[ "style:text-scale" ] = getPercentString(textScale);
876  }
877 
878  StyleContainer::Style aStyle( "style:style", aProps );
879  StyleContainer::Style aSubStyle( "style:text-properties", aFontProps );
880  aStyle.SubStyles.push_back( &aSubStyle );
881  elem.StyleId = m_rStyleContainer.getStyleId( aStyle );
882 }
883 
884 void DrawXmlFinalizer::visit( ParagraphElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
885 {
886 
887  PropertyMap aProps;
888  aProps[ "style:family" ] = "paragraph";
889  // generate standard paragraph style if necessary
890  m_rStyleContainer.getStandardStyleId( "paragraph" );
891 
892  PropertyMap aParProps;
893 
894  aParProps[ "fo:text-align"] = "start";
895  if (elem.bRtl)
896  aParProps[ "style:writing-mode"] = "rl-tb";
897  else
898  aParProps[ "style:writing-mode"] = "lr-tb";
899 
900  StyleContainer::Style aStyle( "style:style", aProps );
901  StyleContainer::Style aSubStyle( "style:paragraph-properties", aParProps );
902  aStyle.SubStyles.push_back( &aSubStyle );
903 
904  elem.StyleId = m_rStyleContainer.getStyleId( aStyle );
905 
906  elem.applyToChildren(*this);
907 }
908 
909 void DrawXmlFinalizer::visit( FrameElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator&)
910 {
911  PropertyMap props1;
912  props1[ "style:family" ] = "graphic";
913  props1[ "style:parent-style-name" ] = "standard";
914  // generate standard graphic style if necessary
916 
917  PropertyMap aGCProps;
918 
919  aGCProps[ "draw:stroke" ] = "none";
920  aGCProps[ "draw:fill" ] = "none";
921  aGCProps[ "draw:auto-grow-height" ] = "true";
922  aGCProps[ "draw:auto-grow-width" ] = "true";
923  aGCProps[ "draw:textarea-horizontal-align" ] = "left";
924  aGCProps[ "draw:textarea-vertical-align" ] = "top";
925  aGCProps[ "fo:min-height"] = "0cm";
926  aGCProps[ "fo:min-width"] = "0cm";
927  aGCProps[ "fo:padding-top" ] = "0cm";
928  aGCProps[ "fo:padding-left" ] = "0cm";
929  aGCProps[ "fo:padding-right" ] = "0cm";
930  aGCProps[ "fo:padding-bottom" ] = "0cm";
931 
932  StyleContainer::Style style1( "style:style", props1 );
933  StyleContainer::Style subStyle1( "style:graphic-properties", aGCProps );
934  style1.SubStyles.push_back(&subStyle1);
935 
936  elem.StyleId = m_rStyleContainer.getStyleId(style1);
937 
938  if (elem.IsForText)
939  {
940  PropertyMap props2;
941  props2["style:family"] = "paragraph";
942 
943  PropertyMap textProps;
944  SetFontsizeProperties(textProps, elem.FontSize);
945 
946  StyleContainer::Style style2("style:style", props2);
947  StyleContainer::Style subStyle2("style:text-properties", textProps);
948  style2.SubStyles.push_back(&subStyle2);
950  }
951 
952  elem.applyToChildren(*this);
953 }
954 
955 void DrawXmlFinalizer::visit( ImageElement&, const std::list< std::unique_ptr<Element> >::const_iterator& )
956 {
957 }
958 
959 void DrawXmlFinalizer::visit( PageElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
960 {
961  if( m_rProcessor.getStatusIndicator().is() )
962  m_rProcessor.getStatusIndicator()->setValue( elem.PageNumber );
963 
964  // transform from pixel to mm
965  double page_width = convPx2mm( elem.w ), page_height = convPx2mm( elem.h );
966 
967  // calculate page margins out of the relevant children (paragraphs)
968  elem.TopMargin = elem.h;
969  elem.BottomMargin = 0;
970  elem.LeftMargin = elem.w;
971  elem.RightMargin = 0;
972 
973  for( const auto& rxChild : elem.Children )
974  {
975  if( rxChild->x < elem.LeftMargin )
976  elem.LeftMargin = rxChild->x;
977  if( rxChild->y < elem.TopMargin )
978  elem.TopMargin = rxChild->y;
979  if( rxChild->x + rxChild->w > elem.RightMargin )
980  elem.RightMargin = (rxChild->x + rxChild->w);
981  if( rxChild->y + rxChild->h > elem.BottomMargin )
982  elem.BottomMargin = (rxChild->y + rxChild->h);
983  }
984 
985  // transform margins to mm
986  double left_margin = convPx2mm( elem.LeftMargin );
987  double right_margin = convPx2mm( elem.RightMargin );
988  double top_margin = convPx2mm( elem.TopMargin );
989  double bottom_margin = convPx2mm( elem.BottomMargin );
990 
991  // round left/top margin to nearest mm
992  left_margin = rtl_math_round( left_margin, 0, rtl_math_RoundingMode_Floor );
993  top_margin = rtl_math_round( top_margin, 0, rtl_math_RoundingMode_Floor );
994  // round (fuzzy) right/bottom margin to nearest cm
995  right_margin = rtl_math_round( right_margin, right_margin >= 10 ? -1 : 0, rtl_math_RoundingMode_Floor );
996  bottom_margin = rtl_math_round( bottom_margin, bottom_margin >= 10 ? -1 : 0, rtl_math_RoundingMode_Floor );
997 
998  // set reasonable default in case of way too large margins
999  // e.g. no paragraph case
1000  if( left_margin > page_width/2.0 - 10 )
1001  left_margin = 10;
1002  if( right_margin > page_width/2.0 - 10 )
1003  right_margin = 10;
1004  if( top_margin > page_height/2.0 - 10 )
1005  top_margin = 10;
1006  if( bottom_margin > page_height/2.0 - 10 )
1007  bottom_margin = 10;
1008 
1009  // catch the weird cases
1010  if( left_margin < 0 )
1011  left_margin = 0;
1012  if( right_margin < 0 )
1013  right_margin = 0;
1014  if( top_margin < 0 )
1015  top_margin = 0;
1016  if( bottom_margin < 0 )
1017  bottom_margin = 0;
1018 
1019  // widely differing margins are unlikely to be correct
1020  if( right_margin > left_margin*1.5 )
1021  right_margin = left_margin;
1022 
1023  elem.LeftMargin = convmm2Px( left_margin );
1024  elem.RightMargin = convmm2Px( right_margin );
1025  elem.TopMargin = convmm2Px( top_margin );
1026  elem.BottomMargin = convmm2Px( bottom_margin );
1027 
1028  // get styles for paragraphs
1029  PropertyMap aPageProps;
1030  PropertyMap aPageLayoutProps;
1031  aPageLayoutProps[ "fo:margin-top" ] = unitMMString( top_margin );
1032  aPageLayoutProps[ "fo:margin-bottom" ] = unitMMString( bottom_margin );
1033  aPageLayoutProps[ "fo:margin-left" ] = unitMMString( left_margin );
1034  aPageLayoutProps[ "fo:margin-right" ] = unitMMString( right_margin );
1035  aPageLayoutProps[ "fo:page-width" ] = unitMMString( page_width );
1036  aPageLayoutProps[ "fo:page-height" ] = unitMMString( page_height );
1037  aPageLayoutProps[ "style:print-orientation" ]= elem.w < elem.h ? OUStringLiteral("portrait") : OUStringLiteral("landscape");
1038  aPageLayoutProps[ "style:writing-mode" ]= "lr-tb";
1039 
1040  StyleContainer::Style aStyle( "style:page-layout", aPageProps);
1041  StyleContainer::Style aSubStyle( "style:page-layout-properties", aPageLayoutProps);
1042  aStyle.SubStyles.push_back(&aSubStyle);
1043  sal_Int32 nPageStyle = m_rStyleContainer.impl_getStyleId( aStyle, false );
1044 
1045  // create master page
1046  OUString aMasterPageLayoutName = m_rStyleContainer.getStyleName( nPageStyle );
1047  aPageProps[ "style:page-layout-name" ] = aMasterPageLayoutName;
1048 
1049  StyleContainer::Style aMPStyle( "style:master-page", aPageProps);
1050 
1051  elem.StyleId = m_rStyleContainer.impl_getStyleId( aMPStyle,false );
1052 
1053  // create styles for children
1054  elem.applyToChildren(*this);
1055 }
1056 
1057 void DrawXmlFinalizer::visit( DocumentElement& elem, const std::list< std::unique_ptr<Element> >::const_iterator& )
1058 {
1059  elem.applyToChildren(*this);
1060 }
1061 
1062 }
1063 
1064 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::rendering::ARGBColor LineColor
Definition: pdfihelper.hxx:96
std::unordered_map< OUString, OUString > PropertyMap
Definition: pdfihelper.hxx:44
void setX(double fX)
css::uno::Reference< css::uno::XComponentContext > m_xContext
PDFIProcessor & m_rProcessor
EmitContext & m_rEmitContext
basegfx::B2DPolyPolygon PolyPoly
basegfx::B2DPoint getNextControlPoint(sal_uInt32 nIndex) const
OUString unitMMString(double fMM)
Definition: pdfihelper.cxx:108
static OUString mirrorString(const OUString &i_rInString)
OUString getPercentString(double value)
Definition: pdfihelper.cxx:103
#define PDFI_OUTDEV_RESOLUTION
Definition: pdfihelper.hxx:38
double convmm2Px(double fMM)
Definition: pdfihelper.hxx:60
static void fillFrameProps(DrawElement &rElem, PropertyMap &rProps, const EmitContext &rEmitContext, bool bWasTransformed)
std::vector< Style * > SubStyles
Definition: style.hxx:45
void applyToChildren(ElementTreeVisitor &)
Apply visitor to all children.
static ParagraphElement * createParagraphElement(Element *pParent)
double getX() const
virtual void beginTag(const char *pTag, const PropertyMap &rProperties)=0
Open up a tag with the given properties.
OUString convertPixelToUnitString(double fPix)
Definition: pdfihelper.cxx:117
void setB2DPolygon(sal_uInt32 nIndex, const B2DPolygon &rPolygon)
aBuf
sal_Int32 impl_getStyleId(const Style &rStyle, bool bSubStyle)
Definition: style.cxx:37
double getY() const
def point()
const FontAttributes & getFont(sal_Int32 nFontId) const
PDFIProcessor & m_rProcessor
StyleContainer & m_rStyleContainer
virtual void visit(HyperlinkElement &, const std::list< std::unique_ptr< Element > >::const_iterator &) override
double get(sal_uInt16 nRow, sal_uInt16 nColumn) const
static bool notTransformed(const GraphicsContext &GC)
B2DPolygon const & getB2DPolygon(sal_uInt32 nIndex) const
basegfx::B2DPolyPolygon Clip
Definition: pdfihelper.hxx:108
static bool isSpaces(TextElement *pTextElem)
PDFIProcessor & rProcessor
bool isPrevControlPointUsed(sal_uInt32 nIndex) const
void setB2DPoint(sal_uInt32 nIndex, const basegfx::B2DPoint &rValue)
css::rendering::ARGBColor FillColor
Definition: pdfihelper.hxx:97
const GraphicsContext & getGraphicsContext(sal_Int32 nGCId) const
double convPx2mm(double fPix)
Definition: pdfihelper.hxx:53
std::vector< double > DashArray
Definition: pdfihelper.hxx:104
const css::uno::Reference< css::i18n::XBreakIterator > & GetBreakIterator()
ImageContainer & rImages
sal_Int32 getGCId(const GraphicsContext &rGC)
css::uno::Reference< css::i18n::XCharacterClassification > mxCharClass
virtual void visit(HyperlinkElement &, const std::list< std::unique_ptr< Element > >::const_iterator &) override
css::uno::Reference< css::task::XStatusIndicator > xStatusIndicator
std::list< std::unique_ptr< Element > > Children
OUString GetLineJoinString() const
Definition: pdfihelper.hxx:149
int i
bool decompose(B2DTuple &rScale, B2DTuple &rTranslate, double &rRotate, double &rShearX) const
double GetAverageTransformationScale(const basegfx::B2DHomMatrix &matrix)
Definition: pdfihelper.cxx:32
basegfx::B2DHomMatrix Transformation
Definition: pdfihelper.hxx:107
void resolveFontStyles(PDFIProcessor const &rProc)
sal_Int32 scale
OUString getStyleName(sal_Int32 nStyle) const
Definition: style.cxx:146
OUString getColorString(const css::rendering::ARGBColor &)
Convert color to "#FEFEFE" color notation.
basegfx::B2DPoint getPrevControlPoint(sal_uInt32 nIndex) const
float u
void scale(double fX, double fY)
void setNextControlPoint(sal_uInt32 nIndex, const basegfx::B2DPoint &rValue)
dictionary props
StyleContainer & rStyles
void FillDashStyleProps(PropertyMap &props, const std::vector< double > &dashArray, double scale)
Definition: pdfihelper.cxx:40
const css::uno::Reference< css::i18n::XCharacterClassification > & GetCharacterClassification()
exports com.sun.star. style
css::uno::Reference< css::i18n::XBreakIterator > mxBreakIter
const css::uno::Reference< css::task::XStatusIndicator > & getStatusIndicator() const
bool isNextControlPointUsed(sal_uInt32 nIndex) const
void updateGeometryWith(const Element *pMergeFrom)
Union element geometry with given element.
sal_uInt32 count() const
void setY(double fY)
SvBaseLink * pLink
double convPx2mmPrec2(double fPix)
Definition: pdfihelper.hxx:67
static void setParent(std::list< std::unique_ptr< Element >>::iterator const &el, Element *pNewParent)
el must be a valid dereferenceable iterator of el->Parent->Children pNewParent must not be NULL ...
sal_Int32 getStyleId(const Style &rStyle)
Definition: style.hxx:152
static void sortElements(Element *pElement)
QPRO_FUNC_TYPE nType
const char * name
void translate(double fX, double fY)
XmlEmitter & rEmitter
css::uno::Reference< css::uno::XComponentContext > m_xContext
sal_Int32 getStandardStyleId(const OString &rFamily)
Definition: style.cxx:76
void optimizeTextElements(Element &rParent)
OUString exportToSvgD(const B2DPolyPolygon &rPolyPoly, bool bUseRelativeCoordinates, bool bDetectQuadraticBeziers, bool bHandleRelativeNextPointCompatible, bool bOOXMLMotionPath=false)
static void SetFontsizeProperties(PropertyMap &props, double fontSize)
virtual void visit(HyperlinkElement &, const std::list< std::unique_ptr< Element > >::const_iterator &) override
void writeBase64EncodedStream(ImageId nImageId, EmitContext &rContext)
OUString GetLineCapString() const
Definition: pdfihelper.hxx:163
virtual void write(const OUString &rString)=0
Write PCTEXT as-is to output.
const bool m_bWriteDrawDocument
writes Impress doc when false
void setPrevControlPoint(sal_uInt32 nIndex, const basegfx::B2DPoint &rValue)
OUStringBuffer Text
virtual void endTag(const char *pTag)=0
Close previously opened tag.
sal_uInt32 count() const
basegfx::B2DPoint const & getB2DPoint(sal_uInt32 nIndex) const