diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-12-02 17:41:41 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2013-12-02 19:04:18 +0100 |
commit | 8dbedf1667f2558c682c636ac9162b36d252e362 (patch) | |
tree | ec6f1e05ad897b21d852b2d9841be62d0152fec2 /filter/source | |
parent | 8302495a219e869f194f4b585c6f2b996eee0a5c (diff) |
oox: move lcl_GetPresetGeometry to msfilter, so filter can use it
Change-Id: Ia741d392a87eaa2f02615a6c9626417a420f205c
Diffstat (limited to 'filter/source')
-rw-r--r-- | filter/source/msfilter/util.cxx | 425 |
1 files changed, 425 insertions, 0 deletions
diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx index 0bd7cbefda60..d3ffc5dc6720 100644 --- a/filter/source/msfilter/util.cxx +++ b/filter/source/msfilter/util.cxx @@ -13,6 +13,7 @@ #include <unotools/fontdefs.hxx> #include <vcl/svapp.hxx> #include <filter/msfilter/util.hxx> +#include <boost/unordered_map.hpp> namespace msfilter { namespace util { @@ -687,6 +688,430 @@ EquationResult ParseCombinedChars(const OUString& rStr) return aResult; } +struct CustomShapeTypeTranslationTable +{ + const char* sOOo; + const char* sMSO; +}; + +static const CustomShapeTypeTranslationTable pCustomShapeTypeTranslationTable[] = +{ + // { "non-primitive", mso_sptMin }, + { "rectangle", "rect" }, + { "round-rectangle", "roundRect" }, + { "ellipse", "ellipse" }, + { "diamond", "diamond" }, + { "isosceles-triangle", "triangle" }, + { "right-triangle", "rtTriangle" }, + { "parallelogram", "parallelogram" }, + { "trapezoid", "trapezoid" }, + { "hexagon", "hexagon" }, + { "octagon", "octagon" }, + { "cross", "plus" }, + { "star5", "star5" }, + { "right-arrow", "rightArrow" }, + // { "mso-spt14", mso_sptThickArrow }, + { "pentagon-right", "homePlate" }, + { "cube", "cube" }, + // { "mso-spt17", mso_sptBalloon }, + // { "mso-spt18", mso_sptSeal }, + { "mso-spt19", "arc" }, + { "mso-spt20", "line" }, + { "mso-spt21", "plaque" }, + { "can", "can" }, + { "ring", "donut" }, + { "mso-spt24", "textSimple" }, + { "mso-spt25", "textOctagon" }, + { "mso-spt26", "textHexagon" }, + { "mso-spt27", "textCurve" }, + { "mso-spt28", "textWave" }, + { "mso-spt29", "textRing" }, + { "mso-spt30", "textOnCurve" }, + { "mso-spt31", "textOnRing" }, + { "mso-spt32", "straightConnector1" }, + { "mso-spt33", "bentConnector2" }, + { "mso-spt34", "bentConnector3" }, + { "mso-spt35", "bentConnector4" }, + { "mso-spt36", "bentConnector5" }, + { "mso-spt37", "curvedConnector2" }, + { "mso-spt38", "curvedConnector3" }, + { "mso-spt39", "curvedConnector4" }, + { "mso-spt40", "curvedConnector5" }, + { "mso-spt41", "callout1" }, + { "mso-spt42", "callout2" }, + { "mso-spt43", "callout3" }, + { "mso-spt44", "accentCallout1" }, + { "mso-spt45", "accentCallout2" }, + { "mso-spt46", "accentCallout3" }, + { "line-callout-1", "borderCallout1" }, + { "line-callout-2", "borderCallout2" }, + { "line-callout-3", "borderCallout3" }, + { "mso-spt49", "accentBorderCallout90" }, + { "mso-spt50", "accentBorderCallout1" }, + { "mso-spt51", "accentBorderCallout2" }, + { "mso-spt52", "accentBorderCallout3" }, + { "mso-spt53", "ribbon" }, + { "mso-spt54", "ribbon2" }, + { "chevron", "chevron" }, + { "pentagon", "pentagon" }, + { "forbidden", "noSmoking" }, + { "star8", "seal8" }, + { "mso-spt59", "seal16" }, + { "mso-spt60", "seal32" }, + { "rectangular-callout", "wedgeRectCallout" }, + { "round-rectangular-callout", "wedgeRoundRectCallout" }, + { "round-callout", "wedgeEllipseCallout" }, + { "mso-spt64", "wave" }, + { "paper", "foldedCorner" }, + { "left-arrow", "leftArrow" }, + { "down-arrow", "downArrow" }, + { "up-arrow", "upArrow" }, + { "left-right-arrow", "leftRightArrow" }, + { "up-down-arrow", "upDownArrow" }, + { "mso-spt71", "irregularSeal1" }, + { "bang", "irregularSeal2" }, + { "lightning", "lightningBolt" }, + { "heart", "heart" }, + { "mso-spt75", "pictureFrame" }, + { "quad-arrow", "quadArrow" }, + { "left-arrow-callout", "leftArrowCallout" }, + { "right-arrow-callout", "rightArrowCallout" }, + { "up-arrow-callout", "upArrowCallout" }, + { "down-arrow-callout", "downArrowCallout" }, + { "left-right-arrow-callout", "leftRightArrowCallout" }, + { "up-down-arrow-callout", "upDownArrowCallout" }, + { "quad-arrow-callout", "quadArrowCallout" }, + { "quad-bevel", "bevel" }, + { "left-bracket", "leftBracket" }, + { "right-bracket", "rightBracket" }, + { "left-brace", "leftBrace" }, + { "right-brace", "rightBrace" }, + { "mso-spt89", "leftUpArrow" }, + { "mso-spt90", "bentUpArrow" }, + { "mso-spt91", "bentArrow" }, + { "star24", "seal24" }, + { "striped-right-arrow", "stripedRightArrow" }, + { "notched-right-arrow", "notchedRightArrow" }, + { "block-arc", "blockArc" }, + { "smiley", "smileyFace" }, + { "vertical-scroll", "verticalScroll" }, + { "horizontal-scroll", "horizontalScroll" }, + { "circular-arrow", "circularArrow" }, + { "mso-spt100", "pie" }, // looks like MSO_SPT is wrong here + { "mso-spt101", "uturnArrow" }, + { "mso-spt102", "curvedRightArrow" }, + { "mso-spt103", "curvedLeftArrow" }, + { "mso-spt104", "curvedUpArrow" }, + { "mso-spt105", "curvedDownArrow" }, + { "cloud-callout", "cloudCallout" }, + { "mso-spt107", "ellipseRibbon" }, + { "mso-spt108", "ellipseRibbon2" }, + { "flowchart-process", "flowChartProcess" }, + { "flowchart-decision", "flowChartDecision" }, + { "flowchart-data", "flowChartInputOutput" }, + { "flowchart-predefined-process", "flowChartPredefinedProcess" }, + { "flowchart-internal-storage", "flowChartInternalStorage" }, + { "flowchart-document", "flowChartDocument" }, + { "flowchart-multidocument", "flowChartMultidocument" }, + { "flowchart-terminator", "flowChartTerminator" }, + { "flowchart-preparation", "flowChartPreparation" }, + { "flowchart-manual-input", "flowChartManualInput" }, + { "flowchart-manual-operation", "flowChartManualOperation" }, + { "flowchart-connector", "flowChartConnector" }, + { "flowchart-card", "flowChartPunchedCard" }, + { "flowchart-punched-tape", "flowChartPunchedTape" }, + { "flowchart-summing-junction", "flowChartSummingJunction" }, + { "flowchart-or", "flowChartOr" }, + { "flowchart-collate", "flowChartCollate" }, + { "flowchart-sort", "flowChartSort" }, + { "flowchart-extract", "flowChartExtract" }, + { "flowchart-merge", "flowChartMerge" }, + { "mso-spt129", "flowChartOfflineStorage" }, + { "flowchart-stored-data", "flowChartOnlineStorage" }, + { "flowchart-sequential-access", "flowChartMagneticTape" }, + { "flowchart-magnetic-disk", "flowChartMagneticDisk" }, + { "flowchart-direct-access-storage", "flowChartMagneticDrum" }, + { "flowchart-display", "flowChartDisplay" }, + { "flowchart-delay", "flowChartDelay" }, + { "fontwork-plain-text", "textPlainText" }, + { "fontwork-stop", "textStop" }, + { "fontwork-triangle-up", "textTriangle" }, + { "fontwork-triangle-down", "textTriangleInverted" }, + { "fontwork-chevron-up", "textChevron" }, + { "fontwork-chevron-down", "textChevronInverted" }, + { "mso-spt142", "textRingInside" }, + { "mso-spt143", "textRingOutside" }, + { "fontwork-arch-up-curve", "textArchUpCurve" }, + { "fontwork-arch-down-curve", "textArchDownCurve" }, + { "fontwork-circle-curve", "textCircleCurve" }, + { "fontwork-open-circle-curve", "textButtonCurve" }, + { "fontwork-arch-up-pour", "textArchUpPour" }, + { "fontwork-arch-down-pour", "textArchDownPour" }, + { "fontwork-circle-pour", "textCirclePour" }, + { "fontwork-open-circle-pour", "textButtonPour" }, + { "fontwork-curve-up", "textCurveUp" }, + { "fontwork-curve-down", "textCurveDown" }, + { "fontwork-fade-up-and-right", "textCascadeUp" }, + { "fontwork-fade-up-and-left", "textCascadeDown" }, + { "fontwork-wave", "textWave1" }, + { "mso-spt157", "textWave2" }, + { "mso-spt158", "textWave3" }, + { "mso-spt159", "textWave4" }, + { "fontwork-inflate", "textInflate" }, + { "mso-spt161", "textDeflate" }, + { "mso-spt162", "textInflateBottom" }, + { "mso-spt163", "textDeflateBottom" }, + { "mso-spt164", "textInflateTop" }, + { "mso-spt165", "textDeflateTop" }, + { "mso-spt166", "textDeflateInflate" }, + { "mso-spt167", "textDeflateInflateDeflate" }, + { "fontwork-fade-right", "textFadeRight" }, + { "fontwork-fade-left", "textFadeLeft" }, + { "fontwork-fade-up", "textFadeUp" }, + { "fontwork-fade-down", "textFadeDown" }, + { "fontwork-slant-up", "textSlantUp" }, + { "fontwork-slant-down", "textSlantDown" }, + { "mso-spt174", "textCanUp" }, + { "mso-spt175", "textCanDown" }, + { "flowchart-alternate-process", "flowChartAlternateProcess" }, + { "flowchart-off-page-connector", "flowChartOffpageConnector" }, + { "mso-spt178", "callout90" }, + { "mso-spt179", "accentCallout90" }, + { "mso-spt180", "borderCallout90" }, + { "mso-spt182", "leftRightUpArrow" }, + { "sun", "sun" }, + { "moon", "moon" }, + { "bracket-pair", "bracketPair" }, + { "brace-pair", "bracePair" }, + { "star4", "seal4" }, + { "mso-spt188", "doubleWave" }, + { "mso-spt189", "actionButtonBlank" }, + { "mso-spt190", "actionButtonHome" }, + { "mso-spt191", "actionButtonHelp" }, + { "mso-spt192", "actionButtonInformation" }, + { "mso-spt193", "actionButtonForwardNext" }, + { "mso-spt194", "actionButtonBackPrevious" }, + { "mso-spt195", "actionButtonEnd" }, + { "mso-spt196", "actionButtonBeginning" }, + { "mso-spt197", "actionButtonReturn" }, + { "mso-spt198", "actionButtonDocument" }, + { "mso-spt199", "actionButtonSound" }, + { "mso-spt200", "actionButtonMovie" }, + { "mso-spt201", "hostControl" }, + { "mso-spt202", "rect" }, + { "ooxml-actionButtonSound", "actionButtonSound" }, + { "ooxml-borderCallout1", "borderCallout1" }, + { "ooxml-plaqueTabs", "plaqueTabs" }, + { "ooxml-curvedLeftArrow", "curvedLeftArrow" }, + { "ooxml-octagon", "octagon" }, + { "ooxml-leftRightRibbon", "leftRightRibbon" }, + { "ooxml-actionButtonInformation", "actionButtonInformation" }, + { "ooxml-bentConnector5", "bentConnector5" }, + { "ooxml-circularArrow", "circularArrow" }, + { "ooxml-downArrowCallout", "downArrowCallout" }, + { "ooxml-mathMinus", "mathMinus" }, + { "ooxml-gear9", "gear9" }, + { "ooxml-round1Rect", "round1Rect" }, + { "ooxml-sun", "sun" }, + { "ooxml-plaque", "plaque" }, + { "ooxml-chevron", "chevron" }, + { "ooxml-flowChartPreparation", "flowChartPreparation" }, + { "ooxml-diagStripe", "diagStripe" }, + { "ooxml-pentagon", "pentagon" }, + { "ooxml-funnel", "funnel" }, + { "ooxml-chartStar", "chartStar" }, + { "ooxml-accentBorderCallout1", "accentBorderCallout1" }, + { "ooxml-notchedRightArrow", "notchedRightArrow" }, + { "ooxml-rightBracket", "rightBracket" }, + { "ooxml-flowChartOffpageConnector", "flowChartOffpageConnector" }, + { "ooxml-leftRightArrow", "leftRightArrow" }, + { "ooxml-decagon", "decagon" }, + { "ooxml-actionButtonHelp", "actionButtonHelp" }, + { "ooxml-star24", "star24" }, + { "ooxml-mathDivide", "mathDivide" }, + { "ooxml-curvedConnector4", "curvedConnector4" }, + { "ooxml-flowChartOr", "flowChartOr" }, + { "ooxml-borderCallout3", "borderCallout3" }, + { "ooxml-upDownArrowCallout", "upDownArrowCallout" }, + { "ooxml-flowChartDecision", "flowChartDecision" }, + { "ooxml-leftRightArrowCallout", "leftRightArrowCallout" }, + { "ooxml-flowChartManualOperation", "flowChartManualOperation" }, + { "ooxml-snipRoundRect", "snipRoundRect" }, + { "ooxml-mathPlus", "mathPlus" }, + { "ooxml-actionButtonForwardNext", "actionButtonForwardNext" }, + { "ooxml-can", "can" }, + { "ooxml-foldedCorner", "foldedCorner" }, + { "ooxml-star32", "star32" }, + { "ooxml-flowChartInternalStorage", "flowChartInternalStorage" }, + { "ooxml-upDownArrow", "upDownArrow" }, + { "ooxml-irregularSeal2", "irregularSeal2" }, + { "ooxml-mathEqual", "mathEqual" }, + { "ooxml-star12", "star12" }, + { "ooxml-uturnArrow", "uturnArrow" }, + { "ooxml-squareTabs", "squareTabs" }, + { "ooxml-leftRightUpArrow", "leftRightUpArrow" }, + { "ooxml-homePlate", "homePlate" }, + { "ooxml-dodecagon", "dodecagon" }, + { "ooxml-leftArrowCallout", "leftArrowCallout" }, + { "ooxml-chord", "chord" }, + { "ooxml-quadArrowCallout", "quadArrowCallout" }, + { "ooxml-actionButtonBeginning", "actionButtonBeginning" }, + { "ooxml-ellipse", "ellipse" }, + { "ooxml-actionButtonEnd", "actionButtonEnd" }, + { "ooxml-arc", "arc" }, + { "ooxml-star16", "star16" }, + { "ooxml-parallelogram", "parallelogram" }, + { "ooxml-bevel", "bevel" }, + { "ooxml-roundRect", "roundRect" }, + { "ooxml-accentCallout1", "accentCallout1" }, + { "ooxml-flowChartSort", "flowChartSort" }, + { "ooxml-star8", "star8" }, + { "ooxml-flowChartAlternateProcess", "flowChartAlternateProcess" }, + { "ooxml-moon", "moon" }, + { "ooxml-star6", "star6" }, + { "ooxml-round2SameRect", "round2SameRect" }, + { "ooxml-nonIsoscelesTrapezoid", "nonIsoscelesTrapezoid" }, + { "ooxml-diamond", "diamond" }, + { "ooxml-ellipseRibbon", "ellipseRibbon" }, + { "ooxml-callout2", "callout2" }, + { "ooxml-pie", "pie" }, + { "ooxml-star4", "star4" }, + { "ooxml-flowChartPredefinedProcess", "flowChartPredefinedProcess" }, + { "ooxml-flowChartPunchedTape", "flowChartPunchedTape" }, + { "ooxml-curvedConnector2", "curvedConnector2" }, + { "ooxml-bentConnector3", "bentConnector3" }, + { "ooxml-cornerTabs", "cornerTabs" }, + { "ooxml-hexagon", "hexagon" }, + { "ooxml-flowChartConnector", "flowChartConnector" }, + { "ooxml-flowChartMagneticDisk", "flowChartMagneticDisk" }, + { "ooxml-heart", "heart" }, + { "ooxml-ribbon2", "ribbon2" }, + { "ooxml-bracePair", "bracePair" }, + { "ooxml-flowChartExtract", "flowChartExtract" }, + { "ooxml-actionButtonHome", "actionButtonHome" }, + { "ooxml-accentBorderCallout3", "accentBorderCallout3" }, + { "ooxml-flowChartOfflineStorage", "flowChartOfflineStorage" }, + { "ooxml-irregularSeal1", "irregularSeal1" }, + { "ooxml-quadArrow", "quadArrow" }, + { "ooxml-leftBrace", "leftBrace" }, + { "ooxml-leftBracket", "leftBracket" }, + { "ooxml-blockArc", "blockArc" }, + { "ooxml-curvedConnector3", "curvedConnector3" }, + { "ooxml-wedgeRoundRectCallout", "wedgeRoundRectCallout" }, + { "ooxml-actionButtonMovie", "actionButtonMovie" }, + { "ooxml-flowChartOnlineStorage", "flowChartOnlineStorage" }, + { "ooxml-gear6", "gear6" }, + { "ooxml-halfFrame", "halfFrame" }, + { "ooxml-snip2SameRect", "snip2SameRect" }, + { "ooxml-triangle", "triangle" }, + { "ooxml-teardrop", "teardrop" }, + { "ooxml-flowChartDocument", "flowChartDocument" }, + { "ooxml-rightArrowCallout", "rightArrowCallout" }, + { "ooxml-rightBrace", "rightBrace" }, + { "ooxml-chartPlus", "chartPlus" }, + { "ooxml-flowChartManualInput", "flowChartManualInput" }, + { "ooxml-flowChartMerge", "flowChartMerge" }, + { "ooxml-line", "line" }, + { "ooxml-downArrow", "downArrow" }, + { "ooxml-upArrow", "upArrow" }, + { "ooxml-curvedDownArrow", "curvedDownArrow" }, + { "ooxml-actionButtonReturn", "actionButtonReturn" }, + { "ooxml-flowChartInputOutput", "flowChartInputOutput" }, + { "ooxml-bracketPair", "bracketPair" }, + { "ooxml-smileyFace", "smileyFace" }, + { "ooxml-actionButtonBlank", "actionButtonBlank" }, + { "ooxml-wave", "wave" }, + { "ooxml-swooshArrow", "swooshArrow" }, + { "ooxml-flowChartSummingJunction", "flowChartSummingJunction" }, + { "ooxml-lightningBolt", "lightningBolt" }, + { "ooxml-flowChartDisplay", "flowChartDisplay" }, + { "ooxml-actionButtonBackPrevious", "actionButtonBackPrevious" }, + { "ooxml-frame", "frame" }, + { "ooxml-rtTriangle", "rtTriangle" }, + { "ooxml-flowChartMagneticTape", "flowChartMagneticTape" }, + { "ooxml-curvedRightArrow", "curvedRightArrow" }, + { "ooxml-leftUpArrow", "leftUpArrow" }, + { "ooxml-wedgeEllipseCallout", "wedgeEllipseCallout" }, + { "ooxml-doubleWave", "doubleWave" }, + { "ooxml-bentArrow", "bentArrow" }, + { "ooxml-star10", "star10" }, + { "ooxml-leftArrow", "leftArrow" }, + { "ooxml-curvedUpArrow", "curvedUpArrow" }, + { "ooxml-snip1Rect", "snip1Rect" }, + { "ooxml-ellipseRibbon2", "ellipseRibbon2" }, + { "ooxml-plus", "plus" }, + { "ooxml-accentCallout3", "accentCallout3" }, + { "ooxml-leftCircularArrow", "leftCircularArrow" }, + { "ooxml-rightArrow", "rightArrow" }, + { "ooxml-flowChartPunchedCard", "flowChartPunchedCard" }, + { "ooxml-snip2DiagRect", "snip2DiagRect" }, + { "ooxml-verticalScroll", "verticalScroll" }, + { "ooxml-star7", "star7" }, + { "ooxml-chartX", "chartX" }, + { "ooxml-cloud", "cloud" }, + { "ooxml-cube", "cube" }, + { "ooxml-round2DiagRect", "round2DiagRect" }, + { "ooxml-flowChartMultidocument", "flowChartMultidocument" }, + { "ooxml-actionButtonDocument", "actionButtonDocument" }, + { "ooxml-flowChartTerminator", "flowChartTerminator" }, + { "ooxml-flowChartDelay", "flowChartDelay" }, + { "ooxml-curvedConnector5", "curvedConnector5" }, + { "ooxml-horizontalScroll", "horizontalScroll" }, + { "ooxml-bentConnector4", "bentConnector4" }, + { "ooxml-leftRightCircularArrow", "leftRightCircularArrow" }, + { "ooxml-wedgeRectCallout", "wedgeRectCallout" }, + { "ooxml-accentCallout2", "accentCallout2" }, + { "ooxml-flowChartMagneticDrum", "flowChartMagneticDrum" }, + { "ooxml-corner", "corner" }, + { "ooxml-borderCallout2", "borderCallout2" }, + { "ooxml-donut", "donut" }, + { "ooxml-flowChartCollate", "flowChartCollate" }, + { "ooxml-mathNotEqual", "mathNotEqual" }, + { "ooxml-bentConnector2", "bentConnector2" }, + { "ooxml-mathMultiply", "mathMultiply" }, + { "ooxml-heptagon", "heptagon" }, + { "ooxml-rect", "rect" }, + { "ooxml-accentBorderCallout2", "accentBorderCallout2" }, + { "ooxml-pieWedge", "pieWedge" }, + { "ooxml-upArrowCallout", "upArrowCallout" }, + { "ooxml-flowChartProcess", "flowChartProcess" }, + { "ooxml-star5", "star5" }, + { "ooxml-lineInv", "lineInv" }, + { "ooxml-straightConnector1", "straightConnector1" }, + { "ooxml-stripedRightArrow", "stripedRightArrow" }, + { "ooxml-callout3", "callout3" }, + { "ooxml-bentUpArrow", "bentUpArrow" }, + { "ooxml-noSmoking", "noSmoking" }, + { "ooxml-trapezoid", "trapezoid" }, + { "ooxml-cloudCallout", "cloudCallout" }, + { "ooxml-callout1", "callout1" }, + { "ooxml-ribbon", "ribbon" }, +}; + +typedef boost::unordered_map< const char*, const char*, rtl::CStringHash, rtl::CStringEqual> CustomShapeTypeTranslationHashMap; +static CustomShapeTypeTranslationHashMap* pCustomShapeTypeTranslationHashMap = NULL; + +const char* GetOOXMLPresetGeometry( const char* sShapeType ) +{ + const char* sPresetGeo; + + if( pCustomShapeTypeTranslationHashMap == NULL ) + { + pCustomShapeTypeTranslationHashMap = new CustomShapeTypeTranslationHashMap (); + for( unsigned int i = 0; i < sizeof( pCustomShapeTypeTranslationTable )/sizeof( CustomShapeTypeTranslationTable ); i ++ ) + { + (*pCustomShapeTypeTranslationHashMap)[ pCustomShapeTypeTranslationTable[ i ].sOOo ] = pCustomShapeTypeTranslationTable[ i ].sMSO; + } + } + + sPresetGeo = (*pCustomShapeTypeTranslationHashMap)[ sShapeType ]; + + if( sPresetGeo == NULL ) + sPresetGeo = "rect"; + + return sPresetGeo; +} + } } |