1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: customshapegeometry.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "oox/drawingml/customshapegeometry.hxx"
33 #include <com/sun/star/xml/sax/FastToken.hpp>
34 #include <comphelper/stl_types.hxx>
37 #include "oox/helper/helper.hxx"
38 #include "oox/helper/propertymap.hxx"
39 #include "oox/core/namespaces.hxx"
42 using ::rtl::OUString
;
43 using namespace ::oox::core
;
44 using namespace ::com::sun::star::uno
;
45 using namespace ::com::sun::star::xml::sax
;
47 namespace oox
{ namespace drawingml
{
70 struct FormularCommandNameTable
75 static FormularCommandNameTable pFormularCommandNameTable
[] =
78 { "+-", FC_PLUSMINUS
},
80 { "ifelse", FC_IFELSE
},
96 typedef std::hash_map
< rtl::OUString
, FormularCommand
, comphelper::UStringHash
, comphelper::UStringEqual
> FormulaCommandHMap
;
98 static const FormulaCommandHMap
* pCommandHashMap
;
100 // ---------------------------------------------------------------------
102 class AdjustmentValueContext
: public ContextHandler
105 AdjustmentValueContext( ContextHandler
& rParent
, CustomShapeProperties
& rCustomShapeProperties
);
106 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XFastContextHandler
> SAL_CALL
createFastChildContext( ::sal_Int32 aElementToken
, const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XFastAttributeList
>& xAttribs
) throw (::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
);
109 CustomShapeProperties
& mrCustomShapeProperties
;
112 AdjustmentValueContext::AdjustmentValueContext( ContextHandler
& rParent
, CustomShapeProperties
& rCustomShapeProperties
)
113 : ContextHandler( rParent
)
114 , mrCustomShapeProperties( rCustomShapeProperties
)
118 static rtl::OUString
convertToOOEquation( const rtl::OUString
& rSource
)
120 if ( !pCommandHashMap
)
122 FormulaCommandHMap
* pHM
= new FormulaCommandHMap();
123 for( sal_Int32 i
= 0; i
< FC_LAST
; i
++ )
124 (*pHM
)[ OUString::createFromAscii( pFormularCommandNameTable
[ i
].pS
) ] = pFormularCommandNameTable
[ i
].pE
;
125 pCommandHashMap
= pHM
;
128 std::vector
< rtl::OUString
> aTokens
;
129 sal_Int32 nIndex
= 0;
132 rtl::OUString
aToken( rSource
.getToken( 0, ' ', nIndex
) );
133 if ( aToken
.getLength() )
134 aTokens
.push_back( aToken
);
136 while ( nIndex
>= 0 );
138 rtl::OUString aEquation
;
139 if ( aTokens
.size() )
141 const FormulaCommandHMap::const_iterator
aIter( pCommandHashMap
->find( aTokens
[ 0 ] ) );
142 if ( aIter
!= pCommandHashMap
->end() )
144 switch( aIter
->second
)
171 Reference
< XFastContextHandler
> AdjustmentValueContext::createFastChildContext( sal_Int32 aElementToken
, const Reference
< XFastAttributeList
>& xAttribs
) throw (SAXException
, RuntimeException
)
173 if ( aElementToken
== ( NMSP_DRAWINGML
| XML_gd
) ) // CT_GeomGuide
175 CustomShapeGuide aGuide
;
176 aGuide
.maName
= xAttribs
->getOptionalValue( XML_name
);
177 aGuide
.maFormula
= convertToOOEquation( xAttribs
->getOptionalValue( XML_fmla
) );
178 std::vector
< CustomShapeGuide
>& rAdjustmentValues( mrCustomShapeProperties
.getAdjustmentValues() );
179 rAdjustmentValues
.push_back( aGuide
);
184 // ---------------------------------------------------------------------
186 OUString
GetShapeType( sal_Int32 nType
)
191 case XML_lineInv
: // TODO
193 static const OUString sLine
= CREATE_OUSTRING( "mso-spt20" );
197 static const OUString sTriangle
= CREATE_OUSTRING( "isosceles-triangle" );
200 case XML_rtTriangle
: {
201 static const OUString sRtTriangle
= CREATE_OUSTRING( "right-triangle" );
205 static const OUString sRectangle
= CREATE_OUSTRING( "rectangle" );
209 static const OUString sDiamond
= CREATE_OUSTRING( "diamond" );
212 case XML_parallelogram
: {
213 static const OUString sParallelogram
= CREATE_OUSTRING( "parallelogram" );
214 sType
= sParallelogram
;
216 case XML_nonIsoscelesTrapezoid
: // TODO
217 case XML_trapezoid
: {
218 static const OUString sTrapezoid
= CREATE_OUSTRING( "trapezoid" );
222 static const OUString sPentagon
= CREATE_OUSTRING( "pentagon" );
225 case XML_heptagon
: // TODO
227 static const OUString sHexagon
= CREATE_OUSTRING( "hexagon" );
230 case XML_decagon
: // TODO
231 case XML_dodecagon
: // TODO
233 static const OUString sOctagon
= CREATE_OUSTRING( "octagon" );
237 static const OUString sStar4
= CREATE_OUSTRING( "star4" );
240 case XML_star6
: // TODO
241 case XML_star7
: // TODO
243 static const OUString sStar5
= CREATE_OUSTRING( "star5" );
246 case XML_star10
: // TODO
247 case XML_star12
: // TODO
248 case XML_star16
: // TODO
250 static const OUString sStar8
= CREATE_OUSTRING( "star8" );
253 case XML_star32
: // TODO
255 static const OUString sStar24
= CREATE_OUSTRING( "star24" );
258 case XML_round1Rect
: // TODO
259 case XML_round2SameRect
: // TODO
260 case XML_round2DiagRect
: // TODO
261 case XML_snipRoundRect
: // TODO
262 case XML_snip1Rect
: // TODO
263 case XML_snip2SameRect
: // TODO
264 case XML_snip2DiagRect
: // TODO
265 case XML_roundRect
: {
266 static const OUString sRoundRect
= CREATE_OUSTRING( "round-rectangle" );
270 static const OUString sPlaque
= CREATE_OUSTRING( "mso-spt21" );
273 case XML_teardrop
: // TODO
275 static const OUString sEllipse
= CREATE_OUSTRING( "ellipse" );
278 case XML_homePlate
: {
279 static const OUString sHomePlate
= CREATE_OUSTRING( "pentagon-right" );
283 static const OUString sChevron
= CREATE_OUSTRING( "chevron" );
286 case XML_pieWedge
: // TODO
287 case XML_pie
: // TODO
289 static const OUString sBlockArc
= CREATE_OUSTRING( "block-arc" );
293 static const OUString sDonut
= CREATE_OUSTRING( "ring" );
296 case XML_noSmoking
: {
297 static const OUString sNoSmoking
= CREATE_OUSTRING( "forbidden" );
300 case XML_rightArrow
: {
301 static const OUString sRightArrow
= CREATE_OUSTRING( "right-arrow" );
304 case XML_leftArrow
: {
305 static const OUString sLeftArrow
= CREATE_OUSTRING( "left-arrow" );
309 static const OUString sUpArrow
= CREATE_OUSTRING( "up-arrow" );
312 case XML_downArrow
: {
313 static const OUString sDownArrow
= CREATE_OUSTRING( "down-arrow" );
316 case XML_stripedRightArrow
: {
317 static const OUString sStripedRightArrow
= CREATE_OUSTRING( "striped-right-arrow" );
318 sType
= sStripedRightArrow
;
320 case XML_notchedRightArrow
: {
321 static const OUString sNotchedRightArrow
= CREATE_OUSTRING( "notched-right-arrow" );
322 sType
= sNotchedRightArrow
;
324 case XML_bentUpArrow
: {
325 static const OUString sBentUpArrow
= CREATE_OUSTRING( "mso-spt90" );
326 sType
= sBentUpArrow
;
328 case XML_leftRightArrow
: {
329 static const OUString sLeftRightArrow
= CREATE_OUSTRING( "left-right-arrow" );
330 sType
= sLeftRightArrow
;
332 case XML_upDownArrow
: {
333 static const OUString sUpDownArrow
= CREATE_OUSTRING( "up-down-arrow" );
334 sType
= sUpDownArrow
;
336 case XML_leftUpArrow
: {
337 static const OUString sLeftUpArrow
= CREATE_OUSTRING( "mso-spt89" );
338 sType
= sLeftUpArrow
;
340 case XML_leftRightUpArrow
: {
341 static const OUString sLeftRightUpArrow
= CREATE_OUSTRING( "mso-spt182" );
342 sType
= sLeftRightUpArrow
;
344 case XML_quadArrow
: {
345 static const OUString sQuadArrow
= CREATE_OUSTRING( "quad-arrow" );
348 case XML_leftArrowCallout
: {
349 static const OUString sLeftArrowCallout
= CREATE_OUSTRING( "left-arrow-callout" );
350 sType
= sLeftArrowCallout
;
352 case XML_rightArrowCallout
: {
353 static const OUString sRightArrowCallout
= CREATE_OUSTRING( "right-arrow-callout" );
354 sType
= sRightArrowCallout
;
356 case XML_upArrowCallout
: {
357 static const OUString sUpArrowCallout
= CREATE_OUSTRING( "up-arrow-callout" );
358 sType
= sUpArrowCallout
;
360 case XML_downArrowCallout
: {
361 static const OUString sDownArrowCallout
= CREATE_OUSTRING( "down-arrow-callout" );
362 sType
= sDownArrowCallout
;
364 case XML_leftRightArrowCallout
: {
365 static const OUString sLeftRightArrowCallout
= CREATE_OUSTRING( "left-right-arrow-callout" );
366 sType
= sLeftRightArrowCallout
;
368 case XML_upDownArrowCallout
: {
369 static const OUString sUpDownArrowCallout
= CREATE_OUSTRING( "up-down-arrow-callout" );
370 sType
= sUpDownArrowCallout
;
372 case XML_quadArrowCallout
: {
373 static const OUString sQuadArrowCallout
= CREATE_OUSTRING( "quad-arrow-callout" );
374 sType
= sQuadArrowCallout
;
376 case XML_bentArrow
: {
377 static const OUString sBentArrow
= CREATE_OUSTRING( "mso-spt91" );
380 case XML_uturnArrow
: {
381 static const OUString sUTurnArrow
= CREATE_OUSTRING( "mso-spt101" );
384 case XML_leftCircularArrow
: // TODO
385 case XML_leftRightCircularArrow
: // TODO
386 case XML_circularArrow
: {
387 static const OUString sCircularArrow
= CREATE_OUSTRING( "circular-arrow" );
388 sType
= sCircularArrow
;
390 case XML_curvedRightArrow
: {
391 static const OUString sCurvedRightArrow
= CREATE_OUSTRING( "mso-spt102" );
392 sType
= sCurvedRightArrow
;
394 case XML_curvedLeftArrow
: {
395 static const OUString sCurvedLeftArrow
= CREATE_OUSTRING( "mso-spt103" );
396 sType
= sCurvedLeftArrow
;
398 case XML_curvedUpArrow
: {
399 static const OUString sCurvedUpArrow
= CREATE_OUSTRING( "mso-spt104" );
400 sType
= sCurvedUpArrow
;
402 case XML_swooshArrow
: // TODO
403 case XML_curvedDownArrow
: {
404 static const OUString sCurvedDownArrow
= CREATE_OUSTRING( "mso-spt105" );
405 sType
= sCurvedDownArrow
;
408 static const OUString sCube
= CREATE_OUSTRING( "cube" );
412 static const OUString sCan
= CREATE_OUSTRING( "can" );
415 case XML_lightningBolt
: {
416 static const OUString sLightningBolt
= CREATE_OUSTRING( "lightning" );
417 sType
= sLightningBolt
;
420 static const OUString sHeart
= CREATE_OUSTRING( "heart" );
424 static const OUString sSun
= CREATE_OUSTRING( "sun" );
428 static const OUString sMoon
= CREATE_OUSTRING( "moon" );
431 case XML_smileyFace
: {
432 static const OUString sSmileyFace
= CREATE_OUSTRING( "smiley" );
435 case XML_irregularSeal1
: {
436 static const OUString sIrregularSeal1
= CREATE_OUSTRING( "mso-spt71" );
437 sType
= sIrregularSeal1
;
439 case XML_irregularSeal2
: {
440 static const OUString sIrregularSeal2
= CREATE_OUSTRING( "bang" );
441 sType
= sIrregularSeal2
;
443 case XML_foldedCorner
: {
444 static const OUString sFoldedCorner
= CREATE_OUSTRING( "paper" );
445 sType
= sFoldedCorner
;
448 static const OUString sBevel
= CREATE_OUSTRING( "quad-bevel" );
451 case XML_halfFrame
: // TODO
452 case XML_corner
: // TODO
453 case XML_diagStripe
: // TODO
454 case XML_chord
: // TODO
456 static const OUString sFrame
= CREATE_OUSTRING( "mso-spt75" );
460 static const OUString sArc
= CREATE_OUSTRING( "mso-spt19" );
463 case XML_leftBracket
: {
464 static const OUString sLeftBracket
= CREATE_OUSTRING( "left-bracket" );
465 sType
= sLeftBracket
;
467 case XML_rightBracket
: {
468 static const OUString sRightBracket
= CREATE_OUSTRING( "right-bracket" );
469 sType
= sRightBracket
;
471 case XML_leftBrace
: {
472 static const OUString sLeftBrace
= CREATE_OUSTRING( "left-brace" );
475 case XML_rightBrace
: {
476 static const OUString sRightBrace
= CREATE_OUSTRING( "right-brace" );
479 case XML_bracketPair
: {
480 static const OUString sBracketPair
= CREATE_OUSTRING( "bracket-pair" );
481 sType
= sBracketPair
;
483 case XML_bracePair
: {
484 static const OUString sBracePair
= CREATE_OUSTRING( "brace-pair" );
487 case XML_straightConnector1
: {
488 static const OUString sStraightConnector1
= CREATE_OUSTRING( "mso-spt32" );
489 sType
= sStraightConnector1
;
491 case XML_bentConnector2
: {
492 static const OUString sBentConnector2
= CREATE_OUSTRING( "mso-spt33" );
493 sType
= sBentConnector2
;
495 case XML_bentConnector3
: {
496 static const OUString sBentConnector3
= CREATE_OUSTRING( "mso-spt34" );
497 sType
= sBentConnector3
;
499 case XML_bentConnector4
: {
500 static const OUString sBentConnector4
= CREATE_OUSTRING( "mso-spt35" );
501 sType
= sBentConnector4
;
503 case XML_bentConnector5
: {
504 static const OUString sBentConnector5
= CREATE_OUSTRING( "mso-spt36" );
505 sType
= sBentConnector5
;
507 case XML_curvedConnector2
: {
508 static const OUString sCurvedConnector2
= CREATE_OUSTRING( "mso-spt37" );
509 sType
= sCurvedConnector2
;
511 case XML_curvedConnector3
: {
512 static const OUString sCurvedConnector3
= CREATE_OUSTRING( "mso-spt38" );
513 sType
= sCurvedConnector3
;
515 case XML_curvedConnector4
: {
516 static const OUString sCurvedConnector4
= CREATE_OUSTRING( "mso-spt39" );
517 sType
= sCurvedConnector4
;
519 case XML_curvedConnector5
: {
520 static const OUString sCurvedConnector5
= CREATE_OUSTRING( "mso-spt40" );
521 sType
= sCurvedConnector5
;
524 static const OUString sCallout1
= CREATE_OUSTRING( "mso-spt41" );
528 static const OUString sCallout2
= CREATE_OUSTRING( "mso-spt42" );
532 static const OUString sCallout3
= CREATE_OUSTRING( "mso-spt43" );
535 case XML_accentCallout1
: {
536 static const OUString sAccentCallout1
= CREATE_OUSTRING( "mso-spt44" );
537 sType
= sAccentCallout1
;
539 case XML_accentCallout2
: {
540 static const OUString sAccentCallout2
= CREATE_OUSTRING( "mso-spt45" );
541 sType
= sAccentCallout2
;
543 case XML_accentCallout3
: {
544 static const OUString sAccentCallout3
= CREATE_OUSTRING( "mso-spt46" );
545 sType
= sAccentCallout3
;
547 case XML_borderCallout1
: {
548 static const OUString sBorderCallout1
= CREATE_OUSTRING( "line-callout-1" );
549 sType
= sBorderCallout1
;
551 case XML_borderCallout2
: {
552 static const OUString sBorderCallout2
= CREATE_OUSTRING( "line-callout-2" );
553 sType
= sBorderCallout2
;
555 case XML_borderCallout3
: {
556 static const OUString sBorderCallout3
= CREATE_OUSTRING( "mso-spt49" );
557 sType
= sBorderCallout3
;
559 case XML_accentBorderCallout1
: {
560 static const OUString sAccentBorderCallout1
= CREATE_OUSTRING( "mso-spt50" );
561 sType
= sAccentBorderCallout1
;
563 case XML_accentBorderCallout2
: {
564 static const OUString sAccentBorderCallout2
= CREATE_OUSTRING( "mso-spt51" );
565 sType
= sAccentBorderCallout2
;
567 case XML_accentBorderCallout3
: {
568 static const OUString sAccentBorderCallout3
= CREATE_OUSTRING( "mso-spt52" );
569 sType
= sAccentBorderCallout3
;
571 case XML_wedgeRectCallout
: {
572 static const OUString sWedgeRectCallout
= CREATE_OUSTRING( "rectangular-callout" );
573 sType
= sWedgeRectCallout
;
575 case XML_wedgeRoundRectCallout
: {
576 static const OUString sWedgeRoundRectCallout
= CREATE_OUSTRING( "round-rectangular-callout" );
577 sType
= sWedgeRoundRectCallout
;
579 case XML_wedgeEllipseCallout
: {
580 static const OUString sWedgeEllipseCallout
= CREATE_OUSTRING( "round-callout" );
581 sType
= sWedgeEllipseCallout
;
583 case XML_cloud
: // TODO
584 case XML_cloudCallout
: {
585 static const OUString sCloudCallout
= CREATE_OUSTRING( "cloud-callout" );
586 sType
= sCloudCallout
;
589 static const OUString sRibbon
= CREATE_OUSTRING( "mso-spt53" );
593 static const OUString sRibbon2
= CREATE_OUSTRING( "mso-spt54" );
596 case XML_ellipseRibbon
: {
597 static const OUString sEllipseRibbon
= CREATE_OUSTRING( "mso-spt107" );
598 sType
= sEllipseRibbon
;
600 case XML_leftRightRibbon
: // TODO
601 case XML_ellipseRibbon2
: {
602 static const OUString sEllipseRibbon2
= CREATE_OUSTRING( "mso-spt108" );
603 sType
= sEllipseRibbon2
;
605 case XML_verticalScroll
: {
606 static const OUString sVerticalScroll
= CREATE_OUSTRING( "vertical-scroll" );
607 sType
= sVerticalScroll
;
609 case XML_horizontalScroll
: {
610 static const OUString sHorizontalScroll
= CREATE_OUSTRING( "horizontal-scroll" );
611 sType
= sHorizontalScroll
;
614 static const OUString sWave
= CREATE_OUSTRING( "mso-spt64" );
617 case XML_doubleWave
: {
618 static const OUString sDoubleWave
= CREATE_OUSTRING( "mso-spt188" );
622 static const OUString sPlus
= CREATE_OUSTRING( "cross" );
625 case XML_flowChartProcess
: {
626 static const OUString sFlowChartProcess
= CREATE_OUSTRING( "flowchart-process" );
627 sType
= sFlowChartProcess
;
629 case XML_flowChartDecision
: {
630 static const OUString sFlowChartDecision
= CREATE_OUSTRING( "flowchart-decision" );
631 sType
= sFlowChartDecision
;
633 case XML_flowChartInputOutput
: {
634 static const OUString sFlowChartInputOutput
= CREATE_OUSTRING( "flowchart-data" );
635 sType
= sFlowChartInputOutput
;
637 case XML_flowChartPredefinedProcess
: {
638 static const OUString sFlowChartPredefinedProcess
= CREATE_OUSTRING( "flowchart-predefined-process" );
639 sType
= sFlowChartPredefinedProcess
;
641 case XML_flowChartInternalStorage
: {
642 static const OUString sFlowChartInternalStorage
= CREATE_OUSTRING( "flowchart-internal-storage" );
643 sType
= sFlowChartInternalStorage
;
645 case XML_flowChartDocument
: {
646 static const OUString sFlowChartDocument
= CREATE_OUSTRING( "flowchart-document" );
647 sType
= sFlowChartDocument
;
649 case XML_flowChartMultidocument
: {
650 static const OUString sFlowChartMultidocument
= CREATE_OUSTRING( "flowchart-multidocument" );
651 sType
= sFlowChartMultidocument
;
653 case XML_flowChartTerminator
: {
654 static const OUString sFlowChartTerminator
= CREATE_OUSTRING( "flowchart-terminator" );
655 sType
= sFlowChartTerminator
;
657 case XML_flowChartPreparation
: {
658 static const OUString sFlowChartPreparation
= CREATE_OUSTRING( "flowchart-preparation" );
659 sType
= sFlowChartPreparation
;
661 case XML_flowChartManualInput
: {
662 static const OUString sFlowChartManualInput
= CREATE_OUSTRING( "flowchart-manual-input" );
663 sType
= sFlowChartManualInput
;
665 case XML_flowChartManualOperation
: {
666 static const OUString sFlowChartManualOperation
= CREATE_OUSTRING( "flowchart-manual-operation" );
667 sType
= sFlowChartManualOperation
;
669 case XML_flowChartConnector
: {
670 static const OUString sFlowChartConnector
= CREATE_OUSTRING( "flowchart-connector" );
671 sType
= sFlowChartConnector
;
673 case XML_flowChartPunchedCard
: {
674 static const OUString sFlowChartPunchedCard
= CREATE_OUSTRING( "flowchart-card" );
675 sType
= sFlowChartPunchedCard
;
677 case XML_flowChartPunchedTape
: {
678 static const OUString sFlowChartPunchedTape
= CREATE_OUSTRING( "flowchart-punched-tape" );
679 sType
= sFlowChartPunchedTape
;
681 case XML_flowChartSummingJunction
: {
682 static const OUString sFlowChartSummingJunction
= CREATE_OUSTRING( "flowchart-summing-junction" );
683 sType
= sFlowChartSummingJunction
;
685 case XML_flowChartOr
: {
686 static const OUString sFlowChartOr
= CREATE_OUSTRING( "flowchart-or" );
687 sType
= sFlowChartOr
;
689 case XML_flowChartCollate
: {
690 static const OUString sFlowChartCollate
= CREATE_OUSTRING( "flowchart-collate" );
691 sType
= sFlowChartCollate
;
693 case XML_flowChartSort
: {
694 static const OUString sFlowChartSort
= CREATE_OUSTRING( "flowchart-sort" );
695 sType
= sFlowChartSort
;
697 case XML_flowChartExtract
: {
698 static const OUString sFlowChartExtract
= CREATE_OUSTRING( "flowchart-extract" );
699 sType
= sFlowChartExtract
;
701 case XML_flowChartMerge
: {
702 static const OUString sFlowChartMerge
= CREATE_OUSTRING( "flowchart-merge" );
703 sType
= sFlowChartMerge
;
705 case XML_flowChartOfflineStorage
: {
706 static const OUString sFlowChartOfflineStorage
= CREATE_OUSTRING( "mso-spt129" );
707 sType
= sFlowChartOfflineStorage
;
709 case XML_flowChartOnlineStorage
: {
710 static const OUString sFlowChartOnlineStorage
= CREATE_OUSTRING( "flowchart-stored-data" );
711 sType
= sFlowChartOnlineStorage
;
713 case XML_flowChartMagneticTape
: {
714 static const OUString sFlowChartMagneticTape
= CREATE_OUSTRING( "flowchart-sequential-access" );
715 sType
= sFlowChartMagneticTape
;
717 case XML_flowChartMagneticDisk
: {
718 static const OUString sFlowChartMagneticDisk
= CREATE_OUSTRING( "flowchart-magnetic-disk" );
719 sType
= sFlowChartMagneticDisk
;
721 case XML_flowChartMagneticDrum
: {
722 static const OUString sFlowChartMagneticDrum
= CREATE_OUSTRING( "flowchart-direct-access-storage" );
723 sType
= sFlowChartMagneticDrum
;
725 case XML_flowChartDisplay
: {
726 static const OUString sFlowChartDisplay
= CREATE_OUSTRING( "flowchart-display" );
727 sType
= sFlowChartDisplay
;
729 case XML_flowChartDelay
: {
730 static const OUString sFlowChartDelay
= CREATE_OUSTRING( "flowchart-delay" );
731 sType
= sFlowChartDelay
;
733 case XML_flowChartAlternateProcess
: {
734 static const OUString sFlowChartAlternateProcess
= CREATE_OUSTRING( "flowchart-alternate-process" );
735 sType
= sFlowChartAlternateProcess
;
737 case XML_flowChartOffpageConnector
: {
738 static const OUString sFlowChartOffpageConnector
= CREATE_OUSTRING( "flowchart-off-page-connector" );
739 sType
= sFlowChartOffpageConnector
;
741 case XML_actionButtonBlank
: {
742 static const OUString sActionButtonBlank
= CREATE_OUSTRING( "mso-spt189" );
743 sType
= sActionButtonBlank
;
745 case XML_actionButtonHome
: {
746 static const OUString sActionButtonHome
= CREATE_OUSTRING( "mso-spt190" );
747 sType
= sActionButtonHome
;
749 case XML_actionButtonHelp
: {
750 static const OUString sActionButtonHelp
= CREATE_OUSTRING( "mso-spt191" );
751 sType
= sActionButtonHelp
;
753 case XML_actionButtonInformation
: {
754 static const OUString sActionButtonInformation
= CREATE_OUSTRING( "mso-spt192" );
755 sType
= sActionButtonInformation
;
757 case XML_actionButtonForwardNext
: {
758 static const OUString sActionButtonForwardNext
= CREATE_OUSTRING( "mso-spt193" );
759 sType
= sActionButtonForwardNext
;
761 case XML_actionButtonBackPrevious
: {
762 static const OUString sActionButtonBackPrevious
= CREATE_OUSTRING( "mso-spt194" );
763 sType
= sActionButtonBackPrevious
;
765 case XML_actionButtonEnd
: {
766 static const OUString sActionButtonEnd
= CREATE_OUSTRING( "mso-spt195" );
767 sType
= sActionButtonEnd
;
769 case XML_actionButtonBeginning
: {
770 static const OUString sActionButtonBeginning
= CREATE_OUSTRING( "mso-spt196" );
771 sType
= sActionButtonBeginning
;
773 case XML_actionButtonReturn
: {
774 static const OUString sActionButtonReturn
= CREATE_OUSTRING( "mso-spt197" );
775 sType
= sActionButtonReturn
;
777 case XML_actionButtonDocument
: {
778 static const OUString sActionButtonDocument
= CREATE_OUSTRING( "mso-spt198" );
779 sType
= sActionButtonDocument
;
781 case XML_actionButtonSound
: {
782 static const OUString sActionButtonSound
= CREATE_OUSTRING( "mso-spt199" );
783 sType
= sActionButtonSound
;
785 case XML_actionButtonMovie
: {
786 static const OUString sActionButtonMovie
= CREATE_OUSTRING( "mso-spt200" );
787 sType
= sActionButtonMovie
;
789 case XML_gear6
: // TODO
790 case XML_gear9
: // TODO
791 case XML_funnel
: // TODO
792 case XML_mathPlus
: // TODO
793 case XML_mathMinus
: // TODO
794 case XML_mathMultiply
: // TODO
795 case XML_mathDivide
: // TODO
796 case XML_mathEqual
: // TODO
797 case XML_mathNotEqual
: // TODO
798 case XML_cornerTabs
: // TODO
799 case XML_squareTabs
: // TODO
800 case XML_plaqueTabs
: // TODO
801 case XML_chartX
: // TODO
802 case XML_chartStar
: // TODO
803 case XML_chartPlus
: { // TODO
804 static const OUString sRectangle
= CREATE_OUSTRING( "rectangle" );
813 static OUString
GetTextShapeType( sal_Int32 nType
)
818 case XML_textNoShape
: // TODO
819 case XML_textPlain
: {
820 static const OUString sTextPlain
= CREATE_OUSTRING( "fontwork-plain-text" );
824 static const OUString sTextStop
= CREATE_OUSTRING( "fontwork-stop" );
827 case XML_textTriangle
: {
828 static const OUString sTextTriangle
= CREATE_OUSTRING( "fontwork-triangle-up" );
829 sType
= sTextTriangle
;
831 case XML_textTriangleInverted
: {
832 static const OUString sTextTriangleInverted
= CREATE_OUSTRING( "fontwork-triangle-down" );
833 sType
= sTextTriangleInverted
;
835 case XML_textChevron
: {
836 static const OUString sTextChevron
= CREATE_OUSTRING( "fontwork-chevron-up" );
837 sType
= sTextChevron
;
839 case XML_textChevronInverted
: {
840 static const OUString sTextChevronInverted
= CREATE_OUSTRING( "fontwork-chevron-down" );
841 sType
= sTextChevronInverted
;
843 case XML_textRingInside
: {
844 static const OUString sTextRingInside
= CREATE_OUSTRING( "mso-spt142" );
845 sType
= sTextRingInside
;
847 case XML_textRingOutside
: {
848 static const OUString sTextRingOutside
= CREATE_OUSTRING( "mso-spt143" );
849 sType
= sTextRingOutside
;
851 case XML_textArchUp
: {
852 static const OUString sTextArchUp
= CREATE_OUSTRING( "fontwork-arch-up-curve" );
855 case XML_textArchDown
: {
856 static const OUString sTextArchDown
= CREATE_OUSTRING( "fontwork-arch-down-curve" );
857 sType
= sTextArchDown
;
859 case XML_textCircle
: {
860 static const OUString sTextCircle
= CREATE_OUSTRING( "fontwork-circle-curve" );
863 case XML_textButton
: {
864 static const OUString sTextButton
= CREATE_OUSTRING( "fontwork-open-circle-curve" );
867 case XML_textArchUpPour
: {
868 static const OUString sTextArchUpPour
= CREATE_OUSTRING( "fontwork-arch-up-pour" );
869 sType
= sTextArchUpPour
;
871 case XML_textArchDownPour
: {
872 static const OUString sTextArchDownPour
= CREATE_OUSTRING( "fontwork-arch-down-pour" );
873 sType
= sTextArchDownPour
;
875 case XML_textCirclePour
: {
876 static const OUString sTextCirclePour
= CREATE_OUSTRING( "fontwork-circle-pour" );
877 sType
= sTextCirclePour
;
879 case XML_textButtonPour
: {
880 static const OUString sTextButtonPour
= CREATE_OUSTRING( "fontwork-open-circle-pour" );
881 sType
= sTextButtonPour
;
883 case XML_textCurveUp
: {
884 static const OUString sTextCurveUp
= CREATE_OUSTRING( "fontwork-curve-up" );
885 sType
= sTextCurveUp
;
887 case XML_textCurveDown
: {
888 static const OUString sTextCurveDown
= CREATE_OUSTRING( "fontwork-curve-down" );
889 sType
= sTextCurveDown
;
891 case XML_textCanUp
: {
892 static const OUString sTextCanUp
= CREATE_OUSTRING( "mso-spt174" );
895 case XML_textCanDown
: {
896 static const OUString sTextCanDown
= CREATE_OUSTRING( "mso-spt175" );
897 sType
= sTextCanDown
;
899 case XML_textWave1
: {
900 static const OUString sTextWave1
= CREATE_OUSTRING( "fontwork-wave" );
903 case XML_textWave2
: {
904 static const OUString sTextWave2
= CREATE_OUSTRING( "mso-spt157" );
907 case XML_textDoubleWave1
: {
908 static const OUString sTextDoubleWave1
= CREATE_OUSTRING( "mso-spt158" );
909 sType
= sTextDoubleWave1
;
911 case XML_textWave4
: {
912 static const OUString sTextWave4
= CREATE_OUSTRING( "mso-spt159" );
915 case XML_textInflate
: {
916 static const OUString sTextInflate
= CREATE_OUSTRING( "fontwork-inflate" );
917 sType
= sTextInflate
;
919 case XML_textDeflate
: {
920 static const OUString sTextDeflate
= CREATE_OUSTRING( "mso-spt161" );
921 sType
= sTextDeflate
;
923 case XML_textInflateBottom
: {
924 static const OUString sTextInflateBottom
= CREATE_OUSTRING( "mso-spt162" );
925 sType
= sTextInflateBottom
;
927 case XML_textDeflateBottom
: {
928 static const OUString sTextDeflateBottom
= CREATE_OUSTRING( "mso-spt163" );
929 sType
= sTextDeflateBottom
;
931 case XML_textInflateTop
: {
932 static const OUString sTextInflateTop
= CREATE_OUSTRING( "mso-spt164" );
933 sType
= sTextInflateTop
;
935 case XML_textDeflateTop
: {
936 static const OUString sTextDeflateTop
= CREATE_OUSTRING( "mso-spt165" );
937 sType
= sTextDeflateTop
;
939 case XML_textDeflateInflate
: {
940 static const OUString sTextDeflateInflate
= CREATE_OUSTRING( "mso-spt166" );
941 sType
= sTextDeflateInflate
;
943 case XML_textDeflateInflateDeflate
: {
944 static const OUString sTextDeflateInflateDeflate
= CREATE_OUSTRING( "mso-spt167" );
945 sType
= sTextDeflateInflateDeflate
;
947 case XML_textFadeRight
: {
948 static const OUString sTextFadeRight
= CREATE_OUSTRING( "fontwork-fade-right" );
949 sType
= sTextFadeRight
;
951 case XML_textFadeLeft
: {
952 static const OUString sTextFadeLeft
= CREATE_OUSTRING( "fontwork-fade-left" );
953 sType
= sTextFadeLeft
;
955 case XML_textFadeUp
: {
956 static const OUString sTextFadeUp
= CREATE_OUSTRING( "fontwork-fade-up" );
959 case XML_textFadeDown
: {
960 static const OUString sTextFadeDown
= CREATE_OUSTRING( "fontwork-fade-down" );
961 sType
= sTextFadeDown
;
963 case XML_textSlantUp
: {
964 static const OUString sTextSlantUp
= CREATE_OUSTRING( "fontwork-slant-up" );
965 sType
= sTextSlantUp
;
967 case XML_textSlantDown
: {
968 static const OUString sTextSlantDown
= CREATE_OUSTRING( "fontwork-slant-down" );
969 sType
= sTextSlantDown
;
971 case XML_textCascadeUp
: {
972 static const OUString sTextCascadeUp
= CREATE_OUSTRING( "fontwork-fade-up-and-right" );
973 sType
= sTextCascadeUp
;
975 case XML_textCascadeDown
: {
976 static const OUString sTextCascadeDown
= CREATE_OUSTRING( "fontwork-fade-up-and-left" );
977 sType
= sTextCascadeDown
;
985 // ---------------------------------------------------------------------
986 // CT_CustomGeometry2D
987 CustomShapeGeometryContext::CustomShapeGeometryContext( ContextHandler
& rParent
, const Reference
< XFastAttributeList
>& /* xAttribs */, CustomShapeProperties
& rCustomShapeProperties
)
988 : ContextHandler( rParent
)
989 , mrCustomShapeProperties( rCustomShapeProperties
)
993 Reference
< XFastContextHandler
> CustomShapeGeometryContext::createFastChildContext( sal_Int32 aElementToken
, const Reference
< XFastAttributeList
>& ) throw (SAXException
, RuntimeException
)
995 switch( aElementToken
)
998 case NMSP_DRAWINGML
|XML_avLst
: // CT_GeomGuideList adjust value list
999 case NMSP_DRAWINGML
|XML_gdLst
: // CT_GeomGuideList guide list
1000 case NMSP_DRAWINGML
|XML_ahLst
: // CT_AdjustHandleList adjust handle list
1001 case NMSP_DRAWINGML
|XML_cxnLst
: // CT_ConnectionSiteList connection site list
1002 case NMSP_DRAWINGML
|XML_rect
: // CT_GeomRectList geometry rect list
1003 case NMSP_DRAWINGML
|XML_pathLst
: // CT_Path2DList 2d path list
1007 Reference
< XFastContextHandler
> xEmpty
;
1011 // ---------------------------------------------------------------------
1012 // CT_PresetGeometry2D
1013 PresetShapeGeometryContext::PresetShapeGeometryContext( ContextHandler
& rParent
, const Reference
< XFastAttributeList
>& xAttribs
, CustomShapeProperties
& rCustomShapeProperties
)
1014 : ContextHandler( rParent
)
1015 , mrCustomShapeProperties( rCustomShapeProperties
)
1017 OUString sShapeType
;
1018 sal_Int32 nShapeType
= xAttribs
->getOptionalValueToken( XML_prst
, FastToken::DONTKNOW
);
1019 if ( nShapeType
!= FastToken::DONTKNOW
)
1020 sShapeType
= GetShapeType( nShapeType
);
1021 OSL_ENSURE( sShapeType
.getLength(), "oox::drawingml::CustomShapeCustomGeometryContext::CustomShapeCustomGeometryContext(), unknown shape type" );
1022 mrCustomShapeProperties
.setShapePresetType( sShapeType
);
1025 Reference
< XFastContextHandler
> PresetShapeGeometryContext::createFastChildContext( sal_Int32 aElementToken
, const Reference
< XFastAttributeList
>& ) throw (SAXException
, RuntimeException
)
1027 if ( aElementToken
== ( NMSP_DRAWINGML
| XML_avLst
) )
1028 return new AdjustmentValueContext( *this, mrCustomShapeProperties
);
1033 // ---------------------------------------------------------------------
1034 // CT_PresetTextShape
1035 PresetTextShapeContext::PresetTextShapeContext( ContextHandler
& rParent
, const Reference
< XFastAttributeList
>& xAttribs
, CustomShapeProperties
& rCustomShapeProperties
)
1036 : ContextHandler( rParent
)
1037 , mrCustomShapeProperties( rCustomShapeProperties
)
1039 OUString sShapeType
;
1040 sal_Int32 nShapeType
= xAttribs
->getOptionalValueToken( XML_prst
, FastToken::DONTKNOW
);
1041 if ( nShapeType
!= FastToken::DONTKNOW
)
1042 sShapeType
= GetTextShapeType( nShapeType
);
1043 OSL_ENSURE( sShapeType
.getLength(), "oox::drawingml::CustomShapeCustomGeometryContext::CustomShapeCustomGeometryContext(), unknown shape type" );
1044 mrCustomShapeProperties
.setShapePresetType( sShapeType
);
1047 Reference
< XFastContextHandler
> PresetTextShapeContext::createFastChildContext( sal_Int32 aElementToken
, const Reference
< XFastAttributeList
>& ) throw (SAXException
, RuntimeException
)
1049 switch( aElementToken
)
1052 case NMSP_DRAWINGML
|XML_avLst
: // CT_GeomGuideList adjust value list
1053 case NMSP_DRAWINGML
|XML_gdLst
: // CT_GeomGuideList guide list
1054 case NMSP_DRAWINGML
|XML_ahLst
: // CT_AdjustHandleList adjust handle list
1055 case NMSP_DRAWINGML
|XML_cxnLst
: // CT_ConnectionSiteList connection site list
1056 case NMSP_DRAWINGML
|XML_rect
: // CT_GeomRectList geometry rect list
1057 case NMSP_DRAWINGML
|XML_pathLst
: // CT_Path2DList 2d path list
1061 Reference
< XFastContextHandler
> xEmpty
;