LibreOffice Module oox (master)  1
vmlshapecontext.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 <sal/config.h>
21 
22 #include <string_view>
23 
25 
28 #include <oox/helper/helper.hxx>
29 #include <oox/token/namespaces.hxx>
30 #include <oox/token/tokens.hxx>
31 #include <oox/vml/vmldrawing.hxx>
32 #include <oox/vml/vmlshape.hxx>
35 
36 #include <osl/diagnose.h>
38 
39 namespace oox::vml {
40 
41 using namespace ::com::sun::star;
42 
43 using ::oox::core::ContextHandler2;
44 using ::oox::core::ContextHandler2Helper;
46 
47 namespace {
48 
51 OptValue< bool > lclDecodeBool( const AttributeList& rAttribs, sal_Int32 nToken )
52 {
53  OptValue< OUString > oValue = rAttribs.getString( nToken );
54  if( oValue.has() ) return OptValue< bool >( ConversionHelper::decodeBool( oValue.get() ) );
55  return OptValue< bool >();
56 }
57 
61 OptValue< double > lclDecodePercent( const AttributeList& rAttribs, sal_Int32 nToken, double fDefValue )
62 {
63  OptValue< OUString > oValue = rAttribs.getString( nToken );
64  if( oValue.has() ) return OptValue< double >( ConversionHelper::decodePercent( oValue.get(), fDefValue ) );
65  return OptValue< double >();
66 }
67 
71 OptValue< double > lclDecodeOpacity( const AttributeList& rAttribs, sal_Int32 nToken, double fDefValue )
72 {
73  OptValue< OUString > oValue = rAttribs.getString( nToken );
74  double fRetval(fDefValue);
75 
76  if( oValue.has() )
77  {
78  const OUString& aString(oValue.get());
79  const sal_Int32 nLength(aString.getLength());
80 
81  if(nLength > 0)
82  {
83  if(aString.endsWith("f"))
84  {
85  fRetval = std::clamp(aString.toDouble() / 65536.0, 0.0, 1.0);
86  }
87  else
88  {
89  fRetval = ConversionHelper::decodePercent( aString, fDefValue );
90  }
91  }
92  }
93 
94  return OptValue< double >(fRetval);
95 }
96 
99 OptValue< Int32Pair > lclDecodeInt32Pair( const AttributeList& rAttribs, sal_Int32 nToken )
100 {
101  OptValue< OUString > oValue = rAttribs.getString( nToken );
102  OptValue< Int32Pair > oRetValue;
103  if( oValue.has() )
104  {
105  OUString aValue1, aValue2;
106  ConversionHelper::separatePair( aValue1, aValue2, oValue.get(), ',' );
107  oRetValue = Int32Pair( aValue1.toInt32(), aValue2.toInt32() );
108  }
109  return oRetValue;
110 }
111 
114 OptValue< DoublePair > lclDecodePercentPair( const AttributeList& rAttribs, sal_Int32 nToken )
115 {
116  OptValue< OUString > oValue = rAttribs.getString( nToken );
117  OptValue< DoublePair > oRetValue;
118  if( oValue.has() )
119  {
120  OUString aValue1, aValue2;
121  ConversionHelper::separatePair( aValue1, aValue2, oValue.get(), ',' );
122  oRetValue = DoublePair(
123  ConversionHelper::decodePercent( aValue1, 0.0 ),
124  ConversionHelper::decodePercent( aValue2, 0.0 ) );
125  }
126  return oRetValue;
127 }
128 
133 bool lclDecodeVmlxBool( std::u16string_view rValue, bool bDefaultForEmpty )
134 {
135  if( rValue.empty() ) return bDefaultForEmpty;
136  sal_Int32 nToken = AttributeConversion::decodeToken( rValue );
137  // anything else than 't' or 'True' is considered to be false, as specified
138  return (nToken == XML_t) || (nToken == XML_True);
139 }
140 
141 } // namespace
142 
143 ShapeLayoutContext::ShapeLayoutContext( ContextHandler2Helper const & rParent, Drawing& rDrawing ) :
144  ContextHandler2( rParent ),
145  mrDrawing( rDrawing )
146 {
147 }
148 
150 {
151  switch( nElement )
152  {
153  case O_TOKEN( idmap ):
154  {
155  OUString aBlockIds = rAttribs.getString( XML_data, OUString() );
156  sal_Int32 nIndex = 0;
157  while( nIndex >= 0 )
158  {
159  OUString aToken = aBlockIds.getToken( 0, ' ', nIndex ).trim();
160  if( !aToken.isEmpty() )
161  mrDrawing.registerBlockId( aToken.toInt32() );
162  }
163  }
164  break;
165  }
166  return nullptr;
167 }
168 
169 ClientDataContext::ClientDataContext( ContextHandler2Helper const & rParent,
170  ClientData& rClientData, const AttributeList& rAttribs ) :
171  ContextHandler2( rParent ),
172  mrClientData( rClientData )
173 {
174  mrClientData.mnObjType = rAttribs.getToken( XML_ObjectType, XML_TOKEN_INVALID );
175 }
176 
177 ContextHandlerRef ClientDataContext::onCreateContext( sal_Int32 /*nElement*/, const AttributeList& /*rAttribs*/ )
178 {
179  if( isRootElement() )
180  {
181  maElementText.clear();
182  return this;
183  }
184  return nullptr;
185 }
186 
187 void ClientDataContext::onCharacters( const OUString& rChars )
188 {
189  /* Empty but existing elements have special meaning, e.g. 'true'. Collect
190  existing text and convert it in onEndElement(). */
191  maElementText = rChars;
192 }
193 
195 {
196  switch( getCurrentElement() )
197  {
198  case VMLX_TOKEN( Anchor ): mrClientData.maAnchor = maElementText; break;
199  case VMLX_TOKEN( FmlaMacro ): mrClientData.maFmlaMacro = maElementText; break;
200  case VMLX_TOKEN( FmlaPict ): mrClientData.maFmlaPict = maElementText; break;
201  case VMLX_TOKEN( FmlaLink ): mrClientData.maFmlaLink = maElementText; break;
202  case VMLX_TOKEN( FmlaRange ): mrClientData.maFmlaRange = maElementText; break;
203  case VMLX_TOKEN( FmlaGroup ): mrClientData.maFmlaGroup = maElementText; break;
204  case VMLX_TOKEN( TextHAlign ): mrClientData.mnTextHAlign = AttributeConversion::decodeToken( maElementText ); break;
205  case VMLX_TOKEN( TextVAlign ): mrClientData.mnTextVAlign = AttributeConversion::decodeToken( maElementText ); break;
206  case VMLX_TOKEN( Column ): mrClientData.mnCol = maElementText.toInt32(); break;
207  case VMLX_TOKEN( Row ): mrClientData.mnRow = maElementText.toInt32(); break;
208  case VMLX_TOKEN( Checked ): mrClientData.mnChecked = maElementText.toInt32(); break;
209  case VMLX_TOKEN( DropStyle ): mrClientData.mnDropStyle = AttributeConversion::decodeToken( maElementText ); break;
210  case VMLX_TOKEN( DropLines ): mrClientData.mnDropLines = maElementText.toInt32(); break;
211  case VMLX_TOKEN( Val ): mrClientData.mnVal = maElementText.toInt32(); break;
212  case VMLX_TOKEN( Min ): mrClientData.mnMin = maElementText.toInt32(); break;
213  case VMLX_TOKEN( Max ): mrClientData.mnMax = maElementText.toInt32(); break;
214  case VMLX_TOKEN( Inc ): mrClientData.mnInc = maElementText.toInt32(); break;
215  case VMLX_TOKEN( Page ): mrClientData.mnPage = maElementText.toInt32(); break;
216  case VMLX_TOKEN( SelType ): mrClientData.mnSelType = AttributeConversion::decodeToken( maElementText ); break;
217  case VMLX_TOKEN( VTEdit ): mrClientData.mnVTEdit = maElementText.toInt32(); break;
218  case VMLX_TOKEN( PrintObject ): mrClientData.mbPrintObject = lclDecodeVmlxBool( maElementText, true ); break;
219  case VMLX_TOKEN( Visible ): mrClientData.mbVisible = lclDecodeVmlxBool( maElementText, true ); break;
220  case VMLX_TOKEN( DDE ): mrClientData.mbDde = lclDecodeVmlxBool( maElementText, true ); break;
221  case VMLX_TOKEN( NoThreeD ): mrClientData.mbNo3D = lclDecodeVmlxBool( maElementText, true ); break;
222  case VMLX_TOKEN( NoThreeD2 ): mrClientData.mbNo3D2 = lclDecodeVmlxBool( maElementText, true ); break;
223  case VMLX_TOKEN( MultiLine ): mrClientData.mbMultiLine = lclDecodeVmlxBool( maElementText, true ); break;
224  case VMLX_TOKEN( VScroll ): mrClientData.mbVScroll = lclDecodeVmlxBool( maElementText, true ); break;
225  case VMLX_TOKEN( SecretEdit ): mrClientData.mbSecretEdit = lclDecodeVmlxBool( maElementText, true ); break;
226  }
227 }
228 
229 ShapeContextBase::ShapeContextBase( ContextHandler2Helper const & rParent ) :
230  ContextHandler2( rParent )
231 {
232 }
233 
234 ContextHandlerRef ShapeContextBase::createShapeContext( ContextHandler2Helper const & rParent,
235  ShapeContainer& rShapes, sal_Int32 nElement, const AttributeList& rAttribs )
236 {
237  switch( nElement )
238  {
239  case O_TOKEN( shapelayout ):
240  return new ShapeLayoutContext( rParent, rShapes.getDrawing() );
241 
242  case VML_TOKEN( shapetype ):
243  return new ShapeTypeContext( rParent, rShapes.createShapeType(), rAttribs );
244  case VML_TOKEN( group ):
245  return new GroupShapeContext( rParent, rShapes.createShape< GroupShape >(), rAttribs );
246  case VML_TOKEN( shape ):
247  if (rAttribs.hasAttribute(XML_path) &&
248  // tdf#122563 skip in the case of empty path
249  !rAttribs.getString(XML_path, "").isEmpty())
250  return new ShapeContext( rParent, rShapes.createShape< BezierShape >(), rAttribs );
251  else
252  return new ShapeContext( rParent, rShapes.createShape< ComplexShape >(), rAttribs );
253  case VML_TOKEN( rect ):
254  return new RectangleShapeContext( rParent, rAttribs, rShapes.createShape< RectangleShape >() );
255  case VML_TOKEN( roundrect ):
256  return new ShapeContext( rParent, rShapes.createShape< RectangleShape >(), rAttribs );
257  case VML_TOKEN( oval ):
258  return new ShapeContext( rParent, rShapes.createShape< EllipseShape >(), rAttribs );
259  case VML_TOKEN( polyline ):
260  return new ShapeContext( rParent, rShapes.createShape< PolyLineShape >(), rAttribs );
261  case VML_TOKEN( line ):
262  return new ShapeContext( rParent, rShapes.createShape< LineShape >(), rAttribs );
263  case VML_TOKEN( curve ):
264  return new ShapeContext( rParent, rShapes.createShape< BezierShape >(), rAttribs );
265 
266  // TODO:
267  case VML_TOKEN( arc ):
268  case VML_TOKEN( diagram ):
269  case VML_TOKEN( image ):
270  return new ShapeContext( rParent, rShapes.createShape< ComplexShape >(), rAttribs );
271 
272  case W_TOKEN(control):
273  return new ControlShapeContext( rParent, rShapes, rAttribs );
274  }
275  return nullptr;
276 }
277 
278 ShapeTypeContext::ShapeTypeContext(ContextHandler2Helper const & rParent,
279  std::shared_ptr<ShapeType> const& pShapeType,
280  const AttributeList& rAttribs)
281  : ShapeContextBase(rParent)
282  , m_pShapeType(pShapeType) // tdf#112311 keep it alive
283  , mrTypeModel( pShapeType->getTypeModel() )
284 {
285  // shape identifier and shape name
286  bool bHasOspid = rAttribs.hasAttribute( O_TOKEN( spid ) );
287  mrTypeModel.maShapeId = rAttribs.getXString( bHasOspid ? O_TOKEN( spid ) : XML_id, OUString() );
288  mrTypeModel.maLegacyId = rAttribs.getString( XML_id, OUString() );
289  OSL_ENSURE( !mrTypeModel.maShapeId.isEmpty(), "ShapeTypeContext::ShapeTypeContext - missing shape identifier" );
290  // builtin shape type identifier
291  mrTypeModel.moShapeType = rAttribs.getInteger( O_TOKEN( spt ) );
292  // if the o:spid attribute exists, the id attribute contains the user-defined shape name
293  if( bHasOspid )
294  {
295  mrTypeModel.maShapeName = rAttribs.getXString( XML_id, OUString() );
296  // get ShapeType and ShapeId from name for compatibility
297  static constexpr OUStringLiteral sShapeTypePrefix = u"shapetype_";
298  OUString tmp;
299  if( mrTypeModel.maShapeName.startsWith( sShapeTypePrefix ) )
300  {
302  mrTypeModel.moShapeType = mrTypeModel.maShapeName.copy(sShapeTypePrefix.getLength()).toInt32();
303  }
304  else if (mrTypeModel.maShapeName.startsWith("_x0000_t", &tmp))
305  {
307  mrTypeModel.moShapeType = tmp.toInt32();
308  }
309  }
310 
311  // coordinate system position/size, CSS style
312  mrTypeModel.moCoordPos = lclDecodeInt32Pair( rAttribs, XML_coordorigin );
313  mrTypeModel.moCoordSize = lclDecodeInt32Pair( rAttribs, XML_coordsize );
314  setStyle( rAttribs.getString( XML_style, OUString() ) );
315  if( lclDecodeBool( rAttribs, O_TOKEN( hr )).get( false ))
316  { // MSO's handling of o:hr width is nowhere near what the spec says:
317  // - o:hrpct is not in % but in 0.1%
318  // - if o:hrpct is not given, 100% width is assumed
319  // - given width is used only if explicit o:hrpct="0" is given
320  OUString hrpct = rAttribs.getString( O_TOKEN( hrpct ), "1000" );
321  if( hrpct != "0" )
322  mrTypeModel.maWidthPercent = OUString::number( hrpct.toInt32() );
325  mrTypeModel.maPositionHorizontal = rAttribs.getString( O_TOKEN( hralign ), "left" );
326  mrTypeModel.moWrapType = "topAndBottom";
327  }
328 
329  // stroke settings (may be overridden by v:stroke element later)
330  mrTypeModel.maStrokeModel.moStroked = lclDecodeBool( rAttribs, XML_stroked );
331  mrTypeModel.maStrokeModel.moColor = rAttribs.getString( XML_strokecolor );
332  mrTypeModel.maStrokeModel.moWeight = rAttribs.getString( XML_strokeweight );
333 
334  // fill settings (may be overridden by v:fill element later)
335  mrTypeModel.maFillModel.moFilled = lclDecodeBool( rAttribs, XML_filled );
336  mrTypeModel.maFillModel.moColor = rAttribs.getString( XML_fillcolor );
337 
338  // For roundrect we may have an arcsize attribute to read
339  mrTypeModel.maArcsize = rAttribs.getString(XML_arcsize, OUString());
340  // editas
341  mrTypeModel.maEditAs = rAttribs.getString(XML_editas, OUString());
342 
343  mrTypeModel.maAdjustments = rAttribs.getString(XML_adj, OUString());
344 }
345 
347 {
348  if( isRootElement() ) switch( nElement )
349  {
350  case VML_TOKEN( stroke ):
351  mrTypeModel.maStrokeModel.moStroked.assignIfUsed( lclDecodeBool( rAttribs, XML_on ) );
352  mrTypeModel.maStrokeModel.maStartArrow.moArrowType = rAttribs.getToken( XML_startarrow );
353  mrTypeModel.maStrokeModel.maStartArrow.moArrowWidth = rAttribs.getToken( XML_startarrowwidth );
354  mrTypeModel.maStrokeModel.maStartArrow.moArrowLength = rAttribs.getToken( XML_startarrowlength );
355  mrTypeModel.maStrokeModel.maEndArrow.moArrowType = rAttribs.getToken( XML_endarrow );
356  mrTypeModel.maStrokeModel.maEndArrow.moArrowWidth = rAttribs.getToken( XML_endarrowwidth );
357  mrTypeModel.maStrokeModel.maEndArrow.moArrowLength = rAttribs.getToken( XML_endarrowlength );
358  mrTypeModel.maStrokeModel.moColor.assignIfUsed( rAttribs.getString( XML_color ) );
359  mrTypeModel.maStrokeModel.moOpacity = lclDecodeOpacity( rAttribs, XML_opacity, 1.0 );
360  mrTypeModel.maStrokeModel.moWeight.assignIfUsed( rAttribs.getString( XML_weight ) );
361  mrTypeModel.maStrokeModel.moDashStyle = rAttribs.getString( XML_dashstyle );
362  mrTypeModel.maStrokeModel.moLineStyle = rAttribs.getToken( XML_linestyle );
363  mrTypeModel.maStrokeModel.moEndCap = rAttribs.getToken( XML_endcap );
364  mrTypeModel.maStrokeModel.moJoinStyle = rAttribs.getToken( XML_joinstyle );
365  break;
366  case VML_TOKEN( fill ):
367  {
368  // in DOCX shapes use r:id for the relationship id
369  // in XLSX they use o:relid
370  bool bHasORelId = rAttribs.hasAttribute( O_TOKEN(relid) );
371  mrTypeModel.maFillModel.moFilled.assignIfUsed( lclDecodeBool( rAttribs, XML_on ) );
372  mrTypeModel.maFillModel.moColor.assignIfUsed( rAttribs.getString( XML_color ) );
373  mrTypeModel.maFillModel.moOpacity = lclDecodeOpacity( rAttribs, XML_opacity, 1.0 );
374  mrTypeModel.maFillModel.moColor2 = rAttribs.getString( XML_color2 );
375  mrTypeModel.maFillModel.moOpacity2 = lclDecodeOpacity( rAttribs, XML_opacity2, 1.0 );
376  mrTypeModel.maFillModel.moType = rAttribs.getToken( XML_type );
377  mrTypeModel.maFillModel.moAngle = rAttribs.getInteger( XML_angle );
378  mrTypeModel.maFillModel.moFocus = lclDecodePercent( rAttribs, XML_focus, 0.0 );
379  mrTypeModel.maFillModel.moFocusPos = lclDecodePercentPair( rAttribs, XML_focusposition );
380  mrTypeModel.maFillModel.moFocusSize = lclDecodePercentPair( rAttribs, XML_focussize );
381  mrTypeModel.maFillModel.moBitmapPath = decodeFragmentPath( rAttribs, bHasORelId ? O_TOKEN(relid) : R_TOKEN(id) );
382  mrTypeModel.maFillModel.moRotate = lclDecodeBool( rAttribs, XML_rotate );
383  break;
384  }
385  case VML_TOKEN( imagedata ):
386  {
387  // shapes in docx use r:id for the relationship id
388  // in xlsx it they use o:relid
389  bool bHasORelId = rAttribs.hasAttribute( O_TOKEN( relid ) );
390  mrTypeModel.moGraphicPath = decodeFragmentPath( rAttribs, bHasORelId ? O_TOKEN( relid ) : R_TOKEN( id ) );
391  mrTypeModel.moGraphicTitle = rAttribs.getString( O_TOKEN( title ) );
392 
393  // Get crop attributes.
394  mrTypeModel.moCropBottom = rAttribs.getString(XML_cropbottom);
395  mrTypeModel.moCropLeft = rAttribs.getString(XML_cropleft);
396  mrTypeModel.moCropRight = rAttribs.getString(XML_cropright);
397  mrTypeModel.moCropTop = rAttribs.getString(XML_croptop);
398 
399  // Gain / contrast.
400  OptValue<OUString> oGain = rAttribs.getString(XML_gain);
401  sal_Int32 nGain = 0x10000;
402  if (oGain.has() && oGain.get().endsWith("f"))
403  {
404  nGain = oGain.get().toInt32();
405  }
406  if (nGain < 0x10000)
407  {
408  nGain *= 101; // 100 + 1 to round
409  nGain /= 0x10000;
410  nGain -= 100;
411  }
412  mrTypeModel.mnGain = nGain;
413 
414  // Blacklevel / brightness.
415  OptValue<OUString> oBlacklevel = rAttribs.getString(XML_blacklevel);
416  sal_Int16 nBlacklevel = 0;
417  if (oBlacklevel.has() && oBlacklevel.get().endsWith("f"))
418  {
419  nBlacklevel = oBlacklevel.get().toInt32();
420  }
421  if (nBlacklevel != 0)
422  {
423  nBlacklevel /= 327;
424  }
425  mrTypeModel.mnBlacklevel = nBlacklevel;
426  }
427  break;
428  case NMSP_vmlWord | XML_wrap:
429  mrTypeModel.moWrapAnchorX = rAttribs.getString(XML_anchorx);
430  mrTypeModel.moWrapAnchorY = rAttribs.getString(XML_anchory);
431  mrTypeModel.moWrapType = rAttribs.getString(XML_type);
432  mrTypeModel.moWrapSide = rAttribs.getString(XML_side);
433  break;
434  case VML_TOKEN( shadow ):
435  {
437  mrTypeModel.maShadowModel.moShadowOn = lclDecodeBool(rAttribs, XML_on).get(false);
440  mrTypeModel.maShadowModel.moOpacity = lclDecodePercent(rAttribs, XML_opacity, 1.0);
441  }
442  break;
443  case VML_TOKEN( textpath ):
446  mrTypeModel.maTextpathModel.moTrim.assignIfUsed(lclDecodeBool(rAttribs, XML_trim));
447  break;
448  }
449  return nullptr;
450 }
451 
453 {
454  OptValue< OUString > oFragmentPath;
455  OptValue< OUString > oRelId = rAttribs.getString( nToken );
456  if( oRelId.has() )
457  oFragmentPath = getFragmentPathFromRelId( oRelId.get() );
458  return oFragmentPath;
459 }
460 
461 void ShapeTypeContext::setStyle( const OUString& rStyle )
462 {
463  sal_Int32 nIndex = 0;
464  while( nIndex >= 0 )
465  {
466  OUString aName, aValue;
467  if( ConversionHelper::separatePair( aName, aValue, rStyle.getToken( 0, ';', nIndex ), ':' ) )
468  {
469  if( aName == "position" ) mrTypeModel.maPosition = aValue;
470  else if( aName == "z-index" ) mrTypeModel.maZIndex = aValue;
471  else if( aName == "left" ) mrTypeModel.maLeft = aValue;
472  else if( aName == "top" ) mrTypeModel.maTop = aValue;
473  else if( aName == "width" ) mrTypeModel.maWidth = aValue;
474  else if( aName == "height" ) mrTypeModel.maHeight = aValue;
475  else if( aName == "margin-left" ) mrTypeModel.maMarginLeft = aValue;
476  else if( aName == "margin-top" ) mrTypeModel.maMarginTop = aValue;
477  else if( aName == "mso-position-vertical-relative" ) mrTypeModel.maPositionVerticalRelative = aValue;
478  else if( aName == "mso-position-horizontal-relative" ) mrTypeModel.maPositionHorizontalRelative = aValue;
479  else if( aName == "mso-position-horizontal" ) mrTypeModel.maPositionHorizontal = aValue;
480  else if( aName == "mso-position-vertical" ) mrTypeModel.maPositionVertical = aValue;
481  else if( aName == "mso-width-percent" ) mrTypeModel.maWidthPercent = aValue;
482  else if( aName == "mso-width-relative" ) mrTypeModel.maWidthRelative = aValue;
483  else if( aName == "mso-height-percent" ) mrTypeModel.maHeightPercent = aValue;
484  else if( aName == "mso-height-relative" ) mrTypeModel.maHeightRelative = aValue;
485  else if( aName == "mso-fit-shape-to-text" ) mrTypeModel.mbAutoHeight = true;
486  else if( aName == "rotation" ) mrTypeModel.maRotation = aValue;
487  else if( aName == "flip" ) mrTypeModel.maFlip = aValue;
488  else if( aName == "visibility" )
489  mrTypeModel.mbVisible = aValue != "hidden";
490  else if( aName == "mso-wrap-style" ) mrTypeModel.maWrapStyle = aValue;
491  else if ( aName == "v-text-anchor" ) mrTypeModel.maVTextAnchor = aValue;
492  else if ( aName == "mso-wrap-distance-left" ) mrTypeModel.maWrapDistanceLeft = aValue;
493  else if ( aName == "mso-wrap-distance-right" ) mrTypeModel.maWrapDistanceRight = aValue;
494  else if ( aName == "mso-wrap-distance-top" ) mrTypeModel.maWrapDistanceTop = aValue;
495  else if ( aName == "mso-wrap-distance-bottom" ) mrTypeModel.maWrapDistanceBottom = aValue;
496  }
497  }
498 }
499 
500 ShapeContext::ShapeContext(ContextHandler2Helper const& rParent,
501  const std::shared_ptr<ShapeBase>& pShape, const AttributeList& rAttribs)
502  : ShapeTypeContext(rParent, pShape, rAttribs)
503  , mrShape(*pShape)
504  , mrShapeModel(pShape->getShapeModel())
505 {
506  // collect shape specific attributes
507  mrShapeModel.maType = rAttribs.getXString( XML_type, OUString() );
508  // polyline path
509  setPoints( rAttribs.getString( XML_points, OUString() ) );
510  // line start and end positions
511  setFrom(rAttribs.getString(XML_from, OUString()));
512  setTo(rAttribs.getString(XML_to, OUString()));
513  setControl1(rAttribs.getString(XML_control1, OUString()));
514  setControl2(rAttribs.getString(XML_control2, OUString()));
515  setVmlPath(rAttribs.getString(XML_path, OUString()));
516  setHyperlink(rAttribs.getString(XML_href, OUString()));
517 }
518 
519 ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
520 {
521  // Excel specific shape client data
522  if( isRootElement() ) switch( nElement )
523  {
524  case VML_TOKEN( textbox ):
525  {
526  // Calculate the shape type: map both <rect> and <v:shape> with a textbox shape type to
527  // a TextShape.
528  sal_Int32 nShapeType = 0;
529  if (ShapeContainer* pShapeContainer = mrShape.getContainer())
530  {
531  OUString aType = mrShapeModel.maType;
532  if (!aType.isEmpty() && aType[0] == '#')
533  {
534  aType = aType.copy(1);
535  }
536  if (const ShapeType* pShapeType = pShapeContainer->getShapeTypeById(aType))
537  {
538  nShapeType = pShapeType->getTypeModel().moShapeType.get();
539  }
540  }
541  mrShapeModel.mbInGroup = (getParentElement() == VML_TOKEN(group));
542 
543  // FIXME: the shape with textbox should be used for the next cases
544  if (getCurrentElement() == VML_TOKEN(rect) || nShapeType == ESCHER_ShpInst_TextBox)
545  {
547  // FIXME: without this a text will be added into the group-shape instead of its
548  // parent shape
549  dynamic_cast<SimpleShape&>(mrShape).setService("com.sun.star.drawing.TextShape");
550  else
551  // FIXME: without this we does not handle some properties like shadow
552  dynamic_cast<SimpleShape&>(mrShape).setService("com.sun.star.text.TextFrame");
553  }
554  return new TextBoxContext( *this, mrShapeModel.createTextBox(mrShape.getTypeModel()), rAttribs,
556  }
557  case VMLX_TOKEN( ClientData ):
558  // tdf#41466 ActiveX control shapes with a textbox are transformed into a frame
559  // (see unit test testActiveXOptionButtonGroup)
560  dynamic_cast<SimpleShape&>(mrShape).setService("com.sun.star.text.TextFrame");
561  return new ClientDataContext( *this, mrShapeModel.createClientData(), rAttribs );
562  case VMLPPT_TOKEN( textdata ):
563  // Force RectangleShape, this is ugly :(
564  // and is there because of the lines above which change it to TextFrame
565  dynamic_cast< SimpleShape& >( mrShape ).setService(
566  "com.sun.star.drawing.RectangleShape");
567  mrShapeModel.maLegacyDiagramPath = getFragmentPathFromRelId(rAttribs.getString(XML_id, OUString()));
568  break;
569  case O_TOKEN( signatureline ):
571  mrShapeModel.maSignatureId = rAttribs.getString(XML_id, OUString());
573  = rAttribs.getString(O_TOKEN(suggestedsigner), OUString());
575  = rAttribs.getString(O_TOKEN(suggestedsigner2), OUString());
577  = rAttribs.getString(O_TOKEN(suggestedsigneremail), OUString());
579  = rAttribs.getString(O_TOKEN(signinginstructions), OUString());
581  rAttribs.getString(XML_showsigndate, "t")); // default is true
583  rAttribs.getString(XML_allowcomments, "f")); // default is false
584  break;
585  case O_TOKEN( lock ):
586  // TODO
587  break;
588  }
589  // handle remaining stuff in base class
590  return ShapeTypeContext::onCreateContext( nElement, rAttribs );
591 }
592 
593 void ShapeContext::setPoints(const OUString& rPoints)
594 {
595  mrShapeModel.maPoints.clear();
596  sal_Int32 nIndex = 0;
597 
598  while (nIndex >= 0)
599  {
601  mrShape.getDrawing().getFilter().getGraphicHelper(), rPoints.getToken(0, ',', nIndex),
602  0, true, true);
604  mrShape.getDrawing().getFilter().getGraphicHelper(), rPoints.getToken(0, ',', nIndex),
605  0, false, true);
606  mrShapeModel.maPoints.emplace_back(nX, nY);
607  }
608  // VML polyline has no size in its style attribute. Word writes the size to attribute
609  // coordsize with values in twip but without unit. For others we get size from points.
610  if (!mrShape.getTypeModel().maWidth.isEmpty() || !mrShape.getTypeModel().maHeight.isEmpty())
611  return;
612 
614  {
615  double fWidth = mrShape.getTypeModel().moCoordSize.get().first;
617  double fHeight = mrShape.getTypeModel().moCoordSize.get().second;
619  mrShape.getTypeModel().maWidth = OUString::number(fWidth) + "pt";
620  mrShape.getTypeModel().maHeight = OUString::number(fHeight) + "pt";
621  }
622  else if (mrShapeModel.maPoints.size())
623  {
624  double fMinX = mrShapeModel.maPoints[0].X;
625  double fMaxX = mrShapeModel.maPoints[0].X;
626  double fMinY = mrShapeModel.maPoints[0].Y;
627  double fMaxY = mrShapeModel.maPoints[0].Y;
628  for (const auto& rPoint : mrShapeModel.maPoints)
629  {
630  if (rPoint.X < fMinX)
631  fMinX = rPoint.X;
632  else if (rPoint.X > fMaxX)
633  fMaxX = rPoint.X;
634  if (rPoint.Y < fMinY)
635  fMinY = rPoint.Y;
636  else if (rPoint.Y > fMaxY)
637  fMaxY = rPoint.Y;
638  }
640  = OUString::number(
642  + "pt";
644  = OUString::number(
646  + "pt";
647  // Set moCoordSize, otherwise default (1000,1000) is used.
649  Int32Pair(basegfx::fround(fMaxX - fMinX), basegfx::fround(fMaxY - fMinY)));
650  }
651 }
652 
653 void ShapeContext::setFrom( const OUString& rPoints )
654 {
655  if (!rPoints.isEmpty())
656  mrShapeModel.maFrom = rPoints;
657 }
658 
659 void ShapeContext::setTo( const OUString& rPoints )
660 {
661  if (!rPoints.isEmpty())
662  mrShapeModel.maTo = rPoints;
663 }
664 
665 void ShapeContext::setControl1( const OUString& rPoints )
666 {
667  if (!rPoints.isEmpty())
668  mrShapeModel.maControl1 = rPoints;
669 }
670 
671 void ShapeContext::setControl2( const OUString& rPoints )
672 {
673  if (!rPoints.isEmpty())
674  mrShapeModel.maControl2 = rPoints;
675 }
676 void ShapeContext::setVmlPath( const OUString& rPath )
677 {
678  if (!rPath.isEmpty())
679  mrShapeModel.maVmlPath = rPath;
680 }
681 
682 void ShapeContext::setHyperlink( const OUString& rHyperlink )
683 {
684  if (!rHyperlink.isEmpty())
685  mrShapeModel.maHyperlink = rHyperlink;
686 }
687 
688 GroupShapeContext::GroupShapeContext(ContextHandler2Helper const& rParent,
689  const std::shared_ptr<GroupShape>& pShape,
690  const AttributeList& rAttribs)
691  : ShapeContext(rParent, pShape, rAttribs)
692  , mrShapes(pShape->getChildren())
693 {
694 }
695 
697 {
698  // try to create a context of an embedded shape
699  ContextHandlerRef xContext = createShapeContext( *this, mrShapes, nElement, rAttribs );
700  // handle remaining stuff of this shape in base class
701  return xContext ? xContext : ShapeContext::onCreateContext( nElement, rAttribs );
702 }
703 
704 RectangleShapeContext::RectangleShapeContext(ContextHandler2Helper const& rParent,
705  const AttributeList& rAttribs,
706  const std::shared_ptr<RectangleShape>& pShape)
707  : ShapeContext(rParent, pShape, rAttribs)
708 {
709 }
710 
712 {
713  // The parent class's context is fine
714  return ShapeContext::onCreateContext( nElement, rAttribs );
715 }
716 
718  : ShapeContextBase (rParent)
719 {
721  aInfo.maShapeId = rAttribs.getXString( W_TOKEN( shapeid ), OUString() );
722  aInfo.maFragmentPath = getFragmentPathFromRelId(rAttribs.getString( R_TOKEN(id), OUString() ));
723  aInfo.maName = rAttribs.getString( W_TOKEN( name ), OUString() );
724  aInfo.mbTextContentShape = true;
725  rShapes.getDrawing().registerControl(aInfo);
726 }
727 
728 } // namespace oox
729 
730 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 mnCol
Column index for spreadsheet cell note.
Definition: vmlshape.hxx:178
tuple line
OptValue< OUString > decodeFragmentPath(const AttributeList &rAttribs, sal_Int32 nToken) const
Resolve a relation identifier to a fragment path.
sal_Int32 mnMin
Minimum value of spin buttons and scroll bars.
Definition: vmlshape.hxx:184
std::shared_ptr< ShapeType > createShapeType()
Creates and returns a new shape template object.
OptValue< OUString > moGraphicTitle
Title of the graphic.
Definition: vmlshape.hxx:100
sal_Int32 nIndex
OptValue< bool > moTrim
Specifies whether extra space is removed above and below the text.
bool mbNo3D
True = flat style, false = 3D style.
Definition: vmlshape.hxx:193
OptValue< OUString > moColor
Specifies the color of the shadow.
OptValue< OUString > moDashStyle
Line dash (predefined or manually).
OUString maZIndex
ZIndex of the shape.
Definition: vmlshape.hxx:70
exports com.sun.star.form. control
sal_Int32 mnDropLines
Number of lines in drop down box.
Definition: vmlshape.hxx:182
ShapeContextBase(::oox::core::ContextHandler2Helper const &rParent)
OUString maSignatureId
ID of the signature.
Definition: vmlshape.hxx:218
bool mbDde
True = object is linked through DDE.
Definition: vmlshape.hxx:192
OUString maTop
Y position of the shape bounding box (number with unit).
Definition: vmlshape.hxx:72
OUString maPositionVertical
The Y position orientation.
Definition: vmlshape.hxx:80
virtual void onCharacters(const OUString &rChars) override
Will be called before a new child element starts, or if the current element is about to be left...
OUString maFmlaLink
Link to value cell associated to the control.
Definition: vmlshape.hxx:172
OptValue< OUString > getXString(sal_Int32 nAttrToken) const
Returns the string value of the specified attribute.
bool mbIsSignatureLine
Shape is a signature line.
Definition: vmlshape.hxx:217
EXTERN_C BOOL BOOL const wchar_t *pProgramPath HRESULT hr
OptValue< sal_Int32 > getInteger(sal_Int32 nAttrToken) const
Returns the 32-bit signed integer value of the specified attribute (decimal).
OOX_DLLPUBLIC bool decodeBool(std::u16string_view rValue)
Returns the boolean value from the passed string of a VML attribute.
OptValue< OUString > moStyle
Specifies the style of the textpath.
Visible
OptValue< sal_Int32 > moArrowType
Excel specific shape client data (such as cell anchor).
Definition: vmlshape.hxx:167
OptValue< double > moOpacity
Solid fill color opacity.
OUString maSignatureLineSuggestedSignerName
Definition: vmlshape.hxx:219
OUString maFmlaMacro
Link to macro associated to the control.
Definition: vmlshape.hxx:170
sal_Int32 toInt32(OUString const &rStr)
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
A shape template contains all formatting properties of shapes and can serve as templates for several ...
Definition: vmlshape.hxx:130
struct _ADOColumn Column
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
Will be called to create a context handler for the passed element.
OUString maHeight
Height of the shape bounding box (number with unit).
Definition: vmlshape.hxx:74
bool mbVScroll
True = textbox has a vertical scrollbar.
Definition: vmlshape.hxx:196
OUString maMarginTop
Y position of the shape bounding box to shape anchor (number with unit).
Definition: vmlshape.hxx:76
OUString maHeightPercent
The height in percents of the HeightRelative.
Definition: vmlshape.hxx:82
OptValue< sal_Int32 > moAngle
Gradient rotation angle.
sal_Int32 mnPage
Large increment of spin buttons and scroll bars.
Definition: vmlshape.hxx:187
OUString maFmlaRange
Link to cell range used as data source for the control.
Definition: vmlshape.hxx:173
OUString maLegacyId
Plaintext identifier of the shape.
Definition: vmlshape.hxx:63
OptValue< OUString > getString(sal_Int32 nAttrToken) const
Returns the string value of the specified attribute.
StrokeArrowModel maStartArrow
Start line arrow style.
OUString maWidthRelative
To what the width is relative.
Definition: vmlshape.hxx:83
OptValue< OUString > moColor2
End color of gradient.
virtual void onEndElement() override
Will be called when the current element is about to be left.
sal_Int32 getParentElement(sal_Int32 nCountBack=1) const
Returns the identifier of the specified parent element.
OptValue< sal_Int32 > moShapeType
Builtin shape type identifier.
Definition: vmlshape.hxx:65
OptValue< double > moOpacity
Specifies the opacity of the shadow.
ShapeTypeContext(::oox::core::ContextHandler2Helper const &rParent, std::shared_ptr< ShapeType > const &pShapeType, const AttributeList &rAttribs)
OptValue< sal_Int32 > moType
Fill type.
OUString maFmlaPict
Target cell range of picture links.
Definition: vmlshape.hxx:171
ShapeLayoutContext(::oox::core::ContextHandler2Helper const &rParent, Drawing &rDrawing)
GraphicHelper & getGraphicHelper() const
Returns a helper for the handling of graphics and graphic objects.
Definition: filterbase.cxx:346
::oox::core::ContextHandlerRef createShapeContext(::oox::core::ContextHandler2Helper const &rParent, ShapeContainer &rShapes, sal_Int32 nElement, const AttributeList &rAttribs)
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
Will be called to create a context handler for the passed element.
A Line shape object.
Definition: vmlshape.hxx:376
OUString maVmlPath
VML path for this shape.
Definition: vmlshape.hxx:216
OUString maEditAs
Edit As type (e.g. "canvas" etc)
Definition: vmlshape.hxx:91
OUString maType
Shape template with default properties.
Definition: vmlshape.hxx:207
bool mbSecretEdit
True = textbox is a password edit field.
Definition: vmlshape.hxx:197
TextBox & createTextBox(ShapeTypeModel &rModel)
Creates and returns a new shape textbox structure.
Definition: vmlshape.cxx:272
OUString maWrapDistanceLeft
Distance from the left side of the shape to the text that wraps around it.
Definition: vmlshape.hxx:106
void set(const Type &rValue)
Definition: helper.hxx:188
OptValue< bool > moStroked
Shape border line on/off.
OptValue< sal_Int32 > moArrowLength
ControlShapeContext(::oox::core::ContextHandler2Helper const &rParent, ShapeContainer &rShapes, const AttributeList &rAttribs)
sal_Int32 mnRow
Row index for spreadsheet cell note.
Definition: vmlshape.hxx:179
Bezier shape object that supports to, from, control1 and control2 attribute or path attribute specifi...
Definition: vmlshape.hxx:395
bool hasAttribute(sal_Int32 nAttrToken) const
Returns true, if the specified attribute is present.
const Type & get() const
Definition: helper.hxx:185
bool mbSignatureLineCanAddComment
Definition: vmlshape.hxx:224
OptValue< Int32Pair > moCoordPos
Top-left position of coordinate system for children scaling.
Definition: vmlshape.hxx:67
sal_Int32 mnDropStyle
Drop down box style (read-only or editable).
Definition: vmlshape.hxx:181
sal_Int32 mnVTEdit
Data type of the textbox.
Definition: vmlshape.hxx:189
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
Will be called to create a context handler for the passed element.
sal_Int32 mnMax
Maximum value of spin buttons and scroll bars.
Definition: vmlshape.hxx:185
sal_Int16 mnBlacklevel
The image brightness, on a 0..0x10000 scale.
Definition: vmlshape.hxx:120
XML_TOKEN_INVALID
StrokeModel maStrokeModel
Border line formatting.
Definition: vmlshape.hxx:94
bool mbVisible
True = cell note is visible.
Definition: vmlshape.hxx:191
B2IRange fround(const B2DRange &rRange)
OUString maHeightRelative
To what the height is relative.
Definition: vmlshape.hxx:84
OUString maHyperlink
The hyperlink assigned to the shape.
Definition: vmlshape.hxx:226
OptValue< OUString > moBitmapPath
Path to fill bitmap fragment.
OUString maAnchor
Cell anchor as comma-separated string.
Definition: vmlshape.hxx:169
sal_Int32 mnSelType
Listbox selection type.
Definition: vmlshape.hxx:188
Contains information about a form control embedded in a draw page.
Definition: vmldrawing.hxx:78
OptValue< OUString > moWrapAnchorY
The base object from which our vertical positioning should be calculated.
Definition: vmlshape.hxx:102
bool mbVisible
Visible or Hidden.
Definition: vmlshape.hxx:88
OUString maAdjustments
Shape adjustment values.
Definition: vmlshape.hxx:92
::std::pair< double, double > DoublePair
RectangleShapeContext(::oox::core::ContextHandler2Helper const &rParent, const AttributeList &rAttribs, const std::shared_ptr< RectangleShape > &pShape)
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
Will be called to create a context handler for the passed element.
OptValue< double > moOpacity2
End color opacity of gradient.
OOX_DLLPUBLIC bool separatePair(OUString &orValue1, OUString &orValue2, const OUString &rValue, sal_Unicode cSep)
Returns two values contained in rValue separated by cSep.
ShapeTypeModel & getTypeModel()
Returns read/write access to the shape template model structure.
Definition: vmlshape.hxx:137
Container that holds a list of shapes and shape templates.
void setPoints(const OUString &rPoints)
Processes the 'points' attribute.
#define ESCHER_ShpInst_TextBox
OptValue< sal_Int32 > moLineStyle
Line style (single, double, ...).
sal_Int32 mnTextVAlign
Vertical text alignment.
Definition: vmlshape.hxx:177
OptValue< DoublePair > moFocusPos
Rectangular gradient focus position of second color.
OUString maControl1
Bezier control point 1.
Definition: vmlshape.hxx:214
OUString maPositionHorizontalRelative
The X position is relative to this.
Definition: vmlshape.hxx:77
ShapeContext(::oox::core::ContextHandler2Helper const &rParent, const std::shared_ptr< ShapeBase > &pShape, const AttributeList &rAttribs)
sal_Int32 mnGain
An adjustment for the intensity of all colors, i.e. contrast, on a 0..0x10000 scale.
Definition: vmlshape.hxx:117
bool mbTextContentShape
Whether this control shape will be imported to Writer or not (has AnchorType property or not)...
Definition: vmldrawing.hxx:83
OptValue< double > moOpacity
Solid line color opacity.
Drawing & getDrawing()
Returns the drawing this shape container is part of.
sal_Int32 mnInc
Small increment of spin buttons and scroll bars.
Definition: vmlshape.hxx:186
OUString maPositionVerticalRelative
The Y position is relative to this.
Definition: vmlshape.hxx:78
static sal_Int32 decodeToken(std::u16string_view rValue)
Returns the XML token identifier from the passed string.
OptValue< OUString > moColor
Solid line color.
StrokeArrowModel maEndArrow
End line arrow style.
OptValue< sal_Int32 > moArrowWidth
OptValue< DoublePair > moFocusSize
Rectangular gradient focus size of second color.
void assignIfUsed(const OptValue &rValue)
Definition: helper.hxx:196
::oox::core::XmlFilterBase & getFilter() const
Returns the filter object that imports/exports this VML drawing.
Definition: vmldrawing.hxx:104
A polygon shape object.
Definition: vmlshape.hxx:362
ClientData & createClientData()
Creates and returns a new shape client data structure.
Definition: vmlshape.cxx:278
OUString maRotation
Rotation of the shape, in degrees.
Definition: vmlshape.hxx:85
OUString maLegacyDiagramPath
Legacy Diagram Fragment Path.
Definition: vmlshape.hxx:211
bool mbMultiLine
True = textbox allows line breaks.
Definition: vmlshape.hxx:195
OptValue< OUString > moWeight
Line width.
sal_Int32 getCurrentElement() const
Returns the identifier of the currently processed element.
std::shared_ptr< ShapeT > createShape()
Creates and returns a new shape object of the specified type.
OptValue< OUString > moWrapAnchorX
The base object from which our horizontal positioning should be calculated.
Definition: vmlshape.hxx:101
OUString maSignatureLineSuggestedSignerTitle
Definition: vmlshape.hxx:220
float u
OUString maFlip
Flip type of the shape (can be "x" or "y").
Definition: vmlshape.hxx:86
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
Will be called to create a context handler for the passed element.
OptValue< OUString > moWrapSide
On which side to wrap the text around the object.
Definition: vmlshape.hxx:104
void setStyle(const OUString &rStyle)
Processes the 'style' attribute.
A group shape that extends the basic shape by a container of child shapes.
Definition: vmlshape.hxx:441
OUString maName
Programmatical name of the form control.
Definition: vmldrawing.hxx:82
OUString getFragmentPathFromRelId(const OUString &rRelId) const
Returns the full fragment path for the passed relation identifier.
bool mbSignatureLineShowSignDate
Definition: vmlshape.hxx:223
bool mbNo3D2
True = flat style, false = 3D style (listboxes and dropdowns).
Definition: vmlshape.hxx:194
ShadowModel maShadowModel
Shape shadow formatting.
Definition: vmlshape.hxx:96
sal_Int32 mnChecked
State for checkboxes and option buttons.
Definition: vmlshape.hxx:180
OUString maArcsize
round rectangles arc size
Definition: vmlshape.hxx:90
OUString maFragmentPath
Path to the fragment describing the form control properties.
Definition: vmldrawing.hxx:81
ClientDataContext(::oox::core::ContextHandler2Helper const &rParent, ClientData &rClientData, const AttributeList &rAttribs)
void setHyperlink(const OUString &rHyperlink)
Processes the 'href' attribute.
bool mbHasShadow
Is a v:shadow element seen?
Provides access to attribute values of an element.
bool isRootElement() const
Returns true, if the element currently processed is the root element of the context or fragment handl...
OUString maSignatureLineSigningInstructions
Definition: vmlshape.hxx:222
A simple shape object based on a specific UNO shape service.
Definition: vmlshape.hxx:309
OptValue< OUString > moCropTop
Specifies how much to crop the image from the top down as a fraction of picture size.
Definition: vmlshape.hxx:113
OUString maWrapDistanceRight
Distance from the right side of the shape to the text that wraps around it.
Definition: vmlshape.hxx:107
OUString maWidth
Width of the shape bounding box (number with unit).
Definition: vmlshape.hxx:73
A complex shape object.
Definition: vmlshape.hxx:426
OptValue< OUString > moString
Specifies the string of the textpath.
OptValue< OUString > moGraphicPath
Path to a graphic for this shape.
Definition: vmlshape.hxx:99
OUString maWrapStyle
Wrapping mode for text.
Definition: vmlshape.hxx:89
OUString maLeft
X position of the shape bounding box (number with unit).
Definition: vmlshape.hxx:71
OptValue< double > moFocus
Linear gradient focus of second color.
OptValue< OUString > moCropBottom
Specifies the how much to crop the image from the bottom up as a fraction of picture size...
Definition: vmlshape.hxx:110
OUString maShapeId
Shape identifier for shape lookup.
Definition: vmldrawing.hxx:80
OUString maFrom
Start point for line shape.
Definition: vmlshape.hxx:212
bool mbPrintObject
True = print the object.
Definition: vmlshape.hxx:190
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
Will be called to create a context handler for the passed element.
OUString maWrapDistanceTop
Distance from the top of the shape to the text that wraps around it.
Definition: vmlshape.hxx:108
ShapeContainer * getContainer() const
Definition: vmlshape.cxx:507
OUString maControl2
Bezier control point 2.
Definition: vmlshape.hxx:215
sal_Int32 mnVal
Current value of spin buttons and scroll bars.
Definition: vmlshape.hxx:183
void setControl2(const OUString &rPoints)
Processes the 'control2' attribute.
OptValue< OUString > moWrapType
How to wrap the text around the object.
Definition: vmlshape.hxx:103
OUString aName
OOX_DLLPUBLIC sal_Int32 decodeMeasureToTwip(const GraphicHelper &rGraphicHelper, const OUString &rValue, sal_Int32 nRefValue, bool bPixelX, bool bDefaultAsPixel)
Converts the passed VML measure string to Twip.
OptValue< OUString > moColor
Solid fill color.
::rtl::Reference< ContextHandler > ContextHandlerRef
void setTo(const OUString &rPoints)
Processes the 'to' attribute.
OUString maMarginLeft
X position of the shape bounding box to shape anchor (number with unit).
Definition: vmlshape.hxx:75
void setFrom(const OUString &rPoints)
Processes the 'from' attribute.
Page
OUString maFmlaGroup
Link to value cell associated to a group of option buttons.
Definition: vmlshape.hxx:174
OUString maSignatureLineSuggestedSignerEmail
Definition: vmlshape.hxx:221
const char * name
Represents the collection of VML shapes for a complete draw page.
Definition: vmldrawing.hxx:93
OUString maShapeId
Unique identifier of the shape.
Definition: vmlshape.hxx:62
An oval shape object.
Definition: vmlshape.hxx:354
OptValue< bool > moFilled
Shape fill on/off.
OUString maWrapDistanceBottom
Distance from the bottom of the shape to the text that wraps around it.
Definition: vmlshape.hxx:109
OptValue< Int32Pair > moCoordSize
Size of coordinate system for children scaling.
Definition: vmlshape.hxx:68
A rectangular shape object.
Definition: vmlshape.hxx:340
sal_Int32 mnTextHAlign
Horizontal text alignment.
Definition: vmlshape.hxx:176
void registerControl(const ControlInfo &rControl)
Registers the passed embedded form control.
Definition: vmldrawing.cxx:134
void registerBlockId(sal_Int32 nBlockId)
Registers a block of shape identifiers reserved by this drawing.
Definition: vmldrawing.cxx:115
void setControl1(const OUString &rPoints)
Processes the 'control1' attribute.
OUString maVTextAnchor
How the text inside the shape is anchored vertically.
Definition: vmlshape.hxx:105
sal_Int32 nLength
OptValue< bool > moShadowOn
Is the element turned on?
OOX_DLLPUBLIC double decodePercent(const OUString &rValue, double fDefValue)
Converts the passed VML percentage measure string to a normalized floating-point value.
OptValue< bool > moRotate
True = rotate gradient/bitmap with shape.
FillModel maFillModel
Shape fill formatting.
Definition: vmlshape.hxx:95
OUString maPosition
Position type of the shape.
Definition: vmlshape.hxx:69
OptValue< sal_Int32 > moJoinStyle
Type of line join.
::std::pair< sal_Int32, sal_Int32 > Int32Pair
Helper class that provides a context stack.
bool has() const
Definition: helper.hxx:181
OUString maTo
End point for line shape.
Definition: vmlshape.hxx:213
OptValue< OUString > moOffset
Specifies the shadow's offset from the shape's location.
OptValue< OUString > moCropLeft
Specifies how much to crop the image from the left in as a fraction of picture size.
Definition: vmlshape.hxx:111
OUString maShapeName
Name of the shape, if present.
Definition: vmlshape.hxx:64
OUString maPositionHorizontal
The X position orientation (default: absolute).
Definition: vmlshape.hxx:79
tuple group
std::shared_ptr< osl::Mutex > const & lock()
bool mbAutoHeight
If true, the height value is a minimum value (mostly used for textboxes)
Definition: vmlshape.hxx:87
OUString maWidthPercent
The width in percents of the WidthRelative.
Definition: vmlshape.hxx:81
void setVmlPath(const OUString &rPath)
Processes the 'path' attribute.
sal_Int32 mnObjType
Type of the shape.
Definition: vmlshape.hxx:175
OptValue< sal_Int32 > getToken(sal_Int32 nAttrToken) const
Returns the token identifier of the value of the specified attribute.
OptValue< OUString > moCropRight
Specifies how much to crop the image from the right in as a fraction of picture size.
Definition: vmlshape.hxx:112
const Drawing & getDrawing() const
Definition: vmlshape.hxx:148
OptValue< sal_Int32 > moEndCap
Type of line end cap.
TextpathModel maTextpathModel
Shape textpath formatting.
Definition: vmlshape.hxx:97
GroupShapeContext(::oox::core::ContextHandler2Helper const &rParent, const std::shared_ptr< GroupShape > &pShape, const AttributeList &rAttribs)
PointVector maPoints
Points for the polyline shape.
Definition: vmlshape.hxx:208