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"
32 #include "oox/drawingml/customshapeproperties.hxx"
34 #include <com/sun/star/xml/sax/FastToken.hpp>
35 #include <comphelper/stl_types.hxx>
37 #include <basegfx/polygon/b2dpolygon.hxx>
39 #include "oox/helper/helper.hxx"
40 #include "oox/helper/propertymap.hxx"
41 #include "oox/core/namespaces.hxx"
44 using ::rtl::OUString
;
45 using namespace ::basegfx
;
46 using namespace ::oox::core
;
47 using namespace ::com::sun::star::uno
;
48 using namespace ::com::sun::star::xml::sax
;
50 namespace oox
{ namespace drawingml
{
73 struct FormularCommandNameTable
78 static FormularCommandNameTable pFormularCommandNameTable
[] =
81 { "+-", FC_PLUSMINUS
},
83 { "ifelse", FC_IFELSE
},
99 typedef std::hash_map
< rtl::OUString
, FormularCommand
, comphelper::UStringHash
, comphelper::UStringEqual
> FormulaCommandHMap
;
101 static const FormulaCommandHMap
* pCommandHashMap
;
103 // ---------------------------------------------------------------------
105 class AdjustmentValueContext
: public ContextHandler
108 AdjustmentValueContext( ContextHandler
& rParent
, CustomShapeProperties
& rCustomShapeProperties
);
109 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
);
112 CustomShapeProperties
& mrCustomShapeProperties
;
115 AdjustmentValueContext::AdjustmentValueContext( ContextHandler
& rParent
, CustomShapeProperties
& rCustomShapeProperties
)
116 : ContextHandler( rParent
)
117 , mrCustomShapeProperties( rCustomShapeProperties
)
121 static rtl::OUString
convertToOOEquation( const rtl::OUString
& rSource
)
123 if ( !pCommandHashMap
)
125 FormulaCommandHMap
* pHM
= new FormulaCommandHMap();
126 for( sal_Int32 i
= 0; i
< FC_LAST
; i
++ )
127 (*pHM
)[ OUString::createFromAscii( pFormularCommandNameTable
[ i
].pS
) ] = pFormularCommandNameTable
[ i
].pE
;
128 pCommandHashMap
= pHM
;
131 std::vector
< rtl::OUString
> aTokens
;
132 sal_Int32 nIndex
= 0;
135 rtl::OUString
aToken( rSource
.getToken( 0, ' ', nIndex
) );
136 if ( aToken
.getLength() )
137 aTokens
.push_back( aToken
);
139 while ( nIndex
>= 0 );
141 rtl::OUString aEquation
;
142 if ( aTokens
.size() )
144 const FormulaCommandHMap::const_iterator
aIter( pCommandHashMap
->find( aTokens
[ 0 ] ) );
145 if ( aIter
!= pCommandHashMap
->end() )
147 switch( aIter
->second
)
174 Reference
< XFastContextHandler
> AdjustmentValueContext::createFastChildContext( sal_Int32 aElementToken
, const Reference
< XFastAttributeList
>& xAttribs
) throw (SAXException
, RuntimeException
)
176 if ( aElementToken
== ( NMSP_DRAWINGML
| XML_gd
) ) // CT_GeomGuide
178 CustomShapeGuide aGuide
;
179 aGuide
.maName
= xAttribs
->getOptionalValue( XML_name
);
180 aGuide
.maFormula
= convertToOOEquation( xAttribs
->getOptionalValue( XML_fmla
) );
181 std::vector
< CustomShapeGuide
>& rAdjustmentValues( mrCustomShapeProperties
.getAdjustmentValues() );
182 rAdjustmentValues
.push_back( aGuide
);
187 // ---------------------------------------------------------------------
189 class PathListContext
: public ContextHandler
192 PathListContext( ContextHandler
& rParent
, Shape
& rShape
);
193 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
);
194 virtual void SAL_CALL
endFastElement( sal_Int32 aElementToken
) throw (SAXException
, RuntimeException
);
198 sal_Int32 maPointToken
;
199 ::basegfx::B2DPolygon maPolygon
;
202 PathListContext::PathListContext( ContextHandler
& rParent
, Shape
& rShape
)
203 : ContextHandler( rParent
)
208 Reference
< XFastContextHandler
> PathListContext::createFastChildContext( sal_Int32 aElementToken
, const Reference
< XFastAttributeList
>& xAttribs
) throw (SAXException
, RuntimeException
)
210 switch( aElementToken
) {
211 case NMSP_DRAWINGML
| XML_path
:
214 case NMSP_DRAWINGML
| XML_close
:
215 maPolygon
.setClosed( true );
217 case NMSP_DRAWINGML
| XML_pt
:
221 sX
= xAttribs
->getOptionalValue( XML_x
);
222 sY
= xAttribs
->getOptionalValue( XML_y
);
229 maPolygon
.append( B2DPoint ( dX
, dY
) );
232 case NMSP_DRAWINGML
| XML_lnTo
:
233 case NMSP_DRAWINGML
| XML_moveTo
:
234 maPointToken
= aElementToken
;
241 void PathListContext::endFastElement( sal_Int32 aElementToken
) throw (SAXException
, RuntimeException
)
243 switch( aElementToken
) {
244 case NMSP_DRAWINGML
|XML_pathLst
:
246 B2DPolyPolygon
& rPoly
= mrShape
.getCustomShapeProperties()->getPolygon();
247 if( rPoly
.count() ) {
248 if( rPoly
.areControlPointsUsed() ) {
249 if( rPoly
.isClosed() )
250 mrShape
.setServiceName( "com.sun.star.drawing.ClosedBezierShape" );
252 mrShape
.setServiceName( "com.sun.star.drawing.OpenBezierShape" );
254 if( rPoly
.isClosed() )
255 mrShape
.setServiceName( "com.sun.star.drawing.PolyPolygonPathShape" );
257 mrShape
.setServiceName( "com.sun.star.drawing.PolyLinePathShape" );
262 case NMSP_DRAWINGML
|XML_path
:
263 if( maPolygon
.count() > 0 )
264 mrShape
.getCustomShapeProperties()->getPolygon().append( maPolygon
);
269 // ---------------------------------------------------------------------
271 OUString
GetShapeType( sal_Int32 nType
)
276 case XML_lineInv
: // TODO
278 static const OUString sLine
= CREATE_OUSTRING( "mso-spt20" );
282 static const OUString sTriangle
= CREATE_OUSTRING( "isosceles-triangle" );
285 case XML_rtTriangle
: {
286 static const OUString sRtTriangle
= CREATE_OUSTRING( "right-triangle" );
290 static const OUString sRectangle
= CREATE_OUSTRING( "rectangle" );
294 static const OUString sDiamond
= CREATE_OUSTRING( "diamond" );
297 case XML_parallelogram
: {
298 static const OUString sParallelogram
= CREATE_OUSTRING( "parallelogram" );
299 sType
= sParallelogram
;
301 case XML_nonIsoscelesTrapezoid
: // TODO
302 case XML_trapezoid
: {
303 static const OUString sTrapezoid
= CREATE_OUSTRING( "trapezoid" );
307 static const OUString sPentagon
= CREATE_OUSTRING( "pentagon" );
310 case XML_heptagon
: // TODO
312 static const OUString sHexagon
= CREATE_OUSTRING( "hexagon" );
315 case XML_decagon
: // TODO
316 case XML_dodecagon
: // TODO
318 static const OUString sOctagon
= CREATE_OUSTRING( "octagon" );
322 static const OUString sStar4
= CREATE_OUSTRING( "star4" );
325 case XML_star6
: // TODO
326 case XML_star7
: // TODO
328 static const OUString sStar5
= CREATE_OUSTRING( "star5" );
331 case XML_star10
: // TODO
332 case XML_star12
: // TODO
333 case XML_star16
: // TODO
335 static const OUString sStar8
= CREATE_OUSTRING( "star8" );
338 case XML_star32
: // TODO
340 static const OUString sStar24
= CREATE_OUSTRING( "star24" );
343 case XML_round1Rect
: // TODO
344 case XML_round2SameRect
: // TODO
345 case XML_round2DiagRect
: // TODO
346 case XML_snipRoundRect
: // TODO
347 case XML_snip1Rect
: // TODO
348 case XML_snip2SameRect
: // TODO
349 case XML_snip2DiagRect
: // TODO
350 case XML_roundRect
: {
351 static const OUString sRoundRect
= CREATE_OUSTRING( "round-rectangle" );
355 static const OUString sPlaque
= CREATE_OUSTRING( "mso-spt21" );
358 case XML_teardrop
: // TODO
360 static const OUString sEllipse
= CREATE_OUSTRING( "ellipse" );
363 case XML_homePlate
: {
364 static const OUString sHomePlate
= CREATE_OUSTRING( "pentagon-right" );
368 static const OUString sChevron
= CREATE_OUSTRING( "chevron" );
371 case XML_pieWedge
: // TODO
372 case XML_pie
: // TODO
374 static const OUString sBlockArc
= CREATE_OUSTRING( "block-arc" );
378 static const OUString sDonut
= CREATE_OUSTRING( "ring" );
381 case XML_noSmoking
: {
382 static const OUString sNoSmoking
= CREATE_OUSTRING( "forbidden" );
385 case XML_rightArrow
: {
386 static const OUString sRightArrow
= CREATE_OUSTRING( "right-arrow" );
389 case XML_leftArrow
: {
390 static const OUString sLeftArrow
= CREATE_OUSTRING( "left-arrow" );
394 static const OUString sUpArrow
= CREATE_OUSTRING( "up-arrow" );
397 case XML_downArrow
: {
398 static const OUString sDownArrow
= CREATE_OUSTRING( "down-arrow" );
401 case XML_stripedRightArrow
: {
402 static const OUString sStripedRightArrow
= CREATE_OUSTRING( "striped-right-arrow" );
403 sType
= sStripedRightArrow
;
405 case XML_notchedRightArrow
: {
406 static const OUString sNotchedRightArrow
= CREATE_OUSTRING( "notched-right-arrow" );
407 sType
= sNotchedRightArrow
;
409 case XML_bentUpArrow
: {
410 static const OUString sBentUpArrow
= CREATE_OUSTRING( "mso-spt90" );
411 sType
= sBentUpArrow
;
413 case XML_leftRightArrow
: {
414 static const OUString sLeftRightArrow
= CREATE_OUSTRING( "left-right-arrow" );
415 sType
= sLeftRightArrow
;
417 case XML_upDownArrow
: {
418 static const OUString sUpDownArrow
= CREATE_OUSTRING( "up-down-arrow" );
419 sType
= sUpDownArrow
;
421 case XML_leftUpArrow
: {
422 static const OUString sLeftUpArrow
= CREATE_OUSTRING( "mso-spt89" );
423 sType
= sLeftUpArrow
;
425 case XML_leftRightUpArrow
: {
426 static const OUString sLeftRightUpArrow
= CREATE_OUSTRING( "mso-spt182" );
427 sType
= sLeftRightUpArrow
;
429 case XML_quadArrow
: {
430 static const OUString sQuadArrow
= CREATE_OUSTRING( "quad-arrow" );
433 case XML_leftArrowCallout
: {
434 static const OUString sLeftArrowCallout
= CREATE_OUSTRING( "left-arrow-callout" );
435 sType
= sLeftArrowCallout
;
437 case XML_rightArrowCallout
: {
438 static const OUString sRightArrowCallout
= CREATE_OUSTRING( "right-arrow-callout" );
439 sType
= sRightArrowCallout
;
441 case XML_upArrowCallout
: {
442 static const OUString sUpArrowCallout
= CREATE_OUSTRING( "up-arrow-callout" );
443 sType
= sUpArrowCallout
;
445 case XML_downArrowCallout
: {
446 static const OUString sDownArrowCallout
= CREATE_OUSTRING( "down-arrow-callout" );
447 sType
= sDownArrowCallout
;
449 case XML_leftRightArrowCallout
: {
450 static const OUString sLeftRightArrowCallout
= CREATE_OUSTRING( "left-right-arrow-callout" );
451 sType
= sLeftRightArrowCallout
;
453 case XML_upDownArrowCallout
: {
454 static const OUString sUpDownArrowCallout
= CREATE_OUSTRING( "up-down-arrow-callout" );
455 sType
= sUpDownArrowCallout
;
457 case XML_quadArrowCallout
: {
458 static const OUString sQuadArrowCallout
= CREATE_OUSTRING( "quad-arrow-callout" );
459 sType
= sQuadArrowCallout
;
461 case XML_bentArrow
: {
462 static const OUString sBentArrow
= CREATE_OUSTRING( "mso-spt91" );
465 case XML_uturnArrow
: {
466 static const OUString sUTurnArrow
= CREATE_OUSTRING( "mso-spt101" );
469 case XML_leftCircularArrow
: // TODO
470 case XML_leftRightCircularArrow
: // TODO
471 case XML_circularArrow
: {
472 static const OUString sCircularArrow
= CREATE_OUSTRING( "circular-arrow" );
473 sType
= sCircularArrow
;
475 case XML_curvedRightArrow
: {
476 static const OUString sCurvedRightArrow
= CREATE_OUSTRING( "mso-spt102" );
477 sType
= sCurvedRightArrow
;
479 case XML_curvedLeftArrow
: {
480 static const OUString sCurvedLeftArrow
= CREATE_OUSTRING( "mso-spt103" );
481 sType
= sCurvedLeftArrow
;
483 case XML_curvedUpArrow
: {
484 static const OUString sCurvedUpArrow
= CREATE_OUSTRING( "mso-spt104" );
485 sType
= sCurvedUpArrow
;
487 case XML_swooshArrow
: // TODO
488 case XML_curvedDownArrow
: {
489 static const OUString sCurvedDownArrow
= CREATE_OUSTRING( "mso-spt105" );
490 sType
= sCurvedDownArrow
;
493 static const OUString sCube
= CREATE_OUSTRING( "cube" );
497 static const OUString sCan
= CREATE_OUSTRING( "can" );
500 case XML_lightningBolt
: {
501 static const OUString sLightningBolt
= CREATE_OUSTRING( "lightning" );
502 sType
= sLightningBolt
;
505 static const OUString sHeart
= CREATE_OUSTRING( "heart" );
509 static const OUString sSun
= CREATE_OUSTRING( "sun" );
513 static const OUString sMoon
= CREATE_OUSTRING( "moon" );
516 case XML_smileyFace
: {
517 static const OUString sSmileyFace
= CREATE_OUSTRING( "smiley" );
520 case XML_irregularSeal1
: {
521 static const OUString sIrregularSeal1
= CREATE_OUSTRING( "mso-spt71" );
522 sType
= sIrregularSeal1
;
524 case XML_irregularSeal2
: {
525 static const OUString sIrregularSeal2
= CREATE_OUSTRING( "bang" );
526 sType
= sIrregularSeal2
;
528 case XML_foldedCorner
: {
529 static const OUString sFoldedCorner
= CREATE_OUSTRING( "paper" );
530 sType
= sFoldedCorner
;
533 static const OUString sBevel
= CREATE_OUSTRING( "quad-bevel" );
536 case XML_halfFrame
: // TODO
537 case XML_corner
: // TODO
538 case XML_diagStripe
: // TODO
539 case XML_chord
: // TODO
541 static const OUString sFrame
= CREATE_OUSTRING( "mso-spt75" );
545 static const OUString sArc
= CREATE_OUSTRING( "mso-spt19" );
548 case XML_leftBracket
: {
549 static const OUString sLeftBracket
= CREATE_OUSTRING( "left-bracket" );
550 sType
= sLeftBracket
;
552 case XML_rightBracket
: {
553 static const OUString sRightBracket
= CREATE_OUSTRING( "right-bracket" );
554 sType
= sRightBracket
;
556 case XML_leftBrace
: {
557 static const OUString sLeftBrace
= CREATE_OUSTRING( "left-brace" );
560 case XML_rightBrace
: {
561 static const OUString sRightBrace
= CREATE_OUSTRING( "right-brace" );
564 case XML_bracketPair
: {
565 static const OUString sBracketPair
= CREATE_OUSTRING( "bracket-pair" );
566 sType
= sBracketPair
;
568 case XML_bracePair
: {
569 static const OUString sBracePair
= CREATE_OUSTRING( "brace-pair" );
572 case XML_straightConnector1
: {
573 static const OUString sStraightConnector1
= CREATE_OUSTRING( "mso-spt32" );
574 sType
= sStraightConnector1
;
576 case XML_bentConnector2
: {
577 static const OUString sBentConnector2
= CREATE_OUSTRING( "mso-spt33" );
578 sType
= sBentConnector2
;
580 case XML_bentConnector3
: {
581 static const OUString sBentConnector3
= CREATE_OUSTRING( "mso-spt34" );
582 sType
= sBentConnector3
;
584 case XML_bentConnector4
: {
585 static const OUString sBentConnector4
= CREATE_OUSTRING( "mso-spt35" );
586 sType
= sBentConnector4
;
588 case XML_bentConnector5
: {
589 static const OUString sBentConnector5
= CREATE_OUSTRING( "mso-spt36" );
590 sType
= sBentConnector5
;
592 case XML_curvedConnector2
: {
593 static const OUString sCurvedConnector2
= CREATE_OUSTRING( "mso-spt37" );
594 sType
= sCurvedConnector2
;
596 case XML_curvedConnector3
: {
597 static const OUString sCurvedConnector3
= CREATE_OUSTRING( "mso-spt38" );
598 sType
= sCurvedConnector3
;
600 case XML_curvedConnector4
: {
601 static const OUString sCurvedConnector4
= CREATE_OUSTRING( "mso-spt39" );
602 sType
= sCurvedConnector4
;
604 case XML_curvedConnector5
: {
605 static const OUString sCurvedConnector5
= CREATE_OUSTRING( "mso-spt40" );
606 sType
= sCurvedConnector5
;
609 static const OUString sCallout1
= CREATE_OUSTRING( "mso-spt41" );
613 static const OUString sCallout2
= CREATE_OUSTRING( "mso-spt42" );
617 static const OUString sCallout3
= CREATE_OUSTRING( "mso-spt43" );
620 case XML_accentCallout1
: {
621 static const OUString sAccentCallout1
= CREATE_OUSTRING( "mso-spt44" );
622 sType
= sAccentCallout1
;
624 case XML_accentCallout2
: {
625 static const OUString sAccentCallout2
= CREATE_OUSTRING( "mso-spt45" );
626 sType
= sAccentCallout2
;
628 case XML_accentCallout3
: {
629 static const OUString sAccentCallout3
= CREATE_OUSTRING( "mso-spt46" );
630 sType
= sAccentCallout3
;
632 case XML_borderCallout1
: {
633 static const OUString sBorderCallout1
= CREATE_OUSTRING( "line-callout-1" );
634 sType
= sBorderCallout1
;
636 case XML_borderCallout2
: {
637 static const OUString sBorderCallout2
= CREATE_OUSTRING( "line-callout-2" );
638 sType
= sBorderCallout2
;
640 case XML_borderCallout3
: {
641 static const OUString sBorderCallout3
= CREATE_OUSTRING( "mso-spt49" );
642 sType
= sBorderCallout3
;
644 case XML_accentBorderCallout1
: {
645 static const OUString sAccentBorderCallout1
= CREATE_OUSTRING( "mso-spt50" );
646 sType
= sAccentBorderCallout1
;
648 case XML_accentBorderCallout2
: {
649 static const OUString sAccentBorderCallout2
= CREATE_OUSTRING( "mso-spt51" );
650 sType
= sAccentBorderCallout2
;
652 case XML_accentBorderCallout3
: {
653 static const OUString sAccentBorderCallout3
= CREATE_OUSTRING( "mso-spt52" );
654 sType
= sAccentBorderCallout3
;
656 case XML_wedgeRectCallout
: {
657 static const OUString sWedgeRectCallout
= CREATE_OUSTRING( "rectangular-callout" );
658 sType
= sWedgeRectCallout
;
660 case XML_wedgeRoundRectCallout
: {
661 static const OUString sWedgeRoundRectCallout
= CREATE_OUSTRING( "round-rectangular-callout" );
662 sType
= sWedgeRoundRectCallout
;
664 case XML_wedgeEllipseCallout
: {
665 static const OUString sWedgeEllipseCallout
= CREATE_OUSTRING( "round-callout" );
666 sType
= sWedgeEllipseCallout
;
668 case XML_cloud
: // TODO
669 case XML_cloudCallout
: {
670 static const OUString sCloudCallout
= CREATE_OUSTRING( "cloud-callout" );
671 sType
= sCloudCallout
;
674 static const OUString sRibbon
= CREATE_OUSTRING( "mso-spt53" );
678 static const OUString sRibbon2
= CREATE_OUSTRING( "mso-spt54" );
681 case XML_ellipseRibbon
: {
682 static const OUString sEllipseRibbon
= CREATE_OUSTRING( "mso-spt107" );
683 sType
= sEllipseRibbon
;
685 case XML_leftRightRibbon
: // TODO
686 case XML_ellipseRibbon2
: {
687 static const OUString sEllipseRibbon2
= CREATE_OUSTRING( "mso-spt108" );
688 sType
= sEllipseRibbon2
;
690 case XML_verticalScroll
: {
691 static const OUString sVerticalScroll
= CREATE_OUSTRING( "vertical-scroll" );
692 sType
= sVerticalScroll
;
694 case XML_horizontalScroll
: {
695 static const OUString sHorizontalScroll
= CREATE_OUSTRING( "horizontal-scroll" );
696 sType
= sHorizontalScroll
;
699 static const OUString sWave
= CREATE_OUSTRING( "mso-spt64" );
702 case XML_doubleWave
: {
703 static const OUString sDoubleWave
= CREATE_OUSTRING( "mso-spt188" );
707 static const OUString sPlus
= CREATE_OUSTRING( "cross" );
710 case XML_flowChartProcess
: {
711 static const OUString sFlowChartProcess
= CREATE_OUSTRING( "flowchart-process" );
712 sType
= sFlowChartProcess
;
714 case XML_flowChartDecision
: {
715 static const OUString sFlowChartDecision
= CREATE_OUSTRING( "flowchart-decision" );
716 sType
= sFlowChartDecision
;
718 case XML_flowChartInputOutput
: {
719 static const OUString sFlowChartInputOutput
= CREATE_OUSTRING( "flowchart-data" );
720 sType
= sFlowChartInputOutput
;
722 case XML_flowChartPredefinedProcess
: {
723 static const OUString sFlowChartPredefinedProcess
= CREATE_OUSTRING( "flowchart-predefined-process" );
724 sType
= sFlowChartPredefinedProcess
;
726 case XML_flowChartInternalStorage
: {
727 static const OUString sFlowChartInternalStorage
= CREATE_OUSTRING( "flowchart-internal-storage" );
728 sType
= sFlowChartInternalStorage
;
730 case XML_flowChartDocument
: {
731 static const OUString sFlowChartDocument
= CREATE_OUSTRING( "flowchart-document" );
732 sType
= sFlowChartDocument
;
734 case XML_flowChartMultidocument
: {
735 static const OUString sFlowChartMultidocument
= CREATE_OUSTRING( "flowchart-multidocument" );
736 sType
= sFlowChartMultidocument
;
738 case XML_flowChartTerminator
: {
739 static const OUString sFlowChartTerminator
= CREATE_OUSTRING( "flowchart-terminator" );
740 sType
= sFlowChartTerminator
;
742 case XML_flowChartPreparation
: {
743 static const OUString sFlowChartPreparation
= CREATE_OUSTRING( "flowchart-preparation" );
744 sType
= sFlowChartPreparation
;
746 case XML_flowChartManualInput
: {
747 static const OUString sFlowChartManualInput
= CREATE_OUSTRING( "flowchart-manual-input" );
748 sType
= sFlowChartManualInput
;
750 case XML_flowChartManualOperation
: {
751 static const OUString sFlowChartManualOperation
= CREATE_OUSTRING( "flowchart-manual-operation" );
752 sType
= sFlowChartManualOperation
;
754 case XML_flowChartConnector
: {
755 static const OUString sFlowChartConnector
= CREATE_OUSTRING( "flowchart-connector" );
756 sType
= sFlowChartConnector
;
758 case XML_flowChartPunchedCard
: {
759 static const OUString sFlowChartPunchedCard
= CREATE_OUSTRING( "flowchart-card" );
760 sType
= sFlowChartPunchedCard
;
762 case XML_flowChartPunchedTape
: {
763 static const OUString sFlowChartPunchedTape
= CREATE_OUSTRING( "flowchart-punched-tape" );
764 sType
= sFlowChartPunchedTape
;
766 case XML_flowChartSummingJunction
: {
767 static const OUString sFlowChartSummingJunction
= CREATE_OUSTRING( "flowchart-summing-junction" );
768 sType
= sFlowChartSummingJunction
;
770 case XML_flowChartOr
: {
771 static const OUString sFlowChartOr
= CREATE_OUSTRING( "flowchart-or" );
772 sType
= sFlowChartOr
;
774 case XML_flowChartCollate
: {
775 static const OUString sFlowChartCollate
= CREATE_OUSTRING( "flowchart-collate" );
776 sType
= sFlowChartCollate
;
778 case XML_flowChartSort
: {
779 static const OUString sFlowChartSort
= CREATE_OUSTRING( "flowchart-sort" );
780 sType
= sFlowChartSort
;
782 case XML_flowChartExtract
: {
783 static const OUString sFlowChartExtract
= CREATE_OUSTRING( "flowchart-extract" );
784 sType
= sFlowChartExtract
;
786 case XML_flowChartMerge
: {
787 static const OUString sFlowChartMerge
= CREATE_OUSTRING( "flowchart-merge" );
788 sType
= sFlowChartMerge
;
790 case XML_flowChartOfflineStorage
: {
791 static const OUString sFlowChartOfflineStorage
= CREATE_OUSTRING( "mso-spt129" );
792 sType
= sFlowChartOfflineStorage
;
794 case XML_flowChartOnlineStorage
: {
795 static const OUString sFlowChartOnlineStorage
= CREATE_OUSTRING( "flowchart-stored-data" );
796 sType
= sFlowChartOnlineStorage
;
798 case XML_flowChartMagneticTape
: {
799 static const OUString sFlowChartMagneticTape
= CREATE_OUSTRING( "flowchart-sequential-access" );
800 sType
= sFlowChartMagneticTape
;
802 case XML_flowChartMagneticDisk
: {
803 static const OUString sFlowChartMagneticDisk
= CREATE_OUSTRING( "flowchart-magnetic-disk" );
804 sType
= sFlowChartMagneticDisk
;
806 case XML_flowChartMagneticDrum
: {
807 static const OUString sFlowChartMagneticDrum
= CREATE_OUSTRING( "flowchart-direct-access-storage" );
808 sType
= sFlowChartMagneticDrum
;
810 case XML_flowChartDisplay
: {
811 static const OUString sFlowChartDisplay
= CREATE_OUSTRING( "flowchart-display" );
812 sType
= sFlowChartDisplay
;
814 case XML_flowChartDelay
: {
815 static const OUString sFlowChartDelay
= CREATE_OUSTRING( "flowchart-delay" );
816 sType
= sFlowChartDelay
;
818 case XML_flowChartAlternateProcess
: {
819 static const OUString sFlowChartAlternateProcess
= CREATE_OUSTRING( "flowchart-alternate-process" );
820 sType
= sFlowChartAlternateProcess
;
822 case XML_flowChartOffpageConnector
: {
823 static const OUString sFlowChartOffpageConnector
= CREATE_OUSTRING( "flowchart-off-page-connector" );
824 sType
= sFlowChartOffpageConnector
;
826 case XML_actionButtonBlank
: {
827 static const OUString sActionButtonBlank
= CREATE_OUSTRING( "mso-spt189" );
828 sType
= sActionButtonBlank
;
830 case XML_actionButtonHome
: {
831 static const OUString sActionButtonHome
= CREATE_OUSTRING( "mso-spt190" );
832 sType
= sActionButtonHome
;
834 case XML_actionButtonHelp
: {
835 static const OUString sActionButtonHelp
= CREATE_OUSTRING( "mso-spt191" );
836 sType
= sActionButtonHelp
;
838 case XML_actionButtonInformation
: {
839 static const OUString sActionButtonInformation
= CREATE_OUSTRING( "mso-spt192" );
840 sType
= sActionButtonInformation
;
842 case XML_actionButtonForwardNext
: {
843 static const OUString sActionButtonForwardNext
= CREATE_OUSTRING( "mso-spt193" );
844 sType
= sActionButtonForwardNext
;
846 case XML_actionButtonBackPrevious
: {
847 static const OUString sActionButtonBackPrevious
= CREATE_OUSTRING( "mso-spt194" );
848 sType
= sActionButtonBackPrevious
;
850 case XML_actionButtonEnd
: {
851 static const OUString sActionButtonEnd
= CREATE_OUSTRING( "mso-spt195" );
852 sType
= sActionButtonEnd
;
854 case XML_actionButtonBeginning
: {
855 static const OUString sActionButtonBeginning
= CREATE_OUSTRING( "mso-spt196" );
856 sType
= sActionButtonBeginning
;
858 case XML_actionButtonReturn
: {
859 static const OUString sActionButtonReturn
= CREATE_OUSTRING( "mso-spt197" );
860 sType
= sActionButtonReturn
;
862 case XML_actionButtonDocument
: {
863 static const OUString sActionButtonDocument
= CREATE_OUSTRING( "mso-spt198" );
864 sType
= sActionButtonDocument
;
866 case XML_actionButtonSound
: {
867 static const OUString sActionButtonSound
= CREATE_OUSTRING( "mso-spt199" );
868 sType
= sActionButtonSound
;
870 case XML_actionButtonMovie
: {
871 static const OUString sActionButtonMovie
= CREATE_OUSTRING( "mso-spt200" );
872 sType
= sActionButtonMovie
;
874 case XML_gear6
: // TODO
875 case XML_gear9
: // TODO
876 case XML_funnel
: // TODO
877 case XML_mathPlus
: // TODO
878 case XML_mathMinus
: // TODO
879 case XML_mathMultiply
: // TODO
880 case XML_mathDivide
: // TODO
881 case XML_mathEqual
: // TODO
882 case XML_mathNotEqual
: // TODO
883 case XML_cornerTabs
: // TODO
884 case XML_squareTabs
: // TODO
885 case XML_plaqueTabs
: // TODO
886 case XML_chartX
: // TODO
887 case XML_chartStar
: // TODO
888 case XML_chartPlus
: { // TODO
889 static const OUString sRectangle
= CREATE_OUSTRING( "rectangle" );
898 static OUString
GetTextShapeType( sal_Int32 nType
)
903 case XML_textNoShape
: // TODO
904 case XML_textPlain
: {
905 static const OUString sTextPlain
= CREATE_OUSTRING( "fontwork-plain-text" );
909 static const OUString sTextStop
= CREATE_OUSTRING( "fontwork-stop" );
912 case XML_textTriangle
: {
913 static const OUString sTextTriangle
= CREATE_OUSTRING( "fontwork-triangle-up" );
914 sType
= sTextTriangle
;
916 case XML_textTriangleInverted
: {
917 static const OUString sTextTriangleInverted
= CREATE_OUSTRING( "fontwork-triangle-down" );
918 sType
= sTextTriangleInverted
;
920 case XML_textChevron
: {
921 static const OUString sTextChevron
= CREATE_OUSTRING( "fontwork-chevron-up" );
922 sType
= sTextChevron
;
924 case XML_textChevronInverted
: {
925 static const OUString sTextChevronInverted
= CREATE_OUSTRING( "fontwork-chevron-down" );
926 sType
= sTextChevronInverted
;
928 case XML_textRingInside
: {
929 static const OUString sTextRingInside
= CREATE_OUSTRING( "mso-spt142" );
930 sType
= sTextRingInside
;
932 case XML_textRingOutside
: {
933 static const OUString sTextRingOutside
= CREATE_OUSTRING( "mso-spt143" );
934 sType
= sTextRingOutside
;
936 case XML_textArchUp
: {
937 static const OUString sTextArchUp
= CREATE_OUSTRING( "fontwork-arch-up-curve" );
940 case XML_textArchDown
: {
941 static const OUString sTextArchDown
= CREATE_OUSTRING( "fontwork-arch-down-curve" );
942 sType
= sTextArchDown
;
944 case XML_textCircle
: {
945 static const OUString sTextCircle
= CREATE_OUSTRING( "fontwork-circle-curve" );
948 case XML_textButton
: {
949 static const OUString sTextButton
= CREATE_OUSTRING( "fontwork-open-circle-curve" );
952 case XML_textArchUpPour
: {
953 static const OUString sTextArchUpPour
= CREATE_OUSTRING( "fontwork-arch-up-pour" );
954 sType
= sTextArchUpPour
;
956 case XML_textArchDownPour
: {
957 static const OUString sTextArchDownPour
= CREATE_OUSTRING( "fontwork-arch-down-pour" );
958 sType
= sTextArchDownPour
;
960 case XML_textCirclePour
: {
961 static const OUString sTextCirclePour
= CREATE_OUSTRING( "fontwork-circle-pour" );
962 sType
= sTextCirclePour
;
964 case XML_textButtonPour
: {
965 static const OUString sTextButtonPour
= CREATE_OUSTRING( "fontwork-open-circle-pour" );
966 sType
= sTextButtonPour
;
968 case XML_textCurveUp
: {
969 static const OUString sTextCurveUp
= CREATE_OUSTRING( "fontwork-curve-up" );
970 sType
= sTextCurveUp
;
972 case XML_textCurveDown
: {
973 static const OUString sTextCurveDown
= CREATE_OUSTRING( "fontwork-curve-down" );
974 sType
= sTextCurveDown
;
976 case XML_textCanUp
: {
977 static const OUString sTextCanUp
= CREATE_OUSTRING( "mso-spt174" );
980 case XML_textCanDown
: {
981 static const OUString sTextCanDown
= CREATE_OUSTRING( "mso-spt175" );
982 sType
= sTextCanDown
;
984 case XML_textWave1
: {
985 static const OUString sTextWave1
= CREATE_OUSTRING( "fontwork-wave" );
988 case XML_textWave2
: {
989 static const OUString sTextWave2
= CREATE_OUSTRING( "mso-spt157" );
992 case XML_textDoubleWave1
: {
993 static const OUString sTextDoubleWave1
= CREATE_OUSTRING( "mso-spt158" );
994 sType
= sTextDoubleWave1
;
996 case XML_textWave4
: {
997 static const OUString sTextWave4
= CREATE_OUSTRING( "mso-spt159" );
1000 case XML_textInflate
: {
1001 static const OUString sTextInflate
= CREATE_OUSTRING( "fontwork-inflate" );
1002 sType
= sTextInflate
;
1004 case XML_textDeflate
: {
1005 static const OUString sTextDeflate
= CREATE_OUSTRING( "mso-spt161" );
1006 sType
= sTextDeflate
;
1008 case XML_textInflateBottom
: {
1009 static const OUString sTextInflateBottom
= CREATE_OUSTRING( "mso-spt162" );
1010 sType
= sTextInflateBottom
;
1012 case XML_textDeflateBottom
: {
1013 static const OUString sTextDeflateBottom
= CREATE_OUSTRING( "mso-spt163" );
1014 sType
= sTextDeflateBottom
;
1016 case XML_textInflateTop
: {
1017 static const OUString sTextInflateTop
= CREATE_OUSTRING( "mso-spt164" );
1018 sType
= sTextInflateTop
;
1020 case XML_textDeflateTop
: {
1021 static const OUString sTextDeflateTop
= CREATE_OUSTRING( "mso-spt165" );
1022 sType
= sTextDeflateTop
;
1024 case XML_textDeflateInflate
: {
1025 static const OUString sTextDeflateInflate
= CREATE_OUSTRING( "mso-spt166" );
1026 sType
= sTextDeflateInflate
;
1028 case XML_textDeflateInflateDeflate
: {
1029 static const OUString sTextDeflateInflateDeflate
= CREATE_OUSTRING( "mso-spt167" );
1030 sType
= sTextDeflateInflateDeflate
;
1032 case XML_textFadeRight
: {
1033 static const OUString sTextFadeRight
= CREATE_OUSTRING( "fontwork-fade-right" );
1034 sType
= sTextFadeRight
;
1036 case XML_textFadeLeft
: {
1037 static const OUString sTextFadeLeft
= CREATE_OUSTRING( "fontwork-fade-left" );
1038 sType
= sTextFadeLeft
;
1040 case XML_textFadeUp
: {
1041 static const OUString sTextFadeUp
= CREATE_OUSTRING( "fontwork-fade-up" );
1042 sType
= sTextFadeUp
;
1044 case XML_textFadeDown
: {
1045 static const OUString sTextFadeDown
= CREATE_OUSTRING( "fontwork-fade-down" );
1046 sType
= sTextFadeDown
;
1048 case XML_textSlantUp
: {
1049 static const OUString sTextSlantUp
= CREATE_OUSTRING( "fontwork-slant-up" );
1050 sType
= sTextSlantUp
;
1052 case XML_textSlantDown
: {
1053 static const OUString sTextSlantDown
= CREATE_OUSTRING( "fontwork-slant-down" );
1054 sType
= sTextSlantDown
;
1056 case XML_textCascadeUp
: {
1057 static const OUString sTextCascadeUp
= CREATE_OUSTRING( "fontwork-fade-up-and-right" );
1058 sType
= sTextCascadeUp
;
1060 case XML_textCascadeDown
: {
1061 static const OUString sTextCascadeDown
= CREATE_OUSTRING( "fontwork-fade-up-and-left" );
1062 sType
= sTextCascadeDown
;
1070 // ---------------------------------------------------------------------
1071 // CT_CustomGeometry2D
1072 CustomShapeGeometryContext::CustomShapeGeometryContext( ContextHandler
& rParent
, const Reference
< XFastAttributeList
>& /* xAttribs */, Shape
& rShape
)
1073 : ContextHandler( rParent
)
1078 Reference
< XFastContextHandler
> CustomShapeGeometryContext::createFastChildContext( sal_Int32 aElementToken
, const Reference
< XFastAttributeList
>& ) throw (SAXException
, RuntimeException
)
1080 switch( aElementToken
)
1083 case NMSP_DRAWINGML
|XML_avLst
: // CT_GeomGuideList adjust value list
1084 case NMSP_DRAWINGML
|XML_gdLst
: // CT_GeomGuideList guide list
1085 case NMSP_DRAWINGML
|XML_ahLst
: // CT_AdjustHandleList adjust handle list
1086 case NMSP_DRAWINGML
|XML_cxnLst
: // CT_ConnectionSiteList connection site list
1087 case NMSP_DRAWINGML
|XML_rect
: // CT_GeomRectList geometry rect list
1089 case NMSP_DRAWINGML
|XML_pathLst
: // CT_Path2DList 2d path list
1090 return new PathListContext( *this, mrShape
);
1093 Reference
< XFastContextHandler
> xEmpty
;
1097 // ---------------------------------------------------------------------
1098 // CT_PresetGeometry2D
1099 PresetShapeGeometryContext::PresetShapeGeometryContext( ContextHandler
& rParent
, const Reference
< XFastAttributeList
>& xAttribs
, CustomShapeProperties
& rCustomShapeProperties
)
1100 : ContextHandler( rParent
)
1101 , mrCustomShapeProperties( rCustomShapeProperties
)
1103 OUString sShapeType
;
1104 sal_Int32 nShapeType
= xAttribs
->getOptionalValueToken( XML_prst
, FastToken::DONTKNOW
);
1105 if ( nShapeType
!= FastToken::DONTKNOW
)
1106 sShapeType
= GetShapeType( nShapeType
);
1107 OSL_ENSURE( sShapeType
.getLength(), "oox::drawingml::CustomShapeCustomGeometryContext::CustomShapeCustomGeometryContext(), unknown shape type" );
1108 mrCustomShapeProperties
.setShapePresetType( sShapeType
);
1111 Reference
< XFastContextHandler
> PresetShapeGeometryContext::createFastChildContext( sal_Int32 aElementToken
, const Reference
< XFastAttributeList
>& ) throw (SAXException
, RuntimeException
)
1113 if ( aElementToken
== ( NMSP_DRAWINGML
| XML_avLst
) )
1114 return new AdjustmentValueContext( *this, mrCustomShapeProperties
);
1119 // ---------------------------------------------------------------------
1120 // CT_PresetTextShape
1121 PresetTextShapeContext::PresetTextShapeContext( ContextHandler
& rParent
, const Reference
< XFastAttributeList
>& xAttribs
, CustomShapeProperties
& rCustomShapeProperties
)
1122 : ContextHandler( rParent
)
1123 , mrCustomShapeProperties( rCustomShapeProperties
)
1125 OUString sShapeType
;
1126 sal_Int32 nShapeType
= xAttribs
->getOptionalValueToken( XML_prst
, FastToken::DONTKNOW
);
1127 if ( nShapeType
!= FastToken::DONTKNOW
)
1128 sShapeType
= GetTextShapeType( nShapeType
);
1129 OSL_ENSURE( sShapeType
.getLength(), "oox::drawingml::CustomShapeCustomGeometryContext::CustomShapeCustomGeometryContext(), unknown shape type" );
1130 mrCustomShapeProperties
.setShapePresetType( sShapeType
);
1133 Reference
< XFastContextHandler
> PresetTextShapeContext::createFastChildContext( sal_Int32 aElementToken
, const Reference
< XFastAttributeList
>& ) throw (SAXException
, RuntimeException
)
1135 switch( aElementToken
)
1138 case NMSP_DRAWINGML
|XML_avLst
: // CT_GeomGuideList adjust value list
1139 case NMSP_DRAWINGML
|XML_gdLst
: // CT_GeomGuideList guide list
1140 case NMSP_DRAWINGML
|XML_ahLst
: // CT_AdjustHandleList adjust handle list
1141 case NMSP_DRAWINGML
|XML_cxnLst
: // CT_ConnectionSiteList connection site list
1142 case NMSP_DRAWINGML
|XML_rect
: // CT_GeomRectList geometry rect list
1143 case NMSP_DRAWINGML
|XML_pathLst
: // CT_Path2DList 2d path list
1147 Reference
< XFastContextHandler
> xEmpty
;