msfilter: add a drawingML -> VML map
This can be used later for the VML or binary export of shapes imported from drawingML. Note that without this, drawingML shapes won't be exported to VML, as e.g. for a triangle it expects a 'isosceles-triangle' type, while the shype's type is 'ooxml-triangle'. Change-Id: I59abc27febdd026c181a7ff38b16c93567058cb9
This commit is contained in:
parent
8dbedf1667
commit
7f9a03e1b7
@ -1088,6 +1088,215 @@ static const CustomShapeTypeTranslationTable pCustomShapeTypeTranslationTable[]
|
|||||||
{ "ooxml-ribbon", "ribbon" },
|
{ "ooxml-ribbon", "ribbon" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct {
|
||||||
|
const char* sDML;
|
||||||
|
MSO_SPT nVML;
|
||||||
|
} pDMLToVMLTable[] = {
|
||||||
|
{"notPrimitive", mso_sptNotPrimitive},
|
||||||
|
{"rectangle", mso_sptRectangle},
|
||||||
|
{"roundRectangle", mso_sptRoundRectangle},
|
||||||
|
{"ellipse", mso_sptEllipse},
|
||||||
|
{"diamond", mso_sptDiamond},
|
||||||
|
{"triangle", mso_sptIsocelesTriangle},
|
||||||
|
{"rtTriangle", mso_sptRightTriangle},
|
||||||
|
{"parallelogram", mso_sptParallelogram},
|
||||||
|
{"trapezoid", mso_sptTrapezoid},
|
||||||
|
{"hexagon", mso_sptHexagon},
|
||||||
|
{"octagon", mso_sptOctagon},
|
||||||
|
{"plus", mso_sptPlus},
|
||||||
|
{"star5", mso_sptStar},
|
||||||
|
{"rightArrow", mso_sptArrow},
|
||||||
|
{"thickArrow", mso_sptThickArrow},
|
||||||
|
{"homePlate", mso_sptHomePlate},
|
||||||
|
{"cube", mso_sptCube},
|
||||||
|
{"wedgeRoundRectCallout", mso_sptBalloon},
|
||||||
|
{"star16", mso_sptSeal},
|
||||||
|
{"arc", mso_sptArc},
|
||||||
|
{"line", mso_sptLine},
|
||||||
|
{"plaque", mso_sptPlaque},
|
||||||
|
{"can", mso_sptCan},
|
||||||
|
{"donut", mso_sptDonut},
|
||||||
|
{"textPlain", mso_sptTextSimple},
|
||||||
|
{"textStop", mso_sptTextOctagon},
|
||||||
|
{"textTriangle", mso_sptTextHexagon},
|
||||||
|
{"textCanDown", mso_sptTextCurve},
|
||||||
|
{"textWave1", mso_sptTextWave},
|
||||||
|
{"textArchUpPour", mso_sptTextRing},
|
||||||
|
{"textCanDown", mso_sptTextOnCurve},
|
||||||
|
{"textArchUp", mso_sptTextOnRing},
|
||||||
|
{"straightConnector1", mso_sptStraightConnector1},
|
||||||
|
{"bentConnector2", mso_sptBentConnector2},
|
||||||
|
{"bentConnector3", mso_sptBentConnector3},
|
||||||
|
{"bentConnector4", mso_sptBentConnector4},
|
||||||
|
{"bentConnector5", mso_sptBentConnector5},
|
||||||
|
{"curvedConnector2", mso_sptCurvedConnector2},
|
||||||
|
{"curvedConnector3", mso_sptCurvedConnector3},
|
||||||
|
{"curvedConnector4", mso_sptCurvedConnector4},
|
||||||
|
{"curvedConnector5", mso_sptCurvedConnector5},
|
||||||
|
{"callout1", mso_sptCallout1},
|
||||||
|
{"callout2", mso_sptCallout2},
|
||||||
|
{"callout3", mso_sptCallout3},
|
||||||
|
{"accentCallout1", mso_sptAccentCallout1},
|
||||||
|
{"accentCallout2", mso_sptAccentCallout2},
|
||||||
|
{"accentCallout3", mso_sptAccentCallout3},
|
||||||
|
{"borderCallout1", mso_sptBorderCallout1},
|
||||||
|
{"borderCallout2", mso_sptBorderCallout2},
|
||||||
|
{"borderCallout3", mso_sptBorderCallout3},
|
||||||
|
{"accentBorderCallout1", mso_sptAccentBorderCallout1},
|
||||||
|
{"accentBorderCallout2", mso_sptAccentBorderCallout2},
|
||||||
|
{"accentBorderCallout3", mso_sptAccentBorderCallout3},
|
||||||
|
{"ribbon", mso_sptRibbon},
|
||||||
|
{"ribbon2", mso_sptRibbon2},
|
||||||
|
{"chevron", mso_sptChevron},
|
||||||
|
{"pentagon", mso_sptPentagon},
|
||||||
|
{"noSmoking", mso_sptNoSmoking},
|
||||||
|
{"star8", mso_sptSeal8},
|
||||||
|
{"star16", mso_sptSeal16},
|
||||||
|
{"star32", mso_sptSeal32},
|
||||||
|
{"wedgeRectCallout", mso_sptWedgeRectCallout},
|
||||||
|
{"wedgeRoundRectCallout", mso_sptWedgeRRectCallout},
|
||||||
|
{"wedgeEllipseCallout", mso_sptWedgeEllipseCallout},
|
||||||
|
{"wave", mso_sptWave},
|
||||||
|
{"foldedCorner", mso_sptFoldedCorner},
|
||||||
|
{"leftArrow", mso_sptLeftArrow},
|
||||||
|
{"downArrow", mso_sptDownArrow},
|
||||||
|
{"upArrow", mso_sptUpArrow},
|
||||||
|
{"leftRightArrow", mso_sptLeftRightArrow},
|
||||||
|
{"upDownArrow", mso_sptUpDownArrow},
|
||||||
|
{"irregularSeal1", mso_sptIrregularSeal1},
|
||||||
|
{"irregularSeal2", mso_sptIrregularSeal2},
|
||||||
|
{"lightningBolt", mso_sptLightningBolt},
|
||||||
|
{"heart", mso_sptHeart},
|
||||||
|
{"pictureFrame", mso_sptPictureFrame},
|
||||||
|
{"quadArrow", mso_sptQuadArrow},
|
||||||
|
{"leftArrowCallout", mso_sptLeftArrowCallout},
|
||||||
|
{"rightArrowCallout", mso_sptRightArrowCallout},
|
||||||
|
{"upArrowCallout", mso_sptUpArrowCallout},
|
||||||
|
{"downArrowCallout", mso_sptDownArrowCallout},
|
||||||
|
{"leftRightArrowCallout", mso_sptLeftRightArrowCallout},
|
||||||
|
{"upDownArrowCallout", mso_sptUpDownArrowCallout},
|
||||||
|
{"quadArrowCallout", mso_sptQuadArrowCallout},
|
||||||
|
{"bevel", mso_sptBevel},
|
||||||
|
{"leftBracket", mso_sptLeftBracket},
|
||||||
|
{"rightBracket", mso_sptRightBracket},
|
||||||
|
{"leftBrace", mso_sptLeftBrace},
|
||||||
|
{"rightBrace", mso_sptRightBrace},
|
||||||
|
{"leftUpArrow", mso_sptLeftUpArrow},
|
||||||
|
{"bentUpArrow", mso_sptBentUpArrow},
|
||||||
|
{"bentArrow", mso_sptBentArrow},
|
||||||
|
{"star24", mso_sptSeal24},
|
||||||
|
{"stripedRightArrow", mso_sptStripedRightArrow},
|
||||||
|
{"notchedRightArrow", mso_sptNotchedRightArrow},
|
||||||
|
{"blockArc", mso_sptBlockArc},
|
||||||
|
{"smileyFace", mso_sptSmileyFace},
|
||||||
|
{"verticalScroll", mso_sptVerticalScroll},
|
||||||
|
{"horizontalScroll", mso_sptHorizontalScroll},
|
||||||
|
{"circularArrow", mso_sptCircularArrow},
|
||||||
|
{"notchedCircularArrow", mso_sptNotchedCircularArrow},
|
||||||
|
{"uturnArrow", mso_sptUturnArrow},
|
||||||
|
{"curvedRightArrow", mso_sptCurvedRightArrow},
|
||||||
|
{"curvedLeftArrow", mso_sptCurvedLeftArrow},
|
||||||
|
{"curvedUpArrow", mso_sptCurvedUpArrow},
|
||||||
|
{"curvedDownArrow", mso_sptCurvedDownArrow},
|
||||||
|
{"cloudCallout", mso_sptCloudCallout},
|
||||||
|
{"ellipseRibbon", mso_sptEllipseRibbon},
|
||||||
|
{"ellipseRibbon2", mso_sptEllipseRibbon2},
|
||||||
|
{"flowChartProcess", mso_sptFlowChartProcess},
|
||||||
|
{"flowChartDecision", mso_sptFlowChartDecision},
|
||||||
|
{"flowChartInputOutput", mso_sptFlowChartInputOutput},
|
||||||
|
{"flowChartPredefinedProcess", mso_sptFlowChartPredefinedProcess},
|
||||||
|
{"flowChartInternalStorage", mso_sptFlowChartInternalStorage},
|
||||||
|
{"flowChartDocument", mso_sptFlowChartDocument},
|
||||||
|
{"flowChartMultidocument", mso_sptFlowChartMultidocument},
|
||||||
|
{"flowChartTerminator", mso_sptFlowChartTerminator},
|
||||||
|
{"flowChartPreparation", mso_sptFlowChartPreparation},
|
||||||
|
{"flowChartManualInput", mso_sptFlowChartManualInput},
|
||||||
|
{"flowChartManualOperation", mso_sptFlowChartManualOperation},
|
||||||
|
{"flowChartConnector", mso_sptFlowChartConnector},
|
||||||
|
{"flowChartPunchedCard", mso_sptFlowChartPunchedCard},
|
||||||
|
{"flowChartPunchedTape", mso_sptFlowChartPunchedTape},
|
||||||
|
{"flowChartSummingJunction", mso_sptFlowChartSummingJunction},
|
||||||
|
{"flowChartOr", mso_sptFlowChartOr},
|
||||||
|
{"flowChartCollate", mso_sptFlowChartCollate},
|
||||||
|
{"flowChartSort", mso_sptFlowChartSort},
|
||||||
|
{"flowChartExtract", mso_sptFlowChartExtract},
|
||||||
|
{"flowChartMerge", mso_sptFlowChartMerge},
|
||||||
|
{"flowChartOfflineStorage", mso_sptFlowChartOfflineStorage},
|
||||||
|
{"flowChartOnlineStorage", mso_sptFlowChartOnlineStorage},
|
||||||
|
{"flowChartMagneticTape", mso_sptFlowChartMagneticTape},
|
||||||
|
{"flowChartMagneticDisk", mso_sptFlowChartMagneticDisk},
|
||||||
|
{"flowChartMagneticDrum", mso_sptFlowChartMagneticDrum},
|
||||||
|
{"flowChartDisplay", mso_sptFlowChartDisplay},
|
||||||
|
{"flowChartDelay", mso_sptFlowChartDelay},
|
||||||
|
{"textPlain", mso_sptTextPlainText},
|
||||||
|
{"textStop", mso_sptTextStop},
|
||||||
|
{"textTriangle", mso_sptTextTriangle},
|
||||||
|
{"textTriangleInverted", mso_sptTextTriangleInverted},
|
||||||
|
{"textChevron", mso_sptTextChevron},
|
||||||
|
{"textChevronInverted", mso_sptTextChevronInverted},
|
||||||
|
{"textRingInside", mso_sptTextRingInside},
|
||||||
|
{"textRingOutside", mso_sptTextRingOutside},
|
||||||
|
{"textArchUp", mso_sptTextArchUpCurve},
|
||||||
|
{"textArchDown", mso_sptTextArchDownCurve},
|
||||||
|
{"textCircle", mso_sptTextCircleCurve},
|
||||||
|
{"textButton", mso_sptTextButtonCurve},
|
||||||
|
{"textArchUpPour", mso_sptTextArchUpPour},
|
||||||
|
{"textArchDownPour", mso_sptTextArchDownPour},
|
||||||
|
{"textCirclePour", mso_sptTextCirclePour},
|
||||||
|
{"textButtonPour", mso_sptTextButtonPour},
|
||||||
|
{"textCurveUp", mso_sptTextCurveUp},
|
||||||
|
{"textCurveDown", mso_sptTextCurveDown},
|
||||||
|
{"textCascadeUp", mso_sptTextCascadeUp},
|
||||||
|
{"textCascadeDown", mso_sptTextCascadeDown},
|
||||||
|
{"textWave1", mso_sptTextWave1},
|
||||||
|
{"textWave2", mso_sptTextWave2},
|
||||||
|
{"textWave3", mso_sptTextWave3},
|
||||||
|
{"textWave4", mso_sptTextWave4},
|
||||||
|
{"textInflate", mso_sptTextInflate},
|
||||||
|
{"textDeflate", mso_sptTextDeflate},
|
||||||
|
{"textInflateBottom", mso_sptTextInflateBottom},
|
||||||
|
{"textDeflateBottom", mso_sptTextDeflateBottom},
|
||||||
|
{"textInflateTop", mso_sptTextInflateTop},
|
||||||
|
{"textDeflateTop", mso_sptTextDeflateTop},
|
||||||
|
{"textDeflateInflate", mso_sptTextDeflateInflate},
|
||||||
|
{"textDeflateInflateDeflate", mso_sptTextDeflateInflateDeflate},
|
||||||
|
{"textFadeRight", mso_sptTextFadeRight},
|
||||||
|
{"textFadeLeft", mso_sptTextFadeLeft},
|
||||||
|
{"textFadeUp", mso_sptTextFadeUp},
|
||||||
|
{"textFadeDown", mso_sptTextFadeDown},
|
||||||
|
{"textSlantUp", mso_sptTextSlantUp},
|
||||||
|
{"textSlantDown", mso_sptTextSlantDown},
|
||||||
|
{"textCanUp", mso_sptTextCanUp},
|
||||||
|
{"textCanDown", mso_sptTextCanDown},
|
||||||
|
{"flowChartAlternateProcess", mso_sptFlowChartAlternateProcess},
|
||||||
|
{"flowChartOffpageConnector", mso_sptFlowChartOffpageConnector},
|
||||||
|
{"callout1", mso_sptCallout90},
|
||||||
|
{"accentCallout1", mso_sptAccentCallout90},
|
||||||
|
{"borderCallout1", mso_sptBorderCallout90},
|
||||||
|
{"accentBorderCallout1", mso_sptAccentBorderCallout90},
|
||||||
|
{"leftRightUpArrow", mso_sptLeftRightUpArrow},
|
||||||
|
{"sun", mso_sptSun},
|
||||||
|
{"moon", mso_sptMoon},
|
||||||
|
{"bracketPair", mso_sptBracketPair},
|
||||||
|
{"bracePair", mso_sptBracePair},
|
||||||
|
{"star4", mso_sptSeal4},
|
||||||
|
{"doubleWave", mso_sptDoubleWave},
|
||||||
|
{"actionButtonBlank", mso_sptActionButtonBlank},
|
||||||
|
{"actionButtonHome", mso_sptActionButtonHome},
|
||||||
|
{"actionButtonHelp", mso_sptActionButtonHelp},
|
||||||
|
{"actionButtonInformation", mso_sptActionButtonInformation},
|
||||||
|
{"actionButtonForwardNext", mso_sptActionButtonForwardNext},
|
||||||
|
{"actionButtonBackPrevious", mso_sptActionButtonBackPrevious},
|
||||||
|
{"actionButtonEnd", mso_sptActionButtonEnd},
|
||||||
|
{"actionButtonBeginning", mso_sptActionButtonBeginning},
|
||||||
|
{"actionButtonReturn", mso_sptActionButtonReturn},
|
||||||
|
{"actionButtonDocument", mso_sptActionButtonDocument},
|
||||||
|
{"actionButtonSound", mso_sptActionButtonSound},
|
||||||
|
{"actionButtonMovie", mso_sptActionButtonMovie},
|
||||||
|
{"hostControl", mso_sptHostControl},
|
||||||
|
{"textBox", mso_sptTextBox},
|
||||||
|
};
|
||||||
|
|
||||||
typedef boost::unordered_map< const char*, const char*, rtl::CStringHash, rtl::CStringEqual> CustomShapeTypeTranslationHashMap;
|
typedef boost::unordered_map< const char*, const char*, rtl::CStringHash, rtl::CStringEqual> CustomShapeTypeTranslationHashMap;
|
||||||
static CustomShapeTypeTranslationHashMap* pCustomShapeTypeTranslationHashMap = NULL;
|
static CustomShapeTypeTranslationHashMap* pCustomShapeTypeTranslationHashMap = NULL;
|
||||||
|
|
||||||
@ -1112,6 +1321,26 @@ const char* GetOOXMLPresetGeometry( const char* sShapeType )
|
|||||||
return sPresetGeo;
|
return sPresetGeo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef boost::unordered_map< const char*, MSO_SPT, rtl::CStringHash, rtl::CStringEqual> DMLToVMLTranslationHashMap;
|
||||||
|
static DMLToVMLTranslationHashMap* pDMLToVMLMap;
|
||||||
|
|
||||||
|
MSO_SPT GETVMLShapeType(OString aType)
|
||||||
|
{
|
||||||
|
const char* pDML = GetOOXMLPresetGeometry(aType.getStr());
|
||||||
|
|
||||||
|
if (!pDMLToVMLMap)
|
||||||
|
{
|
||||||
|
pDMLToVMLMap = new DMLToVMLTranslationHashMap();
|
||||||
|
for (size_t i = 0; i < SAL_N_ELEMENTS(pDMLToVMLTable); ++i)
|
||||||
|
(*pDMLToVMLMap)[pDMLToVMLTable[i].sDML] = pDMLToVMLTable[i].nVML;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pDMLToVMLMap->find(pDML) == pDMLToVMLMap->end())
|
||||||
|
return mso_sptNil;
|
||||||
|
|
||||||
|
return (*pDMLToVMLMap)[pDML];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include <tools/color.hxx>
|
#include <tools/color.hxx>
|
||||||
#include <com/sun/star/lang/Locale.hpp>
|
#include <com/sun/star/lang/Locale.hpp>
|
||||||
#include <filter/msfilter/msfilterdllapi.h>
|
#include <filter/msfilter/msfilterdllapi.h>
|
||||||
|
#include <svx/msdffdef.hxx>
|
||||||
#include <com/sun/star/awt/Size.hpp>
|
#include <com/sun/star/awt/Size.hpp>
|
||||||
|
|
||||||
namespace msfilter {
|
namespace msfilter {
|
||||||
@ -131,9 +132,12 @@ struct MSFILTER_DLLPUBLIC EquationResult
|
|||||||
|
|
||||||
MSFILTER_DLLPUBLIC EquationResult ParseCombinedChars(const OUString& rStr);
|
MSFILTER_DLLPUBLIC EquationResult ParseCombinedChars(const OUString& rStr);
|
||||||
|
|
||||||
/// Similar to EnhancedCustomShapeTypeNames::Get(), but it also supports OOXML types.
|
/// Similar to EnhancedCustomShapeTypeNames::Get(), but it also supports OOXML types and returns a drawingML string.
|
||||||
MSFILTER_DLLPUBLIC const char* GetOOXMLPresetGeometry( const char* sShapeType );
|
MSFILTER_DLLPUBLIC const char* GetOOXMLPresetGeometry( const char* sShapeType );
|
||||||
|
|
||||||
|
/// Similar to EnhancedCustomShapeTypeNames::Get(), but returns an MSO_SPT (binary / VML type).
|
||||||
|
MSFILTER_DLLPUBLIC MSO_SPT GETVMLShapeType(OString aType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user