1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #include "oox/core/xmlfilterbase.hxx" 29*cdf0e10cSrcweir #include "oox/export/shapes.hxx" 30*cdf0e10cSrcweir #include "oox/export/utils.hxx" 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir #include <cstdio> 33*cdf0e10cSrcweir #include <com/sun/star/awt/CharSet.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/awt/FontDescriptor.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/awt/FontSlant.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/awt/FontWeight.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/awt/FontUnderline.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/awt/Gradient.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyState.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/container/XEnumerationAccess.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/drawing/FillStyle.hpp> 43*cdf0e10cSrcweir #include <com/sun/star/drawing/BitmapMode.hpp> 44*cdf0e10cSrcweir #include <com/sun/star/drawing/ConnectorType.hpp> 45*cdf0e10cSrcweir #include <com/sun/star/drawing/LineDash.hpp> 46*cdf0e10cSrcweir #include <com/sun/star/drawing/LineJoint.hpp> 47*cdf0e10cSrcweir #include <com/sun/star/drawing/LineStyle.hpp> 48*cdf0e10cSrcweir #include <com/sun/star/drawing/TextHorizontalAdjust.hpp> 49*cdf0e10cSrcweir #include <com/sun/star/drawing/TextVerticalAdjust.hpp> 50*cdf0e10cSrcweir #include <com/sun/star/i18n/ScriptType.hpp> 51*cdf0e10cSrcweir #include <com/sun/star/io/XOutputStream.hpp> 52*cdf0e10cSrcweir #include <com/sun/star/style/ParagraphAdjust.hpp> 53*cdf0e10cSrcweir #include <com/sun/star/text/XSimpleText.hpp> 54*cdf0e10cSrcweir #include <com/sun/star/text/XText.hpp> 55*cdf0e10cSrcweir #include <com/sun/star/text/XTextContent.hpp> 56*cdf0e10cSrcweir #include <com/sun/star/text/XTextField.hpp> 57*cdf0e10cSrcweir #include <com/sun/star/text/XTextRange.hpp> 58*cdf0e10cSrcweir #include <tools/stream.hxx> 59*cdf0e10cSrcweir #include <tools/string.hxx> 60*cdf0e10cSrcweir #include <vcl/cvtgrf.hxx> 61*cdf0e10cSrcweir #include <unotools/fontcvt.hxx> 62*cdf0e10cSrcweir #include <vcl/graph.hxx> 63*cdf0e10cSrcweir #include <vcl/outdev.hxx> 64*cdf0e10cSrcweir #include <svtools/grfmgr.hxx> 65*cdf0e10cSrcweir #include <rtl/strbuf.hxx> 66*cdf0e10cSrcweir #include <sfx2/app.hxx> 67*cdf0e10cSrcweir #include <svl/languageoptions.hxx> 68*cdf0e10cSrcweir #include <svx/escherex.hxx> 69*cdf0e10cSrcweir #include <svx/svdoashp.hxx> 70*cdf0e10cSrcweir #include <svx/svxenum.hxx> 71*cdf0e10cSrcweir #include <svx/unoapi.hxx> 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir using namespace ::com::sun::star; 74*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 75*cdf0e10cSrcweir using namespace ::com::sun::star::drawing; 76*cdf0e10cSrcweir using namespace ::com::sun::star::i18n; 77*cdf0e10cSrcweir using ::com::sun::star::beans::PropertyState; 78*cdf0e10cSrcweir using ::com::sun::star::beans::PropertyValue; 79*cdf0e10cSrcweir using ::com::sun::star::beans::XPropertySet; 80*cdf0e10cSrcweir using ::com::sun::star::beans::XPropertyState; 81*cdf0e10cSrcweir using ::com::sun::star::container::XEnumeration; 82*cdf0e10cSrcweir using ::com::sun::star::container::XEnumerationAccess; 83*cdf0e10cSrcweir using ::com::sun::star::container::XIndexAccess; 84*cdf0e10cSrcweir using ::com::sun::star::drawing::FillStyle; 85*cdf0e10cSrcweir using ::com::sun::star::io::XOutputStream; 86*cdf0e10cSrcweir using ::com::sun::star::text::XSimpleText; 87*cdf0e10cSrcweir using ::com::sun::star::text::XText; 88*cdf0e10cSrcweir using ::com::sun::star::text::XTextContent; 89*cdf0e10cSrcweir using ::com::sun::star::text::XTextField; 90*cdf0e10cSrcweir using ::com::sun::star::text::XTextRange; 91*cdf0e10cSrcweir using ::rtl::OString; 92*cdf0e10cSrcweir using ::rtl::OStringBuffer; 93*cdf0e10cSrcweir using ::rtl::OUString; 94*cdf0e10cSrcweir using ::rtl::OUStringBuffer; 95*cdf0e10cSrcweir using ::sax_fastparser::FSHelperPtr; 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir DBG(extern void dump_pset(Reference< XPropertySet > rXPropSet)); 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir #define IDS(x) (OString(#x " ") + OString::valueOf( mnShapeIdMax++ )).getStr() 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir struct CustomShapeTypeTranslationTable 102*cdf0e10cSrcweir { 103*cdf0e10cSrcweir const char* sOOo; 104*cdf0e10cSrcweir const char* sMSO; 105*cdf0e10cSrcweir }; 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir static const CustomShapeTypeTranslationTable pCustomShapeTypeTranslationTable[] = 108*cdf0e10cSrcweir { 109*cdf0e10cSrcweir // { "non-primitive", mso_sptMin }, 110*cdf0e10cSrcweir { "rectangle", "rect" }, 111*cdf0e10cSrcweir { "round-rectangle", "roundRect" }, 112*cdf0e10cSrcweir { "ellipse", "ellipse" }, 113*cdf0e10cSrcweir { "diamond", "diamond" }, 114*cdf0e10cSrcweir { "isosceles-triangle", "triangle" }, 115*cdf0e10cSrcweir { "right-triangle", "rtTriangle" }, 116*cdf0e10cSrcweir { "parallelogram", "parallelogram" }, 117*cdf0e10cSrcweir { "trapezoid", "trapezoid" }, 118*cdf0e10cSrcweir { "hexagon", "hexagon" }, 119*cdf0e10cSrcweir { "octagon", "octagon" }, 120*cdf0e10cSrcweir { "cross", "plus" }, 121*cdf0e10cSrcweir { "star5", "star5" }, 122*cdf0e10cSrcweir { "right-arrow", "rightArrow" }, 123*cdf0e10cSrcweir // { "mso-spt14", mso_sptThickArrow }, 124*cdf0e10cSrcweir { "pentagon-right", "homePlate" }, 125*cdf0e10cSrcweir { "cube", "cube" }, 126*cdf0e10cSrcweir // { "mso-spt17", mso_sptBalloon }, 127*cdf0e10cSrcweir // { "mso-spt18", mso_sptSeal }, 128*cdf0e10cSrcweir { "mso-spt19", "arc" }, 129*cdf0e10cSrcweir { "mso-spt20", "line" }, 130*cdf0e10cSrcweir { "mso-spt21", "plaque" }, 131*cdf0e10cSrcweir { "can", "can" }, 132*cdf0e10cSrcweir { "ring", "donut" }, 133*cdf0e10cSrcweir { "mso-spt24", "textSimple" }, 134*cdf0e10cSrcweir { "mso-spt25", "textOctagon" }, 135*cdf0e10cSrcweir { "mso-spt26", "textHexagon" }, 136*cdf0e10cSrcweir { "mso-spt27", "textCurve" }, 137*cdf0e10cSrcweir { "mso-spt28", "textWave" }, 138*cdf0e10cSrcweir { "mso-spt29", "textRing" }, 139*cdf0e10cSrcweir { "mso-spt30", "textOnCurve" }, 140*cdf0e10cSrcweir { "mso-spt31", "textOnRing" }, 141*cdf0e10cSrcweir { "mso-spt32", "straightConnector1" }, 142*cdf0e10cSrcweir { "mso-spt33", "bentConnector2" }, 143*cdf0e10cSrcweir { "mso-spt34", "bentConnector3" }, 144*cdf0e10cSrcweir { "mso-spt35", "bentConnector4" }, 145*cdf0e10cSrcweir { "mso-spt36", "bentConnector5" }, 146*cdf0e10cSrcweir { "mso-spt37", "curvedConnector2" }, 147*cdf0e10cSrcweir { "mso-spt38", "curvedConnector3" }, 148*cdf0e10cSrcweir { "mso-spt39", "curvedConnector4" }, 149*cdf0e10cSrcweir { "mso-spt40", "curvedConnector5" }, 150*cdf0e10cSrcweir { "mso-spt41", "callout1" }, 151*cdf0e10cSrcweir { "mso-spt42", "callout2" }, 152*cdf0e10cSrcweir { "mso-spt43", "callout3" }, 153*cdf0e10cSrcweir { "mso-spt44", "accentCallout1" }, 154*cdf0e10cSrcweir { "mso-spt45", "accentCallout2" }, 155*cdf0e10cSrcweir { "mso-spt46", "accentCallout3" }, 156*cdf0e10cSrcweir { "line-callout-1", "borderCallout1" }, 157*cdf0e10cSrcweir { "line-callout-2", "borderCallout2" }, 158*cdf0e10cSrcweir { "line-callout-3", "borderCallout3" }, 159*cdf0e10cSrcweir { "mso-spt49", "accentBorderCallout90" }, 160*cdf0e10cSrcweir { "mso-spt50", "accentBorderCallout1" }, 161*cdf0e10cSrcweir { "mso-spt51", "accentBorderCallout2" }, 162*cdf0e10cSrcweir { "mso-spt52", "accentBorderCallout3" }, 163*cdf0e10cSrcweir { "mso-spt53", "ribbon" }, 164*cdf0e10cSrcweir { "mso-spt54", "ribbon2" }, 165*cdf0e10cSrcweir { "chevron", "chevron" }, 166*cdf0e10cSrcweir { "pentagon", "pentagon" }, 167*cdf0e10cSrcweir { "forbidden", "noSmoking" }, 168*cdf0e10cSrcweir { "star8", "seal8" }, 169*cdf0e10cSrcweir { "mso-spt59", "seal16" }, 170*cdf0e10cSrcweir { "mso-spt60", "seal32" }, 171*cdf0e10cSrcweir { "rectangular-callout", "wedgeRectCallout" }, 172*cdf0e10cSrcweir { "round-rectangular-callout", "wedgeRoundRectCallout" }, 173*cdf0e10cSrcweir { "round-callout", "wedgeEllipseCallout" }, 174*cdf0e10cSrcweir { "mso-spt64", "wave" }, 175*cdf0e10cSrcweir { "paper", "foldedCorner" }, 176*cdf0e10cSrcweir { "left-arrow", "leftArrow" }, 177*cdf0e10cSrcweir { "down-arrow", "downArrow" }, 178*cdf0e10cSrcweir { "up-arrow", "upArrow" }, 179*cdf0e10cSrcweir { "left-right-arrow", "leftRightArrow" }, 180*cdf0e10cSrcweir { "up-down-arrow", "upDownArrow" }, 181*cdf0e10cSrcweir { "mso-spt71", "irregularSeal1" }, 182*cdf0e10cSrcweir { "bang", "irregularSeal2" }, 183*cdf0e10cSrcweir { "lightning", "lightningBolt" }, 184*cdf0e10cSrcweir { "heart", "heart" }, 185*cdf0e10cSrcweir { "mso-spt75", "pictureFrame" }, 186*cdf0e10cSrcweir { "quad-arrow", "quadArrow" }, 187*cdf0e10cSrcweir { "left-arrow-callout", "leftArrowCallout" }, 188*cdf0e10cSrcweir { "right-arrow-callout", "rightArrowCallout" }, 189*cdf0e10cSrcweir { "up-arrow-callout", "upArrowCallout" }, 190*cdf0e10cSrcweir { "down-arrow-callout", "downArrowCallout" }, 191*cdf0e10cSrcweir { "left-right-arrow-callout", "leftRightArrowCallout" }, 192*cdf0e10cSrcweir { "up-down-arrow-callout", "upDownArrowCallout" }, 193*cdf0e10cSrcweir { "quad-arrow-callout", "quadArrowCallout" }, 194*cdf0e10cSrcweir { "quad-bevel", "bevel" }, 195*cdf0e10cSrcweir { "left-bracket", "leftBracket" }, 196*cdf0e10cSrcweir { "right-bracket", "rightBracket" }, 197*cdf0e10cSrcweir { "left-brace", "leftBrace" }, 198*cdf0e10cSrcweir { "right-brace", "rightBrace" }, 199*cdf0e10cSrcweir { "mso-spt89", "leftUpArrow" }, 200*cdf0e10cSrcweir { "mso-spt90", "bentUpArrow" }, 201*cdf0e10cSrcweir { "mso-spt91", "bentArrow" }, 202*cdf0e10cSrcweir { "star24", "seal24" }, 203*cdf0e10cSrcweir { "striped-right-arrow", "stripedRightArrow" }, 204*cdf0e10cSrcweir { "notched-right-arrow", "notchedRightArrow" }, 205*cdf0e10cSrcweir { "block-arc", "blockArc" }, 206*cdf0e10cSrcweir { "smiley", "smileyFace" }, 207*cdf0e10cSrcweir { "vertical-scroll", "verticalScroll" }, 208*cdf0e10cSrcweir { "horizontal-scroll", "horizontalScroll" }, 209*cdf0e10cSrcweir { "circular-arrow", "circularArrow" }, 210*cdf0e10cSrcweir { "mso-spt100", "pie" }, // looks like MSO_SPT is wrong here 211*cdf0e10cSrcweir { "mso-spt101", "uturnArrow" }, 212*cdf0e10cSrcweir { "mso-spt102", "curvedRightArrow" }, 213*cdf0e10cSrcweir { "mso-spt103", "curvedLeftArrow" }, 214*cdf0e10cSrcweir { "mso-spt104", "curvedUpArrow" }, 215*cdf0e10cSrcweir { "mso-spt105", "curvedDownArrow" }, 216*cdf0e10cSrcweir { "cloud-callout", "cloudCallout" }, 217*cdf0e10cSrcweir { "mso-spt107", "ellipseRibbon" }, 218*cdf0e10cSrcweir { "mso-spt108", "ellipseRibbon2" }, 219*cdf0e10cSrcweir { "flowchart-process", "flowChartProcess" }, 220*cdf0e10cSrcweir { "flowchart-decision", "flowChartDecision" }, 221*cdf0e10cSrcweir { "flowchart-data", "flowChartInputOutput" }, 222*cdf0e10cSrcweir { "flowchart-predefined-process", "flowChartPredefinedProcess" }, 223*cdf0e10cSrcweir { "flowchart-internal-storage", "flowChartInternalStorage" }, 224*cdf0e10cSrcweir { "flowchart-document", "flowChartDocument" }, 225*cdf0e10cSrcweir { "flowchart-multidocument", "flowChartMultidocument" }, 226*cdf0e10cSrcweir { "flowchart-terminator", "flowChartTerminator" }, 227*cdf0e10cSrcweir { "flowchart-preparation", "flowChartPreparation" }, 228*cdf0e10cSrcweir { "flowchart-manual-input", "flowChartManualInput" }, 229*cdf0e10cSrcweir { "flowchart-manual-operation", "flowChartManualOperation" }, 230*cdf0e10cSrcweir { "flowchart-connector", "flowChartConnector" }, 231*cdf0e10cSrcweir { "flowchart-card", "flowChartPunchedCard" }, 232*cdf0e10cSrcweir { "flowchart-punched-tape", "flowChartPunchedTape" }, 233*cdf0e10cSrcweir { "flowchart-summing-junction", "flowChartSummingJunction" }, 234*cdf0e10cSrcweir { "flowchart-or", "flowChartOr" }, 235*cdf0e10cSrcweir { "flowchart-collate", "flowChartCollate" }, 236*cdf0e10cSrcweir { "flowchart-sort", "flowChartSort" }, 237*cdf0e10cSrcweir { "flowchart-extract", "flowChartExtract" }, 238*cdf0e10cSrcweir { "flowchart-merge", "flowChartMerge" }, 239*cdf0e10cSrcweir { "mso-spt129", "flowChartOfflineStorage" }, 240*cdf0e10cSrcweir { "flowchart-stored-data", "flowChartOnlineStorage" }, 241*cdf0e10cSrcweir { "flowchart-sequential-access", "flowChartMagneticTape" }, 242*cdf0e10cSrcweir { "flowchart-magnetic-disk", "flowChartMagneticDisk" }, 243*cdf0e10cSrcweir { "flowchart-direct-access-storage", "flowChartMagneticDrum" }, 244*cdf0e10cSrcweir { "flowchart-display", "flowChartDisplay" }, 245*cdf0e10cSrcweir { "flowchart-delay", "flowChartDelay" }, 246*cdf0e10cSrcweir { "fontwork-plain-text", "textPlainText" }, 247*cdf0e10cSrcweir { "fontwork-stop", "textStop" }, 248*cdf0e10cSrcweir { "fontwork-triangle-up", "textTriangle" }, 249*cdf0e10cSrcweir { "fontwork-triangle-down", "textTriangleInverted" }, 250*cdf0e10cSrcweir { "fontwork-chevron-up", "textChevron" }, 251*cdf0e10cSrcweir { "fontwork-chevron-down", "textChevronInverted" }, 252*cdf0e10cSrcweir { "mso-spt142", "textRingInside" }, 253*cdf0e10cSrcweir { "mso-spt143", "textRingOutside" }, 254*cdf0e10cSrcweir { "fontwork-arch-up-curve", "textArchUpCurve" }, 255*cdf0e10cSrcweir { "fontwork-arch-down-curve", "textArchDownCurve" }, 256*cdf0e10cSrcweir { "fontwork-circle-curve", "textCircleCurve" }, 257*cdf0e10cSrcweir { "fontwork-open-circle-curve", "textButtonCurve" }, 258*cdf0e10cSrcweir { "fontwork-arch-up-pour", "textArchUpPour" }, 259*cdf0e10cSrcweir { "fontwork-arch-down-pour", "textArchDownPour" }, 260*cdf0e10cSrcweir { "fontwork-circle-pour", "textCirclePour" }, 261*cdf0e10cSrcweir { "fontwork-open-circle-pour", "textButtonPour" }, 262*cdf0e10cSrcweir { "fontwork-curve-up", "textCurveUp" }, 263*cdf0e10cSrcweir { "fontwork-curve-down", "textCurveDown" }, 264*cdf0e10cSrcweir { "fontwork-fade-up-and-right", "textCascadeUp" }, 265*cdf0e10cSrcweir { "fontwork-fade-up-and-left", "textCascadeDown" }, 266*cdf0e10cSrcweir { "fontwork-wave", "textWave1" }, 267*cdf0e10cSrcweir { "mso-spt157", "textWave2" }, 268*cdf0e10cSrcweir { "mso-spt158", "textWave3" }, 269*cdf0e10cSrcweir { "mso-spt159", "textWave4" }, 270*cdf0e10cSrcweir { "fontwork-inflate", "textInflate" }, 271*cdf0e10cSrcweir { "mso-spt161", "textDeflate" }, 272*cdf0e10cSrcweir { "mso-spt162", "textInflateBottom" }, 273*cdf0e10cSrcweir { "mso-spt163", "textDeflateBottom" }, 274*cdf0e10cSrcweir { "mso-spt164", "textInflateTop" }, 275*cdf0e10cSrcweir { "mso-spt165", "textDeflateTop" }, 276*cdf0e10cSrcweir { "mso-spt166", "textDeflateInflate" }, 277*cdf0e10cSrcweir { "mso-spt167", "textDeflateInflateDeflate" }, 278*cdf0e10cSrcweir { "fontwork-fade-right", "textFadeRight" }, 279*cdf0e10cSrcweir { "fontwork-fade-left", "textFadeLeft" }, 280*cdf0e10cSrcweir { "fontwork-fade-up", "textFadeUp" }, 281*cdf0e10cSrcweir { "fontwork-fade-down", "textFadeDown" }, 282*cdf0e10cSrcweir { "fontwork-slant-up", "textSlantUp" }, 283*cdf0e10cSrcweir { "fontwork-slant-down", "textSlantDown" }, 284*cdf0e10cSrcweir { "mso-spt174", "textCanUp" }, 285*cdf0e10cSrcweir { "mso-spt175", "textCanDown" }, 286*cdf0e10cSrcweir { "flowchart-alternate-process", "flowChartAlternateProcess" }, 287*cdf0e10cSrcweir { "flowchart-off-page-connector", "flowChartOffpageConnector" }, 288*cdf0e10cSrcweir { "mso-spt178", "callout90" }, 289*cdf0e10cSrcweir { "mso-spt179", "accentCallout90" }, 290*cdf0e10cSrcweir { "mso-spt180", "borderCallout90" }, 291*cdf0e10cSrcweir { "mso-spt182", "leftRightUpArrow" }, 292*cdf0e10cSrcweir { "sun", "sun" }, 293*cdf0e10cSrcweir { "moon", "moon" }, 294*cdf0e10cSrcweir { "bracket-pair", "bracketPair" }, 295*cdf0e10cSrcweir { "brace-pair", "bracePair" }, 296*cdf0e10cSrcweir { "star4", "seal4" }, 297*cdf0e10cSrcweir { "mso-spt188", "doubleWave" }, 298*cdf0e10cSrcweir { "mso-spt189", "actionButtonBlank" }, 299*cdf0e10cSrcweir { "mso-spt190", "actionButtonHome" }, 300*cdf0e10cSrcweir { "mso-spt191", "actionButtonHelp" }, 301*cdf0e10cSrcweir { "mso-spt192", "actionButtonInformation" }, 302*cdf0e10cSrcweir { "mso-spt193", "actionButtonForwardNext" }, 303*cdf0e10cSrcweir { "mso-spt194", "actionButtonBackPrevious" }, 304*cdf0e10cSrcweir { "mso-spt195", "actionButtonEnd" }, 305*cdf0e10cSrcweir { "mso-spt196", "actionButtonBeginning" }, 306*cdf0e10cSrcweir { "mso-spt197", "actionButtonReturn" }, 307*cdf0e10cSrcweir { "mso-spt198", "actionButtonDocument" }, 308*cdf0e10cSrcweir { "mso-spt199", "actionButtonSound" }, 309*cdf0e10cSrcweir { "mso-spt200", "actionButtonMovie" }, 310*cdf0e10cSrcweir { "mso-spt201", "hostControl" }, 311*cdf0e10cSrcweir { "mso-spt202", "rect" } 312*cdf0e10cSrcweir }; 313*cdf0e10cSrcweir 314*cdf0e10cSrcweir struct StringCheck 315*cdf0e10cSrcweir { 316*cdf0e10cSrcweir bool operator()( const char* s1, const char* s2 ) const 317*cdf0e10cSrcweir { 318*cdf0e10cSrcweir return strcmp( s1, s2 ) == 0; 319*cdf0e10cSrcweir } 320*cdf0e10cSrcweir }; 321*cdf0e10cSrcweir 322*cdf0e10cSrcweir typedef std::hash_map< const char*, const char*, std::hash<const char*>, StringCheck> CustomShapeTypeTranslationHashMap; 323*cdf0e10cSrcweir static CustomShapeTypeTranslationHashMap* pCustomShapeTypeTranslationHashMap = NULL; 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir static const char* lcl_GetPresetGeometry( const char* sShapeType ) 326*cdf0e10cSrcweir { 327*cdf0e10cSrcweir const char* sPresetGeo; 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir if( pCustomShapeTypeTranslationHashMap == NULL ) 330*cdf0e10cSrcweir { 331*cdf0e10cSrcweir pCustomShapeTypeTranslationHashMap = new CustomShapeTypeTranslationHashMap (); 332*cdf0e10cSrcweir for( unsigned int i = 0; i < sizeof( pCustomShapeTypeTranslationTable )/sizeof( CustomShapeTypeTranslationTable ); i ++ ) 333*cdf0e10cSrcweir { 334*cdf0e10cSrcweir (*pCustomShapeTypeTranslationHashMap)[ pCustomShapeTypeTranslationTable[ i ].sOOo ] = pCustomShapeTypeTranslationTable[ i ].sMSO; 335*cdf0e10cSrcweir //DBG(printf("type OOo: %s MSO: %s\n", pCustomShapeTypeTranslationTable[ i ].sOOo, pCustomShapeTypeTranslationTable[ i ].sMSO)); 336*cdf0e10cSrcweir } 337*cdf0e10cSrcweir } 338*cdf0e10cSrcweir 339*cdf0e10cSrcweir sPresetGeo = (*pCustomShapeTypeTranslationHashMap)[ sShapeType ]; 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir if( sPresetGeo == NULL ) 342*cdf0e10cSrcweir sPresetGeo = "rect"; 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir return sPresetGeo; 345*cdf0e10cSrcweir } 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir namespace oox { namespace drawingml { 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir #define GETA(propName) \ 350*cdf0e10cSrcweir GetProperty( rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( #propName ) ) ) 351*cdf0e10cSrcweir 352*cdf0e10cSrcweir #define GETAD(propName) \ 353*cdf0e10cSrcweir ( GetPropertyAndState( rXPropSet, rXPropState, String( RTL_CONSTASCII_USTRINGPARAM( #propName ) ), eState ) && eState == beans::PropertyState_DIRECT_VALUE ) 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir #define GET(variable, propName) \ 356*cdf0e10cSrcweir if ( GETA(propName) ) \ 357*cdf0e10cSrcweir mAny >>= variable; 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir ShapeExport::ShapeExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB, DocumentType eDocumentType ) 360*cdf0e10cSrcweir : DrawingML( pFS, pFB, eDocumentType ) 361*cdf0e10cSrcweir , mnXmlNamespace( nXmlNamespace ) 362*cdf0e10cSrcweir , mnShapeIdMax( 1 ) 363*cdf0e10cSrcweir , mnPictureIdMax( 1 ) 364*cdf0e10cSrcweir , maFraction( 1, 576 ) 365*cdf0e10cSrcweir , maMapModeSrc( MAP_100TH_MM ) 366*cdf0e10cSrcweir , maMapModeDest( MAP_INCH, Point(), maFraction, maFraction ) 367*cdf0e10cSrcweir { 368*cdf0e10cSrcweir } 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir sal_Int32 ShapeExport::GetXmlNamespace() const 371*cdf0e10cSrcweir { 372*cdf0e10cSrcweir return mnXmlNamespace; 373*cdf0e10cSrcweir } 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir ShapeExport& ShapeExport::SetXmlNamespace( sal_Int32 nXmlNamespace ) 376*cdf0e10cSrcweir { 377*cdf0e10cSrcweir mnXmlNamespace = nXmlNamespace; 378*cdf0e10cSrcweir return *this; 379*cdf0e10cSrcweir } 380*cdf0e10cSrcweir 381*cdf0e10cSrcweir awt::Size ShapeExport::MapSize( const awt::Size& rSize ) const 382*cdf0e10cSrcweir { 383*cdf0e10cSrcweir Size aRetSize( OutputDevice::LogicToLogic( Size( rSize.Width, rSize.Height ), maMapModeSrc, maMapModeDest ) ); 384*cdf0e10cSrcweir 385*cdf0e10cSrcweir if ( !aRetSize.Width() ) 386*cdf0e10cSrcweir aRetSize.Width()++; 387*cdf0e10cSrcweir if ( !aRetSize.Height() ) 388*cdf0e10cSrcweir aRetSize.Height()++; 389*cdf0e10cSrcweir return awt::Size( aRetSize.Width(), aRetSize.Height() ); 390*cdf0e10cSrcweir } 391*cdf0e10cSrcweir 392*cdf0e10cSrcweir sal_Bool ShapeExport::NonEmptyText( Reference< XShape > xShape ) 393*cdf0e10cSrcweir { 394*cdf0e10cSrcweir Reference< XSimpleText > xText( xShape, UNO_QUERY ); 395*cdf0e10cSrcweir 396*cdf0e10cSrcweir return ( xText.is() && xText->getString().getLength() ); 397*cdf0e10cSrcweir } 398*cdf0e10cSrcweir 399*cdf0e10cSrcweir ShapeExport& ShapeExport::WriteBezierShape( Reference< XShape > xShape, sal_Bool bClosed ) 400*cdf0e10cSrcweir { 401*cdf0e10cSrcweir DBG(printf("write open bezier shape\n")); 402*cdf0e10cSrcweir 403*cdf0e10cSrcweir FSHelperPtr pFS = GetFS(); 404*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_sp, FSEND ); 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir PolyPolygon aPolyPolygon = EscherPropertyContainer::GetPolyPolygon( xShape ); 407*cdf0e10cSrcweir Rectangle aRect( aPolyPolygon.GetBoundRect() ); 408*cdf0e10cSrcweir awt::Size size = MapSize( awt::Size( aRect.GetWidth(), aRect.GetHeight() ) ); 409*cdf0e10cSrcweir 410*cdf0e10cSrcweir DBG(printf("poly count %d\nsize: %d x %d", aPolyPolygon.Count(), int( size.Width ), int( size.Height ))); 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir // non visual shape properties 413*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND ); 414*cdf0e10cSrcweir pFS->singleElementNS( mnXmlNamespace, XML_cNvPr, 415*cdf0e10cSrcweir XML_id, I32S( GetNewShapeID( xShape ) ), 416*cdf0e10cSrcweir XML_name, IDS( Freeform ), 417*cdf0e10cSrcweir FSEND ); 418*cdf0e10cSrcweir pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr, FSEND ); 419*cdf0e10cSrcweir WriteNonVisualProperties( xShape ); 420*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_nvSpPr ); 421*cdf0e10cSrcweir 422*cdf0e10cSrcweir // visual shape properties 423*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND ); 424*cdf0e10cSrcweir WriteTransformation( aRect ); 425*cdf0e10cSrcweir WritePolyPolygon( aPolyPolygon ); 426*cdf0e10cSrcweir Reference< XPropertySet > xProps( xShape, UNO_QUERY ); 427*cdf0e10cSrcweir if( xProps.is() ) { 428*cdf0e10cSrcweir if( bClosed ) 429*cdf0e10cSrcweir WriteFill( xProps ); 430*cdf0e10cSrcweir WriteOutline( xProps ); 431*cdf0e10cSrcweir } 432*cdf0e10cSrcweir 433*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_spPr ); 434*cdf0e10cSrcweir 435*cdf0e10cSrcweir // write text 436*cdf0e10cSrcweir WriteTextBox( xShape ); 437*cdf0e10cSrcweir 438*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_sp ); 439*cdf0e10cSrcweir 440*cdf0e10cSrcweir return *this; 441*cdf0e10cSrcweir } 442*cdf0e10cSrcweir 443*cdf0e10cSrcweir ShapeExport& ShapeExport::WriteClosedBezierShape( Reference< XShape > xShape ) 444*cdf0e10cSrcweir { 445*cdf0e10cSrcweir return WriteBezierShape( xShape, TRUE ); 446*cdf0e10cSrcweir } 447*cdf0e10cSrcweir 448*cdf0e10cSrcweir ShapeExport& ShapeExport::WriteOpenBezierShape( Reference< XShape > xShape ) 449*cdf0e10cSrcweir { 450*cdf0e10cSrcweir return WriteBezierShape( xShape, FALSE ); 451*cdf0e10cSrcweir } 452*cdf0e10cSrcweir 453*cdf0e10cSrcweir ShapeExport& ShapeExport::WriteCustomShape( Reference< XShape > xShape ) 454*cdf0e10cSrcweir { 455*cdf0e10cSrcweir DBG(printf("write custom shape\n")); 456*cdf0e10cSrcweir 457*cdf0e10cSrcweir Reference< XPropertySet > rXPropSet( xShape, UNO_QUERY ); 458*cdf0e10cSrcweir SdrObjCustomShape* pShape = (SdrObjCustomShape*) GetSdrObjectFromXShape( xShape ); 459*cdf0e10cSrcweir sal_Bool bIsDefaultObject = EscherPropertyContainer::IsDefaultObject( pShape ); 460*cdf0e10cSrcweir sal_Bool bPredefinedHandlesUsed = TRUE; 461*cdf0e10cSrcweir OUString sShapeType; 462*cdf0e10cSrcweir sal_uInt32 nMirrorFlags = 0; 463*cdf0e10cSrcweir MSO_SPT eShapeType = EscherPropertyContainer::GetCustomShapeType( xShape, nMirrorFlags, sShapeType ); 464*cdf0e10cSrcweir const char* sPresetShape = lcl_GetPresetGeometry( USS( sShapeType ) ); 465*cdf0e10cSrcweir DBG(printf("custom shape type: %s ==> %s\n", USS( sShapeType ), sPresetShape)); 466*cdf0e10cSrcweir Sequence< PropertyValue > aGeometrySeq; 467*cdf0e10cSrcweir sal_Int32 nAdjustmentValuesIndex = -1; 468*cdf0e10cSrcweir sal_Int32 nAdjustmentsWhichNeedsToBeConverted = 0; 469*cdf0e10cSrcweir 470*cdf0e10cSrcweir if( GETA( CustomShapeGeometry ) ) { 471*cdf0e10cSrcweir DBG(printf("got custom shape geometry\n")); 472*cdf0e10cSrcweir if( mAny >>= aGeometrySeq ) { 473*cdf0e10cSrcweir 474*cdf0e10cSrcweir DBG(printf("got custom shape geometry sequence\n")); 475*cdf0e10cSrcweir for( int i = 0; i < aGeometrySeq.getLength(); i++ ) { 476*cdf0e10cSrcweir const PropertyValue& rProp = aGeometrySeq[ i ]; 477*cdf0e10cSrcweir DBG(printf("geometry property: %s\n", USS( rProp.Name ))); 478*cdf0e10cSrcweir 479*cdf0e10cSrcweir if( rProp.Name.equalsAscii( "AdjustmentValues" )) 480*cdf0e10cSrcweir nAdjustmentValuesIndex = i; 481*cdf0e10cSrcweir else if( rProp.Name.equalsAscii( "Handles" )) { 482*cdf0e10cSrcweir if( !bIsDefaultObject ) 483*cdf0e10cSrcweir bPredefinedHandlesUsed = FALSE; 484*cdf0e10cSrcweir // TODO: update nAdjustmentsWhichNeedsToBeConverted here 485*cdf0e10cSrcweir } 486*cdf0e10cSrcweir } 487*cdf0e10cSrcweir } 488*cdf0e10cSrcweir } 489*cdf0e10cSrcweir 490*cdf0e10cSrcweir FSHelperPtr pFS = GetFS(); 491*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_sp, FSEND ); 492*cdf0e10cSrcweir 493*cdf0e10cSrcweir // non visual shape properties 494*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND ); 495*cdf0e10cSrcweir pFS->singleElementNS( mnXmlNamespace, XML_cNvPr, 496*cdf0e10cSrcweir XML_id, I32S( GetNewShapeID( xShape ) ), 497*cdf0e10cSrcweir XML_name, IDS( CustomShape ), 498*cdf0e10cSrcweir FSEND ); 499*cdf0e10cSrcweir pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr, FSEND ); 500*cdf0e10cSrcweir WriteNonVisualProperties( xShape ); 501*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_nvSpPr ); 502*cdf0e10cSrcweir 503*cdf0e10cSrcweir // visual shape properties 504*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND ); 505*cdf0e10cSrcweir WriteShapeTransformation( xShape ); 506*cdf0e10cSrcweir if( nAdjustmentValuesIndex != -1 ) 507*cdf0e10cSrcweir WritePresetShape( sPresetShape, eShapeType, bPredefinedHandlesUsed, nAdjustmentsWhichNeedsToBeConverted, aGeometrySeq[ nAdjustmentValuesIndex ] ); 508*cdf0e10cSrcweir else 509*cdf0e10cSrcweir WritePresetShape( sPresetShape ); 510*cdf0e10cSrcweir if( rXPropSet.is() ) 511*cdf0e10cSrcweir { 512*cdf0e10cSrcweir WriteFill( rXPropSet ); 513*cdf0e10cSrcweir WriteOutline( rXPropSet ); 514*cdf0e10cSrcweir } 515*cdf0e10cSrcweir 516*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_spPr ); 517*cdf0e10cSrcweir 518*cdf0e10cSrcweir // write text 519*cdf0e10cSrcweir WriteTextBox( xShape ); 520*cdf0e10cSrcweir 521*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_sp ); 522*cdf0e10cSrcweir 523*cdf0e10cSrcweir return *this; 524*cdf0e10cSrcweir } 525*cdf0e10cSrcweir 526*cdf0e10cSrcweir ShapeExport& ShapeExport::WriteEllipseShape( Reference< XShape > xShape ) 527*cdf0e10cSrcweir { 528*cdf0e10cSrcweir DBG(printf("write ellipse shape\n")); 529*cdf0e10cSrcweir 530*cdf0e10cSrcweir FSHelperPtr pFS = GetFS(); 531*cdf0e10cSrcweir 532*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_sp, FSEND ); 533*cdf0e10cSrcweir 534*cdf0e10cSrcweir // TODO: arc, section, cut, connector 535*cdf0e10cSrcweir 536*cdf0e10cSrcweir // non visual shape properties 537*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND ); 538*cdf0e10cSrcweir pFS->singleElementNS( mnXmlNamespace, XML_cNvPr, 539*cdf0e10cSrcweir XML_id, I32S( GetNewShapeID( xShape ) ), 540*cdf0e10cSrcweir XML_name, IDS( Ellipse ), 541*cdf0e10cSrcweir FSEND ); 542*cdf0e10cSrcweir pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr, FSEND ); 543*cdf0e10cSrcweir WriteNonVisualProperties( xShape ); 544*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_nvSpPr ); 545*cdf0e10cSrcweir 546*cdf0e10cSrcweir // visual shape properties 547*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND ); 548*cdf0e10cSrcweir WriteShapeTransformation( xShape ); 549*cdf0e10cSrcweir WritePresetShape( "ellipse" ); 550*cdf0e10cSrcweir Reference< XPropertySet > xProps( xShape, UNO_QUERY ); 551*cdf0e10cSrcweir if( xProps.is() ) 552*cdf0e10cSrcweir { 553*cdf0e10cSrcweir WriteFill( xProps ); 554*cdf0e10cSrcweir WriteOutline( xProps ); 555*cdf0e10cSrcweir } 556*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_spPr ); 557*cdf0e10cSrcweir 558*cdf0e10cSrcweir // write text 559*cdf0e10cSrcweir WriteTextBox( xShape ); 560*cdf0e10cSrcweir 561*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_sp ); 562*cdf0e10cSrcweir 563*cdf0e10cSrcweir return *this; 564*cdf0e10cSrcweir } 565*cdf0e10cSrcweir 566*cdf0e10cSrcweir ShapeExport& ShapeExport::WriteFill( Reference< XPropertySet > xPropSet ) 567*cdf0e10cSrcweir { 568*cdf0e10cSrcweir FillStyle aFillStyle( FillStyle_NONE ); 569*cdf0e10cSrcweir xPropSet->getPropertyValue( S( "FillStyle" ) ) >>= aFillStyle; 570*cdf0e10cSrcweir 571*cdf0e10cSrcweir if( aFillStyle == FillStyle_BITMAP ) 572*cdf0e10cSrcweir { 573*cdf0e10cSrcweir //DBG(printf ("FillStyle_BITMAP properties\n")); 574*cdf0e10cSrcweir //DBG(dump_pset(rXPropSet)); 575*cdf0e10cSrcweir } 576*cdf0e10cSrcweir 577*cdf0e10cSrcweir if( aFillStyle == FillStyle_NONE || 578*cdf0e10cSrcweir aFillStyle == FillStyle_HATCH ) 579*cdf0e10cSrcweir return *this; 580*cdf0e10cSrcweir 581*cdf0e10cSrcweir switch( aFillStyle ) 582*cdf0e10cSrcweir { 583*cdf0e10cSrcweir case ::com::sun::star::drawing::FillStyle_SOLID : 584*cdf0e10cSrcweir WriteSolidFill( xPropSet ); 585*cdf0e10cSrcweir break; 586*cdf0e10cSrcweir case ::com::sun::star::drawing::FillStyle_GRADIENT : 587*cdf0e10cSrcweir WriteGradientFill( xPropSet ); 588*cdf0e10cSrcweir break; 589*cdf0e10cSrcweir case ::com::sun::star::drawing::FillStyle_BITMAP : 590*cdf0e10cSrcweir WriteBlipFill( xPropSet, S( "FillBitmapURL" ) ); 591*cdf0e10cSrcweir break; 592*cdf0e10cSrcweir default: 593*cdf0e10cSrcweir ; 594*cdf0e10cSrcweir } 595*cdf0e10cSrcweir 596*cdf0e10cSrcweir return *this; 597*cdf0e10cSrcweir } 598*cdf0e10cSrcweir 599*cdf0e10cSrcweir ShapeExport& ShapeExport::WriteGraphicObjectShape( Reference< XShape > xShape ) 600*cdf0e10cSrcweir { 601*cdf0e10cSrcweir DBG(printf("write graphic object shape\n")); 602*cdf0e10cSrcweir 603*cdf0e10cSrcweir if( NonEmptyText( xShape ) ) 604*cdf0e10cSrcweir { 605*cdf0e10cSrcweir WriteTextShape( xShape ); 606*cdf0e10cSrcweir 607*cdf0e10cSrcweir //DBG(dump_pset(mXPropSet)); 608*cdf0e10cSrcweir 609*cdf0e10cSrcweir return *this; 610*cdf0e10cSrcweir } 611*cdf0e10cSrcweir 612*cdf0e10cSrcweir DBG(printf("graphicObject without text\n")); 613*cdf0e10cSrcweir 614*cdf0e10cSrcweir OUString sGraphicURL; 615*cdf0e10cSrcweir Reference< XPropertySet > xShapeProps( xShape, UNO_QUERY ); 616*cdf0e10cSrcweir if( !xShapeProps.is() || !( xShapeProps->getPropertyValue( S( "GraphicURL" ) ) >>= sGraphicURL ) ) 617*cdf0e10cSrcweir { 618*cdf0e10cSrcweir DBG(printf("no graphic URL found\n")); 619*cdf0e10cSrcweir return *this; 620*cdf0e10cSrcweir } 621*cdf0e10cSrcweir 622*cdf0e10cSrcweir FSHelperPtr pFS = GetFS(); 623*cdf0e10cSrcweir 624*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_pic, FSEND ); 625*cdf0e10cSrcweir 626*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_nvPicPr, FSEND ); 627*cdf0e10cSrcweir 628*cdf0e10cSrcweir OUString sName, sDescr; 629*cdf0e10cSrcweir bool bHaveName = xShapeProps->getPropertyValue( S( "Name" ) ) >>= sName; 630*cdf0e10cSrcweir bool bHaveDesc = xShapeProps->getPropertyValue( S( "Description" ) ) >>= sDescr; 631*cdf0e10cSrcweir 632*cdf0e10cSrcweir pFS->singleElementNS( mnXmlNamespace, XML_cNvPr, 633*cdf0e10cSrcweir XML_id, I32S( GetNewShapeID( xShape ) ), 634*cdf0e10cSrcweir XML_name, bHaveName ? USS( sName ) : (OString("Picture ") + OString::valueOf( mnPictureIdMax++ )).getStr(), 635*cdf0e10cSrcweir XML_descr, bHaveDesc ? USS( sDescr ) : NULL, 636*cdf0e10cSrcweir FSEND ); 637*cdf0e10cSrcweir // OOXTODO: //cNvPr children: XML_extLst, XML_hlinkClick, XML_hlinkHover 638*cdf0e10cSrcweir 639*cdf0e10cSrcweir pFS->singleElementNS( mnXmlNamespace, XML_cNvPicPr, 640*cdf0e10cSrcweir // OOXTODO: XML_preferRelativeSize 641*cdf0e10cSrcweir FSEND ); 642*cdf0e10cSrcweir 643*cdf0e10cSrcweir WriteNonVisualProperties( xShape ); 644*cdf0e10cSrcweir 645*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_nvPicPr ); 646*cdf0e10cSrcweir 647*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_blipFill, FSEND ); 648*cdf0e10cSrcweir 649*cdf0e10cSrcweir WriteBlip( sGraphicURL ); 650*cdf0e10cSrcweir 651*cdf0e10cSrcweir bool bStretch = false; 652*cdf0e10cSrcweir if( ( xShapeProps->getPropertyValue( S( "FillBitmapStretch" ) ) >>= bStretch ) && bStretch ) 653*cdf0e10cSrcweir { 654*cdf0e10cSrcweir WriteStretch(); 655*cdf0e10cSrcweir } 656*cdf0e10cSrcweir 657*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_blipFill ); 658*cdf0e10cSrcweir 659*cdf0e10cSrcweir // visual shape properties 660*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND ); 661*cdf0e10cSrcweir WriteShapeTransformation( xShape ); 662*cdf0e10cSrcweir WritePresetShape( "rect" ); 663*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_spPr ); 664*cdf0e10cSrcweir 665*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_pic ); 666*cdf0e10cSrcweir 667*cdf0e10cSrcweir return *this; 668*cdf0e10cSrcweir } 669*cdf0e10cSrcweir 670*cdf0e10cSrcweir ShapeExport& ShapeExport::WriteConnectorShape( Reference< XShape > xShape ) 671*cdf0e10cSrcweir { 672*cdf0e10cSrcweir sal_Bool bFlipH = false; 673*cdf0e10cSrcweir sal_Bool bFlipV = false; 674*cdf0e10cSrcweir 675*cdf0e10cSrcweir DBG(printf("write connector shape\n")); 676*cdf0e10cSrcweir 677*cdf0e10cSrcweir FSHelperPtr pFS = GetFS(); 678*cdf0e10cSrcweir 679*cdf0e10cSrcweir const char* sGeometry = "line"; 680*cdf0e10cSrcweir Reference< XPropertySet > rXPropSet( xShape, UNO_QUERY ); 681*cdf0e10cSrcweir Reference< XPropertyState > rXPropState( xShape, UNO_QUERY ); 682*cdf0e10cSrcweir awt::Point aStartPoint, aEndPoint; 683*cdf0e10cSrcweir Reference< XShape > rXShapeA; 684*cdf0e10cSrcweir Reference< XShape > rXShapeB; 685*cdf0e10cSrcweir PropertyState eState; 686*cdf0e10cSrcweir ConnectorType eConnectorType; 687*cdf0e10cSrcweir if( GETAD( EdgeKind ) ) { 688*cdf0e10cSrcweir mAny >>= eConnectorType; 689*cdf0e10cSrcweir 690*cdf0e10cSrcweir switch( eConnectorType ) { 691*cdf0e10cSrcweir case ConnectorType_CURVE: 692*cdf0e10cSrcweir sGeometry = "curvedConnector3"; 693*cdf0e10cSrcweir break; 694*cdf0e10cSrcweir case ConnectorType_STANDARD: 695*cdf0e10cSrcweir sGeometry = "bentConnector3"; 696*cdf0e10cSrcweir break; 697*cdf0e10cSrcweir default: 698*cdf0e10cSrcweir case ConnectorType_LINE: 699*cdf0e10cSrcweir case ConnectorType_LINES: 700*cdf0e10cSrcweir sGeometry = "straightConnector1"; 701*cdf0e10cSrcweir break; 702*cdf0e10cSrcweir } 703*cdf0e10cSrcweir 704*cdf0e10cSrcweir if( GETAD( EdgeStartPoint ) ) { 705*cdf0e10cSrcweir mAny >>= aStartPoint; 706*cdf0e10cSrcweir if( GETAD( EdgeEndPoint ) ) { 707*cdf0e10cSrcweir mAny >>= aEndPoint; 708*cdf0e10cSrcweir } 709*cdf0e10cSrcweir } 710*cdf0e10cSrcweir GET( rXShapeA, EdgeStartConnection ); 711*cdf0e10cSrcweir GET( rXShapeB, EdgeEndConnection ); 712*cdf0e10cSrcweir } 713*cdf0e10cSrcweir EscherConnectorListEntry aConnectorEntry( xShape, aStartPoint, rXShapeA, aEndPoint, rXShapeB ); 714*cdf0e10cSrcweir 715*cdf0e10cSrcweir Rectangle aRect( Point( aStartPoint.X, aStartPoint.Y ), Point( aEndPoint.X, aEndPoint.Y ) ); 716*cdf0e10cSrcweir if( aRect.getWidth() < 0 ) { 717*cdf0e10cSrcweir bFlipH = TRUE; 718*cdf0e10cSrcweir aRect.setX( aEndPoint.X ); 719*cdf0e10cSrcweir aRect.setWidth( aStartPoint.X - aEndPoint.X ); 720*cdf0e10cSrcweir } 721*cdf0e10cSrcweir 722*cdf0e10cSrcweir if( aRect.getHeight() < 0 ) { 723*cdf0e10cSrcweir bFlipV = TRUE; 724*cdf0e10cSrcweir aRect.setY( aEndPoint.Y ); 725*cdf0e10cSrcweir aRect.setHeight( aStartPoint.Y - aEndPoint.Y ); 726*cdf0e10cSrcweir } 727*cdf0e10cSrcweir 728*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_cxnSp, FSEND ); 729*cdf0e10cSrcweir 730*cdf0e10cSrcweir // non visual shape properties 731*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_nvCxnSpPr, FSEND ); 732*cdf0e10cSrcweir pFS->singleElementNS( mnXmlNamespace, XML_cNvPr, 733*cdf0e10cSrcweir XML_id, I32S( GetNewShapeID( xShape ) ), 734*cdf0e10cSrcweir XML_name, IDS( Line ), 735*cdf0e10cSrcweir FSEND ); 736*cdf0e10cSrcweir // non visual connector shape drawing properties 737*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_cNvCxnSpPr, FSEND ); 738*cdf0e10cSrcweir WriteConnectorConnections( aConnectorEntry, GetShapeID( rXShapeA ), GetShapeID( rXShapeB ) ); 739*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_cNvCxnSpPr ); 740*cdf0e10cSrcweir pFS->singleElementNS( mnXmlNamespace, XML_nvPr, FSEND ); 741*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_nvCxnSpPr ); 742*cdf0e10cSrcweir 743*cdf0e10cSrcweir // visual shape properties 744*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND ); 745*cdf0e10cSrcweir WriteTransformation( aRect, bFlipH, bFlipV ); 746*cdf0e10cSrcweir // TODO: write adjustments (ppt export doesn't work well there either) 747*cdf0e10cSrcweir WritePresetShape( sGeometry ); 748*cdf0e10cSrcweir Reference< XPropertySet > xShapeProps( xShape, UNO_QUERY ); 749*cdf0e10cSrcweir if( xShapeProps.is() ) 750*cdf0e10cSrcweir WriteOutline( xShapeProps ); 751*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_spPr ); 752*cdf0e10cSrcweir 753*cdf0e10cSrcweir // write text 754*cdf0e10cSrcweir WriteTextBox( xShape ); 755*cdf0e10cSrcweir 756*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_cxnSp ); 757*cdf0e10cSrcweir 758*cdf0e10cSrcweir return *this; 759*cdf0e10cSrcweir } 760*cdf0e10cSrcweir 761*cdf0e10cSrcweir ShapeExport& ShapeExport::WriteLineShape( Reference< XShape > xShape ) 762*cdf0e10cSrcweir { 763*cdf0e10cSrcweir sal_Bool bFlipH = false; 764*cdf0e10cSrcweir sal_Bool bFlipV = false; 765*cdf0e10cSrcweir 766*cdf0e10cSrcweir DBG(printf("write line shape\n")); 767*cdf0e10cSrcweir 768*cdf0e10cSrcweir FSHelperPtr pFS = GetFS(); 769*cdf0e10cSrcweir 770*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_sp, FSEND ); 771*cdf0e10cSrcweir 772*cdf0e10cSrcweir PolyPolygon aPolyPolygon = EscherPropertyContainer::GetPolyPolygon( xShape ); 773*cdf0e10cSrcweir if( aPolyPolygon.Count() == 1 && aPolyPolygon[ 0 ].GetSize() == 2) 774*cdf0e10cSrcweir { 775*cdf0e10cSrcweir const Polygon& rPoly = aPolyPolygon[ 0 ]; 776*cdf0e10cSrcweir 777*cdf0e10cSrcweir bFlipH = ( rPoly[ 0 ].X() > rPoly[ 1 ].X() ); 778*cdf0e10cSrcweir bFlipV = ( rPoly[ 0 ].Y() > rPoly[ 1 ].Y() ); 779*cdf0e10cSrcweir } 780*cdf0e10cSrcweir 781*cdf0e10cSrcweir // non visual shape properties 782*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND ); 783*cdf0e10cSrcweir pFS->singleElementNS( mnXmlNamespace, XML_cNvPr, 784*cdf0e10cSrcweir XML_id, I32S( GetNewShapeID( xShape ) ), 785*cdf0e10cSrcweir XML_name, IDS( Line ), 786*cdf0e10cSrcweir FSEND ); 787*cdf0e10cSrcweir pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr, FSEND ); 788*cdf0e10cSrcweir WriteNonVisualProperties( xShape ); 789*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_nvSpPr ); 790*cdf0e10cSrcweir 791*cdf0e10cSrcweir // visual shape properties 792*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND ); 793*cdf0e10cSrcweir WriteShapeTransformation( xShape, bFlipH, bFlipV ); 794*cdf0e10cSrcweir WritePresetShape( "line" ); 795*cdf0e10cSrcweir Reference< XPropertySet > xShapeProps( xShape, UNO_QUERY ); 796*cdf0e10cSrcweir if( xShapeProps.is() ) 797*cdf0e10cSrcweir WriteOutline( xShapeProps ); 798*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_spPr ); 799*cdf0e10cSrcweir 800*cdf0e10cSrcweir // write text 801*cdf0e10cSrcweir WriteTextBox( xShape ); 802*cdf0e10cSrcweir 803*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_sp ); 804*cdf0e10cSrcweir 805*cdf0e10cSrcweir return *this; 806*cdf0e10cSrcweir } 807*cdf0e10cSrcweir 808*cdf0e10cSrcweir ShapeExport& ShapeExport::WriteNonVisualDrawingProperties( Reference< XShape > xShape, const char* pName ) 809*cdf0e10cSrcweir { 810*cdf0e10cSrcweir GetFS()->singleElementNS( mnXmlNamespace, XML_cNvPr, 811*cdf0e10cSrcweir XML_id, I32S( GetNewShapeID( xShape ) ), 812*cdf0e10cSrcweir XML_name, pName, 813*cdf0e10cSrcweir FSEND ); 814*cdf0e10cSrcweir 815*cdf0e10cSrcweir return *this; 816*cdf0e10cSrcweir } 817*cdf0e10cSrcweir 818*cdf0e10cSrcweir ShapeExport& ShapeExport::WriteNonVisualProperties( Reference< XShape > ) 819*cdf0e10cSrcweir { 820*cdf0e10cSrcweir // Override to generate //nvPr elements. 821*cdf0e10cSrcweir return *this; 822*cdf0e10cSrcweir } 823*cdf0e10cSrcweir 824*cdf0e10cSrcweir ShapeExport& ShapeExport::WriteRectangleShape( Reference< XShape > xShape ) 825*cdf0e10cSrcweir { 826*cdf0e10cSrcweir DBG(printf("write rectangle shape\n")); 827*cdf0e10cSrcweir 828*cdf0e10cSrcweir FSHelperPtr pFS = GetFS(); 829*cdf0e10cSrcweir 830*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_sp, FSEND ); 831*cdf0e10cSrcweir 832*cdf0e10cSrcweir sal_Int32 nRadius = 0; 833*cdf0e10cSrcweir 834*cdf0e10cSrcweir Reference< XPropertySet > xShapeProps( xShape, UNO_QUERY ); 835*cdf0e10cSrcweir if( xShapeProps.is() ) 836*cdf0e10cSrcweir { 837*cdf0e10cSrcweir xShapeProps->getPropertyValue( S( "CornerRadius" ) ) >>= nRadius; 838*cdf0e10cSrcweir } 839*cdf0e10cSrcweir 840*cdf0e10cSrcweir if( nRadius ) 841*cdf0e10cSrcweir { 842*cdf0e10cSrcweir nRadius = MapSize( awt::Size( nRadius, 0 ) ).Width; 843*cdf0e10cSrcweir } 844*cdf0e10cSrcweir 845*cdf0e10cSrcweir // non visual shape properties 846*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND ); 847*cdf0e10cSrcweir pFS->singleElementNS( mnXmlNamespace, XML_cNvPr, 848*cdf0e10cSrcweir XML_id, I32S( GetNewShapeID( xShape ) ), 849*cdf0e10cSrcweir XML_name, IDS( Rectangle ), 850*cdf0e10cSrcweir FSEND ); 851*cdf0e10cSrcweir pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr, FSEND ); 852*cdf0e10cSrcweir WriteNonVisualProperties( xShape ); 853*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_nvSpPr ); 854*cdf0e10cSrcweir 855*cdf0e10cSrcweir // visual shape properties 856*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND ); 857*cdf0e10cSrcweir WriteShapeTransformation( xShape ); 858*cdf0e10cSrcweir WritePresetShape( "rect" ); 859*cdf0e10cSrcweir Reference< XPropertySet > xProps( xShape, UNO_QUERY ); 860*cdf0e10cSrcweir if( xProps.is() ) 861*cdf0e10cSrcweir { 862*cdf0e10cSrcweir WriteFill( xProps ); 863*cdf0e10cSrcweir WriteOutline( xProps ); 864*cdf0e10cSrcweir } 865*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_spPr ); 866*cdf0e10cSrcweir 867*cdf0e10cSrcweir // write text 868*cdf0e10cSrcweir WriteTextBox( xShape ); 869*cdf0e10cSrcweir 870*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_sp ); 871*cdf0e10cSrcweir 872*cdf0e10cSrcweir return *this; 873*cdf0e10cSrcweir } 874*cdf0e10cSrcweir 875*cdf0e10cSrcweir typedef ShapeExport& (ShapeExport::*ShapeConverter)( Reference< XShape > ); 876*cdf0e10cSrcweir typedef std::hash_map< const char*, ShapeConverter, std::hash<const char*>, StringCheck> NameToConvertMapType; 877*cdf0e10cSrcweir 878*cdf0e10cSrcweir static const NameToConvertMapType& lcl_GetConverters() 879*cdf0e10cSrcweir { 880*cdf0e10cSrcweir static bool shape_map_inited = false; 881*cdf0e10cSrcweir static NameToConvertMapType shape_converters; 882*cdf0e10cSrcweir if( shape_map_inited ) 883*cdf0e10cSrcweir { 884*cdf0e10cSrcweir return shape_converters; 885*cdf0e10cSrcweir } 886*cdf0e10cSrcweir 887*cdf0e10cSrcweir shape_converters[ "com.sun.star.drawing.ClosedBezierShape" ] = &ShapeExport::WriteClosedBezierShape; 888*cdf0e10cSrcweir shape_converters[ "com.sun.star.drawing.ConnectorShape" ] = &ShapeExport::WriteConnectorShape; 889*cdf0e10cSrcweir shape_converters[ "com.sun.star.drawing.CustomShape" ] = &ShapeExport::WriteCustomShape; 890*cdf0e10cSrcweir shape_converters[ "com.sun.star.drawing.EllipseShape" ] = &ShapeExport::WriteEllipseShape; 891*cdf0e10cSrcweir shape_converters[ "com.sun.star.drawing.GraphicObjectShape" ] = &ShapeExport::WriteGraphicObjectShape; 892*cdf0e10cSrcweir shape_converters[ "com.sun.star.drawing.LineShape" ] = &ShapeExport::WriteLineShape; 893*cdf0e10cSrcweir shape_converters[ "com.sun.star.drawing.OpenBezierShape" ] = &ShapeExport::WriteOpenBezierShape; 894*cdf0e10cSrcweir shape_converters[ "com.sun.star.drawing.RectangleShape" ] = &ShapeExport::WriteRectangleShape; 895*cdf0e10cSrcweir shape_converters[ "com.sun.star.drawing.TextShape" ] = &ShapeExport::WriteTextShape; 896*cdf0e10cSrcweir shape_converters[ "com.sun.star.presentation.DateTimeShape" ] = &ShapeExport::WriteTextShape; 897*cdf0e10cSrcweir shape_converters[ "com.sun.star.presentation.FooterShape" ] = &ShapeExport::WriteTextShape; 898*cdf0e10cSrcweir shape_converters[ "com.sun.star.presentation.HeaderShape" ] = &ShapeExport::WriteTextShape; 899*cdf0e10cSrcweir shape_converters[ "com.sun.star.presentation.NotesShape" ] = &ShapeExport::WriteTextShape; 900*cdf0e10cSrcweir shape_converters[ "com.sun.star.presentation.OutlinerShape" ] = &ShapeExport::WriteTextShape; 901*cdf0e10cSrcweir shape_converters[ "com.sun.star.presentation.SlideNumberShape" ] = &ShapeExport::WriteTextShape; 902*cdf0e10cSrcweir shape_converters[ "com.sun.star.presentation.TitleTextShape" ] = &ShapeExport::WriteTextShape; 903*cdf0e10cSrcweir shape_map_inited = true; 904*cdf0e10cSrcweir 905*cdf0e10cSrcweir return shape_converters; 906*cdf0e10cSrcweir } 907*cdf0e10cSrcweir 908*cdf0e10cSrcweir ShapeExport& ShapeExport::WriteShape( Reference< XShape > xShape ) 909*cdf0e10cSrcweir { 910*cdf0e10cSrcweir OUString sShapeType = xShape->getShapeType(); 911*cdf0e10cSrcweir DBG( printf( "write shape: %s\n", USS( sShapeType ) ) ); 912*cdf0e10cSrcweir NameToConvertMapType::const_iterator aConverter = lcl_GetConverters().find( USS( sShapeType ) ); 913*cdf0e10cSrcweir if( aConverter == lcl_GetConverters().end() ) 914*cdf0e10cSrcweir { 915*cdf0e10cSrcweir DBG( printf( "unknown shape\n" ) ); 916*cdf0e10cSrcweir return WriteUnknownShape( xShape ); 917*cdf0e10cSrcweir } 918*cdf0e10cSrcweir (this->*(aConverter->second))( xShape ); 919*cdf0e10cSrcweir 920*cdf0e10cSrcweir return *this; 921*cdf0e10cSrcweir } 922*cdf0e10cSrcweir 923*cdf0e10cSrcweir ShapeExport& ShapeExport::WriteTextBox( Reference< XShape > xShape ) 924*cdf0e10cSrcweir { 925*cdf0e10cSrcweir if( NonEmptyText( xShape ) ) 926*cdf0e10cSrcweir { 927*cdf0e10cSrcweir FSHelperPtr pFS = GetFS(); 928*cdf0e10cSrcweir 929*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_txBody, FSEND ); 930*cdf0e10cSrcweir WriteText( xShape ); 931*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_txBody ); 932*cdf0e10cSrcweir } 933*cdf0e10cSrcweir 934*cdf0e10cSrcweir return *this; 935*cdf0e10cSrcweir } 936*cdf0e10cSrcweir 937*cdf0e10cSrcweir ShapeExport& ShapeExport::WriteTextShape( Reference< XShape > xShape ) 938*cdf0e10cSrcweir { 939*cdf0e10cSrcweir FSHelperPtr pFS = GetFS(); 940*cdf0e10cSrcweir 941*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_sp, FSEND ); 942*cdf0e10cSrcweir 943*cdf0e10cSrcweir // non visual shape properties 944*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_nvSpPr, FSEND ); 945*cdf0e10cSrcweir WriteNonVisualDrawingProperties( xShape, IDS( TextShape ) ); 946*cdf0e10cSrcweir pFS->singleElementNS( mnXmlNamespace, XML_cNvSpPr, XML_txBox, "1", FSEND ); 947*cdf0e10cSrcweir WriteNonVisualProperties( xShape ); 948*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_nvSpPr ); 949*cdf0e10cSrcweir 950*cdf0e10cSrcweir // visual shape properties 951*cdf0e10cSrcweir pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND ); 952*cdf0e10cSrcweir WriteShapeTransformation( xShape ); 953*cdf0e10cSrcweir WritePresetShape( "rect" ); 954*cdf0e10cSrcweir WriteBlipFill( Reference< XPropertySet >(xShape, UNO_QUERY ), S( "GraphicURL" ) ); 955*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_spPr ); 956*cdf0e10cSrcweir 957*cdf0e10cSrcweir WriteTextBox( xShape ); 958*cdf0e10cSrcweir 959*cdf0e10cSrcweir pFS->endElementNS( mnXmlNamespace, XML_sp ); 960*cdf0e10cSrcweir 961*cdf0e10cSrcweir return *this; 962*cdf0e10cSrcweir } 963*cdf0e10cSrcweir 964*cdf0e10cSrcweir ShapeExport& ShapeExport::WriteUnknownShape( Reference< XShape > ) 965*cdf0e10cSrcweir { 966*cdf0e10cSrcweir // Override this method to do something useful. 967*cdf0e10cSrcweir return *this; 968*cdf0e10cSrcweir } 969*cdf0e10cSrcweir 970*cdf0e10cSrcweir size_t ShapeExport::ShapeHash::operator()( const ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > rXShape ) const 971*cdf0e10cSrcweir { 972*cdf0e10cSrcweir return maHashFunction( USS( rXShape->getShapeType() ) ); 973*cdf0e10cSrcweir } 974*cdf0e10cSrcweir 975*cdf0e10cSrcweir sal_Int32 ShapeExport::GetNewShapeID( const Reference< XShape > rXShape ) 976*cdf0e10cSrcweir { 977*cdf0e10cSrcweir sal_Int32 nID = GetFB()->GetUniqueId(); 978*cdf0e10cSrcweir 979*cdf0e10cSrcweir maShapeMap[ rXShape ] = nID; 980*cdf0e10cSrcweir 981*cdf0e10cSrcweir return nID; 982*cdf0e10cSrcweir } 983*cdf0e10cSrcweir 984*cdf0e10cSrcweir sal_Int32 ShapeExport::GetShapeID( const Reference< XShape > rXShape ) 985*cdf0e10cSrcweir { 986*cdf0e10cSrcweir ShapeHashMap::const_iterator aIter = maShapeMap.find( rXShape ); 987*cdf0e10cSrcweir 988*cdf0e10cSrcweir if( aIter == maShapeMap.end() ) 989*cdf0e10cSrcweir return -1; 990*cdf0e10cSrcweir 991*cdf0e10cSrcweir return aIter->second; 992*cdf0e10cSrcweir } 993*cdf0e10cSrcweir 994*cdf0e10cSrcweir } } 995