diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-21 18:38:50 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-21 18:38:50 +0200 |
commit | 112be98c928c38c5cc63c99e86e0b58b8d2dfe29 (patch) | |
tree | 053e3d7dfa670c6c1924d4095d9cfbe622b4b5ba | |
parent | gnumake4: postmerge fixes in hwp (diff) | |
parent | Generate correctly named import library for WNTGCC (diff) | |
download | core-112be98c928c38c5cc63c99e86e0b58b8d2dfe29.tar.gz core-112be98c928c38c5cc63c99e86e0b58b8d2dfe29.zip |
resyncing to master
185 files changed, 13019 insertions, 5141 deletions
diff --git a/filter/inc/filter/msfilter/escherex.hxx b/filter/inc/filter/msfilter/escherex.hxx index 37dbadc207b3..4afd1f006d45 100644 --- a/filter/inc/filter/msfilter/escherex.hxx +++ b/filter/inc/filter/msfilter/escherex.hxx @@ -50,264 +50,263 @@ /*Record Name FBT-Value Instance Contents Wrd Exl PPt Ver*/ // In der Mickysoft-Doku heissen die msofbt... statt ESCHER_... -#define ESCHER_DggContainer 0xF000 /* per-document data X X X */ -#define ESCHER_Dgg 0xF006 /* an FDGG and several FIDCLs X X X 0 */ -#define ESCHER_CLSID 0xF016 /* the CLSID of the application that put the data on the clipboard C C C 0 */ -#define ESCHER_OPT 0xF00B /* count of properties the document-wide default shape properties X X X 3 */ -#define ESCHER_ColorMRU 0xF11A /* count of colors the colors in the MRU swatch X X X 0 */ -#define ESCHER_SplitMenuColors 0xF11E /* count of colors the colors in the top-level split menus X X X 0 */ -#define ESCHER_BstoreContainer 0xF001 /* count of BLIPs all images in the document (JPEGs, metafiles, etc.) X X X */ -#define ESCHER_BSE 0xF007 /* BLIP type an FBSE (one per BLIP) X X X 2 */ -#define ESCHER_BlipFirst 0xF018 /* range of fbts reserved for various kinds of BLIPs X X X */ -#define ESCHER_BlipLast 0xF117 /* range of fbts reserved for various kinds of BLIPs X X X */ - -#define ESCHER_DgContainer 0xF002 /* per-sheet/page/slide data X X X */ -#define ESCHER_Dg 0xF008 /* drawing ID an FDG X X X 0 */ -#define ESCHER_RegroupItems 0xF118 /* count of regroup entries several FRITs X X X 0 */ -#define ESCHER_ColorScheme 0xF120 /* count of colors the colors of the source host's color scheme C C 0 */ -#define ESCHER_SpgrContainer 0xF003 /* several SpContainers, the first of which is the group shape itself X X X */ -#define ESCHER_SpContainer 0xF004 /* a shape X X X */ -#define ESCHER_Spgr 0xF009 /* an FSPGR; only present if the shape is a group shape X X X 1 */ -#define ESCHER_Sp 0xF00A /* shape type an FSP X X X 2 */ +#define ESCHER_DggContainer 0xF000 /* per-document data X X X */ +#define ESCHER_Dgg 0xF006 /* an FDGG and several FIDCLs X X X 0 */ +#define ESCHER_CLSID 0xF016 /* the CLSID of the application that put the data on the clipboard C C C 0 */ +#define ESCHER_OPT 0xF00B /* count of properties the document-wide default shape properties X X X 3 */ +#define ESCHER_ColorMRU 0xF11A /* count of colors the colors in the MRU swatch X X X 0 */ +#define ESCHER_SplitMenuColors 0xF11E /* count of colors the colors in the top-level split menus X X X 0 */ +#define ESCHER_BstoreContainer 0xF001 /* count of BLIPs all images in the document (JPEGs, metafiles, etc.) X X X */ +#define ESCHER_BSE 0xF007 /* BLIP type an FBSE (one per BLIP) X X X 2 */ +#define ESCHER_BlipFirst 0xF018 /* range of fbts reserved for various kinds of BLIPs X X X */ +#define ESCHER_BlipLast 0xF117 /* range of fbts reserved for various kinds of BLIPs X X X */ + +#define ESCHER_DgContainer 0xF002 /* per-sheet/page/slide data X X X */ +#define ESCHER_Dg 0xF008 /* drawing ID an FDG X X X 0 */ +#define ESCHER_RegroupItems 0xF118 /* count of regroup entries several FRITs X X X 0 */ +#define ESCHER_ColorScheme 0xF120 /* count of colors the colors of the source host's color scheme C C 0 */ +#define ESCHER_SpgrContainer 0xF003 /* several SpContainers, the first of which is the group shape itself X X X */ +#define ESCHER_SpContainer 0xF004 /* a shape X X X */ +#define ESCHER_Spgr 0xF009 /* an FSPGR; only present if the shape is a group shape X X X 1 */ +#define ESCHER_Sp 0xF00A /* shape type an FSP X X X 2 */ //#define ESCHER_OPT 0xF00B /* count of properties a shape property table X X X 3 */ -#define ESCHER_Textbox 0xF00C /* RTF text C C C 0 */ -#define ESCHER_ClientTextbox 0xF00D /* host-defined the text in the textbox, in host-defined format X X X */ -#define ESCHER_Anchor 0xF00E /* a RECT, in 100000ths of an inch C C C 0 */ -#define ESCHER_ChildAnchor 0xF00F /* a RECT, in units relative to the parent group X X X 0 */ -#define ESCHER_ClientAnchor 0xF010 /* host-defined the location of the shape, in a host-defined format X X X */ -#define ESCHER_ClientData 0xF011 /* host-defined host-specific data X X X */ -#define ESCHER_OleObject 0xF11F /* a serialized IStorage for an OLE object C C C 0 */ -#define ESCHER_DeletedPspl 0xF11D /* an FPSPL; only present in top-level deleted shapes X 0 */ -#define ESCHER_SolverContainer 0xF005 /* count of rules the rules governing shapes X X X */ -#define ESCHER_ConnectorRule 0xF012 /* an FConnectorRule X X 1 */ -#define ESCHER_AlignRule 0xF013 /* an FAlignRule X X X 0 */ -#define ESCHER_ArcRule 0xF014 /* an FARCRU X X X 0 */ -#define ESCHER_ClientRule 0xF015 /* host-defined host-defined */ -#define ESCHER_CalloutRule 0xF017 /* an FCORU X X X 0 */ -#define ESCHER_Selection 0xF119 /* an FDGSL followed by the SPIDs of the shapes in the selection X 0 */ -#define ESCHER_UDefProp 0xF122 - -#define SHAPEFLAG_GROUP 0x001 // This shape is a group shape -#define SHAPEFLAG_CHILD 0x002 // Not a top-level shape -#define SHAPEFLAG_PATRIARCH 0x004 // This is the topmost group shape. Exactly one of these per drawing. -#define SHAPEFLAG_DELETED 0x008 // The shape has been deleted -#define SHAPEFLAG_OLESHAPE 0x010 // The shape is an OLE object -#define SHAPEFLAG_HAVEMASTER 0x020 // Shape has a hspMaster property -#define SHAPEFLAG_FLIPH 0x040 // Shape is flipped horizontally -#define SHAPEFLAG_FLIPV 0x080 // Shape is flipped vertically -#define SHAPEFLAG_CONNECTOR 0x100 // Connector type of shape -#define SHAPEFLAG_HAVEANCHOR 0x200 // Shape has an anchor of some kind -#define SHAPEFLAG_BACKGROUND 0x400 // Background shape -#define SHAPEFLAG_HAVESPT 0x800 // Shape has a shape type property - -#define ESCHER_ShpInst_Min 0 -#define ESCHER_ShpInst_NotPrimitive ESCHER_ShpInst_Min -#define ESCHER_ShpInst_Rectangle 1 -#define ESCHER_ShpInst_RoundRectangle 2 -#define ESCHER_ShpInst_Ellipse 3 -#define ESCHER_ShpInst_Diamond 4 -#define ESCHER_ShpInst_IsocelesTriangle 5 -#define ESCHER_ShpInst_RightTriangle 6 -#define ESCHER_ShpInst_Parallelogram 7 -#define ESCHER_ShpInst_Trapezoid 8 -#define ESCHER_ShpInst_Hexagon 9 -#define ESCHER_ShpInst_Octagon 10 -#define ESCHER_ShpInst_Plus 11 -#define ESCHER_ShpInst_Star 12 -#define ESCHER_ShpInst_Arrow 13 -#define ESCHER_ShpInst_ThickArrow 14 -#define ESCHER_ShpInst_HomePlate 15 -#define ESCHER_ShpInst_Cube 16 -#define ESCHER_ShpInst_Balloon 17 -#define ESCHER_ShpInst_Seal 18 -#define ESCHER_ShpInst_Arc 19 -#define ESCHER_ShpInst_Line 20 -#define ESCHER_ShpInst_Plaque 21 -#define ESCHER_ShpInst_Can 22 -#define ESCHER_ShpInst_Donut 23 -#define ESCHER_ShpInst_TextSimple 24 -#define ESCHER_ShpInst_TextOctagon 25 -#define ESCHER_ShpInst_TextHexagon 26 -#define ESCHER_ShpInst_TextCurve 27 -#define ESCHER_ShpInst_TextWave 28 -#define ESCHER_ShpInst_TextRing 29 -#define ESCHER_ShpInst_TextOnCurve 30 -#define ESCHER_ShpInst_TextOnRing 31 -#define ESCHER_ShpInst_StraightConnector1 32 -#define ESCHER_ShpInst_BentConnector2 33 -#define ESCHER_ShpInst_BentConnector3 34 -#define ESCHER_ShpInst_BentConnector4 35 -#define ESCHER_ShpInst_BentConnector5 36 -#define ESCHER_ShpInst_CurvedConnector2 37 -#define ESCHER_ShpInst_CurvedConnector3 38 -#define ESCHER_ShpInst_CurvedConnector4 39 -#define ESCHER_ShpInst_CurvedConnector5 40 -#define ESCHER_ShpInst_Callout1 41 -#define ESCHER_ShpInst_Callout2 42 -#define ESCHER_ShpInst_Callout3 43 -#define ESCHER_ShpInst_AccentCallout1 44 -#define ESCHER_ShpInst_AccentCallout2 45 -#define ESCHER_ShpInst_AccentCallout3 46 -#define ESCHER_ShpInst_BorderCallout1 47 -#define ESCHER_ShpInst_BorderCallout2 48 -#define ESCHER_ShpInst_BorderCallout3 49 -#define ESCHER_ShpInst_AccentBorderCallout1 50 -#define ESCHER_ShpInst_AccentBorderCallout2 51 -#define ESCHER_ShpInst_AccentBorderCallout3 52 -#define ESCHER_ShpInst_Ribbon 53 -#define ESCHER_ShpInst_Ribbon2 54 -#define ESCHER_ShpInst_Chevron 55 -#define ESCHER_ShpInst_Pentagon 56 -#define ESCHER_ShpInst_NoSmoking 57 -#define ESCHER_ShpInst_Seal8 58 -#define ESCHER_ShpInst_Seal16 59 -#define ESCHER_ShpInst_Seal32 60 -#define ESCHER_ShpInst_WedgeRectCallout 61 -#define ESCHER_ShpInst_WedgeRRectCallout 62 -#define ESCHER_ShpInst_WedgeEllipseCallout 63 -#define ESCHER_ShpInst_Wave 64 -#define ESCHER_ShpInst_FoldedCorner 65 -#define ESCHER_ShpInst_LeftArrow 66 -#define ESCHER_ShpInst_DownArrow 67 -#define ESCHER_ShpInst_UpArrow 68 -#define ESCHER_ShpInst_LeftRightArrow 69 -#define ESCHER_ShpInst_UpDownArrow 70 -#define ESCHER_ShpInst_IrregularSeal1 71 -#define ESCHER_ShpInst_IrregularSeal2 72 -#define ESCHER_ShpInst_LightningBolt 73 -#define ESCHER_ShpInst_Heart 74 -#define ESCHER_ShpInst_PictureFrame 75 -#define ESCHER_ShpInst_QuadArrow 76 -#define ESCHER_ShpInst_LeftArrowCallout 77 -#define ESCHER_ShpInst_RightArrowCallout 78 -#define ESCHER_ShpInst_UpArrowCallout 79 -#define ESCHER_ShpInst_DownArrowCallout 80 -#define ESCHER_ShpInst_LeftRightArrowCallout 81 -#define ESCHER_ShpInst_UpDownArrowCallout 82 -#define ESCHER_ShpInst_QuadArrowCallout 83 -#define ESCHER_ShpInst_Bevel 84 -#define ESCHER_ShpInst_LeftBracket 85 -#define ESCHER_ShpInst_RightBracket 86 -#define ESCHER_ShpInst_LeftBrace 87 -#define ESCHER_ShpInst_RightBrace 88 -#define ESCHER_ShpInst_LeftUpArrow 89 -#define ESCHER_ShpInst_BentUpArrow 90 -#define ESCHER_ShpInst_BentArrow 91 -#define ESCHER_ShpInst_Seal24 92 -#define ESCHER_ShpInst_StripedRightArrow 93 -#define ESCHER_ShpInst_NotchedRightArrow 94 -#define ESCHER_ShpInst_BlockArc 95 -#define ESCHER_ShpInst_SmileyFace 96 -#define ESCHER_ShpInst_VerticalScroll 97 -#define ESCHER_ShpInst_HorizontalScroll 98 -#define ESCHER_ShpInst_CircularArrow 99 -#define ESCHER_ShpInst_NotchedCircularArrow 100 -#define ESCHER_ShpInst_UturnArrow 101 -#define ESCHER_ShpInst_CurvedRightArrow 102 -#define ESCHER_ShpInst_CurvedLeftArrow 103 -#define ESCHER_ShpInst_CurvedUpArrow 104 -#define ESCHER_ShpInst_CurvedDownArrow 105 -#define ESCHER_ShpInst_CloudCallout 106 -#define ESCHER_ShpInst_EllipseRibbon 107 -#define ESCHER_ShpInst_EllipseRibbon2 108 -#define ESCHER_ShpInst_FlowChartProcess 109 -#define ESCHER_ShpInst_FlowChartDecision 110 -#define ESCHER_ShpInst_FlowChartInputOutput 111 +#define ESCHER_Textbox 0xF00C /* RTF text C C C 0 */ +#define ESCHER_ClientTextbox 0xF00D /* host-defined the text in the textbox, in host-defined format X X X */ +#define ESCHER_Anchor 0xF00E /* a RECT, in 100000ths of an inch C C C 0 */ +#define ESCHER_ChildAnchor 0xF00F /* a RECT, in units relative to the parent group X X X 0 */ +#define ESCHER_ClientAnchor 0xF010 /* host-defined the location of the shape, in a host-defined format X X X */ +#define ESCHER_ClientData 0xF011 /* host-defined host-specific data X X X */ +#define ESCHER_OleObject 0xF11F /* a serialized IStorage for an OLE object C C C 0 */ +#define ESCHER_DeletedPspl 0xF11D /* an FPSPL; only present in top-level deleted shapes X 0 */ +#define ESCHER_SolverContainer 0xF005 /* count of rules the rules governing shapes X X X */ +#define ESCHER_ConnectorRule 0xF012 /* an FConnectorRule X X 1 */ +#define ESCHER_AlignRule 0xF013 /* an FAlignRule X X X 0 */ +#define ESCHER_ArcRule 0xF014 /* an FARCRU X X X 0 */ +#define ESCHER_ClientRule 0xF015 /* host-defined host-defined */ +#define ESCHER_CalloutRule 0xF017 /* an FCORU X X X 0 */ +#define ESCHER_Selection 0xF119 /* an FDGSL followed by the SPIDs of the shapes in the selection X 0 */ +#define ESCHER_UDefProp 0xF122 + +#define SHAPEFLAG_GROUP 0x001 /* This shape is a group shape */ +#define SHAPEFLAG_CHILD 0x002 /* Not a top-level shape */ +#define SHAPEFLAG_PATRIARCH 0x004 /* This is the topmost group shape. Exactly one of these per drawing. */ +#define SHAPEFLAG_DELETED 0x008 /* The shape has been deleted */ +#define SHAPEFLAG_OLESHAPE 0x010 /* The shape is an OLE object */ +#define SHAPEFLAG_HAVEMASTER 0x020 /* Shape has a hspMaster property */ +#define SHAPEFLAG_FLIPH 0x040 /* Shape is flipped horizontally */ +#define SHAPEFLAG_FLIPV 0x080 /* Shape is flipped vertically */ +#define SHAPEFLAG_CONNECTOR 0x100 /* Connector type of shape */ +#define SHAPEFLAG_HAVEANCHOR 0x200 /* Shape has an anchor of some kind */ +#define SHAPEFLAG_BACKGROUND 0x400 /* Background shape */ +#define SHAPEFLAG_HAVESPT 0x800 /* Shape has a shape type property */ + +#define ESCHER_ShpInst_Min 0 +#define ESCHER_ShpInst_NotPrimitive ESCHER_ShpInst_Min +#define ESCHER_ShpInst_Rectangle 1 +#define ESCHER_ShpInst_RoundRectangle 2 +#define ESCHER_ShpInst_Ellipse 3 +#define ESCHER_ShpInst_Diamond 4 +#define ESCHER_ShpInst_IsocelesTriangle 5 +#define ESCHER_ShpInst_RightTriangle 6 +#define ESCHER_ShpInst_Parallelogram 7 +#define ESCHER_ShpInst_Trapezoid 8 +#define ESCHER_ShpInst_Hexagon 9 +#define ESCHER_ShpInst_Octagon 10 +#define ESCHER_ShpInst_Plus 11 +#define ESCHER_ShpInst_Star 12 +#define ESCHER_ShpInst_Arrow 13 +#define ESCHER_ShpInst_ThickArrow 14 +#define ESCHER_ShpInst_HomePlate 15 +#define ESCHER_ShpInst_Cube 16 +#define ESCHER_ShpInst_Balloon 17 +#define ESCHER_ShpInst_Seal 18 +#define ESCHER_ShpInst_Arc 19 +#define ESCHER_ShpInst_Line 20 +#define ESCHER_ShpInst_Plaque 21 +#define ESCHER_ShpInst_Can 22 +#define ESCHER_ShpInst_Donut 23 +#define ESCHER_ShpInst_TextSimple 24 +#define ESCHER_ShpInst_TextOctagon 25 +#define ESCHER_ShpInst_TextHexagon 26 +#define ESCHER_ShpInst_TextCurve 27 +#define ESCHER_ShpInst_TextWave 28 +#define ESCHER_ShpInst_TextRing 29 +#define ESCHER_ShpInst_TextOnCurve 30 +#define ESCHER_ShpInst_TextOnRing 31 +#define ESCHER_ShpInst_StraightConnector1 32 +#define ESCHER_ShpInst_BentConnector2 33 +#define ESCHER_ShpInst_BentConnector3 34 +#define ESCHER_ShpInst_BentConnector4 35 +#define ESCHER_ShpInst_BentConnector5 36 +#define ESCHER_ShpInst_CurvedConnector2 37 +#define ESCHER_ShpInst_CurvedConnector3 38 +#define ESCHER_ShpInst_CurvedConnector4 39 +#define ESCHER_ShpInst_CurvedConnector5 40 +#define ESCHER_ShpInst_Callout1 41 +#define ESCHER_ShpInst_Callout2 42 +#define ESCHER_ShpInst_Callout3 43 +#define ESCHER_ShpInst_AccentCallout1 44 +#define ESCHER_ShpInst_AccentCallout2 45 +#define ESCHER_ShpInst_AccentCallout3 46 +#define ESCHER_ShpInst_BorderCallout1 47 +#define ESCHER_ShpInst_BorderCallout2 48 +#define ESCHER_ShpInst_BorderCallout3 49 +#define ESCHER_ShpInst_AccentBorderCallout1 50 +#define ESCHER_ShpInst_AccentBorderCallout2 51 +#define ESCHER_ShpInst_AccentBorderCallout3 52 +#define ESCHER_ShpInst_Ribbon 53 +#define ESCHER_ShpInst_Ribbon2 54 +#define ESCHER_ShpInst_Chevron 55 +#define ESCHER_ShpInst_Pentagon 56 +#define ESCHER_ShpInst_NoSmoking 57 +#define ESCHER_ShpInst_Seal8 58 +#define ESCHER_ShpInst_Seal16 59 +#define ESCHER_ShpInst_Seal32 60 +#define ESCHER_ShpInst_WedgeRectCallout 61 +#define ESCHER_ShpInst_WedgeRRectCallout 62 +#define ESCHER_ShpInst_WedgeEllipseCallout 63 +#define ESCHER_ShpInst_Wave 64 +#define ESCHER_ShpInst_FoldedCorner 65 +#define ESCHER_ShpInst_LeftArrow 66 +#define ESCHER_ShpInst_DownArrow 67 +#define ESCHER_ShpInst_UpArrow 68 +#define ESCHER_ShpInst_LeftRightArrow 69 +#define ESCHER_ShpInst_UpDownArrow 70 +#define ESCHER_ShpInst_IrregularSeal1 71 +#define ESCHER_ShpInst_IrregularSeal2 72 +#define ESCHER_ShpInst_LightningBolt 73 +#define ESCHER_ShpInst_Heart 74 +#define ESCHER_ShpInst_PictureFrame 75 +#define ESCHER_ShpInst_QuadArrow 76 +#define ESCHER_ShpInst_LeftArrowCallout 77 +#define ESCHER_ShpInst_RightArrowCallout 78 +#define ESCHER_ShpInst_UpArrowCallout 79 +#define ESCHER_ShpInst_DownArrowCallout 80 +#define ESCHER_ShpInst_LeftRightArrowCallout 81 +#define ESCHER_ShpInst_UpDownArrowCallout 82 +#define ESCHER_ShpInst_QuadArrowCallout 83 +#define ESCHER_ShpInst_Bevel 84 +#define ESCHER_ShpInst_LeftBracket 85 +#define ESCHER_ShpInst_RightBracket 86 +#define ESCHER_ShpInst_LeftBrace 87 +#define ESCHER_ShpInst_RightBrace 88 +#define ESCHER_ShpInst_LeftUpArrow 89 +#define ESCHER_ShpInst_BentUpArrow 90 +#define ESCHER_ShpInst_BentArrow 91 +#define ESCHER_ShpInst_Seal24 92 +#define ESCHER_ShpInst_StripedRightArrow 93 +#define ESCHER_ShpInst_NotchedRightArrow 94 +#define ESCHER_ShpInst_BlockArc 95 +#define ESCHER_ShpInst_SmileyFace 96 +#define ESCHER_ShpInst_VerticalScroll 97 +#define ESCHER_ShpInst_HorizontalScroll 98 +#define ESCHER_ShpInst_CircularArrow 99 +#define ESCHER_ShpInst_NotchedCircularArrow 100 +#define ESCHER_ShpInst_UturnArrow 101 +#define ESCHER_ShpInst_CurvedRightArrow 102 +#define ESCHER_ShpInst_CurvedLeftArrow 103 +#define ESCHER_ShpInst_CurvedUpArrow 104 +#define ESCHER_ShpInst_CurvedDownArrow 105 +#define ESCHER_ShpInst_CloudCallout 106 +#define ESCHER_ShpInst_EllipseRibbon 107 +#define ESCHER_ShpInst_EllipseRibbon2 108 +#define ESCHER_ShpInst_FlowChartProcess 109 +#define ESCHER_ShpInst_FlowChartDecision 110 +#define ESCHER_ShpInst_FlowChartInputOutput 111 #define ESCHER_ShpInst_FlowChartPredefinedProcess 112 -#define ESCHER_ShpInst_FlowChartInternalStorage 113 -#define ESCHER_ShpInst_FlowChartDocument 114 -#define ESCHER_ShpInst_FlowChartMultidocument 115 -#define ESCHER_ShpInst_FlowChartTerminator 116 -#define ESCHER_ShpInst_FlowChartPreparation 117 -#define ESCHER_ShpInst_FlowChartManualInput 118 -#define ESCHER_ShpInst_FlowChartManualOperation 119 -#define ESCHER_ShpInst_FlowChartConnector 120 -#define ESCHER_ShpInst_FlowChartPunchedCard 121 -#define ESCHER_ShpInst_FlowChartPunchedTape 122 -#define ESCHER_ShpInst_FlowChartSummingJunction 123 -#define ESCHER_ShpInst_FlowChartOr 124 -#define ESCHER_ShpInst_FlowChartCollate 125 -#define ESCHER_ShpInst_FlowChartSort 126 -#define ESCHER_ShpInst_FlowChartExtract 127 -#define ESCHER_ShpInst_FlowChartMerge 128 -#define ESCHER_ShpInst_FlowChartOfflineStorage 129 -#define ESCHER_ShpInst_FlowChartOnlineStorage 130 -#define ESCHER_ShpInst_FlowChartMagneticTape 131 -#define ESCHER_ShpInst_FlowChartMagneticDisk 132 -#define ESCHER_ShpInst_FlowChartMagneticDrum 133 -#define ESCHER_ShpInst_FlowChartDisplay 134 -#define ESCHER_ShpInst_FlowChartDelay 135 -#define ESCHER_ShpInst_TextPlainText 136 -#define ESCHER_ShpInst_TextStop 137 -#define ESCHER_ShpInst_TextTriangle 138 -#define ESCHER_ShpInst_TextTriangleInverted 139 -#define ESCHER_ShpInst_TextChevron 140 -#define ESCHER_ShpInst_TextChevronInverted 141 -#define ESCHER_ShpInst_TextRingInside 142 -#define ESCHER_ShpInst_TextRingOutside 143 -#define ESCHER_ShpInst_TextArchUpCurve 144 -#define ESCHER_ShpInst_TextArchDownCurve 145 -#define ESCHER_ShpInst_TextCircleCurve 146 -#define ESCHER_ShpInst_TextButtonCurve 147 -#define ESCHER_ShpInst_TextArchUpPour 148 -#define ESCHER_ShpInst_TextArchDownPour 149 -#define ESCHER_ShpInst_TextCirclePour 150 -#define ESCHER_ShpInst_TextButtonPour 151 -#define ESCHER_ShpInst_TextCurveUp 152 -#define ESCHER_ShpInst_TextCurveDown 153 -#define ESCHER_ShpInst_TextCascadeUp 154 -#define ESCHER_ShpInst_TextCascadeDown 155 -#define ESCHER_ShpInst_TextWave1 156 -#define ESCHER_ShpInst_TextWave2 157 -#define ESCHER_ShpInst_TextWave3 158 -#define ESCHER_ShpInst_TextWave4 159 -#define ESCHER_ShpInst_TextInflate 160 -#define ESCHER_ShpInst_TextDeflate 161 -#define ESCHER_ShpInst_TextInflateBottom 162 -#define ESCHER_ShpInst_TextDeflateBottom 163 -#define ESCHER_ShpInst_TextInflateTop 164 -#define ESCHER_ShpInst_TextDeflateTop 165 -#define ESCHER_ShpInst_TextDeflateInflate 166 +#define ESCHER_ShpInst_FlowChartInternalStorage 113 +#define ESCHER_ShpInst_FlowChartDocument 114 +#define ESCHER_ShpInst_FlowChartMultidocument 115 +#define ESCHER_ShpInst_FlowChartTerminator 116 +#define ESCHER_ShpInst_FlowChartPreparation 117 +#define ESCHER_ShpInst_FlowChartManualInput 118 +#define ESCHER_ShpInst_FlowChartManualOperation 119 +#define ESCHER_ShpInst_FlowChartConnector 120 +#define ESCHER_ShpInst_FlowChartPunchedCard 121 +#define ESCHER_ShpInst_FlowChartPunchedTape 122 +#define ESCHER_ShpInst_FlowChartSummingJunction 123 +#define ESCHER_ShpInst_FlowChartOr 124 +#define ESCHER_ShpInst_FlowChartCollate 125 +#define ESCHER_ShpInst_FlowChartSort 126 +#define ESCHER_ShpInst_FlowChartExtract 127 +#define ESCHER_ShpInst_FlowChartMerge 128 +#define ESCHER_ShpInst_FlowChartOfflineStorage 129 +#define ESCHER_ShpInst_FlowChartOnlineStorage 130 +#define ESCHER_ShpInst_FlowChartMagneticTape 131 +#define ESCHER_ShpInst_FlowChartMagneticDisk 132 +#define ESCHER_ShpInst_FlowChartMagneticDrum 133 +#define ESCHER_ShpInst_FlowChartDisplay 134 +#define ESCHER_ShpInst_FlowChartDelay 135 +#define ESCHER_ShpInst_TextPlainText 136 +#define ESCHER_ShpInst_TextStop 137 +#define ESCHER_ShpInst_TextTriangle 138 +#define ESCHER_ShpInst_TextTriangleInverted 139 +#define ESCHER_ShpInst_TextChevron 140 +#define ESCHER_ShpInst_TextChevronInverted 141 +#define ESCHER_ShpInst_TextRingInside 142 +#define ESCHER_ShpInst_TextRingOutside 143 +#define ESCHER_ShpInst_TextArchUpCurve 144 +#define ESCHER_ShpInst_TextArchDownCurve 145 +#define ESCHER_ShpInst_TextCircleCurve 146 +#define ESCHER_ShpInst_TextButtonCurve 147 +#define ESCHER_ShpInst_TextArchUpPour 148 +#define ESCHER_ShpInst_TextArchDownPour 149 +#define ESCHER_ShpInst_TextCirclePour 150 +#define ESCHER_ShpInst_TextButtonPour 151 +#define ESCHER_ShpInst_TextCurveUp 152 +#define ESCHER_ShpInst_TextCurveDown 153 +#define ESCHER_ShpInst_TextCascadeUp 154 +#define ESCHER_ShpInst_TextCascadeDown 155 +#define ESCHER_ShpInst_TextWave1 156 +#define ESCHER_ShpInst_TextWave2 157 +#define ESCHER_ShpInst_TextWave3 158 +#define ESCHER_ShpInst_TextWave4 159 +#define ESCHER_ShpInst_TextInflate 160 +#define ESCHER_ShpInst_TextDeflate 161 +#define ESCHER_ShpInst_TextInflateBottom 162 +#define ESCHER_ShpInst_TextDeflateBottom 163 +#define ESCHER_ShpInst_TextInflateTop 164 +#define ESCHER_ShpInst_TextDeflateTop 165 +#define ESCHER_ShpInst_TextDeflateInflate 166 #define ESCHER_ShpInst_TextDeflateInflateDeflate 167 -#define ESCHER_ShpInst_TextFadeRight 168 -#define ESCHER_ShpInst_TextFadeLeft 169 -#define ESCHER_ShpInst_TextFadeUp 170 -#define ESCHER_ShpInst_TextFadeDown 171 -#define ESCHER_ShpInst_TextSlantUp 172 -#define ESCHER_ShpInst_TextSlantDown 173 -#define ESCHER_ShpInst_TextCanUp 174 -#define ESCHER_ShpInst_TextCanDown 175 +#define ESCHER_ShpInst_TextFadeRight 168 +#define ESCHER_ShpInst_TextFadeLeft 169 +#define ESCHER_ShpInst_TextFadeUp 170 +#define ESCHER_ShpInst_TextFadeDown 171 +#define ESCHER_ShpInst_TextSlantUp 172 +#define ESCHER_ShpInst_TextSlantDown 173 +#define ESCHER_ShpInst_TextCanUp 174 +#define ESCHER_ShpInst_TextCanDown 175 #define ESCHER_ShpInst_FlowChartAlternateProcess 176 #define ESCHER_ShpInst_FlowChartOffpageConnector 177 -#define ESCHER_ShpInst_Callout90 178 -#define ESCHER_ShpInst_AccentCallout90 179 -#define ESCHER_ShpInst_BorderCallout90 180 -#define ESCHER_ShpInst_AccentBorderCallout90 181 -#define ESCHER_ShpInst_LeftRightUpArrow 182 -#define ESCHER_ShpInst_Sun 183 -#define ESCHER_ShpInst_Moon 184 -#define ESCHER_ShpInst_BracketPair 185 -#define ESCHER_ShpInst_BracePair 186 -#define ESCHER_ShpInst_Seal4 187 -#define ESCHER_ShpInst_DoubleWave 188 -#define ESCHER_ShpInst_ActionButtonBlank 189 -#define ESCHER_ShpInst_ActionButtonHome 190 -#define ESCHER_ShpInst_ActionButtonHelp 191 -#define ESCHER_ShpInst_ActionButtonInformation 192 -#define ESCHER_ShpInst_ActionButtonForwardNext 193 -#define ESCHER_ShpInst_ActionButtonBackPrevious 194 -#define ESCHER_ShpInst_ActionButtonEnd 195 -#define ESCHER_ShpInst_ActionButtonBeginning 196 -#define ESCHER_ShpInst_ActionButtonReturn 197 -#define ESCHER_ShpInst_ActionButtonDocument 198 -#define ESCHER_ShpInst_ActionButtonSound 199 -#define ESCHER_ShpInst_ActionButtonMovie 200 -#define ESCHER_ShpInst_HostControl 201 -#define ESCHER_ShpInst_TextBox 202 - -#define ESCHER_ShpInst_COUNT 203 -#define ESCHER_ShpInst_Max 0x0FFF -#define ESCHER_ShpInst_Nil ESCHER_ShpInst_Max +#define ESCHER_ShpInst_Callout90 178 +#define ESCHER_ShpInst_AccentCallout90 179 +#define ESCHER_ShpInst_BorderCallout90 180 +#define ESCHER_ShpInst_AccentBorderCallout90 181 +#define ESCHER_ShpInst_LeftRightUpArrow 182 +#define ESCHER_ShpInst_Sun 183 +#define ESCHER_ShpInst_Moon 184 +#define ESCHER_ShpInst_BracketPair 185 +#define ESCHER_ShpInst_BracePair 186 +#define ESCHER_ShpInst_Seal4 187 +#define ESCHER_ShpInst_DoubleWave 188 +#define ESCHER_ShpInst_ActionButtonBlank 189 +#define ESCHER_ShpInst_ActionButtonHome 190 +#define ESCHER_ShpInst_ActionButtonHelp 191 +#define ESCHER_ShpInst_ActionButtonInformation 192 +#define ESCHER_ShpInst_ActionButtonForwardNext 193 +#define ESCHER_ShpInst_ActionButtonBackPrevious 194 +#define ESCHER_ShpInst_ActionButtonEnd 195 +#define ESCHER_ShpInst_ActionButtonBeginning 196 +#define ESCHER_ShpInst_ActionButtonReturn 197 +#define ESCHER_ShpInst_ActionButtonDocument 198 +#define ESCHER_ShpInst_ActionButtonSound 199 +#define ESCHER_ShpInst_ActionButtonMovie 200 +#define ESCHER_ShpInst_HostControl 201 +#define ESCHER_ShpInst_TextBox 202 +#define ESCHER_ShpInst_COUNT 203 +#define ESCHER_ShpInst_Max 0x0FFF +#define ESCHER_ShpInst_Nil ESCHER_ShpInst_Max enum ESCHER_BlibType { // GEL provided types... @@ -356,11 +355,11 @@ enum ESCHER_wMode // enum ESCHER_ShapePath { - ESCHER_ShapeLines, // A line of straight segments - ESCHER_ShapeLinesClosed, // A closed polygonal object - ESCHER_ShapeCurves, // A line of Bezier curve segments - ESCHER_ShapeCurvesClosed, // A closed shape with curved edges - ESCHER_ShapeComplex // pSegmentInfo must be non-empty + ESCHER_ShapeLines, // A line of straight segments + ESCHER_ShapeLinesClosed, // A closed polygonal object + ESCHER_ShapeCurves, // A line of Bezier curve segments + ESCHER_ShapeCurvesClosed, // A closed shape with curved edges + ESCHER_ShapeComplex // pSegmentInfo must be non-empty }; @@ -376,18 +375,18 @@ enum ESCHER_WrapMode // enum ESCHER_bwMode { - ESCHER_bwColor, // only used for predefined shades - ESCHER_bwAutomatic, // depends on object type - ESCHER_bwGrayScale, // shades of gray only - ESCHER_bwLightGrayScale, // shades of light gray only - ESCHER_bwInverseGray, // dark gray mapped to light gray, etc. - ESCHER_bwGrayOutline, // pure gray and white - ESCHER_bwBlackTextLine, // black text and lines, all else grayscale - ESCHER_bwHighContrast, // pure black and white mode (no grays) - ESCHER_bwBlack, // solid black - ESCHER_bwWhite, // solid white - ESCHER_bwDontShow, // object not drawn - ESCHER_bwNumModes // number of Black and white modes + ESCHER_bwColor, // only used for predefined shades + ESCHER_bwAutomatic, // depends on object type + ESCHER_bwGrayScale, // shades of gray only + ESCHER_bwLightGrayScale, // shades of light gray only + ESCHER_bwInverseGray, // dark gray mapped to light gray, etc. + ESCHER_bwGrayOutline, // pure gray and white + ESCHER_bwBlackTextLine, // black text and lines, all else grayscale + ESCHER_bwHighContrast, // pure black and white mode (no grays) + ESCHER_bwBlack, // solid black + ESCHER_bwWhite, // solid white + ESCHER_bwDontShow, // object not drawn + ESCHER_bwNumModes // number of Black and white modes }; @@ -444,10 +443,10 @@ enum ESCHER_txDir // Callout Type enum ESCHER_spcot { - ESCHER_spcotRightAngle = 1, - ESCHER_spcotOneSegment = 2, - ESCHER_spcotTwoSegment = 3, - ESCHER_spcotThreeSegment = 4 + ESCHER_spcotRightAngle = 1, + ESCHER_spcotOneSegment = 2, + ESCHER_spcotTwoSegment = 3, + ESCHER_spcotThreeSegment= 4 }; // Callout Angle @@ -473,30 +472,25 @@ enum ESCHER_spcod // FontWork alignment enum ESCHER_GeoTextAlign { - ESCHER_AlignTextStretch, /* Stretch each line of text to fit width. */ - ESCHER_AlignTextCenter, /* Center text on width. */ - ESCHER_AlignTextLeft, /* Left justify. */ - ESCHER_AlignTextRight, /* Right justify. */ - ESCHER_AlignTextLetterJust, /* Spread letters out to fit width. */ - ESCHER_AlignTextWordJust, /* Spread words out to fit width. */ - ESCHER_AlignTextInvalid /* Invalid */ + ESCHER_AlignTextStretch, // Stretch each line of text to fit width. + ESCHER_AlignTextCenter, // Center text on width. + ESCHER_AlignTextLeft, // Left justify. + ESCHER_AlignTextRight, // Right justify. + ESCHER_AlignTextLetterJust, // Spread letters out to fit width. + ESCHER_AlignTextWordJust, // Spread words out to fit width. + ESCHER_AlignTextInvalid // Invalid }; // flags for pictures enum ESCHER_BlipFlags { ESCHER_BlipFlagDefault = 0, - ESCHER_BlipFlagComment = 0, // Blip name is a comment - ESCHER_BlipFlagFile, // Blip name is a file name - ESCHER_BlipFlagURL, // Blip name is a full URL - ESCHER_BlipFlagType = 3, // Mask to extract type + ESCHER_BlipFlagComment = 0, // Blip name is a comment + ESCHER_BlipFlagFile, // Blip name is a file name + ESCHER_BlipFlagURL, // Blip name is a full URL + ESCHER_BlipFlagType = 3, // Mask to extract type /* Or the following flags with any of the above. */ - ESCHER_BlipFlagDontSave = 4, // A "dont" is the depression in the metal - // body work of an automobile caused when a - // cyclist violently thrusts his or her nose - // at it, thus a DontSave is another name for - // a cycle lane. - ESCHER_BlipFlagDoNotSave = 4, // For those who prefer English + ESCHER_BlipFlagDoNotSave = 4, ESCHER_BlipFlagLinkToFile = 8 }; @@ -530,20 +524,20 @@ enum ESCHER_ShadowType // - the type of a (length) measurement enum ESCHER_dzType { - ESCHER_dzTypeMin = 0, - ESCHER_dzTypeDefault = 0, // Default size, ignore the values - ESCHER_dzTypeA = 1, // Values are in EMUs - ESCHER_dzTypeV = 2, // Values are in pixels - ESCHER_dzTypeShape = 3, // Values are 16.16 fractions of shape size - ESCHER_dzTypeFixedAspect = 4, // Aspect ratio is fixed - ESCHER_dzTypeAFixed = 5, // EMUs, fixed aspect ratio - ESCHER_dzTypeVFixed = 6, // Pixels, fixed aspect ratio - ESCHER_dzTypeShapeFixed = 7, // Proportion of shape, fixed aspect ratio + ESCHER_dzTypeMin = 0, + ESCHER_dzTypeDefault = 0, // Default size, ignore the values + ESCHER_dzTypeA = 1, // Values are in EMUs + ESCHER_dzTypeV = 2, // Values are in pixels + ESCHER_dzTypeShape = 3, // Values are 16.16 fractions of shape size + ESCHER_dzTypeFixedAspect = 4, // Aspect ratio is fixed + ESCHER_dzTypeAFixed = 5, // EMUs, fixed aspect ratio + ESCHER_dzTypeVFixed = 6, // Pixels, fixed aspect ratio + ESCHER_dzTypeShapeFixed = 7, // Proportion of shape, fixed aspect ratio ESCHER_dzTypeFixedAspectEnlarge= 8, // Aspect ratio is fixed, favor larger size - ESCHER_dzTypeAFixedBig = 9, // EMUs, fixed aspect ratio - ESCHER_dzTypeVFixedBig = 10, // Pixels, fixed aspect ratio - ESCHER_dzTypeShapeFixedBig= 11, // Proportion of shape, fixed aspect ratio - ESCHER_dzTypeMax = 11 + ESCHER_dzTypeAFixedBig = 9, // EMUs, fixed aspect ratio + ESCHER_dzTypeVFixedBig = 10, // Pixels, fixed aspect ratio + ESCHER_dzTypeShapeFixedBig= 11, // Proportion of shape, fixed aspect ratio + ESCHER_dzTypeMax = 11 }; // how to interpret the colors in a shaded fill. @@ -571,36 +565,36 @@ enum ESCHER_ShadeType // compound line style enum ESCHER_LineStyle { - ESCHER_LineSimple, // Single line (of width lineWidth) - ESCHER_LineDouble, // Double lines of equal width - ESCHER_LineThickThin, // Double lines, one thick, one thin - ESCHER_LineThinThick, // Double lines, reverse order - ESCHER_LineTriple // Three lines, thin, thick, thin + ESCHER_LineSimple, // Single line (of width lineWidth) + ESCHER_LineDouble, // Double lines of equal width + ESCHER_LineThickThin, // Double lines, one thick, one thin + ESCHER_LineThinThick, // Double lines, reverse order + ESCHER_LineTriple // Three lines, thin, thick, thin }; // how to "fill" the line contour enum ESCHER_LineType { - ESCHER_lineSolidType, // Fill with a solid color - ESCHER_linePattern, // Fill with a pattern (bitmap) - ESCHER_lineTexture, // A texture (pattern with its own color map) - ESCHER_linePicture // Center a picture in the shape + ESCHER_lineSolidType, // Fill with a solid color + ESCHER_linePattern, // Fill with a pattern (bitmap) + ESCHER_lineTexture, // A texture (pattern with its own color map) + ESCHER_linePicture // Center a picture in the shape }; // dashed line style enum ESCHER_LineDashing { - ESCHER_LineSolid, // Solid (continuous) pen - ESCHER_LineDashSys, // PS_DASH system dash style - ESCHER_LineDotSys, // PS_DOT system dash style - ESCHER_LineDashDotSys, // PS_DASHDOT system dash style - ESCHER_LineDashDotDotSys, // PS_DASHDOTDOT system dash style - ESCHER_LineDotGEL, // square dot style - ESCHER_LineDashGEL, // dash style - ESCHER_LineLongDashGEL, // long dash style - ESCHER_LineDashDotGEL, // dash short dash - ESCHER_LineLongDashDotGEL, // long dash short dash - ESCHER_LineLongDashDotDotGEL // long dash short dash short dash + ESCHER_LineSolid, // Solid (continuous) pen + ESCHER_LineDashSys, // PS_DASH system dash style + ESCHER_LineDotSys, // PS_DOT system dash style + ESCHER_LineDashDotSys, // PS_DASHDOT system dash style + ESCHER_LineDashDotDotSys, // PS_DASHDOTDOT system dash style + ESCHER_LineDotGEL, // square dot style + ESCHER_LineDashGEL, // dash style + ESCHER_LineLongDashGEL, // long dash style + ESCHER_LineDashDotGEL, // dash short dash + ESCHER_LineLongDashDotGEL, // long dash short dash + ESCHER_LineLongDashDotDotGEL // long dash short dash short dash }; // line end effect @@ -645,6 +639,7 @@ enum ESCHER_LineCap ESCHER_LineEndCapSquare, // Square protrudes by half line width ESCHER_LineEndCapFlat // Line ends at end point }; + // Shape Properties // 1pt = 12700 EMU (English Metric Units) // 1pt = 20 Twip = 20/1440" = 1/72" @@ -1000,6 +995,7 @@ struct MSFILTER_DLLPUBLIC EscherExContainer EscherExContainer( SvStream& rSt, const sal_uInt16 nRecType, const sal_uInt16 nInstance = 0 ); ~EscherExContainer(); }; + struct MSFILTER_DLLPUBLIC EscherExAtom { sal_uInt32 nContPos; @@ -1011,15 +1007,17 @@ struct MSFILTER_DLLPUBLIC EscherExAtom struct EscherPropertyValueHelper { - static sal_Bool GetPropertyValue( - ::com::sun::star::uno::Any& rAny, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, - const String& rPropertyName, - sal_Bool bTestPropertyAvailability = sal_False ); - - static ::com::sun::star::beans::PropertyState GetPropertyState( - const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > &, - const String& rPropertyName ); + static sal_Bool GetPropertyValue( + ::com::sun::star::uno::Any& rAny, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, + const String& rPropertyName, + sal_Bool bTestPropertyAvailability = sal_False + ); + + static ::com::sun::star::beans::PropertyState GetPropertyState( + const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > &, + const String& rPropertyName + ); }; // --------------------------------------------------------------------------------------------- @@ -1028,7 +1026,8 @@ struct EscherPersistEntry { sal_uInt32 mnID; sal_uInt32 mnOffset; - EscherPersistEntry( sal_uInt32 nId, sal_uInt32 nOffset ) { mnID = nId; mnOffset = nOffset; }; + + EscherPersistEntry( sal_uInt32 nId, sal_uInt32 nOffset ) { mnID = nId; mnOffset = nOffset; }; }; @@ -1037,37 +1036,41 @@ struct EscherPersistEntry class EscherBlibEntry { - friend class EscherGraphicProvider; - friend class EscherEx; + friend class EscherGraphicProvider; + friend class EscherEx; - protected: +protected: - sal_uInt32 mnIdentifier[ 4 ]; - sal_uInt32 mnPictureOffset; // offset auf die grafik im PictureStreams - sal_uInt32 mnSize; // size of real graphic + sal_uInt32 mnIdentifier[ 4 ]; + sal_uInt32 mnPictureOffset; // offset auf die grafik im PictureStreams + sal_uInt32 mnSize; // size of real graphic - sal_uInt32 mnRefCount; // !! reference count - sal_uInt32 mnSizeExtra; // !! size of preceding header + sal_uInt32 mnRefCount; // !! reference count + sal_uInt32 mnSizeExtra; // !! size of preceding header - ESCHER_BlibType meBlibType; + ESCHER_BlibType meBlibType; - Size maPrefSize; - MapMode maPrefMapMode; + Size maPrefSize; + MapMode maPrefMapMode; - sal_Bool mbIsEmpty; - sal_Bool mbIsNativeGraphicPossible; + sal_Bool mbIsEmpty; + sal_Bool mbIsNativeGraphicPossible; - public: +public: - EscherBlibEntry( sal_uInt32 nPictureOffset, const GraphicObject& rObj, - const ByteString& rId, const GraphicAttr* pAttr = NULL ); + EscherBlibEntry( + sal_uInt32 nPictureOffset, + const GraphicObject& rObj, + const ByteString& rId, + const GraphicAttr* pAttr = NULL + ); - ~EscherBlibEntry(); + ~EscherBlibEntry(); - void WriteBlibEntry( SvStream& rSt, sal_Bool bWritePictureOffset, sal_uInt32 nResize = 0 ); - sal_Bool IsEmpty() const { return mbIsEmpty; }; + void WriteBlibEntry( SvStream& rSt, sal_Bool bWritePictureOffset, sal_uInt32 nResize = 0 ); + sal_Bool IsEmpty() const { return mbIsEmpty; }; - sal_Bool operator==( const EscherBlibEntry& ) const; + sal_Bool operator==( const EscherBlibEntry& ) const; }; // --------------------------------------------------------------------------------------------- @@ -1077,55 +1080,72 @@ class EscherBlibEntry class MSFILTER_DLLPUBLIC EscherGraphicProvider { - sal_uInt32 mnFlags; + sal_uInt32 mnFlags; - EscherBlibEntry** mpBlibEntrys; - sal_uInt32 mnBlibBufSize; - sal_uInt32 mnBlibEntrys; + EscherBlibEntry** mpBlibEntrys; + sal_uInt32 mnBlibBufSize; + sal_uInt32 mnBlibEntrys; - protected : +protected: - sal_uInt32 ImplInsertBlib( EscherBlibEntry* p_EscherBlibEntry ); + sal_uInt32 ImplInsertBlib( EscherBlibEntry* p_EscherBlibEntry ); - public : +public: - sal_uInt32 GetBlibStoreContainerSize( SvStream* pMergePicStreamBSE = NULL ) const; - void WriteBlibStoreContainer( SvStream& rStrm, SvStream* pMergePicStreamBSE = NULL ); - sal_Bool WriteBlibStoreEntry(SvStream& rStrm, sal_uInt32 nBlipId, - sal_Bool bWritePictureOffset, sal_uInt32 nResize = 0); - sal_uInt32 GetBlibID( SvStream& rPicOutStream, const ByteString& rGraphicId, const Rectangle& rBoundRect, - const com::sun::star::awt::Rectangle* pVisArea = NULL, const GraphicAttr* pGrafikAttr = NULL ); - sal_Bool HasGraphics() const { return mnBlibEntrys != 0; }; + sal_uInt32 GetBlibStoreContainerSize( SvStream* pMergePicStreamBSE = NULL ) const; + void WriteBlibStoreContainer( SvStream& rStrm, SvStream* pMergePicStreamBSE = NULL ); + sal_Bool WriteBlibStoreEntry(SvStream& rStrm, sal_uInt32 nBlipId, + sal_Bool bWritePictureOffset, sal_uInt32 nResize = 0); + sal_uInt32 GetBlibID( + SvStream& rPicOutStream, + const ByteString& rGraphicId, + const Rectangle& rBoundRect, + const com::sun::star::awt::Rectangle* pVisArea = NULL, + const GraphicAttr* pGrafikAttr = NULL + ); + sal_Bool HasGraphics() const { return mnBlibEntrys != 0; }; - void SetNewBlipStreamOffset( sal_Int32 nOffset ); + void SetNewBlipStreamOffset( sal_Int32 nOffset ); - sal_Bool GetPrefSize( const sal_uInt32 nBlibId, Size& rSize, MapMode& rMapMode ); + sal_Bool GetPrefSize( const sal_uInt32 nBlibId, Size& rSize, MapMode& rMapMode ); - EscherGraphicProvider( sal_uInt32 nFlags = _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES ); - ~EscherGraphicProvider(); + EscherGraphicProvider( sal_uInt32 nFlags = _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES ); + ~EscherGraphicProvider(); }; +class EscherShapeListEntry; +typedef ::std::vector< EscherShapeListEntry* > EscherShapeList_impl; +typedef ::std::vector< EscherConnectorListEntry* > EscherConnectorList_impl; + class MSFILTER_DLLPUBLIC EscherSolverContainer { - List maShapeList; - List maConnectorList; + EscherShapeList_impl maShapeList; + EscherConnectorList_impl maConnectorList; public: - sal_uInt32 GetShapeId( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rShape ) const; + sal_uInt32 GetShapeId( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rShape + ) const; + + void AddShape( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &, + sal_uInt32 nId + ); - void AddShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &, sal_uInt32 nId ); - void AddConnector( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &, - const ::com::sun::star::awt::Point& rA, - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &, - const ::com::sun::star::awt::Point& rB, - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rConB ); + void AddConnector( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &, + const ::com::sun::star::awt::Point& rA, + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &, + const ::com::sun::star::awt::Point& rB, + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rConB + ); - void WriteSolver( SvStream& ); + void WriteSolver( SvStream& ); - EscherSolverContainer(){}; - ~EscherSolverContainer(); + EscherSolverContainer(){}; + ~EscherSolverContainer(); }; // --------------------------------------------------------------------------------------------- @@ -1149,129 +1169,197 @@ typedef std::vector< EscherPropSortStruct > EscherProperties; class MSFILTER_DLLPUBLIC EscherPropertyContainer { - EscherGraphicProvider* pGraphicProvider; - SvStream* pPicOutStrm; - Rectangle* pShapeBoundRect; - - EscherPropSortStruct* pSortStruct; - - sal_uInt32 nSortCount; - sal_uInt32 nSortBufSize; - sal_uInt32 nCountCount; - sal_uInt32 nCountSize; - - sal_Bool bHasComplexData; - sal_Bool bSuppressRotation; - - - sal_uInt32 ImplGetColor( const sal_uInt32 rColor, sal_Bool bSwap = sal_True ); - void ImplCreateGraphicAttributes( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, - sal_uInt32 nBlibId, sal_Bool bCreateCroppingAttributes ); - sal_Bool ImplCreateEmbeddedBmp( const ByteString& rUniqueId ); - void ImplInit(); - - public : + EscherGraphicProvider* pGraphicProvider; + SvStream* pPicOutStrm; + Rectangle* pShapeBoundRect; - EscherPropertyContainer(); - EscherPropertyContainer( - EscherGraphicProvider& rGraphicProvider, // the PropertyContainer needs to know - SvStream* pPicOutStrm, // the GraphicProvider to be able to write - Rectangle& rShapeBoundRect ); // FillBitmaps or GraphicObjects. - // under some cirumstances the ShapeBoundRect is adjusted - // this will happen when rotated GraphicObjects - // are saved to PowerPoint - ~EscherPropertyContainer(); + EscherPropSortStruct* pSortStruct; - void AddOpt( sal_uInt16 nPropertyID, const rtl::OUString& rString ); + sal_uInt32 nSortCount; + sal_uInt32 nSortBufSize; + sal_uInt32 nCountCount; + sal_uInt32 nCountSize; - void AddOpt( sal_uInt16 nPropertyID, sal_uInt32 nPropValue, - sal_Bool bBlib = sal_False ); + sal_Bool bHasComplexData; + sal_Bool bSuppressRotation; - void AddOpt( sal_uInt16 nPropertyID, sal_Bool bBlib, sal_uInt32 nPropValue, - sal_uInt8* pProp, sal_uInt32 nPropSize ); - sal_Bool GetOpt( sal_uInt16 nPropertyID, sal_uInt32& rPropValue ) const; + sal_uInt32 ImplGetColor( const sal_uInt32 rColor, sal_Bool bSwap = sal_True ); + void ImplCreateGraphicAttributes( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, + sal_uInt32 nBlibId, + sal_Bool bCreateCroppingAttributes + ); + sal_Bool ImplCreateEmbeddedBmp( const ByteString& rUniqueId ); + void ImplInit(); - sal_Bool GetOpt( sal_uInt16 nPropertyID, EscherPropSortStruct& rPropValue ) const; - - EscherProperties GetOpts() const; - - void Commit( SvStream& rSt, sal_uInt16 nVersion = 3, sal_uInt16 nRecType = ESCHER_OPT ); - - sal_Bool CreateShapeProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape ); - sal_Bool CreateOLEGraphicProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXOleObject ); +public: - /** Creates a complex ESCHER_Prop_fillBlip containing the BLIP directly (for Excel charts). */ - sal_Bool CreateEmbeddedBitmapProperties( const ::rtl::OUString& rBitmapUrl, - ::com::sun::star::drawing::BitmapMode eBitmapMode ); - /** Creates a complex ESCHER_Prop_fillBlip containing a hatch style (for Excel charts). */ - sal_Bool CreateEmbeddedHatchProperties( const ::com::sun::star::drawing::Hatch& rHatch, - const Color& rBackColor, bool bFillBackground ); + EscherPropertyContainer(); + EscherPropertyContainer( + EscherGraphicProvider& rGraphicProvider, // the PropertyContainer needs to know + SvStream* pPicOutStrm, // the GraphicProvider to be able to write + Rectangle& rShapeBoundRect // FillBitmaps or GraphicObjects. + ); // under some circumstances the ShapeBoundRect + // is adjusted this will happen when rotated + // GraphicObjects are saved to PowerPoint + ~EscherPropertyContainer(); + + void AddOpt( sal_uInt16 nPropertyID, const rtl::OUString& rString ); + + void AddOpt( + sal_uInt16 nPropertyID, + sal_uInt32 nPropValue, + sal_Bool bBlib = sal_False + ); + + void AddOpt( + sal_uInt16 nPropertyID, + sal_Bool bBlib, + sal_uInt32 nPropValue, + sal_uInt8* pProp, + sal_uInt32 nPropSize + ); + + sal_Bool GetOpt( sal_uInt16 nPropertyID, sal_uInt32& rPropValue ) const; + + sal_Bool GetOpt( sal_uInt16 nPropertyID, EscherPropSortStruct& rPropValue ) const; + + EscherProperties GetOpts() const; + + void Commit( SvStream& rSt, sal_uInt16 nVersion = 3, sal_uInt16 nRecType = ESCHER_OPT ); + + sal_Bool CreateShapeProperties( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape + ); + sal_Bool CreateOLEGraphicProperties( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXOleObject + ); + + /** Creates a complex ESCHER_Prop_fillBlip containing the BLIP directly (for Excel charts). */ + sal_Bool CreateEmbeddedBitmapProperties( + const ::rtl::OUString& rBitmapUrl, + ::com::sun::star::drawing::BitmapMode eBitmapMode + ); + /** Creates a complex ESCHER_Prop_fillBlip containing a hatch style (for Excel charts). */ + sal_Bool CreateEmbeddedHatchProperties( + const ::com::sun::star::drawing::Hatch& rHatch, + const Color& rBackColor, + bool bFillBackground + ); // the GraphicProperties will only be created if a GraphicProvider and PicOutStrm is known // DR: #99897# if no GraphicProvider is present, a complex ESCHER_Prop_fillBlip // will be created, containing the BLIP directly (e.g. for Excel charts). - sal_Bool CreateGraphicProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, - const String& rSource, const sal_Bool bCreateFillBitmap, const sal_Bool bCreateCroppingAttributes = sal_False, - const sal_Bool bFillBitmapModeAllowed = sal_True ); - - sal_Bool CreatePolygonProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, - sal_uInt32 nFlags, sal_Bool bBezier, ::com::sun::star::awt::Rectangle& rGeoRect, Polygon* pPolygon = NULL ); - - static sal_uInt32 GetGradientColor( const ::com::sun::star::awt::Gradient* pGradient, sal_uInt32 nStartColor ); - - void CreateGradientProperties( const ::com::sun::star::awt::Gradient & rGradient ); - void CreateGradientProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & ); - void CreateLineProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, sal_Bool bEdge ); - void CreateFillProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, sal_Bool bEdge ); - void CreateTextProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, sal_uInt32 nText, - const sal_Bool bIsCustomShape = sal_False, const sal_Bool bIsTextFrame = sal_True ); - - sal_Bool CreateConnectorProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape, - EscherSolverContainer& rSolver, ::com::sun::star::awt::Rectangle& rGeoRect, - sal_uInt16& rShapeType, sal_uInt16& rShapeFlags ); - - // Because shadow properties depends to the line and fillstyle, the CreateShadowProperties method should be called at last. - // It activ only when at least a FillStyle or LineStyle is set. - sal_Bool CreateShadowProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & ); + sal_Bool CreateGraphicProperties( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, + const String& rSource, + const sal_Bool bCreateFillBitmap, + const sal_Bool bCreateCroppingAttributes = sal_False, + const sal_Bool bFillBitmapModeAllowed = sal_True + ); + + sal_Bool CreatePolygonProperties( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, + sal_uInt32 nFlags, + sal_Bool bBezier, + ::com::sun::star::awt::Rectangle& rGeoRect, + Polygon* pPolygon = NULL + ); + + static sal_uInt32 GetGradientColor( + const ::com::sun::star::awt::Gradient* pGradient, + sal_uInt32 nStartColor + ); + + void CreateGradientProperties( const ::com::sun::star::awt::Gradient & rGradient ); + void CreateGradientProperties( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & + ); + void CreateLineProperties( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, + sal_Bool bEdge + ); + void CreateFillProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, sal_Bool bEdge ); + void CreateTextProperties( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, + sal_uInt32 nText, + const sal_Bool bIsCustomShape = sal_False, + const sal_Bool bIsTextFrame = sal_True + ); + + sal_Bool CreateConnectorProperties( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape, + EscherSolverContainer& rSolver, + ::com::sun::star::awt::Rectangle& rGeoRect, + sal_uInt16& rShapeType, + sal_uInt16& rShapeFlags + ); + + // Because shadow properties depends to the line and fillstyle, the CreateShadowProperties method should be called at last. + // It activ only when at least a FillStyle or LineStyle is set. + sal_Bool CreateShadowProperties( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & + ); // creates all necessary CustomShape properties, this includes also Text-, Shadow-, Fill-, and LineProperties - void CreateCustomShapeProperties( const MSO_SPT eShapeType, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & ); - sal_Bool IsFontWork() const; - - // helper functions which are also used by the escher import - static PolyPolygon GetPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape ); - static PolyPolygon GetPolyPolygon( const ::com::sun::star::uno::Any& rSource ); - static MSO_SPT GetCustomShapeType( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape, sal_uInt32& nMirrorFlags ); - static MSO_SPT GetCustomShapeType( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape, sal_uInt32& nMirrorFlags, rtl::OUString& rShapeType ); + void CreateCustomShapeProperties( + const MSO_SPT eShapeType, + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & + ); + sal_Bool IsFontWork() const; + + // helper functions which are also used by the escher import + static PolyPolygon GetPolyPolygon( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape + ); + static PolyPolygon GetPolyPolygon( const ::com::sun::star::uno::Any& rSource ); + static MSO_SPT GetCustomShapeType( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape, + sal_uInt32& nMirrorFlags + ); + static MSO_SPT GetCustomShapeType( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape, + sal_uInt32& nMirrorFlags, + rtl::OUString& rShapeType + ); // helper functions which are also used in ooxml export - static sal_Bool GetLineArrow( const sal_Bool bLineStart, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, - ESCHER_LineEnd& reLineEnd, sal_Int32& rnArrowLength, sal_Int32& rnArrowWidth ); - static sal_Bool IsDefaultObject( SdrObjCustomShape* pCustoShape ); - static void LookForPolarHandles( const MSO_SPT eShapeType, sal_Int32& nAdjustmentsWhichNeedsToBeConverted ); - static sal_Bool GetAdjustmentValue( const com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue & rkProp, sal_Int32 nIndex, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, sal_Int32& nValue ); + static sal_Bool GetLineArrow( + const sal_Bool bLineStart, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, + ESCHER_LineEnd& reLineEnd, + sal_Int32& rnArrowLength, + sal_Int32& rnArrowWidth + ); + static sal_Bool IsDefaultObject( SdrObjCustomShape* pCustoShape ); + static void LookForPolarHandles( + const MSO_SPT eShapeType, + sal_Int32& nAdjustmentsWhichNeedsToBeConverted + ); + static sal_Bool GetAdjustmentValue( const com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue & rkProp, sal_Int32 nIndex, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, sal_Int32& nValue ); }; // --------------------------------------------------------------------------------------------- +typedef ::std::vector< EscherPersistEntry* > EscherPersistTable_impl; + class MSFILTER_DLLPUBLIC EscherPersistTable { - public: - List maPersistTable; +public: + EscherPersistTable_impl maPersistTable; - sal_Bool PtIsID( sal_uInt32 nID ); - void PtInsert( sal_uInt32 nID, sal_uInt32 nOfs ); - sal_uInt32 PtDelete( sal_uInt32 nID ); - sal_uInt32 PtGetOffsetByID( sal_uInt32 nID ); - sal_uInt32 PtReplace( sal_uInt32 nID, sal_uInt32 nOfs ); - sal_uInt32 PtReplaceOrInsert( sal_uInt32 nID, sal_uInt32 nOfs ); - sal_uInt32 PtGetCount() const { return maPersistTable.Count(); }; + sal_Bool PtIsID( sal_uInt32 nID ); + void PtInsert( sal_uInt32 nID, sal_uInt32 nOfs ); + sal_uInt32 PtDelete( sal_uInt32 nID ); + sal_uInt32 PtGetOffsetByID( sal_uInt32 nID ); + sal_uInt32 PtReplace( sal_uInt32 nID, sal_uInt32 nOfs ); + sal_uInt32 PtReplaceOrInsert( sal_uInt32 nID, sal_uInt32 nOfs ); + sal_uInt32 PtGetCount() const { return maPersistTable.size(); }; EscherPersistTable(); - virtual ~EscherPersistTable(); + virtual ~EscherPersistTable(); }; // --------------------------------------------------------------------------------------------- @@ -1311,6 +1399,7 @@ class InteractionInfo bool mbHasInteraction; std::auto_ptr<SvMemoryStream> mpHyperlinkRecord; InteractionInfo(); + public: InteractionInfo( SvMemoryStream* pStream, bool bInteraction ) : mbHasInteraction( bInteraction ) { @@ -1489,8 +1578,7 @@ public: /** Returns the graphic provider from the global object that has been passed to the constructor. */ - inline EscherGraphicProvider& - GetGraphicProvider() { return *mxGlobal; } + inline EscherGraphicProvider& GetGraphicProvider() { return *mxGlobal; } /** Called if a picture shall be written and no picture stream is set at class ImplEscherExSdr. @@ -1522,19 +1610,19 @@ public: current stream position are always expanded to include the inserted data. */ - void InsertAtCurrentPos( sal_uInt32 nBytes, bool bExpandEndOfAtom ); + void InsertAtCurrentPos( sal_uInt32 nBytes, bool bExpandEndOfAtom ); - void InsertPersistOffset( sal_uInt32 nKey, sal_uInt32 nOffset ); // Es wird nicht geprueft, ob sich jener schluessel schon in der PersistantTable befindet - void ReplacePersistOffset( sal_uInt32 nKey, sal_uInt32 nOffset ); - sal_uInt32 GetPersistOffset( sal_uInt32 nKey ); - sal_Bool SeekToPersistOffset( sal_uInt32 nKey ); - virtual sal_Bool InsertAtPersistOffset( sal_uInt32 nKey, sal_uInt32 nValue );// nValue wird im Stream an entrsprechender Stelle eingefuegt(overwrite modus), ohne dass sich die + void InsertPersistOffset( sal_uInt32 nKey, sal_uInt32 nOffset ); // Es wird nicht geprueft, ob sich jener schluessel schon in der PersistantTable befindet + void ReplacePersistOffset( sal_uInt32 nKey, sal_uInt32 nOffset ); + sal_uInt32 GetPersistOffset( sal_uInt32 nKey ); + sal_Bool SeekToPersistOffset( sal_uInt32 nKey ); + virtual sal_Bool InsertAtPersistOffset( sal_uInt32 nKey, sal_uInt32 nValue );// nValue wird im Stream an entrsprechender Stelle eingefuegt(overwrite modus), ohne dass sich die // aktuelle StreamPosition aendert - SvStream& GetStream() const { return *mpOutStrm; } - sal_uLong GetStreamPos() const { return mpOutStrm->Tell(); } + SvStream& GetStream() const { return *mpOutStrm; } + sal_uLong GetStreamPos() const { return mpOutStrm->Tell(); } - virtual sal_Bool SeekBehindRecHeader( sal_uInt16 nRecType ); // der stream muss vor einem gueltigen Record Header oder Atom stehen + virtual sal_Bool SeekBehindRecHeader( sal_uInt16 nRecType ); // der stream muss vor einem gueltigen Record Header oder Atom stehen // features beim erzeugen folgender Container: // @@ -1543,42 +1631,42 @@ public: // ESCHER_SpgrContainer: // ESCHER_SpContainer: - virtual void OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance = 0 ); - virtual void CloseContainer(); + virtual void OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance = 0 ); + virtual void CloseContainer(); - virtual void BeginAtom(); - virtual void EndAtom( sal_uInt16 nRecType, int nRecVersion = 0, int nRecInstance = 0 ); - virtual void AddAtom( sal_uInt32 nAtomSitze, sal_uInt16 nRecType, int nRecVersion = 0, int nRecInstance = 0 ); - virtual void AddChildAnchor( const Rectangle& rRectangle ); - virtual void AddClientAnchor( const Rectangle& rRectangle ); + virtual void BeginAtom(); + virtual void EndAtom( sal_uInt16 nRecType, int nRecVersion = 0, int nRecInstance = 0 ); + virtual void AddAtom( sal_uInt32 nAtomSitze, sal_uInt16 nRecType, int nRecVersion = 0, int nRecInstance = 0 ); + virtual void AddChildAnchor( const Rectangle& rRectangle ); + virtual void AddClientAnchor( const Rectangle& rRectangle ); - virtual sal_uInt32 EnterGroup( const String& rShapeName, const Rectangle* pBoundRect = 0 ); - sal_uInt32 EnterGroup( const Rectangle* pBoundRect = NULL ); - sal_uInt32 GetGroupLevel() const { return mnGroupLevel; }; - virtual sal_Bool SetGroupSnapRect( sal_uInt32 nGroupLevel, const Rectangle& rRect ); - virtual sal_Bool SetGroupLogicRect( sal_uInt32 nGroupLevel, const Rectangle& rRect ); - virtual void LeaveGroup(); + virtual sal_uInt32 EnterGroup( const String& rShapeName, const Rectangle* pBoundRect = 0 ); + sal_uInt32 EnterGroup( const Rectangle* pBoundRect = NULL ); + sal_uInt32 GetGroupLevel() const { return mnGroupLevel; }; + virtual sal_Bool SetGroupSnapRect( sal_uInt32 nGroupLevel, const Rectangle& rRect ); + virtual sal_Bool SetGroupLogicRect( sal_uInt32 nGroupLevel, const Rectangle& rRect ); + virtual void LeaveGroup(); // ein ESCHER_Sp wird geschrieben ( Ein ESCHER_DgContainer muss dazu geoeffnet sein !!) - virtual void AddShape( sal_uInt32 nShpInstance, sal_uInt32 nFlagIds, sal_uInt32 nShapeID = 0 ); + virtual void AddShape( sal_uInt32 nShpInstance, sal_uInt32 nFlagIds, sal_uInt32 nShapeID = 0 ); - virtual void Commit( EscherPropertyContainer& rProps, const Rectangle& rRect ); + virtual void Commit( EscherPropertyContainer& rProps, const Rectangle& rRect ); - sal_uInt32 GetColor( const sal_uInt32 nColor, sal_Bool bSwap = sal_True ); - sal_uInt32 GetColor( const Color& rColor, sal_Bool bSwap = sal_True ); + sal_uInt32 GetColor( const sal_uInt32 nColor, sal_Bool bSwap = sal_True ); + sal_uInt32 GetColor( const Color& rColor, sal_Bool bSwap = sal_True ); // ...Sdr... implemented in eschesdo.cxx - void AddSdrPage( const SdrPage& rPage ); - void AddUnoShapes( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes ); + void AddSdrPage( const SdrPage& rPage ); + void AddUnoShapes( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes ); /// returns the ShapeID - sal_uInt32 AddSdrObject( const SdrObject& rObj ); + sal_uInt32 AddSdrObject( const SdrObject& rObj ); /// If objects are written through AddSdrObject the /// SolverContainer has to be written, and maybe some /// maintenance to be done. - void EndSdrObjectPage(); + void EndSdrObjectPage(); /// Called before a shape is written, application supplies /// ClientRecords. May set AppData::bDontWriteShape so the diff --git a/filter/inc/filter/msfilter/msdffimp.hxx b/filter/inc/filter/msfilter/msdffimp.hxx index 81b4403f3938..e51791ec5b6c 100644 --- a/filter/inc/filter/msfilter/msdffimp.hxx +++ b/filter/inc/filter/msfilter/msdffimp.hxx @@ -44,6 +44,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <filter/msfilter/msfilterdllapi.h> #include <sot/storage.hxx> +#include <vector> class Graphic; class SvStream; @@ -66,7 +67,7 @@ class MSFILTER_DLLPUBLIC DffRecordHeader { public: - sal_uInt8 nRecVer; // may be DFF_PSFLAG_CONTAINER + sal_uInt8 nRecVer; // may be DFF_PSFLAG_CONTAINER sal_uInt16 nRecInstance; sal_uInt16 nImpVerInst; sal_uInt16 nRecType; @@ -74,12 +75,23 @@ public: sal_uLong nFilePos; public: DffRecordHeader() : nRecVer(0), nRecInstance(0), nImpVerInst(0), nRecType(0), nRecLen(0), nFilePos(0) {} - bool IsContainer() const { return nRecVer == DFF_PSFLAG_CONTAINER; } - sal_uLong GetRecBegFilePos() const { return nFilePos; } - sal_uLong GetRecEndFilePos() const { return nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen; } - void SeekToEndOfRecord(SvStream& rIn) const { rIn.Seek(nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen ); } - void SeekToContent( SvStream& rIn) const { rIn.Seek(nFilePos + DFF_COMMON_RECORD_HEADER_SIZE ); } - void SeekToBegOfRecord(SvStream& rIn) const { rIn.Seek( nFilePos ); } + bool IsContainer() const { return nRecVer == DFF_PSFLAG_CONTAINER; } + sal_uLong GetRecBegFilePos() const { return nFilePos; } + sal_uLong GetRecEndFilePos() const { return nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen; } + bool SeekToEndOfRecord(SvStream& rIn) const + { + sal_Size nPos = nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen; + return nPos == rIn.Seek(nPos); + } + bool SeekToContent(SvStream& rIn) const + { + sal_Size nPos = nFilePos + DFF_COMMON_RECORD_HEADER_SIZE; + return nPos == rIn.Seek(nPos); + } + bool SeekToBegOfRecord(SvStream& rIn) const + { + return nFilePos == rIn.Seek(nFilePos); + } MSFILTER_DLLPUBLIC friend SvStream& operator>>(SvStream& rIn, DffRecordHeader& rRec); @@ -97,28 +109,31 @@ class SvxMSDffManager; class MSFILTER_DLLPUBLIC DffPropSet : public Table { - protected : +protected: - sal_uInt32 mpContents[ 1024 ]; - DffPropFlags mpFlags[ 1024 ]; + sal_uInt32 mpContents[ 1024 ]; + DffPropFlags mpFlags[ 1024 ]; - public : +public: - DffPropSet( sal_Bool bInitialize = sal_False ){ if ( bInitialize ) - memset( mpFlags, 0, 0x400 * sizeof( DffPropFlags ) ); }; - - inline sal_Bool IsProperty( sal_uInt32 nRecType ) const { return ( mpFlags[ nRecType & 0x3ff ].bSet ); }; - sal_Bool IsHardAttribute( sal_uInt32 nId ) const; - sal_uInt32 GetPropertyValue( sal_uInt32 nId, sal_uInt32 nDefault = 0 ) const; - /** Returns a boolean property by its real identifier. */ - bool GetPropertyBool( sal_uInt32 nId, bool bDefault = false ) const; - /** Returns a string property. */ - ::rtl::OUString GetPropertyString( sal_uInt32 nId, SvStream& rStrm ) const; - void SetPropertyValue( sal_uInt32 nId, sal_uInt32 nValue ) const; - sal_Bool SeekToContent( sal_uInt32 nRecType, SvStream& rSt ) const; - void Merge( DffPropSet& rMasterPropSet ) const; - void InitializePropSet() const; - friend SvStream& operator>>( SvStream& rIn, DffPropSet& rPropSet ); + DffPropSet( sal_Bool bInitialize = sal_False ) + { + if ( bInitialize ) + memset( mpFlags, 0, 0x400 * sizeof( DffPropFlags ) ); + }; + + inline sal_Bool IsProperty( sal_uInt32 nRecType ) const { return ( mpFlags[ nRecType & 0x3ff ].bSet ); }; + sal_Bool IsHardAttribute( sal_uInt32 nId ) const; + sal_uInt32 GetPropertyValue( sal_uInt32 nId, sal_uInt32 nDefault = 0 ) const; + /** Returns a boolean property by its real identifier. */ + bool GetPropertyBool( sal_uInt32 nId, bool bDefault = false ) const; + /** Returns a string property. */ + ::rtl::OUString GetPropertyString( sal_uInt32 nId, SvStream& rStrm ) const; + void SetPropertyValue( sal_uInt32 nId, sal_uInt32 nValue ) const; + sal_Bool SeekToContent( sal_uInt32 nRecType, SvStream& rSt ) const; + void Merge( DffPropSet& rMasterPropSet ) const; + void InitializePropSet() const; + friend SvStream& operator>>( SvStream& rIn, DffPropSet& rPropSet ); }; class SfxItemSet; @@ -215,17 +230,20 @@ struct SvxMSDffConnectorRule sal_uInt32 nSpFlagsA; // SpFlags of shape A ( the original mirror flags must be known when solving the Solver Container ) sal_uInt32 nSpFlagsB; // SpFlags of shape A - SdrObject* pAObj; // pPtr of object ( corresponding to shape A ) - SdrObject* pBObj; // " - SdrObject* pCObj; // " of connector object + SdrObject* pAObj; // pPtr of object ( corresponding to shape A ) + SdrObject* pBObj; // " + SdrObject* pCObj; // " of connector object SvxMSDffConnectorRule() : nSpFlagsA( 0 ), nSpFlagsB( 0 ), pAObj( NULL ), pBObj( NULL ), pCObj( NULL ) {}; friend SvStream& operator>>( SvStream& rIn, SvxMSDffConnectorRule& rAtom ); }; + +typedef ::std::vector< SvxMSDffConnectorRule* > SvxMSDffConnectorRuleList; + struct MSFILTER_DLLPUBLIC SvxMSDffSolverContainer { - List aCList; + SvxMSDffConnectorRuleList aCList; SvxMSDffSolverContainer(); ~SvxMSDffSolverContainer(); @@ -258,11 +276,11 @@ struct MSFILTER_DLLPUBLIC SvxMSDffImportRec { static const int RELTO_DEFAULT = 2; - SdrObject* pObj; - Polygon* pWrapPolygon; - char* pClientAnchorBuffer; + SdrObject* pObj; + Polygon* pWrapPolygon; + char* pClientAnchorBuffer; sal_uInt32 nClientAnchorLen; - char* pClientDataBuffer; + char* pClientDataBuffer; sal_uInt32 nClientDataLen; sal_uInt32 nXAlign; sal_uInt32 *pXRelTo; @@ -270,24 +288,24 @@ struct MSFILTER_DLLPUBLIC SvxMSDffImportRec sal_uInt32 *pYRelTo; sal_uInt32 nLayoutInTableCell; sal_uInt32 nFlags; - long nTextRotationAngle; - long nDxTextLeft; // Abstand der Textbox vom umgebenden Shape - long nDyTextTop; - long nDxTextRight; - long nDyTextBottom; - long nDxWrapDistLeft; - long nDyWrapDistTop; - long nDxWrapDistRight; - long nDyWrapDistBottom; - long nCropFromTop; - long nCropFromBottom; - long nCropFromLeft; - long nCropFromRight; - MSDffTxId aTextId; // Kennungen fuer Textboxen + long nTextRotationAngle; + long nDxTextLeft; // Abstand der Textbox vom umgebenden Shape + long nDyTextTop; + long nDxTextRight; + long nDyTextBottom; + long nDxWrapDistLeft; + long nDyWrapDistTop; + long nDxWrapDistRight; + long nDyWrapDistBottom; + long nCropFromTop; + long nCropFromBottom; + long nCropFromLeft; + long nCropFromRight; + MSDffTxId aTextId; // Kennungen fuer Textboxen sal_uLong nNextShapeId; // fuer verlinkte Textboxen sal_uLong nShapeId; - MSO_SPT eShapeType; - MSO_LineStyle eLineStyle; // Umrandungs-Arten + MSO_SPT eShapeType; + MSO_LineStyle eLineStyle; // Umrandungs-Arten MSO_LineDashing eLineDashing; sal_Bool bDrawHell :1; sal_Bool bHidden :1; @@ -303,11 +321,13 @@ struct MSFILTER_DLLPUBLIC SvxMSDffImportRec ~SvxMSDffImportRec(); sal_Bool operator==( const SvxMSDffImportRec& rEntry ) const { return nShapeId == rEntry.nShapeId; } + sal_Bool operator<( const SvxMSDffImportRec& rEntry ) const { return nShapeId < rEntry.nShapeId; } private: SvxMSDffImportRec &operator=(const SvxMSDffImportRec&); }; + typedef SvxMSDffImportRec* MSDffImportRec_Ptr; // Liste aller SvxMSDffImportRec fuer eine Gruppe @@ -345,8 +365,8 @@ struct DffObjData Rectangle aBoundRect; Rectangle aChildAnchor; - sal_uInt32 nShapeId; - sal_uInt32 nSpFlags; + sal_uInt32 nShapeId; + sal_uInt32 nSpFlags; MSO_SPT eShapeType; sal_Bool bShapeType : 1; @@ -379,15 +399,15 @@ struct DffObjData struct DffRecordList { - sal_uInt32 nCount; - sal_uInt32 nCurrent; - DffRecordList* pPrev; - DffRecordList* pNext; + sal_uInt32 nCount; + sal_uInt32 nCurrent; + DffRecordList* pPrev; + DffRecordList* pNext; - DffRecordHeader mHd[ DFF_RECORD_MANAGER_BUF_SIZE ]; + DffRecordHeader mHd[ DFF_RECORD_MANAGER_BUF_SIZE ]; - DffRecordList( DffRecordList* pList ); - ~DffRecordList(); + DffRecordList( DffRecordList* pList ); + ~DffRecordList(); }; enum DffSeekToContentMode @@ -406,7 +426,7 @@ class MSFILTER_DLLPUBLIC DffRecordManager : public DffRecordList void Clear(); void Consume( SvStream& rIn, sal_Bool bAppend = sal_False, sal_uInt32 nStOfs = 0 ); - sal_Bool SeekToContent( SvStream& rIn, sal_uInt16 nRecType, DffSeekToContentMode eMode = SEEK_FROM_BEGINNING ); + sal_Bool SeekToContent( SvStream& rIn, sal_uInt16 nRecType, DffSeekToContentMode eMode = SEEK_FROM_BEGINNING ); DffRecordHeader* GetRecordHeader( sal_uInt16 nRecType, DffSeekToContentMode eMode = SEEK_FROM_BEGINNING ); DffRecordManager(); @@ -437,23 +457,23 @@ class MSFILTER_DLLPUBLIC SvxMSDffManager : public DffPropertyReader SvxMSDffBLIPInfos* pBLIPInfos; SvxMSDffShapeInfos* pShapeInfos; SvxMSDffShapeOrders* pShapeOrders; - sal_uLong nDefaultFontHeight; - long nOffsDgg; - sal_uInt16 nBLIPCount; - sal_uInt16 nShapeCount; + sal_uLong nDefaultFontHeight; + sal_uInt32 nOffsDgg; + sal_uInt16 nBLIPCount; + sal_uInt16 nShapeCount; sal_uInt32 nGroupShapeFlags; void CheckTxBxStoryChain(); - void GetFidclData( long nOffsDgg ); + void GetFidclData(sal_uInt32 nOffsDgg); protected : - String maBaseURL; - sal_uInt32 mnCurMaxShapeId; // we need this information to - sal_uInt32 mnDrawingsSaved; // access the right drawing - sal_uInt32 mnIdClusters; // while only knowing the shapeid - FIDCL* mpFidcls; - Table maDgOffsetTable; // array of fileoffsets + String maBaseURL; + sal_uInt32 mnCurMaxShapeId; // we need this information to + sal_uInt32 mnDrawingsSaved; // access the right drawing + sal_uInt32 mnIdClusters; // while only knowing the shapeid + FIDCL* mpFidcls; + Table maDgOffsetTable; // array of fileoffsets friend class DffPropertyReader; @@ -470,16 +490,16 @@ protected : long nEmuDiv; long nPntMul; long nPntDiv; - bool bNeedMap; - sal_uInt32 nSvxMSDffSettings; - sal_uInt32 nSvxMSDffOLEConvFlags; + bool bNeedMap; + sal_uInt32 nSvxMSDffSettings; + sal_uInt32 nSvxMSDffOLEConvFlags; /** stores a reference to an imported SdrObject with its shape id if it has one */ SvxMSDffShapeIdContainer maShapeIdContainer; - void GetCtrlData( long nOffsDgg ); + void GetCtrlData(sal_uInt32 nOffsDgg); void GetDrawingGroupContainerData( SvStream& rSt, sal_uLong nLenDgg ); // #156763# @@ -522,9 +542,9 @@ protected : /* folgende Methoden sind zum Excel-Import zu ueberschreiben: */ - virtual sal_Bool ProcessClientAnchor(SvStream& rStData, sal_uLong nDatLen, char*& rpBuff, sal_uInt32& rBuffLen ) const; + virtual sal_Bool ProcessClientAnchor(SvStream& rStData, sal_uInt32 nDatLen, char*& rpBuff, sal_uInt32& rBuffLen ) const; virtual void ProcessClientAnchor2( SvStream& rStData, DffRecordHeader& rHd, void* pData, DffObjData& ); - virtual sal_Bool ProcessClientData( SvStream& rStData, sal_uLong nDatLen, char*& rpBuff, sal_uInt32& rBuffLen ) const; + virtual sal_Bool ProcessClientData( SvStream& rStData, sal_uInt32 nDatLen, char*& rpBuff, sal_uInt32& rBuffLen ) const; virtual SdrObject* ProcessObj( SvStream& rSt, DffObjData& rData, void* pData, Rectangle& rTextRect, SdrObject* pObj = NULL); virtual sal_uLong Calc_nBLIPPos( sal_uLong nOrgVal, sal_uLong nStreamPos ) const; virtual bool GetColorFromPalette(sal_uInt16 nNum, Color& rColor) const; @@ -601,7 +621,7 @@ public: */ SvxMSDffManager( SvStream& rStCtrl, const String& rBaseURL, - long nOffsDgg, + sal_uInt32 nOffsDgg, SvStream* pStData, SdrModel* pSdrModel_ = 0, long nApplicationScale = 0, @@ -613,7 +633,7 @@ public: // in PPT werden die Parameter DGGContainerOffset und PicStream // mit Hilfe einer Init Routine Uebergeben. SvxMSDffManager( SvStream& rStCtrl, const String& rBaseURL, MSFilterTracer* pTracer ); - void InitSvxMSDffManager( long nOffsDgg_, SvStream* pStData_, sal_uInt32 nSvxMSDffOLEConvFlags ); + void InitSvxMSDffManager(sal_uInt32 nOffsDgg_, SvStream* pStData_, sal_uInt32 nSvxMSDffOLEConvFlags); void SetDgContainer( SvStream& rSt ); virtual ~SvxMSDffManager(); @@ -729,16 +749,16 @@ public: return pShapeOrders; } - void StoreShapeOrder(sal_uLong nId, - sal_uLong nTxBx, + void StoreShapeOrder(sal_uLong nId, + sal_uLong nTxBx, SdrObject* pObject, SwFlyFrmFmt* pFly = 0, short nHdFtSection = 0) const; - void ExchangeInShapeOrder(SdrObject* pOldObject, - sal_uLong nTxBx, - SwFlyFrmFmt* pFly, - SdrObject* pObject) const; + void ExchangeInShapeOrder(SdrObject* pOldObject, + sal_uLong nTxBx, + SwFlyFrmFmt* pFly, + SdrObject* pObject) const; void RemoveFromShapeOrder( SdrObject* pObject ) const; @@ -762,9 +782,10 @@ public: static sal_Bool SetPropValue( const ::com::sun::star::uno::Any& rAny, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, - const String& rPropertyName, - sal_Bool bTestPropertyAvailability = sal_False ); + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, + const String& rPropertyName, + sal_Bool bTestPropertyAvailability = sal_False + ); void insertShapeId( sal_Int32 nShapeId, SdrObject* pShape ); void removeShapeId( SdrObject* pShape ); diff --git a/filter/inc/filter/msfilter/msocximex.hxx b/filter/inc/filter/msfilter/msocximex.hxx index 5e1915d0406f..31b3732dbfdd 100644 --- a/filter/inc/filter/msfilter/msocximex.hxx +++ b/filter/inc/filter/msfilter/msocximex.hxx @@ -96,18 +96,12 @@ public: virtual ~SvxMSConvertOCXControls(); //Reads a control from the given storage, constructed shape in pShapeRef - sal_Bool ReadOCXStream( SotStorageRef& rSrc1, + virtual sal_Bool ReadOCXStream( SotStorageRef& rSrc1, com::sun::star::uno::Reference< com::sun::star::drawing::XShape > *pShapeRef=0, - sal_Bool bFloatingCtrl=sal_False ); + sal_Bool bFloatingCtrl=sal_False ) = 0; - //Excel has a nasty kludged mechanism for this, read - //the comments in the source to follow it - sal_Bool ReadOCXExcelKludgeStream(SotStorageStreamRef& rSrc1, - com::sun::star::uno::Reference < - com::sun::star::drawing::XShape > *pShapeRef,sal_Bool bFloatingCtrl); - //Writes the given Uno Control into the given storage diff --git a/filter/inc/filter/msfilter/svdfppt.hxx b/filter/inc/filter/msfilter/svdfppt.hxx index d9f52434b101..57ab915cec71 100644 --- a/filter/inc/filter/msfilter/svdfppt.hxx +++ b/filter/inc/filter/msfilter/svdfppt.hxx @@ -633,6 +633,7 @@ public: sal_uInt32* pTableArry, SvxMSDffSolverContainer* ); + virtual bool ReadFormControl( com::sun::star::uno::Reference< com::sun::star::io::XInputStream >& rxInStrm, com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rFormComp ) const = 0; }; struct PPTTextCharacterStyleAtomInterpreter @@ -1258,13 +1259,20 @@ class PPTConvertOCXControls : public SvxMSConvertOCXControls { virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > & GetDrawPage(); PptPageKind ePageKind; + const SdrPowerPointImport* mpPPTImporter; + com::sun::star::uno::Reference< com::sun::star::io::XInputStream > mxInStrm; public : - PPTConvertOCXControls( SfxObjectShell* pDSh, PptPageKind ePKind ) : + PPTConvertOCXControls( const SdrPowerPointImport* pPPTImporter, com::sun::star::uno::Reference< com::sun::star::io::XInputStream >& rxInStrm, SfxObjectShell* pDSh, PptPageKind ePKind ) : SvxMSConvertOCXControls ( pDSh, NULL ), - ePageKind ( ePKind ) + ePageKind ( ePKind ), + mpPPTImporter ( pPPTImporter ), + mxInStrm ( rxInStrm ) {}; - + virtual sal_Bool ReadOCXStream( SotStorageRef& rSrc1, + com::sun::star::uno::Reference< + com::sun::star::drawing::XShape > *pShapeRef=0, + sal_Bool bFloatingCtrl=sal_False ); virtual sal_Bool InsertControl( const com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > &rFComp, const com::sun::star::awt::Size& rSize, diff --git a/filter/inc/registration.hxx b/filter/inc/registration.hxx index 7bfe0d538b2a..060a77dd945a 100644 --- a/filter/inc/registration.hxx +++ b/filter/inc/registration.hxx @@ -49,17 +49,6 @@ namespace comphelper{ /** TODO doc */ -#define _COMPHELPER_COMPONENT_GETIMPLEMENTATIONENVIRONMENT \ - extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const sal_Char** ppEnvironmentTypeName, \ - uno_Environment** /* ppEnvironment */ ) \ - { \ - *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; \ - } - -//_______________________________________________ - -/** TODO doc - */ #define _COMPHELPER_MULTIINSTANCEFACTORY(IMPLEMENTATIONNAME, SERVICENAMES, FACTORYMETHOD) \ if (IMPLEMENTATIONNAME == sImplName) \ xFactory = ::cppu::createSingleFactory(xSMGR , \ diff --git a/filter/prj/d.lst b/filter/prj/d.lst index 7b7bfc5d308d..53b7a14243d4 100644 --- a/filter/prj/d.lst +++ b/filter/prj/d.lst @@ -3,6 +3,7 @@ mkdir: %COMMON_DEST%\bin\hid ..\%__SRC%\bin\*.dll %_DEST%\bin\*.dll ..\%__SRC%\lib\lib*.so %_DEST%\lib ..\%__SRC%\lib\lib*.dylib %_DEST%\lib +..\%__SRC%\lib\lib*.a %_DEST%\lib ..\%__SRC%\lib\imsfilter.lib %_DEST%\lib\imsfilter.lib ..\%__SRC%\class\*.jar %_DEST%\bin\*.jar ..\%__SRC%\class\XSLTFilter\*.jar %_DEST%\bin\*.jar diff --git a/filter/source/config/cache/registration.cxx b/filter/source/config/cache/registration.cxx index 26930a438b95..6d449c4aa0ca 100644 --- a/filter/source/config/cache/registration.cxx +++ b/filter/source/config/cache/registration.cxx @@ -99,9 +99,6 @@ static void InitConstants() theConstantsInitializer::get(); } -// extern "C" component_getImplementationEnvironment() -_COMPHELPER_COMPONENT_GETIMPLEMENTATIONENVIRONMENT - // extern "C" component_getFactory() _COMPHELPER_COMPONENT_GETFACTORY ( diff --git a/filter/source/config/fragments/makefile.mk b/filter/source/config/fragments/makefile.mk index 716c31891da8..6ad90259aa64 100644 --- a/filter/source/config/fragments/makefile.mk +++ b/filter/source/config/fragments/makefile.mk @@ -176,6 +176,15 @@ ALLTAR : $(ALL_FLAGS) $(ALL_FLAGS) : $(INCLUDE_FRAGMENTS) +.IF "$(CROSS_COMPILING)" == "YES" + +# Just assume cross-compiling from a sane system with a sane java +# command... Too bored now to start propagating all the crazy +# possibilities for Java as FOR_BUILD variants + +MERGE := java -jar $(SOLARBINDIR)$/FCFGMerge.jar + +.ELSE .IF "$(SOLAR_JAVA)"=="" #cmc, hack to workaround the java build requirement .IF "$(SYSTEM_PYTHON)" == "YES" @@ -186,6 +195,7 @@ MERGE:=$(AUGMENT_LIBRARY_PATH) PYTHONPATH=$(SOLARLIBDIR)/python $(SOLARBINDIR)/p .ELSE MERGE := $(JAVAI) $(JAVAIFLAGS) -jar $(SOLARBINDIR)$/FCFGMerge.jar .ENDIF +.ENDIF PACKLANG := $(XSLTPROC) --nonet PACKLANG_IN := diff --git a/filter/source/config/fragments/types/calc_MS_Excel_2003_XML.xcu b/filter/source/config/fragments/types/calc_MS_Excel_2003_XML.xcu index a3af765eaeb4..f37923a6d1f0 100644 --- a/filter/source/config/fragments/types/calc_MS_Excel_2003_XML.xcu +++ b/filter/source/config/fragments/types/calc_MS_Excel_2003_XML.xcu @@ -1,7 +1,7 @@ <node oor:name="calc_MS_Excel_2003_XML" oor:op="replace"> <prop oor:name="DetectService"><value>com.sun.star.comp.filters.XMLFilterDetect</value></prop> <prop oor:name="URLPattern"/> - <prop oor:name="Extensions"><value>xml</value></prop> + <prop oor:name="Extensions"><value>xml xls</value></prop> <prop oor:name="MediaType"/> <prop oor:name="Preferred"><value>false</value></prop> <prop oor:name="PreferredFilter"><value>MS Excel 2003 XML</value></prop> diff --git a/filter/source/config/fragments/types/calc_MS_Excel_97.xcu b/filter/source/config/fragments/types/calc_MS_Excel_97.xcu index 24bbc6db7cff..0f7b643763c9 100644 --- a/filter/source/config/fragments/types/calc_MS_Excel_97.xcu +++ b/filter/source/config/fragments/types/calc_MS_Excel_97.xcu @@ -1,7 +1,7 @@ <node oor:name="calc_MS_Excel_97" oor:op="replace" > <prop oor:name="DetectService"><value>com.sun.star.comp.oox.xls.BiffDetector</value></prop> <prop oor:name="URLPattern"/> - <prop oor:name="Extensions"><value>xls xlc xlm xlw</value></prop> + <prop oor:name="Extensions"><value>xls xlc xlm xlw xlk</value></prop> <prop oor:name="MediaType"><value>application/vnd.ms-excel</value></prop> <prop oor:name="Preferred"><value>false</value></prop> <prop oor:name="PreferredFilter"><value>MS Excel 97</value></prop> diff --git a/filter/source/config/fragments/types/calc_SYLK.xcu b/filter/source/config/fragments/types/calc_SYLK.xcu index bcc970a91987..3f5d1f90b019 100644 --- a/filter/source/config/fragments/types/calc_SYLK.xcu +++ b/filter/source/config/fragments/types/calc_SYLK.xcu @@ -1,8 +1,8 @@ <node oor:name="calc_SYLK" oor:op="replace" > <prop oor:name="DetectService"><value>com.sun.star.comp.calc.FormatDetector</value></prop> <prop oor:name="URLPattern"/> - <prop oor:name="Extensions"><value>slk</value></prop> - <prop oor:name="MediaType"/> + <prop oor:name="Extensions"><value>slk sylk</value></prop> + <prop oor:name="MediaType"><value>text/spreadsheet</value></prop> <prop oor:name="Preferred"><value>false</value></prop> <prop oor:name="PreferredFilter"><value>SYLK</value></prop> <prop oor:name="UIName"> diff --git a/filter/source/config/fragments/types/writer_MS_Word_2003_XML.xcu b/filter/source/config/fragments/types/writer_MS_Word_2003_XML.xcu index 003b5870773c..be34153ccbb9 100644 --- a/filter/source/config/fragments/types/writer_MS_Word_2003_XML.xcu +++ b/filter/source/config/fragments/types/writer_MS_Word_2003_XML.xcu @@ -1,7 +1,7 @@ <node oor:name="writer_MS_Word_2003_XML" oor:op="replace"> <prop oor:name="DetectService"><value>com.sun.star.comp.filters.XMLFilterDetect</value></prop> <prop oor:name="URLPattern"/> - <prop oor:name="Extensions"><value>xml</value></prop> + <prop oor:name="Extensions"><value>xml doc</value></prop> <prop oor:name="MediaType"/> <prop oor:name="Preferred"><value>false</value></prop> <prop oor:name="PreferredFilter"><value>MS Word 2003 XML</value></prop> diff --git a/filter/source/filtertracer/exports.dxp b/filter/source/filtertracer/exports.dxp index 0cb5620a1603..70033078921a 100644 --- a/filter/source/filtertracer/exports.dxp +++ b/filter/source/filtertracer/exports.dxp @@ -1,2 +1 @@ -component_getImplementationEnvironment -component_getFactory
\ No newline at end of file +component_getFactory diff --git a/filter/source/filtertracer/filtertraceruno.cxx b/filter/source/filtertracer/filtertraceruno.cxx index 9cc865c889d6..a0ba7fa09c4a 100644 --- a/filter/source/filtertracer/filtertraceruno.cxx +++ b/filter/source/filtertracer/filtertraceruno.cxx @@ -43,15 +43,6 @@ static REF( NMSP_UNO::XInterface ) SAL_CALL create_FilterTracer( const REF( NMSP return REF( NMSP_UNO::XInterface )( *new FilterTracer( rxFact ) ); } -// ------------------------------------------ -// - component_getImplementationEnvironment - -// ------------------------------------------ - -extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - // ------------------------ // - component_getFactory - // ------------------------ diff --git a/filter/source/flash/swfuno.cxx b/filter/source/flash/swfuno.cxx index 908b12b28bd9..80ab08ee7ef2 100644 --- a/filter/source/flash/swfuno.cxx +++ b/filter/source/flash/swfuno.cxx @@ -56,14 +56,6 @@ using namespace ::swf; extern "C" { -//================================================================================================== -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -//================================================================================================== SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ ) { diff --git a/filter/source/graphicfilter/epbm/epbm.cxx b/filter/source/graphicfilter/epbm/epbm.cxx index ff528153c5e7..f94ab01d7f85 100644 --- a/filter/source/graphicfilter/epbm/epbm.cxx +++ b/filter/source/graphicfilter/epbm/epbm.cxx @@ -188,13 +188,10 @@ void PBMWriter::ImplWriteBody() // ------------------------------------------------------------------------ // eine Dezimalzahl im ASCII format wird in den Stream geschrieben -void PBMWriter::ImplWriteNumber( sal_Int32 nNumber ) +void PBMWriter::ImplWriteNumber(sal_Int32 nNumber) { - const ByteString aNum( ByteString::CreateFromInt32( nNumber ) ); - - for( sal_Int16 n = 0, nLen = aNum.Len(); n < nLen; n++ ) - m_rOStm << aNum.GetChar( n ); - + const rtl::OString aNum(rtl::OString::valueOf(nNumber)); + m_rOStm << aNum.getStr(); } // ------------------------------------------------------------------------ diff --git a/filter/source/graphicfilter/epgm/epgm.cxx b/filter/source/graphicfilter/epgm/epgm.cxx index df16b793401d..747f0528813d 100644 --- a/filter/source/graphicfilter/epgm/epgm.cxx +++ b/filter/source/graphicfilter/epgm/epgm.cxx @@ -213,13 +213,10 @@ void PGMWriter::ImplWriteBody() // ------------------------------------------------------------------------ // eine Dezimalzahl im ASCII format wird in den Stream geschrieben -void PGMWriter::ImplWriteNumber( sal_Int32 nNumber ) +void PGMWriter::ImplWriteNumber(sal_Int32 nNumber) { - const ByteString aNum( ByteString::CreateFromInt32( nNumber ) ); - - for( sal_Int16 n = 0UL, nLen = aNum.Len(); n < nLen; n++ ) - m_rOStm << aNum.GetChar( n ); - + const rtl::OString aNum(rtl::OString::valueOf(nNumber)); + m_rOStm << aNum.getStr(); } // ------------------------------------------------------------------------ diff --git a/filter/source/graphicfilter/eppm/eppm.cxx b/filter/source/graphicfilter/eppm/eppm.cxx index cbe20d7a0668..80a0b25980b8 100644 --- a/filter/source/graphicfilter/eppm/eppm.cxx +++ b/filter/source/graphicfilter/eppm/eppm.cxx @@ -221,13 +221,10 @@ void PPMWriter::ImplWriteBody() // ------------------------------------------------------------------------ // eine Dezimalzahl im ASCII format wird in den Stream geschrieben -void PPMWriter::ImplWriteNumber( sal_Int32 nNumber ) +void PPMWriter::ImplWriteNumber(sal_Int32 nNumber) { - const ByteString aNum( ByteString::CreateFromInt32( nNumber ) ); - - for( sal_Int16 n = 0, nLen = aNum.Len(); n < nLen; n++ ) - m_rOStm << aNum.GetChar( n ); - + const rtl::OString aNum(rtl::OString::valueOf(nNumber)); + m_rOStm << aNum.getStr(); } // ------------------------------------------------------------------------ diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx index b5dfaa932fc3..4dcb8ef3d775 100644 --- a/filter/source/graphicfilter/eps/eps.cxx +++ b/filter/source/graphicfilter/eps/eps.cxx @@ -2454,42 +2454,36 @@ void PSWriter::ImplWriteLineInfo( const LineInfo& rLineInfo ) //--------------------------------------------------------------------------------- -void PSWriter::ImplWriteLong( sal_Int32 nNumber, sal_uLong nMode ) +void PSWriter::ImplWriteLong(sal_Int32 nNumber, sal_uLong nMode) { - const ByteString aNumber( ByteString::CreateFromInt32( nNumber ) ); - sal_uLong nLen = aNumber.Len(); - mnCursorPos += nLen; - for ( sal_uInt16 n = 0; n < nLen; n++ ) - *mpPS << aNumber.GetChar( n ); - ImplExecMode( nMode ); + const rtl::OString aNumber(rtl::OString::valueOf(nNumber)); + mnCursorPos += aNumber.getLength(); + *mpPS << aNumber.getStr(); + ImplExecMode(nMode); } //--------------------------------------------------------------------------------- void PSWriter::ImplWriteDouble( double fNumber, sal_uLong nMode ) { - sal_Int32 nLength; - sal_Int32 nPTemp = (sal_Int32)fNumber; sal_Int32 nATemp = labs( (sal_Int32)( ( fNumber - nPTemp ) * 100000 ) ); if ( !nPTemp && nATemp && ( fNumber < 0.0 ) ) *mpPS << (sal_Char)'-'; - ByteString aNumber1( ByteString::CreateFromInt32( nPTemp ) ); - nLength = aNumber1.Len(); - mnCursorPos += nLength; - for ( sal_Int32 n = 0; n < nLength; n++ ) - *mpPS << aNumber1.GetChar( (sal_uInt16)n ); + const rtl::OString aNumber1(rtl::OString::valueOf(nPTemp)); + *mpPS << aNumber1.getStr(); + mnCursorPos += aNumber1.getLength(); if ( nATemp ) { int zCount = 0; *mpPS << (sal_uInt8)'.'; mnCursorPos++; - const ByteString aNumber2( ByteString::CreateFromInt32( nATemp ) ); + const rtl::OString aNumber2(rtl::OString::valueOf(nATemp)); - sal_Int16 n, nLen = aNumber2.Len(); + sal_Int16 n, nLen = aNumber2.getLength(); if ( nLen < 8 ) { mnCursorPos += 6 - nLen; @@ -2501,9 +2495,9 @@ void PSWriter::ImplWriteDouble( double fNumber, sal_uLong nMode ) mnCursorPos += nLen; for ( n = 0; n < nLen; n++ ) { - *mpPS << aNumber2.GetChar( n ); + *mpPS << aNumber2[n]; zCount--; - if ( aNumber2.GetChar( n ) != '0' ) + if ( aNumber2[n] != '0' ) zCount = 0; } if ( zCount ) @@ -2524,8 +2518,8 @@ void PSWriter::ImplWriteF( sal_Int32 nNumber, sal_uLong nCount, sal_uLong nMode nNumber = -nNumber; mnCursorPos++; } - const ByteString aScaleFactor( ByteString::CreateFromInt32( nNumber ) ); - sal_uLong nLen = aScaleFactor.Len(); + const rtl::OString aScaleFactor(rtl::OString::valueOf(nNumber)); + sal_uLong nLen = aScaleFactor.getLength(); long nStSize = ( nCount + 1 ) - nLen; if ( nStSize >= 1 ) { @@ -2549,7 +2543,7 @@ void PSWriter::ImplWriteF( sal_Int32 nNumber, sal_uLong nCount, sal_uLong nMode *mpPS << (sal_uInt8)'.'; mnCursorPos++; } - *mpPS << aScaleFactor.GetChar( n ); + *mpPS << aScaleFactor[n]; } ImplExecMode( nMode ); } diff --git a/filter/source/graphicfilter/expm/expm.cxx b/filter/source/graphicfilter/expm/expm.cxx index 8ea9ec4bb00a..2cd5fbf035b0 100644 --- a/filter/source/graphicfilter/expm/expm.cxx +++ b/filter/source/graphicfilter/expm/expm.cxx @@ -215,13 +215,10 @@ void XPMWriter::ImplWriteBody() // ------------------------------------------------------------------------ // eine Dezimalzahl im ASCII format wird in den Stream geschrieben -void XPMWriter::ImplWriteNumber( sal_Int32 nNumber ) +void XPMWriter::ImplWriteNumber(sal_Int32 nNumber) { - const ByteString aNum( ByteString::CreateFromInt32( nNumber ) ); - - for( sal_Int16 n = 0UL, nLen = aNum.Len(); n < nLen; ++n ) - m_rOStm << aNum.GetChar( n ); - + const rtl::OString aNum(rtl::OString::valueOf(nNumber)); + m_rOStm << aNum.getStr(); } // ------------------------------------------------------------------------ diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 1af5e63e6034..2bd758eb91c6 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -3283,32 +3283,36 @@ EscherPersistTable::EscherPersistTable() EscherPersistTable::~EscherPersistTable() { - for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() ) - delete (EscherPersistEntry*)pPtr; + for( size_t i = 0, n = maPersistTable.size(); i < n; ++i ) { + delete maPersistTable[ i ]; + } } sal_Bool EscherPersistTable::PtIsID( sal_uInt32 nID ) { - for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() ) - { - if ( ((EscherPersistEntry*)pPtr)->mnID == nID ) + for( size_t i = 0, n = maPersistTable.size(); i < n; ++i ) { + EscherPersistEntry* pPtr = maPersistTable[ i ]; + if ( pPtr->mnID == nID ) { return sal_True; + } } return sal_False; } void EscherPersistTable::PtInsert( sal_uInt32 nID, sal_uInt32 nOfs ) { - maPersistTable.Insert( new EscherPersistEntry( nID, nOfs ) ); + maPersistTable.push_back( new EscherPersistEntry( nID, nOfs ) ); } sal_uInt32 EscherPersistTable::PtDelete( sal_uInt32 nID ) { - for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() ) + EscherPersistTable_impl::iterator it = maPersistTable.begin(); + for( ; it != maPersistTable.end() ; ++it ) { - if ( ((EscherPersistEntry*)pPtr)->mnID == nID ) - { - delete (EscherPersistEntry*) maPersistTable.Remove(); + if ( (*it)->mnID == nID ) { + delete *it; + maPersistTable.erase( it ); + break; } } return 0; @@ -3316,22 +3320,22 @@ sal_uInt32 EscherPersistTable::PtDelete( sal_uInt32 nID ) sal_uInt32 EscherPersistTable::PtGetOffsetByID( sal_uInt32 nID ) { - for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() ) - { - if ( ((EscherPersistEntry*)pPtr)->mnID == nID ) - return ((EscherPersistEntry*)pPtr)->mnOffset; + for( size_t i = 0, n = maPersistTable.size(); i < n; ++i ) { + EscherPersistEntry* pPtr = maPersistTable[ i ]; + if ( pPtr->mnID == nID ) { + return pPtr->mnOffset; + } } return 0; }; sal_uInt32 EscherPersistTable::PtReplace( sal_uInt32 nID, sal_uInt32 nOfs ) { - for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() ) - { - if ( ((EscherPersistEntry*)pPtr)->mnID == nID ) - { - sal_uInt32 nRetValue = ((EscherPersistEntry*)pPtr)->mnOffset; - ((EscherPersistEntry*)pPtr)->mnOffset = nOfs; + for( size_t i = 0, n = maPersistTable.size(); i < n; ++i ) { + EscherPersistEntry* pPtr = maPersistTable[ i ]; + if ( pPtr->mnID == nID ) { + sal_uInt32 nRetValue = pPtr->mnOffset; + pPtr->mnOffset = nOfs; return nRetValue; } } @@ -3340,12 +3344,11 @@ sal_uInt32 EscherPersistTable::PtReplace( sal_uInt32 nID, sal_uInt32 nOfs ) sal_uInt32 EscherPersistTable::PtReplaceOrInsert( sal_uInt32 nID, sal_uInt32 nOfs ) { - for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() ) - { - if ( ((EscherPersistEntry*)pPtr)->mnID == nID ) - { - sal_uInt32 nRetValue = ((EscherPersistEntry*)pPtr)->mnOffset; - ((EscherPersistEntry*)pPtr)->mnOffset = nOfs; + for( size_t i = 0, n = maPersistTable.size(); i < n; ++i ) { + EscherPersistEntry* pPtr = maPersistTable[ i ]; + if ( pPtr->mnID == nID ) { + sal_uInt32 nRetValue = pPtr->mnOffset; + pPtr->mnOffset = nOfs; return nRetValue; } } @@ -3355,10 +3358,10 @@ sal_uInt32 EscherPersistTable::PtReplaceOrInsert( sal_uInt32 nID, sal_uInt32 nOf sal_Bool EscherPropertyValueHelper::GetPropertyValue( ::com::sun::star::uno::Any& rAny, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, - const String& rString, - sal_Bool bTestPropertyAvailability ) -{ + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, + const String& rString, + sal_Bool bTestPropertyAvailability +) { sal_Bool bRetValue = sal_True; if ( bTestPropertyAvailability ) { @@ -4140,33 +4143,35 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( sal_Bool bFirst ) EscherSolverContainer::~EscherSolverContainer() { - void* pP; - - for( pP = maShapeList.First(); pP; pP = maShapeList.Next() ) - delete (EscherShapeListEntry*)pP; - for( pP = maConnectorList.First(); pP; pP = maConnectorList.Next() ) - delete (EscherConnectorListEntry*)pP; + for( size_t i = 0, n = maShapeList.size(); i < n; ++i ) { + delete maShapeList[ i ]; + } + for( size_t i = 0, n = maConnectorList.size(); i < n; ++i ) { + delete maConnectorList[ i ]; + } } void EscherSolverContainer::AddShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape, sal_uInt32 nId ) { - maShapeList.Insert( new EscherShapeListEntry( rXShape, nId ), LIST_APPEND ); + maShapeList.push_back( new EscherShapeListEntry( rXShape, nId ) ); } -void EscherSolverContainer::AddConnector( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rConnector, - const ::com::sun::star::awt::Point& rPA, - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rConA, - const ::com::sun::star::awt::Point& rPB, - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rConB ) +void EscherSolverContainer::AddConnector( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rConnector, + const ::com::sun::star::awt::Point& rPA, + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rConA, + const ::com::sun::star::awt::Point& rPB, + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rConB +) { - maConnectorList.Insert( new EscherConnectorListEntry( rConnector, rPA, rConA, rPB, rConB ), LIST_APPEND ); + maConnectorList.push_back( new EscherConnectorListEntry( rConnector, rPA, rConA, rPB, rConB ) ); } sal_uInt32 EscherSolverContainer::GetShapeId( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape ) const { - for ( EscherShapeListEntry* pPtr = (EscherShapeListEntry*)((List&)maShapeList).First(); - pPtr; pPtr = (EscherShapeListEntry*)((List&)maShapeList).Next() ) + for ( size_t i = 0, n = maShapeList.size(); i < n; ++i ) { + EscherShapeListEntry* pPtr = maShapeList[ i ]; if ( rXShape == pPtr->aXShape ) return ( pPtr->n_EscherId ); } @@ -4175,7 +4180,7 @@ sal_uInt32 EscherSolverContainer::GetShapeId( const ::com::sun::star::uno::Refer void EscherSolverContainer::WriteSolver( SvStream& rStrm ) { - sal_uInt32 nCount = maConnectorList.Count(); + sal_uInt32 nCount = maConnectorList.size(); if ( nCount ) { sal_uInt32 nRecHdPos, nCurrentPos, nSize; @@ -4187,10 +4192,10 @@ void EscherSolverContainer::WriteSolver( SvStream& rStrm ) EscherConnectorRule aConnectorRule; aConnectorRule.nRuleId = 2; - for ( EscherConnectorListEntry* pPtr = (EscherConnectorListEntry*)maConnectorList.First(); - pPtr; pPtr = (EscherConnectorListEntry*)maConnectorList.Next() ) + for ( size_t i = 0, n = maConnectorList.size(); i < n; ++i ) { - aConnectorRule.ncptiA = aConnectorRule.ncptiB = 0xffffffff; + EscherConnectorListEntry* pPtr = maConnectorList[ i ]; + aConnectorRule.ncptiA = aConnectorRule.ncptiB = 0xffffffff; aConnectorRule.nShapeC = GetShapeId( pPtr->mXConnector ); aConnectorRule.nShapeA = GetShapeId( pPtr->mXConnectToA ); aConnectorRule.nShapeB = GetShapeId( pPtr->mXConnectToB ); @@ -4407,11 +4412,12 @@ void EscherEx::InsertAtCurrentPos( sal_uInt32 nBytes, bool bExpandEndOfAtom ) sal_uInt8* pBuf; // Persist table anpassen - for ( void* pPtr = maPersistTable.First(); pPtr; pPtr = maPersistTable.Next() ) - { - sal_uInt32 nOfs = ((EscherPersistEntry*)pPtr)->mnOffset; - if ( nOfs >= nCurPos ) - ((EscherPersistEntry*)pPtr)->mnOffset += nBytes; + for( size_t i = 0, n = maPersistTable.size(); i < n; ++i ) { + EscherPersistEntry* pPtr = maPersistTable[ i ]; + sal_uInt32 nOfs = pPtr->mnOffset; + if ( nOfs >= nCurPos ) { + pPtr->mnOffset += nBytes; + } } // container und atom sizes anpassen diff --git a/filter/source/msfilter/makefile.mk b/filter/source/msfilter/makefile.mk index cbc06ffb49ef..8070bc4f4f88 100644 --- a/filter/source/msfilter/makefile.mk +++ b/filter/source/msfilter/makefile.mk @@ -58,7 +58,11 @@ SLOFILES= \ $(SLO)$/mstoolbar.obj SHL1TARGET= msfilter$(DLLPOSTFIX) +.IF "$(COM)" == "MSC" SHL1IMPLIB= i$(TARGET) +.ELSE +SHL1IMPLIB= msfilter$(DLLPOSTFIX) +.ENDIF SHL1OBJS= $(SLOFILES) SHL1USE_EXPORTS=name SHL1STDLIBS= \ diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 0b34fac649a6..936669d24387 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -211,7 +211,9 @@ sal_Bool Impl_OlePres::Read( SvStream & rStm ) } rStm.ResetError(); - rStm.Seek( nBeginPos ); + if (nBeginPos != rStm.Seek(nBeginPos)) + return sal_False; + nFormat = ReadClipboardFormat( rStm ); // JobSetup, bzw. TargetDevice ueberlesen // Information aufnehmen, um sie beim Schreiben nicht zu verlieren @@ -231,7 +233,7 @@ sal_Bool Impl_OlePres::Read( SvStream & rStm ) rStm.SetError( SVSTREAM_GENERALERROR ); return sal_False; } - sal_uInt32 nAsp; + sal_uInt32 nAsp(0); rStm >> nAsp; sal_uInt16 nSvAsp = sal_uInt16( nAsp ); SetAspect( nSvAsp ); @@ -315,49 +317,6 @@ void Impl_OlePres::Write( SvStream & rStm ) rStm.Seek( nEndPos ); } -Impl_OlePres * CreateCache_Impl( SotStorage * pStor ) -{ - SotStorageStreamRef xOleObjStm =pStor->OpenSotStream( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "Ole-Object" ) ), - STREAM_READ | STREAM_NOCREATE ); - if( xOleObjStm->GetError() ) - return NULL; - SotStorageRef xOleObjStor = new SotStorage( *xOleObjStm ); - if( xOleObjStor->GetError() ) - return NULL; - - String aStreamName; - if( xOleObjStor->IsContained( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\002OlePres000" ) ) ) ) - aStreamName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\002OlePres000" ) ); - else if( xOleObjStor->IsContained( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\1Ole10Native" ) ) ) ) - aStreamName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\1Ole10Native" ) ); - - if( aStreamName.Len() == 0 ) - return NULL; - - - for( sal_uInt16 i = 1; i < 10; i++ ) - { - SotStorageStreamRef xStm = xOleObjStor->OpenSotStream( aStreamName, - STREAM_READ | STREAM_NOCREATE ); - if( xStm->GetError() ) - break; - - xStm->SetBufferSize( 8192 ); - Impl_OlePres * pEle = new Impl_OlePres( 0 ); - if( pEle->Read( *xStm ) && !xStm->GetError() ) - { - if( pEle->GetFormat() == FORMAT_GDIMETAFILE || pEle->GetFormat() == FORMAT_BITMAP ) - return pEle; - } - delete pEle; - aStreamName = String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "\002OlePres00" ) ); - aStreamName += String( i ); - }; - return NULL; -} - - - //--------------------------------------------------------------------------- // Hilfs Klassen aus MSDFFDEF.HXX //--------------------------------------------------------------------------- @@ -650,7 +609,10 @@ bool DffPropSet::GetPropertyBool( sal_uInt32 nId, bool bDefault ) const if( (nBufferSize > 0) && SeekToContent( nId, rStrm ) ) { sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufferSize / 2 ); - aBuffer.ensureCapacity( nStrLen ); + //clip initial size of buffer to something sane in case of silly length + //strings. If there really is a silly amount of data available it still + //works out ok of course + aBuffer.ensureCapacity(std::min(nStrLen,static_cast<sal_Int32>(8192))); for( sal_Int32 nCharIdx = 0; nCharIdx < nStrLen; ++nCharIdx ) { sal_uInt16 nChar = 0; @@ -894,9 +856,10 @@ SvxMSDffSolverContainer::SvxMSDffSolverContainer() SvxMSDffSolverContainer::~SvxMSDffSolverContainer() { - for ( SvxMSDffConnectorRule* pPtr = (SvxMSDffConnectorRule*)aCList.First(); - pPtr; pPtr = (SvxMSDffConnectorRule*)aCList.Next() ) - delete pPtr; + for( size_t i = 0, n = aCList.size(); i < n; ++i ) { + delete aCList[ i ]; + } + aCList.clear(); } SvStream& operator>>( SvStream& rIn, SvxMSDffSolverContainer& rContainer ) @@ -913,7 +876,7 @@ SvStream& operator>>( SvStream& rIn, SvxMSDffSolverContainer& rContainer ) { SvxMSDffConnectorRule* pRule = new SvxMSDffConnectorRule; rIn >> *pRule; - rContainer.aCList.Insert( pRule, LIST_APPEND ); + rContainer.aCList.push_back( pRule ); } aCRule.SeekToEndOfRecord( rIn ); } @@ -923,10 +886,10 @@ SvStream& operator>>( SvStream& rIn, SvxMSDffSolverContainer& rContainer ) void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver ) { - sal_Int32 i, nCnt; - for ( i = 0, nCnt = rSolver.aCList.Count(); i < nCnt; i++ ) + size_t i, nCnt; + for ( i = 0, nCnt = rSolver.aCList.size(); i < nCnt; i++ ) { - SvxMSDffConnectorRule* pPtr = (SvxMSDffConnectorRule*)rSolver.aCList.GetObject( i ); + SvxMSDffConnectorRule* pPtr = rSolver.aCList[ i ]; if ( pPtr->pCObj ) { for ( int nN = 0; nN < 2; nN++ ) @@ -3260,7 +3223,9 @@ void DffRecordManager::Consume( SvStream& rIn, sal_Bool bAppend, sal_uInt32 nStO if ( pCList->nCount == DFF_RECORD_MANAGER_BUF_SIZE ) pCList = new DffRecordList( pCList ); rIn >> pCList->mHd[ pCList->nCount ]; - pCList->mHd[ pCList->nCount++ ].SeekToEndOfRecord( rIn ); + bool bSeekSucceeded = pCList->mHd[ pCList->nCount++ ].SeekToEndOfRecord(rIn); + if (!bSeekSucceeded) + break; } rIn.Seek( nOldPos ); } @@ -4614,31 +4579,29 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r if( pShapeId ) *pShapeId = 0; - rHd.SeekToContent( rSt ); + if (!rHd.SeekToContent(rSt)) + return pRet; + DffRecordHeader aRecHd; // the first atom has to be the SpContainer for the GroupObject rSt >> aRecHd; if ( aRecHd.nRecType == DFF_msofbtSpContainer ) { - sal_Int32 nGroupRotateAngle = 0; - sal_Int32 nSpFlags = 0; mnFix16Angle = 0; - aRecHd.SeekToBegOfRecord( rSt ); + if (!aRecHd.SeekToBegOfRecord(rSt)) + return pRet; + pRet = ImportObj( rSt, pClientData, rClientRect, rGlobalChildRect, nCalledByGroup + 1, pShapeId ); if ( pRet ) { - nSpFlags = nGroupShapeFlags; - nGroupRotateAngle = mnFix16Angle; - Rectangle aClientRect( rClientRect ); - Rectangle aGlobalChildRect; if ( !nCalledByGroup || rGlobalChildRect.IsEmpty() ) aGlobalChildRect = GetGlobalChildAnchor( rHd, rSt, aClientRect ); else aGlobalChildRect = rGlobalChildRect; - if ( ( nGroupRotateAngle > 4500 && nGroupRotateAngle <= 13500 ) - || ( nGroupRotateAngle > 22500 && nGroupRotateAngle <= 31500 ) ) + if ( ( mnFix16Angle > 4500 && mnFix16Angle <= 13500 ) + || ( mnFix16Angle > 22500 && mnFix16Angle <= 31500 ) ) { sal_Int32 nHalfWidth = ( aClientRect.GetWidth() + 1 ) >> 1; sal_Int32 nHalfHeight = ( aClientRect.GetHeight() + 1 ) >> 1; @@ -4650,7 +4613,9 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r } // now importing the inner objects of the group - aRecHd.SeekToEndOfRecord( rSt ); + if (!aRecHd.SeekToEndOfRecord(rSt)) + return pRet; + while ( ( rSt.GetError() == 0 ) && ( rSt.Tell() < rHd.GetRecEndFilePos() ) ) { DffRecordHeader aRecHd2; @@ -4659,10 +4624,11 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r { Rectangle aGroupClientAnchor, aGroupChildAnchor; GetGroupAnchors( aRecHd2, rSt, aGroupClientAnchor, aGroupChildAnchor, aClientRect, aGlobalChildRect ); - aRecHd2.SeekToBegOfRecord( rSt ); + if (!aRecHd2.SeekToBegOfRecord(rSt)) + return pRet; sal_Int32 nShapeId; SdrObject* pTmp = ImportGroup( aRecHd2, rSt, pClientData, aGroupClientAnchor, aGroupChildAnchor, nCalledByGroup + 1, &nShapeId ); - if ( pTmp ) + if ( pTmp && pRet && ((SdrObjGroup*)pRet)->GetSubList() ) { ((SdrObjGroup*)pRet)->GetSubList()->NbcInsertObject( pTmp ); if( nShapeId ) @@ -4671,31 +4637,33 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r } else if ( aRecHd2.nRecType == DFF_msofbtSpContainer ) { - aRecHd2.SeekToBegOfRecord( rSt ); + if (!aRecHd2.SeekToBegOfRecord(rSt)) + return pRet; sal_Int32 nShapeId; SdrObject* pTmp = ImportShape( aRecHd2, rSt, pClientData, aClientRect, aGlobalChildRect, nCalledByGroup + 1, &nShapeId ); - if ( pTmp ) + if ( pTmp && pRet && ((SdrObjGroup*)pRet)->GetSubList()) { ((SdrObjGroup*)pRet)->GetSubList()->NbcInsertObject( pTmp ); if( nShapeId ) insertShapeId( nShapeId, pTmp ); } } - aRecHd2.SeekToEndOfRecord( rSt ); + if (!aRecHd2.SeekToEndOfRecord(rSt)) + return pRet; } - if ( nGroupRotateAngle ) + if ( mnFix16Angle ) { - double a = nGroupRotateAngle * nPi180; - pRet->NbcRotate( aClientRect.Center(), nGroupRotateAngle, sin( a ), cos( a ) ); + double a = mnFix16Angle * nPi180; + pRet->NbcRotate( aClientRect.Center(), mnFix16Angle, sin( a ), cos( a ) ); } - if ( nSpFlags & SP_FFLIPV ) // Vertikal gespiegelt? + if ( nGroupShapeFlags & SP_FFLIPV ) // Vertical flip? { // BoundRect in aBoundRect Point aLeft( aClientRect.Left(), ( aClientRect.Top() + aClientRect.Bottom() ) >> 1 ); Point aRight( aLeft.X() + 1000, aLeft.Y() ); pRet->NbcMirror( aLeft, aRight ); } - if ( nSpFlags & SP_FFLIPH ) // Horizontal gespiegelt? + if ( nGroupShapeFlags & SP_FFLIPH ) // Horizontal flip? { // BoundRect in aBoundRect Point aTop( ( aClientRect.Left() + aClientRect.Right() ) >> 1, aClientRect.Top() ); Point aBottom( aTop.X(), aTop.Y() + 1000 ); @@ -4715,7 +4683,9 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r if( pShapeId ) *pShapeId = 0; - rHd.SeekToBegOfRecord( rSt ); + if (!rHd.SeekToBegOfRecord(rSt)) + return pRet; + DffObjData aObjData( rHd, rClientRect, nCalledByGroup ); maShapeRecords.Consume( rSt, sal_False ); aObjData.bShapeType = maShapeRecords.SeekToContent( rSt, DFF_msofbtSp, SEEK_FROM_BEGINNING ); @@ -4743,7 +4713,8 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r aObjData.bOpt = maShapeRecords.SeekToContent( rSt, DFF_msofbtOPT, SEEK_FROM_CURRENT_AND_RESTART ); if ( aObjData.bOpt ) { - maShapeRecords.Current()->SeekToBegOfRecord( rSt ); + if (!maShapeRecords.Current()->SeekToBegOfRecord(rSt)) + return pRet; #ifdef DBG_AUTOSHAPE ReadPropSet( rSt, pClientData, (sal_uInt32)aObjData.eShapeType ); #else @@ -5307,7 +5278,9 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r Rectangle SvxMSDffManager::GetGlobalChildAnchor( const DffRecordHeader& rHd, SvStream& rSt, Rectangle& aClientRect ) { Rectangle aChildAnchor; - rHd.SeekToContent( rSt ); + if (!rHd.SeekToContent(rSt)) + return aChildAnchor; + while ( ( rSt.GetError() == 0 ) && ( rSt.Tell() < rHd.GetRecEndFilePos() ) ) { DffRecordHeader aShapeHd; @@ -5358,10 +5331,12 @@ Rectangle SvxMSDffManager::GetGlobalChildAnchor( const DffRecordHeader& rHd, SvS aChildAnchor.Union( aChild ); break; } - aShapeAtom.SeekToEndOfRecord( rSt ); + if (!aShapeAtom.SeekToEndOfRecord(rSt)) + break; } } - aShapeHd.SeekToEndOfRecord( rSt ); + if (!aShapeHd.SeekToEndOfRecord(rSt)) + break; } return aChildAnchor; } @@ -5370,8 +5345,10 @@ void SvxMSDffManager::GetGroupAnchors( const DffRecordHeader& rHd, SvStream& rSt Rectangle& rGroupClientAnchor, Rectangle& rGroupChildAnchor, const Rectangle& rClientRect, const Rectangle& rGlobalChildRect ) { + if (!rHd.SeekToContent(rSt)) + return; + sal_Bool bFirst = sal_True; - rHd.SeekToContent( rSt ); DffRecordHeader aShapeHd; while ( ( rSt.GetError() == 0 ) && ( rSt.Tell() < rHd.GetRecEndFilePos() ) ) { @@ -5418,10 +5395,12 @@ void SvxMSDffManager::GetGroupAnchors( const DffRecordHeader& rHd, SvStream& rSt rGroupChildAnchor.Union( aChild ); break; } - aShapeAtom.SeekToEndOfRecord( rSt ); + if (!aShapeAtom.SeekToEndOfRecord(rSt)) + break; } } - aShapeHd.SeekToEndOfRecord( rSt ); + if (!aShapeHd.SeekToEndOfRecord(rSt)) + break; } } @@ -6008,14 +5987,14 @@ SV_IMPL_OP_PTRARR_SORT( SvxMSDffShapeTxBxSort, SvxMSDffShapeOrder_Ptr ); SV_IMPL_OP_PTRARR_SORT(MSDffImportRecords, MSDffImportRec_Ptr) //--------------------------------------------------------------------------- -// exportierte Klasse: oeffentliche Methoden +// exported class: Public Methods //--------------------------------------------------------------------------- SvxMSDffManager::SvxMSDffManager(SvStream& rStCtrl_, const String& rBaseURL, - long nOffsDgg_, + sal_uInt32 nOffsDgg_, SvStream* pStData_, - SdrModel* pSdrModel_,// s. unten: SetModel() + SdrModel* pSdrModel_,// see SetModel() below long nApplicationScale, ColorData mnDefaultColor_, sal_uLong nDefaultFontHeight_, @@ -6028,8 +6007,10 @@ SvxMSDffManager::SvxMSDffManager(SvStream& rStCtrl_, pShapeOrders( new SvxMSDffShapeOrders ), nDefaultFontHeight( nDefaultFontHeight_), nOffsDgg( nOffsDgg_ ), - nBLIPCount( USHRT_MAX ), // mit Error initialisieren, da wir erst pruefen, - nShapeCount( USHRT_MAX ), // ob Kontroll-Stream korrekte Daten enthaellt + nBLIPCount( USHRT_MAX ), // initialize with error, since we fist check if the + nShapeCount( USHRT_MAX ), // control stream has correct data + nGroupShapeFlags(0), //ensure initialization here, as some corrupted + //files may yield to this being unitialized maBaseURL( rBaseURL ), mpFidcls( NULL ), rStCtrl( rStCtrl_ ), @@ -6109,7 +6090,7 @@ SvxMSDffManager::~SvxMSDffManager() delete[] mpFidcls; } -void SvxMSDffManager::InitSvxMSDffManager( long nOffsDgg_, SvStream* pStData_, sal_uInt32 nOleConvFlags ) +void SvxMSDffManager::InitSvxMSDffManager( sal_uInt32 nOffsDgg_, SvStream* pStData_, sal_uInt32 nOleConvFlags ) { nOffsDgg = nOffsDgg_; pStData = pStData_; @@ -6149,13 +6130,15 @@ void SvxMSDffManager::SetDgContainer( SvStream& rSt ) } } -void SvxMSDffManager::GetFidclData( long nOffsDggL ) +void SvxMSDffManager::GetFidclData( sal_uInt32 nOffsDggL ) { - if ( nOffsDggL ) - { - sal_uInt32 nDummy, nMerk = rStCtrl.Tell(); - rStCtrl.Seek( nOffsDggL ); + if (!nOffsDggL) + return; + + sal_uInt32 nDummy, nMerk = rStCtrl.Tell(); + if (nOffsDggL == rStCtrl.Seek(nOffsDggL)) + { DffRecordHeader aRecHd; rStCtrl >> aRecHd; @@ -6181,8 +6164,8 @@ void SvxMSDffManager::GetFidclData( long nOffsDggL ) } } } - rStCtrl.Seek( nMerk ); } + rStCtrl.Seek( nMerk ); } void SvxMSDffManager::CheckTxBxStoryChain() @@ -6259,13 +6242,14 @@ void SvxMSDffManager::CheckTxBxStoryChain() und merken des File-Offsets fuer jedes Blip ============ ******************************************************************************/ -void SvxMSDffManager::GetCtrlData( long nOffsDgg_ ) +void SvxMSDffManager::GetCtrlData( sal_uInt32 nOffsDgg_ ) { // Start Offset unbedingt merken, falls wir nochmal aufsetzen muessen - long nOffsDggL = nOffsDgg_; + sal_uInt32 nOffsDggL = nOffsDgg_; // Kontroll Stream positionieren - rStCtrl.Seek( nOffsDggL ); + if (nOffsDggL != rStCtrl.Seek(nOffsDggL)) + return; sal_uInt8 nVer; sal_uInt16 nInst; @@ -6281,21 +6265,23 @@ void SvxMSDffManager::GetCtrlData( long nOffsDgg_ ) { GetDrawingGroupContainerData( rStCtrl, nLength ); - rStCtrl.Seek( STREAM_SEEK_TO_END ); + rStCtrl.Seek( STREAM_SEEK_TO_END ); sal_uInt32 nMaxStrPos = rStCtrl.Tell(); nPos += nLength; unsigned long nDrawingContainerId = 1; do { - rStCtrl.Seek( nPos ); + if (nPos != rStCtrl.Seek(nPos)) + break; bOk = ReadCommonRecordHeader( rStCtrl, nVer, nInst, nFbt, nLength ) && ( DFF_msofbtDgContainer == nFbt ); if( !bOk ) { nPos++; - rStCtrl.Seek( nPos ); + if (nPos != rStCtrl.Seek(nPos)) + break; bOk = ReadCommonRecordHeader( rStCtrl, nVer, nInst, nFbt, nLength ) && ( DFF_msofbtDgContainer == nFbt ); } @@ -6682,10 +6668,10 @@ sal_Bool SvxMSDffManager::GetShape(sal_uLong nId, SdrObject*& rpShape, sal_uLong nOldPosCtrl = rStCtrl.Tell(); sal_uLong nOldPosData = pStData ? pStData->Tell() : nOldPosCtrl; // das Shape im Steuer Stream anspringen - rStCtrl.Seek( rInfo.nFilePos ); + bool bSeeked = (rInfo.nFilePos == rStCtrl.Seek(rInfo.nFilePos)); // Falls missglueckt, den Fehlerstatus zuruecksetzen und Pech gehabt! - if( rStCtrl.GetError() ) + if (!bSeeked || rStCtrl.GetError()) rStCtrl.ResetError(); else rpShape = ImportObj( rStCtrl, &rData, rData.aParentRect, rData.aParentRect ); @@ -6979,29 +6965,26 @@ sal_Bool SvxMSDffManager::ReadCommonRecordHeader( SvStream& rSt, return rSt.GetError() == 0; } - - - -sal_Bool SvxMSDffManager::ProcessClientAnchor(SvStream& rStData, sal_uLong nDatLen, +sal_Bool SvxMSDffManager::ProcessClientAnchor(SvStream& rStData, sal_uInt32 nDatLen, char*& rpBuff, sal_uInt32& rBuffLen ) const { if( nDatLen ) { - rpBuff = new char[ nDatLen ]; - rBuffLen = nDatLen; - rStData.Read( rpBuff, nDatLen ); + rBuffLen = std::min(rStData.remainingSize(), static_cast<sal_Size>(nDatLen)); + rpBuff = new char[rBuffLen]; + rBuffLen = rStData.Read(rpBuff, rBuffLen); } return sal_True; } -sal_Bool SvxMSDffManager::ProcessClientData(SvStream& rStData, sal_uLong nDatLen, +sal_Bool SvxMSDffManager::ProcessClientData(SvStream& rStData, sal_uInt32 nDatLen, char*& rpBuff, sal_uInt32& rBuffLen ) const { if( nDatLen ) { - rpBuff = new char[ nDatLen ]; - rBuffLen = nDatLen; - rStData.Read( rpBuff, nDatLen ); + rBuffLen = std::min(rStData.remainingSize(), static_cast<sal_Size>(nDatLen)); + rpBuff = new char[rBuffLen]; + rBuffLen = rStData.Read(rpBuff, rBuffLen); } return sal_True; } diff --git a/filter/source/msfilter/msocximex.cxx b/filter/source/msfilter/msocximex.cxx index fd8b15c99576..6c79d1b9b384 100644 --- a/filter/source/msfilter/msocximex.cxx +++ b/filter/source/msfilter/msocximex.cxx @@ -4371,95 +4371,6 @@ OCX_Control * SvxMSConvertOCXControls::OCX_Factory( } -sal_Bool SvxMSConvertOCXControls::ReadOCXStream( SvStorageRef& rSrc1, - uno::Reference < drawing::XShape > *pShapeRef,sal_Bool bFloatingCtrl) -{ - - SvStorageStreamRef xCrash = rSrc1->OpenSotStream( WW8_ASCII2STR("contents") ); - sal_Bool bRet=sal_False; - - SvStorageStreamRef xSrc2 = rSrc1->OpenSotStream( WW8_ASCII2STR("\3OCXNAME") ); - SvStorageStream* pSt = xSrc2; - pSt->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); - - /* #117832# import control name */ - OUString controlName; - bool hasCName = readOCXNAME( controlName, pSt ); - - xSrc2 = rSrc1->OpenSotStream( WW8_ASCII2STR("contents") ); - pSt = xSrc2; - pSt->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); - - /*Get Class Id of this object, see if it is one of the types - *that this importer can handle, call the appropiate handler - to read that control, and call the appropiate handler to - insert that control - */ - - SvGlobalName aTest = rSrc1->GetClassName(); - OCX_Control *pObj = OCX_Factory(aTest.GetHexName()); - if (pObj) - { - pObj->pDocSh = pDocSh; - /* #117832# set imported control name */ - if ( hasCName ) - { - pObj->sName = controlName; - } - com::sun::star::awt::Size aSz; - uno::Reference< form::XFormComponent > xFComp; - const uno::Reference< lang::XMultiServiceFactory > & rServiceFactory = - GetServiceFactory(); - if(!rServiceFactory.is()) - return(sal_False); - bRet = pObj->FullRead(pSt); - if(bRet) - if (pObj->Import(rServiceFactory,xFComp,aSz)) - bRet = InsertControl( xFComp, aSz,pShapeRef,bFloatingCtrl); - delete pObj; - } - return bRet; -} - - -sal_Bool SvxMSConvertOCXControls::ReadOCXExcelKludgeStream( - SvStorageStreamRef& rSrc1, uno::Reference < drawing::XShape > * - pShapeRef,sal_Bool bFloatingCtrl) -{ - sal_Bool bRet=sal_False; - /*Get Class Id of this object, see if it is one of the types - *that this importer can handle, call the appropiate handler - to read that control, and call the appropiate handler to - insert that control - */ - /*The Excel Kludge is to concatenate a class id with a contents - * stream, and then concatenate all the controls together, - * This means that you should have the cnts stream wound to the - * correct location before passing the control stream in here*/ - SvStream *pSt = rSrc1; - pSt->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); - SvGlobalName aTest; - *pSt >> aTest; - OCX_Control *pObj = OCX_Factory(aTest.GetHexName()); - if (pObj) - { - - com::sun::star::awt::Size aSz; - uno::Reference< form::XFormComponent > xFComp; - const uno::Reference< lang::XMultiServiceFactory > & rServiceFactory = - GetServiceFactory(); - if(!rServiceFactory.is()) - return(sal_False); - bRet = pObj->FullRead(rSrc1); - if(bRet) - if (pObj->Import(rServiceFactory,xFComp,aSz)) - bRet = InsertControl( xFComp, aSz,pShapeRef,bFloatingCtrl); - delete pObj; - } - return bRet; -} - - sal_Bool SvxMSConvertOCXControls::WriteOCXStream( SvStorageRef& rSrc1, const uno::Reference< awt::XControlModel > &rControlModel, const awt::Size &rSize, String &rName) diff --git a/filter/source/msfilter/mstoolbar.cxx b/filter/source/msfilter/mstoolbar.cxx index 43e37650dbdd..398d281088f5 100644 --- a/filter/source/msfilter/mstoolbar.cxx +++ b/filter/source/msfilter/mstoolbar.cxx @@ -421,7 +421,7 @@ WString::Read( SvStream *pS ) { OSL_TRACE("WString::Read() stream pos 0x%x", pS->Tell() ); nOffSet = pS->Tell(); - sal_Int8 nChars = 0; + sal_uInt8 nChars = 0; *pS >> nChars; sString = readUnicodeString( pS, nChars ); return true; diff --git a/filter/source/msfilter/powerpoint/pptimporteruno.cxx b/filter/source/msfilter/powerpoint/pptimporteruno.cxx index 0cf1998d15f2..119e8bc5038e 100644 --- a/filter/source/msfilter/powerpoint/pptimporteruno.cxx +++ b/filter/source/msfilter/powerpoint/pptimporteruno.cxx @@ -39,11 +39,6 @@ static REF( NMSP_UNO::XInterface ) SAL_CALL create_PptImporter( const REF( NMSP_ return REF( NMSP_UNO::XInterface )( *new PptImporter( rxFact ) ); } -extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ ) { REF( NMSP_LANG::XSingleServiceFactory ) xFactory; diff --git a/filter/source/msfilter/services.cxx b/filter/source/msfilter/services.cxx index 09a303f72141..cd081b5f7756 100644 --- a/filter/source/msfilter/services.cxx +++ b/filter/source/msfilter/services.cxx @@ -59,17 +59,7 @@ static ::cppu::ImplementationEntry const spServices[] = } // namespace -// ---------------------------------------------------------------------------- - -extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char** ppEnvironmentTypeName, uno_Environment** /*ppEnvironment*/ ) -{ - *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const char* pImplName, void* pServiceManager, void* pRegistryKey ) { return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey, spServices ); } - -// ============================================================================ diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index b6d54ff2cf90..2d812f1c9178 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -127,6 +127,7 @@ #include <vcl/virdev.hxx> #include <algorithm> #include <set> +#include <unotools/streamwrap.hxx> // PPT ColorScheme Slots #define PPT_COLSCHEME (0x08000000) @@ -1235,9 +1236,9 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi } if ( rPersistEntry.pSolverContainer ) { - for ( SvxMSDffConnectorRule* pPtr = (SvxMSDffConnectorRule*)rPersistEntry.pSolverContainer->aCList.First(); - pPtr; pPtr = (SvxMSDffConnectorRule*)rPersistEntry.pSolverContainer->aCList.Next() ) + for ( size_t i = 0; i < rPersistEntry.pSolverContainer->aCList.size(); ++i ) { + SvxMSDffConnectorRule* pPtr = rPersistEntry.pSolverContainer->aCList[ i ]; if ( rObjData.nShapeId == pPtr->nShapeC ) pPtr->pCObj = pRet; else @@ -1676,6 +1677,24 @@ SdrPowerPointImport::~SdrPowerPointImport() delete[] pPersistPtr; } +sal_Bool PPTConvertOCXControls::ReadOCXStream( SotStorageRef& /*rSrc1*/, + com::sun::star::uno::Reference< + com::sun::star::drawing::XShape > *pShapeRef, + sal_Bool bFloatingCtrl ) +{ + bool bRes = false; + uno::Reference< form::XFormComponent > xFComp; + if ( mpPPTImporter && mpPPTImporter->ReadFormControl( mxInStrm, xFComp ) ) + { + if ( xFComp.is() ) + { + com::sun::star::awt::Size aSz; // not used in import + bRes = InsertControl( xFComp, aSz,pShapeRef,bFloatingCtrl); + } + } + return bRes; +} + sal_Bool PPTConvertOCXControls::InsertControl( const com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > &rFComp, @@ -1731,7 +1750,6 @@ sal_Bool PPTConvertOCXControls::InsertControl( } return bRetValue; }; - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& PPTConvertOCXControls::GetDrawPage() { if( !xDrawPage.is() && pDocSh ) @@ -1890,10 +1908,12 @@ SdrObject* SdrPowerPointImport::ImportOLE( long nOLEId, } if ( !pRet && ( pOe->nType == PPT_PST_ExControl ) ) { - PPTConvertOCXControls aPPTConvertOCXControls( pOe->pShell, eAktPageKind ); + uno::Reference< io::XInputStream > xIStrm = new utl::OSeekableInputStreamWrapper(*pDest ); + PPTConvertOCXControls aPPTConvertOCXControls( this, xIStrm, pOe->pShell, eAktPageKind ); ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape; if ( aPPTConvertOCXControls.ReadOCXStream( xObjStor, &xShape, sal_False ) ) pRet = GetSdrObjectFromXShape( xShape ); + } if ( !pRet ) { @@ -6581,7 +6601,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport // now will search for possible textextensions such as date/time fields // or ParaTabStops and append them on this textobj rIn.Seek( nFilePos ); - List* pFieldList = NULL; + ::std::vector< PPTFieldEntry* > FieldList; while ( rIn.Tell() < aClientTextBoxHd.GetRecEndFilePos() ) { rIn >> aTextHd; @@ -6753,20 +6773,23 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport aTextHd.SeekToEndOfRecord( rIn ); if ( pEntry ) { - if ( !pFieldList ) - pFieldList = new List; - sal_uInt32 n; - for ( n = 0; n < pFieldList->Count(); n++ ) - { // sorting fields ( hi >> lo ) - if ( ( (PPTFieldEntry*)pFieldList->GetObject( n ) )->nPos < pEntry->nPos ) + // sorting fields ( hi >> lo ) + ::std::vector< PPTFieldEntry* >::iterator it = FieldList.begin(); + for( ; it < FieldList.end(); ++it ) { + if ( (*it)->nPos < pEntry->nPos ) { break; + } + } + if ( it < FieldList.end() ) { + FieldList.insert( it, pEntry ); + } else { + FieldList.push_back( pEntry ); } - pFieldList->Insert( pEntry, (sal_uInt32)n ); } } - if ( pFieldList ) + if ( !FieldList.empty() ) { - PPTFieldEntry* pFE = (PPTFieldEntry*)pFieldList->First(); + ::std::vector< PPTFieldEntry* >::iterator FE = FieldList.begin(); List& aCharPropList = aStyleTextPropReader.aCharPropList; sal_Int32 i = nParagraphs - 1; @@ -6774,21 +6797,21 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport // at this point we just have a list of textportions(aCharPropList) // the next while loop tries to resolve the list of fields(pFieldList) - while( pFE && ( n >= 0 ) && ( i >= 0 ) ) + while( ( FE < FieldList.end() ) && ( n >= 0 ) && ( i >= 0 ) ) { - PPTCharPropSet* pSet = (PPTCharPropSet*)aCharPropList.GetObject( n ); + PPTCharPropSet* pSet = (PPTCharPropSet*)aCharPropList.GetObject( n ); String aString( pSet->maString ); sal_uInt32 nCount = aString.Len(); sal_uInt32 nPos = pSet->mnOriginalTextPos + nCount; - while ( pFE && nCount-- ) + while ( ( FE < FieldList.end() ) && nCount-- ) { nPos--; - while ( pFE && ( pFE->nPos > nPos ) ) - pFE = (PPTFieldEntry*)pFieldList->Next(); - if ( !pFE ) + while ( ( FE < FieldList.end() ) && ( (*FE)->nPos > nPos ) ) + ++FE; + if ( !(FE < FieldList.end()) ) break; - if ( pFE->nPos == nPos ) + if ( (*FE)->nPos == nPos ) { if ( aString.GetChar( (sal_uInt16)nCount ) == 0x2a ) { @@ -6800,10 +6823,10 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport pNewCPS->maString = String( aString, (sal_uInt16)nCount + 1, (sal_uInt16)nBehind ); aCharPropList.Insert( pNewCPS, n + 1 ); } - if ( pFE->pField2 ) + if ( (*FE)->pField2 ) { PPTCharPropSet* pNewCPS = new PPTCharPropSet( *pSet ); - pNewCPS->mpFieldItem = pFE->pField2, pFE->pField2 = NULL; + pNewCPS->mpFieldItem = (*FE)->pField2, (*FE)->pField2 = NULL; aCharPropList.Insert( pNewCPS, n + 1 ); pNewCPS = new PPTCharPropSet( *pSet ); @@ -6816,18 +6839,18 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport pNewCPS->maString = String( aString, (sal_uInt16)0, (sal_uInt16)nCount ); aCharPropList.Insert( pNewCPS, n++ ); } - if ( pFE->pField1 ) + if ( (*FE)->pField1 ) { - pSet->mpFieldItem = pFE->pField1, pFE->pField1 = NULL; + pSet->mpFieldItem = (*FE)->pField1, (*FE)->pField1 = NULL; } - else if ( pFE->pString ) - pSet->maString = *pFE->pString; + else if ( (*FE)->pString ) + pSet->maString = *(*FE)->pString; } else { - if ( pFE->nTextRangeEnd ) // text range hyperlink + if ( (*FE)->nTextRangeEnd ) // text range hyperlink { - sal_uInt32 nHyperLen = pFE->nTextRangeEnd - nPos; + sal_uInt32 nHyperLen = (*FE)->nTextRangeEnd - nPos; if ( nHyperLen ) { PPTCharPropSet* pBefCPS = NULL; @@ -6847,11 +6870,11 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport PPTCharPropSet* pCurrent = (PPTCharPropSet*)aCharPropList.GetObject( nIdx ); sal_Int32 nNextStringLen = pCurrent->maString.Len(); - DBG_ASSERT( pFE->pField1, "missing field!" ); - if (!pFE->pField1) + DBG_ASSERT( (*FE)->pField1, "missing field!" ); + if (!(*FE)->pField1) break; - const SvxURLField* pField = (const SvxURLField*)pFE->pField1->GetField(); + const SvxURLField* pField = (const SvxURLField*)(*FE)->pField1->GetField(); if ( pCurrent->mpFieldItem ) { @@ -6893,7 +6916,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport } nIdx++; } - delete pFE->pField1, pFE->pField1 = NULL; + delete (*FE)->pField1, (*FE)->pField1 = NULL; if ( pBefCPS ) { @@ -6909,9 +6932,9 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport } n--; } - for ( void* pPtr = pFieldList->First(); pPtr; pPtr = pFieldList->Next() ) - delete (PPTFieldEntry*)pPtr; - delete pFieldList; + for( size_t j = 0, n2 = FieldList.size(); j < n2; ++j ) { + delete FieldList[ j ]; + } } mpImplTextObj->mpParagraphList = new PPTParagraphObj*[ nParagraphs ]; aStyleTextPropReader.aCharPropList.First(); @@ -7500,9 +7523,9 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, sal_uInt32* pTab // possibly connections to the group object have to be removed. if ( pSolverContainer ) { - for ( SvxMSDffConnectorRule* pPtr = (SvxMSDffConnectorRule*)pSolverContainer->aCList.First(); - pPtr; pPtr = (SvxMSDffConnectorRule*)pSolverContainer->aCList.Next() ) + for ( size_t i = 0; i < pSolverContainer->aCList.size(); ++i ) { + SvxMSDffConnectorRule* pPtr = pSolverContainer->aCList[ i ]; SdrObjListIter aIter( *pGroup, IM_DEEPWITHGROUPS ); while( aIter.IsMore() ) { diff --git a/filter/source/odfflatxml/OdfFlatXml.cxx b/filter/source/odfflatxml/OdfFlatXml.cxx index 005bc9a11c2b..4be92503fb1f 100644 --- a/filter/source/odfflatxml/OdfFlatXml.cxx +++ b/filter/source/odfflatxml/OdfFlatXml.cxx @@ -235,8 +235,6 @@ Reference< XInterface > SAL_CALL OdfFlatXml::impl_createInstance(const Reference } -_COMPHELPER_COMPONENT_GETIMPLEMENTATIONENVIRONMENT - // extern "C" component_getFactory() _COMPHELPER_COMPONENT_GETFACTORY ( diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index adcb7135fd45..22823d9fb67f 100644 --- a/filter/source/pdf/impdialog.cxx +++ b/filter/source/pdf/impdialog.cxx @@ -434,6 +434,8 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage( Window* pParent, maCbReduceImageResolution( this, PDFFilterResId( CB_REDUCEIMAGERESOLUTION ) ), maCoReduceImageResolution( this, PDFFilterResId( CO_REDUCEIMAGERESOLUTION ) ), + m_aVerticalLine(this, PDFFilterResId(FL_GENERAL_VERTICAL)), + maFlGeneral( this, PDFFilterResId( FL_GENERAL ) ), maCbPDFA1b( this, PDFFilterResId( CB_PDFA_1B_SELECT ) ), @@ -791,6 +793,8 @@ ImpPDFTabOpnFtrPage::ImpPDFTabOpnFtrPage( Window* pParent, maRbMagnZoom( this, PDFFilterResId( RB_MAGNF_ZOOM ) ), maNumZoom( this, PDFFilterResId( NUM_MAGNF_ZOOM ) ), + m_aVerticalLine(this, PDFFilterResId(FL_INITVIEW_VERTICAL)), + maFlPageLayout( this, PDFFilterResId( FL_PAGE_LAYOUT ) ), maRbPgLyDefault( this, PDFFilterResId( RB_PGLY_DEFAULT ) ), maRbPgLySinglePage( this, PDFFilterResId( RB_PGLY_SINGPG ) ), @@ -955,6 +959,8 @@ ImpPDFTabViewerPage::ImpPDFTabViewerPage( Window* pParent, maCbOpenFullScreen( this, PDFFilterResId( CB_WNDOPT_OPNFULL ) ), maCbDispDocTitle( this, PDFFilterResId( CB_DISPDOCTITLE ) ), + m_aVerticalLine(this, PDFFilterResId(FL_VPREFER_VERTICAL)), + maFlUIOptions( this, PDFFilterResId( FL_USRIFOPT ) ), maCbHideViewerMenubar( this, PDFFilterResId( CB_UOP_HIDEVMENUBAR ) ), maCbHideViewerToolbar( this, PDFFilterResId( CB_UOP_HIDEVTOOLBAR ) ), @@ -1053,6 +1059,8 @@ ImpPDFTabSecurityPage::ImpPDFTabSecurityPage( Window* i_pParent, maOwnerPwdUnset( PDFFilterResId( STR_OWNER_PWD_UNSET ) ), maOwnerPwdPdfa( PDFFilterResId( STR_OWNER_PWD_PDFA ) ), + m_aVerticalLine(this, PDFFilterResId(FL_SECURITY_VERTICAL)), + maFlPrintPermissions( this, PDFFilterResId( FL_PRINT_PERMISSIONS ) ), maRbPrintNone( this, PDFFilterResId( RB_PRINT_NONE ) ), maRbPrintLowRes( this, PDFFilterResId( RB_PRINT_LOWRES ) ), diff --git a/filter/source/pdf/impdialog.hrc b/filter/source/pdf/impdialog.hrc index cd7015f7ef99..eae1c8d53b06 100644 --- a/filter/source/pdf/impdialog.hrc +++ b/filter/source/pdf/impdialog.hrc @@ -187,3 +187,8 @@ #define CB_CNV_OOO_DOCTOPDF 155 #define CB_EXP_BMRK_TO_DEST 156 + +#define FL_GENERAL_VERTICAL 157 +#define FL_INITVIEW_VERTICAL 158 +#define FL_VPREFER_VERTICAL 158 +#define FL_SECURITY_VERTICAL 160 diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx index be565eef93e6..b3e6c23e741f 100644 --- a/filter/source/pdf/impdialog.hxx +++ b/filter/source/pdf/impdialog.hxx @@ -190,6 +190,8 @@ class ImpPDFTabGeneralPage : public SfxTabPage CheckBox maCbReduceImageResolution; ComboBox maCoReduceImageResolution; + FixedLine m_aVerticalLine; + FixedLine maFlGeneral; CheckBox maCbPDFA1b; CheckBox maCbTaggedPDF; @@ -254,6 +256,8 @@ class ImpPDFTabOpnFtrPage : public SfxTabPage RadioButton maRbMagnZoom; MetricField maNumZoom; + FixedLine m_aVerticalLine; + FixedLine maFlPageLayout; RadioButton maRbPgLyDefault; RadioButton maRbPgLySinglePage; @@ -287,6 +291,8 @@ class ImpPDFTabViewerPage : public SfxTabPage CheckBox maCbOpenFullScreen; CheckBox maCbDispDocTitle; + FixedLine m_aVerticalLine; + FixedLine maFlUIOptions; CheckBox maCbHideViewerMenubar; CheckBox maCbHideViewerToolbar; @@ -330,6 +336,8 @@ class ImpPDFTabSecurityPage : public SfxTabPage String maOwnerPwdUnset; String maOwnerPwdPdfa; + FixedLine m_aVerticalLine; + FixedLine maFlPrintPermissions; RadioButton maRbPrintNone; RadioButton maRbPrintLowRes; diff --git a/filter/source/pdf/impdialog.src b/filter/source/pdf/impdialog.src index e65e4dd5da57..b54e1c8d761c 100644 --- a/filter/source/pdf/impdialog.src +++ b/filter/source/pdf/impdialog.src @@ -27,7 +27,7 @@ #include "impdialog.hrc" -#define TAB_PDF_SIZE Size = MAP_APPFONT ( 176, 268 ) +#define TAB_PDF_SIZE Size = MAP_APPFONT ( 352, 155 ) //string for TabDialog standard buttons String STR_PDF_EXPORT { @@ -153,16 +153,24 @@ TabPage RID_PDF_TAB_GENER "1200 DPI" ; }; }; + + FixedLine FL_GENERAL_VERTICAL + { + Pos = MAP_APPFONT ( 175 , 3 ) ; + Size = MAP_APPFONT ( 4 , 150 ) ; + Vert = TRUE; + }; + FixedLine FL_GENERAL { - Pos = MAP_APPFONT ( 6 , 117 ) ; + Pos = MAP_APPFONT ( 182 , 3 ) ; Size = MAP_APPFONT ( 164 , 8 ) ; Text[ en-US ] = "General"; }; CheckBox CB_PDFA_1B_SELECT { HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_PDFA_1B_SELECT"; - Pos = MAP_APPFONT ( 12, 128 ) ; + Pos = MAP_APPFONT ( 188, 14 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; Text[ en-US ] = "P~DF/A-1a"; @@ -170,7 +178,7 @@ TabPage RID_PDF_TAB_GENER CheckBox CB_TAGGEDPDF { HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_TAGGEDPDF"; - Pos = MAP_APPFONT ( 12 , 141 ) ; + Pos = MAP_APPFONT ( 188 , 27 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; Text[ en-US ] = "~Tagged PDF"; @@ -178,14 +186,14 @@ TabPage RID_PDF_TAB_GENER CheckBox CB_EXPORTFORMFIELDS { HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_EXPORTFORMFIELDS"; - Pos = MAP_APPFONT ( 12 , 154 ) ; + Pos = MAP_APPFONT ( 188 , 40 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; Text[ en-US ] = "~Create PDF form"; }; FixedText FT_FORMSFORMAT { - Pos = MAP_APPFONT ( 30 , 168 ) ; + Pos = MAP_APPFONT ( 206 , 54 ) ; Size = MAP_APPFONT ( 93, 8 ) ; Text[ en-US ] = "Submit ~format"; }; @@ -193,7 +201,7 @@ TabPage RID_PDF_TAB_GENER { HelpID = "filter:ListBox:RID_PDF_TAB_GENER:LB_FORMSFORMAT"; Border = TRUE ; - Pos = MAP_APPFONT ( 126, 166 ) ; + Pos = MAP_APPFONT ( 302, 52 ) ; Size = MAP_APPFONT ( 38, 48 ) ; DeltaLang = < Default ; Default ; Default ; Default ; > ; TabStop = TRUE ; @@ -209,7 +217,7 @@ TabPage RID_PDF_TAB_GENER CheckBox CB_ALLOWDUPLICATEFIELDNAMES { HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_ALLOWDUPLICATEFIELDNAMES"; - Pos = MAP_APPFONT( 30, 178 ); + Pos = MAP_APPFONT( 206, 64 ); Size = MAP_APPFONT( 128, 10 ); TabStop = TRUE; Text [ en-US ] = "Allow duplicate field ~names"; @@ -217,7 +225,7 @@ TabPage RID_PDF_TAB_GENER CheckBox CB_EXPORTBOOKMARKS { HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_EXPORTBOOKMARKS"; - Pos = MAP_APPFONT ( 12 , 190 ) ; + Pos = MAP_APPFONT ( 188 , 76 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; Text[ en-US ] = "Export ~bookmarks"; @@ -225,7 +233,7 @@ TabPage RID_PDF_TAB_GENER CheckBox CB_EXPORTNOTES { HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_EXPORTNOTES"; - Pos = MAP_APPFONT ( 12 , 203 ) ; + Pos = MAP_APPFONT ( 188 , 89 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; Text[ en-US ] = "~Export comments"; @@ -233,7 +241,7 @@ TabPage RID_PDF_TAB_GENER CheckBox CB_EXPORTNOTESPAGES { HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_EXPORTNOTESPAGES"; - Pos = MAP_APPFONT ( 12 , 216 ) ; + Pos = MAP_APPFONT ( 188 , 102 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; Text[ en-US ] = "Export ~notes pages"; @@ -241,7 +249,7 @@ TabPage RID_PDF_TAB_GENER CheckBox CB_EXPORTEMPTYPAGES { HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_EXPORTEMPTYPAGES"; - Pos = MAP_APPFONT ( 12 , 229 ) ; + Pos = MAP_APPFONT ( 188 , 115 ) ; Size = MAP_APPFONT ( 158 , 16 ) ; TabStop = TRUE ; WordBreak = TRUE ; @@ -250,7 +258,7 @@ TabPage RID_PDF_TAB_GENER CheckBox CB_EMBEDSTANDARDFONTS { HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_EMBEDSTANDARDFONTS"; - Pos = MAP_APPFONT ( 12 , 248 ) ; + Pos = MAP_APPFONT ( 188 , 134 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; Text[ en-US ] = "E~mbed standard fonts"; @@ -258,7 +266,7 @@ TabPage RID_PDF_TAB_GENER CheckBox CB_ADDSTREAM { HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_ADDSTREAM"; - Pos = MAP_APPFONT ( 12 , 261 ) ; + Pos = MAP_APPFONT ( 188 , 147 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; Text[ en-US ] = "Create ~hybrid file"; @@ -385,45 +393,52 @@ TabPage RID_PDF_TAB_OPNFTR Minimum = 50; Maximum = 1600; }; -//////////////////////////////////////// + + FixedLine FL_INITVIEW_VERTICAL + { + Pos = MAP_APPFONT ( 175 , 3 ) ; + Size = MAP_APPFONT ( 4 , 150 ) ; + Vert = TRUE; + }; + FixedLine FL_PAGE_LAYOUT { - Pos = MAP_APPFONT ( 6 , 146 ) ; - Size = MAP_APPFONT (164 , 8 ) ; + Pos = MAP_APPFONT ( 182 , 3 ) ; + Size = MAP_APPFONT (164 , 8 ) ; Text[ en-US ] = "Page layout" ; }; RadioButton RB_PGLY_DEFAULT { HelpID = "filter:RadioButton:RID_PDF_TAB_OPNFTR:RB_PGLY_DEFAULT"; - Pos = MAP_APPFONT ( 12 , 158 ) ; + Pos = MAP_APPFONT ( 188 , 15 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; Text[ en-US ] = "D~efault" ; }; RadioButton RB_PGLY_SINGPG { HelpID = "filter:RadioButton:RID_PDF_TAB_OPNFTR:RB_PGLY_SINGPG"; - Pos = MAP_APPFONT ( 12 , 170 ) ; + Pos = MAP_APPFONT ( 188 , 27 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; Text[ en-US ] = "~Single page" ; }; RadioButton RB_PGLY_CONT { HelpID = "filter:RadioButton:RID_PDF_TAB_OPNFTR:RB_PGLY_CONT"; - Pos = MAP_APPFONT ( 12 , 182 ) ; + Pos = MAP_APPFONT ( 188 , 39 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; Text[ en-US ] = "~Continuous" ; }; RadioButton RB_PGLY_CONTFAC { HelpID = "filter:RadioButton:RID_PDF_TAB_OPNFTR:RB_PGLY_CONTFAC"; - Pos = MAP_APPFONT ( 12 , 194 ) ; + Pos = MAP_APPFONT ( 188 , 51 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; Text[ en-US ] = "C~ontinuous facing" ; }; CheckBox CB_PGLY_FIRSTLEFT { HelpID = "filter:CheckBox:RID_PDF_TAB_OPNFTR:CB_PGLY_FIRSTLEFT"; - Pos = MAP_APPFONT ( 22 , 206 ) ; + Pos = MAP_APPFONT ( 198 , 63 ) ; Size = MAP_APPFONT ( 148 , 10 ) ; Text[ en-US ] = "First page is ~left" ; }; @@ -478,17 +493,23 @@ TabPage RID_PDF_TAB_VPREFER Text[ en-US ] = "~Display document title"; }; -//////////////////////////////// + FixedLine FL_VPREFER_VERTICAL + { + Pos = MAP_APPFONT ( 175 , 3 ) ; + Size = MAP_APPFONT ( 4 , 150 ) ; + Vert = TRUE; + }; + FixedLine FL_USRIFOPT { - Pos = MAP_APPFONT ( 6 , 64 ) ; + Pos = MAP_APPFONT ( 182 , 3 ) ; Size = MAP_APPFONT ( 164 , 8 ) ; Text[ en-US ] = "User interface options" ; }; CheckBox CB_UOP_HIDEVMENUBAR { HelpID = "filter:CheckBox:RID_PDF_TAB_VPREFER:CB_UOP_HIDEVMENUBAR"; - Pos = MAP_APPFONT ( 12 , 76 ) ; + Pos = MAP_APPFONT ( 188 , 15 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; Text[ en-US ] = "Hide ~menubar"; @@ -496,7 +517,7 @@ TabPage RID_PDF_TAB_VPREFER CheckBox CB_UOP_HIDEVTOOLBAR { HelpID = "filter:CheckBox:RID_PDF_TAB_VPREFER:CB_UOP_HIDEVTOOLBAR"; - Pos = MAP_APPFONT ( 12 , 88 ) ; + Pos = MAP_APPFONT ( 188 , 27 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; Text[ en-US ] = "Hide ~toolbar"; @@ -504,7 +525,7 @@ TabPage RID_PDF_TAB_VPREFER CheckBox CB_UOP_HIDEVWINCTRL { HelpID = "filter:CheckBox:RID_PDF_TAB_VPREFER:CB_UOP_HIDEVWINCTRL"; - Pos = MAP_APPFONT ( 12 , 100 ) ; + Pos = MAP_APPFONT ( 188 , 39 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; Text[ en-US ] = "Hide ~window controls"; @@ -513,14 +534,14 @@ TabPage RID_PDF_TAB_VPREFER //////////////////////////////// FixedLine FL_TRANSITIONS { - Pos = MAP_APPFONT ( 6 , 114 ) ; + Pos = MAP_APPFONT ( 6 , 64 ) ; Size = MAP_APPFONT ( 164 , 8 ) ; Text[ en-US ] = "Transitions" ; }; CheckBox CB_TRANSITIONEFFECTS { HelpID = "filter:CheckBox:RID_PDF_TAB_VPREFER:CB_TRANSITIONEFFECTS"; - Pos = MAP_APPFONT ( 12 , 126 ) ; + Pos = MAP_APPFONT ( 12 , 76 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; Text[ en-US ] = "~Use transition effects"; @@ -528,28 +549,28 @@ TabPage RID_PDF_TAB_VPREFER //////////////////////////////// FixedLine FL_BOOKMARKS { - Pos = MAP_APPFONT ( 6 , 140 ) ; + Pos = MAP_APPFONT ( 182 , 64 ) ; Size = MAP_APPFONT ( 164 , 8 ) ; Text[ en-US ] = "Bookmarks" ; }; RadioButton RB_ALLBOOKMARKLEVELS { HelpID = "filter:RadioButton:RID_PDF_TAB_VPREFER:RB_ALLBOOKMARKLEVELS"; - Pos = MAP_APPFONT ( 12 , 152 ) ; + Pos = MAP_APPFONT ( 188 , 76 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; Text[ en-US ] = "All bookmark levels"; }; RadioButton RB_VISIBLEBOOKMARKLEVELS { HelpID = "filter:RadioButton:RID_PDF_TAB_VPREFER:RB_VISIBLEBOOKMARKLEVELS"; - Pos = MAP_APPFONT ( 12 , 166 ) ; + Pos = MAP_APPFONT ( 188 , 90 ) ; Size = MAP_APPFONT ( 117 , 10 ) ; Text[ en-US ] = "Visible bookmark levels"; }; NumericField NUM_BOOKMARKLEVELS { HelpID = "filter:NumericField:RID_PDF_TAB_VPREFER:NUM_BOOKMARKLEVELS"; - Pos = MAP_APPFONT ( 132 , 165 ) ; + Pos = MAP_APPFONT ( 308 , 89 ) ; Size = MAP_APPFONT ( 32 , 12 ) ; Border = TRUE; Spin = TRUE; @@ -649,31 +670,37 @@ TabPage RID_PDF_TAB_SECURITY Text [en-US] = "PDF document will not be restricted due to PDF/A export."; }; -////////////////////////////// + FixedLine FL_SECURITY_VERTICAL + { + Pos = MAP_APPFONT ( 175 , 3 ) ; + Size = MAP_APPFONT ( 4 , 150 ) ; + Vert = TRUE; + }; + FixedLine FL_PRINT_PERMISSIONS { - Pos = MAP_APPFONT ( 12 , 90 ) ; + Pos = MAP_APPFONT ( 182 , 5 ) ; Size = MAP_APPFONT (156 , 8 ) ; Text[ en-US ] = "Printing" ; }; RadioButton RB_PRINT_NONE { HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_PRINT_NONE"; - Pos = MAP_APPFONT ( 18 , 101 ) ; + Pos = MAP_APPFONT ( 188 , 16 ) ; Size = MAP_APPFONT ( 150 , 10 ) ; Text[ en-US ] = "~Not permitted"; }; RadioButton RB_PRINT_LOWRES { HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_PRINT_LOWRES"; - Pos = MAP_APPFONT ( 18 , 112 ) ; + Pos = MAP_APPFONT ( 188 , 27 ) ; Size = MAP_APPFONT ( 150 , 10 ) ; Text[ en-US ] = "~Low resolution (150 dpi)"; }; RadioButton RB_PRINT_HIGHRES { HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_PRINT_HIGHRES"; - Pos = MAP_APPFONT ( 18 , 123 ) ; + Pos = MAP_APPFONT ( 188 , 38 ) ; Size = MAP_APPFONT ( 150 , 10 ) ; Text[ en-US ] = "~High resolution"; }; @@ -681,35 +708,35 @@ TabPage RID_PDF_TAB_SECURITY ///////////////////////////// FixedLine FL_CHANGES_ALLOWED { - Pos = MAP_APPFONT ( 12 , 134 ) ; + Pos = MAP_APPFONT ( 182 , 49 ) ; Size = MAP_APPFONT (156 , 8 ) ; Text[ en-US ] = "Changes" ; }; RadioButton RB_CHANGES_NONE { HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_CHANGES_NONE"; - Pos = MAP_APPFONT ( 18 , 145 ) ; + Pos = MAP_APPFONT ( 188 , 60 ) ; Size = MAP_APPFONT ( 150 , 10 ) ; Text[ en-US ] = "No~t permitted"; }; RadioButton RB_CHANGES_INSDEL { HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_CHANGES_INSDEL"; - Pos = MAP_APPFONT ( 18 , 157 ) ; + Pos = MAP_APPFONT ( 188 , 72 ) ; Size = MAP_APPFONT ( 150 , 10 ) ; Text[ en-US ] = "~Inserting, deleting, and rotating pages"; }; RadioButton RB_CHANGES_FILLFORM { HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_CHANGES_FILLFORM"; - Pos = MAP_APPFONT ( 18 , 168 ) ; + Pos = MAP_APPFONT ( 188 , 83 ) ; Size = MAP_APPFONT ( 150 , 10 ) ; Text[ en-US ] = "~Filling in form fields"; }; RadioButton RB_CHANGES_COMMENT { HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_CHANGES_COMMENT"; - Pos = MAP_APPFONT ( 18 , 179 ) ; + Pos = MAP_APPFONT ( 188 , 94 ) ; Size = MAP_APPFONT ( 152 , 16 ) ; WordBreak = TRUE ; Text[ en-US ] = "~Commenting, filling in form fields"; @@ -717,7 +744,7 @@ TabPage RID_PDF_TAB_SECURITY RadioButton RB_CHANGES_ANY_NOCOPY { HelpID = "filter:RadioButton:RID_PDF_TAB_SECURITY:RB_CHANGES_ANY_NOCOPY"; - Pos = MAP_APPFONT ( 18 , 198 ) ; + Pos = MAP_APPFONT ( 188 , 113 ) ; Size = MAP_APPFONT ( 152 , 10 ) ; Text[ en-US ] = "~Any except extracting pages"; }; @@ -725,7 +752,7 @@ TabPage RID_PDF_TAB_SECURITY CheckBox CB_ENDAB_COPY { HelpID = "filter:CheckBox:RID_PDF_TAB_SECURITY:CB_ENDAB_COPY"; - Pos = MAP_APPFONT ( 12 , 211 ) ; + Pos = MAP_APPFONT ( 182 , 126 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; Text[ en-US ] = "Ena~ble copying of content" ; @@ -734,7 +761,7 @@ TabPage RID_PDF_TAB_SECURITY CheckBox CB_ENAB_ACCESS { HelpID = "filter:CheckBox:RID_PDF_TAB_SECURITY:CB_ENAB_ACCESS"; - Pos = MAP_APPFONT ( 12 , 224 ) ; + Pos = MAP_APPFONT ( 182 , 139 ) ; Size = MAP_APPFONT ( 158 , 10 ) ; TabStop = TRUE ; Text[ en-US ] = "Enable text access for acce~ssibility tools" ; diff --git a/filter/source/pdf/pdfuno.cxx b/filter/source/pdf/pdfuno.cxx index 3dc446d4bad7..a1f4e99fe842 100644 --- a/filter/source/pdf/pdfuno.cxx +++ b/filter/source/pdf/pdfuno.cxx @@ -47,14 +47,6 @@ using namespace ::com::sun::star::registry; extern "C" { - SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** ) - { - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; - } - - // ------------------------------------------------------------------------- - SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { OUString aImplName( OUString::createFromAscii( pImplName ) ); diff --git a/filter/source/placeware/exports.dxp b/filter/source/placeware/exports.dxp index f0e1c69934bc..70033078921a 100644 --- a/filter/source/placeware/exports.dxp +++ b/filter/source/placeware/exports.dxp @@ -1,2 +1 @@ -component_getImplementationEnvironment component_getFactory diff --git a/filter/source/placeware/uno.cxx b/filter/source/placeware/uno.cxx index 49a5c599c1eb..6ebdbd12a006 100644 --- a/filter/source/placeware/uno.cxx +++ b/filter/source/placeware/uno.cxx @@ -53,13 +53,6 @@ using namespace ::pwp; extern "C" { -//================================================================================================== -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} -//================================================================================================== SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ ) { diff --git a/filter/source/svg/exports.map b/filter/source/svg/exports.map index d679dfda4fb7..e28b04cb046a 100644 --- a/filter/source/svg/exports.map +++ b/filter/source/svg/exports.map @@ -1,6 +1,5 @@ UDK_3_0_0 { global: - component_getImplementationEnvironment; component_getFactory; GraphicImport; diff --git a/filter/source/svg/makefile.mk b/filter/source/svg/makefile.mk index 4c914539299d..425eae9489a2 100644 --- a/filter/source/svg/makefile.mk +++ b/filter/source/svg/makefile.mk @@ -84,7 +84,8 @@ SHL1STDLIBS=\ $(CPPUHELPERLIB) \ $(CPPULIB) \ $(SALLIB) \ - $(LIBXML) + $(LIBXML) \ + $(SVLLIB) SHL1DEPN= SHL1IMPLIB= i$(SHL1TARGET) diff --git a/filter/source/svg/svgdialog.cxx b/filter/source/svg/svgdialog.cxx index a3054537b7b4..6787a38fa7da 100644 --- a/filter/source/svg/svgdialog.cxx +++ b/filter/source/svg/svgdialog.cxx @@ -112,12 +112,6 @@ Reference< XInterface > SAL_CALL SVGDialog_createInstance( const Reference< XMul SVGDialog::SVGDialog( const Reference< XMultiServiceFactory > &rxMSF ) : OGenericUnoDialog( rxMSF ) { - ByteString aResMgrName( "svgfilter" ); - - aResMgrName.Append( ByteString::CreateFromInt32( 0/*SOLARUPD*/ ) ); - - // !!! KA: enable ResMgr - // mapResMgr.reset( ResMgr::CreateResMgr( aResMgrName.GetBuffer(), Application::GetSettings().GetUILocale() ) ); } // ----------------------------------------------------------------------------- diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index 6a523541c221..b23e40a91a7b 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -37,6 +37,7 @@ #include "svgwriter.hxx" #include "svgfontexport.hxx" #include "svgfilter.hxx" +#include "svgscript.hxx" #include "impsvgdialog.hxx" #include <svtools/FilterConfigItem.hxx> @@ -47,9 +48,273 @@ #include <editeng/outliner.hxx> #include <editeng/flditem.hxx> #include <editeng/numitem.hxx> +#include <comphelper/processfactory.hxx> +#include <i18npool/lang.h> +#include <svl/zforlist.hxx> + +#include <boost/preprocessor/repetition/repeat.hpp> + using ::rtl::OUString; + + + +// ------------------------------- +// - ooo elements and attributes - +// ------------------------------- + +#define NSPREFIX "ooo:" + +// ooo xml elements +static const char aOOOElemMetaSlides[] = NSPREFIX "meta_slides"; +static const char aOOOElemMetaSlide[] = NSPREFIX "meta_slide"; +static const char aOOOElemTextField[] = NSPREFIX "text_field"; + +// ooo xml attributes for meta_slides +static const char aOOOAttrNumberOfSlides[] = NSPREFIX "number-of-slides"; +static const char aOOOAttrNumberingType[] = NSPREFIX "page-numbering-type"; + +// ooo xml attributes for meta_slide +static const char aOOOAttrSlide[] = NSPREFIX "slide"; +static const char aOOOAttrMaster[] = NSPREFIX "master"; +static const char aOOOAttrBackgroundVisibility[] = NSPREFIX "background-visibility"; +static const char aOOOAttrMasterObjectsVisibility[] = NSPREFIX "master-objects-visibility"; +static const char aOOOAttrPageNumberVisibility[] = NSPREFIX "page-number-visibility"; +static const char aOOOAttrDateTimeVisibility[] = NSPREFIX "date-time-visibility"; +static const char aOOOAttrFooterVisibility[] = NSPREFIX "footer-visibility"; +static const char aOOOAttrDateTimeField[] = NSPREFIX "date-time-field"; +static const char aOOOAttrFooterField[] = NSPREFIX "footer-field"; +static const char aOOOAttrHeaderField[] = NSPREFIX "header-field"; + +// ooo xml attributes for date_time_field +static const char aOOOAttrDateTimeFormat[] = NSPREFIX "date-time-format"; + +// ooo xml attributes for Placeholder Shapes +static const char aOOOAttrTextAdjust[] = NSPREFIX "text-adjust"; + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * - Text Field Class Hierarchy - * + * * + * This is a set of classes for exporting text field meta info. * + * * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#define TEXT_FIELD_GET_CLASS_NAME_METHOD( class_name ) \ +virtual ::rtl::OUString getClassName() const \ +{ \ + static const char className[] = #class_name; \ + return B2UCONST( className ); \ +} + + +class TextField +{ +protected: + SVGFilter::ObjectSet mMasterPageSet; +public: + + TEXT_FIELD_GET_CLASS_NAME_METHOD( TextField ) + virtual sal_Bool equalTo( const TextField & aTextField ) const = 0; + virtual void growCharSet( SVGFilter::UCharSetMapMap & aTextFieldCharSets ) const = 0; + virtual void elementExport( SVGExport* pSVGExport ) const + { + pSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", getClassName() ); + } + void insertMasterPage( Reference< XDrawPage> xMasterPage ) + { + mMasterPageSet.insert( xMasterPage ); + } + virtual ~TextField() {} +protected: + void implGrowCharSet( SVGFilter::UCharSetMapMap & aTextFieldCharSets, ::rtl::OUString sText, ::rtl::OUString sTextFieldId ) const + { + const sal_Unicode * ustr = sText.getStr(); + sal_Int32 nLength = sText.getLength(); + SVGFilter::ObjectSet::const_iterator aMasterPageIt = mMasterPageSet.begin(); + for( ; aMasterPageIt != mMasterPageSet.end(); ++aMasterPageIt ) + { + const Reference< XInterface > & xMasterPage = *aMasterPageIt; + for( sal_Int32 i = 0; i < nLength; ++i ) + { + aTextFieldCharSets[ xMasterPage ][ sTextFieldId ].insert( ustr[i] ); + } + } + } +}; + +class FixedTextField : public TextField +{ +public: + ::rtl::OUString text; + + TEXT_FIELD_GET_CLASS_NAME_METHOD( FixedTextField ) + virtual sal_Bool equalTo( const TextField & aTextField ) const + { + if( const FixedTextField* aFixedTextField = dynamic_cast< const FixedTextField* >( &aTextField ) ) + { + return ( text == aFixedTextField->text ); + } + return false; + } + virtual void elementExport( SVGExport* pSVGExport ) const + { + TextField::elementExport( pSVGExport ); + SvXMLElementExport aExp( *pSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True ); + pSVGExport->GetDocHandler()->characters( text ); + } + virtual ~FixedTextField() {} +}; + +class FixedDateTimeField : public FixedTextField +{ +public: + FixedDateTimeField() {} + TEXT_FIELD_GET_CLASS_NAME_METHOD( FixedDateTimeField ) + virtual void growCharSet( SVGFilter::UCharSetMapMap & aTextFieldCharSets ) const + { + static const ::rtl::OUString sFieldId = B2UCONST( aOOOAttrDateTimeField ); + implGrowCharSet( aTextFieldCharSets, text, sFieldId ); + } + virtual ~FixedDateTimeField() {} +}; + +class FooterField : public FixedTextField +{ +public: + FooterField() {} + TEXT_FIELD_GET_CLASS_NAME_METHOD( FooterField ) + virtual void growCharSet( SVGFilter::UCharSetMapMap & aTextFieldCharSets ) const + { + static const ::rtl::OUString sFieldId = B2UCONST( aOOOAttrFooterField ); + implGrowCharSet( aTextFieldCharSets, text, sFieldId ); + } + virtual ~FooterField() {} +}; + +class HeaderField : public FixedTextField +{ +public: + HeaderField() {} + TEXT_FIELD_GET_CLASS_NAME_METHOD( HeaderField ) + virtual void growCharSet( SVGFilter::UCharSetMapMap & aTextFieldCharSets ) const + { + static const ::rtl::OUString sFieldId = B2UCONST( aOOOAttrHeaderField ); + implGrowCharSet( aTextFieldCharSets, text, sFieldId ); + } + virtual ~HeaderField() {} +}; + +class VariableTextField : public TextField +{ +public: + TEXT_FIELD_GET_CLASS_NAME_METHOD( VariableTextField ) + virtual ~VariableTextField() {} +}; + +class VariableDateTimeField : public VariableTextField +{ +public: + sal_Int32 format; + + VariableDateTimeField() {} + TEXT_FIELD_GET_CLASS_NAME_METHOD( VariableDateTimeField ) + virtual sal_Bool equalTo( const TextField & aTextField ) const + { + if( const VariableDateTimeField* aField = dynamic_cast< const VariableDateTimeField* >( &aTextField ) ) + { + return ( format == aField->format ); + } + return false; + } + virtual void elementExport( SVGExport* pSVGExport ) const + { + VariableTextField::elementExport( pSVGExport ); + OUString sDateFormat, sTimeFormat; + SvxDateFormat eDateFormat = (SvxDateFormat)( format & 0x0f ); + if( eDateFormat ) + { + switch( eDateFormat ) + { + case SVXDATEFORMAT_STDSMALL: ; + case SVXDATEFORMAT_A: // 13.02.96 + sDateFormat = B2UCONST( "" ); + break; + case SVXDATEFORMAT_C: // 13.Feb 1996 + sDateFormat = B2UCONST( "" ); + break; + case SVXDATEFORMAT_D: // 13.February 1996 + sDateFormat = B2UCONST( "" ); + break; + case SVXDATEFORMAT_E: // Tue, 13.February 1996 + sDateFormat = B2UCONST( "" ); + break; + case SVXDATEFORMAT_STDBIG: ; + case SVXDATEFORMAT_F: // Tuesday, 13.February 1996 + sDateFormat = B2UCONST( "" ); + break; + // default case + case SVXDATEFORMAT_B: ; // 13.02.1996 + default: + sDateFormat = B2UCONST( "" ); + break; + } + } + + SvxTimeFormat eTimeFormat = (SvxTimeFormat)( ( format >> 4 ) & 0x0f ); + if( eTimeFormat ) + { + switch( eTimeFormat ) + { + case SVXTIMEFORMAT_24_HMS: // 13:49:38 + sTimeFormat = B2UCONST( "" ); + break; + case SVXTIMEFORMAT_AM_HM: ; // 01:49 PM + case SVXTIMEFORMAT_12_HM: + sTimeFormat = B2UCONST( "" ); + break; + case SVXTIMEFORMAT_AM_HMS: ; // 01:49:38 PM + case SVXTIMEFORMAT_12_HMS: + sTimeFormat = B2UCONST( "" ); + break; + // default case + case SVXTIMEFORMAT_24_HM: ; // 13:49 + default: + sTimeFormat = B2UCONST( "" ); + break; + } + } + + OUString sDateTimeFormat = sDateFormat; + sDateTimeFormat += OUString::valueOf( sal_Unicode(' ') ); + sDateTimeFormat += sTimeFormat; + + pSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrDateTimeFormat, sDateTimeFormat ); + SvXMLElementExport aExp( *pSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True ); + } + virtual void growCharSet( SVGFilter::UCharSetMapMap & aTextFieldCharSets ) const + { + // we use the unicode char set in an improper way: we put in the date/time fortat + // in order to pass it to the CalcFieldValue method + static const ::rtl::OUString sFieldId = B2UCONST( aOOOAttrDateTimeField ) + B2UCONST( "-variable" ); + SVGFilter::ObjectSet::const_iterator aMasterPageIt = mMasterPageSet.begin(); + for( ; aMasterPageIt != mMasterPageSet.end(); ++aMasterPageIt ) + { + aTextFieldCharSets[ *aMasterPageIt ][ sFieldId ].insert( (sal_Unicode)( format ) ); + } + } + virtual ~VariableDateTimeField() {} +}; + +sal_Bool operator==( const TextField & aLhsTextField, const TextField & aRhsTextField ) +{ + return aLhsTextField.equalTo( aRhsTextField ); +} + + + // ------------- // - SVGExport - // ------------- @@ -62,6 +327,8 @@ SVGExport::SVGExport( mrFilterData( rFilterData ) { SetDocHandler( rxHandler ); + sal_uInt16 nExportFlags = getExportFlags() | EXPORT_PRETTY; + setExportFlags( nExportFlags ); GetDocHandler()->startDocument(); } @@ -233,11 +500,10 @@ sal_Bool ObjectRepresentation::operator==( const ObjectRepresentation& rPresenta sal_Bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) throw (RuntimeException) { - Reference< XMultiServiceFactory > xServiceFactory( ::comphelper::getProcessServiceFactory() ) ; + Reference< XMultiServiceFactory > xServiceFactory( ::comphelper::getProcessServiceFactory() ) ; Reference< XOutputStream > xOStm; SvStream* pOStm = NULL; - sal_Int32 nLength = rDescriptor.getLength(); - sal_Int32 nPageToExport = SVG_EXPORT_ALLPAGES; + sal_Int32 nLength = rDescriptor.getLength(); const PropertyValue* pValue = rDescriptor.getConstArray(); sal_Bool bRet = sal_False; @@ -258,8 +524,6 @@ sal_Bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) if( pOStm ) xOStm = Reference< XOutputStream >( new ::utl::OOutputStreamWrapper ( *pOStm ) ); } - else if( pValue[ i ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PagePos" ) ) ) - pValue[ i ].Value >>= nPageToExport; else if( pValue[ i ].Name.equalsAscii( "FilterData" ) ) { pValue[ i ].Value >>= maFilterData; @@ -318,88 +582,57 @@ sal_Bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) if( xOStm.is() && xServiceFactory.is() ) { - Reference< XMasterPagesSupplier > xMasterPagesSupplier( mxSrcDoc, UNO_QUERY ); - Reference< XDrawPagesSupplier > xDrawPagesSupplier( mxSrcDoc, UNO_QUERY ); - - if( xMasterPagesSupplier.is() && xDrawPagesSupplier.is() ) + if( mSelectedPages.hasElements() && mMasterPageTargets.hasElements() ) { - Reference< XDrawPages > xMasterPages( xMasterPagesSupplier->getMasterPages(), UNO_QUERY ); - Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY ); + Reference< XDocumentHandler > xDocHandler( implCreateExportDocumentHandler( xOStm ) ); - if( xMasterPages.is() && xMasterPages->getCount() && xDrawPages.is() && xDrawPages->getCount() ) + if( xDocHandler.is() ) { - Reference< XDocumentHandler > xDocHandler( implCreateExportDocumentHandler( xOStm ) ); + mbPresentation = Reference< XPresentationSupplier >( mxSrcDoc, UNO_QUERY ).is(); + mpObjects = new ObjectMap; - if( xDocHandler.is() ) - { - mbPresentation = Reference< XPresentationSupplier >( mxSrcDoc, UNO_QUERY ).is(); - mpObjects = new ObjectMap; - - // #110680# - // mpSVGExport = new SVGExport( xDocHandler ); + // #110680# + // mpSVGExport = new SVGExport( xDocHandler ); mpSVGExport = new SVGExport( xServiceFactory, xDocHandler, maFilterData ); - if( nPageToExport < 0 || nPageToExport >= xDrawPages->getCount() ) - nPageToExport = SVG_EXPORT_ALLPAGES; + try + { + mxDefaultPage = mSelectedPages[0]; - try + if( mxDefaultPage.is() ) { - const sal_Int32 nDefaultPage = ( ( SVG_EXPORT_ALLPAGES == nPageToExport ) ? 0 : nPageToExport ); + SvxDrawPage* pSvxDrawPage = SvxDrawPage::getImplementation( mxDefaultPage ); - xDrawPages->getByIndex( nDefaultPage ) >>= mxDefaultPage; - - if( mxDefaultPage.is() ) + if( pSvxDrawPage ) { - SvxDrawPage* pSvxDrawPage = SvxDrawPage::getImplementation( mxDefaultPage ); - - if( pSvxDrawPage ) - { - mpDefaultSdrPage = pSvxDrawPage->GetSdrPage(); - mpSdrModel = mpDefaultSdrPage->GetModel(); - - if( mpSdrModel ) - { - SdrOutliner& rOutl = mpSdrModel->GetDrawOutliner(NULL); - - maOldFieldHdl = rOutl.GetCalcFieldValueHdl(); - rOutl.SetCalcFieldValueHdl( LINK( this, SVGFilter, CalcFieldHdl) ); - } - } + mpDefaultSdrPage = pSvxDrawPage->GetSdrPage(); + mpSdrModel = mpDefaultSdrPage->GetModel(); - if( implCreateObjects( xMasterPages, xDrawPages, nPageToExport ) ) + if( mpSdrModel ) { - ObjectMap::const_iterator aIter( mpObjects->begin() ); - ::std::vector< ObjectRepresentation > aObjects( mpObjects->size() ); - sal_uInt32 nPos = 0; + SdrOutliner& rOutl = mpSdrModel->GetDrawOutliner(NULL); - while( aIter != mpObjects->end() ) - { - aObjects[ nPos++ ] = (*aIter).second; - ++aIter; - } - - mpSVGFontExport = new SVGFontExport( *mpSVGExport, aObjects ); - mpSVGWriter = new SVGActionWriter( *mpSVGExport, *mpSVGFontExport ); - - bRet = implExportDocument( xMasterPages, xDrawPages, nPageToExport ); + maOldFieldHdl = rOutl.GetCalcFieldValueHdl(); + rOutl.SetCalcFieldValueHdl( LINK( this, SVGFilter, CalcFieldHdl) ); } } + bRet = implExportDocument(); } - catch( ... ) - { - delete mpSVGDoc, mpSVGDoc = NULL; - OSL_FAIL( "Exception caught" ); - } + } + catch( ... ) + { + delete mpSVGDoc, mpSVGDoc = NULL; + OSL_FAIL( "Exception caught" ); + } - if( mpSdrModel ) - mpSdrModel->GetDrawOutliner( NULL ).SetCalcFieldValueHdl( maOldFieldHdl ); + if( mpSdrModel ) + mpSdrModel->GetDrawOutliner( NULL ).SetCalcFieldValueHdl( maOldFieldHdl ); - delete mpSVGWriter, mpSVGWriter = NULL; - delete mpSVGExport, mpSVGExport = NULL; - delete mpSVGFontExport, mpSVGFontExport = NULL; - delete mpObjects, mpObjects = NULL; - mbPresentation = sal_False; - } + delete mpSVGWriter, mpSVGWriter = NULL; + delete mpSVGExport, mpSVGExport = NULL; + delete mpSVGFontExport, mpSVGFontExport = NULL; + delete mpObjects, mpObjects = NULL; + mbPresentation = sal_False; } } } @@ -436,20 +669,63 @@ Reference< XDocumentHandler > SVGFilter::implCreateExportDocumentHandler( const // ----------------------------------------------------------------------------- -sal_Bool SVGFilter::implExportDocument( const Reference< XDrawPages >& rxMasterPages, - const Reference< XDrawPages >& rxDrawPages, - sal_Int32 nPageToExport ) +inline +sal_Bool SVGFilter::implLookForFirstVisiblePage() { - DBG_ASSERT( rxMasterPages.is() && rxDrawPages.is(), - "SVGFilter::implExportDocument: invalid parameter" ); + sal_Int32 nCurPage = 0, nLastPage = mSelectedPages.getLength() - 1; - OUString aAttr; - sal_Int32 nDocWidth = 0, nDocHeight = 0; - sal_Int32 nVisible = -1, nVisibleMaster = -1; - sal_Bool bRet = sal_False; - const sal_Bool bSinglePage = ( rxDrawPages->getCount() == 1 ) || ( SVG_EXPORT_ALLPAGES != nPageToExport ); - const sal_Int32 nFirstPage = ( ( SVG_EXPORT_ALLPAGES == nPageToExport ) ? 0 : nPageToExport ); - sal_Int32 nCurPage = nFirstPage, nLastPage = ( bSinglePage ? nFirstPage : ( rxDrawPages->getCount() - 1 ) ); + while( ( nCurPage <= nLastPage ) && ( -1 == mnVisiblePage ) ) + { + const Reference< XDrawPage > & xDrawPage = mSelectedPages[nCurPage]; + + if( xDrawPage.is() ) + { + Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY ); + + if( xPropSet.is() ) + { + sal_Bool bVisible = sal_False; + + if( !mbPresentation || mbSinglePage || + ( ( xPropSet->getPropertyValue( B2UCONST( "Visible" ) ) >>= bVisible ) && bVisible ) ) + { + mnVisiblePage = nCurPage; + + Reference< XMasterPageTarget > xMasterTarget( xDrawPage, UNO_QUERY ); + if( xMasterTarget.is() ) + { + Reference< XDrawPage > xMasterPage( xMasterTarget->getMasterPage() ); + + for( sal_Int32 nMaster = 0, nMasterCount = mMasterPageTargets.getLength(); + ( nMaster < nMasterCount ) && ( -1 == mnVisibleMasterPage ); + ++nMaster ) + { + const Reference< XDrawPage > & xMasterTestPage = mMasterPageTargets[nMaster]; + + if( xMasterTestPage.is() && xMasterTestPage == xMasterPage ) + mnVisibleMasterPage = nMaster; + } + } + } + } + } + ++nCurPage; + } + + return ( mnVisiblePage != -1 ); +} + +// ----------------------------------------------------------------------------- +sal_Bool SVGFilter::implExportDocument() +{ + OUString aAttr; + sal_Int32 nDocWidth = 0, nDocHeight = 0; + sal_Bool bRet = sal_False; + sal_Int32 nLastPage = mSelectedPages.getLength() - 1; + + mbSinglePage = (nLastPage == 0); + mnVisiblePage = -1; + mnVisibleMasterPage = -1; const Reference< XPropertySet > xDefaultPagePropertySet( mxDefaultPage, UNO_QUERY ); const Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY ); @@ -470,6 +746,10 @@ sal_Bool SVGFilter::implExportDocument( const Reference< XDrawPages >& rxMasterP if( mpSVGExport->IsUseTinyProfile() ) mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "baseProfile", B2UCONST( "tiny" ) ); +// enabling _SVG_WRITE_EXTENTS means that the slide size is not adapted +// to the size of the browser window, moreover the slide is top left aligned +// instead of centered. +#undef _SVG_WRITE_EXTENTS #ifdef _SVG_WRITE_EXTENTS aAttr = OUString::valueOf( nDocWidth * 0.01 ); aAttr += B2UCONST( "mm" ); @@ -485,19 +765,21 @@ sal_Bool SVGFilter::implExportDocument( const Reference< XDrawPages >& rxMasterP aAttr += B2UCONST( " " ); aAttr += OUString::valueOf( nDocHeight ); + msClipPathId = B2UCONST( "presentation_clip_path" ); + OUString sClipPathAttrValue = B2UCONST( "url(#" ) + msClipPathId + B2UCONST( ")" ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "viewBox", aAttr ); mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "preserveAspectRatio", B2UCONST( "xMidYMid" ) ); mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "fill-rule", B2UCONST( "evenodd" ) ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "clip-path", sClipPathAttrValue ); // standard line width is based on 1 pixel on a 90 DPI device (0.28222mmm) mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "stroke-width", OUString::valueOf( 28.222 ) ); mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "stroke-linejoin", B2UCONST( "round" ) ); - if( !bSinglePage ) + if( !mbSinglePage ) { mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xmlns:ooo", B2UCONST( "http://xml.openoffice.org/svg/export" ) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "onclick", B2UCONST( "onClick(evt)" ) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "onkeypress", B2UCONST( "onKeyPress(evt)" ) ); } @@ -508,128 +790,312 @@ sal_Bool SVGFilter::implExportDocument( const Reference< XDrawPages >& rxMasterP mpSVGDoc = new SvXMLElementExport( *mpSVGExport, XML_NAMESPACE_NONE, "svg", sal_True, sal_True ); - while( ( nCurPage <= nLastPage ) && ( -1 == nVisible ) ) + // Create a ClipPath element that will be used for cutting bitmaps and other elements that could exceed the page margins. { - Reference< XDrawPage > xDrawPage; + SvXMLElementExport aDefsElem( *mpSVGExport, XML_NAMESPACE_NONE, "defs", sal_True, sal_True ); + { + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", msClipPathId ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "clipPathUnits", B2UCONST( "userSpaceOnUse" ) ); + SvXMLElementExport aClipPathElem( *mpSVGExport, XML_NAMESPACE_NONE, "clipPath", sal_True, sal_True ); + { + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "x", OUString::valueOf( sal_Int32(0) ) ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "y", OUString::valueOf( sal_Int32(0) ) ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "width", OUString::valueOf( nDocWidth ) ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "height", OUString::valueOf( nDocHeight ) ); + SvXMLElementExport aRectElem( *mpSVGExport, XML_NAMESPACE_NONE, "rect", sal_True, sal_True ); + } + } + } - rxDrawPages->getByIndex( nCurPage ) >>= xDrawPage; + if( implLookForFirstVisiblePage() ) // OK! We found at least one visible page. + { + if( !mbSinglePage ) + { + implGenerateMetaData(); + } + else + { + implGetPagePropSet( mSelectedPages[0] ); + } - if( xDrawPage.is() ) + // Create the (Shape, GDIMetaFile) map + if( implCreateObjects() ) { - Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY ); + ObjectMap::const_iterator aIter( mpObjects->begin() ); + ::std::vector< ObjectRepresentation > aObjects( mpObjects->size() ); + sal_uInt32 nPos = 0; - if( xPropSet.is() ) + while( aIter != mpObjects->end() ) { - sal_Bool bVisible = sal_False; - - if( !mbPresentation || bSinglePage || - ( ( xPropSet->getPropertyValue( B2UCONST( "Visible" ) ) >>= bVisible ) && bVisible ) ) - { - Reference< XMasterPageTarget > xMasterTarget( xDrawPage, UNO_QUERY ); + aObjects[ nPos++ ] = (*aIter).second; + ++aIter; + } - if( xMasterTarget.is() ) - { - Reference< XDrawPage > xMasterPage( xMasterTarget->getMasterPage() ); + mpSVGFontExport = new SVGFontExport( *mpSVGExport, aObjects ); + mpSVGWriter = new SVGActionWriter( *mpSVGExport, *mpSVGFontExport ); - nVisible = nCurPage; - for( sal_Int32 nMaster = 0, nMasterCount = rxMasterPages->getCount(); - ( nMaster < nMasterCount ) && ( -1 == nVisibleMaster ); - ++nMaster ) - { - Reference< XDrawPage > xMasterTestPage; + if( mpSVGExport->IsEmbedFonts() ) + { + mpSVGFontExport->EmbedFonts(); + } - rxMasterPages->getByIndex( nMaster ) >>= xMasterTestPage; + implExportPages( mMasterPageTargets, 0, mMasterPageTargets.getLength() - 1, mnVisibleMasterPage, sal_True /* is a master page */ ); + implExportPages( mSelectedPages, 0, nLastPage, mnVisiblePage, sal_False /* is not a master page */ ); - if( xMasterTestPage == xMasterPage ) - nVisibleMaster = nMaster; - } - } - } + if( !mbSinglePage ) + { + implGenerateScript(); } - } - ++nCurPage; + delete mpSVGDoc, mpSVGDoc = NULL; + bRet = sal_True; + } } - if( mpSVGExport->IsEmbedFonts() ) - { - mpSVGFontExport->EmbedFonts(); - } + return bRet; +} + + +//------------------------------------------------------------------------------ +// Append aField to aFieldSet if it is not already present in the set +// and create the field id sFieldId +// - if( -1 != nVisible ) +template< typename TextFieldType > +OUString implGenerateFieldId( std::vector< TextField* > & aFieldSet, + const TextFieldType & aField, + const OUString & sOOOElemField, + Reference< XDrawPage > xMasterPage ) +{ + sal_Bool bFound = sal_False; + sal_Int32 i; + sal_Int32 nSize = aFieldSet.size(); + for( i = 0; i < nSize; ++i ) { - if( bSinglePage ) - implExportPages( rxMasterPages, nVisibleMaster, nVisibleMaster, nVisibleMaster, sal_True ); - else + if( *(aFieldSet[i]) == aField ) { - implGenerateMetaData( rxMasterPages, rxDrawPages ); - implGenerateScript( rxMasterPages, rxDrawPages ); - implExportPages( rxMasterPages, 0, rxMasterPages->getCount() - 1, nVisibleMaster, sal_True ); + bFound = sal_True; + break; } - - implExportPages( rxDrawPages, nFirstPage, nLastPage, nVisible, sal_False ); - - delete mpSVGDoc, mpSVGDoc = NULL; - bRet = sal_True; } - - return bRet; + OUString sFieldId( sOOOElemField ); + sFieldId += OUString::valueOf( sal_Unicode('_') ); + if( !bFound ) + { + aFieldSet.push_back( new TextFieldType( aField ) ); + } + aFieldSet[i]->insertMasterPage( xMasterPage ); + sFieldId += OUString::valueOf( i ); + return sFieldId; } -// ----------------------------------------------------------------------------- +//------------------------------------------------------------------------------ -sal_Bool SVGFilter::implGenerateMetaData( const Reference< XDrawPages >& /* rxMasterPages */, - const Reference< XDrawPages >& rxDrawPages ) +sal_Bool SVGFilter::implGenerateMetaData() { sal_Bool bRet = sal_False; - - if( rxDrawPages->getCount() ) + sal_Int32 nCount = mSelectedPages.getLength(); + if( nCount != 0 ) { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", B2UCONST( "meta_slides" ) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "numberOfSlides", OUString::valueOf( rxDrawPages->getCount() ) ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", B2UCONST( aOOOElemMetaSlides ) ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrNumberOfSlides, OUString::valueOf( nCount ) ); + + /* + * Add a (global) Page Numbering Type attribute for the document + */ + // NOTE: + // at present pSdrModel->GetPageNumType() returns always SVX_ARABIC + // so the following code fragment is pretty unuseful + sal_Int32 nPageNumberingType = SVX_ARABIC; + SvxDrawPage* pSvxDrawPage = SvxDrawPage::getImplementation( mSelectedPages[0] ); + if( pSvxDrawPage ) + { + SdrPage* pSdrPage = pSvxDrawPage->GetSdrPage(); + SdrModel* pSdrModel = pSdrPage->GetModel(); + nPageNumberingType = pSdrModel->GetPageNumType(); + } + if( nPageNumberingType != SVX_NUMBER_NONE ) + { + OUString sNumberingType; + switch( nPageNumberingType ) + { + case SVX_CHARS_UPPER_LETTER: + sNumberingType = B2UCONST( "alpha-upper" ); + break; + case SVX_CHARS_LOWER_LETTER: + sNumberingType = B2UCONST( "alpha-lower" ); + break; + case SVX_ROMAN_UPPER: + sNumberingType = B2UCONST( "roman-upper" ); + break; + case SVX_ROMAN_LOWER: + sNumberingType = B2UCONST( "roman-lower" ); + break; + // arabic numbering type is the default, so we do not append any attribute for it + case SVX_ARABIC: ; + // in case the numbering type is not handled we fall back on arabic numbering + default: ; + break; + } + if( !sNumberingType.isEmpty() ) + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrNumberingType, sNumberingType ); + } + { - SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "ooo:slidesInfo", sal_True, sal_True ); - const OUString aId( B2UCONST( "meta_slide" ) ); + SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True ); + const OUString aId( B2UCONST( aOOOElemMetaSlide ) ); + const OUString aElemTextFieldId( B2UCONST( aOOOElemTextField ) ); + std::vector< TextField* > aFieldSet; - for( sal_Int32 i = 0, nCount = rxDrawPages->getCount(); i < nCount; ++i ) + for( sal_Int32 i = 0; i < nCount; ++i ) { - OUString aSlideId( aId ); - Reference< XDrawPage > xDrawPage( rxDrawPages->getByIndex( i ), UNO_QUERY ); - Reference< XMasterPageTarget > xMasterPageTarget( xDrawPage, UNO_QUERY ); - Reference< XDrawPage > xMasterPage( xMasterPageTarget->getMasterPage(), UNO_QUERY ); - sal_Bool bMasterVisible = sal_True; - OUString aMasterVisibility; - + const Reference< XDrawPage > & xDrawPage = mSelectedPages[i]; + Reference< XMasterPageTarget > xMasterPageTarget( xDrawPage, UNO_QUERY ); + Reference< XDrawPage > xMasterPage( xMasterPageTarget->getMasterPage(), UNO_QUERY ); + OUString aSlideId( aId ); + aSlideId += OUString::valueOf( sal_Unicode('_') ); aSlideId += OUString::valueOf( i ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", aSlideId ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrSlide, implGetValidIDFromInterface( xDrawPage ) ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrMaster, implGetValidIDFromInterface( xMasterPage ) ); + + if( mbPresentation ) { Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY ); if( xPropSet.is() ) - xPropSet->getPropertyValue( B2UCONST( "Background" ) ) >>= bMasterVisible; + { + sal_Bool bBackgroundVisibility = sal_True; // default: visible + sal_Bool bBackgroundObjectsVisibility = sal_True; // default: visible + sal_Bool bPageNumberVisibility = sal_False; // default: hidden + sal_Bool bDateTimeVisibility = sal_True; // default: visible + sal_Bool bFooterVisibility = sal_True; // default: visible + sal_Bool bHeaderVisibility = sal_True; // default: visible + sal_Bool bDateTimeFixed = sal_True; // default: fixed + + FixedDateTimeField aFixedDateTimeField; + VariableDateTimeField aVariableDateTimeField; + FooterField aFooterField; + + xPropSet->getPropertyValue( B2UCONST( "IsBackgroundVisible" ) ) >>= bBackgroundVisibility; + // in case the attribute is set to its default value it is not appended to the meta-slide element + if( !bBackgroundVisibility ) // visibility default value: 'visible' + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrBackgroundVisibility, B2UCONST( "hidden" ) ); + + // Page Number, Date/Time, Footer and Header Fields are regarded as background objects. + // So bBackgroundObjectsVisibility overrides visibility of master page text fields. + xPropSet->getPropertyValue( B2UCONST( "IsBackgroundObjectsVisible" ) ) >>= bBackgroundObjectsVisibility; + if( bBackgroundObjectsVisibility ) // visibility default value: 'visible' + { + /* + * Page Number Field + */ + xPropSet->getPropertyValue( B2UCONST( "IsPageNumberVisible" ) ) >>= bPageNumberVisibility; + bPageNumberVisibility = bPageNumberVisibility && ( nPageNumberingType != SVX_NUMBER_NONE ); + if( bPageNumberVisibility ) // visibility default value: 'hidden' + { + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrPageNumberVisibility, B2UCONST( "visible" ) ); + } + /* + * Date/Time Field + */ + xPropSet->getPropertyValue( B2UCONST( "IsDateTimeVisible" ) ) >>= bDateTimeVisibility; + if( bDateTimeVisibility ) // visibility default value: 'visible' + { + xPropSet->getPropertyValue( B2UCONST( "IsDateTimeFixed" ) ) >>= bDateTimeFixed; + if( bDateTimeFixed ) // we are interested only in the field text not in the date/time format + { + xPropSet->getPropertyValue( B2UCONST( "DateTimeText" ) ) >>= aFixedDateTimeField.text; + if( !aFixedDateTimeField.text.isEmpty() ) + { + OUString sFieldId = implGenerateFieldId( aFieldSet, aFixedDateTimeField, aElemTextFieldId, xMasterPage ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrDateTimeField, sFieldId ); + } + } + else // the inverse applies: we are interested only in the date/time format not in the field text + { + xPropSet->getPropertyValue( B2UCONST( "DateTimeFormat" ) ) >>= aVariableDateTimeField.format; + OUString sFieldId = implGenerateFieldId( aFieldSet, aVariableDateTimeField, aElemTextFieldId, xMasterPage ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrDateTimeField, sFieldId ); + } + } + else + { + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrDateTimeVisibility, B2UCONST( "hidden" ) ); + } + /* + * Footer Field + */ + xPropSet->getPropertyValue( B2UCONST( "IsFooterVisible" ) ) >>= bFooterVisibility; + if( bFooterVisibility ) // visibility default value: 'visible' + { + xPropSet->getPropertyValue( B2UCONST( "FooterText" ) ) >>= aFooterField.text; + if( !aFooterField.text.isEmpty() ) + { + OUString sFieldId = implGenerateFieldId( aFieldSet, aFooterField, aElemTextFieldId, xMasterPage ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrFooterField, sFieldId ); + } + } + else + { + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrFooterVisibility, B2UCONST( "hidden" ) ); + } + } + else + { + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrMasterObjectsVisibility, B2UCONST( "hidden" ) ); + } + if( i == mnVisiblePage ) + { + mVisiblePagePropSet.bIsBackgroundVisible = bBackgroundVisibility; + mVisiblePagePropSet.bAreBackgroundObjectsVisible = bBackgroundObjectsVisibility; + mVisiblePagePropSet.bIsPageNumberFieldVisible = bPageNumberVisibility; + mVisiblePagePropSet.bIsDateTimeFieldVisible = bDateTimeVisibility; + mVisiblePagePropSet.bIsFooterFieldVisible = bFooterVisibility; + mVisiblePagePropSet.bIsHeaderFieldVisible = bHeaderVisibility; + mVisiblePagePropSet.nPageNumberingType = nPageNumberingType; + mVisiblePagePropSet.bIsDateTimeFieldFixed = bDateTimeFixed; + mVisiblePagePropSet.nDateTimeFormat = aVariableDateTimeField.format; + mVisiblePagePropSet.sDateTimeText = aFixedDateTimeField.text; + mVisiblePagePropSet.sFooterText = aFooterField.text; + } + } } - if( bMasterVisible ) - aMasterVisibility = B2UCONST( "visible" ); - else - aMasterVisibility = B2UCONST( "hidden" ); + { + SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True ); + } // when the aExp2 destructor is called the </g> tag is appended to the output file + } - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", aSlideId ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "slide", implGetValidIDFromInterface( xDrawPage ) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "master", implGetValidIDFromInterface( xMasterPage ) ); - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "master-visibility", aMasterVisibility ); + // export text field elements + if( mbPresentation ) + { + for( sal_Int32 i = 0, nSize = aFieldSet.size(); i < nSize; ++i ) + { + OUString sElemId = B2UCONST( aOOOElemTextField ); + sElemId += OUString::valueOf( sal_Unicode('_') ); + sElemId += OUString::valueOf( i ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", sElemId ); + aFieldSet[i]->elementExport( mpSVGExport ); + + aFieldSet[i]->growCharSet( mTextFieldCharSets ); + } + } + // text fields are used only for generating meta info so we don't need them anymore + for( sal_uInt32 i = 0; i < aFieldSet.size(); ++i ) + { + if( aFieldSet[i] != NULL ) { - SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "ooo:slideInfo", sal_True, sal_True ); + delete aFieldSet[i]; } } } - - - bRet =sal_True; + bRet = sal_True; } return bRet; @@ -637,19 +1103,20 @@ sal_Bool SVGFilter::implGenerateMetaData( const Reference< XDrawPages >& /* rxMa // ----------------------------------------------------------------------------- -sal_Bool SVGFilter::implGenerateScript( const Reference< XDrawPages >& /* rxMasterPages */, - const Reference< XDrawPages >& /* rxDrawPages */ ) +#define SVGFILTER_EXPORT_SVGSCRIPT( z, n, aFragment ) \ + xExtDocHandler->unknown( OUString::createFromAscii( aFragment ## n ) ); + +sal_Bool SVGFilter::implGenerateScript() { mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "type", B2UCONST( "text/ecmascript" ) ); { - SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "script", sal_True, sal_True ); - Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY ); + SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "script", sal_True, sal_True ); + Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY ); if( xExtDocHandler.is() ) { - xExtDocHandler->unknown( OUString::createFromAscii( aSVGScript1 ) ); - xExtDocHandler->unknown( OUString::createFromAscii( aSVGScript2 ) ); + BOOST_PP_REPEAT( N_SVGSCRIPT_FRAGMENTS, SVGFILTER_EXPORT_SVGSCRIPT, aSVGScript ) } } @@ -658,7 +1125,86 @@ sal_Bool SVGFilter::implGenerateScript( const Reference< XDrawPages >& /* rxMast // ----------------------------------------------------------------------------- -sal_Bool SVGFilter::implExportPages( const Reference< XDrawPages >& rxPages, +Any SVGFilter::implSafeGetPagePropSet( const OUString & sPropertyName, + const Reference< XPropertySet > & rxPropSet, + const Reference< XPropertySetInfo > & rxPropSetInfo ) +{ + Any result; + if( rxPropSetInfo->hasPropertyByName( sPropertyName ) ) + { + result = rxPropSet->getPropertyValue( sPropertyName ); + } + return result; +} + +// ----------------------------------------------------------------------------- + +/* SVGFilter::implGetPagePropSet + * + * We collect info on master page elements visibility, + * and placeholder text shape content. + * This method is used when exporting a single page + * as implGenerateMetaData is not invoked. + */ +sal_Bool SVGFilter::implGetPagePropSet( const Reference< XDrawPage > & rxPage ) +{ + sal_Bool bRet = sal_False; + + mVisiblePagePropSet.bIsBackgroundVisible = true; + mVisiblePagePropSet.bAreBackgroundObjectsVisible = true; + mVisiblePagePropSet.bIsPageNumberFieldVisible = false;; + mVisiblePagePropSet.bIsHeaderFieldVisible = false; + mVisiblePagePropSet.bIsFooterFieldVisible = true; + mVisiblePagePropSet.bIsDateTimeFieldVisible = true; + mVisiblePagePropSet.bIsDateTimeFieldFixed = true; + mVisiblePagePropSet.nDateTimeFormat = SVXDATEFORMAT_B; + mVisiblePagePropSet.nPageNumberingType = SVX_ARABIC; + + /* We collect info on master page elements visibility, + * and placeholder text shape content. + */ + Any result; + Reference< XPropertySet > xPropSet( rxPage, UNO_QUERY ); + if( xPropSet.is() ) + { + Reference< XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() ); + if( xPropSetInfo.is() ) + { + implSafeGetPagePropSet( B2UCONST( "IsBackgroundVisible" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.bIsBackgroundVisible; + implSafeGetPagePropSet( B2UCONST( "IsBackgroundObjectsVisible" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.bAreBackgroundObjectsVisible; + implSafeGetPagePropSet( B2UCONST( "IsPageNumberVisible" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.bIsPageNumberFieldVisible; + implSafeGetPagePropSet( B2UCONST( "IsHeaderVisible" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.bIsHeaderFieldVisible; + implSafeGetPagePropSet( B2UCONST( "IsFooterVisible" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.bIsFooterFieldVisible; + implSafeGetPagePropSet( B2UCONST( "IsDateTimeVisible" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.bIsDateTimeFieldVisible; + + implSafeGetPagePropSet( B2UCONST( "IsDateTimeFixed" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.bIsDateTimeFieldFixed; + implSafeGetPagePropSet( B2UCONST( "DateTimeFormat" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.nDateTimeFormat; + implSafeGetPagePropSet( B2UCONST( "Number" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.nPageNumber; + implSafeGetPagePropSet( B2UCONST( "DateTimeText" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.sDateTimeText; + implSafeGetPagePropSet( B2UCONST( "FooterText" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.sFooterText; + implSafeGetPagePropSet( B2UCONST( "HeaderText" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.sHeaderText; + + if( mVisiblePagePropSet.bIsPageNumberFieldVisible ) + { + SvxDrawPage* pSvxDrawPage = SvxDrawPage::getImplementation( rxPage ); + if( pSvxDrawPage ) + { + SdrPage* pSdrPage = pSvxDrawPage->GetSdrPage(); + SdrModel* pSdrModel = pSdrPage->GetModel(); + mVisiblePagePropSet.nPageNumberingType = pSdrModel->GetPageNumType(); + } + } + + bRet = sal_True; + } + } + + return bRet; +} + +// ----------------------------------------------------------------------------- + +sal_Bool SVGFilter::implExportPages( const SVGFilter::XDrawPageSequence & rxPages, sal_Int32 nFirstPage, sal_Int32 nLastPage, sal_Int32 nVisiblePage, sal_Bool bMaster ) { @@ -669,36 +1215,15 @@ sal_Bool SVGFilter::implExportPages( const Reference< XDrawPages >& rxPages, for( sal_Int32 i = nFirstPage; i <= nLastPage; ++i ) { - Reference< XDrawPage > xDrawPage; - - rxPages->getByIndex( i ) >>= xDrawPage; - - if( xDrawPage.is() ) + if( rxPages[i].is() ) { - Reference< XShapes > xShapes( xDrawPage, UNO_QUERY ); + Reference< XShapes > xShapes( rxPages[i], UNO_QUERY ); if( xShapes.is() ) { - OUString aVisibility, aId, aSlideName( implGetValidIDFromInterface( xShapes, sal_True ) ); - - // add visibility attribute - if( i == nVisiblePage ) - aVisibility = B2UCONST( "visible" ); - else - aVisibility = B2UCONST( "hidden" ); - - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", aVisibility ); - // add id attribute - if( bMaster ) - aId = ( B2UCONST( "MasterSlide_" ) ) += ::rtl::OUString::valueOf( ++mnMasterSlideId ); - else - aId = ( B2UCONST( "Slide_" ) ) += ::rtl::OUString::valueOf( ++mnSlideId ); - - if( aSlideName.getLength() ) - ( ( aId += B2UCONST( "(" ) ) += aSlideName ) += B2UCONST( ")" ); - - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", aId ); + OUString sPageId = implGetValidIDFromInterface( xShapes ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", sPageId ); { { @@ -717,17 +1242,99 @@ sal_Bool SVGFilter::implExportPages( const Reference< XDrawPages >& rxPages, } } + // We don't set a visibility attribute for a master page element + // as the visibility of each master page sub element (background, + // placeholder shapes, background objects) is managed separately. + OUString aAttrVisibilityValue; + if( !bMaster ) + { + if( i == nVisiblePage ) + aAttrVisibilityValue = B2UCONST( "visible" ); + else + aAttrVisibilityValue = B2UCONST( "hidden" ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", aAttrVisibilityValue ); + } + else + { // when we export the shapes of a master page (implExportShape) we need + // to know if it is the master page targeted by the initially visible slide + mbIsPageVisible = ( i == nVisiblePage ); + } + + // Adding a clip path to each exported slide and master page, + // so in case bitmaps or other elements exceed the slide margins + // they are trimmed, even when they are shown inside a thumbnail view. + OUString sClipPathAttrValue = B2UCONST( "url(#" ) + msClipPathId + B2UCONST( ")" ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "clip-path", sClipPathAttrValue ); + + // insert the <g> open tag related to the Slide/Master_Slide SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True ); - const Point aNullPt; - if( bMaster ) + // In case the page has a background object we append it . + if( (mpObjects->find( rxPages[i] ) != mpObjects->end()) ) { - const GDIMetaFile& rMtf = (*mpObjects)[ xDrawPage ].GetRepresentation(); - mpSVGWriter->WriteMetaFile( aNullPt, rMtf.GetPrefSize(), rMtf, SVGWRITER_WRITE_FILL ); + const GDIMetaFile& rMtf = (*mpObjects)[ rxPages[i] ].GetRepresentation(); + if( rMtf.GetActionSize() ) + { + // background id = "bg-" + page id + OUString sBackgroundId = B2UCONST( "bg-" ); + sBackgroundId += sPageId; + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", sBackgroundId ); + + // At present (LibreOffice 3.4.0) the 'IsBackgroundVisible' property is not handled + // by Impress; anyway we handle this property as referring only to the visibility + // of the master page background. So if a slide has its own background object, + // the visibility of such a background object is always inherited from the visibility + // of the parent slide regardless of the value of the 'IsBackgroundVisible' property. + // This means that we need to set up the visibility attribute only for the background + // element of a master page. + if( bMaster ) + { + if( i == nVisiblePage && mVisiblePagePropSet.bIsBackgroundVisible ) + aAttrVisibilityValue = B2UCONST( "visible" ); + else + aAttrVisibilityValue = B2UCONST( "hidden" ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", aAttrVisibilityValue ); + } + + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", B2UCONST( "Background" ) ); + + // insert the <g> open tag related to the Background + SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True ); + + // append all elements that make up the Background + const Point aNullPt; + mpSVGWriter->WriteMetaFile( aNullPt, rMtf.GetPrefSize(), rMtf, SVGWRITER_WRITE_FILL ); + } // insert the </g> closing tag related to the Background } - bRet = implExportShapes( xShapes ) || bRet; - } + // In case we are dealing with a master page we need to to group all its shapes + // into a group element, this group will make up the so named "background objects" + if( bMaster ) + { + // background objects id = "bo-" + page id + OUString sBackgroundObjectsId = B2UCONST( "bo-" ); + sBackgroundObjectsId += sPageId; + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", sBackgroundObjectsId ); + + if( i == nVisiblePage && mVisiblePagePropSet.bAreBackgroundObjectsVisible ) + aAttrVisibilityValue = B2UCONST( "visible" ); + else + aAttrVisibilityValue = B2UCONST( "hidden" ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", aAttrVisibilityValue ); + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", B2UCONST( "BackgroundObjects" ) ); + + // insert the <g> open tag related to the Background Objects + SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True ); + + // append all shapes that make up the Master Slide + bRet = implExportShapes( xShapes ) || bRet; + } // append the </g> closing tag related to the Background Objects + else + { + // append all shapes that make up the Slide + bRet = implExportShapes( xShapes ) || bRet; + } + } // append the </g> closing tag related to the Slide/Master_Slide } } } @@ -768,52 +1375,6 @@ sal_Bool SVGFilter::implExportShape( const Reference< XShape >& rxShape ) if( mbPresentation ) { xShapePropSet->getPropertyValue( B2UCONST( "IsEmptyPresentationObject" ) ) >>= bHideObj; - - if( !bHideObj ) - { - const Reference< XPropertySet > xDefaultPagePropertySet( mxDefaultPage, UNO_QUERY ); - Reference< XPropertySetInfo > xPagePropSetInfo( xDefaultPagePropertySet->getPropertySetInfo() ); - - if( xPagePropSetInfo.is() ) - { - const ::rtl::OUString aHeaderString( B2UCONST( "IsHeaderVisible" ) ); - const ::rtl::OUString aFooterString( B2UCONST( "IsFooterVisible" ) ); - const ::rtl::OUString aDateTimeString( B2UCONST( "IsDateTimeVisible" ) ); - const ::rtl::OUString aPageNumberString( B2UCONST( "IsPageNumberVisible" ) ); - - Any aProperty; - sal_Bool bValue = sal_False; - - if( ( aShapeType.lastIndexOf( B2UCONST( "presentation.HeaderShape" ) ) != -1 ) && - xPagePropSetInfo->hasPropertyByName( aHeaderString ) && - ( ( aProperty = xDefaultPagePropertySet->getPropertyValue( aHeaderString ) ) >>= bValue ) && - !bValue ) - { - bHideObj = sal_True; - } - else if( ( aShapeType.lastIndexOf( B2UCONST( "presentation.FooterShape" ) ) != -1 ) && - xPagePropSetInfo->hasPropertyByName( aFooterString ) && - ( ( aProperty = xDefaultPagePropertySet->getPropertyValue( aFooterString ) ) >>= bValue ) && - !bValue ) - { - bHideObj = sal_True; - } - else if( ( aShapeType.lastIndexOf( B2UCONST( "presentation.DateTimeShape" ) ) != -1 ) && - xPagePropSetInfo->hasPropertyByName( aDateTimeString ) && - ( ( aProperty = xDefaultPagePropertySet->getPropertyValue( aDateTimeString ) ) >>= bValue ) && - !bValue ) - { - bHideObj = sal_True; - } - else if( ( aShapeType.lastIndexOf( B2UCONST( "presentation.SlideNumberShape" ) ) != -1 ) && - xPagePropSetInfo->hasPropertyByName( aPageNumberString ) && - ( ( aProperty = xDefaultPagePropertySet->getPropertyValue( aPageNumberString ) ) >>= bValue ) && - !bValue ) - { - bHideObj = sal_True; - } - } - } } if( !bHideObj ) @@ -833,7 +1394,8 @@ sal_Bool SVGFilter::implExportShape( const Reference< XShape >& rxShape ) if( !bRet && mpObjects->find( rxShape ) != mpObjects->end() ) { - Reference< XText > xText( rxShape, UNO_QUERY ); + const ::rtl::OUString* pElementId = NULL; + ::com::sun::star::awt::Rectangle aBoundRect; const GDIMetaFile& rMtf = (*mpObjects)[ rxShape ].GetRepresentation(); @@ -843,8 +1405,57 @@ sal_Bool SVGFilter::implExportShape( const Reference< XShape >& rxShape ) const Size aSize( aBoundRect.Width, aBoundRect.Height ); if( rMtf.GetActionSize() ) - { - mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", implGetClassFromShape( rxShape ) ); + { // for text field shapes we set up visibility and text-adjust attributes + // TODO should we set up visibility for all text field shapes to hidden at start ? + OUString aShapeClass = implGetClassFromShape( rxShape ); + if( mbPresentation ) + { + sal_Bool bIsPageNumber = aShapeClass.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Slide_Number" ) ); + sal_Bool bIsFooter = aShapeClass.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Footer" ) ); + sal_Bool bIsDateTime = aShapeClass.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Date/Time" ) ); + if( bIsPageNumber || bIsDateTime || bIsFooter ) + { + // to notify to the SVGActionWriter::ImplWriteActions method + // that we are dealing with a placeholder shape + pElementId = &sPlaceholderTag; + + // if the text field does not belong to the visible page its svg:visibility + // attribute is set to 'hidden'; else it depends on the related property of the visible page + OUString aAttrVisibilityValue( B2UCONST( "hidden" ) ); + if(mbIsPageVisible && mVisiblePagePropSet.bAreBackgroundObjectsVisible && ( + ( bIsPageNumber && mVisiblePagePropSet.bIsPageNumberFieldVisible ) || + ( bIsDateTime && mVisiblePagePropSet.bIsDateTimeFieldVisible ) || + ( bIsFooter && mVisiblePagePropSet.bIsFooterFieldVisible ) ) ) + { + aAttrVisibilityValue = B2UCONST( "visible" ); + } + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", aAttrVisibilityValue ); + + if( !mbSinglePage ) + { + sal_uInt16 nTextAdjust = ParagraphAdjust_LEFT; + OUString sTextAdjust; + xShapePropSet->getPropertyValue( B2UCONST( "ParaAdjust" ) ) >>= nTextAdjust; + + switch( nTextAdjust ) + { + case ParagraphAdjust_LEFT: + sTextAdjust = B2UCONST( "left" ); + break; + case ParagraphAdjust_CENTER: + sTextAdjust = B2UCONST( "center" ); + break; + case ParagraphAdjust_RIGHT: + sTextAdjust = B2UCONST( "right" ); + break; + default: + break; + } + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrTextAdjust, sTextAdjust ); + } + } + } + mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", aShapeClass ); SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True ); OUString aId( B2UCONST( "DrawingGroup_" ) ); OUString aObjName( implGetValidIDFromInterface( rxShape, true ) ), aObjDesc; @@ -872,7 +1483,7 @@ sal_Bool SVGFilter::implExportShape( const Reference< XShape >& rxShape ) { SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True ); - mpSVGWriter->WriteMetaFile( aTopLeft, aSize, rMtf, SVGWRITER_WRITE_ALL); + mpSVGWriter->WriteMetaFile( aTopLeft, aSize, rMtf, SVGWRITER_WRITE_ALL, pElementId ); } } @@ -886,81 +1497,60 @@ sal_Bool SVGFilter::implExportShape( const Reference< XShape >& rxShape ) // ----------------------------------------------------------------------------- -sal_Bool SVGFilter::implCreateObjects( const Reference< XDrawPages >& rxMasterPages, - const Reference< XDrawPages >& rxDrawPages, - sal_Int32 nPageToExport ) +sal_Bool SVGFilter::implCreateObjects() { - if( SVG_EXPORT_ALLPAGES == nPageToExport ) - { - sal_Int32 i, nCount; - - for( i = 0, nCount = rxMasterPages->getCount(); i < nCount; ++i ) - { - Reference< XDrawPage > xMasterPage; - - rxMasterPages->getByIndex( i ) >>= xMasterPage; - - if( xMasterPage.is() ) - { - Reference< XShapes > xShapes( xMasterPage, UNO_QUERY ); + sal_Int32 i, nCount; - implCreateObjectsFromBackground( xMasterPage ); - - if( xShapes.is() ) - implCreateObjectsFromShapes( xShapes ); - } - } + for( i = 0, nCount = mMasterPageTargets.getLength(); i < nCount; ++i ) + { + const Reference< XDrawPage > & xMasterPage = mMasterPageTargets[i]; - for( i = 0, nCount = rxDrawPages->getCount(); i < nCount; ++i ) + if( xMasterPage.is() ) { - Reference< XDrawPage > xDrawPage; - - rxDrawPages->getByIndex( i ) >>= xDrawPage; + mCreateOjectsCurrentMasterPage = xMasterPage; + implCreateObjectsFromBackground( xMasterPage ); - if( xDrawPage.is() ) - { - Reference< XShapes > xShapes( xDrawPage, UNO_QUERY ); + Reference< XShapes > xShapes( xMasterPage, UNO_QUERY ); - if( xShapes.is() ) - implCreateObjectsFromShapes( xShapes ); - } + if( xShapes.is() ) + implCreateObjectsFromShapes( xShapes ); } } - else - { - DBG_ASSERT( nPageToExport >= 0 && nPageToExport < rxDrawPages->getCount(), - "SVGFilter::implCreateObjects: invalid page number to export" ); - - Reference< XDrawPage > xDrawPage; - rxDrawPages->getByIndex( nPageToExport ) >>= xDrawPage; - - if( xDrawPage.is() ) - { - Reference< XMasterPageTarget > xMasterTarget( xDrawPage, UNO_QUERY ); + for( i = 0, nCount = mSelectedPages.getLength(); i < nCount; ++i ) + { + const Reference< XDrawPage > & xDrawPage = mSelectedPages[i]; - if( xMasterTarget.is() ) + if( xDrawPage.is() ) + { +#if ENABLE_EXPORT_CUSTOM_SLIDE_BACKGROUND + // TODO complete the implementation for exporting custom background for each slide + // implementation status: + // - hatch stroke color is set to 'none' so the hatch is not visible, why ? + // - gradient look is not really awesome, too few colors are used; + // - stretched bitmap, gradient and hatch are not exported only once + // and then referenced in case more than one slide uses them. + // - tiled bitmap: an image element is exported for each tile, + // this is really too expensive! + Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY ); + Reference< XPropertySet > xBackground; + xPropSet->getPropertyValue( B2UCONST( "Background" ) ) >>= xBackground; + if( xBackground.is() ) { - Reference< XDrawPage > xMasterPage( xMasterTarget->getMasterPage() ); - - if( xMasterPage.is() ) + drawing::FillStyle aFillStyle; + sal_Bool assigned = ( xBackground->getPropertyValue( B2UCONST( "FillStyle" ) ) >>= aFillStyle ); + if( assigned && aFillStyle != drawing::FillStyle_NONE ) { - Reference< XShapes > xShapes( xMasterPage, UNO_QUERY ); - - implCreateObjectsFromBackground( xMasterPage ); - - if( xShapes.is() ) - implCreateObjectsFromShapes( xShapes ); + implCreateObjectsFromBackground( xDrawPage ); } } - +#endif Reference< XShapes > xShapes( xDrawPage, UNO_QUERY ); - if( xShapes.is() ) - implCreateObjectsFromShapes( xShapes ); - } + if( xShapes.is() ) + implCreateObjectsFromShapes( xShapes ); + } } - return sal_True; } @@ -987,7 +1577,6 @@ sal_Bool SVGFilter::implCreateObjectsFromShapes( const Reference< XShapes >& rxS sal_Bool SVGFilter::implCreateObjectsFromShape( const Reference< XShape >& rxShape ) { sal_Bool bRet = sal_False; - if( rxShape->getShapeType().lastIndexOf( B2UCONST( "drawing.GroupShape" ) ) != -1 ) { Reference< XShapes > xShapes( rxShape, UNO_QUERY ); @@ -1007,9 +1596,9 @@ sal_Bool SVGFilter::implCreateObjectsFromShape( const Reference< XShape >& rxSha { if( aGraphic.GetType() == GRAPHIC_BITMAP ) { - GDIMetaFile aMtf; - const Point aNullPt; - const Size aSize( pObj->GetCurrentBoundRect().GetSize() ); + GDIMetaFile aMtf; + const Point aNullPt; + const Size aSize( pObj->GetCurrentBoundRect().GetSize() ); aMtf.AddAction( new MetaBmpExScaleAction( aNullPt, aSize, aGraphic.GetBitmapEx() ) ); aMtf.SetPrefSize( aSize ); @@ -1030,14 +1619,14 @@ sal_Bool SVGFilter::implCreateObjectsFromShape( const Reference< XShape >& rxSha // ----------------------------------------------------------------------------- -sal_Bool SVGFilter::implCreateObjectsFromBackground( const Reference< XDrawPage >& rxMasterPage ) +sal_Bool SVGFilter::implCreateObjectsFromBackground( const Reference< XDrawPage >& rxDrawPage ) { - Reference< XExporter > xExporter( mxMSF->createInstance( B2UCONST( "com.sun.star.drawing.GraphicExportFilter" ) ), UNO_QUERY ); + Reference< XExporter > xExporter( mxMSF->createInstance( B2UCONST( "com.sun.star.drawing.GraphicExportFilter" ) ), UNO_QUERY ); sal_Bool bRet = sal_False; if( xExporter.is() ) { - GDIMetaFile aMtf; + GDIMetaFile aMtf; Reference< XFilter > xFilter( xExporter, UNO_QUERY ); utl::TempFile aFile; @@ -1051,11 +1640,11 @@ sal_Bool SVGFilter::implCreateObjectsFromBackground( const Reference< XDrawPage aDescriptor[2].Name = B2UCONST( "ExportOnlyBackground" ); aDescriptor[2].Value <<= (sal_Bool) sal_True; - xExporter->setSourceDocument( Reference< XComponent >( rxMasterPage, UNO_QUERY ) ); + xExporter->setSourceDocument( Reference< XComponent >( rxDrawPage, UNO_QUERY ) ); xFilter->filter( aDescriptor ); aMtf.Read( *aFile.GetStream( STREAM_READ ) ); - (*mpObjects)[ rxMasterPage ] = ObjectRepresentation( rxMasterPage, aMtf ); + (*mpObjects)[ rxDrawPage ] = ObjectRepresentation( rxDrawPage, aMtf ); bRet = sal_True; } @@ -1085,7 +1674,8 @@ OUString SVGFilter::implGetClassFromShape( const Reference< XShape >& rxShape ) else if( aShapeType.lastIndexOf( B2UCONST( "presentation.SlideNumberShape" ) ) != -1 ) aRet = B2UCONST( "Slide_Number" ); else - aRet = B2UCONST( "Drawing" ); + aRet = aShapeType; + //aRet = B2UCONST( "Drawing" ); return aRet; } @@ -1125,87 +1715,219 @@ OUString SVGFilter::implGetValidIDFromInterface( const Reference< XInterface >& IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo ) { - OUString aRepresentation; sal_Bool bFieldProcessed = sal_False; - - if( pInfo ) + if( pInfo && mbPresentation ) { - const ::rtl::OUString aHeaderText( B2UCONST( "HeaderText" ) ); - const ::rtl::OUString aFooterText( B2UCONST( "FooterText" ) ); - const ::rtl::OUString aDateTimeText( B2UCONST( "DateTimeText" ) ); - const ::rtl::OUString aPageNumberText( B2UCONST( "Number" ) ); - - const Reference< XPropertySet > xDefaultPagePropertySet( mxDefaultPage, UNO_QUERY ); - Reference< XPropertySetInfo > xDefaultPagePropSetInfo( xDefaultPagePropertySet->getPropertySetInfo() ); + bFieldProcessed = true; + // to notify to the SVGActionWriter::ImplWriteText method + // that we are dealing with a placeholder shape + OUString aRepresentation = sPlaceholderTag; - if( xDefaultPagePropSetInfo.is() ) + if( !mbSinglePage ) { - const SvxFieldData* pField = pInfo->GetField().GetField(); - Any aProperty; - - if( pField->ISA( SvxHeaderField ) && - xDefaultPagePropSetInfo->hasPropertyByName( aHeaderText ) ) + if( !mCreateOjectsCurrentMasterPage.is() ) + { + OSL_FAIL( "error: !mCreateOjectsCurrentMasterPage.is()" ); + return 0; + } + if( mTextFieldCharSets.find( mCreateOjectsCurrentMasterPage ) == mTextFieldCharSets.end() ) { - xDefaultPagePropertySet->getPropertyValue( aHeaderText ) >>= aRepresentation; - bFieldProcessed = sal_True; + OSL_FAIL( "error: mTextFieldCharSets.find( mCreateOjectsCurrentMasterPage ) == mTextFieldCharSets.end()" ); + return 0; } - else if( pField->ISA( SvxFooterField ) && - xDefaultPagePropSetInfo->hasPropertyByName( aFooterText ) ) + + static const ::rtl::OUString aHeaderId( B2UCONST( aOOOAttrHeaderField ) ); + static const ::rtl::OUString aFooterId( B2UCONST( aOOOAttrFooterField ) ); + static const ::rtl::OUString aDateTimeId( B2UCONST( aOOOAttrDateTimeField ) ); + static const ::rtl::OUString aVariableDateTimeId( B2UCONST( aOOOAttrDateTimeField ) + B2UCONST( "-variable" ) ); + + const UCharSet * pCharSet = NULL; + UCharSetMap & aCharSetMap = mTextFieldCharSets[ mCreateOjectsCurrentMasterPage ]; + const SvxFieldData* pField = pInfo->GetField().GetField(); + if( ( pField->GetClassId() == SVX_HEADERFIELD ) && ( aCharSetMap.find( aHeaderId ) != aCharSetMap.end() ) ) { - xDefaultPagePropertySet->getPropertyValue( aFooterText ) >>= aRepresentation; - bFieldProcessed = sal_True; + pCharSet = &( aCharSetMap[ aHeaderId ] ); } - else if( pField->ISA( SvxDateTimeField ) && - xDefaultPagePropSetInfo->hasPropertyByName( aDateTimeText ) ) + else if( ( pField->GetClassId() == SVX_FOOTERFIELD ) && ( aCharSetMap.find( aFooterId ) != aCharSetMap.end() ) ) { - xDefaultPagePropertySet->getPropertyValue( aDateTimeText ) >>= aRepresentation; - bFieldProcessed = sal_True; + pCharSet = &( aCharSetMap[ aFooterId ] ); } - else if( pField->ISA( SvxPageField ) && - xDefaultPagePropSetInfo->hasPropertyByName( aPageNumberText ) ) + else if( pField->GetClassId() == SVX_DATEFIMEFIELD ) { - String aPageNumValue; - sal_Int16 nPageNumber = 0; - - xDefaultPagePropertySet->getPropertyValue( aPageNumberText ) >>= nPageNumber; + if( aCharSetMap.find( aDateTimeId ) != aCharSetMap.end() ) + { + pCharSet = &( aCharSetMap[ aDateTimeId ] ); + } + if( ( aCharSetMap.find( aVariableDateTimeId ) != aCharSetMap.end() ) && !aCharSetMap[ aVariableDateTimeId ].empty() ) + { + SvxDateFormat eDateFormat = SVXDATEFORMAT_B, eCurDateFormat; + const UCharSet & aCharSet = aCharSetMap[ aVariableDateTimeId ]; + UCharSet::const_iterator aChar = aCharSet.begin(); + // we look for the most verbose date format + for( ; aChar != aCharSet.end(); ++aChar ) + { + eCurDateFormat = (SvxDateFormat)( (int)( *aChar ) & 0x0f ); + switch( eDateFormat ) + { + case SVXDATEFORMAT_STDSMALL: ; + case SVXDATEFORMAT_A: ; // 13.02.96 + case SVXDATEFORMAT_B: // 13.02.1996 + switch( eCurDateFormat ) + { + case SVXDATEFORMAT_C: ; // 13.Feb 1996 + case SVXDATEFORMAT_D: // 13.February 1996 + case SVXDATEFORMAT_E: ; // Tue, 13.February 1996 + case SVXDATEFORMAT_STDBIG: ; + case SVXDATEFORMAT_F: // Tuesday, 13.February 1996 + eDateFormat = eCurDateFormat; + break; + default: + break; + } + case SVXDATEFORMAT_C: ; // 13.Feb 1996 + case SVXDATEFORMAT_D: // 13.February 1996 + switch( eCurDateFormat ) + { + case SVXDATEFORMAT_E: ; // Tue, 13.February 1996 + case SVXDATEFORMAT_STDBIG: ; + case SVXDATEFORMAT_F: // Tuesday, 13.February 1996 + eDateFormat = eCurDateFormat; + break; + default: + break; + } + break; + default: + break; + } + } + // Independently of the date format, we always put all these characters by default. + // They should be enough to cover every time format. + aRepresentation += B2UCONST( "0123456789.:/-APM" ); - if( mpSdrModel ) + if( eDateFormat ) + { + String sDate; + LanguageType eLang = pInfo->GetOutliner()->GetLanguage( pInfo->GetPara(), pInfo->GetPos() ); + SvNumberFormatter * pNumberFormatter = new SvNumberFormatter( ::comphelper::getProcessServiceFactory(), LANGUAGE_SYSTEM ); + // We always collect the characters obtained by using the SVXDATEFORMAT_B (as: 13.02.1996) + // so we are sure to include any unusual day|month|year separator. + Date aDate( 1, 1, 1996 ); + sDate += SvxDateField::GetFormatted( aDate, SVXDATEFORMAT_B, *pNumberFormatter, eLang ); + switch( eDateFormat ) + { + case SVXDATEFORMAT_E: ; // Tue, 13.February 1996 + case SVXDATEFORMAT_STDBIG: ; + case SVXDATEFORMAT_F: // Tuesday, 13.February 1996 + for( sal_uInt16 i = 1; i <= 7; ++i ) // we get all days in a week + { + aDate.SetDay( i ); + sDate += SvxDateField::GetFormatted( aDate, eDateFormat, *pNumberFormatter, eLang ); + } + // No break here! We need months too! + case SVXDATEFORMAT_C: ; // 13.Feb 1996 + case SVXDATEFORMAT_D: // 13.February 1996 + for( sal_uInt16 i = 1; i <= 12; ++i ) // we get all months in a year + { + aDate.SetMonth( i ); + sDate += SvxDateField::GetFormatted( aDate, eDateFormat, *pNumberFormatter, eLang ); + } + break; + case SVXDATEFORMAT_STDSMALL: ; + case SVXDATEFORMAT_A: ; // 13.02.96 + case SVXDATEFORMAT_B: ; // 13.02.1996 + default: + // nothing to do here, we always collect the characters needed for these cases. + break; + } + aRepresentation += sDate; + } + } + } + else if( pField->GetClassId() == SVX_PAGEFIELD ) + { + switch( mVisiblePagePropSet.nPageNumberingType ) { - sal_Bool bUpper = sal_False; + case SVX_CHARS_UPPER_LETTER: + aRepresentation += B2UCONST( "QWERTYUIOPASDFGHJKLZXCVBNM" ); + break; + case SVX_CHARS_LOWER_LETTER: + aRepresentation += B2UCONST( "qwertyuiopasdfghjklzxcvbnm" ); + break; + case SVX_ROMAN_UPPER: + aRepresentation += B2UCONST( "IVXLCDM" ); + break; + case SVX_ROMAN_LOWER: + aRepresentation += B2UCONST( "ivxlcdm" ); + break; + // arabic numbering type is the default + case SVX_ARABIC: ; + // in case the numbering type is not handled we fall back on arabic numbering + default: + aRepresentation += B2UCONST( "0123456789" ); + break; + } + } - switch( mpSdrModel->GetPageNumType() ) + if( pCharSet != NULL ) + { + UCharSet::const_iterator aChar = pCharSet->begin(); + for( ; aChar != pCharSet->end(); ++aChar ) + { + aRepresentation += OUString::valueOf( *aChar ); + } + } + pInfo->SetRepresentation( aRepresentation ); + } + else + { + if( mVisiblePagePropSet.bAreBackgroundObjectsVisible ) + { + const SvxFieldData* pField = pInfo->GetField().GetField(); + if( ( pField->GetClassId() == SVX_HEADERFIELD ) && mVisiblePagePropSet.bIsHeaderFieldVisible ) + { + aRepresentation += mVisiblePagePropSet.sHeaderText; + } + else if( ( pField->GetClassId() == SVX_FOOTERFIELD ) && mVisiblePagePropSet.bIsFooterFieldVisible ) + { + aRepresentation += mVisiblePagePropSet.sFooterText; + } + else if( ( pField->GetClassId() == SVX_DATEFIMEFIELD ) && mVisiblePagePropSet.bIsDateTimeFieldVisible ) + { + // TODO: implement the variable case + aRepresentation += mVisiblePagePropSet.sDateTimeText; + } + else if( ( pField->GetClassId() == SVX_PAGEFIELD ) && mVisiblePagePropSet.bIsPageNumberFieldVisible ) + { + sal_Int16 nPageNumber = mVisiblePagePropSet.nPageNumber; + switch( mVisiblePagePropSet.nPageNumberingType ) { case SVX_CHARS_UPPER_LETTER: - aPageNumValue += (sal_Unicode)(char)( ( nPageNumber - 1 ) % 26 + 'A' ); + aRepresentation += OUString::valueOf( (sal_Unicode)(char)( ( nPageNumber - 1 ) % 26 + 'A' ) ); break; case SVX_CHARS_LOWER_LETTER: - aPageNumValue += (sal_Unicode)(char)( ( nPageNumber- 1 ) % 26 + 'a' ); + aRepresentation += OUString::valueOf( (sal_Unicode)(char)( ( nPageNumber - 1 ) % 26 + 'a' ) ); break; case SVX_ROMAN_UPPER: - bUpper = sal_True; + aRepresentation += SvxNumberFormat::CreateRomanString( nPageNumber, true /* upper */ ); + break; case SVX_ROMAN_LOWER: - aPageNumValue += SvxNumberFormat::CreateRomanString( nPageNumber, bUpper ); + aRepresentation += SvxNumberFormat::CreateRomanString( nPageNumber, false /* lower */ ); break; - case SVX_NUMBER_NONE: - aPageNumValue.Erase(); - aPageNumValue += sal_Unicode(' '); + // arabic numbering type is the default + case SVX_ARABIC: ; + // in case the numbering type is not handled we fall back on arabic numbering + default: + aRepresentation += OUString::valueOf( sal_Int32(nPageNumber) ); break; - default : break; } - } - - if( !aPageNumValue.Len() ) - aPageNumValue += String::CreateFromInt32( nPageNumber ); - - aRepresentation = aPageNumValue; - bFieldProcessed = sal_True; + } } - } - pInfo->SetRepresentation( aRepresentation ); + pInfo->SetRepresentation( aRepresentation ); + } } - - return( bFieldProcessed ? 0 : maOldFieldHdl.Call( pInfo ) ); + return ( bFieldProcessed ? 0 : maOldFieldHdl.Call( pInfo ) ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx index caf4fc67c71b..4baaa80d43cb 100644 --- a/filter/source/svg/svgfilter.cxx +++ b/filter/source/svg/svgfilter.cxx @@ -37,6 +37,30 @@ #include <com/sun/star/drawing/XDrawView.hpp> #include <com/sun/star/frame/XDesktop.hdl> #include <com/sun/star/frame/XController.hdl> + + +#include <com/sun/star/view/XSelectionSupplier.hdl> +#include <com/sun/star/view/XSelectionSupplier.hpp> +#include <com/sun/star/drawing/XDrawSubController.hdl> +#include <com/sun/star/drawing/XDrawSubController.hpp> +#include <com/sun/star/container/XNamed.hdl> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/uno/XComponentContext.hdl> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/drawing/framework/XControllerManager.hdl> +#include <com/sun/star/drawing/framework/XControllerManager.hpp> +#include <com/sun/star/drawing/framework/XConfigurationController.hdl> +#include <com/sun/star/drawing/framework/XConfigurationController.hpp> +#include <com/sun/star/drawing/framework/XResource.hdl> +#include <com/sun/star/drawing/framework/XResource.hpp> +#include <com/sun/star/drawing/framework/XView.hdl> +#include <com/sun/star/drawing/framework/XView.hpp> +#include <com/sun/star/drawing/framework/ResourceId.hpp> +#include <comphelper/processfactory.hxx> + + + + #include <osl/mutex.hxx> #include "svgfilter.hxx" @@ -58,7 +82,9 @@ SVGFilter::SVGFilter( const Reference< XComponentContext >& rxCtx ) : mpDefaultSdrPage( NULL ), mpSdrModel( NULL ), mbPresentation( sal_False ), + mbExportAll( sal_False ), mpObjects( NULL ) + { } @@ -75,6 +101,7 @@ SVGFilter::~SVGFilter() // ----------------------------------------------------------------------------- + sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescriptor ) throw (RuntimeException) { @@ -90,47 +117,102 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto else if( mxSrcDoc.is() ) { - sal_Int16 nCurrentPageNumber = -1; - uno::Reference< frame::XDesktop > xDesktop( mxMSF->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), - uno::UNO_QUERY); - if( xDesktop.is() ) + if( !mbExportAll ) { - uno::Reference< frame::XFrame > xFrame( xDesktop->getCurrentFrame() ); - - if( xFrame.is() ) + uno::Reference< frame::XDesktop > xDesktop( mxMSF->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ), + uno::UNO_QUERY); + if( xDesktop.is() ) { - uno::Reference< frame::XController > xController( xFrame->getController() ); + uno::Reference< frame::XFrame > xFrame( xDesktop->getCurrentFrame() ); - if( xController.is() ) + if( xFrame.is() ) { - uno::Reference< drawing::XDrawView > xDrawView( xController, uno::UNO_QUERY ); + uno::Reference< frame::XController > xController( xFrame->getController() ); - if( xDrawView.is() ) + if( xController.is() ) { - uno::Reference< drawing::XDrawPage > xDrawPage( xDrawView->getCurrentPage() ); - - if( xDrawPage.is() ) + /* + * Get the selection from the Slide Sorter Center Pane + */ + if( !mSelectedPages.hasElements() ) { - uno::Reference< beans::XPropertySet >( xDrawPage, uno::UNO_QUERY )-> - getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Number" ) ) ) >>= nCurrentPageNumber; + uno::Reference< beans::XPropertySet > xControllerPropertySet( xController, uno::UNO_QUERY ); + uno::Reference< drawing::XDrawSubController > xSubController; + xControllerPropertySet->getPropertyValue(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SubController" ) ) ) + >>= xSubController; + + if( xSubController.is() ) + { + uno::Any aSelection = xSubController->getSelection(); + if( aSelection.hasValue() ) + { + ObjectSequence aSelectedPageSequence; + aSelection >>= aSelectedPageSequence; + mSelectedPages.realloc( aSelectedPageSequence.getLength() ); + for( sal_Int32 i = 0; i < mSelectedPages.getLength(); ++i ) + { + uno::Reference< drawing::XDrawPage > xDrawPage( aSelectedPageSequence[i], uno::UNO_QUERY ); + mSelectedPages[i] = xDrawPage; + } + } + } } } } } } - Sequence< PropertyValue > aNewDescriptor( rDescriptor ); - - if( nCurrentPageNumber > 0 ) + /* + * Export all slides + */ + if( !mSelectedPages.hasElements() ) { - const sal_uInt32 nOldLength = rDescriptor.getLength(); + uno::Reference< drawing::XMasterPagesSupplier > xMasterPagesSupplier( mxSrcDoc, uno::UNO_QUERY ); + uno::Reference< drawing::XDrawPagesSupplier > xDrawPagesSupplier( mxSrcDoc, uno::UNO_QUERY ); - aNewDescriptor.realloc( nOldLength + 1 ); - aNewDescriptor[ nOldLength ].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PagePos" ) ); - aNewDescriptor[ nOldLength ].Value <<= static_cast< sal_Int16 >( nCurrentPageNumber - 1 ); + if( xMasterPagesSupplier.is() && xDrawPagesSupplier.is() ) + { + uno::Reference< drawing::XDrawPages > xMasterPages( xMasterPagesSupplier->getMasterPages(), uno::UNO_QUERY ); + uno::Reference< drawing::XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), uno::UNO_QUERY ); + if( xMasterPages.is() && xMasterPages->getCount() && + xDrawPages.is() && xDrawPages->getCount() ) + { + sal_Int32 nDPCount = xDrawPages->getCount(); + + mSelectedPages.realloc( nDPCount ); + sal_Int32 i; + for( i = 0; i < nDPCount; ++i ) + { + uno::Reference< drawing::XDrawPage > xDrawPage( xDrawPages->getByIndex( i ), uno::UNO_QUERY ); + mSelectedPages[i] = xDrawPage; + } + } + } + } + + /* + * We get all master page that are targeted by at least one draw page. + * The master page are put in an unordered set. + */ + ObjectSet aMasterPageTargetSet; + for( sal_Int32 i = 0; i < mSelectedPages.getLength(); ++i ) + { + uno::Reference< drawing::XMasterPageTarget > xMasterPageTarget( mSelectedPages[i], uno::UNO_QUERY ); + if( xMasterPageTarget.is() ) + { + aMasterPageTargetSet.insert( xMasterPageTarget->getMasterPage() ); + } + } + // Later we move them to a uno::Sequence so we can get them by index + mMasterPageTargets.realloc( aMasterPageTargetSet.size() ); + ObjectSet::const_iterator aElem = aMasterPageTargetSet.begin(); + for( sal_Int32 i = 0; aElem != aMasterPageTargetSet.end(); ++aElem, ++i) + { + uno::Reference< drawing::XDrawPage > xMasterPage( *aElem, uno::UNO_QUERY ); + mMasterPageTargets[i] = xMasterPage; } - bRet = implExport( aNewDescriptor ); + bRet = implExport( rDescriptor ); } else bRet = sal_False; diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx index 8ef5b626042f..37037ac9766a 100644 --- a/filter/source/svg/svgfilter.hxx +++ b/filter/source/svg/svgfilter.hxx @@ -58,7 +58,14 @@ #include <com/sun/star/java/XJavaVM.hpp> #include <com/sun/star/java/XJavaThreadRegister_11.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/style/ParagraphAdjust.hdl> +#include <com/sun/star/style/ParagraphAdjust.hpp> +#include <com/sun/star/drawing/FillStyle.hpp> +#include <com/sun/star/graphic/XGraphicProvider.hpp> +#include <com/sun/star/graphic/XGraphicProvider.hdl> + +#include <boost/unordered_set.hpp> #include <boost/unordered_map.hpp> #include <osl/diagnose.h> #include <rtl/process.h> @@ -82,9 +89,6 @@ #include <svx/svdobj.hxx> #include <xmloff/xmlexp.hxx> -#include "svgfilter.hxx" -#include "svgscript.hxx" - #include <cstdio> using namespace ::com::sun::star::uno; @@ -96,6 +100,7 @@ using namespace ::com::sun::star::drawing; using namespace ::com::sun::star::presentation; using namespace ::com::sun::star::document; using namespace ::com::sun::star::text; +using namespace ::com::sun::star::style; using namespace ::com::sun::star::io; using namespace ::com::sun::star::xml::sax; using namespace ::std; @@ -106,6 +111,15 @@ using namespace ::std; #define SVG_EXPORT_ALLPAGES ((sal_Int32)-1) + +// ----------- +// - statics - +// ----------- + +// Placeholder tag used into the ImplWriteActions method to filter text placeholder fields +static const ::rtl::OUString sPlaceholderTag = ::rtl::OUString::createFromAscii( "<[:isPlaceholder:]>" ); + + // ------------- // - SVGExport - // ------------- @@ -137,11 +151,11 @@ public: protected: -virtual void _ExportStyles( sal_Bool /* bUsed */ ) {} -virtual void _ExportAutoStyles() {} -virtual void _ExportContent() {} -virtual void _ExportMasterStyles() {} -virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum /* eClass */ ) { return 0; } + virtual void _ExportStyles( sal_Bool /* bUsed */ ) {} + virtual void _ExportAutoStyles() {} + virtual void _ExportContent() {} + virtual void _ExportMasterStyles() {} + virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum /* eClass */ ) { return 0; } private: @@ -164,20 +178,43 @@ private: public: - ObjectRepresentation(); - ObjectRepresentation( const Reference< XInterface >& rxIf, - const GDIMetaFile& rMtf ); - ObjectRepresentation( const ObjectRepresentation& rPresentation ); - ~ObjectRepresentation(); + ObjectRepresentation(); + ObjectRepresentation( const Reference< XInterface >& rxIf, + const GDIMetaFile& rMtf ); + ObjectRepresentation( const ObjectRepresentation& rPresentation ); + ~ObjectRepresentation(); - ObjectRepresentation& operator=( const ObjectRepresentation& rPresentation ); - sal_Bool operator==( const ObjectRepresentation& rPresentation ) const; + ObjectRepresentation& operator=( const ObjectRepresentation& rPresentation ); + sal_Bool operator==( const ObjectRepresentation& rPresentation ) const; - const Reference< XInterface >& GetObject() const { return mxObject; } - sal_Bool HasRepresentation() const { return mpMtf != NULL; } - const GDIMetaFile& GetRepresentation() const { return *mpMtf; } + const Reference< XInterface >& GetObject() const { return mxObject; } + sal_Bool HasRepresentation() const { return mpMtf != NULL; } + const GDIMetaFile& GetRepresentation() const { return *mpMtf; } }; +// ------------------- +// - PagePropertySet - +// ------------------- + +struct PagePropertySet +{ + sal_Bool bIsBackgroundVisible; + sal_Bool bAreBackgroundObjectsVisible; + sal_Bool bIsPageNumberFieldVisible; + sal_Bool bIsDateTimeFieldVisible; + sal_Bool bIsFooterFieldVisible; + sal_Bool bIsHeaderFieldVisible; + sal_Int32 nPageNumberingType; + sal_Bool bIsDateTimeFieldFixed; + sal_Int16 nPageNumber; + sal_Int32 nDateTimeFormat; + ::rtl::OUString sDateTimeText; + ::rtl::OUString sFooterText; + ::rtl::OUString sHeaderText; +}; + + + // --------------------------- // - HashReferenceXInterface - // --------------------------- @@ -190,6 +227,25 @@ struct HashReferenceXInterface } }; +// --------------------------- +// - HashOUString - +// --------------------------- + +struct HashOUString +{ + size_t operator()( const ::rtl::OUString& oustr ) const { return static_cast< size_t >( oustr.hashCode() ); } +}; + +// --------------------------- +// - HashUChar - +// --------------------------- + +struct HashUChar +{ + size_t operator()( const sal_Unicode uchar ) const { return static_cast< size_t >( uchar ); } +}; + + // ------------- // - SVGFilter - // ------------- @@ -203,8 +259,16 @@ class SVGFilter : public cppu::WeakImplHelper4 < XFilter, XExporter, XExtendedFilterDetection > { - typedef ::boost::unordered_map< Reference< XInterface >, ObjectRepresentation, HashReferenceXInterface > ObjectMap; +public: + typedef ::boost::unordered_map< Reference< XInterface >, ObjectRepresentation, HashReferenceXInterface > ObjectMap; typedef ::std::vector< ::rtl::OUString > UniqueIdVector; + typedef ::boost::unordered_set< Reference< XInterface >, HashReferenceXInterface > ObjectSet; + typedef Sequence< Reference< XInterface > > ObjectSequence; + typedef Sequence< Reference< XDrawPage > > XDrawPageSequence; + + typedef ::boost::unordered_set< sal_Unicode, HashUChar > UCharSet; + typedef ::boost::unordered_map< ::rtl::OUString, UCharSet, HashOUString > UCharSetMap; + typedef ::boost::unordered_map< Reference< XInterface >, UCharSetMap, HashReferenceXInterface > UCharSetMapMap; private: @@ -216,12 +280,24 @@ private: SdrPage* mpDefaultSdrPage; SdrModel* mpSdrModel; sal_Bool mbPresentation; + sal_Bool mbExportAll; + sal_Bool mbSinglePage; + sal_Int32 mnVisiblePage; + sal_Int32 mnVisibleMasterPage; + sal_Bool mbIsPageVisible; + PagePropertySet mVisiblePagePropSet; + ::rtl::OUString msClipPathId; + UCharSetMapMap mTextFieldCharSets; + Reference< XInterface > mCreateOjectsCurrentMasterPage; ObjectMap* mpObjects; Reference< XComponent > mxSrcDoc; Reference< XComponent > mxDstDoc; Reference< XDrawPage > mxDefaultPage; Sequence< PropertyValue > maFilterData; + XDrawPageSequence mSelectedPages; + XDrawPageSequence mMasterPageTargets; + UniqueIdVector maUniqueIdVector; sal_Int32 mnMasterSlideId; sal_Int32 mnSlideId; @@ -234,32 +310,30 @@ private: sal_Bool implExport( const Sequence< PropertyValue >& rDescriptor ) throw (RuntimeException); Reference< XDocumentHandler > implCreateExportDocumentHandler( const Reference< XOutputStream >& rxOStm ); - sal_Bool implGenerateMetaData( const Reference< XDrawPages >& rxMasterPages, - const Reference< XDrawPages >& rxDrawPages ); - sal_Bool implGenerateScript( const Reference< XDrawPages >& rxMasterPages, - const Reference< XDrawPages >& rxDrawPages ); + sal_Bool implGetPagePropSet( const Reference< XDrawPage > & rxPage ); + sal_Bool implGenerateMetaData(); + sal_Bool implGenerateScript(); - sal_Bool implExportDocument( const Reference< XDrawPages >& rxMasterPages, - const Reference< XDrawPages >& rxDrawPages, - sal_Int32 nPageToExport ); + sal_Bool implExportDocument(); - sal_Bool implExportPages( const Reference< XDrawPages >& rxPages, + sal_Bool implExportPages( const XDrawPageSequence& rxPages, sal_Int32 nFirstPage, sal_Int32 nLastPage, sal_Int32 nVisiblePage, sal_Bool bMaster ); sal_Bool implExportShapes( const Reference< XShapes >& rxShapes ); sal_Bool implExportShape( const Reference< XShape >& rxShape ); - sal_Bool implCreateObjects( const Reference< XDrawPages >& rxMasterPages, - const Reference< XDrawPages >& rxDrawPages, - sal_Int32 nPageToExport ); + sal_Bool implCreateObjects(); sal_Bool implCreateObjectsFromShapes( const Reference< XShapes >& rxShapes ); sal_Bool implCreateObjectsFromShape( const Reference< XShape >& rxShape ); sal_Bool implCreateObjectsFromBackground( const Reference< XDrawPage >& rxMasterPage ); ::rtl::OUString implGetClassFromShape( const Reference< XShape >& rxShape ); ::rtl::OUString implGetValidIDFromInterface( const Reference< XInterface >& rxIf, sal_Bool bUnique = sal_False ); - + sal_Bool implLookForFirstVisiblePage(); + Any implSafeGetPagePropSet( const ::rtl::OUString & sPropertyName, + const Reference< XPropertySet > & rxPropSet, + const Reference< XPropertySetInfo > & rxPropSetInfo ); DECL_LINK( CalcFieldHdl, EditFieldInfo* ); protected: @@ -280,9 +354,11 @@ protected: public: explicit SVGFilter( const Reference< XComponentContext >& rxCtx ); - virtual ~SVGFilter(); + virtual ~SVGFilter(); }; + + // ----------------------------------------------------------------------------- class SvStream; diff --git a/filter/source/svg/svgfontexport.cxx b/filter/source/svg/svgfontexport.cxx index d796234133d8..f78d24c9fa87 100644 --- a/filter/source/svg/svgfontexport.cxx +++ b/filter/source/svg/svgfontexport.cxx @@ -33,7 +33,13 @@ #include "precompiled_filter.hxx" #include "svgfontexport.hxx" +#include "svgfilter.hxx" +#include "svgwriter.hxx" + + #include <vcl/unohelp.hxx> +#include <vcl/font.hxx> +#include <vcl/outdev.hxx> static const sal_Int32 nFontEM = 2048; diff --git a/filter/source/svg/svgfontexport.hxx b/filter/source/svg/svgfontexport.hxx index a5ebd677e6bc..c05ede336a58 100644 --- a/filter/source/svg/svgfontexport.hxx +++ b/filter/source/svg/svgfontexport.hxx @@ -33,13 +33,20 @@ #define SVGFONTEXPORT_HXX #include <comphelper/stl_types.hxx> -#include "svgfilter.hxx" -#include "svgwriter.hxx" +#include <tools/fontenum.hxx> + // ----------------- // - SVGFontExport - // ----------------- + +class ObjectRepresentation; +class SVGExport; +class Font; +class OutputDevice; + + class SVGFontExport { typedef ::std::vector< ObjectRepresentation > ObjectVector; diff --git a/filter/source/svg/svgscript.hxx b/filter/source/svg/svgscript.hxx index 2019994dced0..145de73b4565 100644 --- a/filter/source/svg/svgscript.hxx +++ b/filter/source/svg/svgscript.hxx @@ -1,3 +1,4 @@ + /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * @@ -26,97 +27,1675 @@ * ************************************************************************/ -static const char aSVGScript1[] = + + +#define N_SVGSCRIPT_FRAGMENTS 9 + +static const char aSVGScript0[] = "<![CDATA[\n\ +\n\ + /** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n\ + * - Presentation Engine v4.7 -\n\ + *\n\ + ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n\ + * This program is free software: you can redistribute it and/or modify\n\ + * it under the terms of the GNU General Public License as published by\n\ + * the Free Software Foundation, either version 3 of the License, or\n\ + * (at your option) any later version.\n\ + *\n\ + * This program is distributed in the hope that it will be useful,\n\ + * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ + * GNU General Public License for more details.\n\ + *\n\ + * You should have received a copy of the GNU General Public License\n\ + * along with this program. If not, see http://www.gnu.org/licenses/.\n\ + *\n\ + ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n\ + * Some parts of this script are based on the JessyInk project:\n\ + * http://code.google.com/p/jessyink/\n\ + *\n\ + ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\ +\n\ + window.onload = init;\n\ +\n\ +\n\ + // ooo elements\n\ + var aOOOElemMetaSlides = 'ooo:meta_slides';\n\ + var aOOOElemMetaSlide = 'ooo:meta_slide';\n\ + var aOOOElemTextField = 'ooo:text_field';\n\ +\n\ + // ooo attributes\n\ + var aOOOAttrNumberOfSlides = 'number-of-slides';\n\ + var aOOOAttrNumberingType = 'page-numbering-type';\n\ +\n\ + var aOOOAttrSlide = 'slide';\n\ + var aOOOAttrMaster = 'master';\n\ + var aOOOAttrBackgroundVisibility = 'background-visibility';\n\ + var aOOOAttrMasterObjectsVisibility = 'master-objects-visibility';\n\ + var aOOOAttrPageNumberVisibility = 'page-number-visibility';\n\ + var aOOOAttrDateTimeVisibility = 'date-time-visibility';\n\ + var aOOOAttrFooterVisibility = 'footer-visibility';\n\ + var aOOOAttrHeaderVisibility = 'header-visibility';\n\ + var aOOOAttrDateTimeField = 'date-time-field';\n\ + var aOOOAttrFooterField = 'footer-field';\n\ + var aOOOAttrHeaderField = 'header-field';\n\ +\n\ + var aOOOAttrDateTimeFormat = 'date-time-format';\n\ +\n\ + var aOOOAttrTextAdjust = 'text-adjust';\n\ +\n\ + // Placeholder class names\n\ + var aSlideNumberClassName = 'Slide_Number';\n\ + var aDateTimeClassName = 'Date/Time';\n\ + var aFooterClassName = 'Footer';\n\ + var aHeaderClassName = 'Header';\n\ +\n\ + // Creating a namespace dictionary.\n\ + var NSS = new Object();\n\ + NSS['svg']='http://www.w3.org/2000/svg';\n\ + NSS['rdf']='http://www.w3.org/1999/02/22-rdf-syntax-ns#';\n\ + NSS['xlink']='http://www.w3.org/1999/xlink';\n\ + NSS['xml']='http://www.w3.org/XML/1998/namespace';\n\ + NSS['ooo'] = 'http://xml.openoffice.org/svg/export';\n\ +\n\ + // Presentation modes.\n\ + var SLIDE_MODE = 1;\n\ + var INDEX_MODE = 2;\n\ +\n\ + // Mouse handler actions.\n\ + var MOUSE_UP = 1;\n\ + var MOUSE_DOWN = 2;\n\ + var MOUSE_MOVE = 3;\n\ + var MOUSE_WHEEL = 4;\n\ +\n\ + // Keycodes.\n\ + var LEFT_KEY = 37; // cursor left keycode\n\ + var UP_KEY = 38; // cursor up keycode\n\ + var RIGHT_KEY = 39; // cursor right keycode\n\ + var DOWN_KEY = 40; // cursor down keycode\n\ + var PAGE_UP_KEY = 33; // page up keycode\n\ + var PAGE_DOWN_KEY = 34; // page down keycode\n\ + var HOME_KEY = 36; // home keycode\n\ + var END_KEY = 35; // end keycode\n\ + var ENTER_KEY = 13;\n\ + var SPACE_KEY = 32;\n\ + var ESCAPE_KEY = 27;\n\ +\n\ + // Visibility Values\n\ + var HIDDEN = 0;\n\ + var VISIBLE = 1;\n\ + var INHERIT = 2;\n\ + var aVisibilityAttributeValue = [ 'hidden', 'visible', 'inherit' ];\n\ + var aVisibilityValue = { 'hidden' : HIDDEN, 'visible' : VISIBLE, 'inherit' : INHERIT };\n\ +\n\ + // Parameters\n\ + var ROOT_NODE = document.getElementsByTagNameNS( NSS['svg'], 'svg' )[0];\n\ + var WIDTH = 0;\n\ + var HEIGHT = 0;\n\ + var INDEX_COLUMNS_DEFAULT = 3;\n\ + var INDEX_OFFSET = 0;\n\ +\n\ + // Initialization.\n\ + var theMetaDoc;\n\ + var theSlideIndexPage;\n\ + var currentMode = SLIDE_MODE;\n\ + var processingEffect = false;\n\ var nCurSlide = 0;\n\ - var nSlides = 0;\n\ - var aSlides = new Object();\n\ - var aMasters = new Object();\n\ - var aMasterVisibilities = new Object();\n\ \n\ - function onClick( aEvt )\n\ + // Initialize char and key code dictionaries.\n\ + var charCodeDictionary = getDefaultCharCodeDictionary();\n\ + var keyCodeDictionary = getDefaultKeyCodeDictionary();\n\ +\n\ + // Initialize mouse handler dictionary.\n\ + var mouseHandlerDictionary = getDefaultMouseHandlerDictionary();\n\ +\n\ + /***************************\n\ + ** OOP support functions **\n\ + ***************************/\n\ +\n\ + function object( aObject )\n\ {\n\ - var nOffset = 0;\n\ + var F = function() {};\n\ + F.prototype = aObject;\n\ + return new F();\n\ + }\n\ \n\ - if( aEvt.getButton() == 0 ) \n\ - nOffset = 1;\n\ - else if( aEvt.getButton() == 2 ) \n\ - nOffset = -1;\n\ + function extend( aSubType, aSuperType )\n\ + {\n\ + if (!aSuperType || !aSubType) {\n\ + alert('extend failed, verify dependencies');\n\ + }\n\ + var OP = Object.prototype;\n\ + var sp = aSuperType.prototype;\n\ + var rp = object( sp );\n\ + aSubType.prototype = rp;\n\ \n\ - if( 0 != nOffset )\n\ - switchSlide( aEvt, nOffset );\n\ + rp.constructor = aSubType;\n\ + aSubType.superclass = sp;\n\ +\n\ + // assign constructor property\n\ + if (aSuperType != Object && sp.constructor == OP.constructor) {\n\ + sp.constructor = aSuperType;\n\ + }\n\ +\n\ + return aSubType;\n\ }\n\ \n\ - function onKeyPress( aEvt ) \n\ + // ------------------------------------------------------------------------------------------ //\n\ + /**********************************\n\ + ** Helper functions and classes **\n\ + **********************************/\n\ +\n\ + function Rectangle( aSVGRectElem )\n\ {\n\ - var nCode = String.fromCharCode( aEvt.getCharCode() );\n\ - var nOffset = 0;\n\ + var x = parseInt( aSVGRectElem.getAttribute( 'x' ) );\n\ + var y = parseInt( aSVGRectElem.getAttribute( 'y' ) );\n\ + var width = parseInt( aSVGRectElem.getAttribute( 'width' ) );\n\ + var height = parseInt( aSVGRectElem.getAttribute( 'height' ) );\n\ \n\ - if( ( ' ' == nCode ) || \n\ - ( ( !aEvt.getCtrlKey() && !aEvt.getAltKey() && !aEvt.getMetaKey() && !aEvt.getShiftKey() ) && \n\ - ( aEvt.getKeyCode() == aEvt.DOM_VK_PAGE_DOWN() ||\n\ - aEvt.getKeyCode() == aEvt.DOM_VK_PAGE_RIGHT() ) ) )\n\ + this.left = x;\n\ + this.right = x + width;\n\ + this.top = y;\n\ + this.bottom = y + height;\n\ + }\n\ +\n\ + function log( message )\n\ + {\n\ + if( typeof console == 'object' )\n\ {\n\ - nOffset = 1;\n\ + console.log( message );\n\ }\n\ - else if( ( !aEvt.getCtrlKey() && !aEvt.getAltKey() && !aEvt.getMetaKey() && !aEvt.getShiftKey() ) && \n\ - ( aEvt.getKeyCode() == aEvt.DOM_VK_PAGE_UP() ||\n\ - aEvt.getKeyCode() == aEvt.DOM_VK_LEFT() ) )\n\ + else if( typeof opera == 'object' )\n\ {\n\ - nOffset = -1\n\ + opera.postError( message );\n\ }\n\ + else if( typeof java == 'object' && typeof java.lang == 'object' )\n\ + {\n\ + java.lang.System.out.println( message );\n\ + }\n\ + }\n\ \n\ - if( 0 != nOffset )\n\ - switchSlide( aEvt, nOffset );\n\ + function getNSAttribute( sNSPrefix, aElem, sAttrName )\n\ + {\n\ + if( !aElem ) return null;\n\ + if( aElem.hasAttributeNS( NSS[sNSPrefix], sAttrName ) )\n\ + {\n\ + return aElem.getAttributeNS( NSS[sNSPrefix], sAttrName );\n\ + }\n\ + return null;\n\ + }\n\ +\n\ + function getOOOAttribute( aElem, sAttrName )\n\ + {\n\ + return getNSAttribute( 'ooo', aElem, sAttrName );\n\ + }\n\ +\n\ + function setNSAttribute( sNSPrefix, aElem, sAttrName, aValue )\n\ +"; + +static const char aSVGScript1[] = +"\ + {\n\ + if( !aElem ) return false;\n\ + if( 'setAttributeNS' in aElem )\n\ + {\n\ + aElem.setAttributeNS( NSS[sNSPrefix], sAttrName, aValue );\n\ + return true;\n\ + }\n\ + else\n\ + {\n\ + aElem.setAttribute(sNSPrefix + ':' + sAttrName, aValue );\n\ + return true;\n\ + }\n\ + }\n\ +\n\ + function setOOOAttribute( aElem, sAttrName, aValue )\n\ + {\n\ + return setNSAttribute( 'ooo', aElem, sAttrName, aValue );\n\ + }\n\ +\n\ + function checkElemAndSetAttribute( aElem, sAttrName, aValue )\n\ + {\n\ + if( aElem )\n\ + aElem.setAttribute( sAttrName, aValue );\n\ + }\n\ +\n\ + function getElementsByProperty( node, name )\n\ + {\n\ + var elems = new Array();\n\ +\n\ + if( node.getAttribute( name ) )\n\ + elems.push( node );\n\ +\n\ + for( var counter = 0; counter < node.childNodes.length; ++counter )\n\ + {\n\ + if( node.childNodes[counter].nodeType == 1 )\n\ + elems = elems.concat( getElementsByProperty( node.childNodes[counter], name ) );\n\ + }\n\ + return elems;\n\ + }\n\ +\n\ + function getElementsByClassName( aElem, sClassName )\n\ + {\n\ +\n\ + var aElementSet = new Array();\n\ + // not all browsers support the 'getElementsByClassName' method\n\ + if( 'getElementsByClassName' in aElem )\n\ + {\n\ + aElementSet = aElem.getElementsByClassName( sClassName );\n\ + }\n\ + else\n\ + {\n\ + var aElementSetByClassProperty = getElementsByProperty( aElem, 'class' );\n\ + for( var i = 0; i < aElementSetByClassProperty.length; ++i )\n\ + {\n\ + var sAttrClassName = aElementSetByClassProperty[i].getAttribute( 'class' );\n\ + if( sAttrClassName == sClassName )\n\ + {\n\ + aElementSet.push( aElementSetByClassProperty[i] );\n\ + }\n\ + }\n\ + }\n\ + return aElementSet;\n\ + }\n\ +\n\ + function getElementByClassName( aElem, sClassName /*, sTagName */)\n\ + {\n\ + var aElementSet = getElementsByClassName( aElem, sClassName );\n\ + if ( aElementSet.length == 1 )\n\ + return aElementSet[0];\n\ + else\n\ + return null;\n\ + }\n\ +\n\ + function getClassAttribute( aElem )\n\ + {\n\ + if( aElem )\n\ + return aElem.getAttribute( 'class' );\n\ + return '';\n\ }\n\ \n\ + function initVisibilityProperty( aElement )\n\ + {\n\ + var nVisibility = VISIBLE;\n\ + var sVisibility = aElement.getAttribute( 'visibility' );\n\ + if( sVisibility ) nVisibility = aVisibilityValue[ sVisibility ];\n\ + return nVisibility;\n\ + }\n\ +\n\ + function setElementVisibility( aElement, nCurrentVisibility, nNewVisibility )\n\ + {\n\ + if( nCurrentVisibility != nNewVisibility )\n\ + {\n\ + checkElemAndSetAttribute( aElement, 'visibility', aVisibilityAttributeValue[nNewVisibility] );\n\ + return nNewVisibility;\n\ + }\n\ + return nCurrentVisibility;\n\ + }\n\ +\n\ + function getSafeIndex( nIndex, nMin, nMax )\n\ + {\n\ + if( nIndex < nMin )\n\ + return nMin;\n\ + else if( nIndex > nMax )\n\ + return nMax;\n\ + else\n\ + return nIndex;\n\ + }\n\ +\n\ +\n\ + // ------------------------------------------------------------------------------------------ //\n\ + /******************\n\ + ** Core Classes **\n\ + ******************/\n\ +\n\ + /** Class MetaDocument **\n\ + * This class provides a pool of properties related to the whole presentation and\n\ + * it is responsible for initializing the set of MetaSlide objects that handle\n\ + * the meta information for each slide.\n\ + */\n\ + function MetaDocument( aMetaDocElem )\n\ + {\n\ + this.nNumberOfSlides = parseInt( aMetaDocElem.getAttributeNS( NSS['ooo'], aOOOAttrNumberOfSlides ) );\n\ + assert( typeof this.nNumberOfSlides == 'number' && this.nNumberOfSlides > 0,\n\ + 'MetaDocument: number of slides is zero or undefined.' );\n\ + this.startSlideNumber = 0;\n\ + this.sPageNumberingType = aMetaDocElem.getAttributeNS( NSS['ooo'], aOOOAttrNumberingType ) || 'arabic';\n\ + this.aMetaSlideSet = new Array();\n\ + this.aMasterPageSet = new Object();\n\ + this.aTextFieldSet = new Array();\n\ + this.slideNumberField = new SlideNumberField( this.sPageNumberingType );\n\ +\n\ + for( var i = 0; i < this.nNumberOfSlides; ++i )\n\ + {\n\ + var sMetaSlideId = aOOOElemMetaSlide + '_' + i;\n\ + this.aMetaSlideSet.push( new MetaSlide( sMetaSlideId, this ) );\n\ + }\n\ + assert( this.aMetaSlideSet.length == this.nNumberOfSlides,\n\ + 'MetaDocument: aMetaSlideSet.length != nNumberOfSlides.' );\n\ + this.aMetaSlideSet[ this.startSlideNumber ].show();\n\ + }\n\ +\n\ + MetaDocument.prototype.initPlaceholderShapes = function()\n\ + {\n\ + this.aMetaSlideSet[0].initPlaceholderShapes();\n\ + };\n\ +\n\ +\n\ + /** Class MetaSlide **\n\ + * This class is responsible for managing the visibility of all master page shapes\n\ + * and background related to a given slide element; it performs the creation and\n\ + * the initialization of each Text Field object.\n\ + */\n\ + function MetaSlide( sMetaSlideId, aMetaDoc )\n\ + {\n\ + this.theDocument = document;\n\ + this.id = sMetaSlideId;\n\ + this.theMetaDoc = aMetaDoc;\n\ + this.element = this.theDocument.getElementById( this.id );\n\ + assert( this.element, 'MetaSlide: meta_slide element <' + this.id + '> not found.' );\n\ + // - Initialize the Slide Element -\n\ + this.slideId = this.element.getAttributeNS( NSS['ooo'], aOOOAttrSlide );\n\ + this.slideElement = this.theDocument.getElementById( this.slideId );\n\ + assert( this.slideElement, 'MetaSlide: slide element <' + this.slideId + '> not found.' );\n\ + // - Initialize the Target Master Page Element -\n\ + this.masterPage = this.initMasterPage();\n\ + // - Initialize Background -\n\ + //this.aBackground = getElementByClassName( this.aSlide, 'Background' );\n\ + // - Initialize Visibility Properties -\n\ + this.nAreMasterObjectsVisible = this.initVisibilityProperty( aOOOAttrMasterObjectsVisibility, VISIBLE );\n\ + this.nIsBackgroundVisible = this.initVisibilityProperty( aOOOAttrBackgroundVisibility, VISIBLE );\n\ + this.nIsPageNumberVisible = this.initVisibilityProperty( aOOOAttrPageNumberVisibility, HIDDEN );\n\ + this.nIsDateTimeVisible = this.initVisibilityProperty( aOOOAttrDateTimeVisibility, VISIBLE );\n\ + this.nIsFooterVisible = this.initVisibilityProperty( aOOOAttrFooterVisibility, VISIBLE );\n\ + this.nIsHeaderVisible = this.initVisibilityProperty( aOOOAttrHeaderVisibility, VISIBLE );\n\ + // - Initialize Master Page Text Fields (Placeholders)-\n\ + this.aMPTextFieldSet = new Object();\n\ + this.aMPTextFieldSet[aSlideNumberClassName] = this.initSlideNumberField();\n\ + this.aMPTextFieldSet[aDateTimeClassName] = this.initDateTimeField( aOOOAttrDateTimeField );\n\ + this.aMPTextFieldSet[aFooterClassName] = this.initFixedTextField( aOOOAttrFooterField );\n\ + this.aMPTextFieldSet[aHeaderClassName] = this.initFixedTextField( aOOOAttrHeaderField );\n\ + }\n\ +\n\ + /*** MetaSlide methods ***/\n\ + MetaSlide.prototype =\n\ + {\n\ + /*** public methods ***/\n\ + hide : function()\n\ + {\n\ + checkElemAndSetAttribute( this.slideElement, 'visibility', 'hidden' );\n\ +\n\ + this.masterPage.hide();\n\ + this.masterPage.hideBackground();\n\ +\n\ + var aFieldSet = this.aMPTextFieldSet;\n\ + var aShapeSet = this.masterPage.aPlaceholderShapeSet;\n\ + if( aFieldSet[aSlideNumberClassName] ) aFieldSet[aSlideNumberClassName].hide( aShapeSet[aSlideNumberClassName] );\n\ + if( aFieldSet[aDateTimeClassName] ) aFieldSet[aDateTimeClassName].hide( aShapeSet[aDateTimeClassName] );\n\ + if( aFieldSet[aFooterClassName] ) aFieldSet[aFooterClassName].hide( aShapeSet[aFooterClassName] );\n\ + if( aFieldSet[aHeaderClassName] ) aFieldSet[aHeaderClassName].hide( aShapeSet[aHeaderClassName] );\n\ + },\n\ "; static const char aSVGScript2[] = -" function switchSlide( aEvt, nOffset ) \n\ +"\ +\n\ + hideExceptMaster : function()\n\ + {\n\ + checkElemAndSetAttribute( this.slideElement, 'visibility', 'hidden' );\n\ + },\n\ +\n\ + show : function()\n\ + {\n\ + checkElemAndSetAttribute( this.slideElement, 'visibility', 'visible' );\n\ +\n\ + this.masterPage.setVisibility( this.nAreMasterObjectsVisible );\n\ + this.masterPage.setVisibilityBackground( this.nIsBackgroundVisible );\n\ +\n\ +\n\ + this.setTextFieldVisibility( aSlideNumberClassName, this.nIsPageNumberVisible );\n\ + this.setTextFieldVisibility( aDateTimeClassName, this.nIsDateTimeVisible );\n\ + this.setTextFieldVisibility( aFooterClassName, this.nIsFooterVisible );\n\ + this.setTextFieldVisibility( aHeaderClassName, this.nIsHeaderVisible );\n\ + },\n\ +\n\ + getMasterPageId : function()\n\ + {\n\ + return this.masterPage.id;\n\ + },\n\ +\n\ + getMasterPageElement : function()\n\ + {\n\ + return this.masterPage.element;\n\ + },\n\ +\n\ + getBackground : function()\n\ + {\n\ + return getElementByClassName( this.slideElement, 'Background' );\n\ + },\n\ +\n\ + getMasterPageBackground : function()\n\ + {\n\ + return this.masterPage.background;\n\ + },\n\ +\n\ + /*** private methods ***/\n\ + initMasterPage : function()\n\ + {\n\ + var sMasterPageId = this.element.getAttributeNS( NSS['ooo'], aOOOAttrMaster );\n\ + if( !this.theMetaDoc.aMasterPageSet.hasOwnProperty( sMasterPageId ) )\n\ + this.theMetaDoc.aMasterPageSet[ sMasterPageId ] = new MasterPage( sMasterPageId );\n\ + return this.theMetaDoc.aMasterPageSet[ sMasterPageId ];\n\ + },\n\ +\n\ + initVisibilityProperty : function( aVisibilityAttribute, nDefaultValue )\n\ + {\n\ + var nVisibility = nDefaultValue;\n\ + var sVisibility = getOOOAttribute( this.element, aVisibilityAttribute );\n\ + if( sVisibility )\n\ + nVisibility = aVisibilityValue[ sVisibility ];\n\ + return nVisibility;\n\ + },\n\ +\n\ + initSlideNumberField : function()\n\ + {\n\ + return this.theMetaDoc.slideNumberField;\n\ + },\n\ +\n\ + initDateTimeField : function( aOOOAttrDateTimeField )\n\ + {\n\ + var sTextFieldId = getOOOAttribute( this.element, aOOOAttrDateTimeField );\n\ + if( !sTextFieldId ) return null;\n\ +\n\ + var nLength = aOOOElemTextField.length + 1;\n\ + var nIndex = parseInt(sTextFieldId.substring( nLength ) );\n\ + if( typeof nIndex != 'number') return null;\n\ +\n\ + if( !this.theMetaDoc.aTextFieldSet[ nIndex ] )\n\ + {\n\ + var aTextField;\n\ + var aTextFieldElem = document.getElementById( sTextFieldId );\n\ + var sClassName = getClassAttribute( aTextFieldElem );\n\ + if( sClassName == 'FixedDateTimeField' )\n\ + {\n\ + aTextField = new FixedTextField( aTextFieldElem );\n\ + }\n\ + else if( sClassName == 'VariableDateTimeField' )\n\ + {\n\ + aTextField = new VariableDateTimeField( aTextFieldElem );\n\ + }\n\ + else\n\ + {\n\ + aTextField = null;\n\ + }\n\ + this.theMetaDoc.aTextFieldSet[ nIndex ] = aTextField;\n\ + }\n\ + return this.theMetaDoc.aTextFieldSet[ nIndex ];\n\ + },\n\ +\n\ + initFixedTextField : function( aOOOAttribute )\n\ + {\n\ + var sTextFieldId = getOOOAttribute( this.element, aOOOAttribute );\n\ + if( !sTextFieldId ) return null;\n\ +\n\ + var nLength = aOOOElemTextField.length + 1;\n\ + var nIndex = parseInt( sTextFieldId.substring( nLength ) );\n\ + if( typeof nIndex != 'number') return null;\n\ +\n\ + if( !this.theMetaDoc.aTextFieldSet[ nIndex ] )\n\ + {\n\ + var aTextFieldElem = document.getElementById( sTextFieldId );\n\ + this.theMetaDoc.aTextFieldSet[ nIndex ]\n\ + = new FixedTextField( aTextFieldElem );\n\ + }\n\ + return this.theMetaDoc.aTextFieldSet[ nIndex ];\n\ + },\n\ +\n\ + setTextFieldVisibility : function( sClassName, nVisible )\n\ + {\n\ + var aTextField = this.aMPTextFieldSet[ sClassName ];\n\ + var aPlaceholderShape = this.masterPage.aPlaceholderShapeSet[ sClassName ];\n\ + if( !aTextField ) return;\n\ + aTextField.setVisibility( this.nAreMasterObjectsVisible & nVisible, aPlaceholderShape );\n\ + }\n\ + };\n\ +\n\ + /** Class MasterPage **\n\ + * This class gives access to a master page element, its background and\n\ + * each placeholder shape present in the master page element.\n\ + */\n\ + function MasterPage( sMasterPageId )\n\ {\n\ - var nNextSlide = nCurSlide + nOffset;\n\ + this.id = sMasterPageId;\n\ + this.element = document.getElementById( this.id );\n\ + assert( this.element, 'MasterPage: master page element <' + this.id + '> not found.' );\n\ + this.background = getElementByClassName( this.element, 'Background' );\n\ + this.backgroundId = this.background.getAttribute( 'id' );\n\ + this.backgroundVisibility = initVisibilityProperty( this.background );\n\ + this.backgroundObjects = getElementByClassName( this.element, 'BackgroundObjects' );\n\ + this.backgroundObjectsId = this.backgroundObjects.getAttribute( 'id' );\n\ + this.backgroundObjectsVisibility = initVisibilityProperty( this.backgroundObjects );\n\ + this.aPlaceholderShapeSet = new Object();\n\ + this.initPlaceholderShapes();\n\ + }\n\ +\n\ + /*** MasterPage methods ***/\n\ + MasterPage.prototype =\n\ + {\n\ + /*** public method ***/\n\ + setVisibility : function( nVisibility )\n\ + {\n\ + this.backgroundObjectsVisibility = setElementVisibility( this.backgroundObjects, this.backgroundObjectsVisibility, nVisibility );\n\ + },\n\ +\n\ + setVisibilityBackground : function( nVisibility )\n\ + {\n\ + this.backgroundVisibility = setElementVisibility( this.background, this.backgroundVisibility, nVisibility );\n\ + },\n\ +\n\ + hide : function()\n\ + {\n\ + this.setVisibility( HIDDEN );\n\ + },\n\ +\n\ + show : function()\n\ + {\n\ + this.setVisibility( VISIBLE );\n\ + },\n\ +\n\ + hideBackground : function()\n\ + {\n\ + this.setVisibilityBackground( HIDDEN );\n\ + },\n\ +\n\ + showBackground : function()\n\ + {\n\ + this.setVisibilityBackground( VISIBLE );\n\ + },\n\ +\n\ + /*** private method ***/\n\ + initPlaceholderShapes : function()\n\ + {\n\ + this.aPlaceholderShapeSet[ aSlideNumberClassName ] = new PlaceholderShape( this, aSlideNumberClassName );\n\ + this.aPlaceholderShapeSet[ aDateTimeClassName ] = new PlaceholderShape( this, aDateTimeClassName );\n\ + this.aPlaceholderShapeSet[ aFooterClassName ] = new PlaceholderShape( this, aFooterClassName );\n\ + this.aPlaceholderShapeSet[ aHeaderClassName ] = new PlaceholderShape( this, aHeaderClassName );\n\ + }\n\ + };\n\ +\n\ + /** Class PlaceholderShape **\n\ + * This class manages the visibility and the text content of a placeholder shape.\n\ + */\n\ + function PlaceholderShape( aMasterPage, sClassName )\n\ + {\n\ + this.masterPage = aMasterPage;\n\ + this.className = sClassName;\n\ + this.element = null;\n\ + this.textElement = null;\n\ +\n\ + this.init();\n\ + }\n\ +\n\ + /* public methods */\n\ + PlaceholderShape.prototype.setTextContent = function( sText )\n\ + {\n\ +"; + +static const char aSVGScript3[] = +"\ + if( !this.textElement )\n\ + {\n\ + log( 'error: PlaceholderShape.setTextContent: text element is not valid in placeholder of type '\n\ + + this.className + ' that belongs to master slide ' + this.masterPage.id );\n\ + return;\n\ + }\n\ + this.textElement.textContent = sText;\n\ + };\n\ +\n\ + PlaceholderShape.prototype.setVisibility = function( nVisibility )\n\ + {\n\ + this.element.setAttribute( 'visibility', aVisibilityAttributeValue[nVisibility] );\n\ + };\n\ +\n\ + PlaceholderShape.prototype.show = function()\n\ + {\n\ + this.element.setAttribute( 'visibility', 'visible' );\n\ + };\n\ +\n\ + PlaceholderShape.prototype.hide = function()\n\ + {\n\ + this.element.setAttribute( 'visibility', 'hidden' );\n\ + };\n\ +\n\ + /* private methods */\n\ + PlaceholderShape.prototype.init = function()\n\ + {\n\ + var aShapeElem = getElementByClassName( this.masterPage.backgroundObjects, this.className );\n\ + if( !aShapeElem ) return;\n\ +\n\ + this.element = aShapeElem;\n\ + this.element.setAttribute( 'visibility', 'hidden' );\n\ +\n\ + this.textElement = getElementByClassName( this.element , 'PlaceholderText' );\n\ + if( !this.textElement ) return;\n\ +\n\ +\n\ + var aSVGRectElemSet = this.element.getElementsByTagName( 'rect' );\n\ + if( aSVGRectElemSet.length != 1) return;\n\ +\n\ + var aRect = new Rectangle( aSVGRectElemSet[0] );\n\ +\n\ + var sTextAdjust = getOOOAttribute( this.element, aOOOAttrTextAdjust ) || 'left';\n\ + var sTextAnchor, sX;\n\ + if( sTextAdjust == 'left' )\n\ + {\n\ + sTextAnchor = 'start';\n\ + sX = String( aRect.left );\n\ + }\n\ + else if( sTextAdjust == 'right' )\n\ + {\n\ + sTextAnchor = 'end';\n\ + sX = String( aRect.right );\n\ + }\n\ + else if( sTextAdjust == 'center' )\n\ + {\n\ + sTextAnchor = 'middle';\n\ + var nMiddle = ( aRect.left + aRect.right ) / 2;\n\ + sX = String( parseInt( String( nMiddle ) ) );\n\ + }\n\ +\n\ +\n\ + this.textElement.setAttribute( 'text-anchor', sTextAnchor );\n\ + this.textElement.setAttribute( 'x', sX );\n\ + };\n\ +\n\ +\n\ + // ------------------------------------------------------------------------------------------ //\n\ + /********************************\n\ + ** Text Field Class Hierarchy **\n\ + ********************************/\n\ +\n\ + /** Class TextField **\n\ + * This class is the root abstract class of the hierarchy.\n\ + * The 'shapeElement' property is the shape element to which\n\ + * this TextField object provides the text content.\n\ + */\n\ + function TextField( aTextFieldElem )\n\ + {\n\ + this.bIsUpdated = false;\n\ + }\n\ +\n\ + /*** TextField public methods ***/\n\ + TextField.prototype.getShapeElement = function()\n\ + {\n\ + return this.shapeElement;\n\ + };\n\ +\n\ + TextField.prototype.setVisibility = function( nVisibility, aPlaceholderShape )\n\ + {\n\ + if( !this.bIsUpdated )\n\ + {\n\ + if( nVisibility )\n\ + {\n\ + this.update( aPlaceholderShape );\n\ + this.bIsUpdated = true;\n\ + }\n\ + aPlaceholderShape.setVisibility( nVisibility );\n\ + }\n\ + else if( !nVisibility )\n\ + {\n\ + aPlaceholderShape.hide();\n\ + this.bIsUpdated = false;\n\ + }\n\ + };\n\ +\n\ + TextField.prototype.show = function( aPlaceholderShape )\n\ + {\n\ + this.setVisibility( VISIBLE, aPlaceholderShape );\n\ + };\n\ +\n\ + TextField.prototype.hide = function( aPlaceholderShape )\n\ + {\n\ + this.setVisibility( HIDDEN, aPlaceholderShape );\n\ + };\n\ +\n\ +\n\ + /** Class FixedTextField **\n\ + * This class handles text field with a fixed text.\n\ + * The text content is provided by the 'text' property.\n\ + */\n\ + function FixedTextField( aTextFieldElem )\n\ + {\n\ + TextField.call( this, aTextFieldElem );\n\ + this.text = aTextFieldElem.textContent;\n\ + }\n\ + extend( FixedTextField, TextField );\n\ +\n\ + FixedTextField.prototype.update = function( aPlaceholderShape )\n\ + {\n\ + aPlaceholderShape.setTextContent( this.text );\n\ + };\n\ +\n\ +\n\ + /** Class VariableDateTimeField **\n\ + * Provide the text content for the related shape by generating the current\n\ + * date/time in the format specified by the 'dateTimeFormat' property.\n\ + */\n\ + function VariableDateTimeField( aTextFieldElem )\n\ + {\n\ + VariableDateTimeField.superclass.constructor.call( this, aTextFieldElem );\n\ + this.dateTimeFormat = getOOOAttribute( aTextFieldElem, aOOOAttrDateTimeFormat );\n\ + }\n\ + extend( VariableDateTimeField, TextField );\n\ +\n\ + /*** public methods ***/\n\ + VariableDateTimeField.prototype.update = function( aPlaceholderShape )\n\ + {\n\ + var sText = this.createDateTimeText( this.dateTimeFormat );\n\ + aPlaceholderShape.setTextContent( sText );\n\ + };\n\ +\n\ + VariableDateTimeField.prototype.createDateTimeText = function( sDateTimeFormat )\n\ + {\n\ + // TODO handle date/time format\n\ + var aDate = Date();\n\ + var sDate = aDate.toLocaleString();\n\ + return sDate;\n\ + };\n\ +\n\ + /** Class SlideNumberField **\n\ + * Provides the text content to the related shape by generating\n\ + * the current page number in the given page numbering type.\n\ + */\n\ + function SlideNumberField( sPageNumberingType )\n\ + {\n\ + SlideNumberField.superclass.constructor.call( this, null );\n\ + this.pageNumberingType = sPageNumberingType;\n\ + }\n\ + extend( SlideNumberField, TextField );\n\ +\n\ + /*** public methods ***/\n\ + SlideNumberField.prototype.getNumberingType = function()\n\ + {\n\ + return this.pageNumberingType;\n\ + };\n\ \n\ - if( nNextSlide < 0 && nSlides > 0 )\n\ - nNextSlide = nSlides - 1;\n\ - else if( nNextSlide >= nSlides ) \n\ - nNextSlide = 0;\n\ + SlideNumberField.prototype.update = function( aPlaceholderShape )\n\ + {\n\ + var sText = this.createSlideNumberText( nCurSlide + 1, this.getNumberingType() );\n\ + aPlaceholderShape.setTextContent( sText );\n\ + };\n\ +\n\ + SlideNumberField.prototype.createSlideNumberText = function( nSlideNumber, sNumberingType )\n\ + {\n\ + // TODO handle page numbering type\n\ + return String( nSlideNumber );\n\ + };\n\ +\n\ +\n\ +\n\ + //------------------------------------------------------------------------------------------- //\n\ + /********************************\n\ + ** Slide Index Classes **\n\ + ********************************/\n\ +\n\ + /** Class SlideIndePagex **\n\ + * This class is responsible for handling the slide index page\n\ + */\n\ + function SlideIndexPage()\n\ +"; + +static const char aSVGScript4[] = +"\ + {\n\ + this.pageElementId = 'slide_index';\n\ + this.pageBgColor = 'rgb(252,252,252)';\n\ + this.pageElement = this.createPageElement();\n\ + assert( this.pageElement, 'SlideIndexPage: pageElement is not valid' );\n\ + this.indexColumns = INDEX_COLUMNS_DEFAULT;\n\ + this.totalThumbnails = this.indexColumns * this.indexColumns;\n\ + this.selectedSlideIndex = nCurSlide;\n\ +\n\ + // set up layout paramers\n\ + this.xSpacingFactor = 600/28000;\n\ + this.ySpacingFactor = 450/21000;\n\ + this.xSpacing = WIDTH * this.xSpacingFactor;\n\ + this.ySpacing = HEIGHT * this.ySpacingFactor;\n\ + this.halfBorderWidthFactor = ( 300/28000 ) * ( this.indexColumns / 3 );\n\ + this.halfBorderWidth = WIDTH * this.halfBorderWidthFactor;\n\ + this.borderWidth = 2 * this.halfBorderWidth;\n\ + // the following formula is used to compute the slide shrinking factor:\n\ + // scaleFactor = ( WIDTH - ( columns + 1 ) * xSpacing ) / ( columns * ( WIDTH + borderWidth ) )\n\ + // indeed we can divide everything by WIDTH:\n\ + this.scaleFactor = ( 1 - ( this.indexColumns + 1 ) * this.xSpacingFactor ) /\n\ + ( this.indexColumns * ( 1 + 2 * this.halfBorderWidthFactor ) );\n\ +\n\ + // We create a Thumbnail Border and Thumbnail MouseArea rectangle template that will be\n\ + // used by every Thumbnail. The Mouse Area rectangle is used in order to trigger the\n\ + // mouseover event properly even when the slide background is hidden.\n\ + this.thumbnailMouseAreaTemplateId = 'thumbnail_mouse_area';\n\ + this.thumbnailMouseAreaTemplateElement = null;\n\ + this.thumbnailBorderTemplateId = 'thumbnail_border';\n\ + this.thumbnailBorderTemplateElement = null;\n\ + this.createTemplateElements();\n\ +\n\ + // Now we create the grid of thumbnails\n\ + this.aThumbnailSet = new Array( this.totalThumbnails );\n\ + for( var i = 0; i < this.totalThumbnails; ++i )\n\ + {\n\ + this.aThumbnailSet[i] = new Thumbnail( this, i );\n\ + this.aThumbnailSet[i].updateView();\n\ + }\n\ +\n\ + this.curThumbnailIndex = this.selectedSlideIndex % this.totalThumbnails;\n\ + this.aThumbnailSet[ this.curThumbnailIndex ].select();\n\ + }\n\ +\n\ +\n\ + /* public methods */\n\ + SlideIndexPage.prototype.getTotalThumbnails = function()\n\ + {\n\ + return this.totalThumbnails;\n\ + };\n\ +\n\ + SlideIndexPage.prototype.show = function()\n\ + {\n\ + this.pageElement.setAttribute( 'display', 'inherit' );\n\ + };\n\ +\n\ + SlideIndexPage.prototype.hide = function()\n\ + {\n\ + this.pageElement.setAttribute( 'display', 'none' );\n\ + };\n\ +\n\ + /** setSelection\n\ + *\n\ + * Change the selected thumbnail from the current one to the thumbnail with index nIndex.\n\ + *\n\ + * @param nIndex - the thumbnail index\n\ + */\n\ + SlideIndexPage.prototype.setSelection = function( nIndex )\n\ + {\n\ + nIndex = getSafeIndex( nIndex, 0, this.getTotalThumbnails() - 1 );\n\ + if( this.curThumbnailIndex != nIndex )\n\ + {\n\ + this.aThumbnailSet[ this.curThumbnailIndex ].unselect();\n\ + this.aThumbnailSet[ nIndex ].select();\n\ + this.curThumbnailIndex = nIndex;\n\ + }\n\ + this.selectedSlideIndex = this.aThumbnailSet[ nIndex ].slideIndex;\n\ + };\n\ +\n\ + SlideIndexPage.prototype.createPageElement = function()\n\ + {\n\ + var aPageElement = document.createElementNS( NSS['svg'], 'g' );\n\ + aPageElement.setAttribute( 'id', this.pageElementId );\n\ + aPageElement.setAttribute( 'display', 'none' );\n\ +\n\ + // the slide index page background\n\ + var sPageBgColor = this.pageBgColor + ';';\n\ + var aRectElement = document.createElementNS( NSS['svg'], 'rect' );\n\ + aRectElement.setAttribute( 'x', 0 );\n\ + aRectElement.setAttribute( 'y', 0 );\n\ + aRectElement.setAttribute( 'width', WIDTH );\n\ + aRectElement.setAttribute( 'height', HEIGHT );\n\ + aRectElement.setAttribute( 'style', 'stroke:none;fill:' + sPageBgColor );\n\ +\n\ + aPageElement.appendChild( aRectElement );\n\ + // The index page is appended after all slide elements\n\ + // so when it is displayed it covers them all\n\ + ROOT_NODE.appendChild( aPageElement );\n\ + return( document.getElementById( this.pageElementId ) );\n\ + };\n\ +\n\ + SlideIndexPage.prototype.createTemplateElements = function()\n\ + {\n\ + // We define a Rect element as a template of thumbnail border for all slide-thumbnails.\n\ + // The stroke color is defined individually by each thumbnail according to\n\ + // its selection status.\n\ + var aDefsElement = document.createElementNS( NSS['svg'], 'defs' );\n\ + var aRectElement = document.createElementNS( NSS['svg'], 'rect' );\n\ + aRectElement.setAttribute( 'id', this.thumbnailBorderTemplateId );\n\ + aRectElement.setAttribute( 'x', -this.halfBorderWidth );\n\ + aRectElement.setAttribute( 'y', -this.halfBorderWidth );\n\ + aRectElement.setAttribute( 'rx', this.halfBorderWidth );\n\ + aRectElement.setAttribute( 'ry', this.halfBorderWidth );\n\ + aRectElement.setAttribute( 'width', WIDTH + this.halfBorderWidth );\n\ + aRectElement.setAttribute( 'height', HEIGHT + this.halfBorderWidth );\n\ + aRectElement.setAttribute( 'stroke-width', this.borderWidth );\n\ + aRectElement.setAttribute( 'fill', 'none' );\n\ + aDefsElement.appendChild( aRectElement );\n\ +\n\ + // We define a Rect element as a template of mouse area for triggering the mouseover event.\n\ + // A copy is used by each thumbnail element.\n\ + aRectElement = document.createElementNS( NSS['svg'], 'rect' );\n\ + aRectElement.setAttribute( 'id', this.thumbnailMouseAreaTemplateId );\n\ + aRectElement.setAttribute( 'x', 0 );\n\ + aRectElement.setAttribute( 'y', 0 );\n\ + aRectElement.setAttribute( 'width', WIDTH );\n\ + aRectElement.setAttribute( 'height', HEIGHT );\n\ + aRectElement.setAttribute( 'fill', this.pageBgColor );\n\ + aDefsElement.appendChild( aRectElement );\n\ +\n\ + this.pageElement.appendChild( aDefsElement );\n\ +\n\ + this.thumbnailMouseAreaTemplateElement = document.getElementById( this.thumbnailMouseAreaTemplateId );\n\ + this.thumbnailBorderTemplateElement = document.getElementById( this.thumbnailBorderTemplateId );\n\ + };\n\ +\n\ + SlideIndexPage.prototype.decreaseNumberOfColumns = function()\n\ + {\n\ + this.setNumberOfColumns( this.indexColumns - 1 );\n\ + };\n\ +\n\ + SlideIndexPage.prototype.increaseNumberOfColumns = function()\n\ + {\n\ + this.setNumberOfColumns( this.indexColumns + 1 );\n\ + };\n\ +\n\ + SlideIndexPage.prototype.resetNumberOfColumns = function()\n\ + {\n\ + this.setNumberOfColumns( INDEX_COLUMNS_DEFAULT );\n\ + };\n\ +\n\ + /** setNumberOfColumns\n\ + *\n\ + * Change the size of the thumbnail grid.\n\ + *\n\ + * @param nNumberOfColumns - the new number of columns/rows of the thumbnail grid\n\ + */\n\ + SlideIndexPage.prototype.setNumberOfColumns = function( nNumberOfColumns )\n\ + {\n\ + if( this.indexColumns == nNumberOfColumns ) return;\n\ + if( nNumberOfColumns < 2 || nNumberOfColumns > 6 ) return;\n\ +\n\ + var suspendHandle = ROOT_NODE.suspendRedraw(500);\n\ +\n\ + var nOldTotalThumbnails = this.totalThumbnails;\n\ + this.indexColumns = nNumberOfColumns;\n\ + this.totalThumbnails = nNumberOfColumns * nNumberOfColumns;;\n\ +\n\ + this.aThumbnailSet[this.curThumbnailIndex].unselect();\n\ +\n\ + // if we decreased the number of used columns we remove the exceding thumbnail elements\n\ + for( var i = this.totalThumbnails; i < nOldTotalThumbnails; ++i )\n\ + {\n\ + this.aThumbnailSet[i].removeElement();\n\ + };\n\ +\n\ + // if we increased the number of used columns we create the needed thumbnail objects\n\ + for( var i = nOldTotalThumbnails; i < this.totalThumbnails; ++i )\n\ + {\n\ + this.aThumbnailSet[i] = new Thumbnail( this, i );\n\ + };\n\ +\n\ + // we set up layout parameters that depend on the number of columns\n\ + this.halfBorderWidthFactor = ( 300/28000 ) * ( this.indexColumns / 3 );\n\ + this.halfBorderWidth = WIDTH * this.halfBorderWidthFactor;\n\ + this.borderWidth = 2 * this.halfBorderWidth;\n\ + // scaleFactor = ( WIDTH - ( columns + 1 ) * xSpacing ) / ( columns * ( WIDTH + borderWidth ) )\n\ + this.scaleFactor = ( 1 - ( this.indexColumns + 1 ) * this.xSpacingFactor ) /\n\ + ( this.indexColumns * ( 1 + 2 * this.halfBorderWidthFactor ) );\n\ +\n\ + // update the thumbnail border size\n\ + var aRectElement = this.thumbnailBorderTemplateElement;\n\ + aRectElement.setAttribute( 'x', -this.halfBorderWidth );\n\ + aRectElement.setAttribute( 'y', -this.halfBorderWidth );\n\ + aRectElement.setAttribute( 'rx', this.halfBorderWidth );\n\ + aRectElement.setAttribute( 'ry', this.halfBorderWidth );\n\ + aRectElement.setAttribute( 'width', WIDTH + this.halfBorderWidth );\n\ + aRectElement.setAttribute( 'height', HEIGHT + this.halfBorderWidth );\n\ + aRectElement.setAttribute( 'stroke-width', this.borderWidth );\n\ +\n\ +"; + +static const char aSVGScript5[] = +"\ + // now we update the displacement on the index page of each thumbnail (old and new)\n\ + for( var i = 0; i < this.totalThumbnails; ++i )\n\ + {\n\ + this.aThumbnailSet[i].updateView();\n\ + }\n\ +\n\ + this.curThumbnailIndex = this.selectedSlideIndex % this.totalThumbnails;\n\ + this.aThumbnailSet[this.curThumbnailIndex].select();\n\ +\n\ + // needed for forcing the indexSetPageSlide routine to update the INDEX_OFFSET\n\ + INDEX_OFFSET = -1;\n\ + indexSetPageSlide( this.selectedSlideIndex );\n\ +\n\ + ROOT_NODE.unsuspendRedraw( suspendHandle );\n\ + ROOT_NODE.forceRedraw();\n\ + };\n\ +\n\ +\n\ + /** Class Thumbnail **\n\ + * This class handles a slide thumbnail.\n\ + */\n\ + function Thumbnail( aSlideIndexPage, nIndex )\n\ + {\n\ + this.container = aSlideIndexPage;\n\ + this.index = nIndex;//= getSafeIndex( nIndex, 0, this.container.getTotalThumbnails() );\n\ + this.pageElement = this.container.pageElement;\n\ + this.thumbnailId = 'thumbnail' + this.index;\n\ + this.thumbnailElement = this.createThumbnailElement();\n\ + this.slideElement = getElementByClassName( this.thumbnailElement, 'Slide' );\n\ + this.backgroundElement = getElementByClassName( this.thumbnailElement, 'Background' );\n\ + this.backgroundObjectsElement = getElementByClassName( this.thumbnailElement, 'BackgroundObjects' );\n\ + this.borderElement = getElementByClassName( this.thumbnailElement, 'Border' );\n\ + this.aTransformSet = new Array( 3 );\n\ + this.visibility = VISIBLE;\n\ + this.isSelected = false;\n\ + };\n\ +\n\ + /* static const class member */\n\ + Thumbnail.prototype.sNormalBorderColor = 'rgb(216,216,216)';\n\ + Thumbnail.prototype.sSelectionBorderColor = 'rgb(92,92,255)';\n\ +\n\ + /* public methods */\n\ + Thumbnail.prototype.removeElement = function()\n\ + {\n\ + if( this.thumbnailElement )\n\ + this.container.pageElement.removeChild( this.thumbnailElement );\n\ + };\n\ +\n\ + Thumbnail.prototype.show = function()\n\ + {\n\ + if( this.visibility == HIDDEN )\n\ + {\n\ + this.thumbnailElement.setAttribute( 'display', 'inherit' );\n\ + this.visibility = VISIBLE;\n\ + }\n\ + };\n\ +\n\ + Thumbnail.prototype.hide = function()\n\ + {\n\ + if( this.visibility == VISIBLE )\n\ + {\n\ + this.thumbnailElement.setAttribute( 'display', 'none' );\n\ + this.visibility = HIDDEN;\n\ + }\n\ + };\n\ +\n\ + Thumbnail.prototype.select = function()\n\ + {\n\ + if( !this.isSelected )\n\ + {\n\ + this.borderElement.setAttribute( 'stroke', this.sSelectionBorderColor );\n\ + this.isSelected = true;\n\ + }\n\ + };\n\ +\n\ + Thumbnail.prototype.unselect = function()\n\ + {\n\ + if( this.isSelected )\n\ + {\n\ + this.borderElement.setAttribute( 'stroke', this.sNormalBorderColor );\n\ + this.isSelected = false;\n\ + }\n\ + };\n\ +\n\ + /** updateView\n\ + *\n\ + * This method updates the displacement of the thumbnail on the slide index page,\n\ + * the value of the row, column coordinates of the thumbnail in the grid, and\n\ + * the onmouseover property of the thumbnail element.\n\ + *\n\ + */\n\ + Thumbnail.prototype.updateView = function()\n\ + {\n\ + this.column = this.index % this.container.indexColumns;\n\ + this.row = ( this.index - this.column ) / this.container.indexColumns;\n\ + this.halfBorderWidth = this.container.halfBorderWidth;\n\ + this.borderWidth = this.container.borderWidth;\n\ + this.width = ( WIDTH + this.borderWidth ) * this.container.scaleFactor;\n\ + this.height = ( HEIGHT + this.borderWidth ) * this.container.scaleFactor;\n\ + this.aTransformSet[2] = 'translate(' + this.halfBorderWidth + ' ' + this.halfBorderWidth + ')';\n\ + this.aTransformSet[1] = 'scale(' + this.container.scaleFactor + ')';\n\ + var sTransformAttrValue = this.computeTransform();\n\ + this.thumbnailElement.setAttribute( 'transform', sTransformAttrValue );\n\ + this.thumbnailElement.setAttribute( 'onmouseover', 'theSlideIndexPage.aThumbnailSet[' + this.index + '].onMouseOver()' );\n\ + };\n\ +\n\ + /** update\n\ + *\n\ + * This method update the content of the thumbnail view\n\ + *\n\ + * @param nIndex - the index of the slide to be shown in the thumbnail\n\ + */\n\ + Thumbnail.prototype.update = function( nIndex )\n\ + {\n\ + if( this.slideIndex == nIndex ) return;\n\ +\n\ + var aMetaSlide = theMetaDoc.aMetaSlideSet[nIndex];\n\ + setNSAttribute( 'xlink', this.slideElement, 'href', '#' + aMetaSlide.slideId );\n\ + if( aMetaSlide.nIsBackgroundVisible )\n\ + {\n\ + setNSAttribute( 'xlink', this.backgroundElement, 'href', '#' + aMetaSlide.masterPage.backgroundId );\n\ + this.backgroundElement.setAttribute( 'visibility', 'inherit' );\n\ + }\n\ + else\n\ + {\n\ + this.backgroundElement.setAttribute( 'visibility', 'hidden' );\n\ + }\n\ + if( aMetaSlide.nAreMasterObjectsVisible )\n\ + {\n\ + setNSAttribute( 'xlink', this.backgroundObjectsElement, 'href', '#' + aMetaSlide.masterPage.backgroundObjectsId );\n\ + this.backgroundObjectsElement.setAttribute( 'visibility', 'inherit' );\n\ + }\n\ + else\n\ + {\n\ + this.backgroundObjectsElement.setAttribute( 'visibility', 'hidden' );\n\ + }\n\ + this.slideIndex = nIndex;\n\ + };\n\ +\n\ + Thumbnail.prototype.clear = function( nIndex )\n\ + {\n\ + setNSAttribute( 'xlink', this.slideElement, 'href', '' );\n\ + setNSAttribute( 'xlink', this.backgroundElement, 'href', '' );\n\ + setNSAttribute( 'xlink', this.backgroundObjectsElement, 'href', '' );\n\ + };\n\ +\n\ + /* private methods */\n\ + Thumbnail.prototype.createThumbnailElement = function()\n\ + {\n\ + var aThumbnailElement = document.createElementNS( NSS['svg'], 'g' );\n\ + aThumbnailElement.setAttribute( 'id', this.thumbnailId );\n\ + aThumbnailElement.setAttribute( 'display', 'inherit' );\n\ +\n\ + var aMouseAreaElement = document.createElementNS( NSS['svg'], 'use' );\n\ + setNSAttribute( 'xlink', aMouseAreaElement, 'href', '#' + this.container.thumbnailMouseAreaTemplateId );\n\ + aMouseAreaElement.setAttribute( 'class', 'MouseArea' );\n\ + aThumbnailElement.appendChild( aMouseAreaElement );\n\ +\n\ + var aBackgroundElement = document.createElementNS( NSS['svg'], 'use' );\n\ + setNSAttribute( 'xlink', aBackgroundElement, 'href', '' );\n\ + aBackgroundElement.setAttribute( 'visibility', 'inherit');\n\ + aBackgroundElement.setAttribute( 'class', 'Background' );\n\ + aThumbnailElement.appendChild( aBackgroundElement );\n\ +\n\ + var aBackgroundObjectsElement = document.createElementNS( NSS['svg'], 'use' );\n\ + setNSAttribute( 'xlink', aBackgroundObjectsElement, 'href', '' );\n\ + aBackgroundObjectsElement.setAttribute( 'visibility', 'inherit');\n\ + aBackgroundObjectsElement.setAttribute( 'class', 'BackgroundObjects' );\n\ + aThumbnailElement.appendChild( aBackgroundObjectsElement );\n\ +\n\ + var aSlideElement = document.createElementNS( NSS['svg'], 'use' );\n\ + setNSAttribute( 'xlink', aSlideElement, 'href', '' );\n\ + aSlideElement.setAttribute( 'class', 'Slide' );\n\ + aThumbnailElement.appendChild( aSlideElement );\n\ +\n\ + var aBorderElement = document.createElementNS( NSS['svg'], 'use' );\n\ + setNSAttribute( 'xlink', aBorderElement, 'href', '#' + this.container.thumbnailBorderTemplateId );\n\ + aBorderElement.setAttribute( 'stroke', this.sNormalBorderColor );\n\ + aBorderElement.setAttribute( 'class', 'Border' );\n\ + aThumbnailElement.appendChild( aBorderElement );\n\ +\n\ + this.container.pageElement.appendChild( aThumbnailElement );\n\ + return( document.getElementById( this.thumbnailId ) );\n\ + };\n\ +\n\ + Thumbnail.prototype.computeTransform = function()\n\ + {\n\ + var nXSpacing = this.container.xSpacing;\n\ + var nYSpacing = this.container.ySpacing;\n\ +\n\ + var nXOffset = nXSpacing + ( this.width + nXSpacing ) * this.column;\n\ + var nYOffset = nYSpacing + ( this.height + nYSpacing ) * this.row;\n\ +\n\ + this.aTransformSet[0] = 'translate(' + nXOffset + ' ' + nYOffset + ')';\n\ +\n\ + sTransform = this.aTransformSet.join( ' ' );\n\ +\n\ + return sTransform;\n\ + };\n\ +\n\ +"; + +static const char aSVGScript6[] = +"\ + Thumbnail.prototype.onMouseOver = function()\n\ + {\n\ + if( ( currentMode == INDEX_MODE ) && ( this.container.curThumbnailIndex != this.index ) )\n\ + {\n\ + this.container.setSelection( this.index );\n\ + }\n\ + };\n\ +\n\ +\n\ +\n\ +\n\ + // ------------------------------------------------------------------------------------------ //\n\ + /** Initialization function.\n\ + * The whole presentation is set-up in this function.\n\ + */\n\ + function init()\n\ + {\n\ \n\ - aSlides[ nCurSlide ].setAttributeNS( null, \"visibility\", \"hidden\" );\n\ - aSlides[ nNextSlide ].setAttributeNS( null, \"visibility\", \"visible\" );\n\ + var VIEWBOX = ROOT_NODE.getAttribute('viewBox');\n\ \n\ - var aCurMaster = aMasters[ nCurSlide ];\n\ - var aCurMasterVisibility = aMasterVisibilities[ nCurSlide ];\n\ - \n\ - var aNextMaster = aMasters[ nNextSlide ];\n\ - var aNextMasterVisibility = aMasterVisibilities[ nNextSlide ];\n\ + if( VIEWBOX )\n\ + {\n\ + WIDTH = ROOT_NODE.viewBox.animVal.width;\n\ + HEIGHT = ROOT_NODE.viewBox.animVal.height;\n\ + }\n\ +\n\ + var aMetaDocElem = document.getElementById( aOOOElemMetaSlides );\n\ + assert( aMetaDocElem, 'init: meta document element not found' );\n\ + theMetaDoc = new MetaDocument( aMetaDocElem );\n\ + theSlideIndexPage = new SlideIndexPage();\n\ +\n\ +\n\ + }\n\ +\n\ + function presentationEngineStop()\n\ + {\n\ + alert( 'We are sorry! An unexpected error occurred.\\nThe presentation engine will be stopped' );\n\ + document.onkeydown = null;\n\ + document.onkeypress = null;\n\ + document.onclick = null;\n\ + window.onmousewheel = null;\n\ + }\n\ +\n\ + function assert( condition, message )\n\ + {\n\ + if (!condition)\n\ + {\n\ + presentationEngineStop();\n\ + if (typeof console == 'object')\n\ + console.trace();\n\ + throw new Error( message );\n\ + }\n\ + }\n\ +\n\ + /** Event handler for key press.\n\ + *\n\ + * @param aEvt the event\n\ + */\n\ + function onKeyDown( aEvt )\n\ + {\n\ + if ( !aEvt )\n\ + aEvt = window.event;\n\ +\n\ + code = aEvt.keyCode || aEvt.charCode;\n\ +\n\ + if ( !processingEffect && keyCodeDictionary[currentMode] && keyCodeDictionary[currentMode][code] )\n\ + return keyCodeDictionary[currentMode][code]();\n\ + else\n\ + document.onkeypress = onKeyPress;\n\ + }\n\ + // Set event handler for key down.\n\ + document.onkeydown = onKeyDown;\n\ +\n\ + /** Event handler for key press.\n\ + *\n\ + * @param aEvt the event\n\ + */\n\ + function onKeyPress( aEvt )\n\ + {\n\ + document.onkeypress = null;\n\ +\n\ + if ( !aEvt )\n\ + aEvt = window.event;\n\ +\n\ + str = String.fromCharCode( aEvt.keyCode || aEvt.charCode );\n\ +\n\ + if ( !processingEffect && charCodeDictionary[currentMode] && charCodeDictionary[currentMode][str] )\n\ + return charCodeDictionary[currentMode][str]();\n\ + }\n\ +\n\ + /** Function to supply the default key code dictionary.\n\ + *\n\ + * @returns default key code dictionary\n\ + */\n\ + function getDefaultKeyCodeDictionary()\n\ + {\n\ + var keyCodeDict = new Object();\n\ +\n\ + keyCodeDict[SLIDE_MODE] = new Object();\n\ + keyCodeDict[INDEX_MODE] = new Object();\n\ +\n\ + keyCodeDict[SLIDE_MODE][LEFT_KEY] = function() { return dispatchEffects(-1); };\n\ + keyCodeDict[SLIDE_MODE][RIGHT_KEY] = function() { return dispatchEffects(1); };\n\ + keyCodeDict[SLIDE_MODE][UP_KEY] = function() { return skipEffects(-1); };\n\ + keyCodeDict[SLIDE_MODE][DOWN_KEY] = function() { return skipEffects(1); };\n\ + keyCodeDict[SLIDE_MODE][PAGE_UP_KEY] = function() { return dispatchEffects(-1); };\n\ + keyCodeDict[SLIDE_MODE][PAGE_DOWN_KEY] = function() { return dispatchEffects(1); };\n\ + keyCodeDict[SLIDE_MODE][HOME_KEY] = function() { return slideSetActiveSlide(0); };\n\ + keyCodeDict[SLIDE_MODE][END_KEY] = function() { return slideSetActiveSlide(theMetaDoc.nNumberOfSlides - 1); };\n\ + keyCodeDict[SLIDE_MODE][SPACE_KEY] = function() { return dispatchEffects(1); };\n\ +\n\ + keyCodeDict[INDEX_MODE][LEFT_KEY] = function() { return indexSetPageSlide( theSlideIndexPage.selectedSlideIndex - 1 ); };\n\ + keyCodeDict[INDEX_MODE][RIGHT_KEY] = function() { return indexSetPageSlide( theSlideIndexPage.selectedSlideIndex + 1 ); };\n\ + keyCodeDict[INDEX_MODE][UP_KEY] = function() { return indexSetPageSlide( theSlideIndexPage.selectedSlideIndex - theSlideIndexPage.indexColumns ); };\n\ + keyCodeDict[INDEX_MODE][DOWN_KEY] = function() { return indexSetPageSlide( theSlideIndexPage.selectedSlideIndex + theSlideIndexPage.indexColumns ); };\n\ + keyCodeDict[INDEX_MODE][PAGE_UP_KEY] = function() { return indexSetPageSlide( theSlideIndexPage.selectedSlideIndex - theSlideIndexPage.getTotalThumbnails() ); };\n\ + keyCodeDict[INDEX_MODE][PAGE_DOWN_KEY] = function() { return indexSetPageSlide( theSlideIndexPage.selectedSlideIndex + theSlideIndexPage.getTotalThumbnails() ); };\n\ + keyCodeDict[INDEX_MODE][HOME_KEY] = function() { return indexSetPageSlide( 0 ); };\n\ + keyCodeDict[INDEX_MODE][END_KEY] = function() { return indexSetPageSlide( theMetaDoc.nNumberOfSlides - 1 ); };\n\ + keyCodeDict[INDEX_MODE][ENTER_KEY] = function() { return toggleSlideIndex(); };\n\ + keyCodeDict[INDEX_MODE][SPACE_KEY] = function() { return toggleSlideIndex(); };\n\ + keyCodeDict[INDEX_MODE][ESCAPE_KEY] = function() { return abandonIndexMode(); };\n\ +\n\ + return keyCodeDict;\n\ + }\n\ +\n\ + /** Function to supply the default char code dictionary.\n\ + *\n\ + * @returns default char code dictionary\n\ + */\n\ + function getDefaultCharCodeDictionary()\n\ + {\n\ + var charCodeDict = new Object();\n\ +\n\ + charCodeDict[SLIDE_MODE] = new Object();\n\ + charCodeDict[INDEX_MODE] = new Object();\n\ +\n\ + charCodeDict[SLIDE_MODE]['i'] = function () { return toggleSlideIndex(); };\n\ +\n\ + charCodeDict[INDEX_MODE]['i'] = function () { return toggleSlideIndex(); };\n\ + charCodeDict[INDEX_MODE]['-'] = function () { return theSlideIndexPage.decreaseNumberOfColumns(); };\n\ + charCodeDict[INDEX_MODE]['='] = function () { return theSlideIndexPage.increaseNumberOfColumns(); };\n\ + charCodeDict[INDEX_MODE]['+'] = function () { return theSlideIndexPage.increaseNumberOfColumns(); };\n\ + charCodeDict[INDEX_MODE]['0'] = function () { return theSlideIndexPage.resetNumberOfColumns(); };\n\ +\n\ + return charCodeDict;\n\ + }\n\ +\n\ +\n\ + function slideOnMouseDown( aEvt )\n\ + {\n\ + if (!aEvt)\n\ + aEvt = window.event;\n\ +\n\ + var nOffset = 0;\n\ +\n\ + if( aEvt.button == 0 )\n\ + nOffset = 1;\n\ + else if( aEvt.button == 2 )\n\ + nOffset = -1;\n\ +\n\ + if( 0 != nOffset )\n\ + switchSlide( nOffset );\n\ + }\n\ +\n\ + /** Event handler for mouse wheel events in slide mode.\n\ + * based on http://adomas.org/javascript-mouse-wheel/\n\ + *\n\ + * @param aEvt the event\n\ + */\n\ + function slideOnMouseWheel(aEvt)\n\ + {\n\ + var delta = 0;\n\ +\n\ + if (!aEvt)\n\ + aEvt = window.event;\n\ +\n\ + if (aEvt.wheelDelta)\n\ + { // IE Opera\n\ + delta = aEvt.wheelDelta/120;\n\ + }\n\ + else if (aEvt.detail)\n\ + { // MOZ\n\ + delta = -aEvt.detail/3;\n\ + }\n\ +\n\ + if (delta > 0)\n\ + skipEffects(-1);\n\ + else if (delta < 0)\n\ + skipEffects(1);\n\ +\n\ + if (aEvt.preventDefault)\n\ + aEvt.preventDefault();\n\ +\n\ + aEvt.returnValue = false;\n\ + }\n\ \n\ - if( ( aCurMaster != aNextMaster ) || ( aCurMasterVisibility != aNextMasterVisibility ) ) \n\ + // Mozilla\n\ + if( window.addEventListener )\n\ + {\n\ +"; + +static const char aSVGScript7[] = +"\ + window.addEventListener( 'DOMMouseScroll', function( aEvt ) { return mouseHandlerDispatch( aEvt, MOUSE_WHEEL ); }, false );\n\ + }\n\ +\n\ + // Opera Safari OK - may not work in IE\n\ + window.onmousewheel = function( aEvt ) { return mouseHandlerDispatch( aEvt, MOUSE_WHEEL ); };\n\ +\n\ + /** Function to handle all mouse events.\n\ + *\n\ + * @param aEvt event\n\ + * @param anAction type of event (e.g. mouse up, mouse wheel)\n\ + */\n\ + function mouseHandlerDispatch( aEvt, anAction )\n\ + {\n\ + if( !aEvt )\n\ + aEvt = window.event;\n\ +\n\ + var retVal = true;\n\ +\n\ + if ( mouseHandlerDictionary[currentMode] && mouseHandlerDictionary[currentMode][anAction] )\n\ {\n\ - if( aCurMaster != aNextMaster )\n\ - aCurMaster.setAttributeNS( null, \"visibility\", \"hidden\" );\n\ - \n\ - aNextMaster.setAttributeNS( null, \"visibility\", aNextMasterVisibility );\n\ + var subRetVal = mouseHandlerDictionary[currentMode][anAction]( aEvt );\n\ +\n\ + if( subRetVal != null && subRetVal != undefined )\n\ + retVal = subRetVal;\n\ }\n\ \n\ - nCurSlide = nNextSlide; \n\ + if( aEvt.preventDefault && !retVal )\n\ + aEvt.preventDefault();\n\ +\n\ + aEvt.returnValue = retVal;\n\ +\n\ + return retVal;\n\ + }\n\ +\n\ + // Set mouse event handler.\n\ + document.onmousedown = function( aEvt ) { return mouseHandlerDispatch( aEvt, MOUSE_DOWN ); };\n\ + //document.onmousemove = function( aEvt ) { return mouseHandlerDispatch( aEvt, MOUSE_MOVE ); };\n\ +\n\ + /** Function to supply the default mouse handler dictionary.\n\ + *\n\ + * @returns default mouse handler dictionary\n\ + */\n\ + function getDefaultMouseHandlerDictionary()\n\ + {\n\ + var mouseHandlerDict = new Object();\n\ +\n\ + mouseHandlerDict[SLIDE_MODE] = new Object();\n\ + mouseHandlerDict[INDEX_MODE] = new Object();\n\ +\n\ +\n\ + mouseHandlerDict[SLIDE_MODE][MOUSE_DOWN] = function( aEvt ) { return slideOnMouseDown( aEvt ); };\n\ + mouseHandlerDict[SLIDE_MODE][MOUSE_WHEEL] = function( aEvt ) { return slideOnMouseWheel( aEvt ); };\n\ +\n\ + mouseHandlerDict[INDEX_MODE][MOUSE_DOWN] = function( aEvt ) { return toggleSlideIndex(); };\n\ +\n\ + return mouseHandlerDict;\n\ + }\n\ +\n\ + /** Function to dispatch the next effect, if there is none left, change the slide.\n\ + *\n\ + * @param dir direction of the change (1 = forwards, -1 = backwards)\n\ + */\n\ + function dispatchEffects(dir)\n\ + {\n\ + // TODO to be implemented\n\ + switchSlide(dir);\n\ + }\n\ +\n\ + /** Function to skip effects and directly either put the slide into start or end state or change slides.\n\ + *\n\ + * @param dir direction of the change (1 = forwards, -1 = backwards)\n\ + */\n\ + function skipEffects(dir)\n\ + {\n\ + // TODO to be implemented\n\ + switchSlide(dir);\n\ + }\n\ +\n\ + /** Function to change between slides.\n\ + *\n\ + * @param nOffset direction (1 = forwards, -1 = backwards)\n\ + */\n\ + function switchSlide( nOffset )\n\ + {\n\ + var nNextSlide = nCurSlide + nOffset;\n\ + slideSetActiveSlide( nNextSlide );\n\ }\n\ \n\ - function init() \n\ + /** Function to display the index sheet.\n\ + *\n\ + * @param offsetNumber offset number\n\ + */\n\ + function displayIndex( offsetNumber )\n\ + {\n\ + var aMetaSlideSet = theMetaDoc.aMetaSlideSet;\n\ + offsetNumber = getSafeIndex( offsetNumber, 0, aMetaSlideSet.length - 1 );\n\ +\n\ + var nTotalThumbnails = theSlideIndexPage.getTotalThumbnails();\n\ + var nEnd = Math.min( offsetNumber + nTotalThumbnails, aMetaSlideSet.length);\n\ +\n\ + var aThumbnailSet = theSlideIndexPage.aThumbnailSet;\n\ + var j = 0;\n\ + for( var i = offsetNumber; i < nEnd; ++i, ++j )\n\ + {\n\ + aThumbnailSet[j].update( i );\n\ + aThumbnailSet[j].show();\n\ + }\n\ + for( ; j < nTotalThumbnails; ++j )\n\ + {\n\ + aThumbnailSet[j].hide();\n\ + }\n\ +\n\ + //do we need to save the current offset?\n\ + if (INDEX_OFFSET != offsetNumber)\n\ + INDEX_OFFSET = offsetNumber;\n\ + }\n\ +\n\ + /** Function to set the active slide in the slide view.\n\ + *\n\ + * @param nNewSlide index of the active slide\n\ + */\n\ + function slideSetActiveSlide( nNewSlide )\n\ {\n\ - nSlides = document.getElementById( \"meta_slides\" ).getAttributeNS( null, \"numberOfSlides\" );\n\ + var aMetaDoc = theMetaDoc;\n\ + var nSlides = aMetaDoc.nNumberOfSlides;\n\ + if( nNewSlide < 0 && nSlides > 0 )\n\ + nNewSlide = nSlides - 1;\n\ + else if( nNewSlide >= nSlides )\n\ + nNewSlide = 0;\n\ +\n\ + if( nNewSlide == nCurSlide ) return;\n\ + var nOldSlide = nCurSlide;\n\ + nCurSlide = nNewSlide;\n\ +\n\ + var oldMetaSlide = aMetaDoc.aMetaSlideSet[nOldSlide];\n\ + var newMetaSlide = aMetaDoc.aMetaSlideSet[nNewSlide];\n\ +\n\ + oldMetaSlide.hide();\n\ + newMetaSlide.show();\n\ + }\n\ +\n\ + /** Function to set the page and active slide in index view.\n\ + *\n\ + * @param nIndex index of the active slide\n\ + *\n\ + * NOTE: To force a redraw,\n\ + * set INDEX_OFFSET to -1 before calling indexSetPageSlide().\n\ + *\n\ + * This is necessary for zooming (otherwise the index might not\n\ + * get redrawn) and when switching to index mode.\n\ + *\n\ + * INDEX_OFFSET = -1\n\ + * indexSetPageSlide(activeSlide);\n\ + */\n\ + function indexSetPageSlide( nIndex )\n\ + {\n\ + var aMetaSlideSet = theMetaDoc.aMetaSlideSet;\n\ + nIndex = getSafeIndex( nIndex, 0, aMetaSlideSet.length - 1 );\n\ +\n\ + //calculate the offset\n\ + var nSelectedThumbnailIndex = nIndex % theSlideIndexPage.getTotalThumbnails();\n\ + var offset = nIndex - nSelectedThumbnailIndex;\n\ +\n\ + if( offset < 0 )\n\ + offset = 0;\n\ +\n\ + //if different from kept offset, then record and change the page\n\ + if( offset != INDEX_OFFSET )\n\ + {\n\ + INDEX_OFFSET = offset;\n\ + displayIndex( INDEX_OFFSET );\n\ + }\n\ +\n\ + //set the selected thumbnail and the current slide\n\ + theSlideIndexPage.setSelection( nSelectedThumbnailIndex );\n\ + }\n\ \n\ - for( i = 0; i < nSlides; i++ )\n\ + /** Function to toggle between index and slide mode.\n\ + */\n\ + function toggleSlideIndex()\n\ + {\n\ + var suspendHandle = ROOT_NODE.suspendRedraw(500);\n\ + var aMetaSlideSet = theMetaDoc.aMetaSlideSet;\n\ +\n\ + if (currentMode == SLIDE_MODE)\n\ + {\n\ + aMetaSlideSet[nCurSlide].hide();\n\ + for( var counter = 0; counter < aMetaSlideSet.length; ++counter )\n\ + {\n\ + checkElemAndSetAttribute( aMetaSlideSet[counter].slideElement, 'visibility', 'inherit' );\n\ + aMetaSlideSet[counter].masterPage.setVisibilityBackground( INHERIT );\n\ + aMetaSlideSet[counter].masterPage.setVisibility( INHERIT );\n\ + }\n\ + INDEX_OFFSET = -1;\n\ + indexSetPageSlide( nCurSlide );\n\ + theSlideIndexPage.show();\n\ + currentMode = INDEX_MODE;\n\ + }\n\ + else if (currentMode == INDEX_MODE)\n\ {\n\ - var aSlide = document.getElementById( \"meta_slide\" + i );\n\ - \n\ - aSlides[ i ] = document.getElementById( aSlide.getAttributeNS( null, \"slide\" ) );\n\ - aMasters[ i ] = document.getElementById( aSlide.getAttributeNS( null, \"master\" ) );\n\ - aMasterVisibilities[ i ] = aSlide.getAttributeNS( null, \"master-visibility\" );\n\ +"; + +static const char aSVGScript8[] = +"\ + theSlideIndexPage.hide();\n\ + nCurSlide = theSlideIndexPage.selectedSlideIndex;\n\ +\n\ + for( var counter = 0; counter < aMetaSlideSet.length; ++counter )\n\ + {\n\ + var aMetaSlide = aMetaSlideSet[counter];\n\ + aMetaSlide.slideElement.setAttribute( 'visibility', 'hidden' );\n\ + aMetaSlide.masterPage.setVisibilityBackground( HIDDEN );\n\ + aMetaSlide.masterPage.setVisibility( HIDDEN );\n\ + }\n\ +\n\ + aMetaSlideSet[nCurSlide].show();\n\ + //activeEffect = 0;\n\ +\n\ + currentMode = SLIDE_MODE;\n\ + //setSlideToState(nCurSlide, STATE_START);\n\ }\n\ +\n\ + ROOT_NODE.unsuspendRedraw(suspendHandle);\n\ + ROOT_NODE.forceRedraw();\n\ }\n\ \n\ - init();\n\ + /** Function that exit from the index mode without changing the shown slide\n\ + *\n\ + */\n\ + function abandonIndexMode()\n\ + {\n\ + theSlideIndexPage.selectedSlideIndex = nCurSlide;\n\ + toggleSlideIndex();\n\ + }\n\ ]]>"; + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index 56b5af4fba0d..364036f35fb1 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -32,6 +32,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_filter.hxx" +#include "svgfilter.hxx" #include "svgfontexport.hxx" #include "svgwriter.hxx" #include <vcl/unohelp.hxx> @@ -1174,67 +1175,101 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const String& rText, mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTransform, aTransform ); } + mpContext->AddPaintAttr( COL_TRANSPARENT, aTextColor ); - if( nLen > 1 ) - { - aNormSize.Width() = pDX[ nLen - 2 ] + mpVDev->GetTextWidth( rText.GetChar( nLen - 1 ) ); + // for each line of text there should be at least one group element + SvXMLElementExport aSVGGElem( mrExport, XML_NAMESPACE_NONE, aXMLElemG, sal_True, sal_False ); - if( nWidth && aNormSize.Width() && ( nWidth != aNormSize.Width() ) ) - { - const double fFactor = (double) nWidth / aNormSize.Width(); + sal_Bool bIsPlaceholderField = sal_False; - for( long i = 0; i < ( nLen - 1 ); i++ ) - pDX[ i ] = FRound( pDX[ i ] * fFactor ); + if( mbIsPlacehlolderShape ) + { + OUString sTextContent = rText; + bIsPlaceholderField = sTextContent.match( sPlaceholderTag ); + // for a placeholder text field we export only one <text> svg element + if( bIsPlaceholderField ) + { + OUString sCleanTextContent; + static const sal_Int32 nFrom = sPlaceholderTag.getLength(); + if( sTextContent.getLength() > nFrom ) + { + sCleanTextContent = sTextContent.copy( nFrom ); + } + mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", B2UCONST( "PlaceholderText" ) ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, ::rtl::OUString::valueOf( aPos.X() ) ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, ::rtl::OUString::valueOf( aPos.Y() ) ); + { + SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemText, sal_True, sal_False ); + // At least for the single slide case we need really to export placeholder text + mrExport.GetDocHandler()->characters( sCleanTextContent ); + } } - else + } + + if( !bIsPlaceholderField ) + { + if( nLen > 1 ) { - ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > xBI( ::vcl::unohelper::CreateBreakIterator() ); - const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetLocale(); - sal_Int32 nCurPos = 0, nLastPos = 0, nX = aPos.X(); + aNormSize.Width() = pDX[ nLen - 2 ] + mpVDev->GetTextWidth( rText.GetChar( nLen - 1 ) ); - // write single glyphs at absolute text positions - for( sal_Bool bCont = sal_True; bCont; ) + if( nWidth && aNormSize.Width() && ( nWidth != aNormSize.Width() ) ) { - sal_Int32 nCount = 1; - - nLastPos = nCurPos; - nCurPos = xBI->nextCharacters( rText, nCurPos, rLocale, - ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, - nCount, nCount ); + const double fFactor = (double) nWidth / aNormSize.Width(); - nCount = nCurPos - nLastPos; - bCont = ( nCurPos < rText.Len() ) && nCount; + for( long i = 0; i < ( nLen - 1 ); i++ ) + pDX[ i ] = FRound( pDX[ i ] * fFactor ); + } + else + { + ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > xBI( ::vcl::unohelper::CreateBreakIterator() ); + const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetLocale(); + sal_Int32 nCurPos = 0, nLastPos = 0, nX = aPos.X(); - if( nCount ) + // write single glyphs at absolute text positions + for( sal_Bool bCont = sal_True; bCont; ) { - const ::rtl::OUString aGlyph( rText.Copy( nLastPos, nCount ) ); + sal_Int32 nCount = 1; + + nLastPos = nCurPos; + nCurPos = xBI->nextCharacters( rText, nCurPos, rLocale, + ::com::sun::star::i18n::CharacterIteratorMode::SKIPCELL, + nCount, nCount ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, ::rtl::OUString::valueOf( nX ) ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, ::rtl::OUString::valueOf( aPos.Y() ) ); + nCount = nCurPos - nLastPos; + bCont = ( nCurPos < rText.Len() ) && nCount; + if( nCount ) { - SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemText, sal_True, sal_False ); - mrExport.GetDocHandler()->characters( aGlyph ); - } + const ::rtl::OUString aGlyph( rText.Copy( nLastPos, nCount ) ); + + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, ::rtl::OUString::valueOf( nX ) ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, ::rtl::OUString::valueOf( aPos.Y() ) ); + + { + SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemText, sal_True, sal_False ); + mrExport.GetDocHandler()->characters( aGlyph ); + } - if( bCont ) - nX = aPos.X() + pDXArray[ nCurPos - 1 ]; + if( bCont ) + nX = aPos.X() + pDXArray[ nCurPos - 1 ]; + } } } } - } - else - { - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, ::rtl::OUString::valueOf( aPos.X() ) ); - mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, ::rtl::OUString::valueOf( aPos.Y() ) ); - + else { - SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemText, sal_True, sal_False ); - mrExport.GetDocHandler()->characters( rText ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, ::rtl::OUString::valueOf( aPos.X() ) ); + mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, ::rtl::OUString::valueOf( aPos.Y() ) ); + + { + SvXMLElementExport aElem( mrExport, XML_NAMESPACE_NONE, aXMLElemText, sal_True, sal_False ); + mrExport.GetDocHandler()->characters( rText ); + } } } + if( !mrExport.IsUseNativeTextDecoration() ) { if( rFont.GetStrikeout() != STRIKEOUT_NONE || rFont.GetUnderline() != UNDERLINE_NONE ) @@ -1332,6 +1367,14 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, if( mnInnerMtfCount ) nWriteFlags |= SVGWRITER_NO_SHAPE_COMMENTS; + mbIsPlacehlolderShape = false; + if( pElementId != NULL && ( *pElementId == sPlaceholderTag ) ) + { + mbIsPlacehlolderShape = true; + // since we utilize pElementId in an improper way we reset it to NULL before to go on + pElementId = NULL; + } + for( sal_uLong nCurAction = 0, nCount = rMtf.GetActionSize(); nCurAction < nCount; nCurAction++ ) { const MetaAction* pAction = rMtf.GetAction( nCurAction ); @@ -1840,7 +1883,10 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, ImplMap( Size( 0, aFont.GetHeight() ), aSz ); aFont.SetHeight( aSz.Height() ); - mpContext->AddPaintAttr( COL_TRANSPARENT, mpVDev->GetTextColor() ); + // lead to a browser error since it duplicates the stroke and + // the fill attributes on the first glyph of each line when + // the text font is the same + //mpContext->AddPaintAttr( COL_TRANSPARENT, mpVDev->GetTextColor() ); mpContext->SetFontAttr( aFont ); ImplWriteText( pA->GetPoint(), aText, NULL, 0 ); } @@ -1862,7 +1908,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, ImplMap( Size( 0, aFont.GetHeight() ), aSz ); aFont.SetHeight( aSz.Height() ); - mpContext->AddPaintAttr( COL_TRANSPARENT, mpVDev->GetTextColor() ); + //mpContext->AddPaintAttr( COL_TRANSPARENT, mpVDev->GetTextColor() ); mpContext->SetFontAttr( aFont ); ImplWriteText( pA->GetRect().TopLeft(), pA->GetText(), NULL, 0 ); } @@ -1885,7 +1931,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, ImplMap( Size( 0, aFont.GetHeight() ), aSz ); aFont.SetHeight( aSz.Height() ); - mpContext->AddPaintAttr( COL_TRANSPARENT, mpVDev->GetTextColor() ); + //mpContext->AddPaintAttr( COL_TRANSPARENT, mpVDev->GetTextColor() ); mpContext->SetFontAttr( aFont ); ImplWriteText( pA->GetPoint(), aText, pA->GetDXArray(), 0 ); } @@ -1908,7 +1954,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf, ImplMap( Size( 0, aFont.GetHeight() ), aSz ); aFont.SetHeight( aSz.Height() ); - mpContext->AddPaintAttr( COL_TRANSPARENT, mpVDev->GetTextColor() ); + //mpContext->AddPaintAttr( COL_TRANSPARENT, mpVDev->GetTextColor() ); mpContext->SetFontAttr( aFont ); ImplWriteText( pA->GetPoint(), aText, NULL, pA->GetWidth() ); } diff --git a/filter/source/svg/svgwriter.hxx b/filter/source/svg/svgwriter.hxx index b21d86095700..91a605a20b93 100644 --- a/filter/source/svg/svgwriter.hxx +++ b/filter/source/svg/svgwriter.hxx @@ -80,17 +80,17 @@ #define NMSP_REGISTRY com::sun::star::registry -#define REF( _def_Obj ) NMSP_UNO::Reference< _def_Obj > -#define SEQ( _def_Obj ) NMSP_UNO::Sequence< _def_Obj > -#define B2UCONST( _def_pChar ) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(_def_pChar ))) -#define SVG_DTD_STRING B2UCONST( "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">" ) +#define REF( _def_Obj ) NMSP_UNO::Reference< _def_Obj > +#define SEQ( _def_Obj ) NMSP_UNO::Sequence< _def_Obj > +#define B2UCONST( _def_pChar ) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(_def_pChar ))) +#define SVG_DTD_STRING B2UCONST( "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">" ) #define SVG_TINY_DTD_STRING B2UCONST( "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG Tiny 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd\">" ) -#define SVGWRITER_WRITE_NONE 0x00000000 -#define SVGWRITER_WRITE_FILL 0x00000001 -#define SVGWRITER_WRITE_TEXT 0x00000002 +#define SVGWRITER_WRITE_NONE 0x00000000 +#define SVGWRITER_WRITE_FILL 0x00000001 +#define SVGWRITER_WRITE_TEXT 0x00000002 #define SVGWRITER_NO_SHAPE_COMMENTS 0x01000000 -#define SVGWRITER_WRITE_ALL 0xFFFFFFFF +#define SVGWRITER_WRITE_ALL 0xFFFFFFFF // ---------------------- // - SVGAttributeWriter - @@ -104,13 +104,13 @@ class SVGAttributeWriter { private: - Font maCurFont; - Color maCurLineColor; - Color maCurFillColor; - SVGExport& mrExport; - SVGFontExport& mrFontExport; - SvXMLElementExport* mpElemFont; - SvXMLElementExport* mpElemPaint; + Font maCurFont; + Color maCurLineColor; + Color maCurFillColor; + SVGExport& mrExport; + SVGFontExport& mrFontExport; + SvXMLElementExport* mpElemFont; + SvXMLElementExport* mpElemPaint; SVGAttributeWriter(); @@ -165,24 +165,26 @@ class SVGActionWriter { private: - sal_Int32 mnCurGradientId; - sal_Int32 mnCurMaskId; - sal_Int32 mnCurPatternId; - Stack maContextStack; - ::std::auto_ptr< SVGShapeDescriptor > mapCurShape; - SVGExport& mrExport; - SVGFontExport& mrFontExport; - SVGAttributeWriter* mpContext; - VirtualDevice* mpVDev; - MapMode maTargetMapMode; - sal_uInt32 mnInnerMtfCount; - sal_Bool mbDestroyVDev; - sal_Bool mbPaintAttrChanged; - sal_Bool mbFontAttrChanged; - sal_Bool mbClipAttrChanged; + sal_Int32 mnCurGradientId; + sal_Int32 mnCurMaskId; + sal_Int32 mnCurPatternId; + Stack maContextStack; + ::std::auto_ptr< SVGShapeDescriptor > mapCurShape; + SVGExport& mrExport; + SVGFontExport& mrFontExport; + SVGAttributeWriter* mpContext; + VirtualDevice* mpVDev; + MapMode maTargetMapMode; + sal_uInt32 mnInnerMtfCount; + sal_Bool mbDestroyVDev; + sal_Bool mbPaintAttrChanged; + sal_Bool mbFontAttrChanged; + sal_Bool mbClipAttrChanged; + sal_Bool mbIsPlacehlolderShape; + SVGAttributeWriter* ImplAcquireContext() { maContextStack.Push( mpContext = new SVGAttributeWriter( mrExport, mrFontExport ) ); return mpContext; } - void ImplReleaseContext() { delete (SVGAttributeWriter*) maContextStack.Pop(); mpContext = (SVGAttributeWriter*) maContextStack.Top(); } + void ImplReleaseContext() { delete (SVGAttributeWriter*) maContextStack.Pop(); mpContext = (SVGAttributeWriter*) maContextStack.Top(); } long ImplMap( sal_Int32 nVal ) const; Point& ImplMap( const Point& rPt, Point& rDstPt ) const; @@ -208,8 +210,7 @@ private: Color ImplGetColorWithIntensity( const Color& rColor, sal_uInt16 nIntensity ); Color ImplGetGradientColor( const Color& rStartColor, const Color& rEndColor, double fOffset ); void ImplWriteMask( GDIMetaFile& rMtf, const Point& rDestPt, const Size& rDestSize, const Gradient& rGradient, sal_uInt32 nWriteFlags ); - void ImplWriteText( const Point& rPos, const String& rText, const sal_Int32* pDXArray, long nWidth, - sal_Bool bApplyMapping = sal_True ); + void ImplWriteText( const Point& rPos, const String& rText, const sal_Int32* pDXArray, long nWidth, sal_Bool bApplyMapping = sal_True ); void ImplWriteText( const Point& rPos, const String& rText, const sal_Int32* pDXArray, long nWidth, Color aTextColor, sal_Bool bApplyMapping ); void ImplWriteBmp( const BitmapEx& rBmpEx, const Point& rPt, const Size& rSz, const Point& rSrcPt, const Size& rSrcSz, sal_Bool bApplyMapping = sal_True ); diff --git a/filter/source/t602/filterenv.cxx b/filter/source/t602/filterenv.cxx index 5202c38c3c91..7bd954484cb6 100644 --- a/filter/source/t602/filterenv.cxx +++ b/filter/source/t602/filterenv.cxx @@ -46,13 +46,6 @@ using namespace T602ImportFilter; extern "C" { -//================================================================================================== -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} -//================================================================================================== SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ ) { diff --git a/filter/source/xmlfilteradaptor/genericfilter.cxx b/filter/source/xmlfilteradaptor/genericfilter.cxx index 67d364c608e0..f530d90c51e8 100644 --- a/filter/source/xmlfilteradaptor/genericfilter.cxx +++ b/filter/source/xmlfilteradaptor/genericfilter.cxx @@ -47,13 +47,6 @@ using namespace ::com::sun::star::registry; extern "C" { -//================================================================================================== -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} -//================================================================================================== SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ ) { diff --git a/filter/source/xmlfilterdetect/fdcomp.cxx b/filter/source/xmlfilterdetect/fdcomp.cxx index 43d80512b9dc..e3a590bf4502 100644 --- a/filter/source/xmlfilterdetect/fdcomp.cxx +++ b/filter/source/xmlfilterdetect/fdcomp.cxx @@ -48,13 +48,6 @@ using namespace ::com::sun::star::registry; extern "C" { -//================================================================================================== -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} -//================================================================================================== SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ ) { diff --git a/filter/source/xsltdialog/exports.dxp b/filter/source/xsltdialog/exports.dxp index f0e1c69934bc..70033078921a 100644 --- a/filter/source/xsltdialog/exports.dxp +++ b/filter/source/xsltdialog/exports.dxp @@ -1,2 +1 @@ -component_getImplementationEnvironment component_getFactory diff --git a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx index df5dde22dd1f..e826ef58dd44 100644 --- a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx +++ b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx @@ -398,14 +398,6 @@ void SAL_CALL XMLFilterDialogComponent::initialize( const Sequence< Any >& aArgu extern "C" { -//================================================================================================== -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -//================================================================================================== SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ ) { diff --git a/filter/source/xsltfilter/XSLTFilter.cxx b/filter/source/xsltfilter/XSLTFilter.cxx index 3d6aefefb8b3..9d17c05d3ada 100644 --- a/filter/source/xsltfilter/XSLTFilter.cxx +++ b/filter/source/xsltfilter/XSLTFilter.cxx @@ -588,12 +588,6 @@ using namespace XSLT; extern "C" { - SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName, - uno_Environment ** /* ppEnv */) - { - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; - } - SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */) { diff --git a/filter/source/xsltfilter/makefile.mk b/filter/source/xsltfilter/makefile.mk index 539469f55fc7..567b37f1bb65 100644 --- a/filter/source/xsltfilter/makefile.mk +++ b/filter/source/xsltfilter/makefile.mk @@ -43,6 +43,10 @@ LIBXSLTINCDIR=external$/libxslt CFLAGS+= -I$(SOLARINCDIR)$/$(LIBXSLTINCDIR) .ENDIF +.IF "$(SYSTEM_LIBXML)" == "YES" +CFLAGS+= $(LIBXML_CFLAGS) +.ENDIF + SLOFILES=$(SLO)$/XSLTFilter.obj $(SLO)$/LibXSLTTransformer.obj $(SLO)/OleHandler.obj LIBNAME=xsltfilter SHL1TARGETDEPN=makefile.mk diff --git a/hwpfilter/CppunitTest_hwpfilter_test_hwpfilter.mk b/hwpfilter/CppunitTest_hwpfilter_test_hwpfilter.mk index 5e053286fc86..386e6fa04da3 100644 --- a/hwpfilter/CppunitTest_hwpfilter_test_hwpfilter.mk +++ b/hwpfilter/CppunitTest_hwpfilter_test_hwpfilter.mk @@ -46,10 +46,14 @@ $(eval $(call gb_CppunitTest_add_linked_libs,hwpfilter_test_hwpfilter, \ $(eval $(call gb_CppunitTest_set_include,hwpfilter_test_hwpfilter,\ $$(INCLUDE) \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) +$(eval $(call gb_CppunitTest_add_api,hwpfilter_test_hwpfilter,\ + offapi \ + udkapi \ +)) + $(eval $(call gb_CppunitTest_uses_ure,hwpfilter_test_hwpfilter)) $(eval $(call gb_CppunitTest_add_type_rdbs,hwpfilter_test_hwpfilter,\ @@ -63,6 +67,7 @@ $(eval $(call gb_CppunitTest_add_service_rdbs,hwpfilter_test_hwpfilter,\ $(eval $(call gb_CppunitTest_set_args,hwpfilter_test_hwpfilter,\ --headless \ --invisible \ + --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \ )) $(eval $(call gb_RdbTarget_RdbTarget,hwpfilter_test_hwpfilter)) diff --git a/hwpfilter/Library_hwp.mk b/hwpfilter/Library_hwp.mk index 87fef9fa66de..ee337a47a2a7 100644 --- a/hwpfilter/Library_hwp.mk +++ b/hwpfilter/Library_hwp.mk @@ -32,7 +32,11 @@ $(eval $(call gb_Library_add_precompiled_header,hwp,$(SRCDIR)/hwpfilter/inc/pch/ $(eval $(call gb_Library_set_include,hwp,\ $$(INCLUDE) \ -I$(realpath $(SRCDIR)/hwpfilter/inc/pch) \ - -I$(OUTDIR)/inc/offuh \ +)) + +$(eval $(call gb_Library_add_api,hwp,\ + offapi \ + udkapi \ )) $(eval $(call gb_Library_add_linked_libs,hwp,\ @@ -49,6 +53,7 @@ ifeq ($(OS),WNT) $(eval $(call gb_Library_add_linked_libs,hwp,\ ole32 \ + user32 \ uuid \ )) diff --git a/hwpfilter/prj/build.lst b/hwpfilter/prj/build.lst index 3fa47f767bfe..5eb79927bdd0 100644 --- a/hwpfilter/prj/build.lst +++ b/hwpfilter/prj/build.lst @@ -1,2 +1,2 @@ -hw hwpfilter : offuh cppuhelper ZLIB:zlib LIBXSLT:libxslt ucbhelper ucb ure NULL +hw hwpfilter : offapi cppuhelper ZLIB:zlib LIBXSLT:libxslt ucbhelper ucb ure test NULL hw hwpfilter\prj nmake - all hw_prj NULL diff --git a/hwpfilter/source/htags.cxx b/hwpfilter/source/htags.cxx index 30244a83f9b8..94cc05058d7c 100644 --- a/hwpfilter/source/htags.cxx +++ b/hwpfilter/source/htags.cxx @@ -59,9 +59,10 @@ bool HyperText::Read(HWPFile & hwpf) } -EmPicture::EmPicture(int tsize):size(tsize - 32) +EmPicture::EmPicture(size_t tsize) + : size(tsize >= 32 ? tsize - 32 : 0) { - if (size <= 0) + if (size == 0) data = 0; else data = new uchar[size]; @@ -82,7 +83,7 @@ EmPicture::~EmPicture(void) bool EmPicture::Read(HWPFile & hwpf) { - if (size <= 0) + if (size == 0) return false; hwpf.Read1b(name, 16); hwpf.Read1b(type, 16); diff --git a/hwpfilter/source/htags.h b/hwpfilter/source/htags.h index bb244c07dd59..21c610db4e9d 100644 --- a/hwpfilter/source/htags.h +++ b/hwpfilter/source/htags.h @@ -39,12 +39,12 @@ class HWPFile; */ struct EmPicture { - int size; + size_t size; char name[16]; char type[16]; uchar *data; - EmPicture(int size); + EmPicture(size_t size); ~EmPicture(void); bool Read(HWPFile& hwpf); diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index 47e8a50d5cbe..8bcef10460df 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -538,12 +538,13 @@ void HwpReader::makeDrawMiscStyle( HWPDrawingObject *hdo ) if( (fd = open( filename , O_CREAT | O_WRONLY , 0666)) >= 0 ) #endif { - write( fd, emp->data, emp->size ); + size_t nWritten = write(fd, emp->data, emp->size); + OSL_VERIFY(nWritten == emp->size); close(fd); } #ifdef _WIN32 int j; - for( j = 0 ; j < (int)strlen( dirname ) ; j++) + for(j = 0 ; j < (int)strlen( dirname ) ; j++) { if( dirname[j] == '\\' ) buf[j] = '/'; else buf[j] = dirname[j]; diff --git a/hwpfilter/source/hwpreader.hxx b/hwpfilter/source/hwpreader.hxx index 7676aafe0dc3..6a7ce4faa4de 100644 --- a/hwpfilter/source/hwpreader.hxx +++ b/hwpfilter/source/hwpreader.hxx @@ -338,19 +338,8 @@ Sequence< OUString> HwpImportFilter::getSupportedServiceNames() throw(::com::sun return aRet; } -///////////////////////////////////////////////////////////////////////////////////// -// The below three C functions are nessesary for this shared library is treaded as -// UNO component library. -///////////////////////////////////////////////////////////////////////////////////// extern "C" { - - SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** ) - { - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; - } - SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * ) { void * pRet = 0; diff --git a/lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk b/lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk index 0def1a7e3724..5bebd75b7849 100644 --- a/lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk +++ b/lotuswordpro/CppunitTest_lotuswordpro_test_lotuswordpro.mk @@ -46,10 +46,14 @@ $(eval $(call gb_CppunitTest_add_linked_libs,lotuswordpro_test_lotuswordpro, \ $(eval $(call gb_CppunitTest_set_include,lotuswordpro_test_lotuswordpro,\ $$(INCLUDE) \ - -I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc \ )) +$(eval $(call gb_CppunitTest_add_api,lotuswordpro_test_lotuswordpro,\ + offapi \ + udkapi \ +)) + $(eval $(call gb_CppunitTest_uses_ure,lotuswordpro_test_lotuswordpro)) $(eval $(call gb_CppunitTest_add_type_rdbs,lotuswordpro_test_lotuswordpro,\ @@ -63,6 +67,7 @@ $(eval $(call gb_CppunitTest_add_service_rdbs,lotuswordpro_test_lotuswordpro,\ $(eval $(call gb_CppunitTest_set_args,lotuswordpro_test_lotuswordpro,\ --headless \ --invisible \ + --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \ )) $(eval $(call gb_RdbTarget_RdbTarget,lotuswordpro_test_lotuswordpro)) diff --git a/lotuswordpro/Library_lwpft.mk b/lotuswordpro/Library_lwpft.mk index db1cf5854e02..988d101f8d89 100644 --- a/lotuswordpro/Library_lwpft.mk +++ b/lotuswordpro/Library_lwpft.mk @@ -30,7 +30,11 @@ $(eval $(call gb_Library_Library,lwpft)) $(eval $(call gb_Library_set_include,lwpft,\ $$(INCLUDE) \ -I$(OUTDIR)/inc \ - -I$(OUTDIR)/inc/offuh \ +)) + +$(eval $(call gb_Library_add_api,lwpft,\ + offapi \ + udkapi \ )) $(eval $(call gb_Library_add_linked_libs,lwpft,\ diff --git a/lotuswordpro/prj/build.lst b/lotuswordpro/prj/build.lst index bee325f8146d..f6c70c5971df 100644 --- a/lotuswordpro/prj/build.lst +++ b/lotuswordpro/prj/build.lst @@ -1,2 +1,2 @@ -wp lotuswordpro : sfx2 sot svx comphelper BOOST:boost ure NULL +wp lotuswordpro : sfx2 sot svx comphelper BOOST:boost ure test NULL wp lotuswordpro\prj nmake - all lwp_prj NULL diff --git a/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx b/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx index 276625397487..cb7075ce9752 100644 --- a/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx +++ b/lotuswordpro/qa/cppunit/test_lotuswordpro.cxx @@ -70,7 +70,9 @@ namespace int m_nLoadedDocs; }; - LotusWordProTest::LotusWordProTest() : m_aSrcRoot( RTL_CONSTASCII_USTRINGPARAM( "file://" ) ), m_nLoadedDocs(0) + LotusWordProTest::LotusWordProTest() + : m_aSrcRoot(RTL_CONSTASCII_USTRINGPARAM("file://" )) + , m_nLoadedDocs(0) { m_xContext = cppu::defaultBootstrap_InitialComponentContext(); m_xFactory = m_xContext->getServiceManager(); diff --git a/lotuswordpro/source/filter/genericfilter.cxx b/lotuswordpro/source/filter/genericfilter.cxx index 5f82b1e9da5f..d889515acb4e 100644 --- a/lotuswordpro/source/filter/genericfilter.cxx +++ b/lotuswordpro/source/filter/genericfilter.cxx @@ -19,11 +19,6 @@ using namespace ::com::sun::star::registry; extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx index e36f9e8feb67..a269a6e61edb 100644 --- a/lotuswordpro/source/filter/lwptablelayout.cxx +++ b/lotuswordpro/source/filter/lwptablelayout.cxx @@ -620,7 +620,7 @@ void LwpTableLayout::RegisterColumns() // justifiable columns will share the remain width averagely dDefaultColumn = dTableWidth/nJustifiableColumn; - // register defualt column style + // register default column style XFColStyle *pColStyle = new XFColStyle(); pColStyle->SetWidth(static_cast<float>(dDefaultColumn)); diff --git a/lotuswordpro/source/filter/tocread.cxx b/lotuswordpro/source/filter/tocread.cxx index ee6e5c65b7f8..84aaf24adcc6 100644 --- a/lotuswordpro/source/filter/tocread.cxx +++ b/lotuswordpro/source/filter/tocread.cxx @@ -384,7 +384,7 @@ CBenTOCReader::ReadSegment(pCBenValue pValue, BenByte * pLookAhead) UtBool Immediate = UT_FALSE; UtBool EightByteOffset = UT_FALSE; - unsigned long Offset(0), Length; + unsigned long Offset(0), Length(0); switch (*pLookAhead) { diff --git a/lotuswordpro/source/filter/xfilter/xffilestream.cxx b/lotuswordpro/source/filter/xfilter/xffilestream.cxx index c868d2fb753d..9cba19ac6900 100644 --- a/lotuswordpro/source/filter/xfilter/xffilestream.cxx +++ b/lotuswordpro/source/filter/xfilter/xffilestream.cxx @@ -61,7 +61,6 @@ #include "xffileattrlist.hxx" #include "ixfattrlist.hxx" -void WriteStartTag(std::ofstream& ofs, const char *pStr, int len); void WriteEndTag(std::ofstream& ofs, const char *pStr, int len); void WriteString(std::ofstream& ofs, const char *pStr, int len); void WriteXmlString(std::ofstream& ofs, const char *pStr, int len); @@ -133,14 +132,6 @@ IXFAttrList* XFFileStream::GetAttrList() return m_pAttrList; } -//------------------------------------------------------------------------------ - -void WriteStartTag(std::ofstream& ofs, const char *pStr, int len) -{ - ofs.write("\n<",2); - ofs.write(pStr,len); -} - void WriteEndTag(std::ofstream& ofs, const char *pStr, int len) { ofs.write("</",2); diff --git a/lotuswordpro/source/filter/xfilter/xfutil.cxx b/lotuswordpro/source/filter/xfilter/xfutil.cxx index 62b61ca84391..8471ff65940a 100644 --- a/lotuswordpro/source/filter/xfilter/xfutil.cxx +++ b/lotuswordpro/source/filter/xfilter/xfutil.cxx @@ -109,38 +109,6 @@ rtl::OUString DoubleToOUString(double num, sal_Int32 /*precision*/) return rtl::OUString::valueOf(num); } -rtl::OUString OEMToOUString(const std::string& /*str*/) -{ - return rtl::OUString(); -} - -rtl::OUString ColorToOUString( sal_uInt32 color) -{ - unsigned int c = color&0x00ffffff; - unsigned char r; - unsigned char g; - unsigned char b; - char buf[8]; - - unsigned int temp = c; - r = temp&0x000000ff; - - temp = c; - g = (temp&0x0000ff00)>>8; - - temp = c; - b = (temp&0x00ff0000)>>16; - - rtl_zeroMemory(buf,8); - sprintf(buf,"#%2x%2x%2x",r,g,b); - for( int i=0; i<6; i++ ) - { - if( buf[i] == ' ' ) - buf[i] = '0'; - } - return rtl::OUString::createFromAscii(buf); -} - rtl::OUString DateTimeToOUString(XFDateTime& dt) { rtl::OUStringBuffer buf; diff --git a/lotuswordpro/source/filter/xfilter/xfutil.hxx b/lotuswordpro/source/filter/xfilter/xfutil.hxx index 3515871b18f9..df49ff4c1797 100644 --- a/lotuswordpro/source/filter/xfilter/xfutil.hxx +++ b/lotuswordpro/source/filter/xfilter/xfutil.hxx @@ -77,10 +77,6 @@ rtl::OUString FloatToOUString(float num, sal_Int32 precision=6); rtl::OUString DoubleToOUString(double num, sal_Int32 precision=6); -rtl::OUString OEMToOUString(const std::string& str); - -rtl::OUString ColorToOUString( sal_uInt32 color); - rtl::OUString DateTimeToOUString(XFDateTime& dt); rtl::OUString GetTableColName(sal_Int32 col); diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk index 2abfb960c461..69ddb25d65ea 100644 --- a/oox/Library_oox.mk +++ b/oox/Library_oox.mk @@ -34,7 +34,6 @@ $(eval $(call gb_Library_add_package_headers,oox,\ $(eval $(call gb_Library_set_include,oox,\ $$(INCLUDE) \ -I$(OUTDIR)/inc \ - -I$(OUTDIR)/inc/offuh \ -I$(realpath $(SRCDIR)/oox/inc) \ )) @@ -42,6 +41,11 @@ $(eval $(call gb_Library_add_defs,oox,\ -DOOX_DLLIMPLEMENTATION \ )) +$(eval $(call gb_Library_add_api,oox,\ + offapi \ + udkapi \ +)) + $(eval $(call gb_Library_add_linked_libs,oox,\ basegfx \ comphelper \ diff --git a/oox/Package_inc.mk b/oox/Package_inc.mk index d9b23dbfd266..b51b51b79559 100644 --- a/oox/Package_inc.mk +++ b/oox/Package_inc.mk @@ -48,6 +48,7 @@ $(eval $(call gb_Package_add_file,oox_inc,inc/oox/helper/refmap.hxx,oox/helper/r $(eval $(call gb_Package_add_file,oox_inc,inc/oox/helper/refvector.hxx,oox/helper/refvector.hxx)) $(eval $(call gb_Package_add_file,oox_inc,inc/oox/helper/storagebase.hxx,oox/helper/storagebase.hxx)) $(eval $(call gb_Package_add_file,oox_inc,inc/oox/helper/zipstorage.hxx,oox/helper/zipstorage.hxx)) +$(eval $(call gb_Package_add_file,oox_inc,inc/oox/ole/olehelper.hxx,oox/ole/olehelper.hxx)) $(eval $(call gb_Package_add_file,oox_inc,inc/oox/ole/oleobjecthelper.hxx,oox/ole/oleobjecthelper.hxx)) $(eval $(call gb_Package_add_file,oox_inc,inc/oox/ole/olestorage.hxx,oox/ole/olestorage.hxx)) $(eval $(call gb_Package_add_file,oox_inc,inc/oox/ole/vbaproject.hxx,oox/ole/vbaproject.hxx)) diff --git a/oox/inc/oox/core/contexthandler.hxx b/oox/inc/oox/core/contexthandler.hxx index 118d9396e354..94a095b22c0c 100644 --- a/oox/inc/oox/core/contexthandler.hxx +++ b/oox/inc/oox/core/contexthandler.hxx @@ -63,7 +63,7 @@ typedef ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastContextHandler class ContextHandler : public ContextHandler_BASE { public: - explicit ContextHandler( ContextHandler& rParent ); + explicit ContextHandler( const ContextHandler& rParent ); virtual ~ContextHandler(); /** Returns the filter instance. */ diff --git a/oox/inc/oox/ole/axcontrol.hxx b/oox/inc/oox/ole/axcontrol.hxx index 273bacd5121a..2f06aca5ee7d 100644 --- a/oox/inc/oox/ole/axcontrol.hxx +++ b/oox/inc/oox/ole/axcontrol.hxx @@ -77,6 +77,11 @@ const sal_uInt16 COMCTL_VERSION_60 = 6; #define AX_GUID_SCROLLBAR "{DFD181E0-5E2F-11CE-A449-00AA004A803D}" #define AX_GUID_FRAME "{6E182020-F460-11CE-9BCD-00AA00608E01}" +// Html control GUID(s) + +#define HTML_GUID_SELECT "{5512D122-5CC6-11CF-8D67-00AA00BDCE1D}" +#define HTML_GUID_TEXTBOX "{5512D124-5CC6-11CF-8D67-00AA00BDCE1D}" + const sal_uInt32 AX_SYSCOLOR_WINDOWBACK = 0x80000005; const sal_uInt32 AX_SYSCOLOR_WINDOWFRAME = 0x80000006; const sal_uInt32 AX_SYSCOLOR_WINDOWTEXT = 0x80000008; @@ -853,6 +858,22 @@ public: virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const; }; +class HtmlSelectModel : public AxListBoxModel +{ + com::sun::star::uno::Sequence< rtl::OUString > msListData; + com::sun::star::uno::Sequence< sal_Int16 > msIndices; +public: + HtmlSelectModel(); + virtual bool importBinaryModel( BinaryInputStream& rInStrm ); + virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const; +}; + +class HtmlTextBoxModel : public AxTextBoxModel +{ +public: + explicit HtmlTextBoxModel(); + virtual bool importBinaryModel( BinaryInputStream& rInStrm ); +}; // ============================================================================ /** A form control embedded in a document draw page. Contains a specific model diff --git a/oox/inc/oox/ole/olehelper.hxx b/oox/inc/oox/ole/olehelper.hxx index 9881eebc21dc..efe0b40c2938 100644 --- a/oox/inc/oox/ole/olehelper.hxx +++ b/oox/inc/oox/ole/olehelper.hxx @@ -31,15 +31,29 @@ #include <rtl/ustring.hxx> #include "oox/helper/binarystreambase.hxx" +#include "oox/helper/storagebase.hxx" +#include "oox/helper/graphichelper.hxx" +#include "com/sun/star/form/XFormComponent.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/frame/XModel.hpp" +#include "com/sun/star/frame/XFrame.hpp" +#include "com/sun/star/awt/XControl.hpp" +#include "com/sun/star/io/XInputStream.hpp" +#include "oox/dllapi.h" namespace oox { class BinaryInputStream; + class BinaryXInputStream; class GraphicHelper; } namespace oox { + +typedef ::boost::shared_ptr< oox::BinaryXInputStream > BinaryXInputStreamRef; + namespace ole { + // ============================================================================ #define OLE_GUID_STDFONT "{0BE35203-8F91-11CE-9DE3-00AA004BB851}" @@ -87,7 +101,7 @@ struct StdHlinkInfo // ============================================================================ /** Static helper functions for OLE import/export. */ -class OleHelper +class OOX_DLLPUBLIC OleHelper { public: /** Returns the UNO RGB color from the passed encoded OLE color. @@ -139,6 +153,30 @@ private: ~OleHelper(); // not implemented }; +class OOX_DLLPUBLIC OleFormCtrlImportHelper +{ + ::oox::StorageRef mpRoot; + ::oox::StorageRef mpPoolStrg; + ::oox::BinaryXInputStreamRef mpCtlsStrm; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxCtx; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel; + ::oox::GraphicHelper maGrfHelper; + bool importControlFromStream( ::oox::BinaryInputStream& rInStrm, + ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp, + const ::rtl::OUString& rGuidString ); + bool importControlFromStorage( ::oox::StorageRef rxObjStrg, + ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp ); +public: + OleFormCtrlImportHelper( const ::com::sun::star::uno::Reference< com::sun::star::io::XInputStream > & xInStrm, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxCtx, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel ); + ~OleFormCtrlImportHelper(); + bool importFormControlFromObjStorage( ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp); + bool importFormControlFromCtls( ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp, + sal_Int32 nPos, sal_Int32 nSize ); + bool importFormControlFromObjPool( ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp, + const ::rtl::OUString& rPoolName ); +}; // ============================================================================ } // namespace ole diff --git a/oox/inc/oox/ppt/backgroundproperties.hxx b/oox/inc/oox/ppt/backgroundproperties.hxx index 7f254e8c386e..4be1177fc55f 100644 --- a/oox/inc/oox/ppt/backgroundproperties.hxx +++ b/oox/inc/oox/ppt/backgroundproperties.hxx @@ -29,18 +29,18 @@ #ifndef OOX_POWERPOINT_BACKGROUNDPROPERTIES_HXX #define OOX_POWERPOINT_BACKGROUNDPROPERTIES_HXX -#include "oox/core/contexthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" #include "oox/drawingml/fillproperties.hxx" namespace oox { namespace ppt { // --------------------------------------------------------------------- -class BackgroundPropertiesContext : public ::oox::core::ContextHandler +class BackgroundPropertiesContext : public ::oox::core::FragmentHandler2 { public: - BackgroundPropertiesContext( ::oox::core::ContextHandler& rParent, ::oox::drawingml::FillProperties& rFillProperties ) throw(); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + BackgroundPropertiesContext( ::oox::core::FragmentHandler2& rParent, ::oox::drawingml::FillProperties& rFillProperties ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); protected: ::oox::drawingml::FillProperties& mrFillProperties; diff --git a/oox/inc/oox/ppt/customshowlistcontext.hxx b/oox/inc/oox/ppt/customshowlistcontext.hxx index df5ca3a7a6fe..d10976b3ad46 100644 --- a/oox/inc/oox/ppt/customshowlistcontext.hxx +++ b/oox/inc/oox/ppt/customshowlistcontext.hxx @@ -31,7 +31,7 @@ #ifndef OOX_POWERPOINT_CUSTOMSHOWLISTCONTEXT_HXX #define OOX_POWERPOINT_CUSTOMSHOWLISTCONTEXT_HXX -#include "oox/core/contexthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" #include <vector> namespace oox { namespace ppt { @@ -45,18 +45,16 @@ namespace oox { namespace ppt { }; /** CT_ */ - class CustomShowListContext : public ::oox::core::ContextHandler + class CustomShowListContext : public ::oox::core::FragmentHandler2 { std::vector< CustomShow >& mrCustomShowList; public: - CustomShowListContext( ::oox::core::ContextHandler& rParent, + CustomShowListContext( ::oox::core::FragmentHandler2& rParent, std::vector< CustomShow >& rCustomShowList ); ~CustomShowListContext( ); - 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 ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); }; } } diff --git a/oox/inc/oox/ppt/layoutfragmenthandler.hxx b/oox/inc/oox/ppt/layoutfragmenthandler.hxx index bc29d732ee28..4e7ae5d28f8e 100644 --- a/oox/inc/oox/ppt/layoutfragmenthandler.hxx +++ b/oox/inc/oox/ppt/layoutfragmenthandler.hxx @@ -41,8 +41,7 @@ public: LayoutFragmentHandler( ::oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, SlidePersistPtr pMasterPersistPtr ) throw(); virtual ~LayoutFragmentHandler() throw(); - virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); }; } } diff --git a/oox/inc/oox/ppt/presentationfragmenthandler.hxx b/oox/inc/oox/ppt/presentationfragmenthandler.hxx index f4d46dba9afc..77db0d6dbdb4 100644 --- a/oox/inc/oox/ppt/presentationfragmenthandler.hxx +++ b/oox/inc/oox/ppt/presentationfragmenthandler.hxx @@ -33,7 +33,9 @@ #include <com/sun/star/awt/Size.hpp> #include "oox/drawingml/textliststyle.hxx" #include "oox/ppt/slidepersist.hxx" +#include "oox/core/contexthandler.hxx" #include "oox/core/fragmenthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" #include "oox/core/relations.hxx" #include "oox/ppt/customshowlistcontext.hxx" @@ -42,15 +44,13 @@ namespace oox { namespace ppt { -class PresentationFragmentHandler : public ::oox::core::FragmentHandler +class PresentationFragmentHandler : public ::oox::core::FragmentHandler2 { public: PresentationFragmentHandler( ::oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath ) throw(); virtual ~PresentationFragmentHandler() throw(); - - virtual void SAL_CALL startDocument( ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL endDocument( ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void finalizeImport(); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); protected: bool importSlide( const ::oox::core::FragmentHandlerRef& rxSlideFragmentHandler, diff --git a/oox/inc/oox/ppt/slidefragmenthandler.hxx b/oox/inc/oox/ppt/slidefragmenthandler.hxx index b530d8cb2550..ce518e214511 100644 --- a/oox/inc/oox/ppt/slidefragmenthandler.hxx +++ b/oox/inc/oox/ppt/slidefragmenthandler.hxx @@ -31,7 +31,7 @@ #include <com/sun/star/drawing/XDrawPage.hpp> #include "oox/helper/propertymap.hxx" -#include "oox/core/fragmenthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" #include "oox/ppt/slidepersist.hxx" #include <stack> @@ -40,14 +40,14 @@ namespace oox { namespace ppt { -class SlideFragmentHandler : public ::oox::core::FragmentHandler +class SlideFragmentHandler : public ::oox::core::FragmentHandler2 { public: SlideFragmentHandler( ::oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, SlidePersistPtr pPersistPtr, const ShapeLocation eShapeLocation ) throw(); virtual ~SlideFragmentHandler() throw(); - virtual void SAL_CALL endDocument( ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void finalizeImport(); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); protected: SlidePersistPtr mpSlidePersistPtr; diff --git a/oox/inc/oox/ppt/slidemastertextstylescontext.hxx b/oox/inc/oox/ppt/slidemastertextstylescontext.hxx index 9f232ee853c8..4381a289a6e1 100644 --- a/oox/inc/oox/ppt/slidemastertextstylescontext.hxx +++ b/oox/inc/oox/ppt/slidemastertextstylescontext.hxx @@ -31,17 +31,17 @@ #include "oox/drawingml/theme.hxx" #include "oox/core/contexthandler.hxx" -#include "oox/core/fragmenthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" #include "oox/ppt/slidepersist.hxx" namespace oox { namespace ppt { -class SlideMasterTextStylesContext : public oox::core::ContextHandler +class SlideMasterTextStylesContext : public oox::core::FragmentHandler2 { public: - SlideMasterTextStylesContext( ::oox::core::ContextHandler& rParent, SlidePersistPtr pSlidePersistPtr ); + SlideMasterTextStylesContext( ::oox::core::FragmentHandler2& rParent, SlidePersistPtr pSlidePersistPtr ); ~SlideMasterTextStylesContext(); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); protected: SlidePersistPtr mpSlidePersistPtr; diff --git a/oox/inc/oox/ppt/slidetimingcontext.hxx b/oox/inc/oox/ppt/slidetimingcontext.hxx index 76dbb7cd2790..a1ba2dd5e936 100644 --- a/oox/inc/oox/ppt/slidetimingcontext.hxx +++ b/oox/inc/oox/ppt/slidetimingcontext.hxx @@ -31,23 +31,20 @@ #include <com/sun/star/animations/XTimeContainer.hpp> #include "oox/ppt/timenode.hxx" -#include "oox/core/contexthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" #include <stack> #include <vector> namespace oox { namespace ppt { -class SlideTimingContext : public ::oox::core::ContextHandler +class SlideTimingContext : public ::oox::core::FragmentHandler2 { public: - SlideTimingContext( ::oox::core::ContextHandler& rParent, TimeNodePtrList & aTimeNodeList ) throw(); + SlideTimingContext( ::oox::core::FragmentHandler2& rParent, TimeNodePtrList & aTimeNodeList ) throw(); virtual ~SlideTimingContext() throw(); - virtual void SAL_CALL endDocument( ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL endFastElement( sal_Int32 aElement ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); private: TimeNodePtrList & maTimeNodeList; diff --git a/oox/inc/oox/ppt/slidetransitioncontext.hxx b/oox/inc/oox/ppt/slidetransitioncontext.hxx index 361a06f4b556..e6d2cbb729b1 100644 --- a/oox/inc/oox/ppt/slidetransitioncontext.hxx +++ b/oox/inc/oox/ppt/slidetransitioncontext.hxx @@ -29,26 +29,24 @@ #ifndef OOX_PPT_SLIDETRANSITIONCONTEXT #define OOX_PPT_SLIDETRANSITIONCONTEXT -#include "oox/core/contexthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" #include "oox/ppt/slidetransition.hxx" namespace oox { class PropertyMap; } namespace oox { namespace ppt { - class SlideTransitionContext : public ::oox::core::ContextHandler + class SlideTransitionContext : public ::oox::core::FragmentHandler2 { public: - SlideTransitionContext( ::oox::core::ContextHandler& rParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, + SlideTransitionContext( ::oox::core::FragmentHandler2& rParent, + const AttributeList& rAttributes, PropertyMap & aProperties ) throw(); virtual ~SlideTransitionContext() throw(); - virtual void SAL_CALL endFastElement( sal_Int32 aElement ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL - createFastChildContext( ::sal_Int32 Element, - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) - throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void onEndElement(); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); + private: PropertyMap& maSlideProperties; diff --git a/oox/inc/oox/ppt/soundactioncontext.hxx b/oox/inc/oox/ppt/soundactioncontext.hxx index 0ee8a88dc5dc..d368c1fad649 100644 --- a/oox/inc/oox/ppt/soundactioncontext.hxx +++ b/oox/inc/oox/ppt/soundactioncontext.hxx @@ -30,20 +30,20 @@ #ifndef OOX_PPT_SOUNDACTIONCONTEXT #define OOX_PPT_SOUNDACTIONCONTEXT -#include "oox/core/contexthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" namespace oox { class PropertyMap; } namespace oox { namespace ppt { -class SoundActionContext : public ::oox::core::ContextHandler +class SoundActionContext : public ::oox::core::FragmentHandler2 { public: - SoundActionContext( ::oox::core::ContextHandler& rParent, PropertyMap & aProperties ) throw(); + SoundActionContext( ::oox::core::FragmentHandler2& rParent, PropertyMap & aProperties ) throw(); virtual ~SoundActionContext() throw(); - virtual void SAL_CALL endFastElement( sal_Int32 aElement ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void onEndElement(); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); private: PropertyMap& maSlideProperties; diff --git a/oox/inc/oox/ppt/timenodelistcontext.hxx b/oox/inc/oox/ppt/timenodelistcontext.hxx index 25c929cdaf67..75949a419077 100644 --- a/oox/inc/oox/ppt/timenodelistcontext.hxx +++ b/oox/inc/oox/ppt/timenodelistcontext.hxx @@ -29,7 +29,7 @@ #ifndef OOX_PPT_TIMENODELISTCONTEXT #define OOX_PPT_TIMENODELISTCONTEXT -#include "oox/core/contexthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" #include "oox/ppt/timenode.hxx" #include <com/sun/star/animations/XTimeContainer.hpp> @@ -37,15 +37,15 @@ namespace oox { namespace ppt { - class TimeNodeContext : public ::oox::core::ContextHandler + class TimeNodeContext : public ::oox::core::FragmentHandler2 { public: virtual ~TimeNodeContext() throw(); - static TimeNodeContext * SAL_CALL makeContext( ::oox::core::ContextHandler& rParent, sal_Int32 aElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ); + static TimeNodeContext * SAL_CALL makeContext( ::oox::core::FragmentHandler2& rParent, sal_Int32 aElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ); protected: - TimeNodeContext( ::oox::core::ContextHandler& rParent, sal_Int32 aElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) throw(); + TimeNodeContext( ::oox::core::FragmentHandler2& rParent, sal_Int32 aElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) throw(); sal_Int32 mnElement; TimeNodePtr mpNode; @@ -54,17 +54,14 @@ namespace oox { namespace ppt { /** FastParser context for XML_tnLst, XML_subTnLst and XML_childTnLst */ -class TimeNodeListContext : public ::oox::core::ContextHandler +class TimeNodeListContext : public ::oox::core::FragmentHandler2 { public: - TimeNodeListContext( ::oox::core::ContextHandler& rParent, TimeNodePtrList & aList ) throw(); + TimeNodeListContext( ::oox::core::FragmentHandler2& rParent, TimeNodePtrList & aList ) throw(); virtual ~TimeNodeListContext() throw(); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL - createFastChildContext( ::sal_Int32 Element, - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) - throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); private: TimeNodePtrList & maList; diff --git a/oox/inc/oox/xls/worksheethelper.hxx b/oox/inc/oox/xls/worksheethelper.hxx index e31c8f69711b..c824c4eb922b 100644 --- a/oox/inc/oox/xls/worksheethelper.hxx +++ b/oox/inc/oox/xls/worksheethelper.hxx @@ -43,6 +43,7 @@ namespace com { namespace sun { namespace star { namespace sheet { class XSheetCellRanges; } namespace sheet { class XSpreadsheet; } namespace table { class XCell; } + namespace table { class XCell2; } namespace table { class XCellRange; } namespace table { class XTableColumns; } namespace table { class XTableRows; } @@ -323,6 +324,13 @@ public: void putValue( const ::com::sun::star::table::CellAddress& rAddress, double fValue ) const; + void putFormulaResult( + const ::com::sun::star::table::CellAddress& rAddress, + double fValue ) const; + void putFormulaString( + const ::com::sun::star::table::CellAddress& rAddress, + const ::rtl::OUString& rText ) const; + /** Inserts a string cell directly into the Calc sheet. */ void putString( const ::com::sun::star::table::CellAddress& rAddress, diff --git a/oox/source/core/contexthandler.cxx b/oox/source/core/contexthandler.cxx index d781a811d520..8b73a5f47885 100644 --- a/oox/source/core/contexthandler.cxx +++ b/oox/source/core/contexthandler.cxx @@ -42,7 +42,7 @@ using ::rtl::OUString; // ============================================================================ -ContextHandler::ContextHandler( ContextHandler& rParent ) : +ContextHandler::ContextHandler( const ContextHandler& rParent ) : ContextHandler_BASE(), mxBaseData( rParent.mxBaseData ) { diff --git a/oox/source/core/services.cxx b/oox/source/core/services.cxx index f05524f4d046..199d8a695048 100644 --- a/oox/source/core/services.cxx +++ b/oox/source/core/services.cxx @@ -81,17 +81,7 @@ static ::cppu::ImplementationEntry const spServices[] = } // namespace -// ---------------------------------------------------------------------------- - -extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char** ppEnvironmentTypeName, uno_Environment** /*ppEnvironment*/ ) -{ - *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const char* pImplName, void* pServiceManager, void* pRegistryKey ) { return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey, spServices ); } - -// ============================================================================ diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index 6638ffe5d4d9..1daea946eb33 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -538,13 +538,13 @@ XmlFilterBase& XmlFilterBase::exportDocumentProperties( Reference< XDocumentProp writeCoreProperties( *this, xProperties ); writeAppProperties( *this, xProperties ); Sequence< ::com::sun::star::beans::NamedValue > aStats = xProperties->getDocumentStatistics(); - printf( "# Document Statistics:\n" ); + OSL_TRACE( "# Document Statistics:\n" ); for( sal_Int32 i = 0, end = aStats.getLength(); i < end; ++i ) { ::com::sun::star::uno::Any aValue = aStats[ i ].Value; ::rtl::OUString sValue; bool bHaveString = aValue >>= sValue; - printf ("#\t%s=%s [%s]\n", + OSL_TRACE ("#\t%s=%s [%s]\n", OUStringToOString( aStats[ i ].Name, RTL_TEXTENCODING_UTF8 ).getStr(), bHaveString ? OUStringToOString( sValue, RTL_TEXTENCODING_UTF8 ).getStr() diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx index 2225d7f5ae27..d07d28c79ae8 100644 --- a/oox/source/drawingml/chart/axisconverter.cxx +++ b/oox/source/drawingml/chart/axisconverter.cxx @@ -315,7 +315,11 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo // number format ------------------------------------------------------ if( (aScaleData.AxisType == cssc2::AxisType::REALNUMBER) || (aScaleData.AxisType == cssc2::AxisType::PERCENT) ) + { + if( mrModel.maNumberFormat.maFormatCode.indexOfAsciiL("%",1) >= 0) + mrModel.maNumberFormat.mbSourceLinked = false; getFormatter().convertNumberFormat( aAxisProp, mrModel.maNumberFormat ); + } // position of crossing axis ------------------------------------------ diff --git a/oox/source/drawingml/chart/chartconverter.cxx b/oox/source/drawingml/chart/chartconverter.cxx index e66eca6bc0e2..261494327efd 100644 --- a/oox/source/drawingml/chart/chartconverter.cxx +++ b/oox/source/drawingml/chart/chartconverter.cxx @@ -59,7 +59,7 @@ static const sal_Unicode API_TOKEN_ARRAY_CLOSE = '}'; static const sal_Unicode API_TOKEN_ARRAY_ROWSEP = '|'; static const sal_Unicode API_TOKEN_ARRAY_COLSEP = ';'; -// Code similar to oox/source/xls/FormulaParser.cxx +// Code similar to oox/source/xls/formulabase.cxx static OUString lclGenerateApiString( const OUString& rString ) { OUString aRetString = rString; @@ -69,7 +69,7 @@ static OUString lclGenerateApiString( const OUString& rString ) return OUStringBuffer().append( sal_Unicode( '"' ) ).append( aRetString ).append( sal_Unicode( '"' ) ).makeStringAndClear(); } - static ::rtl::OUString lclGenerateApiArray( const Matrix< Any >& rMatrix ) +static ::rtl::OUString lclGenerateApiArray( const Matrix< Any >& rMatrix ) { OSL_ENSURE( !rMatrix.empty(), "ChartConverter::lclGenerateApiArray - missing matrix values" ); OUStringBuffer aBuffer; @@ -156,7 +156,7 @@ Reference< XDataSequence > ChartConverter::createDataSequence( const Reference< } catch( Exception& ) { - OSL_FAIL( "ExcelChartConverter::createDataSequence - cannot create data sequence" ); + OSL_FAIL( "ChartConverter::createDataSequence - cannot create data sequence" ); } } diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx index f6f1ad8523ec..8a98471abca9 100644 --- a/oox/source/drawingml/chart/seriesconverter.cxx +++ b/oox/source/drawingml/chart/seriesconverter.cxx @@ -35,6 +35,7 @@ #include <com/sun/star/chart2/XRegressionCurve.hpp> #include <com/sun/star/chart2/XRegressionCurveContainer.hpp> #include <com/sun/star/chart2/data/XDataSink.hpp> +#include <basegfx/numeric/ftools.hxx> #include "oox/drawingml/chart/datasourceconverter.hxx" #include "oox/drawingml/chart/seriesmodel.hxx" #include "oox/drawingml/chart/titleconverter.hxx" @@ -59,6 +60,15 @@ using ::rtl::OUString; namespace { +/** nastied-up sgn function - employs some gratuity around 0 - values + smaller than 0.33 are clamped to 0 + */ +int lclSgn( double nVal ) +{ + const int intVal=nVal*3; + return intVal == 0 ? 0 : (intVal < 0 ? -1 : 1); +} + Reference< XLabeledDataSequence > lclCreateLabeledDataSequence( const ConverterRoot& rParent, DataSourceModel* pValues, const OUString& rRole, @@ -114,6 +124,13 @@ void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatt bool bShowValue = !rDataLabel.mbDeleted && rDataLabel.mobShowVal.get( false ); bool bShowPercent = !rDataLabel.mbDeleted && rDataLabel.mobShowPercent.get( false ) && (rTypeInfo.meTypeCategory == TYPECATEGORY_PIE); + if( bShowValue && + !bShowPercent && rTypeInfo.meTypeCategory == TYPECATEGORY_PIE && + rDataLabel.maNumberFormat.maFormatCode.indexOfAsciiL("%", 1) >= 0 ) + { + bShowValue = false; + bShowPercent = true; + } bool bShowCateg = !rDataLabel.mbDeleted && rDataLabel.mobShowCatName.get( false ); bool bShowSymbol = !rDataLabel.mbDeleted && rDataLabel.mobShowLegendKey.get( false ); @@ -178,6 +195,27 @@ void DataLabelConverter::convertFromModel( const Reference< XDataSeries >& rxDat { PropertySet aPropSet( rxDataSeries->getDataPointByIndex( mrModel.mnIndex ) ); lclConvertLabelFormatting( aPropSet, getFormatter(), mrModel, rTypeGroup, false ); + + if( !mrModel.mxLayout->mbAutoLayout ) + { + // bnc#694340 - nasty hack - chart2 cannot individually + // place data labels, let's try to find a useful + // compromise instead + namespace csscd = ::com::sun::star::chart::DataLabelPlacement; + const sal_Int32 aPositionsLookupTable[] = + { + csscd::TOP_LEFT, csscd::TOP, csscd::TOP_RIGHT, + csscd::LEFT, csscd::CENTER, csscd::RIGHT, + csscd::BOTTOM_LEFT, csscd::BOTTOM, csscd::BOTTOM_RIGHT + }; + const double nMax=std::max( + fabs(mrModel.mxLayout->mfX), + fabs(mrModel.mxLayout->mfY)); + const int simplifiedX=lclSgn(mrModel.mxLayout->mfX/nMax); + const int simplifiedY=lclSgn(mrModel.mxLayout->mfY/nMax); + aPropSet.setProperty( PROP_LabelPlacement, + aPositionsLookupTable[ simplifiedX+1 + 3*(simplifiedY+1) ] ); + } } catch( Exception& ) { @@ -206,6 +244,7 @@ void DataLabelsConverter::convertFromModel( const Reference< XDataSeries >& rxDa // data point label settings for( DataLabelsModel::DataLabelVector::iterator aIt = mrModel.maPointLabels.begin(), aEnd = mrModel.maPointLabels.end(); aIt != aEnd; ++aIt ) { + (*aIt)->maNumberFormat.maFormatCode = mrModel.maNumberFormat.maFormatCode; DataLabelConverter aLabelConv( *this, **aIt ); aLabelConv.convertFromModel( rxDataSeries, rTypeGroup ); } @@ -596,6 +635,12 @@ Reference< XDataSeries > SeriesConverter::createDataSeries( const TypeGroupConve ModelRef< DataLabelsModel > xLabels = mrModel.mxLabels.is() ? mrModel.mxLabels : rTypeGroup.getModel().mxLabels; if( xLabels.is() ) { + if( xLabels->maNumberFormat.maFormatCode.isEmpty() ) + { + // Use number format code from Value series + DataSourceModel* pValues = mrModel.maSources.get( SeriesModel::VALUES ).get(); + xLabels->maNumberFormat.maFormatCode = pValues->mxDataSeq->maFormatCode; + } DataLabelsConverter aLabelsConv( *this, *xLabels ); aLabelsConv.convertFromModel( xDataSeries, rTypeGroup ); } diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index 4bb7663daf34..fb4d01356b59 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -377,30 +377,6 @@ sal_Int32 lcl_getSequenceLengthByRole( return 0; } -bool lcl_hasChartType( const Reference< chart2::XDiagram > & xDiagram, const OUString & rChartType ) -{ - try - { - Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW ); - Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); - for( sal_Int32 nCooSysIdx=0; nCooSysIdx<aCooSysSeq.getLength(); ++nCooSysIdx ) - { - Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY_THROW ); - Sequence< Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes()); - for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx ) - { - if( aChartTypes[nCTIdx]->getChartType().equals( rChartType )) - return true; - } - } - } - catch( uno::Exception & ) - { - OSL_FAIL( "Exception while searching for chart type in diagram" ); - } - return false; -} - OUString lcl_flattenStringSequence( const Sequence< OUString > & rSequence ) { OUStringBuffer aResult; diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx index 9e971e602da6..95a791d86b11 100644 --- a/oox/source/ole/axcontrol.cxx +++ b/oox/source/ole/axcontrol.cxx @@ -61,6 +61,7 @@ #include "oox/helper/containerhelper.hxx" #include "oox/helper/graphichelper.hxx" #include "oox/helper/propertymap.hxx" +#include "tools/string.hxx" namespace oox { namespace ole { @@ -1748,6 +1749,103 @@ void AxUserFormModel::convertProperties( PropertyMap& rPropMap, const ControlCon AxContainerModelBase::convertProperties( rPropMap, rConv ); } +HtmlSelectModel::HtmlSelectModel() +{ +} + +bool +HtmlSelectModel::importBinaryModel( BinaryInputStream& rInStrm ) +{ + static OUString sTerm( RTL_CONSTASCII_USTRINGPARAM("</SELECT") ); + static String sMultiple( RTL_CONSTASCII_USTRINGPARAM("<SELECT MULTIPLE") ); + static String sSelected( RTL_CONSTASCII_USTRINGPARAM("OPTION SELECTED") ); + + OUString sStringContents = rInStrm.readUnicodeArray( rInStrm.size() ); + + String data = sStringContents; + + // replace crlf with lf + data.SearchAndReplaceAll( String( RTL_CONSTASCII_USTRINGPARAM( "\x0D\x0A" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "\x0A" ) ) ); + std::vector< rtl::OUString > listValues; + std::vector< sal_Int16 > selectedIndices; + + // Ultra hacky parser for the info + sal_Int32 nTokenCount = data.GetTokenCount( '\n' ); + + for ( sal_Int32 nToken = 0; nToken < nTokenCount; ++nToken ) + { + String sLine( data.GetToken( nToken, '\n' ) ); + if ( !nToken ) // first line will tell us if multiselect is enabled + { + if ( sLine.CompareTo( sMultiple, sMultiple.Len() ) == COMPARE_EQUAL ) + mnMultiSelect = true; + } + // skip first and last lines, no data there + else if ( nToken < nTokenCount - 1) + { + if ( sLine.GetTokenCount( '>' ) ) + { + String displayValue = sLine.GetToken( 1, '>' ); + if ( displayValue.Len() ) + { + // Really we should be using a proper html parser + // escaping some common bits to be escaped + displayValue.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "<" ) ), String( RTL_CONSTASCII_USTRINGPARAM("<") ) ); + displayValue.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( ">" ) ), String( RTL_CONSTASCII_USTRINGPARAM(">") ) ); + displayValue.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( """ ) ), String( RTL_CONSTASCII_USTRINGPARAM("\"") ) ); + displayValue.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "&" ) ), String( RTL_CONSTASCII_USTRINGPARAM("&") ) ); + listValues.push_back( displayValue ); + if( sLine.Search( sSelected ) != STRING_NOTFOUND ) + selectedIndices.push_back( static_cast< sal_Int16 >( listValues.size() ) - 1 ); + } + } + } + } + if ( listValues.size() ) + { + msListData.realloc( listValues.size() ); + sal_Int32 index = 0; + for( std::vector< rtl::OUString >::iterator it = listValues.begin(); it != listValues.end(); ++it, ++index ) + msListData[ index ] = *it; + } + if ( selectedIndices.size() ) + { + msIndices.realloc( selectedIndices.size() ); + sal_Int32 index = 0; + for( std::vector< sal_Int16 >::iterator it = selectedIndices.begin(); it != selectedIndices.end(); ++it, ++index ) + msIndices[ index ] = *it; + } + return sal_True; +} + + +void +HtmlSelectModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const +{ + rPropMap.setProperty( PROP_StringItemList, msListData ); + rPropMap.setProperty( PROP_SelectedItems, msIndices ); + rPropMap.setProperty( PROP_Dropdown, true ); + AxListBoxModel::convertProperties( rPropMap, rConv ); +} + +HtmlTextBoxModel::HtmlTextBoxModel() +{ +} + +bool +HtmlTextBoxModel::importBinaryModel( BinaryInputStream& rInStrm ) +{ + OUString sStringContents = rInStrm.readUnicodeArray( rInStrm.size() ); +#ifdef DEBUG + // in msocximex ( where this is ported from, it appears *nothing* is read + // from the control stream ), surely there is some useful info there ? + OSL_TRACE("HtmlTextBoxModel::importBinaryModel - string contents of stream :"); + OSL_TRACE("%s", rtl::OUStringToOString( sStringContents, RTL_TEXTENCODING_UTF8 ).getStr() ); +#else + (void) rInStrm; +#endif + return true; +} // ============================================================================ EmbeddedControl::EmbeddedControl( const OUString& rName ) : @@ -1776,6 +1874,8 @@ ControlModelBase* EmbeddedControl::createModelFromGuid( const OUString& rClassId if( aClassId.equalsAscii( AX_GUID_SCROLLBAR ) ) return &createModel< AxScrollBarModel >(); if( aClassId.equalsAscii( AX_GUID_FRAME ) ) return &createModel< AxFrameModel >(); if( aClassId.equalsAscii( COMCTL_GUID_SCROLLBAR_60 ) ) return &createModel< ComCtlScrollBarModel >( COMCTL_VERSION_60 ); + if( aClassId.equalsAscii( HTML_GUID_SELECT ) ) return &createModel< HtmlSelectModel >(); + if( aClassId.equalsAscii( HTML_GUID_TEXTBOX ) ) return &createModel< HtmlTextBoxModel >(); mxModel.reset(); return 0; diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx index 95678f147cd4..2bcafc9a2882 100644 --- a/oox/source/ole/olehelper.cxx +++ b/oox/source/ole/olehelper.cxx @@ -32,6 +32,11 @@ #include "oox/helper/binaryinputstream.hxx" #include "oox/helper/graphichelper.hxx" #include "oox/token/tokens.hxx" +#include "oox/ole/axcontrol.hxx" +#include <com/sun/star/beans/XPropertySet.hpp> +#include "oox/helper/propertymap.hxx" +#include "oox/helper/propertyset.hxx" +#include "oox/ole/olestorage.hxx" namespace oox { namespace ole { @@ -41,6 +46,12 @@ namespace ole { using ::rtl::OUString; using ::rtl::OUStringBuffer; +using ::com::sun::star::form::XFormComponent; +using ::com::sun::star::awt::XControlModel; +using ::com::sun::star::beans::XPropertySet; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::UNO_QUERY; + // ============================================================================ namespace { @@ -308,6 +319,132 @@ StdFontInfo::StdFontInfo( const ::rtl::OUString& rName, sal_uInt32 nHeight, return !rInStrm.isEof(); } +Reference< ::com::sun::star::frame::XFrame > +lcl_getFrame( const Reference< ::com::sun::star::frame::XModel >& rxModel ) +{ + Reference< ::com::sun::star::frame::XFrame > xFrame; + if ( rxModel.is() ) + { + Reference< ::com::sun::star::frame::XController > xController = rxModel->getCurrentController(); + xFrame = xController.is() ? xController->getFrame() : NULL; + } + return xFrame; +} + +OleFormCtrlImportHelper::OleFormCtrlImportHelper( const Reference< com::sun::star::io::XInputStream > & rxInStrm, const Reference< ::com::sun::star::uno::XComponentContext >& rxCtx, const Reference< ::com::sun::star::frame::XModel >& rxModel ) : mpRoot( new ::oox::ole::OleStorage( rxCtx, rxInStrm, true ) ), mxCtx( rxCtx ), mxModel( rxModel ), maGrfHelper( rxCtx, lcl_getFrame( rxModel ), mpRoot ) +{ +} + +OleFormCtrlImportHelper::~OleFormCtrlImportHelper() +{ +} + +bool +OleFormCtrlImportHelper::importControlFromStream( ::oox::BinaryInputStream& rInStrm, Reference< XFormComponent >& rxFormComp, const ::rtl::OUString& rGuidString ) +{ + ::oox::ole::EmbeddedControl aControl( CREATE_OUSTRING( "Unknown" ) ); + if( ::oox::ole::ControlModelBase* pModel = aControl.createModelFromGuid( rGuidString ) ) + { + pModel->importBinaryModel( rInStrm ); + rxFormComp.set( mxCtx->getServiceManager()->createInstanceWithContext( pModel->getServiceName(), mxCtx ), UNO_QUERY ); + Reference< XControlModel > xCtlModel( rxFormComp, UNO_QUERY ); + ::oox::ole::ControlConverter aConv( mxModel, maGrfHelper ); + aControl.convertProperties( xCtlModel, aConv ); + } + return rxFormComp.is(); +} + +bool +OleFormCtrlImportHelper::importFormControlFromCtls( Reference< XFormComponent > & rxFormComp, + sal_Int32 nPos, + sal_Int32 nStreamSize) +{ + if ( mpRoot.get() && mpRoot->isStorage() ) + { + if ( !mpCtlsStrm.get() ) + mpCtlsStrm.reset( new BinaryXInputStream( mpRoot->openInputStream( CREATE_OUSTRING( "Ctls" ) ), true ) ); + mpCtlsStrm->seek( nPos ); + OUString aStrmClassId = ::oox::ole::OleHelper::importGuid( *mpCtlsStrm ); + + bool bOneOfHtmlControls = false; + if ( aStrmClassId.toAsciiUpperCase().equalsAscii( HTML_GUID_SELECT ) + || aStrmClassId.toAsciiUpperCase().equalsAscii( HTML_GUID_TEXTBOX ) ) + bOneOfHtmlControls = false; + + if ( bOneOfHtmlControls ) + { + // html controls don't seem have a handy record length following the GUID + // in the binary stream. + // Given the control stream length create a stream of nStreamSize bytes starting from + // nPos ( offset by the guid already read in ) + const int nGuidSize = 0x10; + StreamDataSequence aDataSeq; + sal_Int32 nBytesToRead = nStreamSize - nGuidSize; + while ( nBytesToRead ) + nBytesToRead -= mpCtlsStrm->readData( aDataSeq, nBytesToRead ); + SequenceInputStream aInSeqStream( aDataSeq ); + importControlFromStream( aInSeqStream, rxFormComp, aStrmClassId ); + } + else + { + importControlFromStream( *mpCtlsStrm, rxFormComp, aStrmClassId ); + } + } + return rxFormComp.is(); +} + +bool OleFormCtrlImportHelper::importControlFromStorage( ::oox::StorageRef xObjStrg, + Reference< XFormComponent > & rxFormComp ) +{ + if ( xObjStrg.get() && xObjStrg->isStorage() ) + { + BinaryXInputStream aNameStream( xObjStrg->openInputStream( CREATE_OUSTRING("\3OCXNAME") ), true ); + BinaryXInputStream aInStrm( xObjStrg->openInputStream( CREATE_OUSTRING("contents") ), true ); + BinaryXInputStream aClsStrm( xObjStrg->openInputStream( CREATE_OUSTRING("\1CompObj") ), true ); + aClsStrm.skip(12); + OUString aStrmClassId = ::oox::ole::OleHelper::importGuid( aClsStrm ); + if ( importControlFromStream( aInStrm, rxFormComp, aStrmClassId ) ) + { + OUString aName = aNameStream.readNulUnicodeArray(); + Reference< XControlModel > xCtlModel( rxFormComp, UNO_QUERY ); + if ( aName.getLength() && xCtlModel.is() ) + { + PropertyMap aPropMap; + aPropMap.setProperty( PROP_Name, aName ); + PropertySet aPropSet( xCtlModel ); + aPropSet.setProperties( aPropMap ); + } + } + } + return rxFormComp.is(); +} + +bool +OleFormCtrlImportHelper::importFormControlFromObjStorage( Reference< XFormComponent > & rxFormComp ) +{ + return importControlFromStorage( mpRoot, rxFormComp ); +} + +bool +OleFormCtrlImportHelper::importFormControlFromObjPool( Reference< XFormComponent > & rxFormComp, + const ::rtl::OUString& rPoolName ) +{ + bool bRet = false; + if ( mpRoot.get() ) + { + if ( !mpPoolStrg.get() ) + mpPoolStrg = mpRoot->openSubStorage( CREATE_OUSTRING( "ObjectPool" ), false ); + if ( !mpPoolStrg.get() ) + return false; + if ( mpPoolStrg->isStorage() ) + { + StorageRef xObjStrg = mpPoolStrg->openSubStorage( rPoolName, false ); + bRet = importControlFromStorage( xObjStrg, rxFormComp ); + } + } + return bRet; +} + // ============================================================================ } // namespace ole diff --git a/oox/source/ppt/animvariantcontext.cxx b/oox/source/ppt/animvariantcontext.cxx index 7d0c9a6c153e..c559cbb56d18 100644 --- a/oox/source/ppt/animvariantcontext.cxx +++ b/oox/source/ppt/animvariantcontext.cxx @@ -48,8 +48,8 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace ppt { - AnimVariantContext::AnimVariantContext( ContextHandler& rParent, sal_Int32 aElement, Any & aValue ) - : ContextHandler( rParent ) + AnimVariantContext::AnimVariantContext( FragmentHandler2& rParent, sal_Int32 aElement, Any & aValue ) + : FragmentHandler2( rParent ) , mnElement( aElement ) , maValue( aValue ) { @@ -59,63 +59,52 @@ namespace oox { namespace ppt { { } - void SAL_CALL AnimVariantContext::endFastElement( sal_Int32 aElement ) - throw ( SAXException, RuntimeException) + void AnimVariantContext::onEndElement() { - if( ( aElement == mnElement ) && maColor.isUsed() ) + if( isCurrentElement( mnElement ) && maColor.isUsed() ) { maValue = makeAny( maColor.getColor( getFilter().getGraphicHelper() ) ); } } - Reference< XFastContextHandler > - SAL_CALL AnimVariantContext::createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) + ContextHandlerRef AnimVariantContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - AttributeList attribs(xAttribs); - switch( aElementToken ) { case PPT_TOKEN( boolVal ): { - bool val = attribs.getBool( XML_val, false ); + bool val = rAttribs.getBool( XML_val, false ); maValue = makeAny( val ); - break; + return this; } case PPT_TOKEN( clrVal ): - xRet.set( new ::oox::drawingml::ColorContext( *this, maColor ) ); + return new ::oox::drawingml::ColorContext( *this, maColor ); // we'll defer setting the Any until the end. - break; case PPT_TOKEN( fltVal ): { - double val = attribs.getDouble( XML_val, 0.0 ); + double val = rAttribs.getDouble( XML_val, 0.0 ); maValue = makeAny( val ); - break; + return this; } case PPT_TOKEN( intVal ): { - sal_Int32 val = attribs.getInteger( XML_val, 0 ); + sal_Int32 val = rAttribs.getInteger( XML_val, 0 ); maValue = makeAny( val ); - break; + return this; } case PPT_TOKEN( strVal ): { - OUString val = attribs.getString( XML_val, OUString() ); + OUString val = rAttribs.getString( XML_val, OUString() ); convertMeasure( val ); // ignore success or failure if it fails, use as is maValue = makeAny( val ); - break; + return this; } default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } diff --git a/oox/source/ppt/animvariantcontext.hxx b/oox/source/ppt/animvariantcontext.hxx index 7508cbef40b9..3c0c2a029bb5 100644 --- a/oox/source/ppt/animvariantcontext.hxx +++ b/oox/source/ppt/animvariantcontext.hxx @@ -34,20 +34,20 @@ #include <com/sun/star/uno/Any.hxx> -#include "oox/core/contexthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" #include "oox/drawingml/color.hxx" namespace oox { namespace ppt { /** context CT_TLAnimVariant */ class AnimVariantContext - : public ::oox::core::ContextHandler + : public ::oox::core::FragmentHandler2 { public: - AnimVariantContext( ::oox::core::ContextHandler& rParent, ::sal_Int32 aElement, ::com::sun::star::uno::Any & aValue ); + AnimVariantContext( ::oox::core::FragmentHandler2& rParent, ::sal_Int32 aElement, ::com::sun::star::uno::Any & aValue ); ~AnimVariantContext( ) throw( ); - virtual void SAL_CALL endFastElement( sal_Int32 /*aElement*/ ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - 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 ); + virtual void onEndElement(); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); private: ::sal_Int32 mnElement; diff --git a/oox/source/ppt/backgroundproperties.cxx b/oox/source/ppt/backgroundproperties.cxx index e3a3714417ff..bbc9940ad10b 100644 --- a/oox/source/ppt/backgroundproperties.cxx +++ b/oox/source/ppt/backgroundproperties.cxx @@ -29,6 +29,7 @@ #include "oox/ppt/backgroundproperties.hxx" #include "oox/drawingml/fillpropertiesgroupcontext.hxx" #include "oox/drawingml/drawingmltypes.hxx" +#include "oox/core/contexthandler2.hxx" using ::rtl::OUString; using namespace ::oox::core; @@ -38,27 +39,22 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace ppt { // --------------------------------------------------------------------- -BackgroundPropertiesContext::BackgroundPropertiesContext( ContextHandler& rParent, ::oox::drawingml::FillProperties& rFillProperties ) throw() -: ContextHandler( rParent ) +BackgroundPropertiesContext::BackgroundPropertiesContext( FragmentHandler2& rParent, ::oox::drawingml::FillProperties& rFillProperties ) +: FragmentHandler2( rParent ) , mrFillProperties( rFillProperties ) { } -Reference< XFastContextHandler > BackgroundPropertiesContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +::oox::core::ContextHandlerRef BackgroundPropertiesContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch( aElementToken ) { case PPT_TOKEN( fill ): // a:CT_FillEffect - break; + return this; } // FillPropertiesGroupContext - if( !xRet.is() ) - xRet = ::oox::drawingml::FillPropertiesContext::createFillContext( *this, aElementToken, xAttribs, mrFillProperties ); - - return xRet; + return dynamic_cast <ContextHandler *> (::oox::drawingml::FillPropertiesContext::createFillContext( *this, aElementToken, rAttribs.getFastAttributeList(), mrFillProperties ).get()); } } } diff --git a/oox/source/ppt/buildlistcontext.cxx b/oox/source/ppt/buildlistcontext.cxx index 11c07c484a91..cd0ea90964a6 100644 --- a/oox/source/ppt/buildlistcontext.cxx +++ b/oox/source/ppt/buildlistcontext.cxx @@ -38,10 +38,10 @@ using ::rtl::OUString; namespace oox { namespace ppt { - BuildListContext::BuildListContext( ContextHandler& rParent, + BuildListContext::BuildListContext( FragmentHandler2& rParent, const Reference< XFastAttributeList >& /*xAttribs*/, TimeNodePtrList & aTimeNodeList) - : ContextHandler( rParent ) + : FragmentHandler2( rParent ) , maTimeNodeList( aTimeNodeList ) , mbInBldGraphic( false ) , mbBuildAsOne( false ) @@ -52,9 +52,9 @@ namespace oox { namespace ppt { { } - void SAL_CALL BuildListContext::endFastElement( sal_Int32 aElement ) throw ( SAXException, RuntimeException) + void BuildListContext::onEndElement() { - switch( aElement ) + switch( getCurrentElement() ) { case PPT_TOKEN( bldGraphic ): mbInBldGraphic = false; @@ -64,12 +64,8 @@ namespace oox { namespace ppt { } } - Reference< XFastContextHandler > SAL_CALL BuildListContext::createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) + ::oox::core::ContextHandlerRef BuildListContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch( aElementToken ) { case PPT_TOKEN( bldAsOne ): @@ -77,36 +73,31 @@ namespace oox { namespace ppt { { mbBuildAsOne = true; } - break; + return this; case PPT_TOKEN( bldSub ): if( mbInBldGraphic ) { } - break; + return this; case PPT_TOKEN( bldGraphic ): { mbInBldGraphic = true; - AttributeList attribs( xAttribs ); - OUString sShapeId = xAttribs->getOptionalValue( XML_spid ); + OUString sShapeId = rAttribs.getString( XML_spid, OUString() ); // TODO -// bool uiExpand = attribs.getBool( XML_uiExpand, true ); +// bool uiExpand = rAttribs.getBool( XML_uiExpand, true ); /* this is unsigned */ -// sal_uInt32 nGroupId = attribs.getUnsignedInteger( XML_grpId, 0 ); - break; +// sal_uInt32 nGroupId = rAttribs.getUnsignedInteger( XML_grpId, 0 ); + return this; } case A_TOKEN( bldDgm ): case A_TOKEN( bldOleChart ): case A_TOKEN( bldP ): - - break; + return this; default: break; } - if( !xRet.is() ) - xRet.set(this); - - return xRet; + return this; } diff --git a/oox/source/ppt/buildlistcontext.hxx b/oox/source/ppt/buildlistcontext.hxx index 1c4e3949fa7b..f147fa8af215 100644 --- a/oox/source/ppt/buildlistcontext.hxx +++ b/oox/source/ppt/buildlistcontext.hxx @@ -32,25 +32,25 @@ #define OOX_PPT_BUILDLISTCONTEXT #include "oox/ppt/timenode.hxx" -#include "oox/core/contexthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" namespace oox { namespace ppt { /** CT_BuildList */ class BuildListContext - : public ::oox::core::ContextHandler + : public ::oox::core::FragmentHandler2 { public: - BuildListContext( ::oox::core::ContextHandler& rParent, + BuildListContext( ::oox::core::FragmentHandler2& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, TimeNodePtrList & aTimeNodeList); ~BuildListContext( ); - virtual void SAL_CALL endFastElement( sal_Int32 aElement ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void onEndElement(); - 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 ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); private: TimeNodePtrList & maTimeNodeList; bool mbInBldGraphic; diff --git a/oox/source/ppt/commonbehaviorcontext.cxx b/oox/source/ppt/commonbehaviorcontext.cxx index 72c59f730053..2e24aa43adb6 100644 --- a/oox/source/ppt/commonbehaviorcontext.cxx +++ b/oox/source/ppt/commonbehaviorcontext.cxx @@ -53,7 +53,7 @@ using namespace ::com::sun::star::animations; namespace oox { namespace ppt { - CommonBehaviorContext::CommonBehaviorContext( ContextHandler& rParent, + CommonBehaviorContext::CommonBehaviorContext( FragmentHandler2& rParent, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) : TimeNodeContext( rParent, PPT_TOKEN( cBhvr ), xAttribs, pNode ) @@ -69,10 +69,9 @@ namespace oox { namespace ppt { - void SAL_CALL CommonBehaviorContext::endFastElement( sal_Int32 aElement ) - throw ( SAXException, RuntimeException) + void CommonBehaviorContext::onEndElement() { - switch( aElement ) + switch( getCurrentElement() ) { case PPT_TOKEN( cBhvr ): { @@ -126,8 +125,7 @@ namespace oox { namespace ppt { } - void CommonBehaviorContext::characters( const OUString& aChars ) - throw( SAXException, RuntimeException ) + void CommonBehaviorContext::onCharacters( const OUString& aChars ) { if( mbIsInAttrName ) { @@ -136,23 +134,17 @@ namespace oox { namespace ppt { } - Reference< XFastContextHandler > SAL_CALL CommonBehaviorContext::createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) + ::oox::core::ContextHandlerRef CommonBehaviorContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( cTn ): - xRet.set( new CommonTimeNodeContext( *this, aElementToken, xAttribs, mpNode ) ); - break; + return new CommonTimeNodeContext( *this, aElementToken, rAttribs.getFastAttributeList(), mpNode ); case PPT_TOKEN( tgtEl ): - xRet.set( new TimeTargetElementContext( *this, mpNode->getTarget() ) ); - break; + return new TimeTargetElementContext( *this, mpNode->getTarget() ); case PPT_TOKEN( attrNameLst ): mbInAttrList = true; - break; + return this; case PPT_TOKEN( attrName ): { if( mbInAttrList ) @@ -164,16 +156,13 @@ namespace oox { namespace ppt { { OSL_TRACE( "OOX: Attribute Name outside an Attribute List" ); } - break; + return this; } default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } } } diff --git a/oox/source/ppt/commonbehaviorcontext.hxx b/oox/source/ppt/commonbehaviorcontext.hxx index e047bbc46c7f..4415687f0b06 100644 --- a/oox/source/ppt/commonbehaviorcontext.hxx +++ b/oox/source/ppt/commonbehaviorcontext.hxx @@ -50,24 +50,17 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - CommonBehaviorContext( ::oox::core::ContextHandler& rParent, + CommonBehaviorContext( ::oox::core::FragmentHandler2& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ); ~CommonBehaviorContext( ) throw( ); - virtual void SAL_CALL endFastElement( sal_Int32 aElement ) - throw ( ::com::sun::star::xml::sax::SAXException, - ::com::sun::star::uno::RuntimeException ); + virtual void onEndElement(); - virtual void SAL_CALL characters( const ::rtl::OUString& aChars ) - throw ( ::com::sun::star::xml::sax::SAXException, - ::com::sun::star::uno::RuntimeException ); + virtual void onCharacters( const ::rtl::OUString& aChars ); - 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 ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); private: bool mbInAttrList; diff --git a/oox/source/ppt/commontimenodecontext.cxx b/oox/source/ppt/commontimenodecontext.cxx index ac88c8c67a1a..30b630cacf72 100644 --- a/oox/source/ppt/commontimenodecontext.cxx +++ b/oox/source/ppt/commontimenodecontext.cxx @@ -374,7 +374,7 @@ static OUString getConvertedSubType( sal_Int16 nPresetClass, sal_Int32 nPresetId // END CommonTimeNodeContext::CommonTimeNodeContext( - ContextHandler& rParent, + FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) @@ -614,39 +614,34 @@ static OUString getConvertedSubType( sal_Int16 nPresetClass, sal_Int32 nPresetId } - void SAL_CALL CommonTimeNodeContext::endFastElement( sal_Int32 aElement ) throw ( SAXException, RuntimeException) + void CommonTimeNodeContext::onEndElement() { - if( aElement == ( PPT_TOKEN( iterate ) ) ) + if( isCurrentElement( PPT_TOKEN( iterate ) ) ) { mbIterate = false; } } - Reference< XFastContextHandler > SAL_CALL CommonTimeNodeContext::createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException ) + ::oox::core::ContextHandlerRef CommonTimeNodeContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; switch ( aElementToken ) { case PPT_TOKEN( childTnLst ): case PPT_TOKEN( subTnLst ): - xRet.set( new TimeNodeListContext( *this, mpNode->getChildren() ) ); - break; + return new TimeNodeListContext( *this, mpNode->getChildren() ); case PPT_TOKEN( stCondLst ): - xRet.set( new CondListContext( *this, aElementToken, xAttribs, mpNode, mpNode->getStartCondition() ) ); - break; + return new CondListContext( *this, aElementToken, rAttribs.getFastAttributeList(), mpNode, mpNode->getStartCondition() ); case PPT_TOKEN( endCondLst ): - xRet.set( new CondListContext( *this, aElementToken, xAttribs, mpNode, mpNode->getEndCondition() ) ); - break; + return new CondListContext( *this, aElementToken, rAttribs.getFastAttributeList(), mpNode, mpNode->getEndCondition() ); case PPT_TOKEN( endSync ): - xRet.set( new CondContext( *this, xAttribs, mpNode, mpNode->getEndSyncValue() ) ); - break; + return new CondContext( *this, rAttribs.getFastAttributeList(), mpNode, mpNode->getEndSyncValue() ); case PPT_TOKEN( iterate ): { - sal_Int32 nVal = xAttribs->getOptionalValueToken( XML_type, XML_el ); + sal_Int32 nVal = rAttribs.getToken( XML_type, XML_el ); if( nVal != 0 ) { // TODO put that in a function @@ -671,37 +666,31 @@ static OUString getConvertedSubType( sal_Int16 nPresetClass, sal_Int32 nPresetId mpNode->getNodeProperties()[ NP_ITERATETYPE ] <<= nEnum; } // in case of exception we ignore the whole tag. - AttributeList attribs( xAttribs ); // TODO what to do with this - /*bool bBackwards =*/ attribs.getBool( XML_backwards, false ); + /*bool bBackwards =*/ rAttribs.getBool( XML_backwards, false ); mbIterate = true; - break; + return this; } case PPT_TOKEN( tmAbs ): if( mbIterate ) { - AttributeList attribs( xAttribs ); - double fTime = attribs.getUnsigned( XML_val, 0 ); + double fTime = rAttribs.getUnsigned( XML_val, 0 ); // time in ms. property is in % TODO mpNode->getNodeProperties()[ NP_ITERATEINTERVAL ] <<= fTime; } - break; + return this; case PPT_TOKEN( tmPct ): if( mbIterate ) { - AttributeList attribs( xAttribs ); - double fPercent = (double)attribs.getUnsigned( XML_val, 0 ) / 100000.0; + double fPercent = (double)rAttribs.getUnsigned( XML_val, 0 ) / 100000.0; mpNode->getNodeProperties()[ NP_ITERATEINTERVAL ] <<= fPercent; } - break; + return this; default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } } } diff --git a/oox/source/ppt/commontimenodecontext.hxx b/oox/source/ppt/commontimenodecontext.hxx index cb67433ee398..0cdb8be7868e 100644 --- a/oox/source/ppt/commontimenodecontext.hxx +++ b/oox/source/ppt/commontimenodecontext.hxx @@ -44,12 +44,12 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - CommonTimeNodeContext( ::oox::core::ContextHandler& rParent, sal_Int32 aElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode); + CommonTimeNodeContext( ::oox::core::FragmentHandler2& rParent, sal_Int32 aElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode); ~CommonTimeNodeContext( ) throw( ); - virtual void SAL_CALL endFastElement( sal_Int32 aElement ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void onEndElement(); - 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 ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); private: bool mbIterate; diff --git a/oox/source/ppt/conditioncontext.cxx b/oox/source/ppt/conditioncontext.cxx index 97dd7f9bfcd5..6be6b1f0753a 100644 --- a/oox/source/ppt/conditioncontext.cxx +++ b/oox/source/ppt/conditioncontext.cxx @@ -51,7 +51,7 @@ using namespace ::com::sun::star::animations; namespace oox { namespace ppt { - CondContext::CondContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, + CondContext::CondContext( FragmentHandler2& rParent, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode, AnimationCondition & aValue ) : TimeNodeContext( rParent, PPT_TOKEN( cond ), xAttribs, pNode ) , maCond( aValue ) @@ -116,10 +116,8 @@ namespace oox { namespace ppt { } } - Reference< XFastContextHandler > SAL_CALL CondContext::createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException ) + ::oox::core::ContextHandlerRef CondContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch( aElementToken ) { case PPT_TOKEN( rtn ): @@ -127,7 +125,7 @@ namespace oox { namespace ppt { // ST_TLTriggerRuntimeNode { first, last, all } sal_Int32 aTok; sal_Int16 nEnum; - aTok = xAttribs->getOptionalValueToken( XML_val, XML_first ); + aTok = rAttribs.getToken( XML_val, XML_first ); switch( aTok ) { case XML_first: @@ -144,28 +142,23 @@ namespace oox { namespace ppt { } maCond.mnType = aElementToken; maCond.maValue = makeAny( nEnum ); - break; + return this; } case PPT_TOKEN( tn ): { maCond.mnType = aElementToken; - AttributeList attribs( xAttribs ); - sal_uInt32 nId = attribs.getUnsigned( XML_val, 0 ); + sal_uInt32 nId = rAttribs.getUnsigned( XML_val, 0 ); maCond.maValue = makeAny( nId ); - break; + return this; } case PPT_TOKEN( tgtEl ): // CT_TLTimeTargetElement - xRet.set( new TimeTargetElementContext( *this, maCond.getTarget() ) ); - break; + return new TimeTargetElementContext( *this, maCond.getTarget() ); default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } @@ -173,7 +166,7 @@ namespace oox { namespace ppt { /** CT_TLTimeConditionList */ CondListContext::CondListContext( - ContextHandler& rParent, sal_Int32 aElement, + FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode, AnimationConditionList & aCond ) @@ -187,25 +180,19 @@ namespace oox { namespace ppt { { } - Reference< XFastContextHandler > CondListContext::createFastChildContext( ::sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException ) + ::oox::core::ContextHandlerRef CondListContext::onCreateContext( sal_Int32 aElement, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch( aElement ) { case PPT_TOKEN( cond ): // add a condition to the list maConditions.push_back( AnimationCondition() ); - xRet.set( new CondContext( *this, xAttribs, mpNode, maConditions.back() ) ); + return new CondContext( *this, rAttribs.getFastAttributeList(), mpNode, maConditions.back() ); break; default: break; } - - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } diff --git a/oox/source/ppt/conditioncontext.hxx b/oox/source/ppt/conditioncontext.hxx index 3abd050da006..ff387a123193 100644 --- a/oox/source/ppt/conditioncontext.hxx +++ b/oox/source/ppt/conditioncontext.hxx @@ -46,11 +46,11 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - CondContext( ::oox::core::ContextHandler& rParent, + CondContext( ::oox::core::FragmentHandler2& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode, AnimationCondition & aCond ); ~CondContext( ) throw( ); - 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 ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); private: // ::com::sun::star::uno::Any & maCond; @@ -66,13 +66,13 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - CondListContext( ::oox::core::ContextHandler& rParent, + CondListContext( ::oox::core::FragmentHandler2& rParent, sal_Int32 aElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode, AnimationConditionList & aCondList ); ~CondListContext( ) throw( ); - 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 ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); private: AnimationConditionList & maConditions; diff --git a/oox/source/ppt/customshowlistcontext.cxx b/oox/source/ppt/customshowlistcontext.cxx index 76bac5b7467c..c75ee4e8a370 100644 --- a/oox/source/ppt/customshowlistcontext.cxx +++ b/oox/source/ppt/customshowlistcontext.cxx @@ -34,24 +34,22 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace ppt { -class CustomShowContext : public ::oox::core::ContextHandler +class CustomShowContext : public ::oox::core::FragmentHandler2 { CustomShow mrCustomShow; public: - CustomShowContext( ::oox::core::ContextHandler& rParent, + CustomShowContext( ::oox::core::FragmentHandler2& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, CustomShow& rCustomShow ); ~CustomShowContext( ); - 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 ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); }; -CustomShowContext::CustomShowContext( ContextHandler& rParent, +CustomShowContext::CustomShowContext( FragmentHandler2& rParent, const Reference< XFastAttributeList >& rxAttribs, CustomShow& rCustomShow ) -: ContextHandler( rParent ) +: FragmentHandler2( rParent ) , mrCustomShow( rCustomShow ) { mrCustomShow.maName = rxAttribs->getOptionalValue( XML_name ); @@ -62,29 +60,25 @@ CustomShowContext::~CustomShowContext( ) { } -Reference< XFastContextHandler > SAL_CALL CustomShowContext::createFastChildContext( sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) +::oox::core::ContextHandlerRef CustomShowContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; switch( aElementToken ) { case PPT_TOKEN( sld ) : - mrCustomShow.maSldLst.push_back( xAttribs->getOptionalValue( R_TOKEN( id ) ) ); + mrCustomShow.maSldLst.push_back( rAttribs.getString( R_TOKEN( id ), rtl::OUString() ) ); + return this; default: break; } - if( !xRet.is() ) - xRet.set( this ); - return xRet; + return this; } //--------------------------------------------------------------------------- -CustomShowListContext::CustomShowListContext( ContextHandler& rParent, +CustomShowListContext::CustomShowListContext( FragmentHandler2& rParent, std::vector< CustomShow >& rCustomShowList ) -: ContextHandler( rParent ) +: FragmentHandler2( rParent ) , mrCustomShowList( rCustomShowList ) { } @@ -93,26 +87,21 @@ CustomShowListContext::~CustomShowListContext( ) { } -Reference< XFastContextHandler > SAL_CALL CustomShowListContext::createFastChildContext( sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) +::oox::core::ContextHandlerRef CustomShowListContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; switch( aElementToken ) { case PPT_TOKEN( custShow ) : { CustomShow aCustomShow; mrCustomShowList.push_back( aCustomShow ); - xRet = new CustomShowContext( *this, xAttribs, mrCustomShowList.back() ); + return new CustomShowContext( *this, rAttribs.getFastAttributeList(), mrCustomShowList.back() ); } default: break; } - if( !xRet.is() ) - xRet.set( this ); - return xRet; + return this; } diff --git a/oox/source/ppt/headerfootercontext.cxx b/oox/source/ppt/headerfootercontext.cxx index 88a1e7c60894..83963585bd0d 100644 --- a/oox/source/ppt/headerfootercontext.cxx +++ b/oox/source/ppt/headerfootercontext.cxx @@ -35,26 +35,25 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace ppt { - HeaderFooterContext::HeaderFooterContext( ContextHandler& rParent, - const Reference< XFastAttributeList >& xAttribs, HeaderFooter& rHeaderFooter ) - : ContextHandler( rParent ) + HeaderFooterContext::HeaderFooterContext( FragmentHandler2& rParent, + const AttributeList& rAttribs, HeaderFooter& rHeaderFooter ) + : FragmentHandler2( rParent ) { - AttributeList aAttribs( xAttribs ); - if ( xAttribs->hasAttribute( XML_sldNum ) ) + if ( rAttribs.hasAttribute( XML_sldNum ) ) { - rHeaderFooter.mbSlideNumber = aAttribs.getBool( XML_sldNum, sal_True ); + rHeaderFooter.mbSlideNumber = rAttribs.getBool( XML_sldNum, sal_True ); } - if ( xAttribs->hasAttribute( XML_hdr ) ) + if ( rAttribs.hasAttribute( XML_hdr ) ) { - rHeaderFooter.mbHeader = aAttribs.getBool( XML_hdr, sal_True ); + rHeaderFooter.mbHeader = rAttribs.getBool( XML_hdr, sal_True ); } - if ( xAttribs->hasAttribute( XML_ftr ) ) + if ( rAttribs.hasAttribute( XML_ftr ) ) { - rHeaderFooter.mbFooter = aAttribs.getBool( XML_ftr, sal_True ); + rHeaderFooter.mbFooter = rAttribs.getBool( XML_ftr, sal_True ); } - if ( xAttribs->hasAttribute( XML_dt ) ) + if ( rAttribs.hasAttribute( XML_dt ) ) { - rHeaderFooter.mbDateTime = aAttribs.getBool( XML_dt, sal_True ); + rHeaderFooter.mbDateTime = rAttribs.getBool( XML_dt, sal_True ); } } diff --git a/oox/source/ppt/headerfootercontext.hxx b/oox/source/ppt/headerfootercontext.hxx index 7cd83b5f53e4..4cc78b9e7dcf 100644 --- a/oox/source/ppt/headerfootercontext.hxx +++ b/oox/source/ppt/headerfootercontext.hxx @@ -32,16 +32,16 @@ #define OOX_PPT_HEADERFOOTERCONTEXT #include "oox/ppt/headerfooter.hxx" -#include "oox/core/contexthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" namespace oox { namespace ppt { /** CT_HeaderFooter */ - class HeaderFooterContext : public ::oox::core::ContextHandler + class HeaderFooterContext : public ::oox::core::FragmentHandler2 { public: - HeaderFooterContext( ::oox::core::ContextHandler& rParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, HeaderFooter& rHeaderFooter ); + HeaderFooterContext( ::oox::core::FragmentHandler2& rParent, + const AttributeList& rAttribs, HeaderFooter& rHeaderFooter ); ~HeaderFooterContext( ); }; diff --git a/oox/source/ppt/layoutfragmenthandler.cxx b/oox/source/ppt/layoutfragmenthandler.cxx index 19a9e6ead026..6697f8190db2 100644 --- a/oox/source/ppt/layoutfragmenthandler.cxx +++ b/oox/source/ppt/layoutfragmenthandler.cxx @@ -60,27 +60,20 @@ LayoutFragmentHandler::~LayoutFragmentHandler() } -Reference< XFastContextHandler > LayoutFragmentHandler::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) - throw (SAXException, RuntimeException) +ContextHandlerRef LayoutFragmentHandler::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet = getFastContextHandler(); switch( aElementToken ) { case PPT_TOKEN( sldLayout ): // CT_SlideLayout - mpSlidePersistPtr->setLayoutValueToken( xAttribs->getOptionalValueToken( XML_type, 0 ) ); // CT_SlideLayoutType + mpSlidePersistPtr->setLayoutValueToken( rAttribs.getToken( XML_type, 0 ) ); // CT_SlideLayoutType break; case PPT_TOKEN( hf ): // CT_HeaderFooter - xRet.set( new HeaderFooterContext( *this, xAttribs, mpSlidePersistPtr->getHeaderFooter() ) ); + return new HeaderFooterContext( *this, rAttribs, mpSlidePersistPtr->getHeaderFooter() ); break; default: - xRet.set( SlideFragmentHandler::createFastChildContext( aElementToken, xAttribs ) ); + return SlideFragmentHandler::onCreateContext( aElementToken, rAttribs ); } - return xRet; -} - -void SAL_CALL LayoutFragmentHandler::endDocument() - throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) -{ + return this; } } } diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index 31a2781d845b..e9fe6994472e 100644 --- a/oox/source/ppt/presentationfragmenthandler.cxx +++ b/oox/source/ppt/presentationfragmenthandler.cxx @@ -61,7 +61,7 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace ppt { PresentationFragmentHandler::PresentationFragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath ) throw() -: FragmentHandler( rFilter, rFragmentPath ) +: FragmentHandler2( rFilter, rFragmentPath ) , mpTextListStyle( new TextListStyle ) { TextParagraphPropertiesVector& rParagraphDefaulsVector( mpTextListStyle->getListStyle() ); @@ -76,10 +76,6 @@ PresentationFragmentHandler::PresentationFragmentHandler( XmlFilterBase& rFilter PresentationFragmentHandler::~PresentationFragmentHandler() throw() { - -} -void PresentationFragmentHandler::startDocument() throw (SAXException, RuntimeException) -{ } void ResolveTextFields( XmlFilterBase& rFilter ) @@ -142,7 +138,7 @@ void ResolveTextFields( XmlFilterBase& rFilter ) } } -void PresentationFragmentHandler::endDocument() throw (SAXException, RuntimeException) +void PresentationFragmentHandler::finalizeImport() { // todo: localized progress bar text const Reference< task::XStatusIndicator >& rxStatusIndicator( getFilter().getStatusIndicator() ); @@ -300,41 +296,36 @@ void PresentationFragmentHandler::endDocument() throw (SAXException, RuntimeExce } // CT_Presentation -Reference< XFastContextHandler > PresentationFragmentHandler::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +::oox::core::ContextHandlerRef PresentationFragmentHandler::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; switch( aElementToken ) { case PPT_TOKEN( presentation ): case PPT_TOKEN( sldMasterIdLst ): case PPT_TOKEN( notesMasterIdLst ): case PPT_TOKEN( sldIdLst ): - break; + return this; case PPT_TOKEN( sldMasterId ): - maSlideMasterVector.push_back( xAttribs->getOptionalValue( R_TOKEN( id ) ) ); - break; + maSlideMasterVector.push_back( rAttribs.getString( R_TOKEN( id ), OUString() ) ); + return this; case PPT_TOKEN( sldId ): - maSlidesVector.push_back( xAttribs->getOptionalValue( R_TOKEN( id ) ) ); - break; + maSlidesVector.push_back( rAttribs.getString( R_TOKEN( id ), OUString() ) ); + return this; case PPT_TOKEN( notesMasterId ): - maNotesMasterVector.push_back( xAttribs->getOptionalValue(R_TOKEN( id ) ) ); - break; + maNotesMasterVector.push_back( rAttribs.getString( R_TOKEN( id ), OUString() ) ); + return this; case PPT_TOKEN( sldSz ): - maSlideSize = GetSize2D( xAttribs ); - break; + maSlideSize = GetSize2D( rAttribs.getFastAttributeList() ); + return this; case PPT_TOKEN( notesSz ): - maNotesSize = GetSize2D( xAttribs ); - break; + maNotesSize = GetSize2D( rAttribs.getFastAttributeList() ); + return this; case PPT_TOKEN( custShowLst ): - xRet.set( new CustomShowListContext( *this, maCustomShowList ) ); - break; + return new CustomShowListContext( *this, maCustomShowList ); case PPT_TOKEN( defaultTextStyle ): - xRet.set( new TextListStyleContext( *this, *mpTextListStyle ) ); - break; + return new TextListStyleContext( *this, *mpTextListStyle ); } - if ( !xRet.is() ) - xRet = getFastContextHandler(); - return xRet; + return this; } bool PresentationFragmentHandler::importSlide( const FragmentHandlerRef& rxSlideFragmentHandler, diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx index 48a53a5f7e1f..4652690e7765 100644 --- a/oox/source/ppt/slidefragmenthandler.cxx +++ b/oox/source/ppt/slidefragmenthandler.cxx @@ -59,7 +59,7 @@ using namespace ::com::sun::star::container; namespace oox { namespace ppt { SlideFragmentHandler::SlideFragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath, SlidePersistPtr pPersistPtr, const ShapeLocation eShapeLocation ) throw() -: FragmentHandler( rFilter, rFragmentPath ) +: FragmentHandler2( rFilter, rFragmentPath ) , mpSlidePersistPtr( pPersistPtr ) , meShapeLocation( eShapeLocation ) { @@ -75,109 +75,102 @@ SlideFragmentHandler::~SlideFragmentHandler() throw() mpSlidePersistPtr->getDrawing()->convertAndInsert(); } -Reference< XFastContextHandler > SlideFragmentHandler::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +::oox::core::ContextHandlerRef SlideFragmentHandler::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - AttributeList aAttribs( xAttribs ); - switch( aElementToken ) { case PPT_TOKEN( sldMaster ): // CT_SlideMaster case PPT_TOKEN( handoutMaster ): // CT_HandoutMaster case PPT_TOKEN( sld ): // CT_CommonSlideData { - AttributeList attribs( xAttribs ); - Reference< XDrawPage > xSlide( mpSlidePersistPtr->getPage() ); PropertyMap aPropMap; PropertySet aSlideProp( xSlide ); - aPropMap[ PROP_Visible ] = Any( attribs.getBool( XML_show, sal_True ) ); + aPropMap[ PROP_Visible ] = Any( rAttribs.getBool( XML_show, sal_True ) ); aSlideProp.setProperties( aPropMap ); - break; + return this; } case PPT_TOKEN( notes ): // CT_NotesSlide case PPT_TOKEN( notesMaster ): // CT_NotesMaster - break; + return this; case PPT_TOKEN( cSld ): // CT_CommonSlideData - maSlideName = xAttribs->getOptionalValue(XML_name); - break; + maSlideName = rAttribs.getString(XML_name, OUString()); + return this; case PPT_TOKEN( spTree ): // CT_GroupShape { - xRet.set( new PPTShapeGroupContext( + // TODO Convert this to FragmentHandler2 + return new PPTShapeGroupContext( *this, mpSlidePersistPtr, meShapeLocation, mpSlidePersistPtr->getShapes(), - oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.GroupShape" ) ) ) ); + oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.GroupShape" ) ) ); } break; case PPT_TOKEN( controls ): - xRet = getFastContextHandler(); - break; + return this; case PPT_TOKEN( control ): { ::oox::vml::ControlInfo aInfo; - aInfo.setShapeId( aAttribs.getInteger( XML_spid, 0 ) ); - aInfo.maFragmentPath = getFragmentPathFromRelId( aAttribs.getString( R_TOKEN( id ), OUString() ) ); - aInfo.maName = aAttribs.getXString( XML_name, OUString() ); + aInfo.setShapeId( rAttribs.getInteger( XML_spid, 0 ) ); + aInfo.maFragmentPath = getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) ); + aInfo.maName = rAttribs.getXString( XML_name, OUString() ); mpSlidePersistPtr->getDrawing()->registerControl( aInfo ); } - return xRet; + return this; case PPT_TOKEN( timing ): // CT_SlideTiming - xRet.set( new SlideTimingContext( *this, mpSlidePersistPtr->getTimeNodeList() ) ); - break; + return new SlideTimingContext( *this, mpSlidePersistPtr->getTimeNodeList() ); case PPT_TOKEN( transition ): // CT_SlideTransition - xRet.set( new SlideTransitionContext( *this, xAttribs, maSlideProperties ) ); - break; + return new SlideTransitionContext( *this, rAttribs, maSlideProperties ); case PPT_TOKEN( hf ): - xRet.set( new HeaderFooterContext( *this, xAttribs, mpSlidePersistPtr->getHeaderFooter() ) ); - break; + return new HeaderFooterContext( *this, rAttribs, mpSlidePersistPtr->getHeaderFooter() ); // BackgroundGroup + case PPT_TOKEN( bg ): + return this; case PPT_TOKEN( bgPr ): // CT_BackgroundProperties { FillPropertiesPtr pFillPropertiesPtr( new FillProperties ); - xRet.set( new BackgroundPropertiesContext( *this, *pFillPropertiesPtr ) ); mpSlidePersistPtr->setBackgroundProperties( pFillPropertiesPtr ); + return new BackgroundPropertiesContext( *this, *pFillPropertiesPtr ); } break; case PPT_TOKEN( bgRef ): // a:CT_StyleMatrixReference { FillPropertiesPtr pFillPropertiesPtr( new FillProperties( - *mpSlidePersistPtr->getTheme()->getFillStyle( xAttribs->getOptionalValue( XML_idx ).toInt32() ) ) ); - xRet.set( new ColorContext( *this, mpSlidePersistPtr->getBackgroundColor() ) ); + *mpSlidePersistPtr->getTheme()->getFillStyle( rAttribs.getInteger( XML_idx, -1 ) ) ) ); + ContextHandlerRef ret = new ColorContext( *this, mpSlidePersistPtr->getBackgroundColor() ); mpSlidePersistPtr->setBackgroundProperties( pFillPropertiesPtr ); + return ret; } break; case PPT_TOKEN( clrMap ): // CT_ColorMapping { oox::drawingml::ClrMapPtr pClrMapPtr( new oox::drawingml::ClrMap() ); - xRet.set( new oox::drawingml::clrMapContext( *this, xAttribs, *pClrMapPtr ) ); + ContextHandlerRef ret = new oox::drawingml::clrMapContext( *this, rAttribs.getFastAttributeList(), *pClrMapPtr ); mpSlidePersistPtr->setClrMap( pClrMapPtr ); + return ret; } break; case PPT_TOKEN( clrMapOvr ): // CT_ColorMappingOverride case PPT_TOKEN( sldLayoutIdLst ): // CT_SlideLayoutIdList - break; + return this; case PPT_TOKEN( txStyles ): // CT_SlideMasterTextStyles - xRet.set( new SlideMasterTextStylesContext( *this, mpSlidePersistPtr ) ); + return new SlideMasterTextStylesContext( *this, mpSlidePersistPtr ); break; case PPT_TOKEN( custDataLst ): // CT_CustomerDataList case PPT_TOKEN( tagLst ): // CT_TagList - break; + return this; } - if( !xRet.is() ) - xRet = getFastContextHandler(); - - return xRet; + return this; } -void SAL_CALL SlideFragmentHandler::endDocument( ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) +void SlideFragmentHandler::finalizeImport() { try { diff --git a/oox/source/ppt/slidemastertextstylescontext.cxx b/oox/source/ppt/slidemastertextstylescontext.cxx index 08b7aaf4af7c..2d1e59c0382d 100644 --- a/oox/source/ppt/slidemastertextstylescontext.cxx +++ b/oox/source/ppt/slidemastertextstylescontext.cxx @@ -37,8 +37,8 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace ppt { -SlideMasterTextStylesContext::SlideMasterTextStylesContext( ContextHandler& rParent, SlidePersistPtr pSlidePersistPtr ) -: ContextHandler( rParent ) +SlideMasterTextStylesContext::SlideMasterTextStylesContext( FragmentHandler2& rParent, SlidePersistPtr pSlidePersistPtr ) +: FragmentHandler2( rParent ) , mpSlidePersistPtr( pSlidePersistPtr ) { } @@ -47,10 +47,9 @@ SlideMasterTextStylesContext::~SlideMasterTextStylesContext() { } -Reference< XFastContextHandler > SlideMasterTextStylesContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& /* xAttribs */ ) throw (SAXException, RuntimeException) +::oox::core::ContextHandlerRef SlideMasterTextStylesContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& /*rAttribs*/ ) { oox::drawingml::TextListStylePtr aTextListStylePtr; - Reference< XFastContextHandler > xRet; switch( aElementToken ) { case PPT_TOKEN( titleStyle ): @@ -78,12 +77,10 @@ Reference< XFastContextHandler > SlideMasterTextStylesContext::createFastChildCo { // are obtained. i got some documents without having the textsize set at for ( int i = 0; i < 9; i++ ) // any point, the master reference application is using 18pt then aTextListStylePtr->getListStyle()[ i ]->getTextCharacterProperties().moHeight = 1800; - xRet.set( new oox::drawingml::TextListStyleContext( *this, *aTextListStylePtr ) ); + return new oox::drawingml::TextListStyleContext( *this, *aTextListStylePtr ); } - if( !xRet.is() ) - xRet.set( this ); - return xRet; + return this; } } } diff --git a/oox/source/ppt/slidetimingcontext.cxx b/oox/source/ppt/slidetimingcontext.cxx index 6c4fcf76a9d2..31738a580e57 100644 --- a/oox/source/ppt/slidetimingcontext.cxx +++ b/oox/source/ppt/slidetimingcontext.cxx @@ -49,8 +49,8 @@ using namespace ::com::sun::star::container; namespace oox { namespace ppt { -SlideTimingContext::SlideTimingContext( ContextHandler& rParent, TimeNodePtrList & aTimeNodeList ) throw() - : ContextHandler( rParent ) +SlideTimingContext::SlideTimingContext( FragmentHandler2& rParent, TimeNodePtrList & aTimeNodeList ) throw() + : FragmentHandler2( rParent ) , maTimeNodeList( aTimeNodeList ) { } @@ -60,42 +60,26 @@ SlideTimingContext::~SlideTimingContext() throw() } -void SlideTimingContext::endFastElement( sal_Int32 /*aElement*/ ) throw ( SAXException, RuntimeException) +::oox::core::ContextHandlerRef SlideTimingContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { -} - - -Reference< XFastContextHandler > SlideTimingContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) -{ - Reference< XFastContextHandler > xRet; - switch( aElementToken ) { case PPT_TOKEN( bldLst ): - xRet.set( new BuildListContext( *this, xAttribs, maTimeNodeList ) ); - break; + return new BuildListContext( *this, rAttribs.getFastAttributeList(), maTimeNodeList ); case PPT_TOKEN( extLst ): - return xRet; + return this; case PPT_TOKEN( tnLst ): // timing nodes { - xRet.set( new TimeNodeListContext( *this, maTimeNodeList ) ); + return new TimeNodeListContext( *this, maTimeNodeList ); } break; default: - break; + return this; } - if( !xRet.is() ) - xRet.set(this); - - return xRet; -} - -void SAL_CALL SlideTimingContext::endDocument( ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) -{ - + return this; } } } diff --git a/oox/source/ppt/slidetransitioncontext.cxx b/oox/source/ppt/slidetransitioncontext.cxx index c7f61912f44e..c74e0d89a2a7 100644 --- a/oox/source/ppt/slidetransitioncontext.cxx +++ b/oox/source/ppt/slidetransitioncontext.cxx @@ -51,23 +51,21 @@ using namespace ::com::sun::star::container; namespace oox { namespace ppt { -SlideTransitionContext::SlideTransitionContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, PropertyMap & aProperties ) throw() -: ContextHandler( rParent ) +SlideTransitionContext::SlideTransitionContext( FragmentHandler2& rParent, const AttributeList& rAttribs, PropertyMap & aProperties ) throw() +: FragmentHandler2( rParent ) , maSlideProperties( aProperties ) , mbHasTransition( sal_False ) { - AttributeList attribs(xAttribs); - // ST_TransitionSpeed - maTransition.setOoxTransitionSpeed( xAttribs->getOptionalValueToken( XML_spd, XML_fast ) ); + maTransition.setOoxTransitionSpeed( rAttribs.getToken( XML_spd, XML_fast ) ); // TODO - attribs.getBool( XML_advClick, true ); + rAttribs.getBool( XML_advClick, true ); // careful. if missing, no auto advance... 0 looks like a valid value // for auto advance - if(attribs.hasAttribute( XML_advTm )) - maTransition.setOoxAdvanceTime( attribs.getInteger( XML_advTm, -1 ) ); + if(rAttribs.hasAttribute( XML_advTm )) + maTransition.setOoxAdvanceTime( rAttribs.getInteger( XML_advTm, -1 ) ); } SlideTransitionContext::~SlideTransitionContext() throw() @@ -75,10 +73,8 @@ SlideTransitionContext::~SlideTransitionContext() throw() } -Reference< XFastContextHandler > SlideTransitionContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +::oox::core::ContextHandlerRef SlideTransitionContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch( aElementToken ) { case PPT_TOKEN( blinds ): @@ -88,67 +84,65 @@ Reference< XFastContextHandler > SlideTransitionContext::createFastChildContext( if (!mbHasTransition) { mbHasTransition = true; - maTransition.setOoxTransitionType( aElementToken, xAttribs->getOptionalValueToken( XML_dir, XML_horz ), 0); + maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_dir, XML_horz ), 0); // ST_Direction { XML_horz, XML_vert } } - break; + return this; case PPT_TOKEN( cover ): case PPT_TOKEN( pull ): if (!mbHasTransition) { mbHasTransition = true; - maTransition.setOoxTransitionType( aElementToken, xAttribs->getOptionalValueToken( XML_dir, XML_l ), 0 ); + maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_dir, XML_l ), 0 ); // ST_TransitionEightDirectionType { ST_TransitionSideDirectionType { // XML_d, XML_d, XML_r, XML_u }, // ST_TransitionCornerDirectionType { // XML_ld, XML_lu, XML_rd, XML_ru } } - break; + return this; case PPT_TOKEN( cut ): case PPT_TOKEN( fade ): if (!mbHasTransition) { mbHasTransition = true; - AttributeList attribs(xAttribs); // CT_OptionalBlackTransition xdb:bool - maTransition.setOoxTransitionType( aElementToken, attribs.getBool( XML_thruBlk, false ), 0); + maTransition.setOoxTransitionType( aElementToken, rAttribs.getBool( XML_thruBlk, false ), 0); } - break; + return this; case PPT_TOKEN( push ): case PPT_TOKEN( wipe ): if (!mbHasTransition) { mbHasTransition = true; - maTransition.setOoxTransitionType( aElementToken, xAttribs->getOptionalValueToken( XML_dir, XML_l ), 0 ); + maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_dir, XML_l ), 0 ); // ST_TransitionSideDirectionType { XML_d, XML_l, XML_r, XML_u } } - break; + return this; case PPT_TOKEN( split ): if (!mbHasTransition) { mbHasTransition = true; - maTransition.setOoxTransitionType( aElementToken, xAttribs->getOptionalValueToken( XML_orient, XML_horz ), xAttribs->getOptionalValueToken( XML_dir, XML_out ) ); + maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_orient, XML_horz ), rAttribs.getToken( XML_dir, XML_out ) ); // ST_Direction { XML_horz, XML_vert } // ST_TransitionInOutDirectionType { XML_out, XML_in } } - break; + return this; case PPT_TOKEN( zoom ): if (!mbHasTransition) { mbHasTransition = true; - maTransition.setOoxTransitionType( aElementToken, xAttribs->getOptionalValueToken( XML_dir, XML_out ), 0 ); + maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_dir, XML_out ), 0 ); // ST_TransitionInOutDirectionType { XML_out, XML_in } } - break; + return this; case PPT_TOKEN( wheel ): if (!mbHasTransition) { mbHasTransition = true; - AttributeList attribs(xAttribs); - maTransition.setOoxTransitionType( aElementToken, attribs.getUnsigned( XML_spokes, 4 ), 0 ); + maTransition.setOoxTransitionType( aElementToken, rAttribs.getUnsigned( XML_spokes, 4 ), 0 ); // unsignedInt } - break; + return this; case PPT_TOKEN( circle ): case PPT_TOKEN( diamond ): case PPT_TOKEN( dissolve ): @@ -162,28 +156,23 @@ Reference< XFastContextHandler > SlideTransitionContext::createFastChildContext( mbHasTransition = true; maTransition.setOoxTransitionType( aElementToken, 0, 0 ); } - break; - + return this; case PPT_TOKEN( sndAc ): // CT_TransitionSoundAction //"Sound" - xRet.set( new SoundActionContext ( *this, maSlideProperties ) ); - break; + return new SoundActionContext ( *this, maSlideProperties ); case PPT_TOKEN( extLst ): // CT_OfficeArtExtensionList - return xRet; + return this; default: break; } - if( !xRet.is() ) - xRet.set(this); - - return xRet; + return this; } -void SlideTransitionContext::endFastElement( sal_Int32 aElement ) throw (::com::sun::star::xml::sax::SAXException, RuntimeException) +void SlideTransitionContext::onEndElement() { - if( aElement == (PPT_TOKEN( transition )) ) + if( isCurrentElement(PPT_TOKEN( transition )) ) { if( mbHasTransition ) { diff --git a/oox/source/ppt/soundactioncontext.cxx b/oox/source/ppt/soundactioncontext.cxx index 64a24963ab66..7b510beda983 100644 --- a/oox/source/ppt/soundactioncontext.cxx +++ b/oox/source/ppt/soundactioncontext.cxx @@ -44,8 +44,8 @@ using namespace ::com::sun::star::uno; namespace oox { namespace ppt { - SoundActionContext::SoundActionContext( ContextHandler& rParent, PropertyMap & aProperties ) throw() - : ContextHandler( rParent ) + SoundActionContext::SoundActionContext( FragmentHandler2& rParent, PropertyMap & aProperties ) throw() + : FragmentHandler2( rParent ) , maSlideProperties( aProperties ) , mbHasStartSound( false ) , mbLoopSound( false ) @@ -59,9 +59,9 @@ namespace oox { namespace ppt { } - void SoundActionContext::endFastElement( sal_Int32 aElement ) throw (SAXException, RuntimeException) + void SoundActionContext::onEndElement() { - if ( aElement == PPT_TOKEN( sndAc ) ) + if ( isCurrentElement( PPT_TOKEN( sndAc ) ) ) { if( mbHasStartSound ) { @@ -97,37 +97,32 @@ namespace oox { namespace ppt { } - Reference< XFastContextHandler > SoundActionContext::createFastChildContext( ::sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) + ::oox::core::ContextHandlerRef SoundActionContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - AttributeList attribs(xAttribs); - - switch( aElement ) + switch( aElementToken ) { case PPT_TOKEN( snd ): if( mbHasStartSound ) { drawingml::EmbeddedWAVAudioFile aAudio; - drawingml::getEmbeddedWAVAudioFile( getRelations(), xAttribs, aAudio); + drawingml::getEmbeddedWAVAudioFile( getRelations(), rAttribs.getFastAttributeList(), aAudio); msSndName = ( aAudio.mbBuiltIn ? aAudio.msName : aAudio.msEmbed ); } - break; + return this; case PPT_TOKEN( endSnd ): // CT_Empty mbStopSound = true; - break; + return this; case PPT_TOKEN( stSnd ): mbHasStartSound = true; - mbLoopSound = attribs.getBool( XML_loop, false ); + mbLoopSound = rAttribs.getBool( XML_loop, false ); + return this; default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } diff --git a/oox/source/ppt/timeanimvaluecontext.cxx b/oox/source/ppt/timeanimvaluecontext.cxx index fd247de41a86..8feb1e623d28 100644 --- a/oox/source/ppt/timeanimvaluecontext.cxx +++ b/oox/source/ppt/timeanimvaluecontext.cxx @@ -36,10 +36,10 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace ppt { - TimeAnimValueListContext::TimeAnimValueListContext( ContextHandler& rParent, + TimeAnimValueListContext::TimeAnimValueListContext( FragmentHandler2& rParent, const Reference< XFastAttributeList >& /*xAttribs*/, TimeAnimationValueList & aTavList ) - : ContextHandler( rParent ) + : FragmentHandler2( rParent ) , maTavList( aTavList ) , mbInValue( false ) { @@ -51,21 +51,17 @@ namespace oox { namespace ppt { } - void SAL_CALL TimeAnimValueListContext::endFastElement( sal_Int32 aElement ) - throw ( SAXException, RuntimeException) + void TimeAnimValueListContext::onEndElement() { - if( aElement == PPT_TOKEN( tav ) ) + if( isCurrentElement( PPT_TOKEN( tav ) ) ) { mbInValue = false; } } - Reference< XFastContextHandler > SAL_CALL TimeAnimValueListContext::createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) + ::oox::core::ContextHandlerRef TimeAnimValueListContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; switch ( aElementToken ) { @@ -73,26 +69,23 @@ namespace oox { namespace ppt { { mbInValue = true; TimeAnimationValue val; - val.msFormula = xAttribs->getOptionalValue( XML_fmla ); - val.msTime = xAttribs->getOptionalValue( XML_tm ); + val.msFormula = rAttribs.getString( XML_fmla, rtl::OUString() ); + val.msTime = rAttribs.getString( XML_tm, rtl::OUString() ); maTavList.push_back( val ); - break; + return this; } case PPT_TOKEN( val ): if( mbInValue ) { // CT_TLAnimVariant - xRet.set( new AnimVariantContext( *this, aElementToken, maTavList.back().maValue ) ); + return new AnimVariantContext( *this, aElementToken, maTavList.back().maValue ); } break; default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } diff --git a/oox/source/ppt/timeanimvaluecontext.hxx b/oox/source/ppt/timeanimvaluecontext.hxx index 10041e2ac413..173e9c19bf5b 100644 --- a/oox/source/ppt/timeanimvaluecontext.hxx +++ b/oox/source/ppt/timeanimvaluecontext.hxx @@ -31,26 +31,25 @@ #ifndef OOX_PPT_TIMEANIMVALUELISTCONTEXT #define OOX_PPT_TIMEANIMVALUELISTCONTEXT -#include "oox/core/contexthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" #include "oox/ppt/animationspersist.hxx" namespace oox { namespace ppt { /** CT_TLTimeAnimateValueList */ class TimeAnimValueListContext - : public ::oox::core::ContextHandler + : public ::oox::core::FragmentHandler2 { public: - TimeAnimValueListContext( ::oox::core::ContextHandler& rParent, + TimeAnimValueListContext( ::oox::core::FragmentHandler2& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, TimeAnimationValueList & aTavList ); ~TimeAnimValueListContext( ); - virtual void SAL_CALL endFastElement( sal_Int32 aElement ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - - 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 ); + virtual void onEndElement(); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); private: TimeAnimationValueList & maTavList; diff --git a/oox/source/ppt/timenodelistcontext.cxx b/oox/source/ppt/timenodelistcontext.cxx index 9aa72213dfe6..ab250d98d10f 100644 --- a/oox/source/ppt/timenodelistcontext.cxx +++ b/oox/source/ppt/timenodelistcontext.cxx @@ -117,7 +117,7 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - MediaNodeContext( ContextHandler& rParent, sal_Int32 aElement, + MediaNodeContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) : TimeNodeContext( rParent, aElement, xAttribs, pNode ) @@ -139,9 +139,9 @@ namespace oox { namespace ppt { } } - virtual void SAL_CALL endFastElement( sal_Int32 aElement ) - throw ( SAXException, RuntimeException) + virtual void onEndElement() { + sal_Int32 aElement = getCurrentElement(); if( aElement == PPT_TOKEN( audio ) ) { // TODO deal with mbIsNarration @@ -152,25 +152,18 @@ namespace oox { namespace ppt { } } - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( cBhvr ): - xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) ); + return new CommonBehaviorContext ( *this, rAttribs.getFastAttributeList(), mpNode ); break; default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } private: @@ -185,7 +178,7 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - SetTimeNodeContext( ContextHandler& rParent, sal_Int32 aElement, + SetTimeNodeContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) : TimeNodeContext( rParent, aElement, xAttribs, pNode ) @@ -212,35 +205,20 @@ namespace oox { namespace ppt { } - virtual void SAL_CALL endFastElement( sal_Int32 /*aElement*/ ) - throw ( SAXException, RuntimeException) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - } - - - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) - { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( cBhvr ): - xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) ); - break; + return new CommonBehaviorContext ( *this, rAttribs.getFastAttributeList(), mpNode ); case PPT_TOKEN( to ): // CT_TLAnimVariant - xRet.set( new AnimVariantContext( *this, aElementToken, maTo ) ); - break; + return new AnimVariantContext( *this, aElementToken, maTo ); default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } private: Any maTo; @@ -252,7 +230,7 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - CmdTimeNodeContext( ContextHandler& rParent, sal_Int32 aElement, + CmdTimeNodeContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) : TimeNodeContext( rParent, aElement, xAttribs, pNode ) @@ -273,10 +251,9 @@ namespace oox { namespace ppt { { } - virtual void SAL_CALL endFastElement( sal_Int32 aElement ) - throw ( SAXException, RuntimeException) + virtual void onEndElement() { - if( aElement == PPT_TOKEN( cmd ) ) + if( isCurrentElement( PPT_TOKEN( cmd ) ) ) { try { // see sd/source/filter/ppt/pptinanimations.cxx @@ -347,25 +324,17 @@ namespace oox { namespace ppt { } - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( cBhvr ): - xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) ); - break; + return new CommonBehaviorContext ( *this, rAttribs.getFastAttributeList(), mpNode ); default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } private: @@ -380,7 +349,7 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - SequenceTimeNodeContext( ContextHandler& rParent, sal_Int32 aElement, + SequenceTimeNodeContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) : TimeNodeContext( rParent, aElement, xAttribs, pNode ) @@ -400,33 +369,23 @@ namespace oox { namespace ppt { } - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( cTn ): - xRet.set( new CommonTimeNodeContext( *this, aElementToken, xAttribs, mpNode ) ); - break; + return new CommonTimeNodeContext( *this, aElementToken, rAttribs.getFastAttributeList(), mpNode ); case PPT_TOKEN( nextCondLst ): - xRet.set( new CondListContext( *this, aElementToken, xAttribs, mpNode, - mpNode->getNextCondition() ) ); - break; + return new CondListContext( *this, aElementToken, rAttribs.getFastAttributeList(), mpNode, + mpNode->getNextCondition() ); case PPT_TOKEN( prevCondLst ): - xRet.set( new CondListContext( *this, aElementToken, xAttribs, mpNode, - mpNode->getPrevCondition() ) ); - break; + return new CondListContext( *this, aElementToken, rAttribs.getFastAttributeList(), mpNode, + mpNode->getPrevCondition() ); default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } private: bool mbConcurrent; @@ -441,32 +400,24 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - ParallelExclTimeNodeContext( ContextHandler& rParent, sal_Int32 aElement, + ParallelExclTimeNodeContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) : TimeNodeContext( rParent, aElement, xAttribs, pNode ) { } - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( cTn ): - xRet.set( new CommonTimeNodeContext( *this, aElementToken, xAttribs, mpNode ) ); - break; + return new CommonTimeNodeContext( *this, aElementToken, rAttribs.getFastAttributeList(), mpNode ); default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } protected: @@ -479,7 +430,7 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - AnimColorContext( ContextHandler& rParent, sal_Int32 aElement, + AnimColorContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) throw() : TimeNodeContext( rParent, aElement, xAttribs, pNode ) @@ -495,10 +446,10 @@ namespace oox { namespace ppt { { } - virtual void SAL_CALL endFastElement( sal_Int32 aElement ) throw ( SAXException, RuntimeException) + virtual void onEndElement() { //xParentNode - if( aElement == mnElement ) + if( isCurrentElement( mnElement ) ) { NodePropertyMap & pProps(mpNode->getNodeProperties()); pProps[ NP_DIRECTION ] = makeAny( mnDir == XML_cw ); @@ -514,10 +465,8 @@ namespace oox { namespace ppt { } - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException ) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( hsl ): @@ -526,12 +475,11 @@ namespace oox { namespace ppt { if( mbHasByColor ) { m_byColor.colorSpace = AnimationColorSpace::HSL; - m_byColor.one = xAttribs->getOptionalValue( XML_h ).toInt32( ); - m_byColor.two = xAttribs->getOptionalValue( XML_s ).toInt32( ); - m_byColor.three = xAttribs->getOptionalValue( XML_l ).toInt32( ); + m_byColor.one = rAttribs.getInteger( XML_h, 0 ); + m_byColor.two = rAttribs.getInteger( XML_s, 0 ); + m_byColor.three = rAttribs.getInteger( XML_l, 0 ); } - xRet.set(this); - break; + return this; } case PPT_TOKEN( rgb ): { @@ -539,38 +487,30 @@ namespace oox { namespace ppt { { // CT_TLByRgbColorTransform m_byColor.colorSpace = AnimationColorSpace::RGB; - m_byColor.one = xAttribs->getOptionalValue( XML_r ).toInt32(); - m_byColor.two = xAttribs->getOptionalValue( XML_g ).toInt32(); - m_byColor.three = xAttribs->getOptionalValue( XML_b ).toInt32(); + m_byColor.one = rAttribs.getInteger( XML_r, 0 ); + m_byColor.two = rAttribs.getInteger( XML_g, 0 ); + m_byColor.three = rAttribs.getInteger( XML_b, 0 ); } - xRet.set(this); - break; + return this; } case PPT_TOKEN( by ): // CT_TLByAnimateColorTransform mbHasByColor = true; - xRet.set(this); - break; + return this; case PPT_TOKEN( cBhvr ): - xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) ); - break; + return new CommonBehaviorContext ( *this, rAttribs.getFastAttributeList(), mpNode ); case PPT_TOKEN( to ): // CT_Color - xRet.set( new ColorContext( *this, maToClr ) ); - break; + return new ColorContext( *this, maToClr ); case PPT_TOKEN( from ): // CT_Color - xRet.set( new ColorContext( *this, maFromClr ) ); - break; + return new ColorContext( *this, maFromClr ); default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } @@ -589,7 +529,7 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - AnimContext( ContextHandler& rParent, sal_Int32 aElement, + AnimContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) throw() : TimeNodeContext( rParent, aElement, xAttribs, pNode ) @@ -671,26 +611,21 @@ namespace oox { namespace ppt { } - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException ) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( cBhvr ): - xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) ); + return new CommonBehaviorContext ( *this, rAttribs.getFastAttributeList(), mpNode ); break; case PPT_TOKEN( tavLst ): - xRet.set( new TimeAnimValueListContext ( *this, xAttribs, maTavList ) ); + return new TimeAnimValueListContext ( *this, rAttribs.getFastAttributeList(), maTavList ); break; default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } private: sal_Int32 mnValueType; @@ -703,7 +638,7 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - AnimScaleContext( ContextHandler& rParent, sal_Int32 aElement, + AnimScaleContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) throw() : TimeNodeContext( rParent, aElement, xAttribs, pNode ) @@ -720,9 +655,9 @@ namespace oox { namespace ppt { { } - virtual void SAL_CALL endFastElement( sal_Int32 aElement ) throw ( SAXException, RuntimeException) + virtual void onEndElement() { - if( aElement == mnElement ) + if( isCurrentElement( mnElement ) ) { if( maTo.hasValue() ) { @@ -739,49 +674,41 @@ namespace oox { namespace ppt { } } - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( cBhvr ): - xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) ); - break; + return new CommonBehaviorContext ( *this, rAttribs.getFastAttributeList(), mpNode ); case PPT_TOKEN( to ): { // CT_TLPoint - Point p = GetPointPercent( xAttribs ); + Point p = GetPointPercent( rAttribs.getFastAttributeList() ); maTo <<= p.X; maTo <<= p.Y; - break; + return this; } case PPT_TOKEN( from ): { // CT_TLPoint - Point p = GetPointPercent( xAttribs ); + Point p = GetPointPercent( rAttribs.getFastAttributeList() ); maFrom <<= p.X; maFrom <<= p.Y; - break; + return this; } case PPT_TOKEN( by ): { // CT_TLPoint - Point p = GetPointPercent( xAttribs ); + Point p = GetPointPercent( rAttribs.getFastAttributeList() ); maBy <<= p.X; maBy <<= p.Y; - break; + return this; } default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } private: Any maBy; @@ -796,7 +723,7 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - AnimRotContext( ContextHandler& rParent, sal_Int32 aElement, + AnimRotContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) throw() : TimeNodeContext( rParent, aElement, xAttribs, pNode ) @@ -827,23 +754,17 @@ namespace oox { namespace ppt { { } - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException ) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( cBhvr ): - xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) ); - break; + return new CommonBehaviorContext ( *this, rAttribs.getFastAttributeList(), mpNode ); default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } }; @@ -854,7 +775,7 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - AnimMotionContext( ContextHandler& rParent, sal_Int32 aElement, + AnimMotionContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) throw() : TimeNodeContext( rParent, aElement, xAttribs, pNode ) @@ -893,63 +814,55 @@ namespace oox { namespace ppt { } - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( cBhvr ): - xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) ); - break; + return new CommonBehaviorContext ( *this, rAttribs.getFastAttributeList(), mpNode ); case PPT_TOKEN( to ): { // CT_TLPoint - Point p = GetPointPercent( xAttribs ); + Point p = GetPointPercent( rAttribs.getFastAttributeList() ); Any rAny; rAny <<= p.X; rAny <<= p.Y; mpNode->setTo( rAny ); - break; + return this; } case PPT_TOKEN( from ): { // CT_TLPoint - Point p = GetPointPercent( xAttribs ); + Point p = GetPointPercent( rAttribs.getFastAttributeList() ); Any rAny; rAny <<= p.X; rAny <<= p.Y; mpNode->setFrom( rAny ); - break; + return this; } case PPT_TOKEN( by ): { // CT_TLPoint - Point p = GetPointPercent( xAttribs ); + Point p = GetPointPercent( rAttribs.getFastAttributeList() ); Any rAny; rAny <<= p.X; rAny <<= p.Y; mpNode->setBy( rAny ); - break; + return this; } case PPT_TOKEN( rCtr ): { // CT_TLPoint - Point p = GetPointPercent( xAttribs ); + Point p = GetPointPercent( rAttribs.getFastAttributeList() ); // TODO push (void)p; - break; + return this; } default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } private: OUString msPtsTypes; @@ -963,7 +876,7 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - AnimEffectContext( ContextHandler& rParent, sal_Int32 aElement, + AnimEffectContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) throw() : TimeNodeContext( rParent, aElement, xAttribs, pNode ) @@ -987,27 +900,20 @@ namespace oox { namespace ppt { } - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException ) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( cBhvr ): - xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) ); - break; + return new CommonBehaviorContext ( *this, rAttribs.getFastAttributeList(), mpNode ); case PPT_TOKEN( progress ): - xRet.set( new AnimVariantContext( *this, aElementToken, maProgress ) ); + return new AnimVariantContext( *this, aElementToken, maProgress ); // TODO handle it. - break; default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } private: Any maProgress; @@ -1018,7 +924,7 @@ namespace oox { namespace ppt { TimeNodeContext * TimeNodeContext::makeContext( - ContextHandler& rParent, sal_Int32 aElement, + FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) { @@ -1069,10 +975,10 @@ namespace oox { namespace ppt { } - TimeNodeContext::TimeNodeContext( ContextHandler& rParent, sal_Int32 aElement, + TimeNodeContext::TimeNodeContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& /*xAttribs*/, const TimeNodePtr & pNode ) throw() - : ContextHandler( rParent ) + : FragmentHandler2( rParent ) , mnElement( aElement ) , mpNode( pNode ) { @@ -1085,9 +991,9 @@ namespace oox { namespace ppt { } - TimeNodeListContext::TimeNodeListContext( ContextHandler& rParent, TimeNodePtrList & aList ) + TimeNodeListContext::TimeNodeListContext( FragmentHandler2& rParent, TimeNodePtrList & aList ) throw() - : ContextHandler( rParent ) + : FragmentHandler2( rParent ) , maList( aList ) { } @@ -1098,10 +1004,8 @@ namespace oox { namespace ppt { } - Reference< XFastContextHandler > SAL_CALL TimeNodeListContext::createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) + ::oox::core::ContextHandlerRef TimeNodeListContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - sal_Int16 nNodeType; switch( aElementToken ) @@ -1155,10 +1059,9 @@ namespace oox { namespace ppt { TimeNodePtr pNode(new TimeNode(nNodeType)); maList.push_back( pNode ); - ContextHandler * pContext = TimeNodeContext::makeContext( *this, aElementToken, xAttribs, pNode ); - xRet.set( pContext ? pContext : this ); + FragmentHandler2 * pContext = TimeNodeContext::makeContext( *this, aElementToken, rAttribs.getFastAttributeList(), pNode ); - return xRet; + return pContext ? pContext : this; } diff --git a/oox/source/ppt/timetargetelementcontext.cxx b/oox/source/ppt/timetargetelementcontext.cxx index 2a0f61c0c4a3..93cbcf701625 100644 --- a/oox/source/ppt/timetargetelementcontext.cxx +++ b/oox/source/ppt/timetargetelementcontext.cxx @@ -49,55 +49,49 @@ namespace oox { namespace ppt { // CT_TLShapeTargetElement class ShapeTargetElementContext - : public ContextHandler + : public FragmentHandler2 { public: - ShapeTargetElementContext( ContextHandler& rParent, ShapeTargetElement & aValue ) - : ContextHandler( rParent ) + ShapeTargetElementContext( FragmentHandler2& rParent, ShapeTargetElement & aValue ) + : FragmentHandler2( rParent ) , bTargetSet(false) , maShapeTarget(aValue) { } - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch( aElementToken ) { case PPT_TOKEN( bg ): bTargetSet = true; maShapeTarget.mnType = XML_bg; - break; + return this; case PPT_TOKEN( txEl ): bTargetSet = true; maShapeTarget.mnType = XML_txEl; - break; + return this; case PPT_TOKEN( subSp ): bTargetSet = true; maShapeTarget.mnType = XML_subSp; - maShapeTarget.msSubShapeId = xAttribs->getOptionalValue( XML_spid ); - break; + maShapeTarget.msSubShapeId = rAttribs.getString( XML_spid, OUString() ); + return this; case PPT_TOKEN( graphicEl ): case PPT_TOKEN( oleChartEl ): bTargetSet = true; // TODO - break; + return this; case PPT_TOKEN( charRg ): case PPT_TOKEN( pRg ): if( bTargetSet && maShapeTarget.mnType == XML_txEl ) { maShapeTarget.mnRangeType = getBaseToken( aElementToken ); - maShapeTarget.maRange = drawingml::GetIndexRange( xAttribs ); + maShapeTarget.maRange = drawingml::GetIndexRange( rAttribs.getFastAttributeList() ); } - break; + return this; default: break; } - if( !xRet.is() ) - xRet.set( this ); - return xRet; + return this; } private: @@ -107,8 +101,8 @@ namespace oox { namespace ppt { - TimeTargetElementContext::TimeTargetElementContext( ContextHandler& rParent, const AnimTargetElementPtr & pValue ) - : ContextHandler( rParent ), + TimeTargetElementContext::TimeTargetElementContext( FragmentHandler2& rParent, const AnimTargetElementPtr & pValue ) + : FragmentHandler2( rParent ), mpTarget( pValue ) { OSL_ENSURE( mpTarget, "no valid target passed" ); @@ -119,34 +113,28 @@ namespace oox { namespace ppt { { } - void SAL_CALL TimeTargetElementContext::endFastElement( sal_Int32 /*aElement*/ ) throw ( SAXException, RuntimeException) - { - } - - Reference< XFastContextHandler > SAL_CALL TimeTargetElementContext::createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException ) + ::oox::core::ContextHandlerRef TimeTargetElementContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch( aElementToken ) { case PPT_TOKEN( inkTgt ): { mpTarget->mnType = XML_inkTgt; - OUString aId = xAttribs->getOptionalValue( XML_spid ); + OUString aId = rAttribs.getString( XML_spid, OUString() ); if( aId.getLength() ) { mpTarget->msValue = aId; } - break; + return this; } case PPT_TOKEN( sldTgt ): mpTarget->mnType = XML_sldTgt; - break; + return this; case PPT_TOKEN( sndTgt ): { mpTarget->mnType = XML_sndTgt; drawingml::EmbeddedWAVAudioFile aAudio; - drawingml::getEmbeddedWAVAudioFile( getRelations(), xAttribs, aAudio); + drawingml::getEmbeddedWAVAudioFile( getRelations(), rAttribs.getFastAttributeList(), aAudio); OUString sSndName = ( aAudio.mbBuiltIn ? aAudio.msName : aAudio.msEmbed ); mpTarget->msValue = sSndName; @@ -155,20 +143,16 @@ namespace oox { namespace ppt { case PPT_TOKEN( spTgt ): { mpTarget->mnType = XML_spTgt; - OUString aId = xAttribs->getOptionalValue( XML_spid ); + OUString aId = rAttribs.getString( XML_spid, OUString() ); mpTarget->msValue = aId; - xRet.set( new ShapeTargetElementContext( *this, mpTarget->maShapeTarget ) ); - break; + return new ShapeTargetElementContext( *this, mpTarget->maShapeTarget ); } default: OSL_TRACE( "OOX: unhandled tag %ld in TL_TimeTargetElement.", getBaseToken( aElementToken ) ); break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } diff --git a/oox/source/ppt/timetargetelementcontext.hxx b/oox/source/ppt/timetargetelementcontext.hxx index 8ee22fd26aae..f20890f1899a 100644 --- a/oox/source/ppt/timetargetelementcontext.hxx +++ b/oox/source/ppt/timetargetelementcontext.hxx @@ -29,20 +29,19 @@ #ifndef OOX_PPT_TIMETARGETELEMENTCONTEXT #define OOX_PPT_TIMETARGETELEMENTCONTEXT -#include "oox/core/contexthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" #include "oox/ppt/animationspersist.hxx" namespace oox { namespace ppt { /** context CT_TLTimeTargetElement */ class TimeTargetElementContext - : public ::oox::core::ContextHandler + : public ::oox::core::FragmentHandler2 { public: - TimeTargetElementContext( ::oox::core::ContextHandler& rParent, const AnimTargetElementPtr & aValue ); + TimeTargetElementContext( ::oox::core::FragmentHandler2& rParent, const AnimTargetElementPtr & aValue ); ~TimeTargetElementContext( ) throw( ); - virtual void SAL_CALL endFastElement( sal_Int32 /*aElement*/ ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - 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 ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); private: AnimTargetElementPtr mpTarget; diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index d3bf0b776c25..a4b270ab4124 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -383,6 +383,7 @@ ScrollValue ScrollValueMax ScrollValueMin Segments +SelectedItems SelectedPage Show ShowBorder @@ -426,6 +427,7 @@ StartPosition StartWith StartingAngle State +StringItemList Subtotals Suffix SwapXAndYAxis diff --git a/oox/source/vml/vmldrawingfragment.cxx b/oox/source/vml/vmldrawingfragment.cxx index 12dd0a42fabf..0f92632f0e00 100644 --- a/oox/source/vml/vmldrawingfragment.cxx +++ b/oox/source/vml/vmldrawingfragment.cxx @@ -50,6 +50,13 @@ DrawingFragment::DrawingFragment( XmlFilterBase& rFilter, const OUString& rFragm FragmentHandler2( rFilter, rFragmentPath, false ), // do not trim whitespace, has been preprocessed by the input stream mrDrawing( rDrawing ) { + RelationsRef xLegacyRels = getRelations().getRelationsFromType( CREATE_MSOFFICE_RELATION_TYPE( "legacyDiagramText" ) ); + for( Relations::const_iterator aIt = xLegacyRels->begin(), aEnd = xLegacyRels->end(); aIt != aEnd; ++aIt ) + { + OUString aLegacyFragmentPath = getFragmentPathFromRelation( aIt->second ); + // TODO: import legacyDiagramText from aLegacyFragmentPath - this is a binary import. + // printf("legacyDiagram: %s\n", ::rtl::OUStringToOString( aLegacyFragmentPath, RTL_TEXTENCODING_UTF8).getStr()); + } } Reference< XInputStream > DrawingFragment::openFragmentStream() const diff --git a/oox/source/xls/formulaparser.cxx b/oox/source/xls/formulaparser.cxx index fa96869afadc..fb4ca7b6bd50 100644 --- a/oox/source/xls/formulaparser.cxx +++ b/oox/source/xls/formulaparser.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/sheet/ComplexReference.hpp> #include <com/sun/star/sheet/ExternalReference.hpp> #include <com/sun/star/sheet/FormulaToken.hpp> +#include <com/sun/star/sheet/NameToken.hpp> #include <com/sun/star/sheet/ReferenceFlags.hpp> #include <com/sun/star/sheet/SingleReference.hpp> #include "oox/core/filterbase.hxx" @@ -2860,7 +2861,10 @@ ApiTokenSequence FormulaParser::convertNameToFormula( sal_Int32 nTokenIndex ) co ApiTokenSequence aTokens( 1 ); aTokens[ 0 ].OpCode = OPCODE_NAME; - aTokens[ 0 ].Data <<= nTokenIndex; + NameToken aNameTokenData; + aNameTokenData.Global = sal_True; + aNameTokenData.Index = nTokenIndex; + aTokens[ 0 ].Data <<= aNameTokenData; return aTokens; } diff --git a/oox/source/xls/sheetdatabuffer.cxx b/oox/source/xls/sheetdatabuffer.cxx index 4eb1349e9438..04551e21840e 100755 --- a/oox/source/xls/sheetdatabuffer.cxx +++ b/oox/source/xls/sheetdatabuffer.cxx @@ -238,6 +238,9 @@ void CellBlockBuffer::setColSpans( sal_Int32 nRow, const ValueRangeSet& rColSpan CellBlock* CellBlockBuffer::getCellBlock( const CellAddress& rCellAddr ) { + // Temporarily disabled. TODO: Fix this. + return NULL; + OSL_ENSURE( rCellAddr.Row >= mnCurrRow, "CellBlockBuffer::getCellBlock - passed row out of order" ); // prepare cell blocks, if row changes if( rCellAddr.Row != mnCurrRow ) diff --git a/oox/source/xls/sheetdatacontext.cxx b/oox/source/xls/sheetdatacontext.cxx index 569126e0ebad..dfb9db03ed0e 100644 --- a/oox/source/xls/sheetdatacontext.cxx +++ b/oox/source/xls/sheetdatacontext.cxx @@ -163,8 +163,15 @@ void SheetDataContext::onCharacters( const OUString& rChars ) maCellValue = rChars; break; case XLS_TOKEN( f ): - if( maFmlaData.mnFormulaType != XML_TOKEN_INVALID ) + if( 0 && maFmlaData.mnFormulaType == XML_normal ) + { + maCellValue = rChars; + mrSheetData.putFormulaString( maCellData.maCellAddr, maCellValue ); + } + else if( maFmlaData.mnFormulaType != XML_TOKEN_INVALID ) + { maTokens = mrFormulaParser.importFormula( maCellData.maCellAddr, rChars ); + } break; } } @@ -178,7 +185,7 @@ void SheetDataContext::onEndElement() { case XML_normal: mrSheetData.setFormulaCell( maCellData, maTokens ); - break; + break; case XML_shared: if( maFmlaData.mnSharedId >= 0 ) { @@ -240,6 +247,13 @@ void SheetDataContext::onEndElement() mrSheetData.setBlankCell( maCellData ); } } + else if( maCellValue.getLength() > 0 ) switch( maCellData.mnCellType ) + { + case XML_n: + /* Set the pre-loaded value */ + mrSheetData.putFormulaResult( maCellData.maCellAddr, maCellValue.toDouble() ); + break; + } } } diff --git a/oox/source/xls/workbookfragment.cxx b/oox/source/xls/workbookfragment.cxx index 96fd34f0c100..9d22f5fdf937 100644 --- a/oox/source/xls/workbookfragment.cxx +++ b/oox/source/xls/workbookfragment.cxx @@ -29,6 +29,7 @@ #include "oox/xls/workbookfragment.hxx" #include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/sheet/XCalculatable.hpp> #include "oox/core/filterbase.hxx" #include "oox/drawingml/themefragmenthandler.hxx" #include "oox/helper/attributelist.hxx" @@ -59,6 +60,7 @@ namespace xls { using namespace ::com::sun::star::io; using namespace ::com::sun::star::table; using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::sheet; using namespace ::oox::core; using ::oox::drawingml::ThemeFragmentHandler; @@ -313,6 +315,11 @@ void WorkbookFragment::finalizeImport() // final conversions, e.g. calculation settings and view settings finalizeWorkbookImport(); + + // Recalculate (only changed ones) + Reference< XCalculatable > xCalculatable( getDocument(), UNO_QUERY ); + if( xCalculatable.is() ) + xCalculatable->calculate(); } // private -------------------------------------------------------------------- diff --git a/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx index 068c89cde2d9..a74e24f3343b 100644 --- a/oox/source/xls/worksheethelper.cxx +++ b/oox/source/xls/worksheethelper.cxx @@ -48,6 +48,7 @@ #include <com/sun/star/sheet/XSheetOutline.hpp> #include <com/sun/star/sheet/XSpreadsheet.hpp> #include <com/sun/star/table/XColumnRowRange.hpp> +#include <com/sun/star/table/XCell2.hpp> #include <com/sun/star/text/WritingMode2.hpp> #include <com/sun/star/text/XText.hpp> #include <rtl/ustrbuf.hxx> @@ -1654,6 +1655,19 @@ void WorksheetHelper::putValue( const CellAddress& rAddress, double fValue ) con if( xCell.is() ) xCell->setValue( fValue ); } +void WorksheetHelper::putFormulaResult( const CellAddress& rAddress, double fValue ) const +{ + Reference< XCell2 > xCell( getCell( rAddress ), UNO_QUERY ); + OSL_ENSURE( xCell.is(), "WorksheetHelper::putFormulaResult - missing cell interface" ); + if( xCell.is() ) xCell->setFormulaResult( fValue ); +} + +void WorksheetHelper::putFormulaString( const CellAddress& rAddress, const OUString& rFormula ) const +{ + Reference< XCell2 > xCell( getCell( rAddress ), UNO_QUERY ); + if( xCell.is() ) xCell->setFormulaString( rFormula ); +} + void WorksheetHelper::putString( const CellAddress& rAddress, const OUString& rText ) const { Reference< XText > xText( getCell( rAddress ), UNO_QUERY ); diff --git a/unoxml/Library_unordf.mk b/unoxml/Library_unordf.mk index 0e1fe61e816a..f716cf2afa59 100644 --- a/unoxml/Library_unordf.mk +++ b/unoxml/Library_unordf.mk @@ -31,7 +31,11 @@ $(eval $(call gb_Library_set_componentfile,unordf,unoxml/source/rdf/unordf)) $(eval $(call gb_Library_set_include,unordf,\ $$(INCLUDE) \ - -I$(OUTDIR)/inc/offuh \ +)) + +$(eval $(call gb_Library_add_api,unordf,\ + udkapi \ + offapi \ )) $(eval $(call gb_Library_add_linked_libs,unordf,\ @@ -54,5 +58,7 @@ $(eval $(call gb_Library_add_exception_objects,unordf,\ unoxml/source/rdf/librdf_services \ )) + $$(REDLAND_CFLAGS) \ + $$(LIBXML_CFLAGS) \ # vim: set noet sw=4 ts=4: diff --git a/unoxml/Library_unoxml.mk b/unoxml/Library_unoxml.mk index 3303e5df6cf7..b51253a44036 100644 --- a/unoxml/Library_unoxml.mk +++ b/unoxml/Library_unoxml.mk @@ -31,9 +31,13 @@ $(eval $(call gb_Library_set_componentfile,unoxml,unoxml/source/service/unoxml)) $(eval $(call gb_Library_set_include,unoxml,\ $$(INCLUDE) \ - -I$(OUTDIR)/inc/offuh \ )) +)) + +$(eval $(call gb_Library_add_api,unoxml,\ + udkapi \ + offapi \ $(eval $(call gb_Library_add_linked_libs,unoxml,\ ucbhelper \ sax \ diff --git a/unoxml/prj/build.lst b/unoxml/prj/build.lst index 02f0482d76f8..97aed0f47b94 100644 --- a/unoxml/prj/build.lst +++ b/unoxml/prj/build.lst @@ -1,2 +1,2 @@ -ux unoxml : offuh cppuhelper LIBXML2:libxml2 LIBXSLT:libxslt REDLAND:redland sax comphelper ucbhelper NULL +ux unoxml : offapi cppuhelper LIBXML2:libxml2 LIBXSLT:libxslt REDLAND:redland sax comphelper ucbhelper NULL ux unoxml\prj nmake - all ux_prj NULL diff --git a/unoxml/source/rdf/librdf_services.cxx b/unoxml/source/rdf/librdf_services.cxx index 03b2b1e39eec..d1ff568a2369 100644 --- a/unoxml/source/rdf/librdf_services.cxx +++ b/unoxml/source/rdf/librdf_services.cxx @@ -39,12 +39,6 @@ using namespace ::com::sun::star; extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const sal_Char **o_ppEnvironmentTypeName, - uno_Environment ** /* ppEnvironment */) -{ - *o_ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - static ::cppu::ImplementationEntry const entries[] = { { &comp_CBlankNode::_create, &comp_CBlankNode::_getImplementationName, @@ -65,7 +59,7 @@ static ::cppu::ImplementationEntry const entries[] = { { 0, 0, 0, 0, 0, 0 } }; -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( +SAL_DLLPUBLIC_EXPORT void * SAL_CALL unordf_component_getFactory( const char * implName, void * serviceManager, void * registryKey) { return ::cppu::component_getFactoryHelper( diff --git a/unoxml/source/rdf/unordf.component b/unoxml/source/rdf/unordf.component index a828e7b05d47..12a01ca6cf8c 100644 --- a/unoxml/source/rdf/unordf.component +++ b/unoxml/source/rdf/unordf.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="unordf" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="CBlankNode"> <service name="com.sun.star.rdf.BlankNode"/> diff --git a/unoxml/source/service/services.cxx b/unoxml/source/service/services.cxx index b81c363931fa..f9c024f7392a 100644 --- a/unoxml/source/service/services.cxx +++ b/unoxml/source/service/services.cxx @@ -55,12 +55,7 @@ using namespace ::com::sun::star::registry; extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const sal_Char **ppEnvironmentTypeName, uno_Environment ** /*ppEnvironment */) -{ - *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ; -} - -SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const sal_Char *pImplementationName, void *pServiceManager, void * /*pRegistryKey*/) +SAL_DLLPUBLIC_EXPORT void* SAL_CALL unoxml_component_getFactory(const sal_Char *pImplementationName, void *pServiceManager, void * /*pRegistryKey*/) { void* pReturn = NULL ; if ( pImplementationName && pServiceManager ) diff --git a/unoxml/source/service/unoxml.component b/unoxml/source/service/unoxml.component index d8c907e6475b..889a755e22c5 100644 --- a/unoxml/source/service/unoxml.component +++ b/unoxml/source/service/unoxml.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="unoxml" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.xml.dom.DocumentBuilder"> <service name="com.sun.star.xml.dom.DocumentBuilder"/> diff --git a/writerfilter/Library_writerfilter.mk b/writerfilter/Library_writerfilter.mk index 1de3e786fd0e..6e3f6d8e18d0 100644 --- a/writerfilter/Library_writerfilter.mk +++ b/writerfilter/Library_writerfilter.mk @@ -37,7 +37,7 @@ $(eval $(call gb_Library_set_componentfile,writerfilter,writerfilter/util/writer $(eval $(call gb_Library_set_include,writerfilter,\ $$(INCLUDE) \ - -I$(OUTDIR)/inc/offuh \ +)) -I$(realpath $(SRCDIR)/writerfilter/inc) \ -I$(WORKDIR)/CustomTarget/writerfilter/source \ -I$(WORKDIR)/CustomTarget/writerfilter/source/ooxml \ @@ -47,6 +47,11 @@ $(eval $(call gb_Library_set_include,writerfilter,\ -I$(realpath $(SRCDIR)/writerfilter/source/dmapper) \ )) +$(eval $(call gb_Library_add_api,writerfilter,\ + offapi \ + udkapi \ +)) + $(eval $(call gb_Library_set_componentfile,writerfilter,writerfilter/util/writerfilter)) $(eval $(call gb_Library_add_defs,writerfilter,\ @@ -62,8 +67,10 @@ $(eval $(call gb_Library_add_linked_libs,writerfilter,\ i18nisolang1 \ i18npaper \ oox \ + rtftok \ sal \ sot \ + svt \ tl \ utl \ $(gb_STDLIBS) \ diff --git a/writerfilter/Module_writerfilter.mk b/writerfilter/Module_writerfilter.mk index d51031d8b881..01f149b8cac8 100644 --- a/writerfilter/Module_writerfilter.mk +++ b/writerfilter/Module_writerfilter.mk @@ -28,6 +28,7 @@ $(eval $(call gb_Module_Module,writerfilter)) $(eval $(call gb_Module_add_targets,writerfilter,\ + Library_rtftok \ Library_writerfilter \ Package_inc \ Package_writerfilter_generated \ @@ -37,7 +38,4 @@ $(eval $(call gb_Module_add_targets,writerfilter,\ # Library_resourcemodel \ # Library_writerfilter_uno \ - # not used - # Library_rtftok - # vim: set noet ts=4 sw=4: diff --git a/writerfilter/inc/WriterFilterDllApi.hxx b/writerfilter/inc/WriterFilterDllApi.hxx index dff806017c8a..358e5cd624bc 100644 --- a/writerfilter/inc/WriterFilterDllApi.hxx +++ b/writerfilter/inc/WriterFilterDllApi.hxx @@ -35,6 +35,12 @@ #else #define WRITERFILTER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT #endif +#if defined(WRITERFILTER_RTFTOK_DLLIMPLEMENTATION) +#define WRITERFILTER_RTFTOK_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define WRITERFILTER_RTFTOK_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif + #define WRITERFILTER_DLLPRIVATE SAL_DLLPRIVATE #endif /* INCLUDED_WRITERFILTERDLLAPI_H */ diff --git a/writerfilter/inc/dmapper/DomainMapper.hxx b/writerfilter/inc/dmapper/DomainMapper.hxx index d9d40aa32ad9..71190a158e1e 100644 --- a/writerfilter/inc/dmapper/DomainMapper.hxx +++ b/writerfilter/inc/dmapper/DomainMapper.hxx @@ -106,6 +106,7 @@ public: void PopListProperties(); bool IsOOXMLImport() const; + bool IsRTFImport() const; ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > GetTextFactory() const; void AddListIDToLFOTable( sal_Int32 nAbstractNumId ); ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > GetCurrentTextRange(); diff --git a/writerfilter/inc/rtftok/RTFDocument.hxx b/writerfilter/inc/rtftok/RTFDocument.hxx new file mode 100644 index 000000000000..72fe6bd2d952 --- /dev/null +++ b/writerfilter/inc/rtftok/RTFDocument.hxx @@ -0,0 +1,72 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Miklos Vajna <vmiklos@frugalware.org> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef _RTFDOCUMENT_HXX_ +#define _RTFDOCUMENT_HXX_ + +#include <resourcemodel/WW8ResourceModel.hxx> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/frame/XFrame.hpp> + +namespace writerfilter { + namespace rtftok { + /// The RTFDocument opens and resolves the RTF document. + class WRITERFILTER_RTFTOK_DLLPUBLIC RTFDocument + : public writerfilter::Reference<Stream> + { + public: + /// Pointer to this stream. + typedef ::boost::shared_ptr<RTFDocument> Pointer_t; + + virtual ~RTFDocument() { } + + /// Resolves this document to a stream handler. + virtual void resolve(Stream & rHandler) = 0; + + /// Returns string representation of the type of this reference. (Debugging purpose only.) + virtual ::std::string getType() const = 0; + }; + + /// Interface to create an RTFDocument instance. + class WRITERFILTER_RTFTOK_DLLPUBLIC RTFDocumentFactory + { + public: + static RTFDocument::Pointer_t + createDocument( + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext, + ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > const & xInputStream, + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > const & xDstDoc, + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > const & xFrame); + }; + } // namespace rtftok +} // namespace writerfilter + +#endif // _RTFDOCUMENT_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/inc/rtftok/RTFInputSource.hxx b/writerfilter/inc/rtftok/RTFInputSource.hxx deleted file mode 100644 index 5a0ca071ab1a..000000000000 --- a/writerfilter/inc/rtftok/RTFInputSource.hxx +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_RTFINPUTSOURCE_HXX -#define INCLUDED_RTFINPUTSOURCE_HXX - -namespace writerfilter { namespace rtftok { - -class RTFInputSource -{ -public: - virtual int read(void *buffer, int maxLen) = 0; -}; - -} } /* end namespace writerfilter::rtftok */ - - -#endif /* INCLUDED_RTFINPUTSOURCE_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/inc/rtftok/RTFParseException.hxx b/writerfilter/inc/rtftok/RTFParseException.hxx deleted file mode 100644 index 338711e57cb7..000000000000 --- a/writerfilter/inc/rtftok/RTFParseException.hxx +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_RTFPARSEEXCEPTION_HXX -#define INCLUDED_RTFPARSEEXCEPTION_HXX - -namespace writerfilter { namespace rtftok { - -class RTFParseException -{ -public: - RTFParseException(char *message); -}; - -} } /* end namespace writerfilter::rtftok */ - - -#endif /* INCLUDED_RTFPARSEEXCEPTION_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/inc/rtftok/RTFScanner.hxx b/writerfilter/inc/rtftok/RTFScanner.hxx deleted file mode 100644 index 9f1e2c655402..000000000000 --- a/writerfilter/inc/rtftok/RTFScanner.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_RTFSCANNER_HXX -#define INCLUDED_RTFSCANNER_HXX - -#include <WriterFilterDllApi.hxx> -#include <vector> -#include <rtftok/RTFInputSource.hxx> -#include <rtftok/RTFScannerHandler.hxx> - -namespace writerfilter { namespace rtftok { - -class WRITERFILTER_DLLPUBLIC RTFScanner { -public: - RTFScanner(RTFScannerHandler &eventHandler_) : eventHandler(eventHandler_) {}; - virtual ~RTFScanner() { } - - const char* YYText() { return yytext; } - int YYLeng() { return yyleng; } - - virtual int yylex() = 0; - - int lineno() const { return yylineno; } - -protected: - char* yytext; - int yyleng; - int yylineno; // only maintained if you use %option yylineno - int yy_flex_debug; // only has effect with -d or "%option debug" - RTFScannerHandler &eventHandler; - - -public: - static writerfilter::rtftok::RTFScanner* createRTFScanner(writerfilter::rtftok::RTFInputSource& inputSource, writerfilter::rtftok::RTFScannerHandler &eventHandler); -}; - -} } /* end namespace writerfilter::rtftok */ - - -#endif /* INCLUDED_RTFSCANNER_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/inc/rtftok/RTFScannerHandler.hxx b/writerfilter/inc/rtftok/RTFScannerHandler.hxx deleted file mode 100644 index aa423439fa53..000000000000 --- a/writerfilter/inc/rtftok/RTFScannerHandler.hxx +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_RTFSCANNERHANDLER_HXX -#define INCLUDED_RTFSCANNERHANDLER_HXX - -namespace writerfilter { namespace rtftok { - -class RTFScannerHandler -{ -public: - virtual void dest(char*token, char*value)=0; - virtual void ctrl(char*token, char*value)=0; - virtual void lbrace(void)=0; - virtual void rbrace(void)=0; - virtual void addSpaces(int count)=0; - virtual void addBinData(unsigned char data)=0; - virtual void addChar(char ch) =0; - virtual void addCharU(sal_Unicode ch) =0; - virtual void addHexChar(char* hexch) =0; - -}; - -} } /* end namespace writerfilter::rtftok */ - -#endif /* INCLUDED_RTFSCANNERHANDLER_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 4e3624405b9a..231b1aba3953 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1634,7 +1634,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType case NS_sprm::LN_PBrcBetween: // sprmPBrcBetween { //in binary format the borders are directly provided in OOXML they are inside of properties - if( IsOOXMLImport() ) + if( IsOOXMLImport() || IsRTFImport() ) { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if( pProperties.get()) @@ -1968,7 +1968,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType break; case NS_sprm::LN_CFDStrike : /*sprmCFDStrike double strike through*/ rContext->Insert(ePropertyId, true, - uno::makeAny( awt::FontStrikeout::DOUBLE ) ); + uno::makeAny( nIntValue ? awt::FontStrikeout::DOUBLE : awt::FontStrikeout::NONE ) ); break; case NS_sprm::LN_CFOutline: /*sprmCFOutline*/ case NS_sprm::LN_CFShadow: /*sprmCFShadow*/ @@ -2085,7 +2085,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType rContext->Insert(PROP_CHAR_CHAR_KERNING, true, uno::makeAny( sal_Int16(ConversionHelper::convertTwipToMM100(sal_Int16(nIntValue))) ) ); break; case NS_sprm::LN_CHpsKern: // sprmCHpsKern auto kerning is bound to a minimum font size in Word - but not in Writer :-( - rContext->Insert(PROP_CHAR_AUTO_KERNING, true, uno::makeAny( true ) ); + rContext->Insert(PROP_CHAR_AUTO_KERNING, true, uno::makeAny( sal_Bool(nIntValue) ) ); break; case NS_sprm::LN_CMajority50: break; // sprmCMajority50 @@ -2684,9 +2684,8 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType break; case 0x6877: //underlining color { - sal_Int32 nColor = ConversionHelper::ConvertColor(nIntValue); rContext->Insert(PROP_CHAR_UNDERLINE_HAS_COLOR, true, uno::makeAny( true ) ); - rContext->Insert(PROP_CHAR_UNDERLINE_COLOR, true, uno::makeAny( nColor ) ); + rContext->Insert(PROP_CHAR_UNDERLINE_COLOR, true, uno::makeAny( nIntValue ) ); } break; case 0x6815: @@ -3677,6 +3676,11 @@ bool DomainMapper::IsOOXMLImport() const return m_pImpl->IsOOXMLImport(); } +bool DomainMapper::IsRTFImport() const +{ + return m_pImpl->IsRTFImport(); +} + uno::Reference < lang::XMultiServiceFactory > DomainMapper::GetTextFactory() const { return m_pImpl->GetTextFactory(); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index bdaf3eb2d1fc..3b698970ed98 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -937,13 +937,7 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap ) uno::Reference< text::XTextRange > xParaEnd( xCur, uno::UNO_QUERY ); CheckParaRedline( xParaEnd ); - // Remove the last empty section paragraph if needed - if ( m_bIsLastParaInSection && !m_bParaChanged ) - { - RemoveLastParagraph( ); - m_bIsLastParaInSection = false; - } - + m_bIsLastParaInSection = false; m_bParaChanged = false; } if( !bKeepLastParagraphProperties ) diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index 60ccc230b43d..d4147b1cb782 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -545,7 +545,7 @@ public: void appendTableManager( ) { boost::shared_ptr< DomainMapperTableManager > pMngr( - new DomainMapperTableManager( m_eDocumentType == DOCUMENT_OOXML ) ); + new DomainMapperTableManager( m_eDocumentType == DOCUMENT_OOXML || m_eDocumentType == DOCUMENT_RTF ) ); m_aTableManagers.push( pMngr ); } @@ -562,6 +562,8 @@ public: bool IsOOXMLImport() const { return m_eDocumentType == DOCUMENT_OOXML; } + bool IsRTFImport() const { return m_eDocumentType == DOCUMENT_RTF; } + void InitPageMargins() { m_aPageMargins = _PageMar(); } void SetPageMarginTwip( PageMarElement eElement, sal_Int32 nValue ); const _PageMar& GetPageMargins() const {return m_aPageMargins;} diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx index fb2cd53f0190..049f5b941af9 100644 --- a/writerfilter/source/dmapper/NumberingManager.cxx +++ b/writerfilter/source/dmapper/NumberingManager.cxx @@ -916,7 +916,7 @@ void ListsManager::lcl_sprm( Sprm& rSprm ) void ListsManager::lcl_entry( int /* pos */, writerfilter::Reference<Properties>::Pointer_t ref ) { - if( m_rDMapper.IsOOXMLImport() ) + if( m_rDMapper.IsOOXMLImport() || m_rDMapper.IsRTFImport() ) { ref->resolve(*this); } diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 9ae05891e072..18b0ef39c981 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -837,130 +837,130 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) if( m_nColumnCount > 0 && xSection.is()) ApplyColumnProperties( xSection ); } - else + //get the properties and create appropriate page styles + uno::Reference< beans::XPropertySet > xFollowPageStyle = GetPageStyle( rDM_Impl.GetPageStyles(), rDM_Impl.GetTextFactory(), false ); + + if( m_nDzaGutter > 0 ) { - //get the properties and create appropriate page styles - uno::Reference< beans::XPropertySet > xFollowPageStyle = GetPageStyle( rDM_Impl.GetPageStyles(), rDM_Impl.GetTextFactory(), false ); + //todo: iGutterPos from DocProperties are missing + if( m_bGutterRTL ) + m_nRightMargin += m_nDzaGutter; + else + m_nLeftMargin += m_nDzaGutter; + } + operator[]( PropertyDefinition( PROP_LEFT_MARGIN, false )) = uno::makeAny( m_nLeftMargin ); + operator[]( PropertyDefinition( PROP_RIGHT_MARGIN, false )) = uno::makeAny( m_nRightMargin ); + + /*** if headers/footers are available then the top/bottom margins of the + header/footer are copied to the top/bottom margin of the page + */ + CopyLastHeaderFooter( false, rDM_Impl ); + PrepareHeaderFooterProperties( false ); + + const ::rtl::OUString sTrayIndex = rPropNameSupplier.GetName( PROP_PRINTER_PAPER_TRAY_INDEX ); + if( m_nPaperBin >= 0 ) + xFollowPageStyle->setPropertyValue( sTrayIndex, uno::makeAny( m_nPaperBin ) ); + uno::Reference< text::XTextColumns > xColumns; + if( m_nColumnCount > 0 ) + xColumns = ApplyColumnProperties( xFollowPageStyle ); - if( m_nDzaGutter > 0 ) - { - //todo: iGutterPos from DocProperties are missing - if( m_bGutterRTL ) - m_nRightMargin += m_nDzaGutter; - else - m_nLeftMargin += m_nDzaGutter; - } - operator[]( PropertyDefinition( PROP_LEFT_MARGIN, false )) = uno::makeAny( m_nLeftMargin ); - operator[]( PropertyDefinition( PROP_RIGHT_MARGIN, false )) = uno::makeAny( m_nRightMargin ); - - /*** if headers/footers are available then the top/bottom margins of the - header/footer are copied to the top/bottom margin of the page - */ - CopyLastHeaderFooter( false, rDM_Impl ); - PrepareHeaderFooterProperties( false ); - - const ::rtl::OUString sTrayIndex = rPropNameSupplier.GetName( PROP_PRINTER_PAPER_TRAY_INDEX ); - if( m_nPaperBin >= 0 ) - xFollowPageStyle->setPropertyValue( sTrayIndex, uno::makeAny( m_nPaperBin ) ); - uno::Reference< text::XTextColumns > xColumns; - if( m_nColumnCount > 0 ) - xColumns = ApplyColumnProperties( xFollowPageStyle ); - - //prepare text grid properties - sal_Int32 nHeight = 1; - PropertyMap::iterator aElement = find(PropertyDefinition( PROP_HEIGHT, false )); - if( aElement != end()) - aElement->second >>= nHeight; - - sal_Int32 nWidth = 1; - aElement = find(PropertyDefinition( PROP_WIDTH, false )); - if( aElement != end()) - aElement->second >>= nWidth; - - text::WritingMode eWritingMode = text::WritingMode_LR_TB; - aElement = find(PropertyDefinition( PROP_WRITING_MODE, false )); - if( aElement != end()) - aElement->second >>= eWritingMode; - - - - sal_Int32 nTextAreaHeight = eWritingMode == text::WritingMode_LR_TB ? - nHeight - m_nTopMargin - m_nBottomMargin : - nWidth - m_nLeftMargin - m_nRightMargin; - - operator[]( PropertyDefinition( PROP_GRID_LINES, false )) = - uno::makeAny( static_cast<sal_Int16>(nTextAreaHeight/m_nGridLinePitch)); - - sal_Int32 nCharWidth = 423; //240 twip/ 12 pt - //todo: is '0' the right index here? - const StyleSheetEntryPtr pEntry = rDM_Impl.GetStyleSheetTable()->FindStyleSheetByISTD(::rtl::OUString::valueOf(static_cast<sal_Int32>(0), 16)); - if( pEntry.get( ) ) - { - PropertyMap::iterator aElement_ = pEntry->pProperties->find(PropertyDefinition( PROP_CHAR_HEIGHT_ASIAN, false )); - if( aElement_ != pEntry->pProperties->end()) - { - double fHeight = 0; - if( aElement_->second >>= fHeight ) - nCharWidth = ConversionHelper::convertTwipToMM100( (long)( fHeight * 20.0 + 0.5 )); - } - } + //prepare text grid properties + sal_Int32 nHeight = 1; + PropertyMap::iterator aElement = find(PropertyDefinition( PROP_HEIGHT, false )); + if( aElement != end()) + aElement->second >>= nHeight; - //dxtCharSpace - if(m_nDxtCharSpace) - { - sal_Int32 nCharSpace = m_nDxtCharSpace; - //main lives in top 20 bits, and is signed. - sal_Int32 nMain = (nCharSpace & 0xFFFFF000); - nMain /= 0x1000; - nCharWidth += ConversionHelper::convertTwipToMM100( nMain * 20 ); - - sal_Int32 nFraction = (nCharSpace & 0x00000FFF); - nFraction = (nFraction * 20)/0xFFF; - nCharWidth += ConversionHelper::convertTwipToMM100( nFraction ); - } - operator[]( PropertyDefinition( PROP_GRID_BASE_HEIGHT, false )) = uno::makeAny( nCharWidth ); - sal_Int32 nRubyHeight = m_nGridLinePitch - nCharWidth; - if(nRubyHeight < 0 ) - nRubyHeight = 0; - operator[]( PropertyDefinition( PROP_GRID_RUBY_HEIGHT, false )) = uno::makeAny( nRubyHeight ); + sal_Int32 nWidth = 1; + aElement = find(PropertyDefinition( PROP_WIDTH, false )); + if( aElement != end()) + aElement->second >>= nWidth; + + text::WritingMode eWritingMode = text::WritingMode_LR_TB; + aElement = find(PropertyDefinition( PROP_WRITING_MODE, false )); + if( aElement != end()) + aElement->second >>= eWritingMode; - sal_Int16 nGridMode = text::TextGridMode::NONE; - switch (m_nGridType) - { - case NS_ooxml::LN_Value_wordprocessingml_ST_DocGrid_lines: - nGridMode = text::TextGridMode::LINES; - break; - case NS_ooxml::LN_Value_wordprocessingml_ST_DocGrid_linesAndChars: - nGridMode = text::TextGridMode::LINES_AND_CHARS; - break; - default: - break; - } - operator[](PropertyDefinition(PROP_GRID_MODE, false)) = uno::makeAny(nGridMode); + sal_Int32 nTextAreaHeight = eWritingMode == text::WritingMode_LR_TB ? + nHeight - m_nTopMargin - m_nBottomMargin : + nWidth - m_nLeftMargin - m_nRightMargin; - _ApplyProperties( xFollowPageStyle ); + operator[]( PropertyDefinition( PROP_GRID_LINES, false )) = + uno::makeAny( static_cast<sal_Int16>(nTextAreaHeight/m_nGridLinePitch)); - //todo: creating a "First Page" style depends on HasTitlePage und _fFacingPage_ - if( m_bTitlePage ) + sal_Int32 nCharWidth = 423; //240 twip/ 12 pt + //todo: is '0' the right index here? + const StyleSheetEntryPtr pEntry = rDM_Impl.GetStyleSheetTable()->FindStyleSheetByISTD(::rtl::OUString::valueOf(static_cast<sal_Int32>(0), 16)); + if( pEntry.get( ) ) + { + PropertyMap::iterator aElement_ = pEntry->pProperties->find(PropertyDefinition( PROP_CHAR_HEIGHT_ASIAN, false )); + if( aElement_ != pEntry->pProperties->end()) { - CopyLastHeaderFooter( true, rDM_Impl ); - PrepareHeaderFooterProperties( true ); - uno::Reference< beans::XPropertySet > xFirstPageStyle = GetPageStyle( - rDM_Impl.GetPageStyles(), rDM_Impl.GetTextFactory(), true ); - _ApplyProperties( xFirstPageStyle ); - - sal_Int32 nPaperBin = m_nFirstPaperBin >= 0 ? m_nFirstPaperBin : m_nPaperBin >= 0 ? m_nPaperBin : 0; - if( nPaperBin ) - xFollowPageStyle->setPropertyValue( sTrayIndex, uno::makeAny( nPaperBin ) ); - if( xColumns.is() ) - xFollowPageStyle->setPropertyValue( - rPropNameSupplier.GetName( PROP_TEXT_COLUMNS ), uno::makeAny( xColumns )); + double fHeight = 0; + if( aElement_->second >>= fHeight ) + nCharWidth = ConversionHelper::convertTwipToMM100( (long)( fHeight * 20.0 + 0.5 )); } + } + + //dxtCharSpace + if(m_nDxtCharSpace) + { + sal_Int32 nCharSpace = m_nDxtCharSpace; + //main lives in top 20 bits, and is signed. + sal_Int32 nMain = (nCharSpace & 0xFFFFF000); + nMain /= 0x1000; + nCharWidth += ConversionHelper::convertTwipToMM100( nMain * 20 ); + + sal_Int32 nFraction = (nCharSpace & 0x00000FFF); + nFraction = (nFraction * 20)/0xFFF; + nCharWidth += ConversionHelper::convertTwipToMM100( nFraction ); + } + operator[]( PropertyDefinition( PROP_GRID_BASE_HEIGHT, false )) = uno::makeAny( nCharWidth ); + sal_Int32 nRubyHeight = m_nGridLinePitch - nCharWidth; + if(nRubyHeight < 0 ) + nRubyHeight = 0; + operator[]( PropertyDefinition( PROP_GRID_RUBY_HEIGHT, false )) = uno::makeAny( nRubyHeight ); + + sal_Int16 nGridMode = text::TextGridMode::NONE; + + switch (m_nGridType) + { + case NS_ooxml::LN_Value_wordprocessingml_ST_DocGrid_lines: + nGridMode = text::TextGridMode::LINES; + break; + case NS_ooxml::LN_Value_wordprocessingml_ST_DocGrid_linesAndChars: + nGridMode = text::TextGridMode::LINES_AND_CHARS; + break; + default: + break; + } + + operator[](PropertyDefinition(PROP_GRID_MODE, false)) = uno::makeAny(nGridMode); + + _ApplyProperties( xFollowPageStyle ); - ApplyBorderToPageStyles( rDM_Impl.GetPageStyles( ), rDM_Impl.GetTextFactory( ), m_nBorderParams ); + //todo: creating a "First Page" style depends on HasTitlePage und _fFacingPage_ + if( m_bTitlePage ) + { + CopyLastHeaderFooter( true, rDM_Impl ); + PrepareHeaderFooterProperties( true ); + uno::Reference< beans::XPropertySet > xFirstPageStyle = GetPageStyle( + rDM_Impl.GetPageStyles(), rDM_Impl.GetTextFactory(), true ); + _ApplyProperties( xFirstPageStyle ); + + sal_Int32 nPaperBin = m_nFirstPaperBin >= 0 ? m_nFirstPaperBin : m_nPaperBin >= 0 ? m_nPaperBin : 0; + if( nPaperBin ) + xFollowPageStyle->setPropertyValue( sTrayIndex, uno::makeAny( nPaperBin ) ); + if( xColumns.is() ) + xFollowPageStyle->setPropertyValue( + rPropNameSupplier.GetName( PROP_TEXT_COLUMNS ), uno::makeAny( xColumns )); + } + + ApplyBorderToPageStyles( rDM_Impl.GetPageStyles( ), rDM_Impl.GetTextFactory( ), m_nBorderParams ); + if ( m_nBreakType != 0 ) + { try { { @@ -992,7 +992,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl ) { OSL_FAIL( "Exception in SectionPropertyMap::CloseSectionGroup"); (void)rEx; - } + } } } diff --git a/writerfilter/source/doctok/DffImpl.cxx b/writerfilter/source/doctok/DffImpl.cxx index cc7b21f26123..25f9b72b11e5 100644 --- a/writerfilter/source/doctok/DffImpl.cxx +++ b/writerfilter/source/doctok/DffImpl.cxx @@ -285,11 +285,6 @@ DffOPT::get_property(sal_uInt32 nPos) return writerfilter::Reference<Properties>::Pointer_t(pTmp); } -sal_uInt32 DffOPT::get_extraoffset_count() -{ - return get_property_count(); -} - sal_uInt32 DffOPT::get_extraoffset(sal_uInt32 pos) { sal_uInt32 nResult; diff --git a/writerfilter/source/doctok/WW8DocumentImpl.cxx b/writerfilter/source/doctok/WW8DocumentImpl.cxx index f7b79a31882a..6c6e649d4439 100644 --- a/writerfilter/source/doctok/WW8DocumentImpl.cxx +++ b/writerfilter/source/doctok/WW8DocumentImpl.cxx @@ -116,11 +116,6 @@ WW8DocumentIteratorImpl::getSubDocument() const return mpDocument->getSubDocument(mCpAndFc); } -WW8SED * WW8DocumentIteratorImpl::getSED() const -{ - return mpDocument->getSED(mCpAndFc); -} - WW8Stream::Sequence WW8DocumentIteratorImpl::getText() { return mpDocument->getText(mCpAndFc); @@ -588,12 +583,6 @@ void WW8DocumentImpl::parseBinTableCpAndFcs(WW8BinTable & rTable, { for (sal_uInt32 i = 0; i < rTable.getEntryCount(); i++) { -#if 0 - char sBuffer[255]; - snprintf(sBuffer, 255, "%ld", i); - char sBufferPageNum[255]; - snprintf(sBufferPageNum, 255, "%ld", rTable.getPageNumber(i)); -#endif Fc aFcFromTable(rTable.getFc(i)); if (aFcFromTable < mpPieceTable->getFirstFc()) @@ -751,16 +740,6 @@ CpAndFc WW8DocumentImpl::getEndnoteEndCp() const return mEndnoteEndCpAndFc; } -CpAndFc WW8DocumentImpl::getTextboxEndCp() const -{ - return mTextboxEndCpAndFc; -} - -CpAndFc WW8DocumentImpl::getTextboxHeaderEndCp() const -{ - return mTextboxHeaderEndCpAndFc; -} - CpAndFc WW8DocumentImpl::getNextCp(const CpAndFc & rCpAndFc) const { CpAndFc aResult = mCpAndFcEnd; @@ -1129,16 +1108,6 @@ writerfilter::Reference<Stream>::Pointer_t WW8DocumentImpl::getHeader(sal_uInt32 CpAndFc aCpAndFcStart(getHeaderCpAndFc(nPos)); CpAndFc aCpAndFcEnd(getHeaderCpAndFc(nPos + 1)); -#if 0 - sal_uInt32 nEquals = 1; - while (aCpAndFcEnd == aCpAndFcStart && nPos + nEquals < getHeaderCount()) - { - ++nEquals; - - aCpAndFcEnd = getHeaderCpAndFc(nPos + nEquals); - } -#endif - if (aCpAndFcStart < aCpAndFcEnd) pResult = writerfilter::Reference<Stream>::Pointer_t (new WW8DocumentImpl(*this, aCpAndFcStart, aCpAndFcEnd)); @@ -1146,22 +1115,6 @@ writerfilter::Reference<Stream>::Pointer_t WW8DocumentImpl::getHeader(sal_uInt32 return pResult; } -sal_uInt32 WW8DocumentImpl::getFootnoteCount() const -{ - return (mpFootnoteHelper.get() != NULL) ? mpFootnoteHelper->getCount() : 0; -} - -writerfilter::Reference<Stream>::Pointer_t -WW8DocumentImpl::getFootnote(sal_uInt32 nPos) -{ - writerfilter::Reference<Stream>::Pointer_t pResult; - - if (! bSubDocument) - pResult = mpFootnoteHelper->get(nPos); - - return pResult; -} - writerfilter::Reference<Stream>::Pointer_t WW8DocumentImpl::getFootnote(const CpAndFc & rCpAndFc) { @@ -1173,22 +1126,6 @@ WW8DocumentImpl::getFootnote(const CpAndFc & rCpAndFc) return pResult; } -sal_uInt32 WW8DocumentImpl::getEndnoteCount() const -{ - return mpEndnoteHelper.get() != NULL ? mpEndnoteHelper->getCount() : 0; -} - -writerfilter::Reference<Stream>::Pointer_t -WW8DocumentImpl::getEndnote(sal_uInt32 nPos) -{ - writerfilter::Reference<Stream>::Pointer_t pResult; - - if (! bSubDocument) - pResult = mpEndnoteHelper->get(nPos); - - return pResult; -} - writerfilter::Reference<Stream>::Pointer_t WW8DocumentImpl::getEndnote(const CpAndFc & rCpAndFc) { @@ -1200,22 +1137,6 @@ WW8DocumentImpl::getEndnote(const CpAndFc & rCpAndFc) return pResult; } -sal_uInt32 WW8DocumentImpl::getAnnotationCount() const -{ - return mpAnnotationHelper.get() != NULL ? - mpAnnotationHelper->getCount() : 0; -} - -writerfilter::Reference<Stream>::Pointer_t -WW8DocumentImpl::getAnnotation(sal_uInt32 nPos) -{ - writerfilter::Reference<Stream>::Pointer_t pResult; - - if (! bSubDocument) - pResult = mpAnnotationHelper->get(nPos); - - return pResult; -} writerfilter::Reference<Stream>::Pointer_t WW8DocumentImpl::getAnnotation(const CpAndFc & rCpAndFc) @@ -1308,11 +1229,6 @@ WW8FLD::Pointer_t WW8DocumentImpl::getCurrentFLD() const return mpFLD; } -sal_uInt32 WW8DocumentImpl::getPicLocation() const -{ - return mfcPicLoc; -} - void WW8DocumentImpl::setPicLocation(sal_uInt32 fcPicLoc) { mfcPicLoc = fcPicLoc; @@ -1421,13 +1337,6 @@ CpAndFc WW8DocumentImpl::getCpAndFc(const Cp & cp, PropertyType type) const return CpAndFc(cp, aFc, type); } -CpAndFc WW8DocumentImpl::getCpAndFc(const Fc & fc, PropertyType type) const -{ - Cp aCp = fc2cp(fc); - - return CpAndFc(aCp, fc, type); -} - void WW8DocumentImpl::resolvePicture(Stream & rStream) { WW8Stream::Pointer_t pStream = getDataStream(); @@ -1672,24 +1581,11 @@ void WW8DocumentImpl::resolve(Stream & rStream) rStream.props(pFibRgFcLcb2000); } -#if 0 - if (mpTextBoxStories.get() != NULL) - { - output.addItem("<textbox.boxes>"); - mpTextBoxStories->dump(output); - output.addItem("</textbox.boxes>"); - } -#endif if (mpFib->get_lcbPlcftxbxBkd() > 0) { PLCF<WW8BKD> aPLCF(*mpTableStream, mpFib->get_fcPlcftxbxBkd(), mpFib->get_lcbPlcftxbxBkd()); -#if 0 - output.addItem("<textbox.breaks>"); - aPLCF.dump(output); - output.addItem("</textbox.breaks>"); -#endif } if (mpDffBlock.get() != NULL) @@ -1711,33 +1607,6 @@ void WW8DocumentImpl::resolve(Stream & rStream) rStream.info("/headers"); } -#if 0 - { - sal_uInt32 nFootnoteCount = getFootnoteCount(); - for (sal_uInt32 n = 0; n < nFootnoteCount; ++n) - { - //clog << "<footnote num=\"" << n << "\"/>" << endl; - - writerfilter::Reference<Stream>::Pointer_t pFootnote(getFootnote(n)); - - if (pFootnote.get() != NULL) - rStream.substream(NS_rtf::LN_footnote, pFootnote); - } - } - { - sal_uInt32 nEndnoteCount = getEndnoteCount(); - for (sal_uInt32 n = 0; n < nEndnoteCount; ++n) - { - //clog << "<endnote num=\"" << n << "\"/>" << endl; - - writerfilter::Reference<Stream>::Pointer_t pEndnote(getEndnote(n)); - - if (pEndnote.get() != NULL) - rStream.substream(NS_rtf::LN_endnote, pEndnote); - } - } -#endif - writerfilter::Reference<Table>::Pointer_t pSttbRgtplc = getListTplcs(); if (pSttbRgtplc.get() != NULL) diff --git a/writerfilter/source/doctok/WW8PropertySetImpl.cxx b/writerfilter/source/doctok/WW8PropertySetImpl.cxx index 53ff1c051675..196939f9c064 100644 --- a/writerfilter/source/doctok/WW8PropertySetImpl.cxx +++ b/writerfilter/source/doctok/WW8PropertySetImpl.cxx @@ -54,12 +54,6 @@ WW8PropertySetIterator::~WW8PropertySetIterator() { } -WW8PropertyImpl::WW8PropertyImpl(WW8Stream & rStream, - sal_uInt32 nOffset, sal_uInt32 nCount) -: WW8StructBase(rStream, nOffset, nCount) -{ -} - WW8PropertyImpl::WW8PropertyImpl(const WW8StructBase & rBase, sal_uInt32 nOffset, sal_uInt32 nCount) @@ -67,13 +61,6 @@ WW8PropertyImpl::WW8PropertyImpl(const WW8StructBase & rBase, { } -WW8PropertyImpl::WW8PropertyImpl(WW8StructBase * pBase, - sal_uInt32 nOffset, - sal_uInt32 nCount) -: WW8StructBase(pBase, nOffset, nCount) -{ -} - WW8PropertyImpl::~WW8PropertyImpl() { } @@ -164,28 +151,6 @@ sal_uInt32 WW8PropertyImpl::getByteLength() const return nParamSize + 2; } -sal_uInt32 WW8PropertyImpl::getParamOffset() const -{ - sal_uInt32 nReturn = 0; - - if (get_spra() == 6) - nReturn = 1; - - switch (getId()) - { - case 0xd608: - case 0xd609: - nReturn = 3; - - break; - - default: - break; - } - - return nReturn; -} - void WW8PropertyImpl::dump(OutputWithDepth<string> & o) const { o.addItem(toString()); diff --git a/writerfilter/source/doctok/WW8ResourceModelImpl.cxx b/writerfilter/source/doctok/WW8ResourceModelImpl.cxx index d23ca33d8f31..008b8624515b 100644 --- a/writerfilter/source/doctok/WW8ResourceModelImpl.cxx +++ b/writerfilter/source/doctok/WW8ResourceModelImpl.cxx @@ -201,12 +201,6 @@ string WW8PropertiesReference::getType() const } WW8BinaryObjReference::WW8BinaryObjReference -(WW8StructBase & rParent, sal_uInt32 nOffset, sal_uInt32 nCount) -: WW8StructBase(rParent, nOffset, nCount) -{ -} - -WW8BinaryObjReference::WW8BinaryObjReference (WW8StructBase * pParent, sal_uInt32 nOffset, sal_uInt32 nCount) : WW8StructBase(pParent, nOffset, nCount) { @@ -218,12 +212,6 @@ WW8BinaryObjReference::WW8BinaryObjReference { } -WW8BinaryObjReference::WW8BinaryObjReference -(WW8Stream & rStream, sal_uInt32 nOffset, sal_uInt32 nCount) -: WW8StructBase(rStream, nOffset, nCount) -{ -} - writerfilter::Reference<BinaryObj>::Pointer_t WW8BinaryObjReference::getBinary() { diff --git a/writerfilter/source/filter/RtfFilter.cxx b/writerfilter/source/filter/RtfFilter.cxx index b018aed2cfda..3c326d98bf29 100644 --- a/writerfilter/source/filter/RtfFilter.cxx +++ b/writerfilter/source/filter/RtfFilter.cxx @@ -32,10 +32,16 @@ #include <osl/module.hxx> #include <tools/solar.h> #include <RtfFilter.hxx> +#include <comphelper/mediadescriptor.hxx> +#include <dmapper/DomainMapper.hxx> +#include <rtftok/RTFDocument.hxx> +#include <com/sun/star/frame/XFrame.hpp> +#include <svtools/miscopt.hxx> using namespace ::rtl; using namespace ::cppu; using namespace ::com::sun::star; +using ::comphelper::MediaDescriptor; RtfFilter::RtfFilter( const uno::Reference< uno::XComponentContext >& rxContext) : m_xContext( rxContext ) @@ -65,6 +71,39 @@ sal_Bool RtfFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescri } else if ( m_xDstDoc.is() ) { + SvtMiscOptions aMiscOptions; + if (aMiscOptions.IsExperimentalMode()) + { + MediaDescriptor aMediaDesc( aDescriptor ); +#ifdef DEBUG_IMPORT + OUString sURL = aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_URL(), OUString() ); + ::std::string sURLc = OUStringToOString(sURL, RTL_TEXTENCODING_ASCII_US).getStr(); + + writerfilter::TagLogger::Pointer_t dmapperLogger + (writerfilter::TagLogger::getInstance("DOMAINMAPPER")); + dmapperLogger->setFileName(sURLc); + dmapperLogger->startDocument(); +#endif + uno::Reference< io::XInputStream > xInputStream; + + aMediaDesc.addInputStream(); + aMediaDesc[ MediaDescriptor::PROP_INPUTSTREAM() ] >>= xInputStream; + + uno::Reference<frame::XFrame> xFrame = aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_FRAME(), + uno::Reference<frame::XFrame>()); + + writerfilter::Stream::Pointer_t pStream( + new writerfilter::dmapper::DomainMapper(m_xContext, xInputStream, m_xDstDoc, writerfilter::dmapper::DOCUMENT_RTF)); + writerfilter::rtftok::RTFDocument::Pointer_t const pDocument( + writerfilter::rtftok::RTFDocumentFactory::createDocument(m_xContext, xInputStream, m_xDstDoc, xFrame)); + pDocument->resolve(*pStream); +#ifdef DEBUG_IMPORT + dmapperLogger->endDocument(); +#endif + return sal_True; + } + + // if not, then use the old importer uno::Reference< lang::XMultiServiceFactory > xMSF(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW); uno::Reference< uno::XInterface > xIfc( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.RtfImport" ))), uno::UNO_QUERY_THROW); if (!xIfc.is()) diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx index 1e039d6febc6..252d4ac6903b 100644 --- a/writerfilter/source/filter/WriterFilter.cxx +++ b/writerfilter/source/filter/WriterFilter.cxx @@ -60,11 +60,6 @@ static struct ::cppu::ImplementationEntry s_component_entries [] = { 0, 0, 0, 0, 0, 0 } // terminate with NULL }; -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(sal_Char const * implName, ::com::sun::star::lang::XMultiServiceFactory * xMgr, ::com::sun::star::registry::XRegistryKey * xRegistry ) { return ::cppu::component_getFactoryHelper(implName, xMgr, xRegistry, s_component_entries ); diff --git a/writerfilter/source/rtftok/FlexLexer.h b/writerfilter/source/rtftok/FlexLexer.h deleted file mode 100644 index 375012b723a7..000000000000 --- a/writerfilter/source/rtftok/FlexLexer.h +++ /dev/null @@ -1,151 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef __FLEX_LEXER_H -// Never included before - need to define base class. -#define __FLEX_LEXER_H -typedef void ostream; -#include <vector> -#include <rtftok/RTFInputSource.hxx> - -extern "C++" { - -struct yy_buffer_state; -typedef int yy_state_type; - -} -#include <rtftok/RTFScanner.hxx> -#endif - -#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce) -// Either this is the first time through (yyFlexLexerOnce not defined), -// or this is a repeated include to define a different flavor of -// yyFlexLexer, as discussed in the flex man page. -#define yyFlexLexerOnce - -class yyFlexLexer : public writerfilter::rtftok::RTFScanner { -private: - class RtfTokenizer* tokenizerInstance; - - void split_ctrl(char *yytext, char* token, char *value); - void raise_ctrl(char* yytext); - void raise_dest(char* yytext); - void raise_destOrCtrl(char* yytext); -protected: - int num_lines; - sal_uInt64 num_chars; - int star_flag; - -public: - // arg_yyin and arg_yyout default to the cin and cout, but we - // only make that assignment when initializing in yylex(). - yyFlexLexer( class writerfilter::rtftok::RTFInputSource* arg_yyin, class writerfilter::rtftok::RTFScannerHandler &eventHandler ); - - virtual ~yyFlexLexer(); - - void yy_switch_to_buffer( struct yy_buffer_state* new_buffer ); - struct yy_buffer_state* yy_create_buffer( class writerfilter::rtftok::RTFInputSource* s, int size ); - void yy_delete_buffer( struct yy_buffer_state* b ); - void yyrestart( class writerfilter::rtftok::RTFInputSource* s ); - - virtual int yylex(); - virtual void switch_streams( class writerfilter::rtftok::RTFInputSource* new_in, ostream* new_out ); - -protected: - -// int LexerInput( char* buf, int max_size ); - virtual void LexerOutput( const char* buf, int size ); - virtual void LexerError( const char* msg ); - - void yyunput( int c, char* buf_ptr ); - int yyinput(); - - void yy_load_buffer_state(); - void yy_init_buffer( struct yy_buffer_state* b, class writerfilter::rtftok::RTFInputSource* s ); - void yy_flush_buffer( struct yy_buffer_state* b ); - - int yy_start_stack_ptr; - int yy_start_stack_depth; - int* yy_start_stack; - - void yy_push_state( int new_state ); - void yy_pop_state(); - int yy_top_state(); - - yy_state_type yy_get_previous_state(); - yy_state_type yy_try_NUL_trans( yy_state_type current_state ); - int yy_get_next_buffer(); - - class writerfilter::rtftok::RTFInputSource* yyin; // input source for default LexerInput - ostream* yyout; // output sink for default LexerOutput - - struct yy_buffer_state* yy_current_buffer; - - // yy_hold_char holds the character lost when yytext is formed. - char yy_hold_char; - - // Number of characters read into yy_ch_buf. - int yy_n_chars; - - // Points to current character in buffer. - char* yy_c_buf_p; - - int yy_init; // whether we need to initialize - int yy_start; // start state number - - // Flag which is used to allow yywrap()'s to do buffer switches - // instead of setting up a fresh yyin. A bit of a hack ... - int yy_did_buffer_switch_on_eof; - - // The following are not always needed, but may be depending - // on use of certain flex features (like REJECT or yymore()). - - yy_state_type yy_last_accepting_state; - char* yy_last_accepting_cpos; - - yy_state_type* yy_state_buf; - yy_state_type* yy_state_ptr; - - char* yy_full_match; - int* yy_full_state; - int yy_full_lp; - - int yy_lp; - int yy_looking_for_trail_begin; - - int yy_more_flag; - int yy_more_len; - int yy_more_offset; - int yy_prev_more_offset; - - private: - -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/RTFParseException.cxx b/writerfilter/source/rtftok/RTFParseException.cxx deleted file mode 100644 index ddfe2e5adb15..000000000000 --- a/writerfilter/source/rtftok/RTFParseException.cxx +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <rtftok/RTFParseException.hxx> - -writerfilter::rtftok::RTFParseException::RTFParseException(char * /*message*/) -{ -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/RTFScanner.lex b/writerfilter/source/rtftok/RTFScanner.lex deleted file mode 100644 index 1cbc636f5348..000000000000 --- a/writerfilter/source/rtftok/RTFScanner.lex +++ /dev/null @@ -1,333 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -/* compile with flex++ -8 -f -+ -Sflex.skl -ortfparser.cxx rtfparser.lex */ -%option yylineno -%{ -#include <math.h> -#include <string.h> -#include <osl/file.h> -#include <sal/macros.h> -#include <assert.h> -#include <vector> - -#if defined (UNX) - #define stricmp strcasecmp -#endif - -writerfilter::rtftok::RTFScanner* writerfilter::rtftok::RTFScanner::createRTFScanner(class writerfilter::rtftok::RTFInputSource& inputSource, writerfilter::rtftok::RTFScannerHandler &eventHandler) -{ - return new yyFlexLexer(&inputSource, eventHandler); -} - - - -extern "C" { -//int isatty(int fd) { return 0; } -int yywrap(void) { return 1; } -} - -/* -oslFileHandle yy_osl_in=NULL; -#define YY_INPUT(buf,result,max_size) \ -{\ -{\ - assert(yy_osl_in!=NULL);\ - sal_Bool isEOF;\ - oslFileError ret=osl_isEndOfFile( yy_osl_in, &isEOF );\ - assert(ret==osl_File_E_None);\ - if (isEOF)\ - {\ - result=YY_NULL;\ - }\ - else\ - {\ - sal_uInt64 bytesRead;\ - ret=osl_readFile( yy_osl_in, buf, max_size, &bytesRead);\ - assert(ret==osl_File_E_None);\ - result = bytesRead; \ - }\ -}\ -} -*/ - -//extern RtfTokenizer* this; -void yyFlexLexer::split_ctrl(char *_yytext, char* token, char *value) - { - int i=0; // skip first '\' - while(_yytext[i]!=0 && (_yytext[i]=='\r' || _yytext[i]=='\n')) i++; - while(_yytext[i]!=0 && (_yytext[i]<'A' || (_yytext[i]>'Z' && _yytext[i]<'a') || _yytext[i]>'z')) i++; - while(_yytext[i]!=0 && _yytext[i]>='A') *(token++)=_yytext[i++]; - *token=0; - while(_yytext[i]!=0 && _yytext[i]>' ') *(value++)=_yytext[i++]; - *value=0; - } - - void yyFlexLexer::raise_ctrl(char* _yytext) - { - char token[50]; - char value[50]; - split_ctrl(_yytext, token, value); - eventHandler.ctrl(token, value); - } - - void yyFlexLexer::raise_dest(char* _yytext) - { - char token[50]; - char value[50]; - split_ctrl(_yytext, token, value); - eventHandler.dest(token, value); - } - -#define _num_of_destctrls (SAL_N_ELEMENTS(_destctrls)) -static const char* _destctrls[] = { -"aftncn", -"aftnsep", -"aftnsepc", -"annotation", -"atnauthor", -"atndate", -"atnicn", -"atnid", -"atnparent", -"atnref", -"atntime", -"atrfend", -"atrfstart", -"author", -"background", -"bkmkend", -"bkmkstart", -"buptim", -"category", -"colortbl", -"comment", -"company", -"creatim", -"datafield", -"do", -"doccomm", -"docvar", -"dptxbxtext", -"falt", -"fchars", -"ffdeftext", -"ffentrymcr", -"ffexitmcr", -"ffformat", -"ffhelptext", -"ffl", -"ffname", -"ffstattext", -"field", -"file", -"filetbl", -"fldinst", -"fldrslt", -"fldtype", -"fname", -"fontemb", -"fontfile", -"fonttbl", -"footer", -"footer", -"footerf", -"footerl", -"footnote", -"formfield", -"ftncn", -"ftnsep", -"ftnsepc", -"g", -"generator", -"gridtbl", -"header", -"header", -"headerf", -"headerl", -"htmltag", -"info", -"keycode", -"keywords", -"lchars", -"levelnumbers", -"leveltext", -"lfolevel", -"list", -"listlevel", -"listname", -"listoverride", -"listoverridetable", -"listtable", -"listtext", -"manager", -"mhtmltag", -"nesttableprops", -"nextfile", -"nonesttables", -"nonshppict", -"objalias", -"objclass", -"objdata", -"object", -"objname", -"objsect", -"objtime", -"oldcprops", -"oldpprops", -"oldsprops", -"oldtprops", -"operator", -"panose", -"pgp", -"pgptbl", -"picprop", -"pict", -"pn", -"pnseclvl", -"pntext", -"pntxta", -"pntxtb", -"printim", -"private", -"pwd", -"pxe", -"result", -"revtbl", -"revtim", -"rsidtbl", -"rtf", -"rxe", -"shp", -"shpgrp", -"shpinst", -"shppict", -"shprslt", -"shptxt", -"sn", -"sp", -"stylesheet", -"subject", -"sv", -"tc", -"template", -"title", -"txe", -"ud", -"upr", -"urtf", -"userprops", -"xe" -}; - - void yyFlexLexer::raise_destOrCtrl(char* _yytext) - { - char token[50]; - char value[50]; - split_ctrl(_yytext, token, value); - char* result=(char*)bsearch(token, _destctrls, _num_of_destctrls, 20, (int (*)(const void*, const void*))stricmp); - if (result) - { - eventHandler.dest(token, value); - } - else - { - eventHandler.lbrace(); - eventHandler.ctrl(token, value); - } - } - -%} - -%% -\{\\upr\{" "? { /* skip upr destination */ - int c; - int br=1; - while (br>0 && (c = yyinput()) != EOF) - { - if (c=='}') br--; - if (c=='{') br++; - } - eventHandler.lbrace(); - num_chars+=yyleng; -} - - -\\bin(("+"|"-")?[0-9]*)?" "? { - raise_dest(yytext); - num_chars+=yyleng; - int len=atoi(yytext+4); - num_chars+=len; - // pictureBytes=2*len; - while ( len ) - { - int c = yyinput(); - eventHandler.addBinData((unsigned char)c); - len--; - } - eventHandler.rbrace(); -} - -\{[\r\n]*\\\*\\[A-Za-z]+(("+"|"-")?[0-9]*)?" "? { /* stared dest word */ - raise_dest(yytext); - num_chars+=yyleng; -} -\{[\r\n]*\\[A-Za-z]+(("+"|"-")?[0-9]*)?" "? { /* dest word */ - raise_destOrCtrl(yytext); -} -\\[A-Za-z]+(("+"|"-")?[0-9]*)?" "? { /* ctrl word */ - raise_ctrl(yytext); - star_flag=0; - num_chars+=yyleng; -} -\\\'[A-Fa-f0-9][A-Fa-f0-9] { /* hex char */ - eventHandler.addHexChar(yytext); - num_chars+=yyleng; -} -\\* { /* star */ - star_flag=1; - num_chars+=yyleng; -} -\{ { /* lbrace */ - eventHandler.lbrace(); - num_chars+=yyleng; -} -\} { /* rbrace */ - eventHandler.rbrace(); - num_chars+=yyleng; -} -\\\| { num_chars+=yyleng;} -\\~ {num_chars+=yyleng; eventHandler.addCharU(0xa0);} -\\- {num_chars+=yyleng;} -\\_ {num_chars+=yyleng;} -\\\: {num_chars+=yyleng;} -\n { ++num_lines;num_chars+=yyleng;} -\r {num_chars+=yyleng;} -\t {num_chars+=yyleng;} -" "(" "+) { eventHandler.addSpaces(yyleng); num_chars+=yyleng;} -. { eventHandler.addChar(yytext[0]); num_chars+=yyleng;} -%% diff --git a/writerfilter/source/rtftok/RTFScanner.skl b/writerfilter/source/rtftok/RTFScanner.skl deleted file mode 100644 index 071eab6c9272..000000000000 --- a/writerfilter/source/rtftok/RTFScanner.skl +++ /dev/null @@ -1,1527 +0,0 @@ -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 - -%- -#include <stdio.h> -%* - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - -#include <math.h> -#include <osl/file.h> -#include <rtl/alloc.h> -#include <rtftok/RTFInputSource.hxx> -#include <rtftok/RTFParseException.hxx> - -static const int EOF=0; - -%+ -//class istream; -%* - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#if __STDC__ - -#define YY_USE_PROTOS -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN yy_start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((yy_start - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#define YY_BUF_SIZE 16384 - -typedef struct yy_buffer_state *YY_BUFFER_STATE; - -extern int yyleng; -%- -extern FILE *yyin, *yyout; -%* - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, yytext_ptr ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; - - -struct yy_buffer_state - { -%- - FILE *yy_input_file; -%+ -// istream* yy_input_file; - writerfilter::rtftok::RTFInputSource *yy_input_file; -%* - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - }; - -%- Standard (non-C++) definition -static YY_BUFFER_STATE yy_current_buffer = 0; -%* - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - -%- Standard (non-C++) definition -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart YY_PROTO(( FILE *input_file )); - -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) - -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); -%* - -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) - -%% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here - -%- Standard (non-C++) definition -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); -%* - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ -%% code to fiddle yytext and yyleng for yymore() goes here - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ -%% code to copy yytext_ptr to yytext[] goes here, if %array - yy_c_buf_p = yy_cp; - -%% data tables for the DFA and the user's section 1 definitions go here - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); -#else -extern int yywrap YY_PROTO(( void )); -#endif -#endif - -%- -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif -%* - -#ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); -#endif - -#ifndef YY_NO_INPUT -%- Standard (non-C++) definition -#ifdef __cplusplus -static int yyinput YY_PROTO(( void )); -#else -static int input YY_PROTO(( void )); -#endif -%* -#endif - -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include <stdlib.h> -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ - -#ifndef ECHO -%- Standard (non-C++) definition -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) -%+ C++ definition -#define ECHO LexerOutput( yytext, yyleng ) -%* -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ -%% fread()/read() definition of YY_INPUT goes here unless we're doing C++ -%+ C++ definition -{result=yyin->read(buf, max_size);} -%* -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -%- -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -%+ -#define YY_FATAL_ERROR(msg) LexerError( msg ) -%* -#endif - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -%- Standard (non-C++) definition -#define YY_DECL int yylex YY_PROTO(( void )) -%+ C++ definition -#define YY_DECL int yyFlexLexer::yylex() -%* -#endif - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -%% YY_RULE_SETUP definition goes here - -YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -%% user's declarations go here - - if ( yy_init ) - { - yy_init = 0; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! yy_start ) - yy_start = 1; /* first start state */ - - if ( ! yyin ) -%- - yyin = stdin; -%+ -// yyin = &cin; - yyin = NULL; -%* - - if ( ! yyout ) -%- - yyout = stdout; -%+ -// yyout = &cout; - yyout = NULL; -%* - - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_load_buffer_state(); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { -%% yymore()-related code goes here - yy_cp = yy_c_buf_p; - - /* Support of yytext. */ - *yy_cp = yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - -%% code to set up and find next match goes here - -yy_find_action: -%% code to find the action number goes here - - YY_DO_BEFORE_ACTION; - -%% code for yylineno update goes here - -do_action: /* This label is used only to access EOF actions. */ - -%% debug code goes here - - switch ( yy_act ) - { /* beginning of action switch */ -%% actions go here - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; - YY_RESTORE_YY_MORE_OFFSET - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { -%% code to do back-up for compressed tables and set up yy_cp goes here - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ - -%+ -yyFlexLexer::yyFlexLexer( writerfilter::rtftok::RTFInputSource* arg_yyin, class writerfilter::rtftok::RTFScannerHandler &eventHandler ) -: writerfilter::rtftok::RTFScanner(eventHandler) - { - yyin = arg_yyin; - yyout = 0; - yy_c_buf_p = 0; - yy_init = 1; - yy_start = 0; - yy_flex_debug = 0; - yylineno = 1; // this will only get updated if %option yylineno - - yy_did_buffer_switch_on_eof = 0; - - yy_looking_for_trail_begin = 0; - yy_more_flag = 0; - yy_more_len = 0; - yy_more_offset = yy_prev_more_offset = 0; - - yy_start_stack_ptr = yy_start_stack_depth = 0; - yy_start_stack = 0; - - yy_current_buffer = 0; - -#ifdef YY_USES_REJECT - yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2]; -#else - yy_state_buf = 0; -#endif - - num_lines=0; - num_chars=0; - star_flag=false; - } - -yyFlexLexer::~yyFlexLexer() - { - delete yy_state_buf; - yy_delete_buffer( yy_current_buffer ); - } - -void yyFlexLexer::switch_streams( writerfilter::rtftok::RTFInputSource* new_in, ostream* new_out ) - { - if ( new_in ) - { - yy_delete_buffer( yy_current_buffer ); - yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) ); - } - - if ( new_out ) - yyout = new_out; - } - -#if 0 -#ifdef YY_INTERACTIVE -int yyFlexLexer::LexerInput( char* buf, int /* max_size */ ) -#else -int yyFlexLexer::LexerInput( char* buf, int max_size ) -#endif -{ - OSL_ASSERT(yyin!=NULL); - ::com::sun::star::uno::Sequence< ::sal_Int8 > buffer; - int len=yyin->readSomeBytes(buffer,max_size); - if (len>0) - { - sal_Int8 *_buffer=buffer.getArray(); - memcpy(buf, _buffer, len); - return len; - } - else - { - return YY_NULL; - } -} -#endif - -void yyFlexLexer::LexerOutput( const char* buf, int size ) - { -// (void) yyout->write( buf, size ); - } -%* - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -%- -static int yy_get_next_buffer() -%+ -int yyFlexLexer::yy_get_next_buffer() -%* - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; - register int number_to_move, i; - int ret_val; - - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_current_buffer->yy_n_chars = yy_n_chars = 0; - - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; - - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; - } - - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -%- -static yy_state_type yy_get_previous_state() -%+ -yy_state_type yyFlexLexer::yy_get_previous_state() -%* - { - register yy_state_type yy_current_state; - register char *yy_cp; - -%% code to get the start state into yy_current_state goes here - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { -%% code to find the next state goes here - } - - return yy_current_state; - } - - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -%- -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif -%+ -yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state ) -%* - { - register int yy_is_jam; -%% code to find the next state, and perhaps do backing up, goes here - - return yy_is_jam ? 0 : yy_current_state; - } - - -%- -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif -%+ -void yyFlexLexer::yyunput( int c, register char* yy_bp ) -%* - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - -%% update yylineno here - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -%- -#endif /* ifndef YY_NO_UNPUT */ -%* - - -%- -#ifdef __cplusplus -static int yyinput() -#else -static int input() -#endif -%+ -int yyFlexLexer::yyinput() -%* - { - int c; - - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; - - else - { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; - - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart( yyin ); - - /* fall through */ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - return EOF; - - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; - break; - } - } - } - - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - -%% update BOL and yylineno - - return c; - } - - -%- -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif -%+ -void yyFlexLexer::yyrestart( writerfilter::rtftok::RTFInputSource* input_file ) -%* - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -%- -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif -%+ -void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -%* - { - if ( yy_current_buffer == new_buffer ) - return; - - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - yy_current_buffer = new_buffer; - yy_load_buffer_state(); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } - - -%- -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif -%+ -void yyFlexLexer::yy_load_buffer_state() -%* - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif -%+ -YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( writerfilter::rtftok::RTFInputSource* file, int size ) -%* - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file ); - - return b; - } - - -%- -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif -%+ -void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b ) -%* - { - if ( ! b ) - return; - - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - -%- -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - -%+ -//extern "C" int isatty YY_PROTO(( int )); -void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, writerfilter::rtftok::RTFInputSource* file ) -%* - - { - yy_flush_buffer( b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - -%- -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif -%+ - b->yy_is_interactive = 0; -%* - } - - -%- -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - -%+ -void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b ) -%* - { - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == yy_current_buffer ) - yy_load_buffer_state(); - } -%* - - -#ifndef YY_NO_SCAN_BUFFER -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b ); - - return b; - } -%* -#endif - - -#ifndef YY_NO_SCAN_STRING -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str ) -yyconst char *yy_str; -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len ); - } -%* -#endif - - -#ifndef YY_NO_SCAN_BYTES -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; - } -%* -#endif - - -#ifndef YY_NO_PUSH_STATE -%- -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif -%+ -void yyFlexLexer::yy_push_state( int new_state ) -%* - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -%- -static void yy_pop_state() -%+ -void yyFlexLexer::yy_pop_state() -%* - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -%- -static int yy_top_state() -%+ -int yyFlexLexer::yy_top_state() -%* - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -%- -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } - -%+ - -void yyFlexLexer::LexerError( yyconst char msg[] ) - { -// cerr << msg << '\n'; -// exit( YY_EXIT_FAILURE ); - throw writerfilter::rtftok::RTFParseException("fatal error: %s"/*, msg*/); - } -%* - - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) - - -/* Internal utility routines. */ - -#ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } -#endif - -#ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; - } -#endif - - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { - return (void *) rtl_allocateMemory( size ); - } - -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { - return (void *) rtl_reallocateMemory( (char *) ptr, size ); - } - -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - rtl_freeMemory( ptr ); - } - -#if YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif - diff --git a/writerfilter/source/rtftok/rtfcharsets.cxx b/writerfilter/source/rtftok/rtfcharsets.cxx new file mode 100644 index 000000000000..96f6feb9237e --- /dev/null +++ b/writerfilter/source/rtftok/rtfcharsets.cxx @@ -0,0 +1,75 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Miklos Vajna <vmiklos@frugalware.org> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include <rtftypes.hxx> +#include <sal/macros.h> + +namespace writerfilter { +namespace rtftok { + +// See RTF spec v1.9.1, page 19 +RTFEncoding aRTFEncodings[] = { + // charset codepage Windows / Mac name + {0, 1252}, // ANSI + {1, 0}, // Default + {2, 42}, // Symbol + {77, 10000}, // Mac Roman + {78, 10001}, // Mac Shift Jis + {79, 10003}, // Mac Hangul + {80, 10008}, // Mac GB2312 + {81, 10002}, // Mac Big5 + {83, 10005}, // Mac Herbrew + {84, 10004}, // Mac Arabic + {85, 10006}, // Mac Greek + {86, 10081}, // Mac Turkish + {87, 10021}, // Mac Thai + {88, 10029}, // Mac East Europe + {89, 10007}, // Mac Russian + {128, 932}, // Shift JIS + {129, 949}, // Hangul + {130, 1361}, // Johab + {134, 936}, // GB2312 + {136, 950}, // Big5 + {161, 1253}, // Greek + {162, 1254}, // Turkish + {163, 1258}, // Viatnamese + {177, 1255}, // Herbrew + {178, 1256}, // Arabic + {186, 1257}, // Baltic + {204, 1251}, // Russian + {222, 874}, // Thai + {238, 1250}, // Eastern European + {254, 437}, // PC 437 + {255, 850}, // OEM +}; + +int nRTFEncodings = SAL_N_ELEMENTS(aRTFEncodings); + +} // namespace rtftok +} // namespace writerfilter + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfcontrolwords.cxx b/writerfilter/source/rtftok/rtfcontrolwords.cxx new file mode 100644 index 000000000000..9034f6f4caa3 --- /dev/null +++ b/writerfilter/source/rtftok/rtfcontrolwords.cxx @@ -0,0 +1,1855 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Miklos Vajna <vmiklos@frugalware.org> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include <rtfdocumentimpl.hxx> +#include <rtftypes.hxx> +#include <rtfcontrolwords.hxx> +#include <sal/macros.h> + +namespace writerfilter { +namespace rtftok { + +RTFSymbol aRTFControlWords[] = { + // sKeyword nControlType nIndex + {"'", CONTROL_SYMBOL, RTF_HEXCHAR}, + {"-", CONTROL_SYMBOL, RTF_OPTHYPH}, + {"*", CONTROL_SYMBOL, RTF_IGNORE}, + {":", CONTROL_SYMBOL, RTF_SUBENTRY}, + {"\\", CONTROL_SYMBOL, RTF_BACKSLASH}, + {"_", CONTROL_SYMBOL, RTF_NOBRKHYPH}, + {"{", CONTROL_SYMBOL, RTF_LBRACE}, + {"|", CONTROL_SYMBOL, RTF_FORMULA}, + {"}", CONTROL_SYMBOL, RTF_RBRACE}, + {"~", CONTROL_SYMBOL, RTF_NOBREAK}, + {"ab", CONTROL_TOGGLE, RTF_AB}, + {"absh", CONTROL_VALUE, RTF_ABSH}, + {"abslock", CONTROL_FLAG, RTF_ABSLOCK}, + {"absnoovrlp", CONTROL_TOGGLE, RTF_ABSNOOVRLP}, + {"absw", CONTROL_VALUE, RTF_ABSW}, + {"acaps", CONTROL_TOGGLE, RTF_ACAPS}, + {"acccircle", CONTROL_TOGGLE, RTF_ACCCIRCLE}, + {"acccomma", CONTROL_TOGGLE, RTF_ACCCOMMA}, + {"accdot", CONTROL_TOGGLE, RTF_ACCDOT}, + {"accnone", CONTROL_TOGGLE, RTF_ACCNONE}, + {"accunderdot", CONTROL_TOGGLE, RTF_ACCUNDERDOT}, + {"acf", CONTROL_VALUE, RTF_ACF}, + {"adeff", CONTROL_VALUE, RTF_ADEFF}, + {"additive", CONTROL_FLAG, RTF_ADDITIVE}, + {"adeflang", CONTROL_VALUE, RTF_ADEFLANG}, + {"adjustright", CONTROL_FLAG, RTF_ADJUSTRIGHT}, + {"adn", CONTROL_VALUE, RTF_ADN}, + {"aenddoc", CONTROL_FLAG, RTF_AENDDOC}, + {"aendnotes", CONTROL_FLAG, RTF_AENDNOTES}, + {"aexpnd", CONTROL_VALUE, RTF_AEXPND}, + {"af", CONTROL_VALUE, RTF_AF}, + {"afelev", CONTROL_FLAG, RTF_AFELEV}, + {"afs", CONTROL_VALUE, RTF_AFS}, + {"aftnbj", CONTROL_FLAG, RTF_AFTNBJ}, + {"aftncn", CONTROL_DESTINATION, RTF_AFTNCN}, + {"aftnnalc", CONTROL_FLAG, RTF_AFTNNALC}, + {"aftnnar", CONTROL_FLAG, RTF_AFTNNAR}, + {"aftnnauc", CONTROL_FLAG, RTF_AFTNNAUC}, + {"aftnnchi", CONTROL_FLAG, RTF_AFTNNCHI}, + {"aftnnchosung", CONTROL_FLAG, RTF_AFTNNCHOSUNG}, + {"aftnncnum", CONTROL_FLAG, RTF_AFTNNCNUM}, + {"aftnndbar", CONTROL_FLAG, RTF_AFTNNDBAR}, + {"aftnndbnum", CONTROL_FLAG, RTF_AFTNNDBNUM}, + {"aftnndbnumd", CONTROL_FLAG, RTF_AFTNNDBNUMD}, + {"aftnndbnumk", CONTROL_FLAG, RTF_AFTNNDBNUMK}, + {"aftnndbnumt", CONTROL_FLAG, RTF_AFTNNDBNUMT}, + {"aftnnganada", CONTROL_FLAG, RTF_AFTNNGANADA}, + {"aftnngbnum", CONTROL_FLAG, RTF_AFTNNGBNUM}, + {"aftnngbnumd", CONTROL_FLAG, RTF_AFTNNGBNUMD}, + {"aftnngbnumk", CONTROL_FLAG, RTF_AFTNNGBNUMK}, + {"aftnngbnuml", CONTROL_FLAG, RTF_AFTNNGBNUML}, + {"aftnnrlc", CONTROL_FLAG, RTF_AFTNNRLC}, + {"aftnnruc", CONTROL_FLAG, RTF_AFTNNRUC}, + {"aftnnzodiac", CONTROL_FLAG, RTF_AFTNNZODIAC}, + {"aftnnzodiacd", CONTROL_FLAG, RTF_AFTNNZODIACD}, + {"aftnnzodiacl", CONTROL_FLAG, RTF_AFTNNZODIACL}, + {"aftnrestart", CONTROL_FLAG, RTF_AFTNRESTART}, + {"aftnrstcont", CONTROL_FLAG, RTF_AFTNRSTCONT}, + {"aftnsep", CONTROL_DESTINATION, RTF_AFTNSEP}, + {"aftnsepc", CONTROL_DESTINATION, RTF_AFTNSEPC}, + {"aftnstart", CONTROL_VALUE, RTF_AFTNSTART}, + {"aftntj", CONTROL_FLAG, RTF_AFTNTJ}, + {"ai", CONTROL_TOGGLE, RTF_AI}, + {"alang", CONTROL_VALUE, RTF_ALANG}, + {"allowfieldendsel", CONTROL_FLAG, RTF_ALLOWFIELDENDSEL}, + {"allprot", CONTROL_FLAG, RTF_ALLPROT}, + {"alntblind", CONTROL_FLAG, RTF_ALNTBLIND}, + {"alt", CONTROL_FLAG, RTF_ALT}, + {"animtext", CONTROL_VALUE, RTF_ANIMTEXT}, + {"annotation", CONTROL_DESTINATION, RTF_ANNOTATION}, + {"annotprot", CONTROL_FLAG, RTF_ANNOTPROT}, + {"ansi", CONTROL_FLAG, RTF_ANSI}, + {"ansicpg", CONTROL_VALUE, RTF_ANSICPG}, + {"aoutl", CONTROL_TOGGLE, RTF_AOUTL}, + {"ApplyBrkRules", CONTROL_FLAG, RTF_APPLYBRKRULES}, + {"ascaps", CONTROL_TOGGLE, RTF_ASCAPS}, + {"ashad", CONTROL_TOGGLE, RTF_ASHAD}, + {"asianbrkrule", CONTROL_FLAG, RTF_ASIANBRKRULE}, + {"aspalpha", CONTROL_TOGGLE, RTF_ASPALPHA}, + {"aspnum", CONTROL_TOGGLE, RTF_ASPNUM}, + {"astrike", CONTROL_TOGGLE, RTF_ASTRIKE}, + {"atnauthor", CONTROL_DESTINATION, RTF_ATNAUTHOR}, + {"atndate", CONTROL_DESTINATION, RTF_ATNDATE}, + {"atnicn", CONTROL_DESTINATION, RTF_ATNICN}, + {"atnid", CONTROL_DESTINATION, RTF_ATNID}, + {"atnparent", CONTROL_DESTINATION, RTF_ATNPARENT}, + {"atnref", CONTROL_DESTINATION, RTF_ATNREF}, + {"atntime", CONTROL_DESTINATION, RTF_ATNTIME}, + {"atrfend", CONTROL_DESTINATION, RTF_ATRFEND}, + {"atrfstart", CONTROL_DESTINATION, RTF_ATRFSTART}, + {"aul", CONTROL_TOGGLE, RTF_AUL}, + {"auld", CONTROL_TOGGLE, RTF_AULD}, + {"auldb", CONTROL_TOGGLE, RTF_AULDB}, + {"aulnone", CONTROL_TOGGLE, RTF_AULNONE}, + {"aulw", CONTROL_TOGGLE, RTF_AULW}, + {"aup", CONTROL_VALUE, RTF_AUP}, + {"author", CONTROL_DESTINATION, RTF_AUTHOR}, + {"autofmtoverride", CONTROL_FLAG, RTF_AUTOFMTOVERRIDE}, + {"b", CONTROL_TOGGLE, RTF_B}, + {"background", CONTROL_DESTINATION, RTF_BACKGROUND}, + {"bdbfhdr", CONTROL_FLAG, RTF_BDBFHDR}, + {"bdrrlswsix", CONTROL_FLAG, RTF_BDRRLSWSIX}, + {"bgbdiag", CONTROL_FLAG, RTF_BGBDIAG}, + {"bgcross", CONTROL_FLAG, RTF_BGCROSS}, + {"bgdcross", CONTROL_FLAG, RTF_BGDCROSS}, + {"bgdkbdiag", CONTROL_FLAG, RTF_BGDKBDIAG}, + {"bgdkcross", CONTROL_FLAG, RTF_BGDKCROSS}, + {"bgdkdcross", CONTROL_FLAG, RTF_BGDKDCROSS}, + {"bgdkfdiag", CONTROL_FLAG, RTF_BGDKFDIAG}, + {"bgdkhoriz", CONTROL_FLAG, RTF_BGDKHORIZ}, + {"bgdkvert", CONTROL_FLAG, RTF_BGDKVERT}, + {"bgfdiag", CONTROL_FLAG, RTF_BGFDIAG}, + {"bghoriz", CONTROL_FLAG, RTF_BGHORIZ}, + {"bgvert", CONTROL_FLAG, RTF_BGVERT}, + {"bin", CONTROL_VALUE, RTF_BIN}, + {"binfsxn", CONTROL_VALUE, RTF_BINFSXN}, + {"binsxn", CONTROL_VALUE, RTF_BINSXN}, + {"bkmkcolf", CONTROL_VALUE, RTF_BKMKCOLF}, + {"bkmkcoll", CONTROL_VALUE, RTF_BKMKCOLL}, + {"bkmkend", CONTROL_DESTINATION, RTF_BKMKEND}, + {"bkmkpub", CONTROL_FLAG, RTF_BKMKPUB}, + {"bkmkstart", CONTROL_DESTINATION, RTF_BKMKSTART}, + {"bliptag", CONTROL_VALUE, RTF_BLIPTAG}, + {"blipuid", CONTROL_DESTINATION, RTF_BLIPUID}, + {"blipupi", CONTROL_VALUE, RTF_BLIPUPI}, + {"blue", CONTROL_VALUE, RTF_BLUE}, + {"bookfold", CONTROL_FLAG, RTF_BOOKFOLD}, + {"bookfoldrev", CONTROL_FLAG, RTF_BOOKFOLDREV}, + {"bookfoldsheets", CONTROL_VALUE, RTF_BOOKFOLDSHEETS}, + {"box", CONTROL_FLAG, RTF_BOX}, + {"brdrart", CONTROL_VALUE, RTF_BRDRART}, + {"brdrb", CONTROL_FLAG, RTF_BRDRB}, + {"brdrbar", CONTROL_FLAG, RTF_BRDRBAR}, + {"brdrbtw", CONTROL_FLAG, RTF_BRDRBTW}, + {"brdrcf", CONTROL_VALUE, RTF_BRDRCF}, + {"brdrdash", CONTROL_FLAG, RTF_BRDRDASH}, + {"brdrdashd", CONTROL_FLAG, RTF_BRDRDASHD}, + {"brdrdashdd", CONTROL_FLAG, RTF_BRDRDASHDD}, + {"brdrdashdot", CONTROL_FLAG, RTF_BRDRDASHDOT}, + {"brdrdashdotdot", CONTROL_FLAG, RTF_BRDRDASHDOTDOT}, + {"brdrdashdotstr", CONTROL_FLAG, RTF_BRDRDASHDOTSTR}, + {"brdrdashsm", CONTROL_FLAG, RTF_BRDRDASHSM}, + {"brdrdb", CONTROL_FLAG, RTF_BRDRDB}, + {"brdrdot", CONTROL_FLAG, RTF_BRDRDOT}, + {"brdremboss", CONTROL_FLAG, RTF_BRDREMBOSS}, + {"brdrengrave", CONTROL_FLAG, RTF_BRDRENGRAVE}, + {"brdrframe", CONTROL_FLAG, RTF_BRDRFRAME}, + {"brdrhair", CONTROL_FLAG, RTF_BRDRHAIR}, + {"brdrinset", CONTROL_FLAG, RTF_BRDRINSET}, + {"brdrl", CONTROL_FLAG, RTF_BRDRL}, + {"brdrnil", CONTROL_FLAG, RTF_BRDRNIL}, + {"brdrnone", CONTROL_FLAG, RTF_BRDRNONE}, + {"brdroutset", CONTROL_FLAG, RTF_BRDROUTSET}, + {"brdrr", CONTROL_FLAG, RTF_BRDRR}, + {"brdrs", CONTROL_FLAG, RTF_BRDRS}, + {"brdrsh", CONTROL_FLAG, RTF_BRDRSH}, + {"brdrt", CONTROL_FLAG, RTF_BRDRT}, + {"brdrtbl", CONTROL_FLAG, RTF_BRDRTBL}, + {"brdrth", CONTROL_FLAG, RTF_BRDRTH}, + {"brdrthtnlg", CONTROL_FLAG, RTF_BRDRTHTNLG}, + {"brdrthtnmg", CONTROL_FLAG, RTF_BRDRTHTNMG}, + {"brdrthtnsg", CONTROL_FLAG, RTF_BRDRTHTNSG}, + {"brdrtnthlg", CONTROL_FLAG, RTF_BRDRTNTHLG}, + {"brdrtnthmg", CONTROL_FLAG, RTF_BRDRTNTHMG}, + {"brdrtnthsg", CONTROL_FLAG, RTF_BRDRTNTHSG}, + {"brdrtnthtnlg", CONTROL_FLAG, RTF_BRDRTNTHTNLG}, + {"brdrtnthtnmg", CONTROL_FLAG, RTF_BRDRTNTHTNMG}, + {"brdrtnthtnsg", CONTROL_FLAG, RTF_BRDRTNTHTNSG}, + {"brdrtriple", CONTROL_FLAG, RTF_BRDRTRIPLE}, + {"brdrw", CONTROL_VALUE, RTF_BRDRW}, + {"brdrwavy", CONTROL_FLAG, RTF_BRDRWAVY}, + {"brdrwavydb", CONTROL_FLAG, RTF_BRDRWAVYDB}, + {"brkfrm", CONTROL_FLAG, RTF_BRKFRM}, + {"brsp", CONTROL_VALUE, RTF_BRSP}, + {"bullet", CONTROL_SYMBOL, RTF_BULLET}, + {"buptim", CONTROL_DESTINATION, RTF_BUPTIM}, + {"bxe", CONTROL_FLAG, RTF_BXE}, + {"caccentfive", CONTROL_FLAG, RTF_CACCENTFIVE}, + {"caccentfour", CONTROL_FLAG, RTF_CACCENTFOUR}, + {"caccentone", CONTROL_FLAG, RTF_CACCENTONE}, + {"caccentsix", CONTROL_FLAG, RTF_CACCENTSIX}, + {"caccentthree", CONTROL_FLAG, RTF_CACCENTTHREE}, + {"caccenttwo", CONTROL_FLAG, RTF_CACCENTTWO}, + {"cachedcolbal", CONTROL_FLAG, RTF_CACHEDCOLBAL}, + {"caps", CONTROL_TOGGLE, RTF_CAPS}, + {"category", CONTROL_DESTINATION, RTF_CATEGORY}, + {"cb", CONTROL_VALUE, RTF_CB}, + {"cbackgroundone", CONTROL_FLAG, RTF_CBACKGROUNDONE}, + {"cbackgroundtwo", CONTROL_FLAG, RTF_CBACKGROUNDTWO}, + {"cbpat", CONTROL_VALUE, RTF_CBPAT}, + {"cchs", CONTROL_VALUE, RTF_CCHS}, + {"cell", CONTROL_SYMBOL, RTF_CELL}, + {"cellx", CONTROL_VALUE, RTF_CELLX}, + {"cf", CONTROL_VALUE, RTF_CF}, + {"cfollowedhyperlink", CONTROL_FLAG, RTF_CFOLLOWEDHYPERLINK}, + {"cfpat", CONTROL_VALUE, RTF_CFPAT}, + {"cgrid", CONTROL_VALUE, RTF_CGRID}, + {"charrsid", CONTROL_VALUE, RTF_CHARRSID}, + {"charscalex", CONTROL_VALUE, RTF_CHARSCALEX}, + {"chatn", CONTROL_SYMBOL, RTF_CHATN}, + {"chbgbdiag", CONTROL_FLAG, RTF_CHBGBDIAG}, + {"chbgcross", CONTROL_FLAG, RTF_CHBGCROSS}, + {"chbgdcross", CONTROL_FLAG, RTF_CHBGDCROSS}, + {"chbgdkbdiag", CONTROL_FLAG, RTF_CHBGDKBDIAG}, + {"chbgdkcross", CONTROL_FLAG, RTF_CHBGDKCROSS}, + {"chbgdkdcross", CONTROL_FLAG, RTF_CHBGDKDCROSS}, + {"chbgdkfdiag", CONTROL_FLAG, RTF_CHBGDKFDIAG}, + {"chbgdkhoriz", CONTROL_FLAG, RTF_CHBGDKHORIZ}, + {"chbgdkvert", CONTROL_FLAG, RTF_CHBGDKVERT}, + {"chbgfdiag", CONTROL_FLAG, RTF_CHBGFDIAG}, + {"chbghoriz", CONTROL_FLAG, RTF_CHBGHORIZ}, + {"chbgvert", CONTROL_FLAG, RTF_CHBGVERT}, + {"chbrdr", CONTROL_FLAG, RTF_CHBRDR}, + {"chcbpat", CONTROL_VALUE, RTF_CHCBPAT}, + {"chcfpat", CONTROL_VALUE, RTF_CHCFPAT}, + {"chdate", CONTROL_SYMBOL, RTF_CHDATE}, + {"chdpa", CONTROL_SYMBOL, RTF_CHDPA}, + {"chdpl", CONTROL_SYMBOL, RTF_CHDPL}, + {"chftn", CONTROL_SYMBOL, RTF_CHFTN}, + {"chftnsep", CONTROL_SYMBOL, RTF_CHFTNSEP}, + {"chftnsepc", CONTROL_SYMBOL, RTF_CHFTNSEPC}, + {"chpgn", CONTROL_SYMBOL, RTF_CHPGN}, + {"chhres", CONTROL_VALUE, RTF_CHHRES}, + {"chshdng", CONTROL_VALUE, RTF_CHSHDNG}, + {"chtime", CONTROL_SYMBOL, RTF_CHTIME}, + {"chyperlink", CONTROL_FLAG, RTF_CHYPERLINK}, + {"clbgbdiag", CONTROL_FLAG, RTF_CLBGBDIAG}, + {"clbgcross", CONTROL_FLAG, RTF_CLBGCROSS}, + {"clbgdcross", CONTROL_FLAG, RTF_CLBGDCROSS}, + {"clbgdkbdiag", CONTROL_FLAG, RTF_CLBGDKBDIAG}, + {"clbgdkcross", CONTROL_FLAG, RTF_CLBGDKCROSS}, + {"clbgdkdcross", CONTROL_FLAG, RTF_CLBGDKDCROSS}, + {"clbgdkfdiag", CONTROL_FLAG, RTF_CLBGDKFDIAG}, + {"clbgdkhor", CONTROL_FLAG, RTF_CLBGDKHOR}, + {"clbgdkvert", CONTROL_FLAG, RTF_CLBGDKVERT}, + {"clbgfdiag", CONTROL_FLAG, RTF_CLBGFDIAG}, + {"clbghoriz", CONTROL_FLAG, RTF_CLBGHORIZ}, + {"clbgvert", CONTROL_FLAG, RTF_CLBGVERT}, + {"clbrdrb", CONTROL_FLAG, RTF_CLBRDRB}, + {"clbrdrl", CONTROL_FLAG, RTF_CLBRDRL}, + {"clbrdrr", CONTROL_FLAG, RTF_CLBRDRR}, + {"clbrdrt", CONTROL_FLAG, RTF_CLBRDRT}, + {"clcbpat", CONTROL_VALUE, RTF_CLCBPAT}, + {"clcbpatraw", CONTROL_VALUE, RTF_CLCBPATRAW}, + {"clcfpat", CONTROL_VALUE, RTF_CLCFPAT}, + {"clcfpatraw", CONTROL_VALUE, RTF_CLCFPATRAW}, + {"cldel", CONTROL_FLAG, RTF_CLDEL}, + {"cldelauth", CONTROL_VALUE, RTF_CLDELAUTH}, + {"cldeldttm", CONTROL_VALUE, RTF_CLDELDTTM}, + {"cldgll", CONTROL_FLAG, RTF_CLDGLL}, + {"cldglu", CONTROL_FLAG, RTF_CLDGLU}, + {"clFitText", CONTROL_FLAG, RTF_CLFITTEXT}, + {"clftsWidth", CONTROL_VALUE, RTF_CLFTSWIDTH}, + {"clhidemark", CONTROL_FLAG, RTF_CLHIDEMARK}, + {"clins", CONTROL_FLAG, RTF_CLINS}, + {"clinsauth", CONTROL_VALUE, RTF_CLINSAUTH}, + {"clinsdttm", CONTROL_VALUE, RTF_CLINSDTTM}, + {"clmgf", CONTROL_FLAG, RTF_CLMGF}, + {"clmrg", CONTROL_FLAG, RTF_CLMRG}, + {"clmrgd", CONTROL_FLAG, RTF_CLMRGD}, + {"clmrgdauth", CONTROL_VALUE, RTF_CLMRGDAUTH}, + {"clmrgddttm", CONTROL_VALUE, RTF_CLMRGDDTTM}, + {"clmrgdr", CONTROL_FLAG, RTF_CLMRGDR}, + {"clNoWrap", CONTROL_FLAG, RTF_CLNOWRAP}, + {"clpadb", CONTROL_VALUE, RTF_CLPADB}, + {"clpadfb", CONTROL_VALUE, RTF_CLPADFB}, + {"clpadfl", CONTROL_VALUE, RTF_CLPADFL}, + {"clpadfr", CONTROL_VALUE, RTF_CLPADFR}, + {"clpadft", CONTROL_VALUE, RTF_CLPADFT}, + {"clpadl", CONTROL_VALUE, RTF_CLPADL}, + {"clpadr", CONTROL_VALUE, RTF_CLPADR}, + {"clpadt", CONTROL_VALUE, RTF_CLPADT}, + {"clspb", CONTROL_VALUE, RTF_CLSPB}, + {"clspfb", CONTROL_VALUE, RTF_CLSPFB}, + {"clspfl", CONTROL_VALUE, RTF_CLSPFL}, + {"clspfr", CONTROL_VALUE, RTF_CLSPFR}, + {"clspft", CONTROL_VALUE, RTF_CLSPFT}, + {"clspl", CONTROL_VALUE, RTF_CLSPL}, + {"clspr", CONTROL_VALUE, RTF_CLSPR}, + {"clspt", CONTROL_VALUE, RTF_CLSPT}, + {"clshdng", CONTROL_VALUE, RTF_CLSHDNG}, + {"clshdngraw", CONTROL_VALUE, RTF_CLSHDNGRAW}, + {"clshdrawnil", CONTROL_FLAG, RTF_CLSHDRAWNIL}, + {"clsplit", CONTROL_FLAG, RTF_CLSPLIT}, + {"clsplitr", CONTROL_FLAG, RTF_CLSPLITR}, + {"cltxbtlr", CONTROL_FLAG, RTF_CLTXBTLR}, + {"cltxlrtb", CONTROL_FLAG, RTF_CLTXLRTB}, + {"cltxlrtbv", CONTROL_FLAG, RTF_CLTXLRTBV}, + {"cltxtbrl", CONTROL_FLAG, RTF_CLTXTBRL}, + {"cltxtbrlv", CONTROL_FLAG, RTF_CLTXTBRLV}, + {"clvertalb", CONTROL_FLAG, RTF_CLVERTALB}, + {"clvertalc", CONTROL_FLAG, RTF_CLVERTALC}, + {"clvertalt", CONTROL_FLAG, RTF_CLVERTALT}, + {"clvmgf", CONTROL_FLAG, RTF_CLVMGF}, + {"clvmrg", CONTROL_FLAG, RTF_CLVMRG}, + {"clwWidth", CONTROL_VALUE, RTF_CLWWIDTH}, + {"cmaindarkone", CONTROL_FLAG, RTF_CMAINDARKONE}, + {"cmaindarktwo", CONTROL_FLAG, RTF_CMAINDARKTWO}, + {"cmainlightone", CONTROL_FLAG, RTF_CMAINLIGHTONE}, + {"cmainlighttwo", CONTROL_FLAG, RTF_CMAINLIGHTTWO}, + {"collapsed", CONTROL_FLAG, RTF_COLLAPSED}, + {"colno", CONTROL_VALUE, RTF_COLNO}, + {"colorschememapping", CONTROL_DESTINATION, RTF_COLORSCHEMEMAPPING}, + {"colortbl", CONTROL_DESTINATION, RTF_COLORTBL}, + {"cols", CONTROL_VALUE, RTF_COLS}, + {"colsr", CONTROL_VALUE, RTF_COLSR}, + {"colsx", CONTROL_VALUE, RTF_COLSX}, + {"column", CONTROL_SYMBOL, RTF_COLUMN}, + {"colw", CONTROL_VALUE, RTF_COLW}, + {"comment", CONTROL_DESTINATION, RTF_COMMENT}, + {"company", CONTROL_DESTINATION, RTF_COMPANY}, + {"contextualspace", CONTROL_FLAG, RTF_CONTEXTUALSPACE}, + {"cpg", CONTROL_VALUE, RTF_CPG}, + {"crauth", CONTROL_VALUE, RTF_CRAUTH}, + {"crdate", CONTROL_VALUE, RTF_CRDATE}, + {"creatim", CONTROL_DESTINATION, RTF_CREATIM}, + {"cs", CONTROL_VALUE, RTF_CS}, + {"cshade", CONTROL_VALUE, RTF_CSHADE}, + {"ctextone", CONTROL_FLAG, RTF_CTEXTONE}, + {"ctexttwo", CONTROL_FLAG, RTF_CTEXTTWO}, + {"ctint", CONTROL_VALUE, RTF_CTINT}, + {"ctrl", CONTROL_FLAG, RTF_CTRL}, + {"cts", CONTROL_VALUE, RTF_CTS}, + {"cufi", CONTROL_VALUE, RTF_CUFI}, + {"culi", CONTROL_VALUE, RTF_CULI}, + {"curi", CONTROL_VALUE, RTF_CURI}, + {"cvmme", CONTROL_FLAG, RTF_CVMME}, + {"datafield", CONTROL_DESTINATION, RTF_DATAFIELD}, + {"datastore", CONTROL_DESTINATION, RTF_DATASTORE}, + {"date", CONTROL_FLAG, RTF_DATE}, + {"dbch", CONTROL_FLAG, RTF_DBCH}, + {"defchp", CONTROL_DESTINATION, RTF_DEFCHP}, + {"deff", CONTROL_VALUE, RTF_DEFF}, + {"defformat", CONTROL_FLAG, RTF_DEFFORMAT}, + {"deflang", CONTROL_VALUE, RTF_DEFLANG}, + {"deflangfe", CONTROL_VALUE, RTF_DEFLANGFE}, + {"defpap", CONTROL_DESTINATION, RTF_DEFPAP}, + {"defshp", CONTROL_FLAG, RTF_DEFSHP}, + {"deftab", CONTROL_VALUE, RTF_DEFTAB}, + {"deleted", CONTROL_TOGGLE, RTF_DELETED}, + {"delrsid", CONTROL_VALUE, RTF_DELRSID}, + {"dfrauth", CONTROL_VALUE, RTF_DFRAUTH}, + {"dfrdate", CONTROL_VALUE, RTF_DFRDATE}, + {"dfrmtxtx", CONTROL_VALUE, RTF_DFRMTXTX}, + {"dfrmtxty", CONTROL_VALUE, RTF_DFRMTXTY}, + {"dfrstart", CONTROL_VALUE, RTF_DFRSTART}, + {"dfrstop", CONTROL_VALUE, RTF_DFRSTOP}, + {"dfrxst", CONTROL_VALUE, RTF_DFRXST}, + {"dghorigin", CONTROL_VALUE, RTF_DGHORIGIN}, + {"dghshow", CONTROL_VALUE, RTF_DGHSHOW}, + {"dghspace", CONTROL_VALUE, RTF_DGHSPACE}, + {"dgmargin", CONTROL_FLAG, RTF_DGMARGIN}, + {"dgsnap", CONTROL_FLAG, RTF_DGSNAP}, + {"dgvorigin", CONTROL_VALUE, RTF_DGVORIGIN}, + {"dgvshow", CONTROL_VALUE, RTF_DGVSHOW}, + {"dgvspace", CONTROL_VALUE, RTF_DGVSPACE}, + {"dibitmap", CONTROL_VALUE, RTF_DIBITMAP}, + {"disabled", CONTROL_TOGGLE, RTF_DISABLED}, + {"dn", CONTROL_VALUE, RTF_DN}, + {"dntblnsbdb", CONTROL_FLAG, RTF_DNTBLNSBDB}, + {"do", CONTROL_DESTINATION, RTF_DO}, + {"dobxcolumn", CONTROL_FLAG, RTF_DOBXCOLUMN}, + {"dobxmargin", CONTROL_FLAG, RTF_DOBXMARGIN}, + {"dobxpage", CONTROL_FLAG, RTF_DOBXPAGE}, + {"dobymargin", CONTROL_FLAG, RTF_DOBYMARGIN}, + {"dobypage", CONTROL_FLAG, RTF_DOBYPAGE}, + {"dobypara", CONTROL_FLAG, RTF_DOBYPARA}, + {"doccomm", CONTROL_DESTINATION, RTF_DOCCOMM}, + {"doctemp", CONTROL_FLAG, RTF_DOCTEMP}, + {"doctype", CONTROL_VALUE, RTF_DOCTYPE}, + {"docvar", CONTROL_DESTINATION, RTF_DOCVAR}, + {"dodhgt", CONTROL_VALUE, RTF_DODHGT}, + {"dolock", CONTROL_FLAG, RTF_DOLOCK}, + {"donotembedlingdata", CONTROL_VALUE, RTF_DONOTEMBEDLINGDATA}, + {"donotembedsysfont", CONTROL_VALUE, RTF_DONOTEMBEDSYSFONT}, + {"donotshowcomments", CONTROL_FLAG, RTF_DONOTSHOWCOMMENTS}, + {"donotshowinsdel", CONTROL_FLAG, RTF_DONOTSHOWINSDEL}, + {"donotshowmarkup", CONTROL_FLAG, RTF_DONOTSHOWMARKUP}, + {"donotshowprops", CONTROL_FLAG, RTF_DONOTSHOWPROPS}, + {"dpaendhol", CONTROL_FLAG, RTF_DPAENDHOL}, + {"dpaendl", CONTROL_VALUE, RTF_DPAENDL}, + {"dpaendsol", CONTROL_FLAG, RTF_DPAENDSOL}, + {"dpaendw", CONTROL_VALUE, RTF_DPAENDW}, + {"dparc", CONTROL_FLAG, RTF_DPARC}, + {"dparcflipx", CONTROL_FLAG, RTF_DPARCFLIPX}, + {"dparcflipy", CONTROL_FLAG, RTF_DPARCFLIPY}, + {"dpastarthol", CONTROL_FLAG, RTF_DPASTARTHOL}, + {"dpastartl", CONTROL_VALUE, RTF_DPASTARTL}, + {"dpastartsol", CONTROL_FLAG, RTF_DPASTARTSOL}, + {"dpastartw", CONTROL_VALUE, RTF_DPASTARTW}, + {"dpcallout", CONTROL_FLAG, RTF_DPCALLOUT}, + {"dpcoa", CONTROL_VALUE, RTF_DPCOA}, + {"dpcoaccent", CONTROL_FLAG, RTF_DPCOACCENT}, + {"dpcobestfit", CONTROL_FLAG, RTF_DPCOBESTFIT}, + {"dpcoborder", CONTROL_FLAG, RTF_DPCOBORDER}, + {"dpcodabs", CONTROL_FLAG, RTF_DPCODABS}, + {"dpcodbottom", CONTROL_FLAG, RTF_DPCODBOTTOM}, + {"dpcodcenter", CONTROL_FLAG, RTF_DPCODCENTER}, + {"dpcodescent", CONTROL_VALUE, RTF_DPCODESCENT}, + {"dpcodtop", CONTROL_FLAG, RTF_DPCODTOP}, + {"dpcolength", CONTROL_VALUE, RTF_DPCOLENGTH}, + {"dpcominusx", CONTROL_FLAG, RTF_DPCOMINUSX}, + {"dpcominusy", CONTROL_FLAG, RTF_DPCOMINUSY}, + {"dpcooffset", CONTROL_VALUE, RTF_DPCOOFFSET}, + {"dpcosmarta", CONTROL_FLAG, RTF_DPCOSMARTA}, + {"dpcotdouble", CONTROL_FLAG, RTF_DPCOTDOUBLE}, + {"dpcotright", CONTROL_FLAG, RTF_DPCOTRIGHT}, + {"dpcotsingle", CONTROL_FLAG, RTF_DPCOTSINGLE}, + {"dpcottriple", CONTROL_FLAG, RTF_DPCOTTRIPLE}, + {"dpcount", CONTROL_VALUE, RTF_DPCOUNT}, + {"dpellipse", CONTROL_FLAG, RTF_DPELLIPSE}, + {"dpendgroup", CONTROL_FLAG, RTF_DPENDGROUP}, + {"dpfillbgcb", CONTROL_VALUE, RTF_DPFILLBGCB}, + {"dpfillbgcg", CONTROL_VALUE, RTF_DPFILLBGCG}, + {"dpfillbgcr", CONTROL_VALUE, RTF_DPFILLBGCR}, + {"dpfillbggray", CONTROL_VALUE, RTF_DPFILLBGGRAY}, + {"dpfillbgpal", CONTROL_FLAG, RTF_DPFILLBGPAL}, + {"dpfillfgcb", CONTROL_VALUE, RTF_DPFILLFGCB}, + {"dpfillfgcg", CONTROL_VALUE, RTF_DPFILLFGCG}, + {"dpfillfgcr", CONTROL_VALUE, RTF_DPFILLFGCR}, + {"dpfillfggray", CONTROL_VALUE, RTF_DPFILLFGGRAY}, + {"dpfillfgpal", CONTROL_FLAG, RTF_DPFILLFGPAL}, + {"dpfillpat", CONTROL_VALUE, RTF_DPFILLPAT}, + {"dpgroup", CONTROL_FLAG, RTF_DPGROUP}, + {"dpline", CONTROL_FLAG, RTF_DPLINE}, + {"dplinecob", CONTROL_VALUE, RTF_DPLINECOB}, + {"dplinecog", CONTROL_VALUE, RTF_DPLINECOG}, + {"dplinecor", CONTROL_VALUE, RTF_DPLINECOR}, + {"dplinedado", CONTROL_FLAG, RTF_DPLINEDADO}, + {"dplinedadodo", CONTROL_FLAG, RTF_DPLINEDADODO}, + {"dplinedash", CONTROL_FLAG, RTF_DPLINEDASH}, + {"dplinedot", CONTROL_FLAG, RTF_DPLINEDOT}, + {"dplinegray", CONTROL_VALUE, RTF_DPLINEGRAY}, + {"dplinehollow", CONTROL_FLAG, RTF_DPLINEHOLLOW}, + {"dplinepal", CONTROL_FLAG, RTF_DPLINEPAL}, + {"dplinesolid", CONTROL_FLAG, RTF_DPLINESOLID}, + {"dplinew", CONTROL_VALUE, RTF_DPLINEW}, + {"dppolycount", CONTROL_VALUE, RTF_DPPOLYCOUNT}, + {"dppolygon", CONTROL_FLAG, RTF_DPPOLYGON}, + {"dppolyline", CONTROL_FLAG, RTF_DPPOLYLINE}, + {"dpptx", CONTROL_VALUE, RTF_DPPTX}, + {"dppty", CONTROL_VALUE, RTF_DPPTY}, + {"dprect", CONTROL_FLAG, RTF_DPRECT}, + {"dproundr", CONTROL_FLAG, RTF_DPROUNDR}, + {"dpshadow", CONTROL_FLAG, RTF_DPSHADOW}, + {"dpshadx", CONTROL_VALUE, RTF_DPSHADX}, + {"dpshady", CONTROL_VALUE, RTF_DPSHADY}, + {"dptxbtlr", CONTROL_FLAG, RTF_DPTXBTLR}, + {"dptxbx", CONTROL_FLAG, RTF_DPTXBX}, + {"dptxbxmar", CONTROL_VALUE, RTF_DPTXBXMAR}, + {"dptxbxtext", CONTROL_DESTINATION, RTF_DPTXBXTEXT}, + {"dptxlrtb", CONTROL_FLAG, RTF_DPTXLRTB}, + {"dptxlrtbv", CONTROL_FLAG, RTF_DPTXLRTBV}, + {"dptxtbrl", CONTROL_FLAG, RTF_DPTXTBRL}, + {"dptxtbrlv", CONTROL_FLAG, RTF_DPTXTBRLV}, + {"dpx", CONTROL_VALUE, RTF_DPX}, + {"dpxsize", CONTROL_VALUE, RTF_DPXSIZE}, + {"dpy", CONTROL_VALUE, RTF_DPY}, + {"dpysize", CONTROL_VALUE, RTF_DPYSIZE}, + {"dropcapli", CONTROL_VALUE, RTF_DROPCAPLI}, + {"dropcapt", CONTROL_VALUE, RTF_DROPCAPT}, + {"ds", CONTROL_VALUE, RTF_DS}, + {"dxfrtext", CONTROL_VALUE, RTF_DXFRTEXT}, + {"dy", CONTROL_VALUE, RTF_DY}, + {"ebcend", CONTROL_DESTINATION, RTF_EBCEND}, + {"ebcstart", CONTROL_DESTINATION, RTF_EBCSTART}, + {"edmins", CONTROL_VALUE, RTF_EDMINS}, + {"embo", CONTROL_TOGGLE, RTF_EMBO}, + {"emdash", CONTROL_SYMBOL, RTF_EMDASH}, + {"emfblip", CONTROL_FLAG, RTF_EMFBLIP}, + {"emspace", CONTROL_SYMBOL, RTF_EMSPACE}, + {"endash", CONTROL_SYMBOL, RTF_ENDASH}, + {"enddoc", CONTROL_FLAG, RTF_ENDDOC}, + {"endnhere", CONTROL_FLAG, RTF_ENDNHERE}, + {"endnotes", CONTROL_FLAG, RTF_ENDNOTES}, + {"enforceprot", CONTROL_VALUE, RTF_ENFORCEPROT}, + {"enspace", CONTROL_SYMBOL, RTF_ENSPACE}, + {"expnd", CONTROL_VALUE, RTF_EXPND}, + {"expndtw", CONTROL_VALUE, RTF_EXPNDTW}, + {"expshrtn", CONTROL_FLAG, RTF_EXPSHRTN}, + {"f", CONTROL_VALUE, RTF_F}, + {"faauto", CONTROL_FLAG, RTF_FAAUTO}, + {"facenter", CONTROL_FLAG, RTF_FACENTER}, + {"facingp", CONTROL_FLAG, RTF_FACINGP}, + {"factoidname", CONTROL_DESTINATION, RTF_FACTOIDNAME}, + {"fafixed", CONTROL_FLAG, RTF_FAFIXED}, + {"fahang", CONTROL_FLAG, RTF_FAHANG}, + {"falt", CONTROL_DESTINATION, RTF_FALT}, + {"faroman", CONTROL_FLAG, RTF_FAROMAN}, + {"favar", CONTROL_FLAG, RTF_FAVAR}, + {"fbias", CONTROL_VALUE, RTF_FBIAS}, + {"fbidi", CONTROL_FLAG, RTF_FBIDI}, + {"fbidis", CONTROL_FLAG, RTF_FBIDIS}, + {"fbimajor", CONTROL_FLAG, RTF_FBIMAJOR}, + {"fbiminor", CONTROL_FLAG, RTF_FBIMINOR}, + {"fchars", CONTROL_DESTINATION, RTF_FCHARS}, + {"fcharset", CONTROL_VALUE, RTF_FCHARSET}, + {"fcs", CONTROL_VALUE, RTF_FCS}, + {"fdbmajor", CONTROL_FLAG, RTF_FDBMAJOR}, + {"fdbminor", CONTROL_FLAG, RTF_FDBMINOR}, + {"fdecor", CONTROL_FLAG, RTF_FDECOR}, + {"felnbrelev", CONTROL_FLAG, RTF_FELNBRELEV}, + {"fet", CONTROL_VALUE, RTF_FET}, + {"fetch", CONTROL_FLAG, RTF_FETCH}, + {"ffdefres", CONTROL_VALUE, RTF_FFDEFRES}, + {"ffdeftext", CONTROL_DESTINATION, RTF_FFDEFTEXT}, + {"ffentrymcr", CONTROL_DESTINATION, RTF_FFENTRYMCR}, + {"ffexitmcr", CONTROL_DESTINATION, RTF_FFEXITMCR}, + {"ffformat", CONTROL_DESTINATION, RTF_FFFORMAT}, + {"ffhaslistbox", CONTROL_VALUE, RTF_FFHASLISTBOX}, + {"ffhelptext", CONTROL_DESTINATION, RTF_FFHELPTEXT}, + {"ffhps", CONTROL_VALUE, RTF_FFHPS}, + {"ffl", CONTROL_DESTINATION, RTF_FFL}, + {"ffmaxlen", CONTROL_VALUE, RTF_FFMAXLEN}, + {"ffname", CONTROL_DESTINATION, RTF_FFNAME}, + {"ffownhelp", CONTROL_VALUE, RTF_FFOWNHELP}, + {"ffownstat", CONTROL_VALUE, RTF_FFOWNSTAT}, + {"ffprot", CONTROL_VALUE, RTF_FFPROT}, + {"ffrecalc", CONTROL_VALUE, RTF_FFRECALC}, + {"ffres", CONTROL_VALUE, RTF_FFRES}, + {"ffsize", CONTROL_VALUE, RTF_FFSIZE}, + {"ffstattext", CONTROL_DESTINATION, RTF_FFSTATTEXT}, + {"fftype", CONTROL_VALUE, RTF_FFTYPE}, + {"fftypetxt", CONTROL_VALUE, RTF_FFTYPETXT}, + {"fhimajor", CONTROL_FLAG, RTF_FHIMAJOR}, + {"fhiminor", CONTROL_FLAG, RTF_FHIMINOR}, + {"fi", CONTROL_VALUE, RTF_FI}, + {"fid", CONTROL_VALUE, RTF_FID}, + {"field", CONTROL_DESTINATION, RTF_FIELD}, + {"file", CONTROL_DESTINATION, RTF_FILE}, + {"filetbl", CONTROL_DESTINATION, RTF_FILETBL}, + {"fittext", CONTROL_VALUE, RTF_FITTEXT}, + {"fjgothic", CONTROL_FLAG, RTF_FJGOTHIC}, + {"fjminchou", CONTROL_FLAG, RTF_FJMINCHOU}, + {"fldalt", CONTROL_FLAG, RTF_FLDALT}, + {"flddirty", CONTROL_FLAG, RTF_FLDDIRTY}, + {"fldedit", CONTROL_FLAG, RTF_FLDEDIT}, + {"fldinst", CONTROL_DESTINATION, RTF_FLDINST}, + {"fldlock", CONTROL_FLAG, RTF_FLDLOCK}, + {"fldpriv", CONTROL_FLAG, RTF_FLDPRIV}, + {"fldrslt", CONTROL_DESTINATION, RTF_FLDRSLT}, + {"fldtype", CONTROL_DESTINATION, RTF_FLDTYPE}, + {"flomajor", CONTROL_FLAG, RTF_FLOMAJOR}, + {"flominor", CONTROL_FLAG, RTF_FLOMINOR}, + {"fmodern", CONTROL_FLAG, RTF_FMODERN}, + {"fn", CONTROL_VALUE, RTF_FN}, + {"fname", CONTROL_DESTINATION, RTF_FNAME}, + {"fnetwork", CONTROL_FLAG, RTF_FNETWORK}, + {"fnil", CONTROL_FLAG, RTF_FNIL}, + {"fnonfilesys", CONTROL_FLAG, RTF_FNONFILESYS}, + {"fontemb", CONTROL_DESTINATION, RTF_FONTEMB}, + {"fontfile", CONTROL_DESTINATION, RTF_FONTFILE}, + {"fonttbl", CONTROL_DESTINATION, RTF_FONTTBL}, + {"footer", CONTROL_DESTINATION, RTF_FOOTER}, + {"footerf", CONTROL_DESTINATION, RTF_FOOTERF}, + {"footerl", CONTROL_DESTINATION, RTF_FOOTERL}, + {"footerr", CONTROL_DESTINATION, RTF_FOOTERR}, + {"footery", CONTROL_VALUE, RTF_FOOTERY}, + {"footnote", CONTROL_DESTINATION, RTF_FOOTNOTE}, + {"forceupgrade", CONTROL_FLAG, RTF_FORCEUPGRADE}, + {"formdisp", CONTROL_FLAG, RTF_FORMDISP}, + {"formfield", CONTROL_DESTINATION, RTF_FORMFIELD}, + {"formprot", CONTROL_FLAG, RTF_FORMPROT}, + {"formshade", CONTROL_FLAG, RTF_FORMSHADE}, + {"fosnum", CONTROL_VALUE, RTF_FOSNUM}, + {"fprq", CONTROL_VALUE, RTF_FPRQ}, + {"fracwidth", CONTROL_FLAG, RTF_FRACWIDTH}, + {"frelative", CONTROL_VALUE, RTF_FRELATIVE}, + {"frmtxbtlr", CONTROL_FLAG, RTF_FRMTXBTLR}, + {"frmtxlrtb", CONTROL_FLAG, RTF_FRMTXLRTB}, + {"frmtxlrtbv", CONTROL_FLAG, RTF_FRMTXLRTBV}, + {"frmtxtbrl", CONTROL_FLAG, RTF_FRMTXTBRL}, + {"frmtxtbrlv", CONTROL_FLAG, RTF_FRMTXTBRLV}, + {"froman", CONTROL_FLAG, RTF_FROMAN}, + {"fromhtml", CONTROL_VALUE, RTF_FROMHTML}, + {"fromtext", CONTROL_FLAG, RTF_FROMTEXT}, + {"fs", CONTROL_VALUE, RTF_FS}, + {"fscript", CONTROL_FLAG, RTF_FSCRIPT}, + {"fswiss", CONTROL_FLAG, RTF_FSWISS}, + {"ftech", CONTROL_FLAG, RTF_FTECH}, + {"ftnalt", CONTROL_FLAG, RTF_FTNALT}, + {"ftnbj", CONTROL_FLAG, RTF_FTNBJ}, + {"ftncn", CONTROL_DESTINATION, RTF_FTNCN}, + {"ftnil", CONTROL_FLAG, RTF_FTNIL}, + {"ftnlytwnine", CONTROL_FLAG, RTF_FTNLYTWNINE}, + {"ftnnalc", CONTROL_FLAG, RTF_FTNNALC}, + {"ftnnar", CONTROL_FLAG, RTF_FTNNAR}, + {"ftnnauc", CONTROL_FLAG, RTF_FTNNAUC}, + {"ftnnchi", CONTROL_FLAG, RTF_FTNNCHI}, + {"ftnnchosung", CONTROL_FLAG, RTF_FTNNCHOSUNG}, + {"ftnncnum", CONTROL_FLAG, RTF_FTNNCNUM}, + {"ftnndbar", CONTROL_FLAG, RTF_FTNNDBAR}, + {"ftnndbnum", CONTROL_FLAG, RTF_FTNNDBNUM}, + {"ftnndbnumd", CONTROL_FLAG, RTF_FTNNDBNUMD}, + {"ftnndbnumk", CONTROL_FLAG, RTF_FTNNDBNUMK}, + {"ftnndbnumt", CONTROL_FLAG, RTF_FTNNDBNUMT}, + {"ftnnganada", CONTROL_FLAG, RTF_FTNNGANADA}, + {"ftnngbnum", CONTROL_FLAG, RTF_FTNNGBNUM}, + {"ftnngbnumd", CONTROL_FLAG, RTF_FTNNGBNUMD}, + {"ftnngbnumk", CONTROL_FLAG, RTF_FTNNGBNUMK}, + {"ftnngbnuml", CONTROL_FLAG, RTF_FTNNGBNUML}, + {"ftnnrlc", CONTROL_FLAG, RTF_FTNNRLC}, + {"ftnnruc", CONTROL_FLAG, RTF_FTNNRUC}, + {"ftnnzodiac", CONTROL_FLAG, RTF_FTNNZODIAC}, + {"ftnnzodiacd", CONTROL_FLAG, RTF_FTNNZODIACD}, + {"ftnnzodiacl", CONTROL_FLAG, RTF_FTNNZODIACL}, + {"ftnrestart", CONTROL_FLAG, RTF_FTNRESTART}, + {"ftnrstcont", CONTROL_FLAG, RTF_FTNRSTCONT}, + {"ftnrstpg", CONTROL_FLAG, RTF_FTNRSTPG}, + {"ftnsep", CONTROL_DESTINATION, RTF_FTNSEP}, + {"ftnsepc", CONTROL_DESTINATION, RTF_FTNSEPC}, + {"ftnstart", CONTROL_VALUE, RTF_FTNSTART}, + {"ftntj", CONTROL_FLAG, RTF_FTNTJ}, + {"fttruetype", CONTROL_FLAG, RTF_FTTRUETYPE}, + {"fvaliddos", CONTROL_FLAG, RTF_FVALIDDOS}, + {"fvalidhpfs", CONTROL_FLAG, RTF_FVALIDHPFS}, + {"fvalidmac", CONTROL_FLAG, RTF_FVALIDMAC}, + {"fvalidntfs", CONTROL_FLAG, RTF_FVALIDNTFS}, + {"g", CONTROL_DESTINATION, RTF_G}, + {"gcw", CONTROL_VALUE, RTF_GCW}, + {"generator", CONTROL_DESTINATION, RTF_GENERATOR}, + {"green", CONTROL_VALUE, RTF_GREEN}, + {"grfdocevents", CONTROL_VALUE, RTF_GRFDOCEVENTS}, + {"gridtbl", CONTROL_DESTINATION, RTF_GRIDTBL}, + {"gutter", CONTROL_VALUE, RTF_GUTTER}, + {"gutterprl", CONTROL_FLAG, RTF_GUTTERPRL}, + {"guttersxn", CONTROL_VALUE, RTF_GUTTERSXN}, + {"header", CONTROL_DESTINATION, RTF_HEADER}, + {"headerf", CONTROL_DESTINATION, RTF_HEADERF}, + {"headerl", CONTROL_DESTINATION, RTF_HEADERL}, + {"headerr", CONTROL_DESTINATION, RTF_HEADERR}, + {"headery", CONTROL_VALUE, RTF_HEADERY}, + {"hich", CONTROL_FLAG, RTF_HICH}, + {"highlight", CONTROL_VALUE, RTF_HIGHLIGHT}, + {"hl", CONTROL_DESTINATION, RTF_HL}, + {"hlfr", CONTROL_DESTINATION, RTF_HLFR}, + {"hlinkbase", CONTROL_DESTINATION, RTF_HLINKBASE}, + {"hlloc", CONTROL_DESTINATION, RTF_HLLOC}, + {"hlsrc", CONTROL_DESTINATION, RTF_HLSRC}, + {"horzdoc", CONTROL_FLAG, RTF_HORZDOC}, + {"horzsect", CONTROL_FLAG, RTF_HORZSECT}, + {"horzvert", CONTROL_VALUE, RTF_HORZVERT}, + {"hr", CONTROL_VALUE, RTF_HR}, + {"hres", CONTROL_VALUE, RTF_HRES}, + {"hrule", CONTROL_FLAG, RTF_HRULE}, + {"hsv", CONTROL_DESTINATION, RTF_HSV}, + {"htmautsp", CONTROL_FLAG, RTF_HTMAUTSP}, + {"htmlbase", CONTROL_FLAG, RTF_HTMLBASE}, + {"htmlrtf", CONTROL_TOGGLE, RTF_HTMLRTF}, + {"htmltag", CONTROL_DESTINATION, RTF_HTMLTAG}, + {"hwelev", CONTROL_FLAG, RTF_HWELEV}, + {"hyphauto", CONTROL_TOGGLE, RTF_HYPHAUTO}, + {"hyphcaps", CONTROL_TOGGLE, RTF_HYPHCAPS}, + {"hyphconsec", CONTROL_VALUE, RTF_HYPHCONSEC}, + {"hyphhotz", CONTROL_VALUE, RTF_HYPHHOTZ}, + {"hyphpar", CONTROL_TOGGLE, RTF_HYPHPAR}, + {"i", CONTROL_TOGGLE, RTF_I}, + {"id", CONTROL_VALUE, RTF_ID}, + {"ignoremixedcontent", CONTROL_VALUE, RTF_IGNOREMIXEDCONTENT}, + {"ilfomacatclnup", CONTROL_VALUE, RTF_ILFOMACATCLNUP}, + {"ilvl", CONTROL_VALUE, RTF_ILVL}, + {"impr", CONTROL_TOGGLE, RTF_IMPR}, + {"indmirror", CONTROL_FLAG, RTF_INDMIRROR}, + {"indrlsweleven", CONTROL_FLAG, RTF_INDRLSWELEVEN}, + {"info", CONTROL_DESTINATION, RTF_INFO}, + {"insrsid", CONTROL_VALUE, RTF_INSRSID}, + {"intbl", CONTROL_FLAG, RTF_INTBL}, + {"ipgp", CONTROL_VALUE, RTF_IPGP}, + {"irowband", CONTROL_VALUE, RTF_IROWBAND}, + {"irow", CONTROL_VALUE, RTF_IROW}, + {"itap", CONTROL_VALUE, RTF_ITAP}, + {"ixe", CONTROL_FLAG, RTF_IXE}, + {"jcompress", CONTROL_FLAG, RTF_JCOMPRESS}, + {"jexpand", CONTROL_FLAG, RTF_JEXPAND}, + {"jis", CONTROL_FLAG, RTF_JIS}, + {"jpegblip", CONTROL_FLAG, RTF_JPEGBLIP}, + {"jsksu", CONTROL_FLAG, RTF_JSKSU}, + {"keep", CONTROL_FLAG, RTF_KEEP}, + {"keepn", CONTROL_FLAG, RTF_KEEPN}, + {"kerning", CONTROL_VALUE, RTF_KERNING}, + {"keycode", CONTROL_DESTINATION, RTF_KEYCODE}, + {"keywords", CONTROL_DESTINATION, RTF_KEYWORDS}, + {"krnprsnet", CONTROL_FLAG, RTF_KRNPRSNET}, + {"ksulang", CONTROL_VALUE, RTF_KSULANG}, + {"jclisttab", CONTROL_FLAG, RTF_JCLISTTAB}, + {"landscape", CONTROL_FLAG, RTF_LANDSCAPE}, + {"lang", CONTROL_VALUE, RTF_LANG}, + {"langfe", CONTROL_VALUE, RTF_LANGFE}, + {"langfenp", CONTROL_VALUE, RTF_LANGFENP}, + {"langnp", CONTROL_VALUE, RTF_LANGNP}, + {"lastrow", CONTROL_FLAG, RTF_LASTROW}, + {"latentstyles", CONTROL_DESTINATION, RTF_LATENTSTYLES}, + {"lbr", CONTROL_VALUE, RTF_LBR}, + {"lchars", CONTROL_DESTINATION, RTF_LCHARS}, + {"ldblquote", CONTROL_SYMBOL, RTF_LDBLQUOTE}, + {"level", CONTROL_VALUE, RTF_LEVEL}, + {"levelfollow", CONTROL_VALUE, RTF_LEVELFOLLOW}, + {"levelindent", CONTROL_VALUE, RTF_LEVELINDENT}, + {"leveljc", CONTROL_VALUE, RTF_LEVELJC}, + {"leveljcn", CONTROL_VALUE, RTF_LEVELJCN}, + {"levellegal", CONTROL_VALUE, RTF_LEVELLEGAL}, + {"levelnfc", CONTROL_VALUE, RTF_LEVELNFC}, + {"levelnfcn", CONTROL_VALUE, RTF_LEVELNFCN}, + {"levelnorestart", CONTROL_VALUE, RTF_LEVELNORESTART}, + {"levelnumbers", CONTROL_DESTINATION, RTF_LEVELNUMBERS}, + {"levelold", CONTROL_VALUE, RTF_LEVELOLD}, + {"levelpicture", CONTROL_VALUE, RTF_LEVELPICTURE}, + {"levelpicturenosize", CONTROL_FLAG, RTF_LEVELPICTURENOSIZE}, + {"levelprev", CONTROL_VALUE, RTF_LEVELPREV}, + {"levelprevspace", CONTROL_VALUE, RTF_LEVELPREVSPACE}, + {"levelspace", CONTROL_VALUE, RTF_LEVELSPACE}, + {"levelstartat", CONTROL_VALUE, RTF_LEVELSTARTAT}, + {"leveltemplateid", CONTROL_VALUE, RTF_LEVELTEMPLATEID}, + {"leveltext", CONTROL_DESTINATION, RTF_LEVELTEXT}, + {"lfolevel", CONTROL_DESTINATION, RTF_LFOLEVEL}, + {"li", CONTROL_VALUE, RTF_LI}, + {"line", CONTROL_SYMBOL, RTF_LINE}, + {"linebetcol", CONTROL_FLAG, RTF_LINEBETCOL}, + {"linecont", CONTROL_FLAG, RTF_LINECONT}, + {"linemod", CONTROL_VALUE, RTF_LINEMOD}, + {"lineppage", CONTROL_FLAG, RTF_LINEPPAGE}, + {"linerestart", CONTROL_FLAG, RTF_LINERESTART}, + {"linestart", CONTROL_VALUE, RTF_LINESTART}, + {"linestarts", CONTROL_VALUE, RTF_LINESTARTS}, + {"linex", CONTROL_VALUE, RTF_LINEX}, + {"linkself", CONTROL_FLAG, RTF_LINKSELF}, + {"linkstyles", CONTROL_FLAG, RTF_LINKSTYLES}, + {"linkval", CONTROL_DESTINATION, RTF_LINKVAL}, + {"lin", CONTROL_VALUE, RTF_LIN}, + {"lisa", CONTROL_VALUE, RTF_LISA}, + {"lisb", CONTROL_VALUE, RTF_LISB}, + {"list", CONTROL_DESTINATION, RTF_LIST}, + {"listhybrid", CONTROL_FLAG, RTF_LISTHYBRID}, + {"listid", CONTROL_VALUE, RTF_LISTID}, + {"listlevel", CONTROL_DESTINATION, RTF_LISTLEVEL}, + {"listname", CONTROL_DESTINATION, RTF_LISTNAME}, + {"listoverride", CONTROL_DESTINATION, RTF_LISTOVERRIDE}, + {"listoverridecount", CONTROL_VALUE, RTF_LISTOVERRIDECOUNT}, + {"listoverrideformat", CONTROL_VALUE, RTF_LISTOVERRIDEFORMAT}, + {"listoverridestartat", CONTROL_FLAG, RTF_LISTOVERRIDESTARTAT}, + {"listoverridetable", CONTROL_DESTINATION, RTF_LISTOVERRIDETABLE}, + {"listpicture", CONTROL_DESTINATION, RTF_LISTPICTURE}, + {"listrestarthdn", CONTROL_VALUE, RTF_LISTRESTARTHDN}, + {"listsimple", CONTROL_VALUE, RTF_LISTSIMPLE}, + {"liststyleid", CONTROL_VALUE, RTF_LISTSTYLEID}, + {"liststylename", CONTROL_DESTINATION, RTF_LISTSTYLENAME}, + {"listtable", CONTROL_DESTINATION, RTF_LISTTABLE}, + {"listtemplateid", CONTROL_VALUE, RTF_LISTTEMPLATEID}, + {"listtext", CONTROL_DESTINATION, RTF_LISTTEXT}, + {"lnbrkrule", CONTROL_FLAG, RTF_LNBRKRULE}, + {"lndscpsxn", CONTROL_FLAG, RTF_LNDSCPSXN}, + {"lnongrid", CONTROL_FLAG, RTF_LNONGRID}, + {"loch", CONTROL_FLAG, RTF_LOCH}, + {"lquote", CONTROL_SYMBOL, RTF_LQUOTE}, + {"ls", CONTROL_VALUE, RTF_LS}, + {"lsdlocked", CONTROL_VALUE, RTF_LSDLOCKED}, + {"lsdlockeddef", CONTROL_VALUE, RTF_LSDLOCKEDDEF}, + {"lsdlockedexcept", CONTROL_DESTINATION, RTF_LSDLOCKEDEXCEPT}, + {"lsdpriority", CONTROL_VALUE, RTF_LSDPRIORITY}, + {"lsdprioritydef", CONTROL_VALUE, RTF_LSDPRIORITYDEF}, + {"lsdqformat", CONTROL_VALUE, RTF_LSDQFORMAT}, + {"lsdqformatdef", CONTROL_VALUE, RTF_LSDQFORMATDEF}, + {"lsdsemihidden", CONTROL_VALUE, RTF_LSDSEMIHIDDEN}, + {"lsdsemihiddendef", CONTROL_VALUE, RTF_LSDSEMIHIDDENDEF}, + {"lsdstimax", CONTROL_VALUE, RTF_LSDSTIMAX}, + {"lsdunhideused", CONTROL_VALUE, RTF_LSDUNHIDEUSED}, + {"lsdunhideuseddef", CONTROL_VALUE, RTF_LSDUNHIDEUSEDDEF}, + {"ltrch", CONTROL_FLAG, RTF_LTRCH}, + {"ltrdoc", CONTROL_FLAG, RTF_LTRDOC}, + {"ltrmark", CONTROL_SYMBOL, RTF_LTRMARK}, + {"ltrpar", CONTROL_FLAG, RTF_LTRPAR}, + {"ltrrow", CONTROL_FLAG, RTF_LTRROW}, + {"ltrsect", CONTROL_FLAG, RTF_LTRSECT}, + {"lvltentative", CONTROL_FLAG, RTF_LVLTENTATIVE}, + {"lytcalctblwd", CONTROL_FLAG, RTF_LYTCALCTBLWD}, + {"lytexcttp", CONTROL_FLAG, RTF_LYTEXCTTP}, + {"lytprtmet", CONTROL_FLAG, RTF_LYTPRTMET}, + {"lyttblrtgr", CONTROL_FLAG, RTF_LYTTBLRTGR}, + {"mac", CONTROL_FLAG, RTF_MAC}, + {"macc", CONTROL_DESTINATION, RTF_MACC}, + {"maccPr", CONTROL_DESTINATION, RTF_MACCPR}, + {"macpict", CONTROL_FLAG, RTF_MACPICT}, + {"mailmerge", CONTROL_DESTINATION, RTF_MAILMERGE}, + {"makebackup", CONTROL_FLAG, RTF_MAKEBACKUP}, + {"maln", CONTROL_DESTINATION, RTF_MALN}, + {"malnScr", CONTROL_DESTINATION, RTF_MALNSCR}, + {"manager", CONTROL_DESTINATION, RTF_MANAGER}, + {"margb", CONTROL_VALUE, RTF_MARGB}, + {"margbsxn", CONTROL_VALUE, RTF_MARGBSXN}, + {"margl", CONTROL_VALUE, RTF_MARGL}, + {"marglsxn", CONTROL_VALUE, RTF_MARGLSXN}, + {"margmirror", CONTROL_FLAG, RTF_MARGMIRROR}, + {"margmirsxn", CONTROL_FLAG, RTF_MARGMIRSXN}, + {"margPr", CONTROL_DESTINATION, RTF_MARGPR}, + {"margr", CONTROL_VALUE, RTF_MARGR}, + {"margrsxn", CONTROL_VALUE, RTF_MARGRSXN}, + {"margSz", CONTROL_VALUE, RTF_MARGSZ}, + {"margt", CONTROL_VALUE, RTF_MARGT}, + {"margtsxn", CONTROL_VALUE, RTF_MARGTSXN}, + {"mbar", CONTROL_DESTINATION, RTF_MBAR}, + {"mbarPr", CONTROL_DESTINATION, RTF_MBARPR}, + {"mbaseJc", CONTROL_DESTINATION, RTF_MBASEJC}, + {"mbegChr", CONTROL_DESTINATION, RTF_MBEGCHR}, + {"mborderBox", CONTROL_DESTINATION, RTF_MBORDERBOX}, + {"mborderBoxPr", CONTROL_DESTINATION, RTF_MBORDERBOXPR}, + {"mbox", CONTROL_DESTINATION, RTF_MBOX}, + {"mboxPr", CONTROL_DESTINATION, RTF_MBOXPR}, + {"mbrk", CONTROL_VALUE, RTF_MBRK}, + {"mbrkBin", CONTROL_VALUE, RTF_MBRKBIN}, + {"mbrkBinSub", CONTROL_VALUE, RTF_MBRKBINSUB}, + {"mcGp", CONTROL_VALUE, RTF_MCGP}, + {"mcGpRule", CONTROL_VALUE, RTF_MCGPRULE}, + {"mchr", CONTROL_DESTINATION, RTF_MCHR}, + {"mcount", CONTROL_DESTINATION, RTF_MCOUNT}, + {"mcSp", CONTROL_VALUE, RTF_MCSP}, + {"mctrlPr", CONTROL_DESTINATION, RTF_MCTRLPR}, + {"md", CONTROL_DESTINATION, RTF_MD}, + {"mdefJc", CONTROL_VALUE, RTF_MDEFJC}, + {"mdeg", CONTROL_DESTINATION, RTF_MDEG}, + {"mdegHide", CONTROL_DESTINATION, RTF_MDEGHIDE}, + {"mden", CONTROL_DESTINATION, RTF_MDEN}, + {"mdiff", CONTROL_DESTINATION, RTF_MDIFF}, + {"mdiffSty", CONTROL_VALUE, RTF_MDIFFSTY}, + {"mdispdef", CONTROL_VALUE, RTF_MDISPDEF}, + {"mdPr", CONTROL_DESTINATION, RTF_MDPR}, + {"me", CONTROL_DESTINATION, RTF_ME}, + {"mendChr", CONTROL_DESTINATION, RTF_MENDCHR}, + {"meqArr", CONTROL_DESTINATION, RTF_MEQARR}, + {"meqArrPr", CONTROL_DESTINATION, RTF_MEQARRPR}, + {"mf", CONTROL_DESTINATION, RTF_MF}, + {"mfName", CONTROL_DESTINATION, RTF_MFNAME}, + {"mfPr", CONTROL_DESTINATION, RTF_MFPR}, + {"mfunc", CONTROL_DESTINATION, RTF_MFUNC}, + {"mfuncPr", CONTROL_DESTINATION, RTF_MFUNCPR}, + {"mgroupChr", CONTROL_DESTINATION, RTF_MGROUPCHR}, + {"mgroupChrPr", CONTROL_DESTINATION, RTF_MGROUPCHRPR}, + {"mgrow", CONTROL_DESTINATION, RTF_MGROW}, + {"mhideBot", CONTROL_DESTINATION, RTF_MHIDEBOT}, + {"mhideLeft", CONTROL_DESTINATION, RTF_MHIDELEFT}, + {"mhideRight", CONTROL_DESTINATION, RTF_MHIDERIGHT}, + {"mhideTop", CONTROL_DESTINATION, RTF_MHIDETOP}, + {"mhtmltag", CONTROL_DESTINATION, RTF_MHTMLTAG}, + {"min", CONTROL_VALUE, RTF_MIN}, + {"minterSp", CONTROL_VALUE, RTF_MINTERSP}, + {"mintLim", CONTROL_VALUE, RTF_MINTLIM}, + {"mintraSp", CONTROL_VALUE, RTF_MINTRASP}, + {"mjc", CONTROL_VALUE, RTF_MJC}, + {"mlim", CONTROL_DESTINATION, RTF_MLIM}, + {"mlimloc", CONTROL_DESTINATION, RTF_MLIMLOC}, + {"mlimlow", CONTROL_DESTINATION, RTF_MLIMLOW}, + {"mlimlowPr", CONTROL_DESTINATION, RTF_MLIMLOWPR}, + {"mlimupp", CONTROL_DESTINATION, RTF_MLIMUPP}, + {"mlimuppPr", CONTROL_DESTINATION, RTF_MLIMUPPPR}, + {"mlit", CONTROL_FLAG, RTF_MLIT}, + {"mlMargin", CONTROL_VALUE, RTF_MLMARGIN}, + {"mm", CONTROL_DESTINATION, RTF_MM}, + {"mmaddfieldname", CONTROL_DESTINATION, RTF_MMADDFIELDNAME}, + {"mmath", CONTROL_DESTINATION, RTF_MMATH}, + {"mmathFont", CONTROL_VALUE, RTF_MMATHFONT}, + {"mmathPict", CONTROL_DESTINATION, RTF_MMATHPICT}, + {"mmathPr", CONTROL_DESTINATION, RTF_MMATHPR}, + {"mmattach", CONTROL_FLAG, RTF_MMATTACH}, + {"mmaxdist", CONTROL_DESTINATION, RTF_MMAXDIST}, + {"mmblanklines", CONTROL_FLAG, RTF_MMBLANKLINES}, + {"mmc", CONTROL_DESTINATION, RTF_MMC}, + {"mmcJc", CONTROL_DESTINATION, RTF_MMCJC}, + {"mmconnectstr", CONTROL_DESTINATION, RTF_MMCONNECTSTR}, + {"mmconnectstrdata", CONTROL_DESTINATION, RTF_MMCONNECTSTRDATA}, + {"mmcPr", CONTROL_DESTINATION, RTF_MMCPR}, + {"mmcs", CONTROL_DESTINATION, RTF_MMCS}, + {"mmdatasource", CONTROL_DESTINATION, RTF_MMDATASOURCE}, + {"mmdatatypeaccess", CONTROL_FLAG, RTF_MMDATATYPEACCESS}, + {"mmdatatypeexcel", CONTROL_FLAG, RTF_MMDATATYPEEXCEL}, + {"mmdatatypefile", CONTROL_FLAG, RTF_MMDATATYPEFILE}, + {"mmdatatypeodbc", CONTROL_FLAG, RTF_MMDATATYPEODBC}, + {"mmdatatypeodso", CONTROL_FLAG, RTF_MMDATATYPEODSO}, + {"mmdatatypeqt", CONTROL_FLAG, RTF_MMDATATYPEQT}, + {"mmdefaultsql", CONTROL_FLAG, RTF_MMDEFAULTSQL}, + {"mmdestemail", CONTROL_FLAG, RTF_MMDESTEMAIL}, + {"mmdestfax", CONTROL_FLAG, RTF_MMDESTFAX}, + {"mmdestnewdoc", CONTROL_FLAG, RTF_MMDESTNEWDOC}, + {"mmdestprinter", CONTROL_FLAG, RTF_MMDESTPRINTER}, + {"mmerrors", CONTROL_VALUE, RTF_MMERRORS}, + {"mmfttypeaddress", CONTROL_FLAG, RTF_MMFTTYPEADDRESS}, + {"mmfttypebarcode", CONTROL_FLAG, RTF_MMFTTYPEBARCODE}, + {"mmfttypedbcolumn", CONTROL_FLAG, RTF_MMFTTYPEDBCOLUMN}, + {"mmfttypemapped", CONTROL_FLAG, RTF_MMFTTYPEMAPPED}, + {"mmfttypenull", CONTROL_FLAG, RTF_MMFTTYPENULL}, + {"mmfttypesalutation", CONTROL_FLAG, RTF_MMFTTYPESALUTATION}, + {"mmheadersource", CONTROL_DESTINATION, RTF_MMHEADERSOURCE}, + {"mmjdsotype", CONTROL_VALUE, RTF_MMJDSOTYPE}, + {"mmlinktoquery", CONTROL_FLAG, RTF_MMLINKTOQUERY}, + {"mmmailsubject", CONTROL_DESTINATION, RTF_MMMAILSUBJECT}, + {"mmmaintypecatalog", CONTROL_FLAG, RTF_MMMAINTYPECATALOG}, + {"mmmaintypeemail", CONTROL_FLAG, RTF_MMMAINTYPEEMAIL}, + {"mmmaintypeenvelopes", CONTROL_FLAG, RTF_MMMAINTYPEENVELOPES}, + {"mmmaintypefax", CONTROL_FLAG, RTF_MMMAINTYPEFAX}, + {"mmmaintypelabels", CONTROL_FLAG, RTF_MMMAINTYPELABELS}, + {"mmmaintypeletters", CONTROL_FLAG, RTF_MMMAINTYPELETTERS}, + {"mmodso", CONTROL_DESTINATION, RTF_MMODSO}, + {"mmodsoactive", CONTROL_VALUE, RTF_MMODSOACTIVE}, + {"mmodsocoldelim", CONTROL_VALUE, RTF_MMODSOCOLDELIM}, + {"mmodsocolumn", CONTROL_VALUE, RTF_MMODSOCOLUMN}, + {"mmodsodynaddr", CONTROL_VALUE, RTF_MMODSODYNADDR}, + {"mmodsofhdr", CONTROL_VALUE, RTF_MMODSOFHDR}, + {"mmodsofilter", CONTROL_DESTINATION, RTF_MMODSOFILTER}, + {"mmodsofldmpdata", CONTROL_DESTINATION, RTF_MMODSOFLDMPDATA}, + {"mmodsofmcolumn", CONTROL_VALUE, RTF_MMODSOFMCOLUMN}, + {"mmodsohash", CONTROL_VALUE, RTF_MMODSOHASH}, + {"mmodsolid", CONTROL_VALUE, RTF_MMODSOLID}, + {"mmodsomappedname", CONTROL_DESTINATION, RTF_MMODSOMAPPEDNAME}, + {"mmodsoname", CONTROL_DESTINATION, RTF_MMODSONAME}, + {"mmodsorecipdata", CONTROL_DESTINATION, RTF_MMODSORECIPDATA}, + {"mmodsosort", CONTROL_DESTINATION, RTF_MMODSOSORT}, + {"mmodsosrc", CONTROL_DESTINATION, RTF_MMODSOSRC}, + {"mmodsotable", CONTROL_DESTINATION, RTF_MMODSOTABLE}, + {"mmodsoudl", CONTROL_DESTINATION, RTF_MMODSOUDL}, + {"mmodsoudldata", CONTROL_DESTINATION, RTF_MMODSOUDLDATA}, + {"mmodsouniquetag", CONTROL_DESTINATION, RTF_MMODSOUNIQUETAG}, + {"mmPr", CONTROL_DESTINATION, RTF_MMPR}, + {"mmquery", CONTROL_DESTINATION, RTF_MMQUERY}, + {"mmr", CONTROL_DESTINATION, RTF_MMR}, + {"mmreccur", CONTROL_VALUE, RTF_MMRECCUR}, + {"mmshowdata", CONTROL_FLAG, RTF_MMSHOWDATA}, + {"mnary", CONTROL_DESTINATION, RTF_MNARY}, + {"mnaryLim", CONTROL_VALUE, RTF_MNARYLIM}, + {"mnaryPr", CONTROL_DESTINATION, RTF_MNARYPR}, + {"mnoBreak", CONTROL_DESTINATION, RTF_MNOBREAK}, + {"mnor", CONTROL_FLAG, RTF_MNOR}, + {"mnum", CONTROL_DESTINATION, RTF_MNUM}, + {"mo", CONTROL_VALUE, RTF_MO}, + {"mobjDist", CONTROL_DESTINATION, RTF_MOBJDIST}, + {"moMath", CONTROL_DESTINATION, RTF_MOMATH}, + {"moMathPara", CONTROL_DESTINATION, RTF_MOMATHPARA}, + {"moMathParaPr", CONTROL_DESTINATION, RTF_MOMATHPARAPR}, + {"mopEmu", CONTROL_DESTINATION, RTF_MOPEMU}, + {"mphant", CONTROL_DESTINATION, RTF_MPHANT}, + {"mphantPr", CONTROL_DESTINATION, RTF_MPHANTPR}, + {"mplcHide", CONTROL_DESTINATION, RTF_MPLCHIDE}, + {"mpos", CONTROL_DESTINATION, RTF_MPOS}, + {"mpostSp", CONTROL_VALUE, RTF_MPOSTSP}, + {"mpreSp", CONTROL_VALUE, RTF_MPRESP}, + {"mr", CONTROL_DESTINATION, RTF_MR}, + {"mrad", CONTROL_DESTINATION, RTF_MRAD}, + {"mradPr", CONTROL_DESTINATION, RTF_MRADPR}, + {"mrMargin", CONTROL_VALUE, RTF_MRMARGIN}, + {"mrPr", CONTROL_DESTINATION, RTF_MRPR}, + {"mrSp", CONTROL_VALUE, RTF_MRSP}, + {"mrSpRule", CONTROL_VALUE, RTF_MRSPRULE}, + {"mscr", CONTROL_VALUE, RTF_MSCR}, + {"msepChr", CONTROL_DESTINATION, RTF_MSEPCHR}, + {"mshow", CONTROL_DESTINATION, RTF_MSHOW}, + {"mshp", CONTROL_DESTINATION, RTF_MSHP}, + {"msmallFrac", CONTROL_VALUE, RTF_MSMALLFRAC}, + {"msmcap", CONTROL_FLAG, RTF_MSMCAP}, + {"msPre", CONTROL_DESTINATION, RTF_MSPRE}, + {"msPrePr", CONTROL_DESTINATION, RTF_MSPREPR}, + {"msSub", CONTROL_DESTINATION, RTF_MSSUB}, + {"msSubPr", CONTROL_DESTINATION, RTF_MSSUBPR}, + {"msSubSup", CONTROL_DESTINATION, RTF_MSSUBSUP}, + {"msSubSupPr", CONTROL_DESTINATION, RTF_MSSUBSUPPR}, + {"msSup", CONTROL_DESTINATION, RTF_MSSUP}, + {"msSupPr", CONTROL_DESTINATION, RTF_MSSUPPR}, + {"mstrikeBLTR", CONTROL_DESTINATION, RTF_MSTRIKEBLTR}, + {"mstrikeH", CONTROL_DESTINATION, RTF_MSTRIKEH}, + {"mstrikeTLBR", CONTROL_DESTINATION, RTF_MSTRIKETLBR}, + {"mstrikeV", CONTROL_DESTINATION, RTF_MSTRIKEV}, + {"msty", CONTROL_VALUE, RTF_MSTY}, + {"msub", CONTROL_DESTINATION, RTF_MSUB}, + {"msubHide", CONTROL_DESTINATION, RTF_MSUBHIDE}, + {"msup", CONTROL_DESTINATION, RTF_MSUP}, + {"msupHide", CONTROL_DESTINATION, RTF_MSUPHIDE}, + {"mtransp", CONTROL_DESTINATION, RTF_MTRANSP}, + {"mtype", CONTROL_DESTINATION, RTF_MTYPE}, + {"muser", CONTROL_FLAG, RTF_MUSER}, + {"mvauth", CONTROL_VALUE, RTF_MVAUTH}, + {"mvdate", CONTROL_VALUE, RTF_MVDATE}, + {"mvertJc", CONTROL_DESTINATION, RTF_MVERTJC}, + {"mvf", CONTROL_FLAG, RTF_MVF}, + {"mvfmf", CONTROL_DESTINATION, RTF_MVFMF}, + {"mvfml", CONTROL_DESTINATION, RTF_MVFML}, + {"mvt", CONTROL_FLAG, RTF_MVT}, + {"mvtof", CONTROL_DESTINATION, RTF_MVTOF}, + {"mvtol", CONTROL_DESTINATION, RTF_MVTOL}, + {"mwrapIndent", CONTROL_VALUE, RTF_MWRAPINDENT}, + {"mwrapRight", CONTROL_VALUE, RTF_MWRAPRIGHT}, + {"mzeroAsc", CONTROL_DESTINATION, RTF_MZEROASC}, + {"mzeroDesc", CONTROL_DESTINATION, RTF_MZERODESC}, + {"mzeroWid", CONTROL_DESTINATION, RTF_MZEROWID}, + {"nestcell", CONTROL_SYMBOL, RTF_NESTCELL}, + {"nestrow", CONTROL_SYMBOL, RTF_NESTROW}, + {"nesttableprops", CONTROL_DESTINATION, RTF_NESTTABLEPROPS}, + {"newtblstyruls", CONTROL_FLAG, RTF_NEWTBLSTYRULS}, + {"nextfile", CONTROL_DESTINATION, RTF_NEXTFILE}, + {"noafcnsttbl", CONTROL_FLAG, RTF_NOAFCNSTTBL}, + {"nobrkwrptbl", CONTROL_FLAG, RTF_NOBRKWRPTBL}, + {"nocolbal", CONTROL_FLAG, RTF_NOCOLBAL}, + {"nocompatoptions", CONTROL_FLAG, RTF_NOCOMPATOPTIONS}, + {"nocwrap", CONTROL_FLAG, RTF_NOCWRAP}, + {"nocxsptable", CONTROL_FLAG, RTF_NOCXSPTABLE}, + {"noextrasprl", CONTROL_FLAG, RTF_NOEXTRASPRL}, + {"nofchars", CONTROL_VALUE, RTF_NOFCHARS}, + {"nofcharsws", CONTROL_VALUE, RTF_NOFCHARSWS}, + {"nofeaturethrottle", CONTROL_FLAG, RTF_NOFEATURETHROTTLE}, + {"nofpages", CONTROL_VALUE, RTF_NOFPAGES}, + {"nofwords", CONTROL_VALUE, RTF_NOFWORDS}, + {"nogrowautofit", CONTROL_FLAG, RTF_NOGROWAUTOFIT}, + {"noindnmbrts", CONTROL_FLAG, RTF_NOINDNMBRTS}, + {"nojkernpunct", CONTROL_FLAG, RTF_NOJKERNPUNCT}, + {"nolead", CONTROL_FLAG, RTF_NOLEAD}, + {"noline", CONTROL_FLAG, RTF_NOLINE}, + {"nolnhtadjtbl", CONTROL_FLAG, RTF_NOLNHTADJTBL}, + {"nonesttables", CONTROL_DESTINATION, RTF_NONESTTABLES}, + {"nonshppict", CONTROL_FLAG, RTF_NONSHPPICT}, + {"nooverflow", CONTROL_FLAG, RTF_NOOVERFLOW}, + {"noproof", CONTROL_FLAG, RTF_NOPROOF}, + {"noqfpromote", CONTROL_FLAG, RTF_NOQFPROMOTE}, + {"nosectexpand", CONTROL_FLAG, RTF_NOSECTEXPAND}, + {"nosnaplinegrid", CONTROL_FLAG, RTF_NOSNAPLINEGRID}, + {"nospaceforul", CONTROL_FLAG, RTF_NOSPACEFORUL}, + {"nosupersub", CONTROL_FLAG, RTF_NOSUPERSUB}, + {"notabind", CONTROL_FLAG, RTF_NOTABIND}, + {"notbrkcnstfrctbl", CONTROL_FLAG, RTF_NOTBRKCNSTFRCTBL}, + {"notcvasp", CONTROL_FLAG, RTF_NOTCVASP}, + {"notvatxbx", CONTROL_FLAG, RTF_NOTVATXBX}, + {"nouicompat", CONTROL_FLAG, RTF_NOUICOMPAT}, + {"noultrlspc", CONTROL_FLAG, RTF_NOULTRLSPC}, + {"nowidctlpar", CONTROL_FLAG, RTF_NOWIDCTLPAR}, + {"nowrap", CONTROL_FLAG, RTF_NOWRAP}, + {"nowwrap", CONTROL_FLAG, RTF_NOWWRAP}, + {"noxlattoyen", CONTROL_FLAG, RTF_NOXLATTOYEN}, + {"objalias", CONTROL_DESTINATION, RTF_OBJALIAS}, + {"objalign", CONTROL_VALUE, RTF_OBJALIGN}, + {"objattph", CONTROL_FLAG, RTF_OBJATTPH}, + {"objautlink", CONTROL_FLAG, RTF_OBJAUTLINK}, + {"objclass", CONTROL_DESTINATION, RTF_OBJCLASS}, + {"objcropb", CONTROL_VALUE, RTF_OBJCROPB}, + {"objcropl", CONTROL_VALUE, RTF_OBJCROPL}, + {"objcropr", CONTROL_VALUE, RTF_OBJCROPR}, + {"objcropt", CONTROL_VALUE, RTF_OBJCROPT}, + {"objdata", CONTROL_DESTINATION, RTF_OBJDATA}, + {"object", CONTROL_DESTINATION, RTF_OBJECT}, + {"objemb", CONTROL_FLAG, RTF_OBJEMB}, + {"objh", CONTROL_VALUE, RTF_OBJH}, + {"objhtml", CONTROL_FLAG, RTF_OBJHTML}, + {"objicemb", CONTROL_FLAG, RTF_OBJICEMB}, + {"objlink", CONTROL_FLAG, RTF_OBJLINK}, + {"objlock", CONTROL_FLAG, RTF_OBJLOCK}, + {"objname", CONTROL_DESTINATION, RTF_OBJNAME}, + {"objocx", CONTROL_FLAG, RTF_OBJOCX}, + {"objpub", CONTROL_FLAG, RTF_OBJPUB}, + {"objscalex", CONTROL_VALUE, RTF_OBJSCALEX}, + {"objscaley", CONTROL_VALUE, RTF_OBJSCALEY}, + {"objsect", CONTROL_DESTINATION, RTF_OBJSECT}, + {"objsetsize", CONTROL_FLAG, RTF_OBJSETSIZE}, + {"objsub", CONTROL_FLAG, RTF_OBJSUB}, + {"objtime", CONTROL_DESTINATION, RTF_OBJTIME}, + {"objtransy", CONTROL_VALUE, RTF_OBJTRANSY}, + {"objupdate", CONTROL_FLAG, RTF_OBJUPDATE}, + {"objw", CONTROL_VALUE, RTF_OBJW}, + {"ogutter", CONTROL_VALUE, RTF_OGUTTER}, + {"oldas", CONTROL_FLAG, RTF_OLDAS}, + {"oldcprops", CONTROL_DESTINATION, RTF_OLDCPROPS}, + {"oldlinewrap", CONTROL_FLAG, RTF_OLDLINEWRAP}, + {"oldpprops", CONTROL_DESTINATION, RTF_OLDPPROPS}, + {"oldsprops", CONTROL_DESTINATION, RTF_OLDSPROPS}, + {"oldtprops", CONTROL_DESTINATION, RTF_OLDTPROPS}, + {"oleclsid", CONTROL_DESTINATION, RTF_OLECLSID}, + {"operator", CONTROL_DESTINATION, RTF_OPERATOR}, + {"otblrul", CONTROL_FLAG, RTF_OTBLRUL}, + {"outl", CONTROL_TOGGLE, RTF_OUTL}, + {"outlinelevel", CONTROL_VALUE, RTF_OUTLINELEVEL}, + {"overlay", CONTROL_FLAG, RTF_OVERLAY}, + {"page", CONTROL_SYMBOL, RTF_PAGE}, + {"pagebb", CONTROL_FLAG, RTF_PAGEBB}, + {"panose", CONTROL_DESTINATION, RTF_PANOSE}, + {"paperh", CONTROL_VALUE, RTF_PAPERH}, + {"paperw", CONTROL_VALUE, RTF_PAPERW}, + {"par", CONTROL_SYMBOL, RTF_PAR}, + {"pararsid", CONTROL_VALUE, RTF_PARARSID}, + {"pard", CONTROL_FLAG, RTF_PARD}, + {"password", CONTROL_DESTINATION, RTF_PASSWORD}, + {"passwordhash", CONTROL_DESTINATION, RTF_PASSWORDHASH}, + {"pc", CONTROL_FLAG, RTF_PC}, + {"pca", CONTROL_FLAG, RTF_PCA}, + {"pgbrdrb", CONTROL_FLAG, RTF_PGBRDRB}, + {"pgbrdrfoot", CONTROL_FLAG, RTF_PGBRDRFOOT}, + {"pgbrdrhead", CONTROL_FLAG, RTF_PGBRDRHEAD}, + {"pgbrdrl", CONTROL_FLAG, RTF_PGBRDRL}, + {"pgbrdropt", CONTROL_VALUE, RTF_PGBRDROPT}, + {"pgbrdrr", CONTROL_FLAG, RTF_PGBRDRR}, + {"pgbrdrsnap", CONTROL_FLAG, RTF_PGBRDRSNAP}, + {"pgbrdrt", CONTROL_FLAG, RTF_PGBRDRT}, + {"pghsxn", CONTROL_VALUE, RTF_PGHSXN}, + {"pgnbidia", CONTROL_FLAG, RTF_PGNBIDIA}, + {"pgnbidib", CONTROL_FLAG, RTF_PGNBIDIB}, + {"pgnchosung", CONTROL_FLAG, RTF_PGNCHOSUNG}, + {"pgncnum", CONTROL_FLAG, RTF_PGNCNUM}, + {"pgncont", CONTROL_FLAG, RTF_PGNCONT}, + {"pgndbnum", CONTROL_FLAG, RTF_PGNDBNUM}, + {"pgndbnumd", CONTROL_FLAG, RTF_PGNDBNUMD}, + {"pgndbnumk", CONTROL_FLAG, RTF_PGNDBNUMK}, + {"pgndbnumt", CONTROL_FLAG, RTF_PGNDBNUMT}, + {"pgndec", CONTROL_FLAG, RTF_PGNDEC}, + {"pgndecd", CONTROL_FLAG, RTF_PGNDECD}, + {"pgnganada", CONTROL_FLAG, RTF_PGNGANADA}, + {"pgngbnum", CONTROL_FLAG, RTF_PGNGBNUM}, + {"pgngbnumd", CONTROL_FLAG, RTF_PGNGBNUMD}, + {"pgngbnumk", CONTROL_FLAG, RTF_PGNGBNUMK}, + {"pgngbnuml", CONTROL_FLAG, RTF_PGNGBNUML}, + {"pgnhindia", CONTROL_FLAG, RTF_PGNHINDIA}, + {"pgnhindib", CONTROL_FLAG, RTF_PGNHINDIB}, + {"pgnhindic", CONTROL_FLAG, RTF_PGNHINDIC}, + {"pgnhindid", CONTROL_FLAG, RTF_PGNHINDID}, + {"pgnhn", CONTROL_VALUE, RTF_PGNHN}, + {"pgnhnsc", CONTROL_FLAG, RTF_PGNHNSC}, + {"pgnhnsh", CONTROL_FLAG, RTF_PGNHNSH}, + {"pgnhnsm", CONTROL_FLAG, RTF_PGNHNSM}, + {"pgnhnsn", CONTROL_FLAG, RTF_PGNHNSN}, + {"pgnhnsp", CONTROL_FLAG, RTF_PGNHNSP}, + {"pgnid", CONTROL_FLAG, RTF_PGNID}, + {"pgnlcltr", CONTROL_FLAG, RTF_PGNLCLTR}, + {"pgnlcrm", CONTROL_FLAG, RTF_PGNLCRM}, + {"pgnrestart", CONTROL_FLAG, RTF_PGNRESTART}, + {"pgnstart", CONTROL_VALUE, RTF_PGNSTART}, + {"pgnstarts", CONTROL_VALUE, RTF_PGNSTARTS}, + {"pgnthaia", CONTROL_FLAG, RTF_PGNTHAIA}, + {"pgnthaib", CONTROL_FLAG, RTF_PGNTHAIB}, + {"pgnthaic", CONTROL_FLAG, RTF_PGNTHAIC}, + {"pgnucltr", CONTROL_FLAG, RTF_PGNUCLTR}, + {"pgnucrm", CONTROL_FLAG, RTF_PGNUCRM}, + {"pgnvieta", CONTROL_FLAG, RTF_PGNVIETA}, + {"pgnx", CONTROL_VALUE, RTF_PGNX}, + {"pgny", CONTROL_VALUE, RTF_PGNY}, + {"pgnzodiac", CONTROL_FLAG, RTF_PGNZODIAC}, + {"pgnzodiacd", CONTROL_FLAG, RTF_PGNZODIACD}, + {"pgnzodiacl", CONTROL_FLAG, RTF_PGNZODIACL}, + {"pgp", CONTROL_DESTINATION, RTF_PGP}, + {"pgptbl", CONTROL_DESTINATION, RTF_PGPTBL}, + {"pgwsxn", CONTROL_VALUE, RTF_PGWSXN}, + {"phcol", CONTROL_FLAG, RTF_PHCOL}, + {"phmrg", CONTROL_FLAG, RTF_PHMRG}, + {"phpg", CONTROL_FLAG, RTF_PHPG}, + {"picbmp", CONTROL_FLAG, RTF_PICBMP}, + {"picbpp", CONTROL_VALUE, RTF_PICBPP}, + {"piccropb", CONTROL_VALUE, RTF_PICCROPB}, + {"piccropl", CONTROL_VALUE, RTF_PICCROPL}, + {"piccropr", CONTROL_VALUE, RTF_PICCROPR}, + {"piccropt", CONTROL_VALUE, RTF_PICCROPT}, + {"pich", CONTROL_VALUE, RTF_PICH}, + {"pichgoal", CONTROL_VALUE, RTF_PICHGOAL}, + {"picprop", CONTROL_DESTINATION, RTF_PICPROP}, + {"picscaled", CONTROL_FLAG, RTF_PICSCALED}, + {"picscalex", CONTROL_VALUE, RTF_PICSCALEX}, + {"picscaley", CONTROL_VALUE, RTF_PICSCALEY}, + {"pict", CONTROL_DESTINATION, RTF_PICT}, + {"picw", CONTROL_VALUE, RTF_PICW}, + {"picwgoal", CONTROL_VALUE, RTF_PICWGOAL}, + {"pindtabqc", CONTROL_FLAG, RTF_PINDTABQC}, + {"pindtabql", CONTROL_FLAG, RTF_PINDTABQL}, + {"pindtabqr", CONTROL_FLAG, RTF_PINDTABQR}, + {"plain", CONTROL_FLAG, RTF_PLAIN}, + {"pmartabqc", CONTROL_FLAG, RTF_PMARTABQC}, + {"pmartabql", CONTROL_FLAG, RTF_PMARTABQL}, + {"pmartabqr", CONTROL_FLAG, RTF_PMARTABQR}, + {"pmmetafile", CONTROL_VALUE, RTF_PMMETAFILE}, + {"pn", CONTROL_DESTINATION, RTF_PN}, + {"pnacross", CONTROL_FLAG, RTF_PNACROSS}, + {"pnaiu", CONTROL_FLAG, RTF_PNAIU}, + {"pnaiud", CONTROL_FLAG, RTF_PNAIUD}, + {"pnaiueo", CONTROL_FLAG, RTF_PNAIUEO}, + {"pnaiueod", CONTROL_FLAG, RTF_PNAIUEOD}, + {"pnb", CONTROL_TOGGLE, RTF_PNB}, + {"pnbidia", CONTROL_FLAG, RTF_PNBIDIA}, + {"pnbidib", CONTROL_FLAG, RTF_PNBIDIB}, + {"pncaps", CONTROL_TOGGLE, RTF_PNCAPS}, + {"pncard", CONTROL_FLAG, RTF_PNCARD}, + {"pncf", CONTROL_VALUE, RTF_PNCF}, + {"pnchosung", CONTROL_FLAG, RTF_PNCHOSUNG}, + {"pncnum", CONTROL_FLAG, RTF_PNCNUM}, + {"pndbnum", CONTROL_FLAG, RTF_PNDBNUM}, + {"pndbnumd", CONTROL_FLAG, RTF_PNDBNUMD}, + {"pndbnumk", CONTROL_FLAG, RTF_PNDBNUMK}, + {"pndbnuml", CONTROL_FLAG, RTF_PNDBNUML}, + {"pndbnumt", CONTROL_FLAG, RTF_PNDBNUMT}, + {"pndec", CONTROL_FLAG, RTF_PNDEC}, + {"pndecd", CONTROL_FLAG, RTF_PNDECD}, + {"pnf", CONTROL_VALUE, RTF_PNF}, + {"pnfs", CONTROL_VALUE, RTF_PNFS}, + {"pnganada", CONTROL_FLAG, RTF_PNGANADA}, + {"pngblip", CONTROL_FLAG, RTF_PNGBLIP}, + {"pngbnum", CONTROL_FLAG, RTF_PNGBNUM}, + {"pngbnumd", CONTROL_FLAG, RTF_PNGBNUMD}, + {"pngbnumk", CONTROL_FLAG, RTF_PNGBNUMK}, + {"pngbnuml", CONTROL_FLAG, RTF_PNGBNUML}, + {"pnhang", CONTROL_FLAG, RTF_PNHANG}, + {"pni", CONTROL_TOGGLE, RTF_PNI}, + {"pnindent", CONTROL_VALUE, RTF_PNINDENT}, + {"pniroha", CONTROL_FLAG, RTF_PNIROHA}, + {"pnirohad", CONTROL_FLAG, RTF_PNIROHAD}, + {"pnlcltr", CONTROL_FLAG, RTF_PNLCLTR}, + {"pnlcrm", CONTROL_FLAG, RTF_PNLCRM}, + {"pnlvl", CONTROL_VALUE, RTF_PNLVL}, + {"pnlvlblt", CONTROL_FLAG, RTF_PNLVLBLT}, + {"pnlvlbody", CONTROL_FLAG, RTF_PNLVLBODY}, + {"pnlvlcont", CONTROL_FLAG, RTF_PNLVLCONT}, + {"pnnumonce", CONTROL_FLAG, RTF_PNNUMONCE}, + {"pnord", CONTROL_FLAG, RTF_PNORD}, + {"pnordt", CONTROL_FLAG, RTF_PNORDT}, + {"pnprev", CONTROL_FLAG, RTF_PNPREV}, + {"pnqc", CONTROL_FLAG, RTF_PNQC}, + {"pnql", CONTROL_FLAG, RTF_PNQL}, + {"pnqr", CONTROL_FLAG, RTF_PNQR}, + {"pnrauth", CONTROL_VALUE, RTF_PNRAUTH}, + {"pnrdate", CONTROL_VALUE, RTF_PNRDATE}, + {"pnrestart", CONTROL_FLAG, RTF_PNRESTART}, + {"pnrnfc", CONTROL_VALUE, RTF_PNRNFC}, + {"pnrnot", CONTROL_FLAG, RTF_PNRNOT}, + {"pnrpnbr", CONTROL_VALUE, RTF_PNRPNBR}, + {"pnrrgb", CONTROL_VALUE, RTF_PNRRGB}, + {"pnrstart", CONTROL_VALUE, RTF_PNRSTART}, + {"pnrstop", CONTROL_VALUE, RTF_PNRSTOP}, + {"pnrxst", CONTROL_VALUE, RTF_PNRXST}, + {"pnscaps", CONTROL_TOGGLE, RTF_PNSCAPS}, + {"pnseclvl", CONTROL_DESTINATION, RTF_PNSECLVL}, + {"pnsp", CONTROL_VALUE, RTF_PNSP}, + {"pnstart", CONTROL_VALUE, RTF_PNSTART}, + {"pnstrike", CONTROL_TOGGLE, RTF_PNSTRIKE}, + {"pntext", CONTROL_DESTINATION, RTF_PNTEXT}, + {"pntxta", CONTROL_DESTINATION, RTF_PNTXTA}, + {"pntxtb", CONTROL_DESTINATION, RTF_PNTXTB}, + {"pnucltr", CONTROL_FLAG, RTF_PNUCLTR}, + {"pnucrm", CONTROL_FLAG, RTF_PNUCRM}, + {"pnul", CONTROL_TOGGLE, RTF_PNUL}, + {"pnuld", CONTROL_FLAG, RTF_PNULD}, + {"pnuldash", CONTROL_FLAG, RTF_PNULDASH}, + {"pnuldashd", CONTROL_FLAG, RTF_PNULDASHD}, + {"pnuldashdd", CONTROL_FLAG, RTF_PNULDASHDD}, + {"pnuldb", CONTROL_FLAG, RTF_PNULDB}, + {"pnulhair", CONTROL_FLAG, RTF_PNULHAIR}, + {"pnulnone", CONTROL_FLAG, RTF_PNULNONE}, + {"pnulth", CONTROL_FLAG, RTF_PNULTH}, + {"pnulw", CONTROL_FLAG, RTF_PNULW}, + {"pnulwave", CONTROL_FLAG, RTF_PNULWAVE}, + {"pnzodiac", CONTROL_FLAG, RTF_PNZODIAC}, + {"pnzodiacd", CONTROL_FLAG, RTF_PNZODIACD}, + {"pnzodiacl", CONTROL_FLAG, RTF_PNZODIACL}, + {"posnegx", CONTROL_VALUE, RTF_POSNEGX}, + {"posnegy", CONTROL_VALUE, RTF_POSNEGY}, + {"posx", CONTROL_VALUE, RTF_POSX}, + {"posxc", CONTROL_FLAG, RTF_POSXC}, + {"posxi", CONTROL_FLAG, RTF_POSXI}, + {"posxl", CONTROL_FLAG, RTF_POSXL}, + {"posxo", CONTROL_FLAG, RTF_POSXO}, + {"posxr", CONTROL_FLAG, RTF_POSXR}, + {"posy", CONTROL_VALUE, RTF_POSY}, + {"posyb", CONTROL_FLAG, RTF_POSYB}, + {"posyc", CONTROL_FLAG, RTF_POSYC}, + {"posyil", CONTROL_FLAG, RTF_POSYIL}, + {"posyin", CONTROL_FLAG, RTF_POSYIN}, + {"posyout", CONTROL_FLAG, RTF_POSYOUT}, + {"posyt", CONTROL_FLAG, RTF_POSYT}, + {"prauth", CONTROL_VALUE, RTF_PRAUTH}, + {"prcolbl", CONTROL_FLAG, RTF_PRCOLBL}, + {"prdate", CONTROL_VALUE, RTF_PRDATE}, + {"printdata", CONTROL_FLAG, RTF_PRINTDATA}, + {"printim", CONTROL_DESTINATION, RTF_PRINTIM}, + {"private", CONTROL_DESTINATION, RTF_PRIVATE}, + {"propname", CONTROL_DESTINATION, RTF_PROPNAME}, + {"proptype", CONTROL_VALUE, RTF_PROPTYPE}, + {"protect", CONTROL_TOGGLE, RTF_PROTECT}, + {"protend", CONTROL_DESTINATION, RTF_PROTEND}, + {"protlevel", CONTROL_VALUE, RTF_PROTLEVEL}, + {"protstart", CONTROL_DESTINATION, RTF_PROTSTART}, + {"protusertbl", CONTROL_DESTINATION, RTF_PROTUSERTBL}, + {"psover", CONTROL_FLAG, RTF_PSOVER}, + {"psz", CONTROL_VALUE, RTF_PSZ}, + {"ptabldot", CONTROL_FLAG, RTF_PTABLDOT}, + {"ptablmdot", CONTROL_FLAG, RTF_PTABLMDOT}, + {"ptablminus", CONTROL_FLAG, RTF_PTABLMINUS}, + {"ptablnone", CONTROL_FLAG, RTF_PTABLNONE}, + {"ptabluscore", CONTROL_FLAG, RTF_PTABLUSCORE}, + {"pubauto", CONTROL_FLAG, RTF_PUBAUTO}, + {"pvmrg", CONTROL_FLAG, RTF_PVMRG}, + {"pvpara", CONTROL_FLAG, RTF_PVPARA}, + {"pvpg", CONTROL_FLAG, RTF_PVPG}, + {"pwd", CONTROL_VALUE, RTF_PWD}, + {"pxe", CONTROL_DESTINATION, RTF_PXE}, + {"qc", CONTROL_FLAG, RTF_QC}, + {"qd", CONTROL_FLAG, RTF_QD}, + {"qj", CONTROL_FLAG, RTF_QJ}, + {"qk", CONTROL_VALUE, RTF_QK}, + {"ql", CONTROL_FLAG, RTF_QL}, + {"qmspace", CONTROL_SYMBOL, RTF_QMSPACE}, + {"qr", CONTROL_FLAG, RTF_QR}, + {"qt", CONTROL_FLAG, RTF_QT}, + {"rawclbgdkbdiag", CONTROL_FLAG, RTF_RAWCLBGDKBDIAG}, + {"rawclbgbdiag", CONTROL_FLAG, RTF_RAWCLBGBDIAG}, + {"rawclbgcross", CONTROL_FLAG, RTF_RAWCLBGCROSS}, + {"rawclbgdcross", CONTROL_FLAG, RTF_RAWCLBGDCROSS}, + {"rawclbgdkcross", CONTROL_FLAG, RTF_RAWCLBGDKCROSS}, + {"rawclbgdkdcross", CONTROL_FLAG, RTF_RAWCLBGDKDCROSS}, + {"rawclbgdkfdiag", CONTROL_FLAG, RTF_RAWCLBGDKFDIAG}, + {"rawclbgdkhor", CONTROL_FLAG, RTF_RAWCLBGDKHOR}, + {"rawclbgdkvert", CONTROL_FLAG, RTF_RAWCLBGDKVERT}, + {"rawclbgfdiag", CONTROL_FLAG, RTF_RAWCLBGFDIAG}, + {"rawclbghoriz", CONTROL_FLAG, RTF_RAWCLBGHORIZ}, + {"rawclbgvert", CONTROL_FLAG, RTF_RAWCLBGVERT}, + {"rdblquote", CONTROL_SYMBOL, RTF_RDBLQUOTE}, + {"readonlyrecommended", CONTROL_FLAG, RTF_READONLYRECOMMENDED}, + {"readprot", CONTROL_FLAG, RTF_READPROT}, + {"red", CONTROL_VALUE, RTF_RED}, + {"relyonvml", CONTROL_VALUE, RTF_RELYONVML}, + {"remdttm", CONTROL_FLAG, RTF_REMDTTM}, + {"rempersonalinfo", CONTROL_FLAG, RTF_REMPERSONALINFO}, + {"result", CONTROL_DESTINATION, RTF_RESULT}, + {"revauth", CONTROL_VALUE, RTF_REVAUTH}, + {"revauthdel", CONTROL_VALUE, RTF_REVAUTHDEL}, + {"revbar", CONTROL_VALUE, RTF_REVBAR}, + {"revdttm", CONTROL_VALUE, RTF_REVDTTM}, + {"revdttmdel", CONTROL_VALUE, RTF_REVDTTMDEL}, + {"revised", CONTROL_TOGGLE, RTF_REVISED}, + {"revisions", CONTROL_FLAG, RTF_REVISIONS}, + {"revprop", CONTROL_VALUE, RTF_REVPROP}, + {"revprot", CONTROL_FLAG, RTF_REVPROT}, + {"revtbl", CONTROL_DESTINATION, RTF_REVTBL}, + {"revtim", CONTROL_DESTINATION, RTF_REVTIM}, + {"ri", CONTROL_VALUE, RTF_RI}, + {"rin", CONTROL_VALUE, RTF_RIN}, + {"row", CONTROL_SYMBOL, RTF_ROW}, + {"rquote", CONTROL_SYMBOL, RTF_RQUOTE}, + {"rsid", CONTROL_VALUE, RTF_RSID}, + {"rsidroot", CONTROL_VALUE, RTF_RSIDROOT}, + {"rsidtbl", CONTROL_DESTINATION, RTF_RSIDTBL}, + {"rsltbmp", CONTROL_FLAG, RTF_RSLTBMP}, + {"rslthtml", CONTROL_FLAG, RTF_RSLTHTML}, + {"rsltmerge", CONTROL_FLAG, RTF_RSLTMERGE}, + {"rsltpict", CONTROL_FLAG, RTF_RSLTPICT}, + {"rsltrtf", CONTROL_FLAG, RTF_RSLTRTF}, + {"rslttxt", CONTROL_FLAG, RTF_RSLTTXT}, + {"rtf", CONTROL_DESTINATION, RTF_RTF}, + {"rtlch", CONTROL_FLAG, RTF_RTLCH}, + {"rtldoc", CONTROL_FLAG, RTF_RTLDOC}, + {"rtlgutter", CONTROL_FLAG, RTF_RTLGUTTER}, + {"rtlmark", CONTROL_SYMBOL, RTF_RTLMARK}, + {"rtlpar", CONTROL_FLAG, RTF_RTLPAR}, + {"rtlrow", CONTROL_FLAG, RTF_RTLROW}, + {"rtlsect", CONTROL_FLAG, RTF_RTLSECT}, + {"rxe", CONTROL_DESTINATION, RTF_RXE}, + {"s", CONTROL_VALUE, RTF_S}, + {"sa", CONTROL_VALUE, RTF_SA}, + {"saauto", CONTROL_TOGGLE, RTF_SAAUTO}, + {"saftnnalc", CONTROL_FLAG, RTF_SAFTNNALC}, + {"saftnnar", CONTROL_FLAG, RTF_SAFTNNAR}, + {"saftnnauc", CONTROL_FLAG, RTF_SAFTNNAUC}, + {"saftnnchi", CONTROL_FLAG, RTF_SAFTNNCHI}, + {"saftnnchosung", CONTROL_FLAG, RTF_SAFTNNCHOSUNG}, + {"saftnncnum", CONTROL_FLAG, RTF_SAFTNNCNUM}, + {"saftnndbar", CONTROL_FLAG, RTF_SAFTNNDBAR}, + {"saftnndbnum", CONTROL_FLAG, RTF_SAFTNNDBNUM}, + {"saftnndbnumd", CONTROL_FLAG, RTF_SAFTNNDBNUMD}, + {"saftnndbnumk", CONTROL_FLAG, RTF_SAFTNNDBNUMK}, + {"saftnndbnumt", CONTROL_FLAG, RTF_SAFTNNDBNUMT}, + {"saftnnganada", CONTROL_FLAG, RTF_SAFTNNGANADA}, + {"saftnngbnum", CONTROL_FLAG, RTF_SAFTNNGBNUM}, + {"saftnngbnumd", CONTROL_FLAG, RTF_SAFTNNGBNUMD}, + {"saftnngbnumk", CONTROL_FLAG, RTF_SAFTNNGBNUMK}, + {"saftnngbnuml", CONTROL_FLAG, RTF_SAFTNNGBNUML}, + {"saftnnrlc", CONTROL_FLAG, RTF_SAFTNNRLC}, + {"saftnnruc", CONTROL_FLAG, RTF_SAFTNNRUC}, + {"saftnnzodiac", CONTROL_FLAG, RTF_SAFTNNZODIAC}, + {"saftnnzodiacd", CONTROL_FLAG, RTF_SAFTNNZODIACD}, + {"saftnnzodiacl", CONTROL_FLAG, RTF_SAFTNNZODIACL}, + {"saftnrestart", CONTROL_FLAG, RTF_SAFTNRESTART}, + {"saftnrstcont", CONTROL_FLAG, RTF_SAFTNRSTCONT}, + {"saftnstart", CONTROL_VALUE, RTF_SAFTNSTART}, + {"sautoupd", CONTROL_FLAG, RTF_SAUTOUPD}, + {"saveinvalidxml", CONTROL_FLAG, RTF_SAVEINVALIDXML}, + {"saveprevpict", CONTROL_FLAG, RTF_SAVEPREVPICT}, + {"sb", CONTROL_VALUE, RTF_SB}, + {"sbasedon", CONTROL_VALUE, RTF_SBASEDON}, + {"sbauto", CONTROL_TOGGLE, RTF_SBAUTO}, + {"sbkcol", CONTROL_FLAG, RTF_SBKCOL}, + {"sbkeven", CONTROL_FLAG, RTF_SBKEVEN}, + {"sbknone", CONTROL_FLAG, RTF_SBKNONE}, + {"sbkodd", CONTROL_FLAG, RTF_SBKODD}, + {"sbkpage", CONTROL_FLAG, RTF_SBKPAGE}, + {"sbys", CONTROL_FLAG, RTF_SBYS}, + {"scaps", CONTROL_TOGGLE, RTF_SCAPS}, + {"scompose", CONTROL_FLAG, RTF_SCOMPOSE}, + {"sec", CONTROL_VALUE, RTF_SEC}, + {"sect", CONTROL_SYMBOL, RTF_SECT}, + {"sectd", CONTROL_FLAG, RTF_SECTD}, + {"sectdefaultcl", CONTROL_FLAG, RTF_SECTDEFAULTCL}, + {"sectexpand", CONTROL_VALUE, RTF_SECTEXPAND}, + {"sectlinegrid", CONTROL_VALUE, RTF_SECTLINEGRID}, + {"sectnum", CONTROL_SYMBOL, RTF_SECTNUM}, + {"sectrsid", CONTROL_VALUE, RTF_SECTRSID}, + {"sectspecifycl", CONTROL_FLAG, RTF_SECTSPECIFYCL}, + {"sectspecifygenN", CONTROL_FLAG, RTF_SECTSPECIFYGENN}, + {"sectspecifyl", CONTROL_FLAG, RTF_SECTSPECIFYL}, + {"sectunlocked", CONTROL_FLAG, RTF_SECTUNLOCKED}, + {"sftnbj", CONTROL_FLAG, RTF_SFTNBJ}, + {"sftnnalc", CONTROL_FLAG, RTF_SFTNNALC}, + {"sftnnar", CONTROL_FLAG, RTF_SFTNNAR}, + {"sftnnauc", CONTROL_FLAG, RTF_SFTNNAUC}, + {"sftnnchi", CONTROL_FLAG, RTF_SFTNNCHI}, + {"sftnnchosung", CONTROL_FLAG, RTF_SFTNNCHOSUNG}, + {"sftnncnum", CONTROL_FLAG, RTF_SFTNNCNUM}, + {"sftnndbar", CONTROL_FLAG, RTF_SFTNNDBAR}, + {"sftnndbnum", CONTROL_FLAG, RTF_SFTNNDBNUM}, + {"sftnndbnumd", CONTROL_FLAG, RTF_SFTNNDBNUMD}, + {"sftnndbnumk", CONTROL_FLAG, RTF_SFTNNDBNUMK}, + {"sftnndbnumt", CONTROL_FLAG, RTF_SFTNNDBNUMT}, + {"sftnnganada", CONTROL_FLAG, RTF_SFTNNGANADA}, + {"sftnngbnum", CONTROL_FLAG, RTF_SFTNNGBNUM}, + {"sftnngbnumd", CONTROL_FLAG, RTF_SFTNNGBNUMD}, + {"sftnngbnumk", CONTROL_FLAG, RTF_SFTNNGBNUMK}, + {"sftnngbnuml", CONTROL_FLAG, RTF_SFTNNGBNUML}, + {"sftnnrlc", CONTROL_FLAG, RTF_SFTNNRLC}, + {"sftnnruc", CONTROL_FLAG, RTF_SFTNNRUC}, + {"sftnnzodiac", CONTROL_FLAG, RTF_SFTNNZODIAC}, + {"sftnnzodiacd", CONTROL_FLAG, RTF_SFTNNZODIACD}, + {"sftnnzodiacl", CONTROL_FLAG, RTF_SFTNNZODIACL}, + {"sftnrestart", CONTROL_FLAG, RTF_SFTNRESTART}, + {"sftnrstcont", CONTROL_FLAG, RTF_SFTNRSTCONT}, + {"sftnrstpg", CONTROL_FLAG, RTF_SFTNRSTPG}, + {"sftnstart", CONTROL_VALUE, RTF_SFTNSTART}, + {"sftntj", CONTROL_FLAG, RTF_SFTNTJ}, + {"shad", CONTROL_TOGGLE, RTF_SHAD}, + {"shading", CONTROL_VALUE, RTF_SHADING}, + {"shidden", CONTROL_FLAG, RTF_SHIDDEN}, + {"shift", CONTROL_FLAG, RTF_SHIFT}, + {"showplaceholdtext", CONTROL_VALUE, RTF_SHOWPLACEHOLDTEXT}, + {"showxmlerrors", CONTROL_VALUE, RTF_SHOWXMLERRORS}, + {"shp", CONTROL_DESTINATION, RTF_SHP}, + {"shpbottom", CONTROL_VALUE, RTF_SHPBOTTOM}, + {"shpbxcolumn", CONTROL_FLAG, RTF_SHPBXCOLUMN}, + {"shpbxignore", CONTROL_FLAG, RTF_SHPBXIGNORE}, + {"shpbxmargin", CONTROL_FLAG, RTF_SHPBXMARGIN}, + {"shpbxpage", CONTROL_FLAG, RTF_SHPBXPAGE}, + {"shpbyignore", CONTROL_FLAG, RTF_SHPBYIGNORE}, + {"shpbymargin", CONTROL_FLAG, RTF_SHPBYMARGIN}, + {"shpbypage", CONTROL_FLAG, RTF_SHPBYPAGE}, + {"shpbypara", CONTROL_FLAG, RTF_SHPBYPARA}, + {"shpfblwtxt", CONTROL_VALUE, RTF_SHPFBLWTXT}, + {"shpfhdr", CONTROL_VALUE, RTF_SHPFHDR}, + {"shpgrp", CONTROL_DESTINATION, RTF_SHPGRP}, + {"shpinst", CONTROL_DESTINATION, RTF_SHPINST}, + {"shpleft", CONTROL_VALUE, RTF_SHPLEFT}, + {"shplid", CONTROL_VALUE, RTF_SHPLID}, + {"shplockanchor", CONTROL_FLAG, RTF_SHPLOCKANCHOR}, + {"shppict", CONTROL_DESTINATION, RTF_SHPPICT}, + {"shpright", CONTROL_VALUE, RTF_SHPRIGHT}, + {"shprslt", CONTROL_DESTINATION, RTF_SHPRSLT}, + {"shptop", CONTROL_VALUE, RTF_SHPTOP}, + {"shptxt", CONTROL_DESTINATION, RTF_SHPTXT}, + {"shpwrk", CONTROL_VALUE, RTF_SHPWRK}, + {"shpwr", CONTROL_VALUE, RTF_SHPWR}, + {"shpz", CONTROL_VALUE, RTF_SHPZ}, + {"sl", CONTROL_VALUE, RTF_SL}, + {"slink", CONTROL_VALUE, RTF_SLINK}, + {"slmult", CONTROL_VALUE, RTF_SLMULT}, + {"slocked", CONTROL_FLAG, RTF_SLOCKED}, + {"sn", CONTROL_DESTINATION, RTF_SN}, + {"snaptogridincell", CONTROL_FLAG, RTF_SNAPTOGRIDINCELL}, + {"snext", CONTROL_VALUE, RTF_SNEXT}, + {"softcol", CONTROL_FLAG, RTF_SOFTCOL}, + {"softlheight", CONTROL_VALUE, RTF_SOFTLHEIGHT}, + {"softline", CONTROL_FLAG, RTF_SOFTLINE}, + {"softpage", CONTROL_FLAG, RTF_SOFTPAGE}, + {"sp", CONTROL_DESTINATION, RTF_SP}, + {"spersonal", CONTROL_FLAG, RTF_SPERSONAL}, + {"spltpgpar", CONTROL_FLAG, RTF_SPLTPGPAR}, + {"splytwnine", CONTROL_FLAG, RTF_SPLYTWNINE}, + {"spriority", CONTROL_VALUE, RTF_SPRIORITY}, + {"sprsbsp", CONTROL_FLAG, RTF_SPRSBSP}, + {"sprslnsp", CONTROL_FLAG, RTF_SPRSLNSP}, + {"sprsspbf", CONTROL_FLAG, RTF_SPRSSPBF}, + {"sprstsm", CONTROL_FLAG, RTF_SPRSTSM}, + {"sprstsp", CONTROL_FLAG, RTF_SPRSTSP}, + {"spv", CONTROL_FLAG, RTF_SPV}, + {"sqformat", CONTROL_FLAG, RTF_SQFORMAT}, + {"srauth", CONTROL_VALUE, RTF_SRAUTH}, + {"srdate", CONTROL_VALUE, RTF_SRDATE}, + {"sreply", CONTROL_FLAG, RTF_SREPLY}, + {"ssemihidden", CONTROL_VALUE, RTF_SSEMIHIDDEN}, + {"staticval", CONTROL_DESTINATION, RTF_STATICVAL}, + {"stextflow", CONTROL_VALUE, RTF_STEXTFLOW}, + {"strike", CONTROL_TOGGLE, RTF_STRIKE}, + {"striked", CONTROL_TOGGLE, RTF_STRIKED}, + {"stshfbi", CONTROL_VALUE, RTF_STSHFBI}, + {"stshfdbch", CONTROL_VALUE, RTF_STSHFDBCH}, + {"stshfhich", CONTROL_VALUE, RTF_STSHFHICH}, + {"stshfloch", CONTROL_VALUE, RTF_STSHFLOCH}, + {"stylelock", CONTROL_FLAG, RTF_STYLELOCK}, + {"stylelockbackcomp", CONTROL_FLAG, RTF_STYLELOCKBACKCOMP}, + {"stylelockenforced", CONTROL_FLAG, RTF_STYLELOCKENFORCED}, + {"stylelockqfset", CONTROL_FLAG, RTF_STYLELOCKQFSET}, + {"stylelocktheme", CONTROL_FLAG, RTF_STYLELOCKTHEME}, + {"stylesheet", CONTROL_DESTINATION, RTF_STYLESHEET}, + {"stylesortmethod", CONTROL_VALUE, RTF_STYLESORTMETHOD}, + {"styrsid", CONTROL_VALUE, RTF_STYRSID}, + {"sub", CONTROL_FLAG, RTF_SUB}, + {"subdocument", CONTROL_VALUE, RTF_SUBDOCUMENT}, + {"subfontbysize", CONTROL_FLAG, RTF_SUBFONTBYSIZE}, + {"subject", CONTROL_DESTINATION, RTF_SUBJECT}, + {"sunhideused", CONTROL_VALUE, RTF_SUNHIDEUSED}, + {"super", CONTROL_FLAG, RTF_SUPER}, + {"sv", CONTROL_DESTINATION, RTF_SV}, + {"svb", CONTROL_DESTINATION, RTF_SVB}, + {"swpbdr", CONTROL_FLAG, RTF_SWPBDR}, + {"tab", CONTROL_SYMBOL, RTF_TAB}, + {"tabsnoovrlp", CONTROL_FLAG, RTF_TABSNOOVRLP}, + {"taprtl", CONTROL_FLAG, RTF_TAPRTL}, + {"tb", CONTROL_VALUE, RTF_TB}, + {"tblind", CONTROL_VALUE, RTF_TBLIND}, + {"tblindtype", CONTROL_VALUE, RTF_TBLINDTYPE}, + {"tbllkbestfit", CONTROL_FLAG, RTF_TBLLKBESTFIT}, + {"tbllkborder", CONTROL_FLAG, RTF_TBLLKBORDER}, + {"tbllkcolor", CONTROL_FLAG, RTF_TBLLKCOLOR}, + {"tbllkfont", CONTROL_FLAG, RTF_TBLLKFONT}, + {"tbllkhdrcols", CONTROL_FLAG, RTF_TBLLKHDRCOLS}, + {"tbllkhdrrows", CONTROL_FLAG, RTF_TBLLKHDRROWS}, + {"tbllklastcol", CONTROL_FLAG, RTF_TBLLKLASTCOL}, + {"tbllklastrow", CONTROL_FLAG, RTF_TBLLKLASTROW}, + {"tbllknocolband", CONTROL_FLAG, RTF_TBLLKNOCOLBAND}, + {"tbllknorowband", CONTROL_FLAG, RTF_TBLLKNOROWBAND}, + {"tbllkshading", CONTROL_FLAG, RTF_TBLLKSHADING}, + {"tblrsid", CONTROL_VALUE, RTF_TBLRSID}, + {"tc", CONTROL_DESTINATION, RTF_TC}, + {"tcelld", CONTROL_FLAG, RTF_TCELLD}, + {"tcf", CONTROL_VALUE, RTF_TCF}, + {"tcl", CONTROL_VALUE, RTF_TCL}, + {"tcn", CONTROL_FLAG, RTF_TCN}, + {"tdfrmtxtBottom", CONTROL_VALUE, RTF_TDFRMTXTBOTTOM}, + {"tdfrmtxtLeft", CONTROL_VALUE, RTF_TDFRMTXTLEFT}, + {"tdfrmtxtRight", CONTROL_VALUE, RTF_TDFRMTXTRIGHT}, + {"tdfrmtxtTop", CONTROL_VALUE, RTF_TDFRMTXTTOP}, + {"template", CONTROL_DESTINATION, RTF_TEMPLATE}, + {"themedata", CONTROL_DESTINATION, RTF_THEMEDATA}, + {"themelang", CONTROL_VALUE, RTF_THEMELANG}, + {"themelangcs", CONTROL_VALUE, RTF_THEMELANGCS}, + {"themelangfe", CONTROL_VALUE, RTF_THEMELANGFE}, + {"time", CONTROL_FLAG, RTF_TIME}, + {"title", CONTROL_DESTINATION, RTF_TITLE}, + {"titlepg", CONTROL_FLAG, RTF_TITLEPG}, + {"tldot", CONTROL_FLAG, RTF_TLDOT}, + {"tleq", CONTROL_FLAG, RTF_TLEQ}, + {"tlhyph", CONTROL_FLAG, RTF_TLHYPH}, + {"tlmdot", CONTROL_FLAG, RTF_TLMDOT}, + {"tlth", CONTROL_FLAG, RTF_TLTH}, + {"tlul", CONTROL_FLAG, RTF_TLUL}, + {"toplinepunct", CONTROL_FLAG, RTF_TOPLINEPUNCT}, + {"tphcol", CONTROL_FLAG, RTF_TPHCOL}, + {"tphmrg", CONTROL_FLAG, RTF_TPHMRG}, + {"tphpg", CONTROL_FLAG, RTF_TPHPG}, + {"tposnegx", CONTROL_VALUE, RTF_TPOSNEGX}, + {"tposnegy", CONTROL_VALUE, RTF_TPOSNEGY}, + {"tposxc", CONTROL_FLAG, RTF_TPOSXC}, + {"tposxi", CONTROL_FLAG, RTF_TPOSXI}, + {"tposxl", CONTROL_FLAG, RTF_TPOSXL}, + {"tposx", CONTROL_VALUE, RTF_TPOSX}, + {"tposxo", CONTROL_FLAG, RTF_TPOSXO}, + {"tposxr", CONTROL_FLAG, RTF_TPOSXR}, + {"tposy", CONTROL_VALUE, RTF_TPOSY}, + {"tposyb", CONTROL_FLAG, RTF_TPOSYB}, + {"tposyc", CONTROL_FLAG, RTF_TPOSYC}, + {"tposyil", CONTROL_FLAG, RTF_TPOSYIL}, + {"tposyin", CONTROL_FLAG, RTF_TPOSYIN}, + {"tposyout", CONTROL_FLAG, RTF_TPOSYOUT}, + {"tposyt", CONTROL_FLAG, RTF_TPOSYT}, + {"tpvmrg", CONTROL_FLAG, RTF_TPVMRG}, + {"tpvpara", CONTROL_FLAG, RTF_TPVPARA}, + {"tpvpg", CONTROL_FLAG, RTF_TPVPG}, + {"tqc", CONTROL_FLAG, RTF_TQC}, + {"tqdec", CONTROL_FLAG, RTF_TQDEC}, + {"tqr", CONTROL_FLAG, RTF_TQR}, + {"trackformatting", CONTROL_VALUE, RTF_TRACKFORMATTING}, + {"trackmoves", CONTROL_VALUE, RTF_TRACKMOVES}, + {"transmf", CONTROL_FLAG, RTF_TRANSMF}, + {"trauth", CONTROL_VALUE, RTF_TRAUTH}, + {"trautofit", CONTROL_TOGGLE, RTF_TRAUTOFIT}, + {"trbgbdiag", CONTROL_FLAG, RTF_TRBGBDIAG}, + {"trbgcross", CONTROL_FLAG, RTF_TRBGCROSS}, + {"trbgdcross", CONTROL_FLAG, RTF_TRBGDCROSS}, + {"trbgdkbdiag", CONTROL_FLAG, RTF_TRBGDKBDIAG}, + {"trbgdkcross", CONTROL_FLAG, RTF_TRBGDKCROSS}, + {"trbgdkdcross", CONTROL_FLAG, RTF_TRBGDKDCROSS}, + {"trbgdkfdiag", CONTROL_FLAG, RTF_TRBGDKFDIAG}, + {"trbgdkhor", CONTROL_FLAG, RTF_TRBGDKHOR}, + {"trbgdkvert", CONTROL_FLAG, RTF_TRBGDKVERT}, + {"trbgfdiag", CONTROL_FLAG, RTF_TRBGFDIAG}, + {"trbghoriz", CONTROL_FLAG, RTF_TRBGHORIZ}, + {"trbgvert", CONTROL_FLAG, RTF_TRBGVERT}, + {"trbrdrb", CONTROL_FLAG, RTF_TRBRDRB}, + {"trbrdrh", CONTROL_FLAG, RTF_TRBRDRH}, + {"trbrdrl", CONTROL_FLAG, RTF_TRBRDRL}, + {"trbrdrr", CONTROL_FLAG, RTF_TRBRDRR}, + {"trbrdrt", CONTROL_FLAG, RTF_TRBRDRT}, + {"trbrdrv", CONTROL_FLAG, RTF_TRBRDRV}, + {"trcbpat", CONTROL_VALUE, RTF_TRCBPAT}, + {"trcfpat", CONTROL_VALUE, RTF_TRCFPAT}, + {"trdate", CONTROL_VALUE, RTF_TRDATE}, + {"trftsWidthA", CONTROL_VALUE, RTF_TRFTSWIDTHA}, + {"trftsWidthB", CONTROL_VALUE, RTF_TRFTSWIDTHB}, + {"trftsWidth", CONTROL_VALUE, RTF_TRFTSWIDTH}, + {"trgaph", CONTROL_VALUE, RTF_TRGAPH}, + {"trhdr", CONTROL_FLAG, RTF_TRHDR}, + {"trkeep", CONTROL_FLAG, RTF_TRKEEP}, + {"trkeepfollow", CONTROL_FLAG, RTF_TRKEEPFOLLOW}, + {"trleft", CONTROL_VALUE, RTF_TRLEFT}, + {"trowd", CONTROL_FLAG, RTF_TROWD}, + {"trpaddb", CONTROL_VALUE, RTF_TRPADDB}, + {"trpaddfb", CONTROL_VALUE, RTF_TRPADDFB}, + {"trpaddfl", CONTROL_VALUE, RTF_TRPADDFL}, + {"trpaddfr", CONTROL_VALUE, RTF_TRPADDFR}, + {"trpaddft", CONTROL_VALUE, RTF_TRPADDFT}, + {"trpaddl", CONTROL_VALUE, RTF_TRPADDL}, + {"trpaddr", CONTROL_VALUE, RTF_TRPADDR}, + {"trpaddt", CONTROL_VALUE, RTF_TRPADDT}, + {"trpadob", CONTROL_VALUE, RTF_TRPADOB}, + {"trpadofb", CONTROL_VALUE, RTF_TRPADOFB}, + {"trpadofl", CONTROL_VALUE, RTF_TRPADOFL}, + {"trpadofr", CONTROL_VALUE, RTF_TRPADOFR}, + {"trpadoft", CONTROL_VALUE, RTF_TRPADOFT}, + {"trpadol", CONTROL_VALUE, RTF_TRPADOL}, + {"trpador", CONTROL_VALUE, RTF_TRPADOR}, + {"trpadot", CONTROL_VALUE, RTF_TRPADOT}, + {"trpat", CONTROL_VALUE, RTF_TRPAT}, + {"trqc", CONTROL_FLAG, RTF_TRQC}, + {"trql", CONTROL_FLAG, RTF_TRQL}, + {"trqr", CONTROL_FLAG, RTF_TRQR}, + {"trrh", CONTROL_VALUE, RTF_TRRH}, + {"trshdng", CONTROL_VALUE, RTF_TRSHDNG}, + {"trspdb", CONTROL_VALUE, RTF_TRSPDB}, + {"trspdfb", CONTROL_VALUE, RTF_TRSPDFB}, + {"trspdfl", CONTROL_VALUE, RTF_TRSPDFL}, + {"trspdfr", CONTROL_VALUE, RTF_TRSPDFR}, + {"trspdft", CONTROL_VALUE, RTF_TRSPDFT}, + {"trspdl", CONTROL_VALUE, RTF_TRSPDL}, + {"trspdr", CONTROL_VALUE, RTF_TRSPDR}, + {"trspdt", CONTROL_VALUE, RTF_TRSPDT}, + {"trspob", CONTROL_VALUE, RTF_TRSPOB}, + {"trspofb", CONTROL_VALUE, RTF_TRSPOFB}, + {"trspofl", CONTROL_VALUE, RTF_TRSPOFL}, + {"trspofr", CONTROL_VALUE, RTF_TRSPOFR}, + {"trspoft", CONTROL_VALUE, RTF_TRSPOFT}, + {"trspol", CONTROL_VALUE, RTF_TRSPOL}, + {"trspor", CONTROL_VALUE, RTF_TRSPOR}, + {"trspot", CONTROL_VALUE, RTF_TRSPOT}, + {"truncatefontheight", CONTROL_FLAG, RTF_TRUNCATEFONTHEIGHT}, + {"truncex", CONTROL_FLAG, RTF_TRUNCEX}, + {"trwWidthA", CONTROL_VALUE, RTF_TRWWIDTHA}, + {"trwWidthB", CONTROL_VALUE, RTF_TRWWIDTHB}, + {"trwWidth", CONTROL_VALUE, RTF_TRWWIDTH}, + {"ts", CONTROL_VALUE, RTF_TS}, + {"tsbgbdiag", CONTROL_FLAG, RTF_TSBGBDIAG}, + {"tsbgcross", CONTROL_FLAG, RTF_TSBGCROSS}, + {"tsbgdcross", CONTROL_FLAG, RTF_TSBGDCROSS}, + {"tsbgdkbdiag", CONTROL_FLAG, RTF_TSBGDKBDIAG}, + {"tsbgdkcross", CONTROL_FLAG, RTF_TSBGDKCROSS}, + {"tsbgdkdcross", CONTROL_FLAG, RTF_TSBGDKDCROSS}, + {"tsbgdkfdiag", CONTROL_FLAG, RTF_TSBGDKFDIAG}, + {"tsbgdkhor", CONTROL_FLAG, RTF_TSBGDKHOR}, + {"tsbgdkvert", CONTROL_FLAG, RTF_TSBGDKVERT}, + {"tsbgfdiag", CONTROL_FLAG, RTF_TSBGFDIAG}, + {"tsbghoriz", CONTROL_FLAG, RTF_TSBGHORIZ}, + {"tsbgvert", CONTROL_FLAG, RTF_TSBGVERT}, + {"tsbrdrb", CONTROL_FLAG, RTF_TSBRDRB}, + {"tsbrdrdgl", CONTROL_FLAG, RTF_TSBRDRDGL}, + {"tsbrdrdgr", CONTROL_FLAG, RTF_TSBRDRDGR}, + {"tsbrdrh", CONTROL_FLAG, RTF_TSBRDRH}, + {"tsbrdrl", CONTROL_FLAG, RTF_TSBRDRL}, + {"tsbrdrr", CONTROL_FLAG, RTF_TSBRDRR}, + {"tsbrdrt", CONTROL_FLAG, RTF_TSBRDRT}, + {"tsbrdrv", CONTROL_FLAG, RTF_TSBRDRV}, + {"tscbandhorzeven", CONTROL_FLAG, RTF_TSCBANDHORZEVEN}, + {"tscbandhorzodd", CONTROL_FLAG, RTF_TSCBANDHORZODD}, + {"tscbandsh", CONTROL_VALUE, RTF_TSCBANDSH}, + {"tscbandsv", CONTROL_VALUE, RTF_TSCBANDSV}, + {"tscbandverteven", CONTROL_FLAG, RTF_TSCBANDVERTEVEN}, + {"tscbandvertodd", CONTROL_FLAG, RTF_TSCBANDVERTODD}, + {"tscellcbpat", CONTROL_VALUE, RTF_TSCELLCBPAT}, + {"tscellcfpat", CONTROL_VALUE, RTF_TSCELLCFPAT}, + {"tscellpaddb", CONTROL_VALUE, RTF_TSCELLPADDB}, + {"tscellpaddfb", CONTROL_VALUE, RTF_TSCELLPADDFB}, + {"tscellpaddfl", CONTROL_VALUE, RTF_TSCELLPADDFL}, + {"tscellpaddfr", CONTROL_VALUE, RTF_TSCELLPADDFR}, + {"tscellpaddft", CONTROL_VALUE, RTF_TSCELLPADDFT}, + {"tscellpaddl", CONTROL_VALUE, RTF_TSCELLPADDL}, + {"tscellpaddr", CONTROL_VALUE, RTF_TSCELLPADDR}, + {"tscellpaddt", CONTROL_VALUE, RTF_TSCELLPADDT}, + {"tscellpct", CONTROL_VALUE, RTF_TSCELLPCT}, + {"tscellwidth", CONTROL_VALUE, RTF_TSCELLWIDTH}, + {"tscellwidthfts", CONTROL_VALUE, RTF_TSCELLWIDTHFTS}, + {"tscfirstcol", CONTROL_FLAG, RTF_TSCFIRSTCOL}, + {"tscfirstrow", CONTROL_FLAG, RTF_TSCFIRSTROW}, + {"tsclastcol", CONTROL_FLAG, RTF_TSCLASTCOL}, + {"tsclastrow", CONTROL_FLAG, RTF_TSCLASTROW}, + {"tscnecell", CONTROL_FLAG, RTF_TSCNECELL}, + {"tscnwcell", CONTROL_FLAG, RTF_TSCNWCELL}, + {"tscsecell", CONTROL_FLAG, RTF_TSCSECELL}, + {"tscswcell", CONTROL_FLAG, RTF_TSCSWCELL}, + {"tsd", CONTROL_FLAG, RTF_TSD}, + {"tsnowrap", CONTROL_FLAG, RTF_TSNOWRAP}, + {"tsrowd", CONTROL_FLAG, RTF_TSROWD}, + {"tsvertalb", CONTROL_FLAG, RTF_TSVERTALB}, + {"tsvertalc", CONTROL_FLAG, RTF_TSVERTALC}, + {"tsvertalt", CONTROL_FLAG, RTF_TSVERTALT}, + {"twoinone", CONTROL_VALUE, RTF_TWOINONE}, + {"twoonone", CONTROL_FLAG, RTF_TWOONONE}, + {"tx", CONTROL_VALUE, RTF_TX}, + {"txbxtwalways", CONTROL_FLAG, RTF_TXBXTWALWAYS}, + {"txbxtwfirst", CONTROL_FLAG, RTF_TXBXTWFIRST}, + {"txbxtwfirstlast", CONTROL_FLAG, RTF_TXBXTWFIRSTLAST}, + {"txbxtwlast", CONTROL_FLAG, RTF_TXBXTWLAST}, + {"txbxtwno", CONTROL_FLAG, RTF_TXBXTWNO}, + {"txe", CONTROL_DESTINATION, RTF_TXE}, + {"u", CONTROL_VALUE, RTF_U}, + {"uc", CONTROL_VALUE, RTF_UC}, + {"ud", CONTROL_DESTINATION, RTF_UD}, + {"ul", CONTROL_TOGGLE, RTF_UL}, + {"ulc", CONTROL_VALUE, RTF_ULC}, + {"uld", CONTROL_FLAG, RTF_ULD}, + {"uldash", CONTROL_TOGGLE, RTF_ULDASH}, + {"uldashd", CONTROL_TOGGLE, RTF_ULDASHD}, + {"uldashdd", CONTROL_TOGGLE, RTF_ULDASHDD}, + {"uldb", CONTROL_TOGGLE, RTF_ULDB}, + {"ulhair", CONTROL_TOGGLE, RTF_ULHAIR}, + {"ulhwave", CONTROL_TOGGLE, RTF_ULHWAVE}, + {"ulldash", CONTROL_TOGGLE, RTF_ULLDASH}, + {"ulnone", CONTROL_FLAG, RTF_ULNONE}, + {"ulth", CONTROL_TOGGLE, RTF_ULTH}, + {"ulthd", CONTROL_TOGGLE, RTF_ULTHD}, + {"ulthdash", CONTROL_TOGGLE, RTF_ULTHDASH}, + {"ulthdashd", CONTROL_TOGGLE, RTF_ULTHDASHD}, + {"ulthdashdd", CONTROL_TOGGLE, RTF_ULTHDASHDD}, + {"ulthldash", CONTROL_TOGGLE, RTF_ULTHLDASH}, + {"ululdbwave", CONTROL_TOGGLE, RTF_ULULDBWAVE}, + {"ulw", CONTROL_FLAG, RTF_ULW}, + {"ulwave", CONTROL_TOGGLE, RTF_ULWAVE}, + {"up", CONTROL_VALUE, RTF_UP}, + {"upr", CONTROL_DESTINATION, RTF_UPR}, + {"urtf", CONTROL_VALUE, RTF_URTF}, + {"useltbaln", CONTROL_FLAG, RTF_USELTBALN}, + {"usenormstyforlist", CONTROL_FLAG, RTF_USENORMSTYFORLIST}, + {"userprops", CONTROL_DESTINATION, RTF_USERPROPS}, + {"usexform", CONTROL_FLAG, RTF_USEXFORM}, + {"utinl", CONTROL_FLAG, RTF_UTINL}, + {"v", CONTROL_TOGGLE, RTF_V}, + {"validatexml", CONTROL_VALUE, RTF_VALIDATEXML}, + {"vern", CONTROL_VALUE, RTF_VERN}, + {"version", CONTROL_VALUE, RTF_VERSION}, + {"vertal", CONTROL_FLAG, RTF_VERTAL}, + {"vertalb", CONTROL_FLAG, RTF_VERTALB}, + {"vertalc", CONTROL_FLAG, RTF_VERTALC}, + {"vertalj", CONTROL_FLAG, RTF_VERTALJ}, + {"vertalt", CONTROL_FLAG, RTF_VERTALT}, + {"vertdoc", CONTROL_FLAG, RTF_VERTDOC}, + {"vertsect", CONTROL_FLAG, RTF_VERTSECT}, + {"viewbksp", CONTROL_VALUE, RTF_VIEWBKSP}, + {"viewkind", CONTROL_VALUE, RTF_VIEWKIND}, + {"viewnobound", CONTROL_FLAG, RTF_VIEWNOBOUND}, + {"viewscale", CONTROL_VALUE, RTF_VIEWSCALE}, + {"viewzk", CONTROL_VALUE, RTF_VIEWZK}, + {"wbitmap", CONTROL_VALUE, RTF_WBITMAP}, + {"wbmbitspixel", CONTROL_VALUE, RTF_WBMBITSPIXEL}, + {"wbmplanes", CONTROL_VALUE, RTF_WBMPLANES}, + {"wbmwidthbyte", CONTROL_VALUE, RTF_WBMWIDTHBYTE}, + {"webhidden", CONTROL_FLAG, RTF_WEBHIDDEN}, + {"wgrffmtfilter", CONTROL_DESTINATION, RTF_WGRFFMTFILTER}, + {"widctlpar", CONTROL_FLAG, RTF_WIDCTLPAR}, + {"widowctrl", CONTROL_FLAG, RTF_WIDOWCTRL}, + {"windowcaption", CONTROL_DESTINATION, RTF_WINDOWCAPTION}, + {"wmetafile", CONTROL_VALUE, RTF_WMETAFILE}, + {"wpeqn", CONTROL_FLAG, RTF_WPEQN}, + {"wpjst", CONTROL_FLAG, RTF_WPJST}, + {"wpsp", CONTROL_FLAG, RTF_WPSP}, + {"wraparound", CONTROL_FLAG, RTF_WRAPAROUND}, + {"wrapdefault", CONTROL_FLAG, RTF_WRAPDEFAULT}, + {"wrapthrough", CONTROL_FLAG, RTF_WRAPTHROUGH}, + {"wraptight", CONTROL_FLAG, RTF_WRAPTIGHT}, + {"wraptrsp", CONTROL_FLAG, RTF_WRAPTRSP}, + {"writereservation", CONTROL_DESTINATION, RTF_WRITERESERVATION}, + {"writereservhash", CONTROL_DESTINATION, RTF_WRITERESERVHASH}, + {"wrppunct", CONTROL_FLAG, RTF_WRPPUNCT}, + {"xe", CONTROL_DESTINATION, RTF_XE}, + {"xef", CONTROL_VALUE, RTF_XEF}, + {"xform", CONTROL_DESTINATION, RTF_XFORM}, + {"xmlattr", CONTROL_FLAG, RTF_XMLATTR}, + {"xmlattrname", CONTROL_DESTINATION, RTF_XMLATTRNAME}, + {"xmlattrns", CONTROL_VALUE, RTF_XMLATTRNS}, + {"xmlattrvalue", CONTROL_DESTINATION, RTF_XMLATTRVALUE}, + {"xmlclose", CONTROL_DESTINATION, RTF_XMLCLOSE}, + {"xmlname", CONTROL_DESTINATION, RTF_XMLNAME}, + {"xmlns", CONTROL_VALUE, RTF_XMLNS}, + {"xmlnstbl", CONTROL_DESTINATION, RTF_XMLNSTBL}, + {"xmlopen", CONTROL_DESTINATION, RTF_XMLOPEN}, + {"xmlsdttcell", CONTROL_FLAG, RTF_XMLSDTTCELL}, + {"xmlsdttpara", CONTROL_FLAG, RTF_XMLSDTTPARA}, + {"xmlsdttregular", CONTROL_FLAG, RTF_XMLSDTTREGULAR}, + {"xmlsdttrow", CONTROL_FLAG, RTF_XMLSDTTROW}, + {"xmlsdttunknown", CONTROL_FLAG, RTF_XMLSDTTUNKNOWN}, + {"yr", CONTROL_VALUE, RTF_YR}, + {"yts", CONTROL_VALUE, RTF_YTS}, + {"yxe", CONTROL_FLAG, RTF_YXE}, + {"zwbo", CONTROL_SYMBOL, RTF_ZWBO}, + {"zwj", CONTROL_SYMBOL, RTF_ZWJ}, + {"zwnbo", CONTROL_SYMBOL, RTF_ZWNBO}, + {"zwnj", CONTROL_SYMBOL, RTF_ZWNJ}, +}; +int nRTFControlWords = SAL_N_ELEMENTS(aRTFControlWords); + +} // namespace rtftok +} // namespace writerfilter + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfcontrolwords.hxx b/writerfilter/source/rtftok/rtfcontrolwords.hxx new file mode 100644 index 000000000000..a6c35312c19f --- /dev/null +++ b/writerfilter/source/rtftok/rtfcontrolwords.hxx @@ -0,0 +1,1854 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Miklos Vajna <vmiklos@frugalware.org> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef _RTFCONTROLWORDS_HXX_ +#define _RTFCONTROLWORDS_HXX_ + +namespace writerfilter { +namespace rtftok { + +enum RTFKeyword +{ + RTF_HEXCHAR, + RTF_OPTHYPH, + RTF_IGNORE, + RTF_SUBENTRY, + RTF_BACKSLASH, + RTF_NOBRKHYPH, + RTF_LBRACE, + RTF_FORMULA, + RTF_RBRACE, + RTF_NOBREAK, + RTF_AB, + RTF_ABSH, + RTF_ABSLOCK, + RTF_ABSNOOVRLP, + RTF_ABSW, + RTF_ACAPS, + RTF_ACCCIRCLE, + RTF_ACCCOMMA, + RTF_ACCDOT, + RTF_ACCNONE, + RTF_ACCUNDERDOT, + RTF_ACF, + RTF_ADEFF, + RTF_ADDITIVE, + RTF_ADEFLANG, + RTF_ADJUSTRIGHT, + RTF_ADN, + RTF_AENDDOC, + RTF_AENDNOTES, + RTF_AEXPND, + RTF_AF, + RTF_AFELEV, + RTF_AFS, + RTF_AFTNBJ, + RTF_AFTNCN, + RTF_AFTNNALC, + RTF_AFTNNAR, + RTF_AFTNNAUC, + RTF_AFTNNCHI, + RTF_AFTNNCHOSUNG, + RTF_AFTNNCNUM, + RTF_AFTNNDBAR, + RTF_AFTNNDBNUM, + RTF_AFTNNDBNUMD, + RTF_AFTNNDBNUMK, + RTF_AFTNNDBNUMT, + RTF_AFTNNGANADA, + RTF_AFTNNGBNUM, + RTF_AFTNNGBNUMD, + RTF_AFTNNGBNUMK, + RTF_AFTNNGBNUML, + RTF_AFTNNRLC, + RTF_AFTNNRUC, + RTF_AFTNNZODIAC, + RTF_AFTNNZODIACD, + RTF_AFTNNZODIACL, + RTF_AFTNRESTART, + RTF_AFTNRSTCONT, + RTF_AFTNSEP, + RTF_AFTNSEPC, + RTF_AFTNSTART, + RTF_AFTNTJ, + RTF_AI, + RTF_ALANG, + RTF_ALLOWFIELDENDSEL, + RTF_ALLPROT, + RTF_ALNTBLIND, + RTF_ALT, + RTF_ANIMTEXT, + RTF_ANNOTATION, + RTF_ANNOTPROT, + RTF_ANSI, + RTF_ANSICPG, + RTF_AOUTL, + RTF_APPLYBRKRULES, + RTF_ASCAPS, + RTF_ASHAD, + RTF_ASIANBRKRULE, + RTF_ASPALPHA, + RTF_ASPNUM, + RTF_ASTRIKE, + RTF_ATNAUTHOR, + RTF_ATNDATE, + RTF_ATNICN, + RTF_ATNID, + RTF_ATNPARENT, + RTF_ATNREF, + RTF_ATNTIME, + RTF_ATRFEND, + RTF_ATRFSTART, + RTF_AUL, + RTF_AULD, + RTF_AULDB, + RTF_AULNONE, + RTF_AULW, + RTF_AUP, + RTF_AUTHOR, + RTF_AUTOFMTOVERRIDE, + RTF_B, + RTF_BACKGROUND, + RTF_BDBFHDR, + RTF_BDRRLSWSIX, + RTF_BGBDIAG, + RTF_BGCROSS, + RTF_BGDCROSS, + RTF_BGDKBDIAG, + RTF_BGDKCROSS, + RTF_BGDKDCROSS, + RTF_BGDKFDIAG, + RTF_BGDKHORIZ, + RTF_BGDKVERT, + RTF_BGFDIAG, + RTF_BGHORIZ, + RTF_BGVERT, + RTF_BIN, + RTF_BINFSXN, + RTF_BINSXN, + RTF_BKMKCOLF, + RTF_BKMKCOLL, + RTF_BKMKEND, + RTF_BKMKPUB, + RTF_BKMKSTART, + RTF_BLIPTAG, + RTF_BLIPUID, + RTF_BLIPUPI, + RTF_BLUE, + RTF_BOOKFOLD, + RTF_BOOKFOLDREV, + RTF_BOOKFOLDSHEETS, + RTF_BOX, + RTF_BRDRART, + RTF_BRDRB, + RTF_BRDRBAR, + RTF_BRDRBTW, + RTF_BRDRCF, + RTF_BRDRDASH, + RTF_BRDRDASHD, + RTF_BRDRDASHDD, + RTF_BRDRDASHDOT, + RTF_BRDRDASHDOTDOT, + RTF_BRDRDASHDOTSTR, + RTF_BRDRDASHSM, + RTF_BRDRDB, + RTF_BRDRDOT, + RTF_BRDREMBOSS, + RTF_BRDRENGRAVE, + RTF_BRDRFRAME, + RTF_BRDRHAIR, + RTF_BRDRINSET, + RTF_BRDRL, + RTF_BRDRNIL, + RTF_BRDRNONE, + RTF_BRDROUTSET, + RTF_BRDRR, + RTF_BRDRS, + RTF_BRDRSH, + RTF_BRDRT, + RTF_BRDRTBL, + RTF_BRDRTH, + RTF_BRDRTHTNLG, + RTF_BRDRTHTNMG, + RTF_BRDRTHTNSG, + RTF_BRDRTNTHLG, + RTF_BRDRTNTHMG, + RTF_BRDRTNTHSG, + RTF_BRDRTNTHTNLG, + RTF_BRDRTNTHTNMG, + RTF_BRDRTNTHTNSG, + RTF_BRDRTRIPLE, + RTF_BRDRW, + RTF_BRDRWAVY, + RTF_BRDRWAVYDB, + RTF_BRKFRM, + RTF_BRSP, + RTF_BULLET, + RTF_BUPTIM, + RTF_BXE, + RTF_CACCENTFIVE, + RTF_CACCENTFOUR, + RTF_CACCENTONE, + RTF_CACCENTSIX, + RTF_CACCENTTHREE, + RTF_CACCENTTWO, + RTF_CACHEDCOLBAL, + RTF_CAPS, + RTF_CATEGORY, + RTF_CB, + RTF_CBACKGROUNDONE, + RTF_CBACKGROUNDTWO, + RTF_CBPAT, + RTF_CCHS, + RTF_CELL, + RTF_CELLX, + RTF_CF, + RTF_CFOLLOWEDHYPERLINK, + RTF_CFPAT, + RTF_CGRID, + RTF_CHARRSID, + RTF_CHARSCALEX, + RTF_CHATN, + RTF_CHBGBDIAG, + RTF_CHBGCROSS, + RTF_CHBGDCROSS, + RTF_CHBGDKBDIAG, + RTF_CHBGDKCROSS, + RTF_CHBGDKDCROSS, + RTF_CHBGDKFDIAG, + RTF_CHBGDKHORIZ, + RTF_CHBGDKVERT, + RTF_CHBGFDIAG, + RTF_CHBGHORIZ, + RTF_CHBGVERT, + RTF_CHBRDR, + RTF_CHCBPAT, + RTF_CHCFPAT, + RTF_CHDATE, + RTF_CHDPA, + RTF_CHDPL, + RTF_CHFTN, + RTF_CHFTNSEP, + RTF_CHFTNSEPC, + RTF_CHPGN, + RTF_CHHRES, + RTF_CHSHDNG, + RTF_CHTIME, + RTF_CHYPERLINK, + RTF_CLBGBDIAG, + RTF_CLBGCROSS, + RTF_CLBGDCROSS, + RTF_CLBGDKBDIAG, + RTF_CLBGDKCROSS, + RTF_CLBGDKDCROSS, + RTF_CLBGDKFDIAG, + RTF_CLBGDKHOR, + RTF_CLBGDKVERT, + RTF_CLBGFDIAG, + RTF_CLBGHORIZ, + RTF_CLBGVERT, + RTF_CLBRDRB, + RTF_CLBRDRL, + RTF_CLBRDRR, + RTF_CLBRDRT, + RTF_CLCBPAT, + RTF_CLCBPATRAW, + RTF_CLCFPAT, + RTF_CLCFPATRAW, + RTF_CLDEL, + RTF_CLDELAUTH, + RTF_CLDELDTTM, + RTF_CLDGLL, + RTF_CLDGLU, + RTF_CLFITTEXT, + RTF_CLFTSWIDTH, + RTF_CLHIDEMARK, + RTF_CLINS, + RTF_CLINSAUTH, + RTF_CLINSDTTM, + RTF_CLMGF, + RTF_CLMRG, + RTF_CLMRGD, + RTF_CLMRGDAUTH, + RTF_CLMRGDDTTM, + RTF_CLMRGDR, + RTF_CLNOWRAP, + RTF_CLPADB, + RTF_CLPADFB, + RTF_CLPADFL, + RTF_CLPADFR, + RTF_CLPADFT, + RTF_CLPADL, + RTF_CLPADR, + RTF_CLPADT, + RTF_CLSPB, + RTF_CLSPFB, + RTF_CLSPFL, + RTF_CLSPFR, + RTF_CLSPFT, + RTF_CLSPL, + RTF_CLSPR, + RTF_CLSPT, + RTF_CLSHDNG, + RTF_CLSHDNGRAW, + RTF_CLSHDRAWNIL, + RTF_CLSPLIT, + RTF_CLSPLITR, + RTF_CLTXBTLR, + RTF_CLTXLRTB, + RTF_CLTXLRTBV, + RTF_CLTXTBRL, + RTF_CLTXTBRLV, + RTF_CLVERTALB, + RTF_CLVERTALC, + RTF_CLVERTALT, + RTF_CLVMGF, + RTF_CLVMRG, + RTF_CLWWIDTH, + RTF_CMAINDARKONE, + RTF_CMAINDARKTWO, + RTF_CMAINLIGHTONE, + RTF_CMAINLIGHTTWO, + RTF_COLLAPSED, + RTF_COLNO, + RTF_COLORSCHEMEMAPPING, + RTF_COLORTBL, + RTF_COLS, + RTF_COLSR, + RTF_COLSX, + RTF_COLUMN, + RTF_COLW, + RTF_COMMENT, + RTF_COMPANY, + RTF_CONTEXTUALSPACE, + RTF_CPG, + RTF_CRAUTH, + RTF_CRDATE, + RTF_CREATIM, + RTF_CS, + RTF_CSHADE, + RTF_CTEXTONE, + RTF_CTEXTTWO, + RTF_CTINT, + RTF_CTRL, + RTF_CTS, + RTF_CUFI, + RTF_CULI, + RTF_CURI, + RTF_CVMME, + RTF_DATAFIELD, + RTF_DATASTORE, + RTF_DATE, + RTF_DBCH, + RTF_DEFCHP, + RTF_DEFF, + RTF_DEFFORMAT, + RTF_DEFLANG, + RTF_DEFLANGFE, + RTF_DEFPAP, + RTF_DEFSHP, + RTF_DEFTAB, + RTF_DELETED, + RTF_DELRSID, + RTF_DFRAUTH, + RTF_DFRDATE, + RTF_DFRMTXTX, + RTF_DFRMTXTY, + RTF_DFRSTART, + RTF_DFRSTOP, + RTF_DFRXST, + RTF_DGHORIGIN, + RTF_DGHSHOW, + RTF_DGHSPACE, + RTF_DGMARGIN, + RTF_DGSNAP, + RTF_DGVORIGIN, + RTF_DGVSHOW, + RTF_DGVSPACE, + RTF_DIBITMAP, + RTF_DISABLED, + RTF_DN, + RTF_DNTBLNSBDB, + RTF_DO, + RTF_DOBXCOLUMN, + RTF_DOBXMARGIN, + RTF_DOBXPAGE, + RTF_DOBYMARGIN, + RTF_DOBYPAGE, + RTF_DOBYPARA, + RTF_DOCCOMM, + RTF_DOCTEMP, + RTF_DOCTYPE, + RTF_DOCVAR, + RTF_DODHGT, + RTF_DOLOCK, + RTF_DONOTEMBEDLINGDATA, + RTF_DONOTEMBEDSYSFONT, + RTF_DONOTSHOWCOMMENTS, + RTF_DONOTSHOWINSDEL, + RTF_DONOTSHOWMARKUP, + RTF_DONOTSHOWPROPS, + RTF_DPAENDHOL, + RTF_DPAENDL, + RTF_DPAENDSOL, + RTF_DPAENDW, + RTF_DPARC, + RTF_DPARCFLIPX, + RTF_DPARCFLIPY, + RTF_DPASTARTHOL, + RTF_DPASTARTL, + RTF_DPASTARTSOL, + RTF_DPASTARTW, + RTF_DPCALLOUT, + RTF_DPCOA, + RTF_DPCOACCENT, + RTF_DPCOBESTFIT, + RTF_DPCOBORDER, + RTF_DPCODABS, + RTF_DPCODBOTTOM, + RTF_DPCODCENTER, + RTF_DPCODESCENT, + RTF_DPCODTOP, + RTF_DPCOLENGTH, + RTF_DPCOMINUSX, + RTF_DPCOMINUSY, + RTF_DPCOOFFSET, + RTF_DPCOSMARTA, + RTF_DPCOTDOUBLE, + RTF_DPCOTRIGHT, + RTF_DPCOTSINGLE, + RTF_DPCOTTRIPLE, + RTF_DPCOUNT, + RTF_DPELLIPSE, + RTF_DPENDGROUP, + RTF_DPFILLBGCB, + RTF_DPFILLBGCG, + RTF_DPFILLBGCR, + RTF_DPFILLBGGRAY, + RTF_DPFILLBGPAL, + RTF_DPFILLFGCB, + RTF_DPFILLFGCG, + RTF_DPFILLFGCR, + RTF_DPFILLFGGRAY, + RTF_DPFILLFGPAL, + RTF_DPFILLPAT, + RTF_DPGROUP, + RTF_DPLINE, + RTF_DPLINECOB, + RTF_DPLINECOG, + RTF_DPLINECOR, + RTF_DPLINEDADO, + RTF_DPLINEDADODO, + RTF_DPLINEDASH, + RTF_DPLINEDOT, + RTF_DPLINEGRAY, + RTF_DPLINEHOLLOW, + RTF_DPLINEPAL, + RTF_DPLINESOLID, + RTF_DPLINEW, + RTF_DPPOLYCOUNT, + RTF_DPPOLYGON, + RTF_DPPOLYLINE, + RTF_DPPTX, + RTF_DPPTY, + RTF_DPRECT, + RTF_DPROUNDR, + RTF_DPSHADOW, + RTF_DPSHADX, + RTF_DPSHADY, + RTF_DPTXBTLR, + RTF_DPTXBX, + RTF_DPTXBXMAR, + RTF_DPTXBXTEXT, + RTF_DPTXLRTB, + RTF_DPTXLRTBV, + RTF_DPTXTBRL, + RTF_DPTXTBRLV, + RTF_DPX, + RTF_DPXSIZE, + RTF_DPY, + RTF_DPYSIZE, + RTF_DROPCAPLI, + RTF_DROPCAPT, + RTF_DS, + RTF_DXFRTEXT, + RTF_DY, + RTF_EBCEND, + RTF_EBCSTART, + RTF_EDMINS, + RTF_EMBO, + RTF_EMDASH, + RTF_EMFBLIP, + RTF_EMSPACE, + RTF_ENDASH, + RTF_ENDDOC, + RTF_ENDNHERE, + RTF_ENDNOTES, + RTF_ENFORCEPROT, + RTF_ENSPACE, + RTF_EXPND, + RTF_EXPNDTW, + RTF_EXPSHRTN, + RTF_F, + RTF_FAAUTO, + RTF_FACENTER, + RTF_FACINGP, + RTF_FACTOIDNAME, + RTF_FAFIXED, + RTF_FAHANG, + RTF_FALT, + RTF_FAROMAN, + RTF_FAVAR, + RTF_FBIAS, + RTF_FBIDI, + RTF_FBIDIS, + RTF_FBIMAJOR, + RTF_FBIMINOR, + RTF_FCHARS, + RTF_FCHARSET, + RTF_FCS, + RTF_FDBMAJOR, + RTF_FDBMINOR, + RTF_FDECOR, + RTF_FELNBRELEV, + RTF_FET, + RTF_FETCH, + RTF_FFDEFRES, + RTF_FFDEFTEXT, + RTF_FFENTRYMCR, + RTF_FFEXITMCR, + RTF_FFFORMAT, + RTF_FFHASLISTBOX, + RTF_FFHELPTEXT, + RTF_FFHPS, + RTF_FFL, + RTF_FFMAXLEN, + RTF_FFNAME, + RTF_FFOWNHELP, + RTF_FFOWNSTAT, + RTF_FFPROT, + RTF_FFRECALC, + RTF_FFRES, + RTF_FFSIZE, + RTF_FFSTATTEXT, + RTF_FFTYPE, + RTF_FFTYPETXT, + RTF_FHIMAJOR, + RTF_FHIMINOR, + RTF_FI, + RTF_FID, + RTF_FIELD, + RTF_FILE, + RTF_FILETBL, + RTF_FITTEXT, + RTF_FJGOTHIC, + RTF_FJMINCHOU, + RTF_FLDALT, + RTF_FLDDIRTY, + RTF_FLDEDIT, + RTF_FLDINST, + RTF_FLDLOCK, + RTF_FLDPRIV, + RTF_FLDRSLT, + RTF_FLDTYPE, + RTF_FLOMAJOR, + RTF_FLOMINOR, + RTF_FMODERN, + RTF_FN, + RTF_FNAME, + RTF_FNETWORK, + RTF_FNIL, + RTF_FNONFILESYS, + RTF_FONTEMB, + RTF_FONTFILE, + RTF_FONTTBL, + RTF_FOOTER, + RTF_FOOTERF, + RTF_FOOTERL, + RTF_FOOTERR, + RTF_FOOTERY, + RTF_FOOTNOTE, + RTF_FORCEUPGRADE, + RTF_FORMDISP, + RTF_FORMFIELD, + RTF_FORMPROT, + RTF_FORMSHADE, + RTF_FOSNUM, + RTF_FPRQ, + RTF_FRACWIDTH, + RTF_FRELATIVE, + RTF_FRMTXBTLR, + RTF_FRMTXLRTB, + RTF_FRMTXLRTBV, + RTF_FRMTXTBRL, + RTF_FRMTXTBRLV, + RTF_FROMAN, + RTF_FROMHTML, + RTF_FROMTEXT, + RTF_FS, + RTF_FSCRIPT, + RTF_FSWISS, + RTF_FTECH, + RTF_FTNALT, + RTF_FTNBJ, + RTF_FTNCN, + RTF_FTNIL, + RTF_FTNLYTWNINE, + RTF_FTNNALC, + RTF_FTNNAR, + RTF_FTNNAUC, + RTF_FTNNCHI, + RTF_FTNNCHOSUNG, + RTF_FTNNCNUM, + RTF_FTNNDBAR, + RTF_FTNNDBNUM, + RTF_FTNNDBNUMD, + RTF_FTNNDBNUMK, + RTF_FTNNDBNUMT, + RTF_FTNNGANADA, + RTF_FTNNGBNUM, + RTF_FTNNGBNUMD, + RTF_FTNNGBNUMK, + RTF_FTNNGBNUML, + RTF_FTNNRLC, + RTF_FTNNRUC, + RTF_FTNNZODIAC, + RTF_FTNNZODIACD, + RTF_FTNNZODIACL, + RTF_FTNRESTART, + RTF_FTNRSTCONT, + RTF_FTNRSTPG, + RTF_FTNSEP, + RTF_FTNSEPC, + RTF_FTNSTART, + RTF_FTNTJ, + RTF_FTTRUETYPE, + RTF_FVALIDDOS, + RTF_FVALIDHPFS, + RTF_FVALIDMAC, + RTF_FVALIDNTFS, + RTF_G, + RTF_GCW, + RTF_GENERATOR, + RTF_GREEN, + RTF_GRFDOCEVENTS, + RTF_GRIDTBL, + RTF_GUTTER, + RTF_GUTTERPRL, + RTF_GUTTERSXN, + RTF_HEADER, + RTF_HEADERF, + RTF_HEADERL, + RTF_HEADERR, + RTF_HEADERY, + RTF_HICH, + RTF_HIGHLIGHT, + RTF_HL, + RTF_HLFR, + RTF_HLINKBASE, + RTF_HLLOC, + RTF_HLSRC, + RTF_HORZDOC, + RTF_HORZSECT, + RTF_HORZVERT, + RTF_HR, + RTF_HRES, + RTF_HRULE, + RTF_HSV, + RTF_HTMAUTSP, + RTF_HTMLBASE, + RTF_HTMLRTF, + RTF_HTMLTAG, + RTF_HWELEV, + RTF_HYPHAUTO, + RTF_HYPHCAPS, + RTF_HYPHCONSEC, + RTF_HYPHHOTZ, + RTF_HYPHPAR, + RTF_I, + RTF_ID, + RTF_IGNOREMIXEDCONTENT, + RTF_ILFOMACATCLNUP, + RTF_ILVL, + RTF_IMPR, + RTF_INDMIRROR, + RTF_INDRLSWELEVEN, + RTF_INFO, + RTF_INSRSID, + RTF_INTBL, + RTF_IPGP, + RTF_IROWBAND, + RTF_IROW, + RTF_ITAP, + RTF_IXE, + RTF_JCOMPRESS, + RTF_JEXPAND, + RTF_JIS, + RTF_JPEGBLIP, + RTF_JSKSU, + RTF_KEEP, + RTF_KEEPN, + RTF_KERNING, + RTF_KEYCODE, + RTF_KEYWORDS, + RTF_KRNPRSNET, + RTF_KSULANG, + RTF_JCLISTTAB, + RTF_LANDSCAPE, + RTF_LANG, + RTF_LANGFE, + RTF_LANGFENP, + RTF_LANGNP, + RTF_LASTROW, + RTF_LATENTSTYLES, + RTF_LBR, + RTF_LCHARS, + RTF_LDBLQUOTE, + RTF_LEVEL, + RTF_LEVELFOLLOW, + RTF_LEVELINDENT, + RTF_LEVELJC, + RTF_LEVELJCN, + RTF_LEVELLEGAL, + RTF_LEVELNFC, + RTF_LEVELNFCN, + RTF_LEVELNORESTART, + RTF_LEVELNUMBERS, + RTF_LEVELOLD, + RTF_LEVELPICTURE, + RTF_LEVELPICTURENOSIZE, + RTF_LEVELPREV, + RTF_LEVELPREVSPACE, + RTF_LEVELSPACE, + RTF_LEVELSTARTAT, + RTF_LEVELTEMPLATEID, + RTF_LEVELTEXT, + RTF_LFOLEVEL, + RTF_LI, + RTF_LINE, + RTF_LINEBETCOL, + RTF_LINECONT, + RTF_LINEMOD, + RTF_LINEPPAGE, + RTF_LINERESTART, + RTF_LINESTART, + RTF_LINESTARTS, + RTF_LINEX, + RTF_LINKSELF, + RTF_LINKSTYLES, + RTF_LINKVAL, + RTF_LIN, + RTF_LISA, + RTF_LISB, + RTF_LIST, + RTF_LISTHYBRID, + RTF_LISTID, + RTF_LISTLEVEL, + RTF_LISTNAME, + RTF_LISTOVERRIDE, + RTF_LISTOVERRIDECOUNT, + RTF_LISTOVERRIDEFORMAT, + RTF_LISTOVERRIDESTARTAT, + RTF_LISTOVERRIDETABLE, + RTF_LISTPICTURE, + RTF_LISTRESTARTHDN, + RTF_LISTSIMPLE, + RTF_LISTSTYLEID, + RTF_LISTSTYLENAME, + RTF_LISTTABLE, + RTF_LISTTEMPLATEID, + RTF_LISTTEXT, + RTF_LNBRKRULE, + RTF_LNDSCPSXN, + RTF_LNONGRID, + RTF_LOCH, + RTF_LQUOTE, + RTF_LS, + RTF_LSDLOCKED, + RTF_LSDLOCKEDDEF, + RTF_LSDLOCKEDEXCEPT, + RTF_LSDPRIORITY, + RTF_LSDPRIORITYDEF, + RTF_LSDQFORMAT, + RTF_LSDQFORMATDEF, + RTF_LSDSEMIHIDDEN, + RTF_LSDSEMIHIDDENDEF, + RTF_LSDSTIMAX, + RTF_LSDUNHIDEUSED, + RTF_LSDUNHIDEUSEDDEF, + RTF_LTRCH, + RTF_LTRDOC, + RTF_LTRMARK, + RTF_LTRPAR, + RTF_LTRROW, + RTF_LTRSECT, + RTF_LVLTENTATIVE, + RTF_LYTCALCTBLWD, + RTF_LYTEXCTTP, + RTF_LYTPRTMET, + RTF_LYTTBLRTGR, + RTF_MAC, + RTF_MACC, + RTF_MACCPR, + RTF_MACPICT, + RTF_MAILMERGE, + RTF_MAKEBACKUP, + RTF_MALN, + RTF_MALNSCR, + RTF_MANAGER, + RTF_MARGB, + RTF_MARGBSXN, + RTF_MARGL, + RTF_MARGLSXN, + RTF_MARGMIRROR, + RTF_MARGMIRSXN, + RTF_MARGPR, + RTF_MARGR, + RTF_MARGRSXN, + RTF_MARGSZ, + RTF_MARGT, + RTF_MARGTSXN, + RTF_MBAR, + RTF_MBARPR, + RTF_MBASEJC, + RTF_MBEGCHR, + RTF_MBORDERBOX, + RTF_MBORDERBOXPR, + RTF_MBOX, + RTF_MBOXPR, + RTF_MBRK, + RTF_MBRKBIN, + RTF_MBRKBINSUB, + RTF_MCGP, + RTF_MCGPRULE, + RTF_MCHR, + RTF_MCOUNT, + RTF_MCSP, + RTF_MCTRLPR, + RTF_MD, + RTF_MDEFJC, + RTF_MDEG, + RTF_MDEGHIDE, + RTF_MDEN, + RTF_MDIFF, + RTF_MDIFFSTY, + RTF_MDISPDEF, + RTF_MDPR, + RTF_ME, + RTF_MENDCHR, + RTF_MEQARR, + RTF_MEQARRPR, + RTF_MF, + RTF_MFNAME, + RTF_MFPR, + RTF_MFUNC, + RTF_MFUNCPR, + RTF_MGROUPCHR, + RTF_MGROUPCHRPR, + RTF_MGROW, + RTF_MHIDEBOT, + RTF_MHIDELEFT, + RTF_MHIDERIGHT, + RTF_MHIDETOP, + RTF_MHTMLTAG, + RTF_MIN, + RTF_MINTERSP, + RTF_MINTLIM, + RTF_MINTRASP, + RTF_MJC, + RTF_MLIM, + RTF_MLIMLOC, + RTF_MLIMLOW, + RTF_MLIMLOWPR, + RTF_MLIMUPP, + RTF_MLIMUPPPR, + RTF_MLIT, + RTF_MLMARGIN, + RTF_MM, + RTF_MMADDFIELDNAME, + RTF_MMATH, + RTF_MMATHFONT, + RTF_MMATHPICT, + RTF_MMATHPR, + RTF_MMATTACH, + RTF_MMAXDIST, + RTF_MMBLANKLINES, + RTF_MMC, + RTF_MMCJC, + RTF_MMCONNECTSTR, + RTF_MMCONNECTSTRDATA, + RTF_MMCPR, + RTF_MMCS, + RTF_MMDATASOURCE, + RTF_MMDATATYPEACCESS, + RTF_MMDATATYPEEXCEL, + RTF_MMDATATYPEFILE, + RTF_MMDATATYPEODBC, + RTF_MMDATATYPEODSO, + RTF_MMDATATYPEQT, + RTF_MMDEFAULTSQL, + RTF_MMDESTEMAIL, + RTF_MMDESTFAX, + RTF_MMDESTNEWDOC, + RTF_MMDESTPRINTER, + RTF_MMERRORS, + RTF_MMFTTYPEADDRESS, + RTF_MMFTTYPEBARCODE, + RTF_MMFTTYPEDBCOLUMN, + RTF_MMFTTYPEMAPPED, + RTF_MMFTTYPENULL, + RTF_MMFTTYPESALUTATION, + RTF_MMHEADERSOURCE, + RTF_MMJDSOTYPE, + RTF_MMLINKTOQUERY, + RTF_MMMAILSUBJECT, + RTF_MMMAINTYPECATALOG, + RTF_MMMAINTYPEEMAIL, + RTF_MMMAINTYPEENVELOPES, + RTF_MMMAINTYPEFAX, + RTF_MMMAINTYPELABELS, + RTF_MMMAINTYPELETTERS, + RTF_MMODSO, + RTF_MMODSOACTIVE, + RTF_MMODSOCOLDELIM, + RTF_MMODSOCOLUMN, + RTF_MMODSODYNADDR, + RTF_MMODSOFHDR, + RTF_MMODSOFILTER, + RTF_MMODSOFLDMPDATA, + RTF_MMODSOFMCOLUMN, + RTF_MMODSOHASH, + RTF_MMODSOLID, + RTF_MMODSOMAPPEDNAME, + RTF_MMODSONAME, + RTF_MMODSORECIPDATA, + RTF_MMODSOSORT, + RTF_MMODSOSRC, + RTF_MMODSOTABLE, + RTF_MMODSOUDL, + RTF_MMODSOUDLDATA, + RTF_MMODSOUNIQUETAG, + RTF_MMPR, + RTF_MMQUERY, + RTF_MMR, + RTF_MMRECCUR, + RTF_MMSHOWDATA, + RTF_MNARY, + RTF_MNARYLIM, + RTF_MNARYPR, + RTF_MNOBREAK, + RTF_MNOR, + RTF_MNUM, + RTF_MO, + RTF_MOBJDIST, + RTF_MOMATH, + RTF_MOMATHPARA, + RTF_MOMATHPARAPR, + RTF_MOPEMU, + RTF_MPHANT, + RTF_MPHANTPR, + RTF_MPLCHIDE, + RTF_MPOS, + RTF_MPOSTSP, + RTF_MPRESP, + RTF_MR, + RTF_MRAD, + RTF_MRADPR, + RTF_MRMARGIN, + RTF_MRPR, + RTF_MRSP, + RTF_MRSPRULE, + RTF_MSCR, + RTF_MSEPCHR, + RTF_MSHOW, + RTF_MSHP, + RTF_MSMALLFRAC, + RTF_MSMCAP, + RTF_MSPRE, + RTF_MSPREPR, + RTF_MSSUB, + RTF_MSSUBPR, + RTF_MSSUBSUP, + RTF_MSSUBSUPPR, + RTF_MSSUP, + RTF_MSSUPPR, + RTF_MSTRIKEBLTR, + RTF_MSTRIKEH, + RTF_MSTRIKETLBR, + RTF_MSTRIKEV, + RTF_MSTY, + RTF_MSUB, + RTF_MSUBHIDE, + RTF_MSUP, + RTF_MSUPHIDE, + RTF_MTRANSP, + RTF_MTYPE, + RTF_MUSER, + RTF_MVAUTH, + RTF_MVDATE, + RTF_MVERTJC, + RTF_MVF, + RTF_MVFMF, + RTF_MVFML, + RTF_MVT, + RTF_MVTOF, + RTF_MVTOL, + RTF_MWRAPINDENT, + RTF_MWRAPRIGHT, + RTF_MZEROASC, + RTF_MZERODESC, + RTF_MZEROWID, + RTF_NESTCELL, + RTF_NESTROW, + RTF_NESTTABLEPROPS, + RTF_NEWTBLSTYRULS, + RTF_NEXTFILE, + RTF_NOAFCNSTTBL, + RTF_NOBRKWRPTBL, + RTF_NOCOLBAL, + RTF_NOCOMPATOPTIONS, + RTF_NOCWRAP, + RTF_NOCXSPTABLE, + RTF_NOEXTRASPRL, + RTF_NOFCHARS, + RTF_NOFCHARSWS, + RTF_NOFEATURETHROTTLE, + RTF_NOFPAGES, + RTF_NOFWORDS, + RTF_NOGROWAUTOFIT, + RTF_NOINDNMBRTS, + RTF_NOJKERNPUNCT, + RTF_NOLEAD, + RTF_NOLINE, + RTF_NOLNHTADJTBL, + RTF_NONESTTABLES, + RTF_NONSHPPICT, + RTF_NOOVERFLOW, + RTF_NOPROOF, + RTF_NOQFPROMOTE, + RTF_NOSECTEXPAND, + RTF_NOSNAPLINEGRID, + RTF_NOSPACEFORUL, + RTF_NOSUPERSUB, + RTF_NOTABIND, + RTF_NOTBRKCNSTFRCTBL, + RTF_NOTCVASP, + RTF_NOTVATXBX, + RTF_NOUICOMPAT, + RTF_NOULTRLSPC, + RTF_NOWIDCTLPAR, + RTF_NOWRAP, + RTF_NOWWRAP, + RTF_NOXLATTOYEN, + RTF_OBJALIAS, + RTF_OBJALIGN, + RTF_OBJATTPH, + RTF_OBJAUTLINK, + RTF_OBJCLASS, + RTF_OBJCROPB, + RTF_OBJCROPL, + RTF_OBJCROPR, + RTF_OBJCROPT, + RTF_OBJDATA, + RTF_OBJECT, + RTF_OBJEMB, + RTF_OBJH, + RTF_OBJHTML, + RTF_OBJICEMB, + RTF_OBJLINK, + RTF_OBJLOCK, + RTF_OBJNAME, + RTF_OBJOCX, + RTF_OBJPUB, + RTF_OBJSCALEX, + RTF_OBJSCALEY, + RTF_OBJSECT, + RTF_OBJSETSIZE, + RTF_OBJSUB, + RTF_OBJTIME, + RTF_OBJTRANSY, + RTF_OBJUPDATE, + RTF_OBJW, + RTF_OGUTTER, + RTF_OLDAS, + RTF_OLDCPROPS, + RTF_OLDLINEWRAP, + RTF_OLDPPROPS, + RTF_OLDSPROPS, + RTF_OLDTPROPS, + RTF_OLECLSID, + RTF_OPERATOR, + RTF_OTBLRUL, + RTF_OUTL, + RTF_OUTLINELEVEL, + RTF_OVERLAY, + RTF_PAGE, + RTF_PAGEBB, + RTF_PANOSE, + RTF_PAPERH, + RTF_PAPERW, + RTF_PAR, + RTF_PARARSID, + RTF_PARD, + RTF_PASSWORD, + RTF_PASSWORDHASH, + RTF_PC, + RTF_PCA, + RTF_PGBRDRB, + RTF_PGBRDRFOOT, + RTF_PGBRDRHEAD, + RTF_PGBRDRL, + RTF_PGBRDROPT, + RTF_PGBRDRR, + RTF_PGBRDRSNAP, + RTF_PGBRDRT, + RTF_PGHSXN, + RTF_PGNBIDIA, + RTF_PGNBIDIB, + RTF_PGNCHOSUNG, + RTF_PGNCNUM, + RTF_PGNCONT, + RTF_PGNDBNUM, + RTF_PGNDBNUMD, + RTF_PGNDBNUMK, + RTF_PGNDBNUMT, + RTF_PGNDEC, + RTF_PGNDECD, + RTF_PGNGANADA, + RTF_PGNGBNUM, + RTF_PGNGBNUMD, + RTF_PGNGBNUMK, + RTF_PGNGBNUML, + RTF_PGNHINDIA, + RTF_PGNHINDIB, + RTF_PGNHINDIC, + RTF_PGNHINDID, + RTF_PGNHN, + RTF_PGNHNSC, + RTF_PGNHNSH, + RTF_PGNHNSM, + RTF_PGNHNSN, + RTF_PGNHNSP, + RTF_PGNID, + RTF_PGNLCLTR, + RTF_PGNLCRM, + RTF_PGNRESTART, + RTF_PGNSTART, + RTF_PGNSTARTS, + RTF_PGNTHAIA, + RTF_PGNTHAIB, + RTF_PGNTHAIC, + RTF_PGNUCLTR, + RTF_PGNUCRM, + RTF_PGNVIETA, + RTF_PGNX, + RTF_PGNY, + RTF_PGNZODIAC, + RTF_PGNZODIACD, + RTF_PGNZODIACL, + RTF_PGP, + RTF_PGPTBL, + RTF_PGWSXN, + RTF_PHCOL, + RTF_PHMRG, + RTF_PHPG, + RTF_PICBMP, + RTF_PICBPP, + RTF_PICCROPB, + RTF_PICCROPL, + RTF_PICCROPR, + RTF_PICCROPT, + RTF_PICH, + RTF_PICHGOAL, + RTF_PICPROP, + RTF_PICSCALED, + RTF_PICSCALEX, + RTF_PICSCALEY, + RTF_PICT, + RTF_PICW, + RTF_PICWGOAL, + RTF_PINDTABQC, + RTF_PINDTABQL, + RTF_PINDTABQR, + RTF_PLAIN, + RTF_PMARTABQC, + RTF_PMARTABQL, + RTF_PMARTABQR, + RTF_PMMETAFILE, + RTF_PN, + RTF_PNACROSS, + RTF_PNAIU, + RTF_PNAIUD, + RTF_PNAIUEO, + RTF_PNAIUEOD, + RTF_PNB, + RTF_PNBIDIA, + RTF_PNBIDIB, + RTF_PNCAPS, + RTF_PNCARD, + RTF_PNCF, + RTF_PNCHOSUNG, + RTF_PNCNUM, + RTF_PNDBNUM, + RTF_PNDBNUMD, + RTF_PNDBNUMK, + RTF_PNDBNUML, + RTF_PNDBNUMT, + RTF_PNDEC, + RTF_PNDECD, + RTF_PNF, + RTF_PNFS, + RTF_PNGANADA, + RTF_PNGBLIP, + RTF_PNGBNUM, + RTF_PNGBNUMD, + RTF_PNGBNUMK, + RTF_PNGBNUML, + RTF_PNHANG, + RTF_PNI, + RTF_PNINDENT, + RTF_PNIROHA, + RTF_PNIROHAD, + RTF_PNLCLTR, + RTF_PNLCRM, + RTF_PNLVL, + RTF_PNLVLBLT, + RTF_PNLVLBODY, + RTF_PNLVLCONT, + RTF_PNNUMONCE, + RTF_PNORD, + RTF_PNORDT, + RTF_PNPREV, + RTF_PNQC, + RTF_PNQL, + RTF_PNQR, + RTF_PNRAUTH, + RTF_PNRDATE, + RTF_PNRESTART, + RTF_PNRNFC, + RTF_PNRNOT, + RTF_PNRPNBR, + RTF_PNRRGB, + RTF_PNRSTART, + RTF_PNRSTOP, + RTF_PNRXST, + RTF_PNSCAPS, + RTF_PNSECLVL, + RTF_PNSP, + RTF_PNSTART, + RTF_PNSTRIKE, + RTF_PNTEXT, + RTF_PNTXTA, + RTF_PNTXTB, + RTF_PNUCLTR, + RTF_PNUCRM, + RTF_PNUL, + RTF_PNULD, + RTF_PNULDASH, + RTF_PNULDASHD, + RTF_PNULDASHDD, + RTF_PNULDB, + RTF_PNULHAIR, + RTF_PNULNONE, + RTF_PNULTH, + RTF_PNULW, + RTF_PNULWAVE, + RTF_PNZODIAC, + RTF_PNZODIACD, + RTF_PNZODIACL, + RTF_POSNEGX, + RTF_POSNEGY, + RTF_POSX, + RTF_POSXC, + RTF_POSXI, + RTF_POSXL, + RTF_POSXO, + RTF_POSXR, + RTF_POSY, + RTF_POSYB, + RTF_POSYC, + RTF_POSYIL, + RTF_POSYIN, + RTF_POSYOUT, + RTF_POSYT, + RTF_PRAUTH, + RTF_PRCOLBL, + RTF_PRDATE, + RTF_PRINTDATA, + RTF_PRINTIM, + RTF_PRIVATE, + RTF_PROPNAME, + RTF_PROPTYPE, + RTF_PROTECT, + RTF_PROTEND, + RTF_PROTLEVEL, + RTF_PROTSTART, + RTF_PROTUSERTBL, + RTF_PSOVER, + RTF_PSZ, + RTF_PTABLDOT, + RTF_PTABLMDOT, + RTF_PTABLMINUS, + RTF_PTABLNONE, + RTF_PTABLUSCORE, + RTF_PUBAUTO, + RTF_PVMRG, + RTF_PVPARA, + RTF_PVPG, + RTF_PWD, + RTF_PXE, + RTF_QC, + RTF_QD, + RTF_QJ, + RTF_QK, + RTF_QL, + RTF_QMSPACE, + RTF_QR, + RTF_QT, + RTF_RAWCLBGDKBDIAG, + RTF_RAWCLBGBDIAG, + RTF_RAWCLBGCROSS, + RTF_RAWCLBGDCROSS, + RTF_RAWCLBGDKCROSS, + RTF_RAWCLBGDKDCROSS, + RTF_RAWCLBGDKFDIAG, + RTF_RAWCLBGDKHOR, + RTF_RAWCLBGDKVERT, + RTF_RAWCLBGFDIAG, + RTF_RAWCLBGHORIZ, + RTF_RAWCLBGVERT, + RTF_RDBLQUOTE, + RTF_READONLYRECOMMENDED, + RTF_READPROT, + RTF_RED, + RTF_RELYONVML, + RTF_REMDTTM, + RTF_REMPERSONALINFO, + RTF_RESULT, + RTF_REVAUTH, + RTF_REVAUTHDEL, + RTF_REVBAR, + RTF_REVDTTM, + RTF_REVDTTMDEL, + RTF_REVISED, + RTF_REVISIONS, + RTF_REVPROP, + RTF_REVPROT, + RTF_REVTBL, + RTF_REVTIM, + RTF_RI, + RTF_RIN, + RTF_ROW, + RTF_RQUOTE, + RTF_RSID, + RTF_RSIDROOT, + RTF_RSIDTBL, + RTF_RSLTBMP, + RTF_RSLTHTML, + RTF_RSLTMERGE, + RTF_RSLTPICT, + RTF_RSLTRTF, + RTF_RSLTTXT, + RTF_RTF, + RTF_RTLCH, + RTF_RTLDOC, + RTF_RTLGUTTER, + RTF_RTLMARK, + RTF_RTLPAR, + RTF_RTLROW, + RTF_RTLSECT, + RTF_RXE, + RTF_S, + RTF_SA, + RTF_SAAUTO, + RTF_SAFTNNALC, + RTF_SAFTNNAR, + RTF_SAFTNNAUC, + RTF_SAFTNNCHI, + RTF_SAFTNNCHOSUNG, + RTF_SAFTNNCNUM, + RTF_SAFTNNDBAR, + RTF_SAFTNNDBNUM, + RTF_SAFTNNDBNUMD, + RTF_SAFTNNDBNUMK, + RTF_SAFTNNDBNUMT, + RTF_SAFTNNGANADA, + RTF_SAFTNNGBNUM, + RTF_SAFTNNGBNUMD, + RTF_SAFTNNGBNUMK, + RTF_SAFTNNGBNUML, + RTF_SAFTNNRLC, + RTF_SAFTNNRUC, + RTF_SAFTNNZODIAC, + RTF_SAFTNNZODIACD, + RTF_SAFTNNZODIACL, + RTF_SAFTNRESTART, + RTF_SAFTNRSTCONT, + RTF_SAFTNSTART, + RTF_SAUTOUPD, + RTF_SAVEINVALIDXML, + RTF_SAVEPREVPICT, + RTF_SB, + RTF_SBASEDON, + RTF_SBAUTO, + RTF_SBKCOL, + RTF_SBKEVEN, + RTF_SBKNONE, + RTF_SBKODD, + RTF_SBKPAGE, + RTF_SBYS, + RTF_SCAPS, + RTF_SCOMPOSE, + RTF_SEC, + RTF_SECT, + RTF_SECTD, + RTF_SECTDEFAULTCL, + RTF_SECTEXPAND, + RTF_SECTLINEGRID, + RTF_SECTNUM, + RTF_SECTRSID, + RTF_SECTSPECIFYCL, + RTF_SECTSPECIFYGENN, + RTF_SECTSPECIFYL, + RTF_SECTUNLOCKED, + RTF_SFTNBJ, + RTF_SFTNNALC, + RTF_SFTNNAR, + RTF_SFTNNAUC, + RTF_SFTNNCHI, + RTF_SFTNNCHOSUNG, + RTF_SFTNNCNUM, + RTF_SFTNNDBAR, + RTF_SFTNNDBNUM, + RTF_SFTNNDBNUMD, + RTF_SFTNNDBNUMK, + RTF_SFTNNDBNUMT, + RTF_SFTNNGANADA, + RTF_SFTNNGBNUM, + RTF_SFTNNGBNUMD, + RTF_SFTNNGBNUMK, + RTF_SFTNNGBNUML, + RTF_SFTNNRLC, + RTF_SFTNNRUC, + RTF_SFTNNZODIAC, + RTF_SFTNNZODIACD, + RTF_SFTNNZODIACL, + RTF_SFTNRESTART, + RTF_SFTNRSTCONT, + RTF_SFTNRSTPG, + RTF_SFTNSTART, + RTF_SFTNTJ, + RTF_SHAD, + RTF_SHADING, + RTF_SHIDDEN, + RTF_SHIFT, + RTF_SHOWPLACEHOLDTEXT, + RTF_SHOWXMLERRORS, + RTF_SHP, + RTF_SHPBOTTOM, + RTF_SHPBXCOLUMN, + RTF_SHPBXIGNORE, + RTF_SHPBXMARGIN, + RTF_SHPBXPAGE, + RTF_SHPBYIGNORE, + RTF_SHPBYMARGIN, + RTF_SHPBYPAGE, + RTF_SHPBYPARA, + RTF_SHPFBLWTXT, + RTF_SHPFHDR, + RTF_SHPGRP, + RTF_SHPINST, + RTF_SHPLEFT, + RTF_SHPLID, + RTF_SHPLOCKANCHOR, + RTF_SHPPICT, + RTF_SHPRIGHT, + RTF_SHPRSLT, + RTF_SHPTOP, + RTF_SHPTXT, + RTF_SHPWRK, + RTF_SHPWR, + RTF_SHPZ, + RTF_SL, + RTF_SLINK, + RTF_SLMULT, + RTF_SLOCKED, + RTF_SN, + RTF_SNAPTOGRIDINCELL, + RTF_SNEXT, + RTF_SOFTCOL, + RTF_SOFTLHEIGHT, + RTF_SOFTLINE, + RTF_SOFTPAGE, + RTF_SP, + RTF_SPERSONAL, + RTF_SPLTPGPAR, + RTF_SPLYTWNINE, + RTF_SPRIORITY, + RTF_SPRSBSP, + RTF_SPRSLNSP, + RTF_SPRSSPBF, + RTF_SPRSTSM, + RTF_SPRSTSP, + RTF_SPV, + RTF_SQFORMAT, + RTF_SRAUTH, + RTF_SRDATE, + RTF_SREPLY, + RTF_SSEMIHIDDEN, + RTF_STATICVAL, + RTF_STEXTFLOW, + RTF_STRIKE, + RTF_STRIKED, + RTF_STSHFBI, + RTF_STSHFDBCH, + RTF_STSHFHICH, + RTF_STSHFLOCH, + RTF_STYLELOCK, + RTF_STYLELOCKBACKCOMP, + RTF_STYLELOCKENFORCED, + RTF_STYLELOCKQFSET, + RTF_STYLELOCKTHEME, + RTF_STYLESHEET, + RTF_STYLESORTMETHOD, + RTF_STYRSID, + RTF_SUB, + RTF_SUBDOCUMENT, + RTF_SUBFONTBYSIZE, + RTF_SUBJECT, + RTF_SUNHIDEUSED, + RTF_SUPER, + RTF_SV, + RTF_SVB, + RTF_SWPBDR, + RTF_TAB, + RTF_TABSNOOVRLP, + RTF_TAPRTL, + RTF_TB, + RTF_TBLIND, + RTF_TBLINDTYPE, + RTF_TBLLKBESTFIT, + RTF_TBLLKBORDER, + RTF_TBLLKCOLOR, + RTF_TBLLKFONT, + RTF_TBLLKHDRCOLS, + RTF_TBLLKHDRROWS, + RTF_TBLLKLASTCOL, + RTF_TBLLKLASTROW, + RTF_TBLLKNOCOLBAND, + RTF_TBLLKNOROWBAND, + RTF_TBLLKSHADING, + RTF_TBLRSID, + RTF_TC, + RTF_TCELLD, + RTF_TCF, + RTF_TCL, + RTF_TCN, + RTF_TDFRMTXTBOTTOM, + RTF_TDFRMTXTLEFT, + RTF_TDFRMTXTRIGHT, + RTF_TDFRMTXTTOP, + RTF_TEMPLATE, + RTF_THEMEDATA, + RTF_THEMELANG, + RTF_THEMELANGCS, + RTF_THEMELANGFE, + RTF_TIME, + RTF_TITLE, + RTF_TITLEPG, + RTF_TLDOT, + RTF_TLEQ, + RTF_TLHYPH, + RTF_TLMDOT, + RTF_TLTH, + RTF_TLUL, + RTF_TOPLINEPUNCT, + RTF_TPHCOL, + RTF_TPHMRG, + RTF_TPHPG, + RTF_TPOSNEGX, + RTF_TPOSNEGY, + RTF_TPOSXC, + RTF_TPOSXI, + RTF_TPOSXL, + RTF_TPOSX, + RTF_TPOSXO, + RTF_TPOSXR, + RTF_TPOSY, + RTF_TPOSYB, + RTF_TPOSYC, + RTF_TPOSYIL, + RTF_TPOSYIN, + RTF_TPOSYOUT, + RTF_TPOSYT, + RTF_TPVMRG, + RTF_TPVPARA, + RTF_TPVPG, + RTF_TQC, + RTF_TQDEC, + RTF_TQR, + RTF_TRACKFORMATTING, + RTF_TRACKMOVES, + RTF_TRANSMF, + RTF_TRAUTH, + RTF_TRAUTOFIT, + RTF_TRBGBDIAG, + RTF_TRBGCROSS, + RTF_TRBGDCROSS, + RTF_TRBGDKBDIAG, + RTF_TRBGDKCROSS, + RTF_TRBGDKDCROSS, + RTF_TRBGDKFDIAG, + RTF_TRBGDKHOR, + RTF_TRBGDKVERT, + RTF_TRBGFDIAG, + RTF_TRBGHORIZ, + RTF_TRBGVERT, + RTF_TRBRDRB, + RTF_TRBRDRH, + RTF_TRBRDRL, + RTF_TRBRDRR, + RTF_TRBRDRT, + RTF_TRBRDRV, + RTF_TRCBPAT, + RTF_TRCFPAT, + RTF_TRDATE, + RTF_TRFTSWIDTHA, + RTF_TRFTSWIDTHB, + RTF_TRFTSWIDTH, + RTF_TRGAPH, + RTF_TRHDR, + RTF_TRKEEP, + RTF_TRKEEPFOLLOW, + RTF_TRLEFT, + RTF_TROWD, + RTF_TRPADDB, + RTF_TRPADDFB, + RTF_TRPADDFL, + RTF_TRPADDFR, + RTF_TRPADDFT, + RTF_TRPADDL, + RTF_TRPADDR, + RTF_TRPADDT, + RTF_TRPADOB, + RTF_TRPADOFB, + RTF_TRPADOFL, + RTF_TRPADOFR, + RTF_TRPADOFT, + RTF_TRPADOL, + RTF_TRPADOR, + RTF_TRPADOT, + RTF_TRPAT, + RTF_TRQC, + RTF_TRQL, + RTF_TRQR, + RTF_TRRH, + RTF_TRSHDNG, + RTF_TRSPDB, + RTF_TRSPDFB, + RTF_TRSPDFL, + RTF_TRSPDFR, + RTF_TRSPDFT, + RTF_TRSPDL, + RTF_TRSPDR, + RTF_TRSPDT, + RTF_TRSPOB, + RTF_TRSPOFB, + RTF_TRSPOFL, + RTF_TRSPOFR, + RTF_TRSPOFT, + RTF_TRSPOL, + RTF_TRSPOR, + RTF_TRSPOT, + RTF_TRUNCATEFONTHEIGHT, + RTF_TRUNCEX, + RTF_TRWWIDTHA, + RTF_TRWWIDTHB, + RTF_TRWWIDTH, + RTF_TS, + RTF_TSBGBDIAG, + RTF_TSBGCROSS, + RTF_TSBGDCROSS, + RTF_TSBGDKBDIAG, + RTF_TSBGDKCROSS, + RTF_TSBGDKDCROSS, + RTF_TSBGDKFDIAG, + RTF_TSBGDKHOR, + RTF_TSBGDKVERT, + RTF_TSBGFDIAG, + RTF_TSBGHORIZ, + RTF_TSBGVERT, + RTF_TSBRDRB, + RTF_TSBRDRDGL, + RTF_TSBRDRDGR, + RTF_TSBRDRH, + RTF_TSBRDRL, + RTF_TSBRDRR, + RTF_TSBRDRT, + RTF_TSBRDRV, + RTF_TSCBANDHORZEVEN, + RTF_TSCBANDHORZODD, + RTF_TSCBANDSH, + RTF_TSCBANDSV, + RTF_TSCBANDVERTEVEN, + RTF_TSCBANDVERTODD, + RTF_TSCELLCBPAT, + RTF_TSCELLCFPAT, + RTF_TSCELLPADDB, + RTF_TSCELLPADDFB, + RTF_TSCELLPADDFL, + RTF_TSCELLPADDFR, + RTF_TSCELLPADDFT, + RTF_TSCELLPADDL, + RTF_TSCELLPADDR, + RTF_TSCELLPADDT, + RTF_TSCELLPCT, + RTF_TSCELLWIDTH, + RTF_TSCELLWIDTHFTS, + RTF_TSCFIRSTCOL, + RTF_TSCFIRSTROW, + RTF_TSCLASTCOL, + RTF_TSCLASTROW, + RTF_TSCNECELL, + RTF_TSCNWCELL, + RTF_TSCSECELL, + RTF_TSCSWCELL, + RTF_TSD, + RTF_TSNOWRAP, + RTF_TSROWD, + RTF_TSVERTALB, + RTF_TSVERTALC, + RTF_TSVERTALT, + RTF_TWOINONE, + RTF_TWOONONE, + RTF_TX, + RTF_TXBXTWALWAYS, + RTF_TXBXTWFIRST, + RTF_TXBXTWFIRSTLAST, + RTF_TXBXTWLAST, + RTF_TXBXTWNO, + RTF_TXE, + RTF_U, + RTF_UC, + RTF_UD, + RTF_UL, + RTF_ULC, + RTF_ULD, + RTF_ULDASH, + RTF_ULDASHD, + RTF_ULDASHDD, + RTF_ULDB, + RTF_ULHAIR, + RTF_ULHWAVE, + RTF_ULLDASH, + RTF_ULNONE, + RTF_ULTH, + RTF_ULTHD, + RTF_ULTHDASH, + RTF_ULTHDASHD, + RTF_ULTHDASHDD, + RTF_ULTHLDASH, + RTF_ULULDBWAVE, + RTF_ULW, + RTF_ULWAVE, + RTF_UP, + RTF_UPR, + RTF_URTF, + RTF_USELTBALN, + RTF_USENORMSTYFORLIST, + RTF_USERPROPS, + RTF_USEXFORM, + RTF_UTINL, + RTF_V, + RTF_VALIDATEXML, + RTF_VERN, + RTF_VERSION, + RTF_VERTAL, + RTF_VERTALB, + RTF_VERTALC, + RTF_VERTALJ, + RTF_VERTALT, + RTF_VERTDOC, + RTF_VERTSECT, + RTF_VIEWBKSP, + RTF_VIEWKIND, + RTF_VIEWNOBOUND, + RTF_VIEWSCALE, + RTF_VIEWZK, + RTF_WBITMAP, + RTF_WBMBITSPIXEL, + RTF_WBMPLANES, + RTF_WBMWIDTHBYTE, + RTF_WEBHIDDEN, + RTF_WGRFFMTFILTER, + RTF_WIDCTLPAR, + RTF_WIDOWCTRL, + RTF_WINDOWCAPTION, + RTF_WMETAFILE, + RTF_WPEQN, + RTF_WPJST, + RTF_WPSP, + RTF_WRAPAROUND, + RTF_WRAPDEFAULT, + RTF_WRAPTHROUGH, + RTF_WRAPTIGHT, + RTF_WRAPTRSP, + RTF_WRITERESERVATION, + RTF_WRITERESERVHASH, + RTF_WRPPUNCT, + RTF_XE, + RTF_XEF, + RTF_XFORM, + RTF_XMLATTR, + RTF_XMLATTRNAME, + RTF_XMLATTRNS, + RTF_XMLATTRVALUE, + RTF_XMLCLOSE, + RTF_XMLNAME, + RTF_XMLNS, + RTF_XMLNSTBL, + RTF_XMLOPEN, + RTF_XMLSDTTCELL, + RTF_XMLSDTTPARA, + RTF_XMLSDTTREGULAR, + RTF_XMLSDTTROW, + RTF_XMLSDTTUNKNOWN, + RTF_YR, + RTF_YTS, + RTF_YXE, + RTF_ZWBO, + RTF_ZWJ, + RTF_ZWNBO, + RTF_ZWNJ +}; + +} // namespace rtftok +} // namespace writerfilter + +#endif // _RTFCONTROLWORDS_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfdocumentfactory.cxx b/writerfilter/source/rtftok/rtfdocumentfactory.cxx new file mode 100644 index 000000000000..a397565c085d --- /dev/null +++ b/writerfilter/source/rtftok/rtfdocumentfactory.cxx @@ -0,0 +1,44 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Miklos Vajna <vmiklos@frugalware.org> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include <rtfdocumentimpl.hxx> + +namespace writerfilter { +namespace rtftok { + +RTFDocument::Pointer_t RTFDocumentFactory::createDocument(uno::Reference< uno::XComponentContext > const & xContext, + uno::Reference< io::XInputStream > const & xInputStream, + uno::Reference< lang::XComponent > const & xDstDoc, + uno::Reference< frame::XFrame > const & xFrame) +{ + return RTFDocument::Pointer_t(new RTFDocumentImpl(xContext, xInputStream, xDstDoc, xFrame)); +} + +} // namespace rtftok +} // namespace writerfilter + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx new file mode 100644 index 000000000000..930059d431d0 --- /dev/null +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -0,0 +1,2547 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Miklos Vajna <vmiklos@frugalware.org> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include <rtfdocumentimpl.hxx> +#include <rtftypes.hxx> +#include <rtfcontrolwords.hxx> +#include <rtfvalue.hxx> +#include <rtfsprm.hxx> +#include <rtfreferenceproperties.hxx> +#include <doctok/sprmids.hxx> // NS_sprm namespace +#include <doctok/resourceids.hxx> // NS_rtf namespace +#include <ooxml/resourceids.hxx> // NS_ooxml namespace +#include <ooxml/OOXMLFastTokens.hxx> // ooxml namespace +#include <unotools/ucbstreamhelper.hxx> +#include <rtl/strbuf.hxx> +#include <rtl/ustrbuf.hxx> +#include <rtl/tencinfo.h> +#include <svl/lngmisc.hxx> +#include <editeng/borderline.hxx> +#include <unotools/streamwrap.hxx> +#include <com/sun/star/beans/XPropertySet.hpp> + +using std::make_pair; +using rtl::OString; +using rtl::OStringBuffer; +using rtl::OUString; +using rtl::OUStringBuffer; +using rtl::OUStringToOString; + +namespace writerfilter { +namespace rtftok { + +static RTFSprms_t& lcl_getNumPr(std::stack<RTFParserState>& aStates) +{ + // insert the numpr sprm if necessary + RTFValue::Pointer_t p = RTFSprm::find(aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_numPr); + if (!p.get()) + { + RTFSprms_t aAttributes; + RTFSprms_t aSprms; + RTFValue::Pointer_t pValue(new RTFValue(aAttributes, aSprms)); + aStates.top().aParagraphSprms.push_back(make_pair(NS_ooxml::LN_CT_PPrBase_numPr, pValue)); + p = RTFSprm::find(aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_numPr); + } + return p->getSprms(); +} + +static Id lcl_getParagraphBorder(sal_uInt32 nIndex) +{ + static const Id aBorderIds[] = + { + NS_sprm::LN_PBrcTop, NS_sprm::LN_PBrcLeft, NS_sprm::LN_PBrcBottom, NS_sprm::LN_PBrcRight + }; + + return aBorderIds[nIndex]; +} + +static void lcl_putNestedAttribute(RTFSprms_t& rSprms, Id nParent, Id nId, RTFValue::Pointer_t pValue, + bool bOverwrite = false, bool bAttribute = true) +{ + RTFValue::Pointer_t pParent = RTFSprm::find(rSprms, nParent); + if (!pParent.get()) + { + RTFSprms_t aAttributes; + RTFValue::Pointer_t pParentValue(new RTFValue(aAttributes)); + rSprms.push_back(make_pair(nParent, pParentValue)); + pParent = pParentValue; + } + RTFSprms_t& rAttributes = (bAttribute ? pParent->getAttributes() : pParent->getSprms()); + if (bOverwrite) + for (RTFSprms_t::iterator i = rAttributes.begin(); i != rAttributes.end(); ++i) + if (i->first == nId) + { + i->second = pValue; + return; + } + rAttributes.push_back(make_pair(nId, pValue)); +} + +static void lcl_putNestedSprm(RTFSprms_t& rSprms, Id nParent, Id nId, RTFValue::Pointer_t pValue, bool bOverwrite = false) +{ + lcl_putNestedAttribute(rSprms, nParent, nId, pValue, bOverwrite, false); +} + +static RTFSprms_t& lcl_getLastAttributes(RTFSprms_t& rSprms, Id nId) +{ + RTFValue::Pointer_t p = RTFSprm::find(rSprms, nId); + if (p->getSprms().size()) + return p->getSprms().back().second->getAttributes(); + else + { + OSL_FAIL("trying to set property when no type is defined"); + return p->getSprms(); + } +} + +static void lcl_putBorderProperty(std::stack<RTFParserState>& aStates, Id nId, RTFValue::Pointer_t pValue) +{ + if (aStates.top().nBorderState == BORDER_PARAGRAPH) + for (int i = 0; i < 4; i++) + { + RTFValue::Pointer_t p = RTFSprm::find(aStates.top().aParagraphSprms, lcl_getParagraphBorder(i)); + if (p.get()) + { + RTFSprms_t& rAttributes = p->getAttributes(); + rAttributes.push_back(make_pair(nId, pValue)); + } + } + else if (aStates.top().nBorderState == BORDER_CELL) + { + // Attributes of the last border type + RTFSprms_t& rAttributes = lcl_getLastAttributes(aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcBorders); + rAttributes.push_back(make_pair(nId, pValue)); + } + else if (aStates.top().nBorderState == BORDER_PAGE) + { + // Attributes of the last border type + RTFSprms_t& rAttributes = lcl_getLastAttributes(aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgBorders); + rAttributes.push_back(make_pair(nId, pValue)); + } +} + +static void lcl_Break(Stream& rMapper) +{ + sal_uInt8 sBreak[] = { 0xd }; + rMapper.text(sBreak, 1); +} + +static void lcl_TableBreak(Stream& rMapper) +{ + lcl_Break(rMapper); + rMapper.endParagraphGroup(); + rMapper.startParagraphGroup(); +} + +// NEEDSWORK: DocxAttributeOutput's impl_AppendTwoDigits does the same. +static void lcl_AppendTwoDigits(OStringBuffer &rBuffer, sal_Int32 nNum) +{ + if ( nNum < 0 || nNum > 99 ) + { + rBuffer.append( "00" ); + return; + } + + if ( nNum < 10 ) + rBuffer.append( '0' ); + + rBuffer.append( nNum ); +} + +// NEEDSWORK: sw::ms::DTTM2DateTime and DocxAttributeOutput's +// impl_DateTimeToOString could be combined to do the same. +static OString lcl_DTTM22OString(long lDTTM) +{ + sal_uInt16 lMin = (sal_uInt16)(lDTTM & 0x0000003F); + lDTTM >>= 6; + sal_uInt16 lHour= (sal_uInt16)(lDTTM & 0x0000001F); + lDTTM >>= 5; + sal_uInt16 lDay = (sal_uInt16)(lDTTM & 0x0000001F); + lDTTM >>= 5; + sal_uInt16 lMon = (sal_uInt16)(lDTTM & 0x0000000F); + lDTTM >>= 4; + sal_uInt16 lYear= (sal_uInt16)(lDTTM & 0x000001FF) + 1900; + + OStringBuffer aBuf; + aBuf.append(sal_Int32(lYear)); + aBuf.append('-'); + lcl_AppendTwoDigits(aBuf, lMon); + aBuf.append('-'); + lcl_AppendTwoDigits(aBuf, lDay); + aBuf.append('T'); + lcl_AppendTwoDigits(aBuf, lHour); + aBuf.append(':'); + lcl_AppendTwoDigits(aBuf, lMin); + aBuf.append(":00Z"); + return aBuf.makeStringAndClear(); +} + +static writerfilter::Reference<Properties>::Pointer_t lcl_getBookmarkProperties(int nPos, OUString& rString) +{ + RTFSprms_t aAttributes; + RTFValue::Pointer_t pPos(new RTFValue(nPos)); + if (rString.getLength()) + { + // If present, this should be sent first. + RTFValue::Pointer_t pString(new RTFValue(rString)); + aAttributes.push_back(make_pair(NS_rtf::LN_BOOKMARKNAME, pString)); + } + aAttributes.push_back(make_pair(NS_rtf::LN_IBKL, pPos)); + return writerfilter::Reference<Properties>::Pointer_t(new RTFReferenceProperties(aAttributes)); +} + +static writerfilter::Reference<Properties>::Pointer_t lcl_getBookmarkProperties(int nPos) +{ + OUString aStr; + return lcl_getBookmarkProperties(nPos, aStr); +} + +static int lcl_AsHex(char ch) +{ + int ret = 0; + if (isdigit(ch)) + ret = ch - '0'; + else + { + if (islower(ch)) + { + if (ch < 'a' || ch > 'f') + return -1; + ret = ch - 'a'; + } + else + { + if (ch < 'A' || ch > 'F') + return -1; + ret = ch - 'A'; + } + ret += 10; + } + return ret; +} + +static const char* lcl_RtfToString(RTFKeyword nKeyword) +{ + for (int i = 0; i < nRTFControlWords; i++) + { + if (nKeyword == aRTFControlWords[i].nIndex) + return aRTFControlWords[i].sKeyword; + } + return NULL; +} +RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& xContext, + uno::Reference<io::XInputStream> const& xInputStream, + uno::Reference<lang::XComponent> const& xDstDoc, + uno::Reference<frame::XFrame> const& xFrame) + : m_xContext(xContext), + m_xInputStream(xInputStream), + m_xDstDoc(xDstDoc), + m_xFrame(xFrame), + m_nGroup(0), + m_aDefaultState(), + m_bSkipUnknown(false), + m_aFontEncodings(), + m_aColorTable(), + m_bFirstRun(true), + m_bNeedPap(false), + m_aListTableSprms(), + m_aSettingsTableSprms(), + m_xStorage(), + m_aTableBuffer(), + m_bTable(false), + m_aSuperBuffer(), + m_bSuper(false), + m_bHasFootnote(false), + m_bIsSubstream(false), + m_nHeaderFooterPositions(), + m_nGroupStartPos(0), + m_aBookmarks(), + m_aAuthors() +{ + OSL_ENSURE(xInputStream.is(), "no input stream"); + if (!xInputStream.is()) + throw uno::RuntimeException(); + m_pInStream = utl::UcbStreamHelper::CreateStream( xInputStream, sal_True ); + + m_xModelFactory.set(m_xDstDoc, uno::UNO_QUERY); + OSL_ASSERT(m_xModelFactory.is()); + + m_pGraphicHelper = new oox::GraphicHelper(m_xContext, xFrame, m_xStorage); +} + +RTFDocumentImpl::~RTFDocumentImpl() +{ +} + +SvStream& RTFDocumentImpl::Strm() +{ + return *m_pInStream; +} + +Stream& RTFDocumentImpl::Mapper() +{ + return *m_pMapperStream; +} + +void RTFDocumentImpl::setSubstream(bool bIsSubtream) +{ + m_bIsSubstream = bIsSubtream; +} + +void RTFDocumentImpl::setIgnoreFirst(OUString& rIgnoreFirst) +{ + m_aIgnoreFirst = rIgnoreFirst; +} + +void RTFDocumentImpl::resolveSubstream(sal_uInt32 nPos, Id nId) +{ + OUString aStr; + resolveSubstream(nPos, nId, aStr); +} +void RTFDocumentImpl::resolveSubstream(sal_uInt32 nPos, Id nId, OUString& rIgnoreFirst) +{ + sal_uInt32 nCurrent = Strm().Tell(); + // Seek to header position, parse, then seek back. + RTFDocumentImpl::Pointer_t pImpl(new RTFDocumentImpl(m_xContext, m_xInputStream, m_xDstDoc, m_xFrame)); + pImpl->setSubstream(true); + pImpl->setIgnoreFirst(rIgnoreFirst); + pImpl->seek(nPos); + OSL_TRACE("substream start"); + Mapper().substream(nId, pImpl); + OSL_TRACE("substream end"); + Strm().Seek(nCurrent); + nPos = 0; +} + +void RTFDocumentImpl::parBreak() +{ + // end previous paragraph + Mapper().startCharacterGroup(); + lcl_Break(Mapper()); + Mapper().endCharacterGroup(); + Mapper().endParagraphGroup(); + + // start new one + Mapper().startParagraphGroup(); +} + +void RTFDocumentImpl::sectBreak(bool bFinal = false) +{ + while (m_nHeaderFooterPositions.size()) + { + std::pair<Id, sal_uInt32> aPair = m_nHeaderFooterPositions.front(); + m_nHeaderFooterPositions.pop_front(); + resolveSubstream(aPair.second, aPair.first); + } + + RTFValue::Pointer_t pBreak = RTFSprm::find(m_aStates.top().aSectionSprms, NS_sprm::LN_SBkc); + // In case the last section is a continous one, we don't need to output a section break. + if (bFinal && pBreak.get() && !pBreak->getInt()) + RTFSprm::erase(m_aStates.top().aSectionSprms, NS_sprm::LN_SBkc); + + // Section properties are a paragraph sprm. + RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aSectionAttributes, m_aStates.top().aSectionSprms)); + RTFSprms_t aAttributes; + RTFSprms_t aSprms; + aSprms.push_back(make_pair(NS_ooxml::LN_CT_PPr_sectPr, pValue)); + writerfilter::Reference<Properties>::Pointer_t const pProperties( + new RTFReferenceProperties(aAttributes, aSprms) + ); + // The trick is that we send properties of the previous section right now, which will be exactly what dmapper expects. + Mapper().props(pProperties); + Mapper().endParagraphGroup(); + if (!m_bIsSubstream) + Mapper().endSectionGroup(); + if (!bFinal) + { + Mapper().startSectionGroup(); + Mapper().startParagraphGroup(); + } +} + +void RTFDocumentImpl::seek(sal_uInt32 nPos) +{ + Strm().Seek(nPos); +} + +sal_uInt32 RTFDocumentImpl::getColorTable(sal_uInt32 nIndex) +{ + if (nIndex < m_aColorTable.size()) + return m_aColorTable[nIndex]; + return 0; +} + +sal_uInt32 RTFDocumentImpl::getEncodingTable(sal_uInt32 nFontIndex) +{ + if (nFontIndex < m_aFontEncodings.size()) + return m_aFontEncodings[nFontIndex]; + return 0; +} + +void RTFDocumentImpl::resolve(Stream & rMapper) +{ + m_pMapperStream = &rMapper; + switch (resolveParse()) + { + case ERROR_OK: + OSL_TRACE("%s: finished without errors", OSL_THIS_FUNC); + break; + case ERROR_GROUP_UNDER: + OSL_TRACE("%s: unmatched '}'", OSL_THIS_FUNC); + break; + case ERROR_GROUP_OVER: + OSL_TRACE("%s: unmatched '{'", OSL_THIS_FUNC); + break; + case ERROR_EOF: + OSL_TRACE("%s: unexpected end of file", OSL_THIS_FUNC); + break; + case ERROR_HEX_INVALID: + OSL_TRACE("%s: invalid hex char", OSL_THIS_FUNC); + break; + } +} + +int RTFDocumentImpl::resolvePict(char ch, bool bInline) +{ + SvMemoryStream aStream; + int b = 0, count = 2; + + // TODO this discards properties after the 'pib' property + if (!bInline) + resolveShapeProperties(m_aStates.top().aShapeProperties); + + // Read the group. + while(!Strm().IsEof() && ch != '{' && ch != '}' && ch != '\\') + { + if (ch != 0x0d && ch != 0x0a) + { + b = b << 4; + char parsed = lcl_AsHex(ch); + if (parsed == -1) + return ERROR_HEX_INVALID; + b += parsed; + count--; + if (!count) + { + aStream << (char)b; + count = 2; + b = 0; + } + } + Strm() >> ch; + } + Strm().SeekRel(-1); + + // Store, and get its URL. + aStream.Seek(0); + uno::Reference<io::XInputStream> xInputStream(new utl::OInputStreamWrapper(&aStream)); + OUString aGraphicUrl = m_pGraphicHelper->importGraphicObject(xInputStream); + + // Wrap it in an XShape. + uno::Reference<drawing::XShape> xShape; + OUString aService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GraphicObjectShape")); + xShape.set(m_xModelFactory->createInstance(aService), uno::UNO_QUERY); + OSL_ASSERT(xShape.is()); + uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY); + OSL_ASSERT(xPropertySet.is()); + xPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicURL")), uno::Any(aGraphicUrl)); + + // Send it to the dmapper. + RTFSprms_t aSprms; + RTFSprms_t aAttributes; + // shape attribute + RTFSprms_t aPicAttributes; + RTFValue::Pointer_t pShapeValue(new RTFValue(xShape)); + aPicAttributes.push_back(make_pair(NS_ooxml::LN_shape, pShapeValue)); + // pic sprm + RTFSprms_t aGraphicDataAttributes; + RTFSprms_t aGraphicDataSprms; + RTFValue::Pointer_t pPicValue(new RTFValue(aPicAttributes)); + aGraphicDataSprms.push_back(make_pair(NS_ooxml::LN_pic_pic, pPicValue)); + // graphicData sprm + RTFSprms_t aGraphicAttributes; + RTFSprms_t aGraphicSprms; + RTFValue::Pointer_t pGraphicDataValue(new RTFValue(aGraphicDataAttributes, aGraphicDataSprms)); + aGraphicSprms.push_back(make_pair(NS_ooxml::LN_CT_GraphicalObject_graphicData, pGraphicDataValue)); + // graphic sprm + RTFValue::Pointer_t pGraphicValue(new RTFValue(aGraphicAttributes, aGraphicSprms)); + // extent sprm + RTFSprms_t aExtentAttributes; + for (RTFSprms_t::iterator i = m_aStates.top().aCharacterAttributes.begin(); i != m_aStates.top().aCharacterAttributes.end(); ++i) + if (i->first == NS_rtf::LN_XEXT || i->first == NS_rtf::LN_YEXT) + aExtentAttributes.push_back(make_pair(i->first, i->second)); + RTFValue::Pointer_t pExtentValue(new RTFValue(aExtentAttributes)); + // docpr sprm + RTFSprms_t aDocprAttributes; + for (RTFSprms_t::iterator i = m_aStates.top().aCharacterAttributes.begin(); i != m_aStates.top().aCharacterAttributes.end(); ++i) + if (i->first == NS_ooxml::LN_CT_NonVisualDrawingProps_name || i->first == NS_ooxml::LN_CT_NonVisualDrawingProps_descr) + aDocprAttributes.push_back(make_pair(i->first, i->second)); + RTFValue::Pointer_t pDocprValue(new RTFValue(aDocprAttributes)); + if (bInline) + { + RTFSprms_t aInlineAttributes; + RTFSprms_t aInlineSprms; + aInlineSprms.push_back(make_pair(NS_ooxml::LN_CT_Inline_extent, pExtentValue)); + aInlineSprms.push_back(make_pair(NS_ooxml::LN_CT_Inline_docPr, pDocprValue)); + aInlineSprms.push_back(make_pair(NS_ooxml::LN_graphic_graphic, pGraphicValue)); + // inline sprm + RTFValue::Pointer_t pValue(new RTFValue(aInlineAttributes, aInlineSprms)); + aSprms.push_back(make_pair(NS_ooxml::LN_inline_inline, pValue)); + } + else // anchored + { + // wrap sprm + RTFSprms_t aAnchorWrapAttributes; + for (RTFSprms_t::iterator i = m_aStates.top().aCharacterAttributes.begin(); i != m_aStates.top().aCharacterAttributes.end(); ++i) + if (i->first == NS_ooxml::LN_CT_WrapSquare_wrapText) + aAnchorWrapAttributes.push_back(make_pair(i->first, i->second)); + RTFValue::Pointer_t pAnchorWrapValue(new RTFValue(aAnchorWrapAttributes)); + RTFSprms_t aAnchorAttributes; + RTFSprms_t aAnchorSprms; + aAnchorSprms.push_back(make_pair(NS_ooxml::LN_CT_Anchor_extent, pExtentValue)); + if (aAnchorWrapAttributes.size()) + aAnchorSprms.push_back(make_pair(NS_ooxml::LN_EG_WrapType_wrapSquare, pAnchorWrapValue)); + aAnchorSprms.push_back(make_pair(NS_ooxml::LN_CT_Anchor_docPr, pDocprValue)); + aAnchorSprms.push_back(make_pair(NS_ooxml::LN_graphic_graphic, pGraphicValue)); + // anchor sprm + RTFValue::Pointer_t pValue(new RTFValue(aAnchorAttributes, aAnchorSprms)); + aSprms.push_back(make_pair(NS_ooxml::LN_anchor_anchor, pValue)); + } + writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aAttributes, aSprms)); + Mapper().props(pProperties); + + return 0; +} + +int RTFDocumentImpl::resolveChars(char ch) +{ + OStringBuffer aBuf; + + if (m_aStates.top().nDestinationState == DESTINATION_PICT) + return resolvePict(ch, true); + else if (m_aStates.top().nDestinationState == DESTINATION_SHAPEPROPERTYVALUEPICT) + return resolvePict(ch, false); + while(!Strm().IsEof() && ch != '{' && ch != '}' && ch != '\\') + { + if (ch != 0x0d && ch != 0x0a) + { + if (m_aStates.top().nCharsToSkip == 0) + aBuf.append(ch); + else + m_aStates.top().nCharsToSkip--; + } + // read a single char if we're in hex mode + if (m_aStates.top().nInternalState == INTERNAL_HEX) + break; + Strm() >> ch; + } + if (m_aStates.top().nInternalState != INTERNAL_HEX && !Strm().IsEof()) + Strm().SeekRel(-1); + if (m_aStates.top().nDestinationState == DESTINATION_SKIP) + return 0; + OString aStr = aBuf.makeStringAndClear(); + if (m_aStates.top().nDestinationState == DESTINATION_LEVELNUMBERS) + { + if (aStr.toChar() != ';') + m_aStates.top().aLevelNumbers.push_back(sal_Int32(ch)); + return 0; + } + OSL_TRACE("%s: collected '%s'", OSL_THIS_FUNC, aStr.getStr()); + + OUString aOUStr(OStringToOUString(aStr, m_aStates.top().nCurrentEncoding)); + + if (m_aStates.top().nDestinationState == DESTINATION_COLORTABLE) + { + // we hit a ';' at the end of each color entry + sal_uInt32 color = (m_aStates.top().aCurrentColor.nRed << 16) | ( m_aStates.top().aCurrentColor.nGreen << 8) + | m_aStates.top().aCurrentColor.nBlue; + m_aColorTable.push_back(color); + // set components back to zero + m_aStates.top().aCurrentColor = RTFColorTableEntry(); + } + else + text(aOUStr); + + return 0; +} + +void RTFDocumentImpl::text(OUString& rString) +{ + bool bRet = true; + switch (m_aStates.top().nDestinationState) + { + case DESTINATION_FONTENTRY: + case DESTINATION_STYLEENTRY: + case DESTINATION_REVISIONENTRY: + // drop the ; at the end if it's there + if (rString.endsWithAsciiL(";", 1)) + rString = rString.copy(0, rString.getLength() - 1); + case DESTINATION_LEVELTEXT: + case DESTINATION_SHAPEPROPERTYNAME: + case DESTINATION_SHAPEPROPERTYVALUE: + case DESTINATION_BOOKMARKEND: + m_aDestinationText.append(rString); + break; + default: bRet = false; break; + } + if (bRet) + return; + + if (m_aIgnoreFirst.getLength() && m_aIgnoreFirst.equals(rString)) + { + m_aIgnoreFirst = OUString(); + return; + } + + writerfilter::Reference<Properties>::Pointer_t const pParagraphProperties( + new RTFReferenceProperties(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms) + ); + + if (m_bFirstRun) + { + // output settings table + RTFSprms_t aAttributes; + writerfilter::Reference<Properties>::Pointer_t const pProp(new RTFReferenceProperties(aAttributes, m_aSettingsTableSprms)); + RTFReferenceTable::Entries_t aSettingsTableEntries; + aSettingsTableEntries.insert(make_pair(0, pProp)); + writerfilter::Reference<Table>::Pointer_t const pTable(new RTFReferenceTable(aSettingsTableEntries)); + Mapper().table(NS_ooxml::LN_settings_settings, pTable); + // start initial paragraph + if (!m_bIsSubstream) + Mapper().startSectionGroup(); + Mapper().startParagraphGroup(); + Mapper().props(pParagraphProperties); + m_bFirstRun = false; + } + if (m_bNeedPap) + { + if (!m_bTable && !m_bSuper) + Mapper().props(pParagraphProperties); + else + { + RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms)); + if (m_bTable) + m_aTableBuffer.push_back(make_pair(BUFFER_PROPS, pValue)); + else + m_aSuperBuffer.push_back(make_pair(BUFFER_PROPS, pValue)); + } + m_bNeedPap = false; + } + + // Don't return earlier, a bookmark start has to be in a paragraph group. + if (m_aStates.top().nDestinationState == DESTINATION_BOOKMARKSTART) + { + m_aDestinationText.append(rString); + return; + } + + if (!m_bTable && !m_bSuper && m_aStates.top().nDestinationState != DESTINATION_FOOTNOTE) + Mapper().startCharacterGroup(); + else + { + RTFValue::Pointer_t pValue; + if (m_bTable) + m_aTableBuffer.push_back(make_pair(BUFFER_STARTRUN, pValue)); + else + m_aSuperBuffer.push_back(make_pair(BUFFER_STARTRUN, pValue)); + } + if (m_aStates.top().nDestinationState == DESTINATION_NORMAL || m_aStates.top().nDestinationState == DESTINATION_FIELDRESULT) + { + if (!m_bTable && !m_bSuper) + { + writerfilter::Reference<Properties>::Pointer_t const pProperties( + new RTFReferenceProperties(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms) + ); + Mapper().props(pProperties); + } + else + { + RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms)); + if (m_bTable) + m_aTableBuffer.push_back(make_pair(BUFFER_PROPS, pValue)); + else + m_aSuperBuffer.push_back(make_pair(BUFFER_PROPS, pValue)); + } + } + if (!m_bTable && !m_bSuper) + Mapper().utext(reinterpret_cast<sal_uInt8 const*>(rString.getStr()), rString.getLength()); + else + { + RTFValue::Pointer_t pValue(new RTFValue(rString)); + if (m_bTable) + m_aTableBuffer.push_back(make_pair(BUFFER_UTEXT, pValue)); + else + m_aSuperBuffer.push_back(make_pair(BUFFER_UTEXT, pValue)); + } + if (!m_bTable && !m_bSuper && m_aStates.top().nDestinationState != DESTINATION_FOOTNOTE) + Mapper().endCharacterGroup(); + else + { + RTFValue::Pointer_t pValue; + if (m_bTable) + m_aTableBuffer.push_back(make_pair(BUFFER_ENDRUN, pValue)); + else + m_aSuperBuffer.push_back(make_pair(BUFFER_ENDRUN, pValue)); + } +} + +void RTFDocumentImpl::replayBuffer(std::deque< std::pair<RTFBufferTypes, RTFValue::Pointer_t> >& rBuffer) +{ + while (rBuffer.size()) + { + std::pair<RTFBufferTypes, RTFValue::Pointer_t> aPair = rBuffer.front(); + rBuffer.pop_front(); + if (aPair.first == BUFFER_PROPS) + { + writerfilter::Reference<Properties>::Pointer_t const pProp( + new RTFReferenceProperties(aPair.second->getAttributes(), aPair.second->getSprms()) + ); + Mapper().props(pProp); + } + else if (aPair.first == BUFFER_CELLEND) + { + RTFValue::Pointer_t pValue(new RTFValue(1)); + m_aStates.top().aTableCellSprms.push_back(make_pair(NS_sprm::LN_PCell, pValue)); + writerfilter::Reference<Properties>::Pointer_t const pTableCellProperties( + new RTFReferenceProperties(m_aStates.top().aTableCellAttributes, m_aStates.top().aTableCellSprms) + ); + Mapper().props(pTableCellProperties); + lcl_TableBreak(Mapper()); + break; + } + else if (aPair.first == BUFFER_STARTRUN) + Mapper().startCharacterGroup(); + else if (aPair.first == BUFFER_UTEXT) + { + OUString aString(aPair.second->getString()); + Mapper().utext(reinterpret_cast<sal_uInt8 const*>(aString.getStr()), aString.getLength()); + } + else if (aPair.first == BUFFER_ENDRUN) + Mapper().endCharacterGroup(); + else if (aPair.first == BUFFER_PAR) + parBreak(); + else + OSL_FAIL("should not happen"); + } + +} + +int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword) +{ + bool bParsed = true; + switch (nKeyword) + { + case RTF_RTF: + break; + case RTF_FONTTBL: + m_aStates.top().nDestinationState = DESTINATION_FONTTABLE; + break; + case RTF_COLORTBL: + m_aStates.top().nDestinationState = DESTINATION_COLORTABLE; + break; + case RTF_STYLESHEET: + m_aStates.top().nDestinationState = DESTINATION_STYLESHEET; + break; + case RTF_FIELD: + // A field consists of an fldinst and an fldrslt group. + break; + case RTF_FLDINST: + { + sal_uInt8 sFieldStart[] = { 0x13 }; + Mapper().startCharacterGroup(); + Mapper().text(sFieldStart, 1); + Mapper().endCharacterGroup(); + m_aStates.top().nDestinationState = DESTINATION_FIELDINSTRUCTION; + } + break; + case RTF_FLDRSLT: + m_aStates.top().nDestinationState = DESTINATION_FIELDRESULT; + break; + case RTF_LISTTABLE: + m_aStates.top().nDestinationState = DESTINATION_LISTTABLE; + break; + case RTF_LIST: + m_aStates.top().nDestinationState = DESTINATION_LISTENTRY; + break; + case RTF_LISTOVERRIDETABLE: + m_aStates.top().nDestinationState = DESTINATION_LISTOVERRIDETABLE; + break; + case RTF_LISTOVERRIDE: + m_aStates.top().nDestinationState = DESTINATION_LISTOVERRIDEENTRY; + break; + case RTF_LISTLEVEL: + m_aStates.top().nDestinationState = DESTINATION_LISTLEVEL; + break; + case RTF_LEVELTEXT: + m_aStates.top().nDestinationState = DESTINATION_LEVELTEXT; + break; + case RTF_LEVELNUMBERS: + m_aStates.top().nDestinationState = DESTINATION_LEVELNUMBERS; + break; + case RTF_SHPPICT: + m_aStates.top().nDestinationState = DESTINATION_SHPPICT; + break; + case RTF_PICT: + if (m_aStates.top().nDestinationState != DESTINATION_SHAPEPROPERTYVALUE) + m_aStates.top().nDestinationState = DESTINATION_PICT; // as character + else + m_aStates.top().nDestinationState = DESTINATION_SHAPEPROPERTYVALUEPICT; // anchored inside a shape + break; + case RTF_PICPROP: + m_aStates.top().nDestinationState = DESTINATION_PICPROP; + break; + case RTF_SP: + m_aStates.top().nDestinationState = DESTINATION_SHAPEPROPERTY; + break; + case RTF_SN: + m_aStates.top().nDestinationState = DESTINATION_SHAPEPROPERTYNAME; + break; + case RTF_SV: + m_aStates.top().nDestinationState = DESTINATION_SHAPEPROPERTYVALUE; + break; + case RTF_SHP: + m_aStates.top().nDestinationState = DESTINATION_SHAPE; + break; + case RTF_SHPINST: + m_aStates.top().nDestinationState = DESTINATION_SHAPEINSTRUCTION; + break; + case RTF_NESTTABLEPROPS: + m_aStates.top().nDestinationState = DESTINATION_NESTEDTABLEPROPERTIES; + break; + case RTF_HEADER: + case RTF_FOOTER: + case RTF_HEADERL: + case RTF_HEADERR: + case RTF_HEADERF: + case RTF_FOOTERL: + case RTF_FOOTERR: + case RTF_FOOTERF: + if (!m_bIsSubstream) + { + Id nId = 0; + sal_uInt32 nPos = m_nGroupStartPos - 1; + switch (nKeyword) + { + case RTF_HEADER: nId = NS_rtf::LN_headerr; break; + case RTF_FOOTER: nId = NS_rtf::LN_footerr; break; + case RTF_HEADERL: nId = NS_rtf::LN_headerl; break; + case RTF_HEADERR: nId = NS_rtf::LN_headerr; break; + case RTF_HEADERF: nId = NS_rtf::LN_headerr; break; // TODO figure out how to use NS_rtf::LN_headerf + case RTF_FOOTERL: nId = NS_rtf::LN_footerl; break; + case RTF_FOOTERR: nId = NS_rtf::LN_footerr; break; + case RTF_FOOTERF: nId = NS_rtf::LN_footerr; break; // same here, NS_rtf::LN_footerf could be used + default: break; + } + m_nHeaderFooterPositions.push_back(make_pair(nId, nPos)); + m_aStates.top().nDestinationState = DESTINATION_SKIP; + } + break; + case RTF_FOOTNOTE: + if (!m_bIsSubstream) + { + Id nId = NS_rtf::LN_footnote; + + // Check if this is an endnote. + OStringBuffer aBuf; + char ch; + for (int i = 0; i < 7; ++i) + { + Strm() >> ch; + aBuf.append(ch); + } + OString aKeyword = aBuf.makeStringAndClear(); + if (aKeyword.equals("\\ftnalt")) + nId = NS_rtf::LN_endnote; + + m_bHasFootnote = true; + m_bSuper = false; + bool bCustomMark = false; + OUString aCustomMark; + while (m_aSuperBuffer.size()) + { + std::pair<RTFBufferTypes, RTFValue::Pointer_t> aPair = m_aSuperBuffer.front(); + m_aSuperBuffer.pop_front(); + if (aPair.first == BUFFER_UTEXT) + { + aCustomMark = aPair.second->getString(); + bCustomMark = true; + } + } + m_aStates.top().nDestinationState = DESTINATION_FOOTNOTE; + if (bCustomMark) + Mapper().startCharacterGroup(); + resolveSubstream(m_nGroupStartPos - 1, nId, aCustomMark); + if (bCustomMark) + { + m_aStates.top().aCharacterAttributes.clear(); + m_aStates.top().aCharacterSprms.clear(); + RTFValue::Pointer_t pValue(new RTFValue(1)); + m_aStates.top().aCharacterAttributes.push_back(make_pair(NS_ooxml::LN_CT_FtnEdnRef_customMarkFollows, pValue)); + text(aCustomMark); + Mapper().endCharacterGroup(); + } + m_aStates.top().nDestinationState = DESTINATION_SKIP; + } + break; + case RTF_BKMKSTART: + m_aStates.top().nDestinationState = DESTINATION_BOOKMARKSTART; + break; + case RTF_BKMKEND: + m_aStates.top().nDestinationState = DESTINATION_BOOKMARKEND; + break; + case RTF_REVTBL: + m_aStates.top().nDestinationState = DESTINATION_REVISIONTABLE; + break; + case RTF_LISTTEXT: + // Should be ignored by any reader that understands Word 97 through Word 2007 numbering. + case RTF_NONESTTABLES: + // This destination should be ignored by readers that support nested tables. + m_aStates.top().nDestinationState = DESTINATION_SKIP; + break; + default: + OSL_TRACE("%s: TODO handle destination '%s'", OSL_THIS_FUNC, lcl_RtfToString(nKeyword)); + // Make sure we skip destinations (even without \*) till we don't handle them + m_aStates.top().nDestinationState = DESTINATION_SKIP; + bParsed = false; + break; + } + + skipDestination(bParsed); + return 0; +} + +int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) +{ + bool bParsed = true; + sal_uInt8 cCh = 0; + + // Trivial symbols + switch (nKeyword) + { + case RTF_LINE: cCh = '\n'; break; + case RTF_TAB: cCh = '\t'; break; + case RTF_BACKSLASH: cCh = '\\'; break; + case RTF_LBRACE: cCh = '{'; break; + case RTF_RBRACE: cCh = '}'; break; + case RTF_EMDASH: cCh = 151; break; + case RTF_ENDASH: cCh = 150; break; + case RTF_BULLET: cCh = 149; break; + case RTF_LQUOTE: cCh = 145; break; + case RTF_RQUOTE: cCh = 146; break; + case RTF_LDBLQUOTE: cCh = 147; break; + case RTF_RDBLQUOTE: cCh = 148; break; + default: break; + } + if (cCh > 0) + { + OUString aStr(OStringToOUString(OString(cCh), RTL_TEXTENCODING_MS_1252)); + text(aStr); + skipDestination(bParsed); + return 0; + } + + switch (nKeyword) + { + case RTF_IGNORE: + m_bSkipUnknown = true; + return 0; // don't reset m_bSkipUnknown after this keyword + break; + case RTF_PAR: + { + if (!m_bTable) + parBreak(); + else + { + RTFValue::Pointer_t pValue; + m_aTableBuffer.push_back(make_pair(BUFFER_PAR, pValue)); + } + // but don't emit properties yet, since they may change till the first text token arrives + m_bNeedPap = true; + } + break; + case RTF_SECT: + sectBreak(); + break; + case RTF_NOBREAK: + { + OUString aStr(SVT_HARD_SPACE); + text(aStr); + } + break; + case RTF_NOBRKHYPH: + { + OUString aStr(SVT_HARD_HYPHEN); + text(aStr); + } + break; + case RTF_OPTHYPH: + { + OUString aStr(SVT_SOFT_HYPHEN); + text(aStr); + } + break; + case RTF_HEXCHAR: + m_aStates.top().nInternalState = INTERNAL_HEX; + break; + case RTF_CELL: + case RTF_NESTCELL: + { + if (m_bNeedPap) + { + // There were no runs in the cell, so we need to send paragraph properties here. + RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms)); + m_aTableBuffer.push_back(make_pair(BUFFER_PROPS, pValue)); + } + + RTFValue::Pointer_t pValue; + m_aTableBuffer.push_back(make_pair(BUFFER_CELLEND, pValue)); + m_bNeedPap = true; + } + break; + case RTF_ROW: + case RTF_NESTROW: + { + writerfilter::Reference<Properties>::Pointer_t const pParagraphProperties( + new RTFReferenceProperties(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms) + ); + Mapper().props(pParagraphProperties); + + // Table width. + RTFValue::Pointer_t pUnitValue(new RTFValue(3)); + lcl_putNestedAttribute(m_aStates.top().aTableRowSprms, + NS_ooxml::LN_CT_TblPrBase_tblW, NS_ooxml::LN_CT_TblWidth_type, pUnitValue); + RTFValue::Pointer_t pWidthValue(new RTFValue(m_aStates.top().nCellX)); + lcl_putNestedAttribute(m_aStates.top().aTableRowSprms, + NS_ooxml::LN_CT_TblPrBase_tblW, NS_ooxml::LN_CT_TblWidth_w, pWidthValue); + + RTFValue::Pointer_t pRowValue(new RTFValue(1)); + m_aStates.top().aTableRowSprms.push_back(make_pair(NS_sprm::LN_PRow, pRowValue)); + writerfilter::Reference<Properties>::Pointer_t const pTableRowProperties( + new RTFReferenceProperties(m_aStates.top().aTableRowAttributes, m_aStates.top().aTableRowSprms) + ); + Mapper().props(pTableRowProperties); + + lcl_TableBreak(Mapper()); + m_bNeedPap = true; + m_aTableBuffer.clear(); + } + break; + case RTF_COLUMN: + { + sal_uInt8 sBreak[] = { 0xe }; + Mapper().startCharacterGroup(); + Mapper().text(sBreak, 1); + Mapper().endCharacterGroup(); + } + break; + case RTF_CHFTN: + // Nothing to do, dmapper assumes this is the default. + break; + default: + OSL_TRACE("%s: TODO handle symbol '%s'", OSL_THIS_FUNC, lcl_RtfToString(nKeyword)); + bParsed = false; + break; + } + skipDestination(bParsed); + return 0; +} + +int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) +{ + bool bParsed = true; + int nParam = -1; + + // Indentation + switch (nKeyword) + { + case RTF_QC: nParam = 1; break; + case RTF_QJ: nParam = 3; break; + case RTF_QL: nParam = 0; break; + case RTF_QR: nParam = 2; break; + case RTF_QD: nParam = 4; break; + default: break; + } + if (nParam >= 0) + { + RTFValue::Pointer_t pValue(new RTFValue(nParam)); + m_aStates.top().aParagraphSprms.push_back(make_pair(NS_sprm::LN_PJc, pValue)); + skipDestination(bParsed); + return 0; + } + + // Tab kind. + switch (nKeyword) + { + case RTF_TQR: nParam = 2; break; + case RTF_TQC: nParam = 1; break; + case RTF_TQDEC: nParam = 3; break; + default: break; + } + if (nParam >= 0) + { + RTFValue::Pointer_t pValue(new RTFValue(nParam)); + m_aStates.top().aTabAttributes.push_back(make_pair(NS_ooxml::LN_CT_TabStop_val, pValue)); + skipDestination(bParsed); + return 0; + } + + // Tab lead. + switch (nKeyword) + { + case RTF_TLDOT: nParam = 1; break; + case RTF_TLMDOT: nParam = NS_ooxml::LN_Value_ST_TabTlc_middleDot; break; + case RTF_TLHYPH: nParam = 2; break; + case RTF_TLUL: nParam = 3; break; + case RTF_TLTH: nParam = 2; break; // thick line is not supported by dmapper, this is just a hack + case RTF_TLEQ: nParam = 0; break; // equal sign isn't, either + default: break; + } + if (nParam >= 0) + { + RTFValue::Pointer_t pValue(new RTFValue(nParam)); + m_aStates.top().aTabAttributes.push_back(make_pair(NS_ooxml::LN_CT_TabStop_leader, pValue)); + skipDestination(bParsed); + return 0; + } + + // Border types + switch (nKeyword) + { + // brdrhair and brdrs are the same, brdrw will make a difference + case RTF_BRDRHAIR: nParam = editeng::SOLID; break; + case RTF_BRDRS: nParam = editeng::SOLID; break; + case RTF_BRDRDOT: nParam = editeng::DOTTED; break; + case RTF_BRDRDASH: nParam = editeng::DASHED; break; + case RTF_BRDRDB: nParam = editeng::DOUBLE; break; + case RTF_BRDRTNTHSG: nParam = editeng::THINTHICK_SMALLGAP; break; + case RTF_BRDRTNTHMG: nParam = editeng::THINTHICK_MEDIUMGAP; break; + case RTF_BRDRTNTHLG: nParam = editeng::THINTHICK_LARGEGAP; break; + case RTF_BRDRTHTNSG: nParam = editeng::THICKTHIN_SMALLGAP; break; + case RTF_BRDRTHTNMG: nParam = editeng::THICKTHIN_MEDIUMGAP; break; + case RTF_BRDRTHTNLG: nParam = editeng::THICKTHIN_LARGEGAP; break; + case RTF_BRDREMBOSS: nParam = editeng::EMBOSSED; break; + case RTF_BRDRENGRAVE: nParam = editeng::ENGRAVED; break; + case RTF_BRDROUTSET: nParam = editeng::OUTSET; break; + case RTF_BRDRINSET: nParam = editeng::INSET; break; + case RTF_BRDRNONE: nParam = editeng::NO_STYLE; break; + default: break; + } + if (nParam >= 0) + { + RTFValue::Pointer_t pValue(new RTFValue(nParam)); + lcl_putBorderProperty(m_aStates, NS_rtf::LN_BRCTYPE, pValue); + skipDestination(bParsed); + return 0; + } + + // Section breaks + switch (nKeyword) + { + case RTF_SBKNONE: nParam = 0; break; + case RTF_SBKCOL: nParam = 1; break; + case RTF_SBKPAGE: nParam = 2; break; + case RTF_SBKEVEN: nParam = 3; break; + case RTF_SBKODD: nParam = 4; break; + default: break; + } + if (nParam >= 0) + { + RTFValue::Pointer_t pValue(new RTFValue(nParam)); + m_aStates.top().aSectionSprms.push_back(make_pair(NS_sprm::LN_SBkc, pValue)); + skipDestination(bParsed); + return 0; + } + + // Trivial paragraph flags + switch (nKeyword) + { + case RTF_KEEP: nParam = NS_sprm::LN_PFKeep; break; + case RTF_KEEPN: nParam = NS_sprm::LN_PFKeepFollow; break; + case RTF_WIDCTLPAR: nParam = NS_sprm::LN_PFWidowControl; break; + case RTF_INTBL: m_bTable = true; nParam = NS_sprm::LN_PFInTable; break; + case RTF_PAGEBB: nParam = NS_sprm::LN_PFPageBreakBefore; break; + default: break; + } + if (nParam >= 0) + { + RTFValue::Pointer_t pValue(new RTFValue(1)); + m_aStates.top().aParagraphSprms.push_back(make_pair(nParam, pValue)); + skipDestination(bParsed); + return 0; + } + + switch (nKeyword) + { + case RTF_FNIL: + case RTF_FROMAN: + case RTF_FSWISS: + case RTF_FMODERN: + case RTF_FSCRIPT: + case RTF_FDECOR: + case RTF_FTECH: + case RTF_FBIDI: + // TODO ooxml:CT_Font_family seems to be ignored by the domain mapper + break; + case RTF_ANSI: + m_aStates.top().nCurrentEncoding = RTL_TEXTENCODING_MS_1252; + break; + case RTF_PLAIN: + m_aStates.top().aCharacterSprms = m_aDefaultState.aCharacterSprms; + m_aStates.top().aCharacterAttributes = m_aDefaultState.aCharacterAttributes; + break; + case RTF_PARD: + m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms; + m_aStates.top().aParagraphAttributes = m_aDefaultState.aParagraphAttributes; + m_bTable = false; + break; + case RTF_SECTD: + m_aStates.top().aSectionSprms = m_aDefaultState.aSectionSprms; + m_aStates.top().aSectionAttributes = m_aDefaultState.aSectionAttributes; + break; + case RTF_TROWD: + m_aStates.top().aTableRowSprms = m_aDefaultState.aTableRowSprms; + m_aStates.top().aTableRowAttributes = m_aDefaultState.aTableRowAttributes; + m_aStates.top().nCellX = 0; + m_aStates.top().aTableCellsSprms = m_aDefaultState.aTableCellsSprms; + m_aStates.top().aTableCellsAttributes = m_aDefaultState.aTableCellsAttributes; + break; + case RTF_NOWIDCTLPAR: + { + RTFValue::Pointer_t pValue(new RTFValue(0)); + m_aStates.top().aParagraphSprms.push_back(make_pair(NS_sprm::LN_PFWidowControl, pValue)); + } + break; + case RTF_BOX: + { + RTFSprms_t aAttributes; + RTFValue::Pointer_t pValue(new RTFValue(aAttributes)); + m_aStates.top().aParagraphSprms.push_back(make_pair(NS_sprm::LN_PBrcTop, pValue)); + m_aStates.top().aParagraphSprms.push_back(make_pair(NS_sprm::LN_PBrcLeft, pValue)); + m_aStates.top().aParagraphSprms.push_back(make_pair(NS_sprm::LN_PBrcBottom, pValue)); + m_aStates.top().aParagraphSprms.push_back(make_pair(NS_sprm::LN_PBrcRight, pValue)); + m_aStates.top().nBorderState = BORDER_PARAGRAPH; + } + break; + case RTF_LTRSECT: + case RTF_RTLSECT: + { + RTFValue::Pointer_t pValue(new RTFValue(nKeyword == RTF_LTRSECT ? 0 : 1)); + m_aStates.top().aParagraphSprms.push_back(make_pair(NS_sprm::LN_STextFlow, pValue)); + } + break; + case RTF_LTRPAR: + case RTF_RTLPAR: + { + RTFValue::Pointer_t pValue(new RTFValue(nKeyword == RTF_LTRPAR ? 0 : 1)); + m_aStates.top().aParagraphSprms.push_back(make_pair(NS_sprm::LN_PFrameTextFlow, pValue)); + } + break; + case RTF_LTRROW: + case RTF_RTLROW: + { + RTFValue::Pointer_t pValue(new RTFValue(nKeyword == RTF_LTRROW ? 0 : 1)); + m_aStates.top().aParagraphSprms.push_back(make_pair(NS_sprm::LN_TTextFlow, pValue)); + } + break; + case RTF_LTRCH: + case RTF_RTLCH: + // dmapper does not support these. + break; + case RTF_ULNONE: + { + RTFValue::Pointer_t pValue(new RTFValue(0)); + m_aStates.top().aCharacterSprms.push_back(make_pair(NS_sprm::LN_CKul, pValue)); + } + break; + case RTF_NONSHPPICT: + m_aStates.top().nDestinationState = DESTINATION_SKIP; + break; + case RTF_CLBRDRT: + case RTF_CLBRDRL: + case RTF_CLBRDRB: + case RTF_CLBRDRR: + { + RTFSprms_t aAttributes; + RTFSprms_t aSprms; + RTFValue::Pointer_t pValue(new RTFValue(aAttributes, aSprms)); + switch (nKeyword) + { + case RTF_CLBRDRT: nParam = NS_ooxml::LN_CT_TcBorders_top; break; + case RTF_CLBRDRL: nParam = NS_ooxml::LN_CT_TcBorders_left; break; + case RTF_CLBRDRB: nParam = NS_ooxml::LN_CT_TcBorders_bottom; break; + case RTF_CLBRDRR: nParam = NS_ooxml::LN_CT_TcBorders_right; break; + default: break; + } + lcl_putNestedSprm(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcBorders, nParam, pValue); + m_aStates.top().nBorderState = BORDER_CELL; + } + break; + case RTF_PGBRDRT: + case RTF_PGBRDRL: + case RTF_PGBRDRB: + case RTF_PGBRDRR: + { + RTFSprms_t aAttributes; + RTFSprms_t aSprms; + RTFValue::Pointer_t pValue(new RTFValue(aAttributes, aSprms)); + switch (nKeyword) + { + case RTF_PGBRDRT: nParam = NS_ooxml::LN_CT_PageBorders_top; break; + case RTF_PGBRDRL: nParam = NS_ooxml::LN_CT_PageBorders_left; break; + case RTF_PGBRDRB: nParam = NS_ooxml::LN_CT_PageBorders_bottom; break; + case RTF_PGBRDRR: nParam = NS_ooxml::LN_CT_PageBorders_right; break; + default: break; + } + lcl_putNestedSprm(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgBorders, nParam, pValue); + m_aStates.top().nBorderState = BORDER_PAGE; + } + break; + case RTF_CLVMGF: + { + RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_ST_Merge_restart)); + m_aStates.top().aTableCellSprms.push_back(make_pair(NS_ooxml::LN_CT_TcPrBase_vMerge, pValue)); + } + break; + case RTF_CLVMRG: + { + RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_ST_Merge_continue)); + m_aStates.top().aTableCellSprms.push_back(make_pair(NS_ooxml::LN_CT_TcPrBase_vMerge, pValue)); + } + break; + case RTF_CLVERTALT: + case RTF_CLVERTALC: + case RTF_CLVERTALB: + { + switch (nKeyword) + { + case RTF_CLVERTALT: nParam = 0; break; + case RTF_CLVERTALC: nParam = 1; break; + case RTF_CLVERTALB: nParam = 3; break; + default: break; + } + RTFValue::Pointer_t pValue(new RTFValue(nParam)); + m_aStates.top().aTableCellSprms.push_back(make_pair(NS_ooxml::LN_CT_TcPrBase_vAlign, pValue)); + } + break; + case RTF_TRKEEP: + { + RTFValue::Pointer_t pValue(new RTFValue(1)); + m_aStates.top().aTableRowSprms.push_back(make_pair(NS_sprm::LN_TCantSplit, pValue)); + } + case RTF_SECTUNLOCKED: + { + RTFValue::Pointer_t pValue(new RTFValue(!nParam)); + m_aStates.top().aSectionSprms.push_back(make_pair(NS_ooxml::LN_EG_SectPrContents_formProt, pValue)); + } + case RTF_PGNDEC: + case RTF_PGNUCRM: + case RTF_PGNLCRM: + case RTF_PGNUCLTR: + case RTF_PGNLCLTR: + case RTF_PGNBIDIA: + case RTF_PGNBIDIB: + break; + // These should be mapped to NS_ooxml::LN_EG_SectPrContents_pgNumType, but dmapper has no API for that at the moment. + break; + case RTF_LOCH: + // Noop, dmapper detects this automatically. + break; + case RTF_HICH: + m_aStates.top().bIsCjk = true; + break; + case RTF_DBCH: + m_aStates.top().bIsCjk = false; + break; + case RTF_TITLEPG: + { + RTFValue::Pointer_t pValue(new RTFValue(1)); + m_aStates.top().aSectionSprms.push_back(make_pair(NS_ooxml::LN_EG_SectPrContents_titlePg, pValue)); + } + break; + case RTF_SUPER: + { + m_bSuper = true; + OUString aValue(RTL_CONSTASCII_USTRINGPARAM("superscript")); + RTFValue::Pointer_t pValue(new RTFValue(aValue)); + m_aStates.top().aCharacterSprms.push_back(make_pair(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue)); + } + break; + case RTF_SUB: + { + OUString aValue(RTL_CONSTASCII_USTRINGPARAM("subscript")); + RTFValue::Pointer_t pValue(new RTFValue(aValue)); + m_aStates.top().aCharacterSprms.push_back(make_pair(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue)); + } + break; + case RTF_LINEPPAGE: + case RTF_LINECONT: + { + RTFValue::Pointer_t pValue(new RTFValue(nKeyword == RTF_LINEPPAGE ? 0 : 2)); + lcl_putNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_lnNumType, NS_ooxml::LN_CT_LineNumber_restart, pValue); + } + break; + default: + OSL_TRACE("%s: TODO handle flag '%s'", OSL_THIS_FUNC, lcl_RtfToString(nKeyword)); + bParsed = false; + break; + } + skipDestination(bParsed); + return 0; +} + +int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) +{ + bool bParsed = true; + int nSprm = 0; + RTFValue::Pointer_t pIntValue(new RTFValue(nParam)); + // Trivial table sprms. + switch (nKeyword) + { + case RTF_FPRQ: nSprm = NS_rtf::LN_PRQ; break; + case RTF_LEVELJC: nSprm = NS_ooxml::LN_CT_Lvl_lvlJc; break; + case RTF_LEVELNFC: nSprm = NS_rtf::LN_NFC; break; + case RTF_LEVELSTARTAT: nSprm = NS_rtf::LN_ISTARTAT; break; + default: break; + } + if (nSprm > 0) + { + m_aStates.top().aTableSprms.push_back(make_pair(nSprm, pIntValue)); + skipDestination(bParsed); + return 0; + } + // Trivial character sprms. + switch (nKeyword) + { + case RTF_AF: nSprm = (m_aStates.top().bIsCjk ? NS_sprm::LN_CRgFtc1 : NS_sprm::LN_CRgFtc2); break; + case RTF_FS: nSprm = NS_sprm::LN_CHps; break; + case RTF_AFS: nSprm = NS_sprm::LN_CHpsBi; break; + case RTF_ANIMTEXT: nSprm = NS_sprm::LN_CSfxText; break; + case RTF_EXPNDTW: nSprm = NS_sprm::LN_CDxaSpace; break; + case RTF_KERNING: nSprm = NS_sprm::LN_CHpsKern; break; + case RTF_CHARSCALEX: nSprm = NS_sprm::LN_CCharScale; break; + case RTF_LANG: nSprm = NS_sprm::LN_CRgLid0; break; + case RTF_LANGFE: nSprm = NS_sprm::LN_CRgLid1; break; + default: break; + } + if (nSprm > 0) + { + m_aStates.top().aCharacterSprms.push_back(make_pair(nSprm, pIntValue)); + skipDestination(bParsed); + return 0; + } + // Trivial paragraph sprms. + switch (nKeyword) + { + case RTF_FI: nSprm = NS_sprm::LN_PDxaLeft1; break; + case RTF_LI: nSprm = NS_sprm::LN_PDxaLeft; break; + case RTF_LIN: nSprm = 0x845e; break; + case RTF_RI: nSprm = NS_sprm::LN_PDxaRight; break; + case RTF_RIN: nSprm = 0x845d; break; + case RTF_SB: nSprm = NS_sprm::LN_PDyaBefore; break; + case RTF_SA: nSprm = NS_sprm::LN_PDyaAfter; break; + case RTF_ITAP: nSprm = NS_sprm::LN_PTableDepth; break; + default: break; + } + if (nSprm > 0) + { + m_aStates.top().aParagraphSprms.push_back(make_pair(nSprm, pIntValue)); + skipDestination(bParsed); + return 0; + } + + // Trivial table attributes. + switch (nKeyword) + { + case RTF_SBASEDON: nSprm = NS_rtf::LN_ISTDBASE; break; + case RTF_SNEXT: nSprm = NS_rtf::LN_ISTDNEXT; break; + default: break; + } + if (nSprm > 0) + { + m_aStates.top().aTableAttributes.push_back(make_pair(nSprm, pIntValue)); + skipDestination(bParsed); + return 0; + } + + // Trivial paragraph attributes. + switch (nKeyword) + { + // NS_sprm::LN_PDyaLine could be used, but that won't work with slmult + case RTF_SL: nSprm = NS_ooxml::LN_CT_Spacing_line; break; + default: break; + } + if (nSprm > 0) + { + m_aStates.top().aParagraphAttributes.push_back(make_pair(nSprm, pIntValue)); + skipDestination(bParsed); + return 0; + } + + // Trivial character attributes. + switch (nKeyword) + { + case RTF_PICW: nSprm = NS_rtf::LN_XEXT; if (m_aStates.top().nPictureScaleX) nParam = m_aStates.top().nPictureScaleX * nParam; break; + case RTF_PICH: nSprm = NS_rtf::LN_YEXT; if (m_aStates.top().nPictureScaleY) nParam = m_aStates.top().nPictureScaleY * nParam; break; + default: break; + } + if (nSprm > 0) + { + RTFValue::Pointer_t pValue(new RTFValue(nParam)); + m_aStates.top().aCharacterAttributes.push_back(make_pair(nSprm, pValue)); + skipDestination(bParsed); + return 0; + } + + // Then check for the more complex ones. + switch (nKeyword) + { + case RTF_F: + if (m_aStates.top().nDestinationState == DESTINATION_FONTENTRY) + m_aStates.top().nCurrentFontIndex = nParam; + else + { + m_aStates.top().aCharacterSprms.push_back(make_pair(NS_sprm::LN_CRgFtc0, pIntValue)); + m_aStates.top().nCurrentEncoding = getEncodingTable(nParam); + } + break; + case RTF_RED: + m_aStates.top().aCurrentColor.nRed = nParam; + break; + case RTF_GREEN: + m_aStates.top().aCurrentColor.nGreen = nParam; + break; + case RTF_BLUE: + m_aStates.top().aCurrentColor.nBlue = nParam; + break; + case RTF_FCHARSET: + { + // we always send text to the domain mapper in OUString, so no + // need to send encoding info + int i; + for (i = 0; i < nRTFEncodings; i++) + { + if (aRTFEncodings[i].charset == nParam) + break; + } + if (i == nRTFEncodings) + // not found + return 0; + m_aFontEncodings[m_aStates.top().nCurrentFontIndex] = rtl_getTextEncodingFromWindowsCodePage(aRTFEncodings[i].codepage); + } + break; + case RTF_CF: + { + // NS_sprm::LN_CIco won't work, that would be an index in a static table + m_aStates.top().aCharacterAttributes.push_back(make_pair(NS_ooxml::LN_CT_Color_val, pIntValue)); + } + break; + case RTF_S: + if (m_aStates.top().nDestinationState == DESTINATION_STYLEENTRY) + { + m_aStates.top().nCurrentStyleIndex = nParam; + m_aStates.top().aTableAttributes.push_back(make_pair(NS_rtf::LN_ISTD, pIntValue)); + } + else + m_aStates.top().aParagraphAttributes.push_back(make_pair(NS_rtf::LN_ISTD, pIntValue)); + break; + case RTF_CS: + if (m_aStates.top().nDestinationState == DESTINATION_STYLEENTRY) + { + m_aStates.top().nCurrentStyleIndex = nParam; + m_aStates.top().aTableAttributes.push_back(make_pair(NS_rtf::LN_ISTD, pIntValue)); + RTFValue::Pointer_t pValue(new RTFValue(2)); + m_aStates.top().aTableAttributes.push_back(make_pair(NS_rtf::LN_SGC, pValue)); // character style + } + else + m_aStates.top().aCharacterAttributes.push_back(make_pair(NS_rtf::LN_ISTD, pIntValue)); + break; + case RTF_DEFF: + m_aDefaultState.aCharacterSprms.push_back(make_pair(NS_sprm::LN_CRgFtc0, pIntValue)); + break; + case RTF_DEFLANG: + m_aDefaultState.aCharacterSprms.push_back(make_pair(NS_sprm::LN_CRgLid0, pIntValue)); + break; + case RTF_ADEFLANG: + m_aDefaultState.aCharacterSprms.push_back(make_pair(NS_sprm::LN_CLidBi, pIntValue)); + break; + case RTF_CHCBPAT: + { + RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam))); + lcl_putNestedAttribute(m_aStates.top().aCharacterSprms, NS_sprm::LN_CShd, NS_ooxml::LN_CT_Shd_fill, pValue); + } + break; + case RTF_CLCBPAT: + { + RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam))); + lcl_putNestedAttribute(m_aStates.top().aTableCellSprms, + NS_ooxml::LN_CT_TcPrBase_shd, NS_ooxml::LN_CT_Shd_fill, pValue); + } + break; + case RTF_CBPAT: + { + RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam))); + lcl_putNestedAttribute(m_aStates.top().aParagraphSprms, NS_sprm::LN_PShd, NS_ooxml::LN_CT_Shd_fill, pValue); + } + break; + case RTF_ULC: + { + RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam))); + m_aStates.top().aCharacterSprms.push_back(make_pair(0x6877, pValue)); + } + break; + case RTF_UP: // TODO handle when point size is not shrinking + { + OUString aValue(RTL_CONSTASCII_USTRINGPARAM("superscript")); + RTFValue::Pointer_t pValue(new RTFValue(aValue)); + m_aStates.top().aCharacterSprms.push_back(make_pair(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue)); + } + break; + case RTF_DN: + { + OUString aValue(RTL_CONSTASCII_USTRINGPARAM("subscript")); + RTFValue::Pointer_t pValue(new RTFValue(aValue)); + m_aStates.top().aCharacterSprms.push_back(make_pair(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue)); + } + break; + case RTF_HORZVERT: + { + RTFValue::Pointer_t pValue(new RTFValue(true)); + m_aStates.top().aCharacterAttributes.push_back(make_pair(NS_ooxml::LN_CT_EastAsianLayout_vert, pValue)); + if (nParam) + // rotate fits to a single line + m_aStates.top().aCharacterAttributes.push_back(make_pair(NS_ooxml::LN_CT_EastAsianLayout_vertCompress, pValue)); + } + break; + case RTF_EXPND: + { + RTFValue::Pointer_t pValue(new RTFValue(nParam/5)); + m_aStates.top().aCharacterSprms.push_back(make_pair(NS_sprm::LN_CDxaSpace, pValue)); + } + break; + case RTF_TWOINONE: + { + RTFValue::Pointer_t pValue(new RTFValue(true)); + m_aStates.top().aCharacterAttributes.push_back(make_pair(NS_ooxml::LN_CT_EastAsianLayout_combine, pValue)); + if (nParam > 0) + m_aStates.top().aCharacterAttributes.push_back(make_pair(NS_ooxml::LN_CT_EastAsianLayout_combineBrackets, pIntValue)); + } + break; + case RTF_SLMULT: + if (nParam > 0) + { + RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_wordprocessingml_ST_LineSpacingRule_auto)); + m_aStates.top().aParagraphAttributes.push_back(make_pair(NS_ooxml::LN_CT_Spacing_lineRule, pValue)); + } + break; + case RTF_BRDRW: + { + // dmapper expects it in 1/8 pt, we have it in twip - but avoid rounding 1 to 0 + if (nParam > 1) + nParam = nParam * 2 / 5; + RTFValue::Pointer_t pValue(new RTFValue(nParam)); + lcl_putBorderProperty(m_aStates, NS_rtf::LN_DPTLINEWIDTH, pValue); + } + break; + case RTF_BRDRCF: + { + RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam))); + lcl_putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_color, pValue); + } + break; + case RTF_BRSP: + { + // dmapper expects it in points, we have it in twip + RTFValue::Pointer_t pValue(new RTFValue(nParam / 20)); + lcl_putBorderProperty(m_aStates, NS_rtf::LN_DPTSPACE, pValue); + } + break; + case RTF_TX: + { + m_aStates.top().aTabAttributes.push_back(make_pair(NS_ooxml::LN_CT_TabStop_pos, pIntValue)); + RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aTabAttributes)); + lcl_putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_tabs, NS_ooxml::LN_CT_Tabs_tab, pValue); + m_aStates.top().aTabAttributes.clear(); + } + break; + case RTF_ILVL: + { + RTFSprms_t& rSprms = lcl_getNumPr(m_aStates); + rSprms.push_back(make_pair(NS_sprm::LN_PIlvl, pIntValue)); + } + case RTF_LISTTEMPLATEID: + // This one is not referenced anywhere, so it's pointless to store it at the moment. + break; + case RTF_LISTID: + { + if (m_aStates.top().nDestinationState == DESTINATION_LISTENTRY) + m_aStates.top().aTableAttributes.push_back(make_pair(NS_ooxml::LN_CT_AbstractNum_abstractNumId, pIntValue)); + else if (m_aStates.top().nDestinationState == DESTINATION_LISTOVERRIDEENTRY) + m_aStates.top().aTableSprms.push_back(make_pair(NS_ooxml::LN_CT_Num_abstractNumId, pIntValue)); + } + break; + case RTF_LS: + { + if (m_aStates.top().nDestinationState == DESTINATION_LISTOVERRIDEENTRY) + m_aStates.top().aTableAttributes.push_back(make_pair(NS_rtf::LN_LSID, pIntValue)); + else + { + RTFSprms_t& rSprms = lcl_getNumPr(m_aStates); + rSprms.push_back(make_pair(NS_sprm::LN_PIlfo, pIntValue)); + } + } + break; + case RTF_U: + if ((SAL_MIN_INT16 <= nParam) && (nParam <= SAL_MAX_INT16)) + { + OUString aStr(static_cast<sal_Unicode>(nParam)); + text(aStr); + m_aStates.top().nCharsToSkip = m_aStates.top().nUc; + } + break; + case RTF_LEVELFOLLOW: + case RTF_LISTOVERRIDECOUNT: + // Ignore these for now, the exporter always emits them with a zero parameter. + break; + case RTF_PICSCALEX: + m_aStates.top().nPictureScaleX = 0.01 * nParam; + break; + case RTF_PICSCALEY: + m_aStates.top().nPictureScaleY = 0.01 * nParam; + break; + case RTF_SHPWRK: + { + int nValue = 0; + switch (nParam) + { + case 0: nValue = NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_bothSides; break; + case 1: nValue = NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_left; break; + case 2: nValue = NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_right; break; + case 3: nValue = NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_largest; break; + default: break; + } + RTFValue::Pointer_t pValue(new RTFValue(nValue)); + m_aStates.top().aCharacterAttributes.push_back(make_pair(NS_ooxml::LN_CT_WrapSquare_wrapText, pValue)); + } + break; + case RTF_CELLX: + { + int nCellX = nParam - m_aStates.top().nCellX; + m_aStates.top().nCellX = nParam; + RTFValue::Pointer_t pXValue(new RTFValue(nCellX)); + m_aStates.top().aTableRowSprms.push_back(make_pair(NS_ooxml::LN_CT_TblGridBase_gridCol, pXValue)); + + replayBuffer(m_aTableBuffer); + + // Reset cell properties. + RTFSprms::Pointer_t pTableCellSprms(new RTFSprms_t(m_aStates.top().aTableCellSprms)); + m_aStates.top().aTableCellsSprms.push_back(pTableCellSprms); + RTFSprms::Pointer_t pTableCellAttributes(new RTFSprms_t(m_aStates.top().aTableCellAttributes)); + m_aStates.top().aTableCellsAttributes.push_back(pTableCellAttributes); + m_aStates.top().aTableCellSprms = m_aDefaultState.aTableCellSprms; + m_aStates.top().aTableCellAttributes = m_aDefaultState.aTableCellAttributes; + } + break; + case RTF_TRRH: + { + lcl_putNestedAttribute(m_aStates.top().aTableRowSprms, + NS_ooxml::LN_CT_TrPrBase_trHeight, NS_ooxml::LN_CT_Height_val, pIntValue); + } + break; + case RTF_COLS: + lcl_putNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_cols, NS_ooxml::LN_CT_Columns_num, pIntValue); + break; + case RTF_COLSX: + lcl_putNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_cols, NS_ooxml::LN_CT_Columns_space, pIntValue); + break; + case RTF_COLNO: + lcl_putNestedSprm(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_cols, NS_ooxml::LN_CT_Columns_col, pIntValue); + break; + case RTF_COLW: + case RTF_COLSR: + { + RTFSprms_t& rAttributes = lcl_getLastAttributes(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_cols); + rAttributes.push_back(make_pair((nKeyword == RTF_COLW ? NS_ooxml::LN_CT_Column_w : NS_ooxml::LN_CT_Column_space), + pIntValue)); + } + break; + case RTF_PAPERH: + lcl_putNestedAttribute(m_aDefaultState.aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_h, pIntValue, true); + break; + case RTF_PAPERW: + lcl_putNestedAttribute(m_aDefaultState.aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_w, pIntValue, true); + break; + case RTF_PGHSXN: + lcl_putNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_h, pIntValue, true); + break; + case RTF_PGWSXN: + lcl_putNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_w, pIntValue, true); + break; + case RTF_MARGL: + lcl_putNestedAttribute(m_aDefaultState.aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_left, pIntValue, true); + break; + case RTF_MARGR: + lcl_putNestedAttribute(m_aDefaultState.aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_right, pIntValue, true); + break; + case RTF_MARGT: + lcl_putNestedAttribute(m_aDefaultState.aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_top, pIntValue, true); + break; + case RTF_MARGB: + lcl_putNestedAttribute(m_aDefaultState.aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_bottom, pIntValue, true); + break; + case RTF_MARGLSXN: + lcl_putNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_left, pIntValue, true); + break; + case RTF_MARGRSXN: + lcl_putNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_right, pIntValue, true); + break; + case RTF_MARGTSXN: + lcl_putNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_top, pIntValue, true); + break; + case RTF_MARGBSXN: + lcl_putNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_bottom, pIntValue, true); + break; + case RTF_HEADERY: + lcl_putNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_header, pIntValue, true); + break; + case RTF_FOOTERY: + lcl_putNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_footer, pIntValue, true); + break; + case RTF_DEFTAB: + m_aSettingsTableSprms.push_back(make_pair(NS_ooxml::LN_CT_Settings_defaultTabStop, pIntValue)); + break; + case RTF_LINEMOD: + lcl_putNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_lnNumType, NS_ooxml::LN_CT_LineNumber_countBy, pIntValue); + break; + case RTF_LINEX: + if (nParam) + lcl_putNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_lnNumType, NS_ooxml::LN_CT_LineNumber_distance, pIntValue); + break; + case RTF_LINESTARTS: + lcl_putNestedAttribute(m_aStates.top().aSectionSprms, + NS_ooxml::LN_EG_SectPrContents_lnNumType, NS_ooxml::LN_CT_LineNumber_start, pIntValue); + break; + case RTF_REVAUTH: + case RTF_REVAUTHDEL: + { + RTFValue::Pointer_t pValue(new RTFValue(m_aAuthors[nParam])); + lcl_putNestedAttribute(m_aStates.top().aCharacterSprms, + NS_ooxml::LN_trackchange, NS_ooxml::LN_CT_TrackChange_author, pValue); + } + break; + case RTF_REVDTTM: + case RTF_REVDTTMDEL: + { + OUString aStr(OStringToOUString(lcl_DTTM22OString(nParam), m_aStates.top().nCurrentEncoding)); + RTFValue::Pointer_t pValue(new RTFValue(aStr)); + lcl_putNestedAttribute(m_aStates.top().aCharacterSprms, + NS_ooxml::LN_trackchange, NS_ooxml::LN_CT_TrackChange_date, pValue); + } + break; + default: + OSL_TRACE("%s: TODO handle value '%s'", OSL_THIS_FUNC, lcl_RtfToString(nKeyword)); + bParsed = false; + break; + } + skipDestination(bParsed); + return 0; +} + +int RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam) +{ + bool bParsed = true; + int nSprm = -1; + RTFValue::Pointer_t pBoolValue(new RTFValue(!bParam || nParam != 0)); + + // Map all underline keywords to a single sprm. + switch (nKeyword) + { + case RTF_UL: nSprm = 1; break; + case RTF_ULD: nSprm = 4; break; + case RTF_ULDASH: nSprm = 7; break; + case RTF_ULDASHD: nSprm = 9; break; + case RTF_ULDASHDD: nSprm = 10; break; + case RTF_ULDB: nSprm = 3; break; + case RTF_ULHWAVE: nSprm = 27; break; + case RTF_ULLDASH: nSprm = 39; break; + case RTF_ULTH: nSprm = 6; break; + case RTF_ULTHD: nSprm = 20; break; + case RTF_ULTHDASH: nSprm = 23; break; + case RTF_ULTHDASHD: nSprm = 25; break; + case RTF_ULTHDASHDD: nSprm = 26; break; + case RTF_ULTHLDASH: nSprm = 55; break; + case RTF_ULULDBWAVE: nSprm = 43; break; + case RTF_ULW: nSprm = 2; break; + case RTF_ULWAVE: nSprm = 11; break; + default: break; + } + if (nSprm >= 0) + { + RTFValue::Pointer_t pValue(new RTFValue((!bParam || nParam != 0) ? nSprm : 0)); + m_aStates.top().aCharacterSprms.push_back(make_pair(NS_sprm::LN_CKul, pValue)); + skipDestination(bParsed); + return 0; + } + + // Accent characters (over dot / over coma). + switch (nKeyword) + { + case RTF_ACCNONE: nSprm = 0; break; + case RTF_ACCDOT: nSprm = 1; break; + case RTF_ACCCOMMA: nSprm = 2; break; + case RTF_ACCCIRCLE: nSprm = 3; break; + case RTF_ACCUNDERDOT: nSprm = 4; break; + default: break; + } + if (nSprm >= 0) + { + RTFValue::Pointer_t pValue(new RTFValue((!bParam || nParam != 0) ? nSprm : 0)); + m_aStates.top().aCharacterSprms.push_back(make_pair(NS_sprm::LN_CKcd, pValue)); + skipDestination(bParsed); + return 0; + } + + // Trivial character sprms. + switch (nKeyword) + { + case RTF_B: nSprm = NS_sprm::LN_CFBold; break; + case RTF_AB: nSprm = NS_sprm::LN_CFBoldBi; break; + case RTF_I: nSprm = NS_sprm::LN_CFItalic; break; + case RTF_AI: nSprm = NS_sprm::LN_CFItalicBi; break; + case RTF_UL: nSprm = NS_sprm::LN_CKul; break; + case RTF_OUTL: nSprm = NS_sprm::LN_CFOutline; break; + case RTF_SHAD: nSprm = NS_sprm::LN_CFShadow; break; + case RTF_V: nSprm = NS_sprm::LN_CFVanish; break; + case RTF_STRIKE: nSprm = NS_sprm::LN_CFStrike; break; + case RTF_STRIKED: nSprm = NS_sprm::LN_CFDStrike; break; + case RTF_SCAPS: nSprm = NS_sprm::LN_CFSmallCaps; break; + case RTF_IMPR: nSprm = NS_sprm::LN_CFImprint; break; + default: break; + } + if (nSprm >= 0) + { + m_aStates.top().aCharacterSprms.push_back(make_pair(nSprm, pBoolValue)); + skipDestination(bParsed); + return 0; + } + + switch (nKeyword) + { + case RTF_ASPALPHA: + m_aStates.top().aParagraphSprms.push_back(make_pair(NS_sprm::LN_PFAutoSpaceDE, pBoolValue)); + break; + case RTF_DELETED: + case RTF_REVISED: + { + RTFValue::Pointer_t pValue(new RTFValue(nKeyword == RTF_DELETED ? ooxml::OOXML_del : ooxml::OOXML_ins)); + lcl_putNestedAttribute(m_aStates.top().aCharacterSprms, + NS_ooxml::LN_trackchange, NS_ooxml::LN_token, pValue); + } + break; + default: + OSL_TRACE("%s: TODO handle toggle '%s'", OSL_THIS_FUNC, lcl_RtfToString(nKeyword)); + bParsed = false; + break; + } + skipDestination(bParsed); + return 0; +} + +void RTFDocumentImpl::skipDestination(bool bParsed) +{ + if (m_bSkipUnknown) + { + if (!bParsed) + { + OSL_TRACE("%s: skipping destination", OSL_THIS_FUNC); + m_aStates.top().nDestinationState = DESTINATION_SKIP; + } + m_bSkipUnknown = false; + } +} + +int RTFDocumentImpl::dispatchKeyword(OString& rKeyword, bool bParam, int nParam) +{ + if (m_aStates.top().nDestinationState == DESTINATION_SKIP) + return 0; + /*OSL_TRACE("%s: keyword '\\%s' with param? %d param val: '%d'", OSL_THIS_FUNC, + rKeyword.getStr(), (bParam ? 1 : 0), (bParam ? nParam : 0));*/ + int i, ret; + for (i = 0; i < nRTFControlWords; i++) + { + if (!strcmp(rKeyword.getStr(), aRTFControlWords[i].sKeyword)) + break; + } + if (i == nRTFControlWords) + { + OSL_TRACE("%s: unknown keyword '\\%s'", OSL_THIS_FUNC, rKeyword.getStr()); + skipDestination(false); + return 0; + } + + switch (aRTFControlWords[i].nControlType) + { + case CONTROL_FLAG: + // flags ignore any parameter by definition + if ((ret = dispatchFlag(aRTFControlWords[i].nIndex))) + return ret; + break; + case CONTROL_DESTINATION: + // same for destinations + if ((ret = dispatchDestination(aRTFControlWords[i].nIndex))) + return ret; + break; + case CONTROL_SYMBOL: + // and symbols + if ((ret = dispatchSymbol(aRTFControlWords[i].nIndex))) + return ret; + break; + case CONTROL_TOGGLE: + if ((ret = dispatchToggle(aRTFControlWords[i].nIndex, bParam, nParam))) + return ret; + break; + case CONTROL_VALUE: + // values require a parameter by definition + if (bParam && (ret = dispatchValue(aRTFControlWords[i].nIndex, nParam))) + return ret; + break; + } + + return 0; +} + +int RTFDocumentImpl::resolveKeyword() +{ + char ch; + OStringBuffer aBuf; + bool bNeg = false; + bool bParam = false; + int nParam = 0; + + Strm() >> ch; + if (Strm().IsEof()) + return ERROR_EOF; + + if (!isalpha(ch)) + { + aBuf.append(ch); + OString aKeyword = aBuf.makeStringAndClear(); + // control symbols aren't followed by a space, so we can return here + // without doing any SeekRel() + return dispatchKeyword(aKeyword, bParam, nParam); + } + while(isalpha(ch)) + { + aBuf.append(ch); + Strm() >> ch; + } + + if (ch == '-') + { + // in case we'll have a parameter, that will be negative + bNeg = true; + Strm() >> ch; + if (Strm().IsEof()) + return ERROR_EOF; + } + if (isdigit(ch)) + { + OStringBuffer aParameter; + + // we have a parameter + bParam = true; + while(isdigit(ch)) + { + aParameter.append(ch); + Strm() >> ch; + } + nParam = aParameter.makeStringAndClear().toInt32(); + if (bNeg) + nParam = -nParam; + } + if (ch != ' ') + Strm().SeekRel(-1); + OString aKeyword = aBuf.makeStringAndClear(); + return dispatchKeyword(aKeyword, bParam, nParam); +} + +int RTFDocumentImpl::pushState() +{ + //OSL_TRACE("%s before push: %d", OSL_THIS_FUNC, m_nGroup); + + m_nGroupStartPos = Strm().Tell(); + RTFParserState aState; + if (m_aStates.empty()) + aState = m_aDefaultState; + else + aState = m_aStates.top(); + m_aStates.push(aState); + + m_nGroup++; + + if (m_aStates.top().nDestinationState == DESTINATION_FONTTABLE) + m_aStates.top().nDestinationState = DESTINATION_FONTENTRY; + else if (m_aStates.top().nDestinationState == DESTINATION_STYLESHEET) + m_aStates.top().nDestinationState = DESTINATION_STYLEENTRY; + else if (m_aStates.top().nDestinationState == DESTINATION_FIELDRESULT) + m_aStates.top().nDestinationState = DESTINATION_NORMAL; + else if (m_aStates.top().nDestinationState == DESTINATION_REVISIONTABLE) + m_aStates.top().nDestinationState = DESTINATION_REVISIONENTRY; + + return 0; +} + +RTFSprms_t RTFDocumentImpl::mergeSprms() +{ + RTFSprms_t aSprms; + for (RTFSprms_t::iterator i = m_aStates.top().aTableSprms.begin(); + i != m_aStates.top().aTableSprms.end(); ++i) + aSprms.push_back(make_pair(i->first, i->second)); + for (RTFSprms_t::iterator i = m_aStates.top().aCharacterSprms.begin(); + i != m_aStates.top().aCharacterSprms.end(); ++i) + aSprms.push_back(make_pair(i->first, i->second)); + for (RTFSprms_t::iterator i = m_aStates.top().aParagraphSprms.begin(); + i != m_aStates.top().aParagraphSprms.end(); ++i) + aSprms.push_back(make_pair(i->first, i->second)); + return aSprms; +} + +RTFSprms_t RTFDocumentImpl::mergeAttributes() +{ + RTFSprms_t aAttributes; + for (RTFSprms_t::iterator i = m_aStates.top().aTableAttributes.begin(); + i != m_aStates.top().aTableAttributes.end(); ++i) + aAttributes.push_back(make_pair(i->first, i->second)); + for (RTFSprms_t::iterator i = m_aStates.top().aCharacterAttributes.begin(); + i != m_aStates.top().aCharacterAttributes.end(); ++i) + aAttributes.push_back(make_pair(i->first, i->second)); + for (RTFSprms_t::iterator i = m_aStates.top().aParagraphAttributes.begin(); + i != m_aStates.top().aParagraphAttributes.end(); ++i) + aAttributes.push_back(make_pair(i->first, i->second)); + return aAttributes; +} + +int RTFDocumentImpl::popState() +{ + //OSL_TRACE("%s before pop: m_nGroup %d, dest state: %d", OSL_THIS_FUNC, m_nGroup, m_aStates.top().nDestinationState); + + RTFReferenceTable::Entry_t aEntry; + bool bFontEntryEnd = false; + bool bStyleEntryEnd = false; + RTFSprms_t aSprms; + RTFSprms_t aAttributes; + bool bListEntryEnd = false; + bool bListLevelEnd = false; + bool bListOverrideEntryEnd = false; + bool bLevelTextEnd = false; + std::vector< std::pair<rtl::OUString, rtl::OUString> > aShapeProperties; + bool bPopShapeProperties = false; + bool bPicPropEnd = false; + + if (m_aStates.top().nDestinationState == DESTINATION_FONTTABLE) + { + writerfilter::Reference<Table>::Pointer_t const pTable(new RTFReferenceTable(m_aStates.top().aFontTableEntries)); + Mapper().table(NS_rtf::LN_FONTTABLE, pTable); + } + else if (m_aStates.top().nDestinationState == DESTINATION_STYLESHEET) + { + writerfilter::Reference<Table>::Pointer_t const pTable(new RTFReferenceTable(m_aStates.top().aStyleTableEntries)); + Mapper().table(NS_rtf::LN_STYLESHEET, pTable); + } + else if (m_aStates.top().nDestinationState == DESTINATION_LISTOVERRIDETABLE) + { + RTFSprms_t aListTableAttributes; + writerfilter::Reference<Properties>::Pointer_t const pProp(new RTFReferenceProperties(aListTableAttributes, m_aListTableSprms)); + RTFReferenceTable::Entries_t aListTableEntries; + aListTableEntries.insert(make_pair(0, pProp)); + writerfilter::Reference<Table>::Pointer_t const pTable(new RTFReferenceTable(aListTableEntries)); + Mapper().table(NS_rtf::LN_LISTTABLE, pTable); + } + else if (m_aStates.top().nDestinationState == DESTINATION_FONTENTRY) + { + RTFValue::Pointer_t pValue(new RTFValue(m_aDestinationText.makeStringAndClear())); + m_aStates.top().aTableAttributes.push_back(make_pair(NS_rtf::LN_XSZFFN, pValue)); + + bFontEntryEnd = true; + writerfilter::Reference<Properties>::Pointer_t const pProp( + new RTFReferenceProperties(m_aStates.top().aTableAttributes, m_aStates.top().aTableSprms) + ); + aEntry.first = m_aStates.top().nCurrentFontIndex; + aEntry.second = pProp; + } + else if (m_aStates.top().nDestinationState == DESTINATION_STYLEENTRY) + { + RTFValue::Pointer_t pValue(new RTFValue(m_aDestinationText.makeStringAndClear())); + m_aStates.top().aTableAttributes.push_back(make_pair(NS_rtf::LN_XSTZNAME1, pValue)); + + bStyleEntryEnd = true; + writerfilter::Reference<Properties>::Pointer_t const pProp( + new RTFReferenceProperties(mergeAttributes(), mergeSprms()) + ); + aEntry.first = m_aStates.top().nCurrentStyleIndex; + aEntry.second = pProp; + } + else if (m_aStates.top().nDestinationState == DESTINATION_LISTENTRY) + { + aAttributes = m_aStates.top().aTableAttributes; + aSprms = m_aStates.top().aTableSprms; + for (RTFSprms_t::iterator i = m_aStates.top().aListLevelEntries.begin(); + i != m_aStates.top().aListLevelEntries.end(); ++i) + aSprms.push_back(make_pair(i->first, i->second)); + bListEntryEnd = true; + } + else if (m_aStates.top().nDestinationState == DESTINATION_LISTLEVEL) + { + aAttributes = m_aStates.top().aTableAttributes; + aSprms = m_aStates.top().aTableSprms; + bListLevelEnd = true; + } + else if (m_aStates.top().nDestinationState == DESTINATION_LISTOVERRIDEENTRY) + { + aAttributes = m_aStates.top().aTableAttributes; + aSprms = m_aStates.top().aTableSprms; + bListOverrideEntryEnd = true; + } + else if (m_aStates.top().nDestinationState == DESTINATION_FIELDINSTRUCTION) + { + sal_uInt8 sFieldSep[] = { 0x14 }; + Mapper().startCharacterGroup(); + Mapper().text(sFieldSep, 1); + Mapper().endCharacterGroup(); + } + else if (m_aStates.top().nDestinationState == DESTINATION_FIELDRESULT) + { + sal_uInt8 sFieldEnd[] = { 0x15 }; + Mapper().startCharacterGroup(); + Mapper().text(sFieldEnd, 1); + Mapper().endCharacterGroup(); + } + else if (m_aStates.top().nDestinationState == DESTINATION_LEVELTEXT) + { + OUString aStr = m_aDestinationText.makeStringAndClear(); + + // The first character is the length of the string (the rest should be ignored). + sal_Int32 nLength(aStr.toChar()); + OUString aValue = aStr.copy(1, nLength); + RTFValue::Pointer_t pValue(new RTFValue(aValue, true)); + m_aStates.top().aTableAttributes.push_back(make_pair(NS_ooxml::LN_CT_LevelText_val, pValue)); + + aAttributes = m_aStates.top().aTableAttributes; + bLevelTextEnd = true; + } + else if (m_aStates.top().nDestinationState == DESTINATION_LEVELNUMBERS) + { + RTFSprms_t& rAttributes = RTFSprm::find(m_aStates.top().aTableSprms, NS_ooxml::LN_CT_Lvl_lvlText)->getAttributes(); + RTFValue::Pointer_t pValue = RTFSprm::find(rAttributes, NS_ooxml::LN_CT_LevelText_val); + OUString aOrig = pValue->getString(); + + OUStringBuffer aBuf; + sal_Int32 nReplaces = 1; + for (int i = 0; i < aOrig.getLength(); i++) + { + if (std::find(m_aStates.top().aLevelNumbers.begin(), m_aStates.top().aLevelNumbers.end(), i+1) + != m_aStates.top().aLevelNumbers.end()) + { + aBuf.append(sal_Unicode('%')); + // '1.1.1' -> '%1.%2.%3', but '1.' (with '2.' prefix omitted) is %2. + aBuf.append(sal_Int32(nReplaces++ + m_aStates.top().nListLevelNum + 1 - m_aStates.top().aLevelNumbers.size())); + } + else + aBuf.append(aOrig.copy(i, 1)); + } + pValue->setString(aBuf.makeStringAndClear()); + } + else if (m_aStates.top().nDestinationState == DESTINATION_SHAPEPROPERTYNAME + || m_aStates.top().nDestinationState == DESTINATION_SHAPEPROPERTYVALUE + || m_aStates.top().nDestinationState == DESTINATION_SHAPEPROPERTY) + { + aShapeProperties = m_aStates.top().aShapeProperties; + if (m_aStates.top().nDestinationState == DESTINATION_SHAPEPROPERTYNAME) + aShapeProperties.push_back(make_pair(m_aDestinationText.makeStringAndClear(), OUString())); + else if (m_aStates.top().nDestinationState == DESTINATION_SHAPEPROPERTYVALUE) + aShapeProperties.back().second = m_aDestinationText.makeStringAndClear(); + bPopShapeProperties = true; + } + else if (m_aStates.top().nDestinationState == DESTINATION_PICPROP) + { + aShapeProperties = m_aStates.top().aShapeProperties; + bPicPropEnd = true; + } + else if (m_aStates.top().nDestinationState == DESTINATION_REVISIONENTRY) + m_aAuthors[m_aAuthors.size()] = m_aDestinationText.makeStringAndClear(); + else if (m_aStates.top().nDestinationState == DESTINATION_BOOKMARKSTART) + { + OUString aStr = m_aDestinationText.makeStringAndClear(); + int nPos = m_aBookmarks.size(); + m_aBookmarks[aStr] = nPos; + Mapper().props(lcl_getBookmarkProperties(nPos, aStr)); + } + else if (m_aStates.top().nDestinationState == DESTINATION_BOOKMARKEND) + Mapper().props(lcl_getBookmarkProperties(m_aBookmarks[m_aDestinationText.makeStringAndClear()])); + + // See if we need to end a track change + RTFValue::Pointer_t pTrackchange = RTFSprm::find(m_aStates.top().aCharacterSprms, NS_ooxml::LN_trackchange); + if (pTrackchange.get()) + { + RTFSprms_t aTCAttributes; + RTFValue::Pointer_t pValue(new RTFValue(0)); + aTCAttributes.push_back(make_pair(NS_ooxml::LN_endtrackchange, pValue)); + writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aTCAttributes)); + Mapper().props(pProperties); + } + + // This is the end of the doc, see if we need to close the last section. + if (m_nGroup == 1) + sectBreak(true); + + m_aStates.pop(); + + m_nGroup--; + + if (bFontEntryEnd) + m_aStates.top().aFontTableEntries.insert(make_pair(aEntry.first, aEntry.second)); + else if (bStyleEntryEnd) + m_aStates.top().aStyleTableEntries.insert(make_pair(aEntry.first, aEntry.second)); + // list table + else if (bListEntryEnd) + { + RTFValue::Pointer_t pValue(new RTFValue(aAttributes, aSprms)); + m_aListTableSprms.push_back(make_pair(NS_ooxml::LN_CT_Numbering_abstractNum, pValue)); + } + else if (bListLevelEnd) + { + RTFValue::Pointer_t pInnerValue(new RTFValue(m_aStates.top().nListLevelNum++)); + aAttributes.push_back(make_pair(NS_ooxml::LN_CT_Lvl_ilvl, pInnerValue)); + + RTFValue::Pointer_t pValue(new RTFValue(aAttributes, aSprms)); + m_aStates.top().aListLevelEntries.push_back(make_pair(NS_ooxml::LN_CT_AbstractNum_lvl, pValue)); + } + // list override table + else if (bListOverrideEntryEnd) + { + RTFValue::Pointer_t pValue(new RTFValue(aAttributes, aSprms)); + m_aListTableSprms.push_back(make_pair(NS_ooxml::LN_CT_Numbering_num, pValue)); + } + else if (bLevelTextEnd) + { + RTFValue::Pointer_t pValue(new RTFValue(aAttributes)); + m_aStates.top().aTableSprms.push_back(make_pair(NS_ooxml::LN_CT_Lvl_lvlText, pValue)); + } + else if (bPopShapeProperties) + m_aStates.top().aShapeProperties = aShapeProperties; + else if (bPicPropEnd) + resolveShapeProperties(aShapeProperties); + if (m_bSuper) + { + if (!m_bHasFootnote) + replayBuffer(m_aSuperBuffer); + m_bSuper = m_bHasFootnote = false; + } + + return 0; +} + +void RTFDocumentImpl::resolveShapeProperties(std::vector< std::pair<rtl::OUString, rtl::OUString> >& rShapeProperties) +{ + for (std::vector< std::pair<rtl::OUString, rtl::OUString> >::iterator i = rShapeProperties.begin(); i != rShapeProperties.end(); ++i) + { + if (i->first.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("shapeType"))) + { + int nValue = i->second.toInt32(); + switch (nValue) + { + case 75: // picture frame + break; + default: + OSL_TRACE("%s: TODO handle shape type '%d'", OSL_THIS_FUNC, nValue); + break; + } + } + else if (i->first.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("wzName"))) + { + RTFValue::Pointer_t pValue(new RTFValue(i->second)); + m_aStates.top().aCharacterAttributes.push_back(make_pair(NS_ooxml::LN_CT_NonVisualDrawingProps_name, pValue)); + } + else if (i->first.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("wzDescription"))) + { + RTFValue::Pointer_t pValue(new RTFValue(i->second)); + m_aStates.top().aCharacterAttributes.push_back(make_pair(NS_ooxml::LN_CT_NonVisualDrawingProps_descr, pValue)); + } + else + OSL_TRACE("%s: TODO handle shape property '%s':'%s'", OSL_THIS_FUNC, + OUStringToOString( i->first, RTL_TEXTENCODING_UTF8 ).getStr(), + OUStringToOString( i->second, RTL_TEXTENCODING_UTF8 ).getStr()); + } +} + +int RTFDocumentImpl::resolveParse() +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + char ch; + int ret; + // for hex chars + int b = 0, count = 2; + + while ((Strm() >> ch, !Strm().IsEof())) + { + //OSL_TRACE("%s: parsing character '%c'", OSL_THIS_FUNC, ch); + if (m_nGroup < 0) + return ERROR_GROUP_UNDER; + if (!m_aStates.empty() && m_aStates.top().nInternalState == INTERNAL_BIN) + { + OSL_TRACE("%s: TODO, binary internal state", OSL_THIS_FUNC); + } + else + { + switch (ch) + { + case '{': + if ((ret = pushState())) + return ret; + break; + case '}': + if ((ret = popState())) + return ret; + if (m_bIsSubstream && m_nGroup == 0) + return 0; + break; + case '\\': + if ((ret = resolveKeyword())) + return ret; + break; + case 0x0d: + case 0x0a: + break; // ignore these + default: + if (m_aStates.top().nInternalState == INTERNAL_NORMAL) + { + if ((ret = resolveChars(ch))) + return ret; + } + else + { + OSL_TRACE("%s: hex internal state", OSL_THIS_FUNC); + b = b << 4; + char parsed = lcl_AsHex(ch); + if (parsed == -1) + return ERROR_HEX_INVALID; + b += parsed; + count--; + if (!count) + { + if ((ret = resolveChars(b))) + return ret; + count = 2; + b = 0; + m_aStates.top().nInternalState = INTERNAL_NORMAL; + } + } + break; + } + } + } + + if (m_nGroup < 0) + return ERROR_GROUP_UNDER; + else if (m_nGroup > 0) + return ERROR_GROUP_OVER; + return 0; +} + +::std::string RTFDocumentImpl::getType() const +{ + return "RTFDocumentImpl"; +} + +RTFParserState::RTFParserState() + : nInternalState(INTERNAL_NORMAL), + nDestinationState(DESTINATION_NORMAL), + nBorderState(BORDER_NONE), + aTableSprms(), + aTableAttributes(), + aCharacterSprms(), + aCharacterAttributes(), + aParagraphSprms(), + aParagraphAttributes(), + aSectionSprms(), + aSectionAttributes(), + aTableRowSprms(), + aTableRowAttributes(), + aTableCellSprms(), + aTableCellAttributes(), + aTabAttributes(), + aFontTableEntries(), + nCurrentFontIndex(0), + aCurrentColor(), + aStyleTableEntries(), + nCurrentStyleIndex(0), + nCurrentEncoding(0), + nUc(1), + nCharsToSkip(0), + nListLevelNum(0), + aListLevelEntries(), + aLevelNumbers(), + nPictureScaleX(0), + nPictureScaleY(0), + aShapeProperties(), + nCellX(0), + aTableCellsSprms(), + aTableCellsAttributes(), + bIsCjk(false) +{ +} + +RTFColorTableEntry::RTFColorTableEntry() + : nRed(0), + nGreen(0), + nBlue(0) +{ +} + +} // namespace rtftok +} // namespace writerfilter + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx new file mode 100644 index 000000000000..90618a8103e0 --- /dev/null +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -0,0 +1,305 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Miklos Vajna <vmiklos@frugalware.org> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef _RTFDOCUMENTIMPL_HXX_ +#define _RTFDOCUMENTIMPL_HXX_ + +#include <memory> +#include <stack> +#include <vector> + +#include <rtl/strbuf.hxx> +#include <oox/helper/graphichelper.hxx> +#include <oox/helper/storagebase.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +#include <resourcemodel/WW8ResourceModel.hxx> +#include <rtftok/RTFDocument.hxx> +#include <rtfcontrolwords.hxx> +#include <rtfreferencetable.hxx> +#include <rtfsprm.hxx> + +class SvStream; + +namespace writerfilter { + namespace rtftok { + enum RTFInternalState + { + INTERNAL_NORMAL, + INTERNAL_BIN, + INTERNAL_HEX + }; + + enum RTFDesitnationState + { + DESTINATION_NORMAL, + DESTINATION_SKIP, + DESTINATION_FONTTABLE, + DESTINATION_FONTENTRY, + DESTINATION_COLORTABLE, + DESTINATION_STYLESHEET, + DESTINATION_STYLEENTRY, + DESTINATION_FIELDINSTRUCTION, + DESTINATION_FIELDRESULT, + DESTINATION_LISTTABLE, + DESTINATION_LISTENTRY, + DESTINATION_LISTOVERRIDETABLE, + DESTINATION_LISTOVERRIDEENTRY, + DESTINATION_LISTLEVEL, + DESTINATION_LEVELTEXT, + DESTINATION_LEVELNUMBERS, + DESTINATION_SHPPICT, + DESTINATION_PICT, + DESTINATION_PICPROP, + DESTINATION_SHAPEPROPERTY, + DESTINATION_SHAPEPROPERTYNAME, + DESTINATION_SHAPEPROPERTYVALUE, + DESTINATION_SHAPE, + DESTINATION_SHAPEINSTRUCTION, + DESTINATION_SHAPEPROPERTYVALUEPICT, + DESTINATION_NESTEDTABLEPROPERTIES, + DESTINATION_FOOTNOTE, + DESTINATION_BOOKMARKSTART, + DESTINATION_BOOKMARKEND, + DESTINATION_REVISIONTABLE, + DESTINATION_REVISIONENTRY + }; + + enum RTFBorderState + { + BORDER_NONE, + BORDER_PARAGRAPH, + BORDER_CELL, + BORDER_PAGE + }; + + enum RTFErrors + { + ERROR_OK, + ERROR_GROUP_UNDER, + ERROR_GROUP_OVER, + ERROR_EOF, + ERROR_HEX_INVALID + }; + + enum RTFControlTypes + { + CONTROL_FLAG, // eg \sbknone takes no parameter + CONTROL_DESTINATION, // eg \fonttbl, if ignored, the whole group should be skipped + CONTROL_SYMBOL, // eg \tab + CONTROL_TOGGLE, // eg \b (between on and off) + CONTROL_VALUE // eg \fs (requires parameter) + }; + + /// Minimalistic buffer elements for nested cells. + enum RTFBufferTypes + { + BUFFER_PROPS, + BUFFER_CELLEND, + BUFFER_STARTRUN, + BUFFER_UTEXT, + BUFFER_ENDRUN, + BUFFER_PAR + }; + + /// An entry in the color table. + class RTFColorTableEntry + { + public: + RTFColorTableEntry(); + sal_uInt8 nRed; + sal_uInt8 nGreen; + sal_uInt8 nBlue; + }; + + /// State of the parser, which gets saved / restored when changing groups. + class RTFParserState + { + public: + RTFParserState(); + RTFInternalState nInternalState; + RTFDesitnationState nDestinationState; + RTFBorderState nBorderState; + // font table, stylesheet table + RTFSprms_t aTableSprms; + RTFSprms_t aTableAttributes; + // reset by plain + RTFSprms_t aCharacterSprms; + RTFSprms_t aCharacterAttributes; + // reset by pard + RTFSprms_t aParagraphSprms; + RTFSprms_t aParagraphAttributes; + // reset by sectd + RTFSprms_t aSectionSprms; + RTFSprms_t aSectionAttributes; + // reset by trowd + RTFSprms_t aTableRowSprms; + RTFSprms_t aTableRowAttributes; + // reset by cellx + RTFSprms_t aTableCellSprms; + RTFSprms_t aTableCellAttributes; + // reset by tx + RTFSprms_t aTabAttributes; + + RTFReferenceTable::Entries_t aFontTableEntries; + int nCurrentFontIndex; + + RTFColorTableEntry aCurrentColor; + + RTFReferenceTable::Entries_t aStyleTableEntries; + int nCurrentStyleIndex; + + rtl_TextEncoding nCurrentEncoding; + + /// Current \uc value. + int nUc; + /// Characters to skip, set to nUc by \u. + int nCharsToSkip; + + /// Next list level index to use when parsing list table. + int nListLevelNum; + /// List level entries, which will form a list entry later. + RTFSprms_t aListLevelEntries; + + /// List of character positions in leveltext to replace. + std::vector<sal_Int32> aLevelNumbers; + + float nPictureScaleX; + float nPictureScaleY; + std::vector< std::pair<rtl::OUString, rtl::OUString> > aShapeProperties; + + /// Current cellx value. + int nCellX; + std::deque<RTFSprms::Pointer_t> aTableCellsSprms; + std::deque<RTFSprms::Pointer_t> aTableCellsAttributes; + + /// CJK or CTL? + bool bIsCjk; + }; + + /// Implementation of the RTFDocument interface. + class RTFDocumentImpl + : public RTFDocument + { + public: + typedef ::boost::shared_ptr<RTFDocumentImpl> Pointer_t; + RTFDocumentImpl(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const& xContext, + com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const& xInputStream, + com::sun::star::uno::Reference<com::sun::star::lang::XComponent> const& xDstDoc, + com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const& xFrame); + virtual ~RTFDocumentImpl(); + virtual void resolve(Stream & rHandler); + virtual std::string getType() const; + + SvStream& Strm(); + Stream& Mapper(); + sal_uInt32 getColorTable(sal_uInt32 nIndex); + sal_uInt32 getEncodingTable(sal_uInt32 nFontIndex); + void skipDestination(bool bParsed); + RTFSprms_t mergeSprms(); + RTFSprms_t mergeAttributes(); + void setSubstream(bool bIsSubtream); + void setIgnoreFirst(rtl::OUString& rIgnoreFirst); + void resolveSubstream(sal_uInt32 nPos, Id nId); + void resolveSubstream(sal_uInt32 nPos, Id nId, rtl::OUString& rIgnoreFirst); + void seek(sal_uInt32 nPos); + private: + int resolveParse(); + int resolveKeyword(); + void resolveShapeProperties(std::vector< std::pair<rtl::OUString, rtl::OUString> >& rShapeProperties); + + int dispatchKeyword(rtl::OString& rKeyword, bool bParam, int nParam); + int dispatchFlag(RTFKeyword nKeyword); + int dispatchDestination(RTFKeyword nKeyword); + int dispatchSymbol(RTFKeyword nKeyword); + int dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam); + int dispatchValue(RTFKeyword nKeyword, int nParam); + + int resolveChars(char ch); + /// Resolve a picture: If not inline, then anchored. + int resolvePict(char ch, bool bInline); + int pushState(); + int popState(); + void text(rtl::OUString& rString); + void parBreak(); + void sectBreak(bool bFinal); + void replayBuffer(std::deque< std::pair<RTFBufferTypes, RTFValue::Pointer_t> >& rBuffer); + + com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const& m_xContext; + com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const& m_xInputStream; + com::sun::star::uno::Reference<com::sun::star::lang::XComponent> const& m_xDstDoc; + com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const& m_xFrame; + com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> m_xModelFactory; + SvStream* m_pInStream; + Stream* m_pMapperStream; + /// Same as m_aStates.size(), except that this can be negative for invalid input. + int m_nGroup; + std::stack<RTFParserState> m_aStates; + /// Read by RTF_PARD. + RTFParserState m_aDefaultState; + bool m_bSkipUnknown; + /// Font index <-> encoding map, *not* part of the parser state + std::map<int, rtl_TextEncoding> m_aFontEncodings; + /// Color index <-> RGB color value map + std::vector<sal_uInt32> m_aColorTable; + bool m_bFirstRun; + /// If paragraph properties should be emitted on next run. + bool m_bNeedPap; + /// The list table and list override table combined. + RTFSprms_t m_aListTableSprms; + /// The settings table. + RTFSprms_t m_aSettingsTableSprms; + + oox::StorageRef m_xStorage; + oox::GraphicHelper* m_pGraphicHelper; + + /// Buffered table cells, till cell definitions are not reached. + std::deque< std::pair<RTFBufferTypes, RTFValue::Pointer_t> > m_aTableBuffer; + bool m_bTable; + /// Buffered superscript, till footnote is reached (or not). + std::deque< std::pair<RTFBufferTypes, RTFValue::Pointer_t> > m_aSuperBuffer; + bool m_bSuper; + bool m_bHasFootnote; + /// If this is a substream. + bool m_bIsSubstream; + std::deque< std::pair<Id, sal_uInt32> > m_nHeaderFooterPositions; + sal_uInt32 m_nGroupStartPos; + /// Ignore the first occurrence of this text. + rtl::OUString m_aIgnoreFirst; + /// Bookmark name <-> index map. + std::map<rtl::OUString, int> m_aBookmarks; + /// Revision index <-> author map. + std::map<int, rtl::OUString> m_aAuthors; + /// Text from special destinations. + rtl::OUStringBuffer m_aDestinationText; + }; + } // namespace rtftok +} // namespace writerfilter + +#endif // _RTFDOCUMENTIMPL_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfreferenceproperties.cxx b/writerfilter/source/rtftok/rtfreferenceproperties.cxx new file mode 100644 index 000000000000..6ca5f1d68a3f --- /dev/null +++ b/writerfilter/source/rtftok/rtfreferenceproperties.cxx @@ -0,0 +1,69 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Miklos Vajna <vmiklos@frugalware.org> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include <rtfreferenceproperties.hxx> +#include <rtfsprm.hxx> + +namespace writerfilter { +namespace rtftok { + +RTFReferenceProperties::RTFReferenceProperties(RTFSprms_t rAttributes, RTFSprms_t rSprms) + : m_rAttributes(rAttributes), + m_rSprms(rSprms) +{ +} + +RTFReferenceProperties::RTFReferenceProperties(RTFSprms_t rAttributes) + : m_rAttributes(rAttributes), + m_rSprms() +{ +} + +RTFReferenceProperties::~RTFReferenceProperties() +{ +} + +void RTFReferenceProperties::resolve(Properties& rHandler) +{ + for (RTFSprms_t::iterator i = m_rAttributes.begin(); i != m_rAttributes.end(); ++i) + rHandler.attribute(i->first, *i->second.get()); + for (RTFSprms_t::iterator i = m_rSprms.begin(); i != m_rSprms.end(); ++i) + { + RTFSprm aSprm(i->first, i->second); + rHandler.sprm(aSprm); + } +} + +std::string RTFReferenceProperties::getType() const +{ + return "RTFReferenceProperties"; +} + +} // namespace rtftok +} // namespace writerfilter + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfreferenceproperties.hxx b/writerfilter/source/rtftok/rtfreferenceproperties.hxx new file mode 100644 index 000000000000..a689e5f8d645 --- /dev/null +++ b/writerfilter/source/rtftok/rtfreferenceproperties.hxx @@ -0,0 +1,58 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Miklos Vajna <vmiklos@frugalware.org> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef _RTFREFERENCEPROPERTIES_HXX_ +#define _RTFREFERENCEPROPERTIES_HXX_ + +#include <map> +#include <resourcemodel/WW8ResourceModel.hxx> +#include <rtfsprm.hxx> + +class SvStream; + +namespace writerfilter { + namespace rtftok { + /// Sends RTFSprm instances to DomainMapper. + class RTFReferenceProperties + : public writerfilter::Reference<Properties> + { + public: + RTFReferenceProperties(RTFSprms_t rAttributes, RTFSprms_t rSprms); + RTFReferenceProperties(RTFSprms_t rAttributes); + virtual ~RTFReferenceProperties(); + virtual void resolve(Properties & rHandler); + virtual std::string getType() const; + private: + RTFSprms_t m_rAttributes; + RTFSprms_t m_rSprms; + }; + } // namespace rtftok +} // namespace writerfilter + +#endif // _RTFREFERENCEPROPERTIES_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfreferencetable.cxx b/writerfilter/source/rtftok/rtfreferencetable.cxx new file mode 100644 index 000000000000..9966c68f6903 --- /dev/null +++ b/writerfilter/source/rtftok/rtfreferencetable.cxx @@ -0,0 +1,56 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Miklos Vajna <vmiklos@frugalware.org> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include <rtfreferencetable.hxx> + +namespace writerfilter { +namespace rtftok { + +RTFReferenceTable::RTFReferenceTable(Entries_t const& rEntries) + : m_aEntries(rEntries) +{ +} + +RTFReferenceTable::~RTFReferenceTable() +{ +} + +void RTFReferenceTable::resolve(Table& rHandler) +{ + for (Entries_t::const_iterator i = m_aEntries.begin(); i != m_aEntries.end(); ++i) + rHandler.entry(i->first, i->second); +} + +std::string RTFReferenceTable::getType() const +{ + return "RTFReferenceTable"; +} + +} // namespace rtftok +} // namespace writerfilter + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfreferencetable.hxx b/writerfilter/source/rtftok/rtfreferencetable.hxx new file mode 100644 index 000000000000..f0e0194c0f87 --- /dev/null +++ b/writerfilter/source/rtftok/rtfreferencetable.hxx @@ -0,0 +1,57 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Miklos Vajna <vmiklos@frugalware.org> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef _RTFREFERENCETABLE_HXX_ +#define _RTFREFERENCETABLE_HXX_ + +#include <map> +#include <resourcemodel/WW8ResourceModel.hxx> + +class SvStream; + +namespace writerfilter { + namespace rtftok { + /// Sends tables (e.g. font table) to the domain mapper. + class RTFReferenceTable + : public writerfilter::Reference<Table> + { + public: + typedef std::map<int, writerfilter::Reference<Properties>::Pointer_t> Entries_t; + typedef std::pair<int, writerfilter::Reference<Properties>::Pointer_t> Entry_t; + RTFReferenceTable(Entries_t const& rEntries); + virtual ~RTFReferenceTable(); + virtual void resolve(Table & rHandler); + virtual std::string getType() const; + private: + Entries_t m_aEntries; + }; + } // namespace rtftok +} // namespace writerfilter + +#endif // _RTFREFERENCETABLE_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfsprm.cxx b/writerfilter/source/rtftok/rtfsprm.cxx new file mode 100644 index 000000000000..e5d3e263d98a --- /dev/null +++ b/writerfilter/source/rtftok/rtfsprm.cxx @@ -0,0 +1,121 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Miklos Vajna <vmiklos@frugalware.org> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include <rtfsprm.hxx> +#include <rtl/strbuf.hxx> + +#include <resourcemodel/QNameToString.hxx> + +using rtl::OStringBuffer; + +namespace writerfilter { +namespace rtftok { + +RTFSprm::RTFSprm(Id nKeyword, RTFValue::Pointer_t& pValue) + : m_nKeyword(nKeyword), + m_pValue(pValue) +{ +} + +sal_uInt32 RTFSprm::getId() const +{ + return m_nKeyword; +} + +Value::Pointer_t RTFSprm::getValue() +{ + return Value::Pointer_t(m_pValue->Clone()); +} + +writerfilter::Reference<BinaryObj>::Pointer_t RTFSprm::getBinary() +{ + return m_pValue->getBinary(); +} + +writerfilter::Reference<Stream>::Pointer_t RTFSprm::getStream() +{ + return m_pValue->getStream(); +} + +writerfilter::Reference<Properties>::Pointer_t RTFSprm::getProps() +{ + return m_pValue->getProperties(); +} + +Sprm::Kind RTFSprm::getKind() +{ + return Sprm::UNKNOWN; +} + +std::string RTFSprm::getName() const +{ + return "RTFSprm"; +} + +std::string RTFSprm::toString() const +{ + OStringBuffer aBuf("RTFSprm"); + + std::string sResult = (*QNameToString::Instance())(m_nKeyword); + if (sResult.length() == 0) + sResult = (*SprmIdToString::Instance())(m_nKeyword); + + aBuf.append(" ('"); + if (sResult.length() == 0) + aBuf.append(sal_Int32(m_nKeyword)); + else + aBuf.append(sResult.c_str()); + aBuf.append("', '"); + aBuf.append(m_pValue->toString().c_str()); + aBuf.append("')"); + + return aBuf.makeStringAndClear().getStr(); +} + +RTFValue::Pointer_t RTFSprm::find(RTFSprms_t &rVector, Id nKeyword) +{ + for (RTFSprms_t::iterator i = rVector.begin(); i != rVector.end(); ++i) + if (i->first == nKeyword) + return i->second; + RTFValue::Pointer_t pValue; + return pValue; +} + +void RTFSprm::erase(RTFSprms_t &rVector, Id nKeyword) +{ + for (RTFSprms_t::iterator i = rVector.begin(); i != rVector.end(); ++i) + if (i->first == nKeyword) + { + rVector.erase(i); + return; + } +} + +} // namespace rtftok +} // namespace writerfilter + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfsprm.hxx b/writerfilter/source/rtftok/rtfsprm.hxx new file mode 100644 index 000000000000..441c7e9aa8b0 --- /dev/null +++ b/writerfilter/source/rtftok/rtfsprm.hxx @@ -0,0 +1,68 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Miklos Vajna <vmiklos@frugalware.org> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef _RTFSPRM_HXX_ +#define _RTFSPRM_HXX_ + +#include <string> +#include <resourcemodel/WW8ResourceModel.hxx> +#include <rtfcontrolwords.hxx> +#include <rtfvalue.hxx> + +namespace writerfilter { + namespace rtftok { + /// A list of RTFSprm + typedef std::vector< std::pair<Id, RTFValue::Pointer_t> > RTFSprms_t; + namespace RTFSprms { + typedef ::boost::shared_ptr<RTFSprms_t> Pointer_t; + } + /// RTF keyword with a parameter + class RTFSprm + : public Sprm + { + public: + RTFSprm(Id nKeyword, RTFValue::Pointer_t& pValue); + virtual sal_uInt32 getId() const; + virtual Value::Pointer_t getValue(); + virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary(); + virtual writerfilter::Reference<Stream>::Pointer_t getStream(); + virtual writerfilter::Reference<Properties>::Pointer_t getProps(); + virtual Kind getKind(); + virtual std::string getName() const; + virtual std::string toString() const; + static RTFValue::Pointer_t find(RTFSprms_t& rVector, Id nKeyword); + static void erase(RTFSprms_t& rVector, Id nKeyword); + private: + Id m_nKeyword; + RTFValue::Pointer_t& m_pValue; + }; + } // namespace rtftok +} // namespace writerfilter + +#endif // _RTFSPRM_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtftypes.hxx b/writerfilter/source/rtftok/rtftypes.hxx new file mode 100644 index 000000000000..3f437f34b534 --- /dev/null +++ b/writerfilter/source/rtftok/rtftypes.hxx @@ -0,0 +1,58 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Miklos Vajna <vmiklos@frugalware.org> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef _RTFTYPES_HXX_ +#define _RTFTYPES_HXX_ + +#include <rtfcontrolwords.hxx> + +namespace writerfilter { + namespace rtftok { + /// Respresents an RTF Control Word + typedef struct + { + const char *sKeyword; + int nControlType; + RTFKeyword nIndex; + } RTFSymbol; + extern RTFSymbol aRTFControlWords[]; + extern int nRTFControlWords; + + /// RTF legacy charsets + typedef struct + { + int charset; + int codepage; + } RTFEncoding; + extern RTFEncoding aRTFEncodings[]; + extern int nRTFEncodings; + } // namespace rtftok +} // namespace writerfilter + +#endif // _RTFTYPES_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfvalue.cxx b/writerfilter/source/rtftok/rtfvalue.cxx new file mode 100644 index 000000000000..54fbd6cbe790 --- /dev/null +++ b/writerfilter/source/rtftok/rtfvalue.cxx @@ -0,0 +1,174 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Miklos Vajna <vmiklos@frugalware.org> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include <rtfvalue.hxx> +#include <rtfreferenceproperties.hxx> +#include <rtl/strbuf.hxx> +#include <rtl/ustrbuf.hxx> + +namespace writerfilter { +namespace rtftok { + +using rtl::OString; +using rtl::OUString; + +RTFValue::RTFValue(int nValue, rtl::OUString sValue, RTFSprms_t rAttributes, + RTFSprms_t rSprms, uno::Reference<drawing::XShape> rShape) + : m_nValue(nValue), + m_sValue(sValue), + m_rAttributes(rAttributes), + m_rSprms(rSprms), + m_rShape(rShape), + m_bForceString(false) +{ +} + +RTFValue::RTFValue(int nValue) + : m_nValue(nValue), + m_sValue(), + m_rAttributes(), + m_rSprms(), + m_rShape(), + m_bForceString(false) +{ +} + +RTFValue::RTFValue(OUString sValue, bool bForce) + : m_nValue(), + m_sValue(sValue), + m_rAttributes(), + m_rSprms(), + m_rShape(), + m_bForceString(bForce) +{ +} + +RTFValue::RTFValue(RTFSprms_t rAttributes) + : m_nValue(), + m_sValue(), + m_rAttributes(rAttributes), + m_rSprms(), + m_rShape(), + m_bForceString(false) +{ +} + +RTFValue::RTFValue(RTFSprms_t rAttributes, RTFSprms_t rSprms) + : m_nValue(), + m_sValue(), + m_rAttributes(rAttributes), + m_rSprms(rSprms), + m_rShape(), + m_bForceString(false) +{ +} + +RTFValue::RTFValue(uno::Reference<drawing::XShape> rShape) + : m_nValue(), + m_sValue(), + m_rAttributes(), + m_rSprms(), + m_rShape(rShape), + m_bForceString(false) +{ +} + +int RTFValue::getInt() const +{ + return m_nValue; +} + +OUString RTFValue::getString() const +{ + if (m_sValue.getLength() > 0 || m_bForceString) + return m_sValue; + else + return OUString::valueOf(sal_Int32(m_nValue)); +} + +void RTFValue::setString(OUString sValue) +{ + m_sValue = sValue; +} + +uno::Any RTFValue::getAny() const +{ + uno::Any ret; + if (m_sValue.getLength() > 0 || m_bForceString) + ret <<= m_sValue; + else if (m_rShape.is()) + ret <<= m_rShape; + else + ret <<= static_cast<sal_Int32>(m_nValue); + return ret; +} + +writerfilter::Reference<Properties>::Pointer_t RTFValue::getProperties() +{ + writerfilter::Reference<Properties>::Pointer_t const pProperties( + new RTFReferenceProperties(m_rAttributes, m_rSprms) + ); + return pProperties; +} + +writerfilter::Reference<Stream>::Pointer_t RTFValue::getStream() +{ + return writerfilter::Reference<Stream>::Pointer_t(); +} + +writerfilter::Reference<BinaryObj>::Pointer_t RTFValue::getBinary() +{ + return writerfilter::Reference<BinaryObj>::Pointer_t(); +} + +std::string RTFValue::toString() const +{ + if (m_sValue.getLength() > 0 || m_bForceString) + return OUStringToOString(m_sValue, RTL_TEXTENCODING_UTF8).getStr(); + else + return OString::valueOf(static_cast<sal_Int32>(m_nValue)).getStr(); +} + +RTFValue* RTFValue::Clone() +{ + return new RTFValue(m_nValue, m_sValue, m_rAttributes, m_rSprms, m_rShape); +} + +RTFSprms_t& RTFValue::getAttributes() +{ + return m_rAttributes; +} + +RTFSprms_t& RTFValue::getSprms() +{ + return m_rSprms; +} + +} // namespace rtftok +} // namespace writerfilter + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/rtftok/rtfvalue.hxx b/writerfilter/source/rtftok/rtfvalue.hxx new file mode 100644 index 000000000000..e03971936ac9 --- /dev/null +++ b/writerfilter/source/rtftok/rtfvalue.hxx @@ -0,0 +1,76 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Miklos Vajna <vmiklos@frugalware.org> + * Portions created by the Initial Developer are Copyright (C) 2011 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef _RTFVALUE_HXX_ +#define _RTFVALUE_HXX_ + +#include <string> +#include <map> +#include <rtl/ustrbuf.hxx> +#include <resourcemodel/WW8ResourceModel.hxx> + +namespace writerfilter { + namespace rtftok { + /// Value of an RTF keyword + class RTFValue + : public Value + { + public: + typedef ::boost::shared_ptr<RTFValue> Pointer_t; + RTFValue(int nValue, rtl::OUString sValue, std::vector< std::pair<Id, RTFValue::Pointer_t> > rAttributes, + std::vector< std::pair<Id, RTFValue::Pointer_t> > rSprms, uno::Reference<drawing::XShape> rShape); + RTFValue(int nValue); + RTFValue(rtl::OUString sValue, bool bForce = false); + RTFValue(std::vector< std::pair<Id, RTFValue::Pointer_t> > rAttributes); + RTFValue(std::vector< std::pair<Id, RTFValue::Pointer_t> > rAttributes, + std::vector< std::pair<Id, RTFValue::Pointer_t> > rSprms); + RTFValue(uno::Reference<drawing::XShape> rShape); + void setString(rtl::OUString sValue); + virtual int getInt() const; + virtual rtl::OUString getString() const; + virtual uno::Any getAny() const; + virtual writerfilter::Reference<Properties>::Pointer_t getProperties(); + virtual writerfilter::Reference<Stream>::Pointer_t getStream(); + virtual writerfilter::Reference<BinaryObj>::Pointer_t getBinary(); + virtual std::string toString() const; + virtual RTFValue* Clone(); + std::vector< std::pair<Id, RTFValue::Pointer_t> >& getAttributes(); + std::vector< std::pair<Id, RTFValue::Pointer_t> >& getSprms(); + private: + int m_nValue; + rtl::OUString m_sValue; + std::vector< std::pair<Id, RTFValue::Pointer_t> > m_rAttributes; + std::vector< std::pair<Id, RTFValue::Pointer_t> > m_rSprms; + uno::Reference<drawing::XShape> m_rShape; + bool m_bForceString; + }; + } // namespace rtftok +} // namespace writerfilter + +#endif // _RTFVALUE_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/unocomponent/component.cxx b/writerfilter/unocomponent/component.cxx index d715a70a9ae1..1bb79c7ba069 100644 --- a/writerfilter/unocomponent/component.cxx +++ b/writerfilter/unocomponent/component.cxx @@ -56,12 +56,6 @@ static struct ::cppu::ImplementationEntry s_component_entries [] = { 0, 0, 0, 0, 0, 0 } // terminate with NULL }; - -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(sal_Char const * implName, ::com::sun::star::lang::XMultiServiceFactory * xMgr, ::com::sun::star::registry::XRegistryKey * xRegistry ) { fprintf(stderr, "Loading service: %s: ", implName); diff --git a/writerfilter/unocomponent/exports.dxp b/writerfilter/unocomponent/exports.dxp index f0e1c69934bc..70033078921a 100644 --- a/writerfilter/unocomponent/exports.dxp +++ b/writerfilter/unocomponent/exports.dxp @@ -1,2 +1 @@ -component_getImplementationEnvironment component_getFactory diff --git a/writerperfect/source/filter/OdgGenerator.cxx b/writerperfect/source/filter/OdgGenerator.cxx index aa9c7856cce6..8269c0a1c9bd 100644 --- a/writerperfect/source/filter/OdgGenerator.cxx +++ b/writerperfect/source/filter/OdgGenerator.cxx @@ -40,11 +40,182 @@ // remove this #define MULTIPAGE_WORKAROUND 1 +static inline double getAngle(double bx, double by) +{ + return fmod(2*M_PI + (by > 0.0 ? 1.0 : -1.0) * acos( bx / sqrt(bx * bx + by * by) ), 2*M_PI); +} + +static void getEllipticalArcBBox(double x1, double y1, + double rx, double ry, double phi, bool largeArc, bool sweep, double x2, double y2, + double &xmin, double &ymin, double &xmax, double &ymax) +{ + phi *= M_PI/180; + if (rx < 0.0) + rx *= -1.0; + if (ry < 0.0) + ry *= -1.0; + + if (rx == 0.0 || ry == 0.0) + { + xmin = (x1 < x2 ? x1 : x2); + xmax = (x1 > x2 ? x1 : x2); + ymin = (y1 < y2 ? y1 : y2); + ymax = (y1 > y2 ? y1 : y2); + return; + } + + // F.6.5.1 + const double x1prime = cos(phi)*(x1 - x2)/2 + sin(phi)*(y1 - y2)/2; + const double y1prime = -sin(phi)*(x1 - x2)/2 + cos(phi)*(y1 - y2)/2; + + // F.6.5.2 + double radicant = (rx*rx*ry*ry - rx*rx*y1prime*y1prime - ry*ry*x1prime*x1prime)/(rx*rx*y1prime*y1prime + ry*ry*x1prime*x1prime); + double cxprime = 0.0; + double cyprime = 0.0; + if (radicant < 0.0) + { + double ratio = rx/ry; + radicant = y1prime*y1prime + x1prime*x1prime/(ratio*ratio); + if (radicant < 0.0) + { + xmin = (x1 < x2 ? x1 : x2); + xmax = (x1 > x2 ? x1 : x2); + ymin = (y1 < y2 ? y1 : y2); + ymax = (y1 > y2 ? y1 : y2); + return; + } + ry=sqrt(radicant); + rx=ratio*ry; + } + else + { + double factor = (largeArc==sweep ? -1.0 : 1.0)*sqrt(radicant); + + cxprime = factor*rx*y1prime/ry; + cyprime = -factor*ry*x1prime/rx; + } + + // F.6.5.3 + double cx = cxprime*cos(phi) - cyprime*sin(phi) + (x1 + x2)/2; + double cy = cxprime*sin(phi) + cyprime*cos(phi) + (y1 + y2)/2; + + // now compute bounding box of the whole ellipse + + // Parametric equation of an ellipse: + // x(theta) = cx + rx*cos(theta)*cos(phi) - ry*sin(theta)*sin(phi) + // y(theta) = cy + rx*cos(theta)*sin(phi) + ry*sin(theta)*cos(phi) + + // Compute local extrems + // 0 = -rx*sin(theta)*cos(phi) - ry*cos(theta)*sin(phi) + // 0 = -rx*sin(theta)*sin(phi) - ry*cos(theta)*cos(phi) + + // Local extrems for X: + // theta = -atan(ry*tan(phi)/rx) + // and + // theta = M_PI -atan(ry*tan(phi)/rx) + + // Local extrems for Y: + // theta = atan(ry/(tan(phi)*rx)) + // and + // theta = M_PI + atan(ry/(tan(phi)*rx)) + + double txmin, txmax, tymin, tymax; + + // First handle special cases + if (phi == 0 || phi == M_PI) + { + xmin = cx - rx; + txmin = getAngle(-rx, 0); + xmax = cx + rx; + txmax = getAngle(rx, 0); + ymin = cy - ry; + tymin = getAngle(0, -ry); + ymax = cy + ry; + tymax = getAngle(0, ry); + } + else if (phi == M_PI / 2.0 || phi == 3.0*M_PI/2.0) + { + xmin = cx - ry; + txmin = getAngle(-ry, 0); + xmax = cx + ry; + txmax = getAngle(ry, 0); + ymin = cy - rx; + tymin = getAngle(0, -rx); + ymax = cy + rx; + tymax = getAngle(0, rx); + } + else + { + txmin = -atan(ry*tan(phi)/rx); + txmax = M_PI - atan (ry*tan(phi)/rx); + xmin = cx + rx*cos(txmin)*cos(phi) - ry*sin(txmin)*sin(phi); + xmax = cx + rx*cos(txmax)*cos(phi) - ry*sin(txmax)*sin(phi); + double tmpY = cy + rx*cos(txmin)*sin(phi) + ry*sin(txmin)*cos(phi); + txmin = getAngle(xmin - cx, tmpY - cy); + tmpY = cy + rx*cos(txmax)*sin(phi) + ry*sin(txmax)*cos(phi); + txmax = getAngle(xmax - cx, tmpY - cy); + + tymin = atan(ry/(tan(phi)*rx)); + tymax = atan(ry/(tan(phi)*rx))+M_PI; + ymin = cy + rx*cos(tymin)*sin(phi) + ry*sin(tymin)*cos(phi); + ymax = cy + rx*cos(tymax)*sin(phi) + ry*sin(tymax)*cos(phi); + double tmpX = cx + rx*cos(tymin)*cos(phi) - ry*sin(tymin)*sin(phi); + tymin = getAngle(tmpX - cx, ymin - cy); + tmpX = cx + rx*cos(tymax)*cos(phi) - ry*sin(tymax)*sin(phi); + tymax = getAngle(tmpX - cx, ymax - cy); + } + if (xmin > xmax) + { + std::swap(xmin,xmax); + std::swap(txmin,txmax); + } + if (ymin > ymax) + { + std::swap(ymin,ymax); + std::swap(tymin,tymax); + } + double angle1 = getAngle(x1 - cx, y1 - cy); + double angle2 = getAngle(x2 - cx, y2 - cy); + + // for sweep == 0 it is normal to have delta theta < 0 + // but we don't care about the rotation direction for bounding box + if (!sweep) + std::swap(angle1, angle2); + + // We cannot check directly for whether an angle is included in + // an interval of angles that cross the 360/0 degree boundary + // So here we will have to check for their absence in the complementary + // angle interval + bool otherArc = false; + if (angle1 > angle2) + { + std::swap(angle1, angle2); + otherArc = true; + } + + // Check txmin + if ((!otherArc && (angle1 > txmin || angle2 < txmin)) || (otherArc && !(angle1 > txmin || angle2 < txmin))) + xmin = x1 < x2 ? x1 : x2; + // Check txmax + if ((!otherArc && (angle1 > txmax || angle2 < txmax)) || (otherArc && !(angle1 > txmax || angle2 < txmax))) + xmax = x1 > x2 ? x1 : x2; + // Check tymin + if ((!otherArc && (angle1 > tymin || angle2 < tymin)) || (otherArc && !(angle1 > tymin || angle2 < tymin))) + ymin = y1 < y2 ? y1 : y2; + // Check tymax + if ((!otherArc && (angle1 > tymax || angle2 < tymax)) || (otherArc && !(angle1 > tymax || angle2 < tymax))) + ymax = y1 > y2 ? y1 : y2; +} + static WPXString doubleToString(const double value) { WPXString tempString; tempString.sprintf("%.4f", value); +#ifndef __ANDROID__ std::string decimalPoint(localeconv()->decimal_point); +#else + std::string decimalPoint("."); +#endif if ((decimalPoint.size() == 0) || (decimalPoint == ".")) return tempString; std::string stringValue(tempString.cstr()); @@ -573,22 +744,38 @@ void OdgGeneratorPrivate::_drawPath(const WPXPropertyListVector& path) { if(path.count() == 0) return; + // This must be a mistake and we do not want to crash lower + if(path[0]["libwpg:path-action"]->getStr() == "Z") + return; // try to find the bounding box // this is simple convex hull technique, the bounding box might not be // accurate but that should be enough for this purpose - double px = path[0]["svg:x"]->getDouble(); - double py = path[0]["svg:y"]->getDouble(); - double qx = path[0]["svg:x"]->getDouble(); - double qy = path[0]["svg:y"]->getDouble(); + bool isFirstPoint = true; + + double px = 0.0, py = 0.0, qx = 0.0, qy = 0.0; + double lastX = 0.0; + double lastY = 0.0; + for(unsigned k = 0; k < path.count(); k++) { if (!path[k]["svg:x"] || !path[k]["svg:y"]) continue; + if (isFirstPoint) + { + px = path[k]["svg:x"]->getDouble(); + py = path[k]["svg:y"]->getDouble(); + qx = px; + qy = py; + lastX = px; + lastY = py; + isFirstPoint = false; + } px = (px > path[k]["svg:x"]->getDouble()) ? path[k]["svg:x"]->getDouble() : px; py = (py > path[k]["svg:y"]->getDouble()) ? path[k]["svg:y"]->getDouble() : py; qx = (qx < path[k]["svg:x"]->getDouble()) ? path[k]["svg:x"]->getDouble() : qx; qy = (qy < path[k]["svg:y"]->getDouble()) ? path[k]["svg:y"]->getDouble() : qy; + if(path[k]["libwpg:path-action"]->getStr() == "C") { px = (px > path[k]["svg:x1"]->getDouble()) ? path[k]["svg:x1"]->getDouble() : px; @@ -600,23 +787,29 @@ void OdgGeneratorPrivate::_drawPath(const WPXPropertyListVector& path) qx = (qx < path[k]["svg:x2"]->getDouble()) ? path[k]["svg:x2"]->getDouble() : qx; qy = (qy < path[k]["svg:y2"]->getDouble()) ? path[k]["svg:y2"]->getDouble() : qy; } -#if 0 if(path[k]["libwpg:path-action"]->getStr() == "A") { - px = (px > path[k]["svg:x"]->getDouble()-2*path[k]["svg:rx"]->getDouble()) ? path[k]["svg:x"]->getDouble()-2*path[k]["svg:rx"]->getDouble() : px; - py = (py > path[k]["svg:y"]->getDouble()-2*path[k]["svg:ry"]->getDouble()) ? path[k]["svg:y"]->getDouble()-2*path[k]["svg:ry"]->getDouble() : py; - qx = (qx < path[k]["svg:x"]->getDouble()+2*path[k]["svg:rx"]->getDouble()) ? path[k]["svg:x"]->getDouble()+2*path[k]["svg:rx"]->getDouble() : qx; - qy = (qy < path[k]["svg:y"]->getDouble()+2*path[k]["svg:ry"]->getDouble()) ? path[k]["svg:y"]->getDouble()+2*path[k]["svg:ry"]->getDouble() : qy; + double xmin, xmax, ymin, ymax; + + getEllipticalArcBBox(lastX, lastY, path[k]["svg:rx"]->getDouble(), path[k]["svg:ry"]->getDouble(), + path[k]["libwpg:rotate"] ? path[k]["libwpg:rotate"]->getDouble() : 0.0, + path[k]["libwpg:large-arc"] ? path[k]["libwpg:large-arc"]->getInt() : 1, + path[k]["libwpg:sweep"] ? path[k]["libwpg:sweep"]->getInt() : 1, + path[k]["svg:x"]->getDouble(), path[k]["svg:y"]->getDouble(), xmin, ymin, xmax, ymax); + + px = (px > xmin ? xmin : px); + py = (py > ymin ? ymin : py); + qx = (qx < xmax ? xmax : qx); + qy = (qy < ymax ? ymax : qy); } -#endif + lastX = path[k]["svg:x"]->getDouble(); + lastY = path[k]["svg:y"]->getDouble(); } - double vw = qx - px; - double vh = qy - py; - _writeGraphicsStyle(); - TagOpenElement *pDrawPathElement = new TagOpenElement("draw:path"); WPXString sValue; + _writeGraphicsStyle(); + TagOpenElement *pDrawPathElement = new TagOpenElement("draw:path"); sValue.sprintf("gr%i", miGraphicsStyleIndex-1); pDrawPathElement->addAttribute("draw:style-name", sValue); pDrawPathElement->addAttribute("draw:text-style-name", "P1"); @@ -625,11 +818,11 @@ void OdgGeneratorPrivate::_drawPath(const WPXPropertyListVector& path) pDrawPathElement->addAttribute("svg:x", sValue); sValue = doubleToString(py); sValue.append("in"); pDrawPathElement->addAttribute("svg:y", sValue); - sValue = doubleToString(vw); sValue.append("in"); + sValue = doubleToString((qx - px)); sValue.append("in"); pDrawPathElement->addAttribute("svg:width", sValue); - sValue = doubleToString(vh); sValue.append("in"); + sValue = doubleToString((qy - py)); sValue.append("in"); pDrawPathElement->addAttribute("svg:height", sValue); - sValue.sprintf("%i %i %i %i", 0, 0, (unsigned)(vw*2540), (unsigned)(vh*2540)); + sValue.sprintf("%i %i %i %i", 0, 0, (unsigned)(2540*(qx - px)), (unsigned)(2540*(qy - py))); pDrawPathElement->addAttribute("svg:viewBox", sValue); sValue.clear(); @@ -643,9 +836,7 @@ void OdgGeneratorPrivate::_drawPath(const WPXPropertyListVector& path) (unsigned)((path[i]["svg:y"]->getDouble()-py)*2540)); sValue.append(sElement); } - else if (path[i]["libwpg:path-action"]->getStr() == "L" - // approximate for the time being the elliptic arc by a line - || path[i]["libwpg:path-action"]->getStr() == "A") + else if (path[i]["libwpg:path-action"]->getStr() == "L") { sElement.sprintf("L%i %i", (unsigned)((path[i]["svg:x"]->getDouble()-px)*2540), (unsigned)((path[i]["svg:y"]->getDouble()-py)*2540)); @@ -654,21 +845,21 @@ void OdgGeneratorPrivate::_drawPath(const WPXPropertyListVector& path) else if (path[i]["libwpg:path-action"]->getStr() == "C") { sElement.sprintf("C%i %i %i %i %i %i", (unsigned)((path[i]["svg:x1"]->getDouble()-px)*2540), - (int)((path[i]["svg:y1"]->getDouble()-py)*2540), (unsigned)((path[i]["svg:x2"]->getDouble()-px)*2540), - (int)((path[i]["svg:y2"]->getDouble()-py)*2540), (unsigned)((path[i]["svg:x"]->getDouble()-px)*2540), + (unsigned)((path[i]["svg:y1"]->getDouble()-py)*2540), (unsigned)((path[i]["svg:x2"]->getDouble()-px)*2540), + (unsigned)((path[i]["svg:y2"]->getDouble()-py)*2540), (unsigned)((path[i]["svg:x"]->getDouble()-px)*2540), (unsigned)((path[i]["svg:y"]->getDouble()-py)*2540)); sValue.append(sElement); } -#if 0 else if (path[i]["libwpg:path-action"]->getStr() == "A") { sElement.sprintf("A%i %i %i %i %i %i %i", (unsigned)((path[i]["svg:rx"]->getDouble())*2540), - (int)((path[i]["svg:ry"]->getDouble())*2540), (path[i]["libwpg:rotate"] ? path[i]["libwpg:rotate"]->getInt() : 0), - 0, 0, (unsigned)((path[i]["svg:x"]->getDouble()-px)*2540), (unsigned)((path[i]["svg:y"]->getDouble()-py)*2540)); + (unsigned)((path[i]["svg:ry"]->getDouble())*2540), (path[i]["libwpg:rotate"] ? path[i]["libwpg:rotate"]->getInt() : 0), + (path[i]["libwpg:large-arc"] ? path[i]["libwpg:large-arc"]->getInt() : 1), + (path[i]["libwpg:sweep"] ? path[i]["libwpg:sweep"]->getInt() : 1), + (unsigned)((path[i]["svg:x"]->getDouble()-px)*2540), (unsigned)((path[i]["svg:y"]->getDouble()-py)*2540)); sValue.append(sElement); } -#endif - else if (path[i]["libwpg:path-action"]->getStr() == "Z" && i >= (path.count() - 1)) + else if (path[i]["libwpg:path-action"]->getStr() == "Z") sValue.append(" Z"); } pDrawPathElement->addAttribute("svg:d", sValue); @@ -744,31 +935,76 @@ void OdgGeneratorPrivate::_writeGraphicsStyle() mGraphicsStrokeDashStyles.push_back(new TagCloseElement("draw:stroke-dash")); } #endif - if(mxStyle["draw:fill"] && mxStyle["draw:fill"]->getStr() == "gradient" && mxGradient.count() >= 2) + if(mxStyle["draw:fill"] && mxStyle["draw:fill"]->getStr() == "gradient") { TagOpenElement *pDrawGradientElement = new TagOpenElement("draw:gradient"); - pDrawGradientElement->addAttribute("draw:style", "linear"); + if (mxStyle["draw:style"]) + pDrawGradientElement->addAttribute("draw:style", mxStyle["draw:style"]->getStr()); WPXString sValue; sValue.sprintf("Gradient_%i", miGradientIndex++); pDrawGradientElement->addAttribute("draw:name", sValue); // ODG angle unit is 0.1 degree - double angle = mxStyle["draw:angle"] ? -mxStyle["draw:angle"]->getDouble() : 0.0; + double angle = mxStyle["draw:angle"] ? mxStyle["draw:angle"]->getDouble() : 0.0; while(angle < 0) angle += 360; while(angle > 360) angle -= 360; - sValue.sprintf("%i", (unsigned)(angle*10)); pDrawGradientElement->addAttribute("draw:angle", sValue); - pDrawGradientElement->addAttribute("draw:start-color", mxGradient[0]["svg:stop-color"]->getStr().cstr()); - pDrawGradientElement->addAttribute("draw:end-color", mxGradient[1]["svg:stop-color"]->getStr().cstr()); - pDrawGradientElement->addAttribute("draw:start-intensity", "100%"); - pDrawGradientElement->addAttribute("draw:end-intensity", "100%"); - pDrawGradientElement->addAttribute("draw:border", "0%"); - mGraphicsGradientStyles.push_back(pDrawGradientElement); - mGraphicsGradientStyles.push_back(new TagCloseElement("draw:gradient")); + if (!mxGradient.count()) + { + if (mxStyle["draw:start-color"]) + pDrawGradientElement->addAttribute("draw:start-color", mxStyle["draw:start-color"]->getStr()); + if (mxStyle["draw:end-color"]) + pDrawGradientElement->addAttribute("draw:end-color", mxStyle["draw:end-color"]->getStr()); + + if (mxStyle["draw:border"]) + pDrawGradientElement->addAttribute("draw:border", mxStyle["draw:border"]->getStr()); + else + pDrawGradientElement->addAttribute("draw:border", "0%"); + + if (mxStyle["svg:cx"]) + pDrawGradientElement->addAttribute("draw:cx", mxStyle["svg:cx"]->getStr()); + else if (mxStyle["draw:cx"]) + pDrawGradientElement->addAttribute("draw:cx", mxStyle["draw:cx"]->getStr()); + + if (mxStyle["svg:cy"]) + pDrawGradientElement->addAttribute("draw:cy", mxStyle["svg:cy"]->getStr()); + else if (mxStyle["draw:cx"]) + pDrawGradientElement->addAttribute("draw:cx", mxStyle["svg:cx"]->getStr()); + + if (mxStyle["draw:start-intensity"]) + pDrawGradientElement->addAttribute("draw:start-intensity", mxStyle["draw:start-intensity"]->getStr()); + else + pDrawGradientElement->addAttribute("draw:start-intensity", "100%"); + + if (mxStyle["draw:border"]) + pDrawGradientElement->addAttribute("draw:end-intensity", mxStyle["draw:end-intensity"]->getStr()); + else + pDrawGradientElement->addAttribute("draw:end-intensity", "100%"); + + mGraphicsGradientStyles.push_back(pDrawGradientElement); + mGraphicsGradientStyles.push_back(new TagCloseElement("draw:gradient")); + } + else if(mxGradient.count() >= 2) + { + sValue.sprintf("%i", (unsigned)(angle*10)); + pDrawGradientElement->addAttribute("draw:angle", sValue); + + pDrawGradientElement->addAttribute("draw:start-color", mxGradient[1]["svg:stop-color"]->getStr()); + pDrawGradientElement->addAttribute("draw:end-color", mxGradient[0]["svg:stop-color"]->getStr()); + if (mxStyle["svg:cx"]) + pDrawGradientElement->addAttribute("draw:cx", mxStyle["svg:cx"]->getStr()); + if (mxStyle["svg:cy"]) + pDrawGradientElement->addAttribute("draw:cy", mxStyle["svg:cy"]->getStr()); + pDrawGradientElement->addAttribute("draw:start-intensity", "100%"); + pDrawGradientElement->addAttribute("draw:end-intensity", "100%"); + pDrawGradientElement->addAttribute("draw:border", "0%"); + mGraphicsGradientStyles.push_back(pDrawGradientElement); + mGraphicsGradientStyles.push_back(new TagCloseElement("draw:gradient")); + } } TagOpenElement *pStyleStyleElement = new TagOpenElement("style:style"); @@ -781,13 +1017,18 @@ void OdgGeneratorPrivate::_writeGraphicsStyle() TagOpenElement *pStyleGraphicsPropertiesElement = new TagOpenElement("style:graphic-properties"); - if(!(mxStyle["draw:stroke"] && mxStyle["draw:stroke"]->getStr() == "none") && mxStyle["svg:stroke-width"] && mxStyle["svg:stroke-width"]->getDouble() > 0.0) + if((mxStyle["draw:stroke"] && mxStyle["draw:stroke"]->getStr() == "none") || + (mxStyle["svg:stroke-width"] && mxStyle["svg:stroke-width"]->getDouble() == 0.0) || + (mxStyle["svg:stroke-color"] && mxStyle["svg:stroke-color"]->getStr() == "none")) + pStyleGraphicsPropertiesElement->addAttribute("draw:stroke", "none"); + else { if (mxStyle["svg:stroke-width"]) pStyleGraphicsPropertiesElement->addAttribute("svg:stroke-width", mxStyle["svg:stroke-width"]->getStr()); if (mxStyle["svg:stroke-color"]) pStyleGraphicsPropertiesElement->addAttribute("svg:stroke-color", mxStyle["svg:stroke-color"]->getStr()); + if (mxStyle["svg:stroke-opacity"] && mxStyle["svg:stroke-opacity"]->getDouble() != 1.0) pStyleGraphicsPropertiesElement->addAttribute("svg:stroke-opacity", mxStyle["svg:stroke-opacity"]->getStr()); @@ -803,11 +1044,12 @@ void OdgGeneratorPrivate::_writeGraphicsStyle() } #endif } - else - pStyleGraphicsPropertiesElement->addAttribute("draw:stroke", "none"); if(mxStyle["draw:fill"] && mxStyle["draw:fill"]->getStr() == "none") pStyleGraphicsPropertiesElement->addAttribute("draw:fill", "none"); + else + if (mxStyle["svg:fill-rule"]) + pStyleGraphicsPropertiesElement->addAttribute("svg:fill-rule", mxStyle["svg:fill-rule"]->getStr()); if(mxStyle["draw:fill"] && mxStyle["draw:fill"]->getStr() == "solid") { @@ -820,14 +1062,22 @@ void OdgGeneratorPrivate::_writeGraphicsStyle() if(mxStyle["draw:fill"] && mxStyle["draw:fill"]->getStr() == "gradient") { - if (mxGradient.count() >= 2) + if (!mxGradient.count() || mxGradient.count() >= 2) { pStyleGraphicsPropertiesElement->addAttribute("draw:fill", "gradient"); sValue.sprintf("Gradient_%i", miGradientIndex-1); pStyleGraphicsPropertiesElement->addAttribute("draw:fill-gradient-name", sValue); } else - pStyleGraphicsPropertiesElement->addAttribute("draw:fill", "none"); + { + if (mxGradient[0]["svg:stop-color"]) + { + pStyleGraphicsPropertiesElement->addAttribute("draw:fill", "solid"); + pStyleGraphicsPropertiesElement->addAttribute("draw:fill-color", mxGradient[0]["svg:stop-color"]->getStr()); + } + else + pStyleGraphicsPropertiesElement->addAttribute("draw:fill", "solid"); + } } mGraphicsAutomaticStyles.push_back(pStyleGraphicsPropertiesElement); diff --git a/writerperfect/source/vsdimp/visioimport_genericfilter.cxx b/writerperfect/source/vsdimp/visioimport_genericfilter.cxx index be152d1e33a9..ddc3f25fcb09 100644 --- a/writerperfect/source/vsdimp/visioimport_genericfilter.cxx +++ b/writerperfect/source/vsdimp/visioimport_genericfilter.cxx @@ -41,11 +41,6 @@ using namespace ::com::sun::star::registry; extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ ) { diff --git a/writerperfect/source/wpdimp/wpft_genericfilter.cxx b/writerperfect/source/wpdimp/wpft_genericfilter.cxx index 947c27f155a7..240707e796c8 100644 --- a/writerperfect/source/wpdimp/wpft_genericfilter.cxx +++ b/writerperfect/source/wpdimp/wpft_genericfilter.cxx @@ -40,13 +40,6 @@ using namespace ::com::sun::star::registry; extern "C" { -//================================================================================================== -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} -//================================================================================================== SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ ) { diff --git a/writerperfect/source/wpgimp/wpgimport_genericfilter.cxx b/writerperfect/source/wpgimp/wpgimport_genericfilter.cxx index c453a9c10dc9..4a7f97a0dd1a 100644 --- a/writerperfect/source/wpgimp/wpgimport_genericfilter.cxx +++ b/writerperfect/source/wpgimp/wpgimport_genericfilter.cxx @@ -41,11 +41,6 @@ using namespace ::com::sun::star::registry; extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ ) { diff --git a/writerperfect/source/wpsimp/msworks_genericfilter.cxx b/writerperfect/source/wpsimp/msworks_genericfilter.cxx index 2213c0c52f8b..87dc407c9a81 100644 --- a/writerperfect/source/wpsimp/msworks_genericfilter.cxx +++ b/writerperfect/source/wpsimp/msworks_genericfilter.cxx @@ -41,11 +41,6 @@ using namespace ::com::sun::star::registry; extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ ) { diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/DefColWidth.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/DefColWidth.java index b6b3baace2de..927f98ee71b0 100644 --- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/DefColWidth.java +++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/DefColWidth.java @@ -36,7 +36,7 @@ import org.openoffice.xmerge.util.EndianConverter; import org.openoffice.xmerge.converter.xml.sxc.pexcel.PocketExcelConstants; /** - * Represents a BIFF record defiuning the defualt column width + * Represents a BIFF record defining the default column width */ public class DefColWidth implements BIFFRecord { diff --git a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/ExtendedFormat.java b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/ExtendedFormat.java index 2ae615dc93ce..bc78f566be8f 100644 --- a/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/ExtendedFormat.java +++ b/xmerge/source/pexcel/java/org/openoffice/xmerge/converter/xml/sxc/pexcel/records/ExtendedFormat.java @@ -88,7 +88,7 @@ org.openoffice.xmerge.converter.xml.OfficeConstants { } /** - * Constructs a pocket Excel Document using defualt values and sets the + * Constructs a pocket Excel Document using default values and sets the * font index using the specified attribute * * @param ixfnt index of the font this format should use diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/ColourConverter.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/ColourConverter.java index d0fed6d39ce0..08954fa81a50 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/ColourConverter.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/ColourConverter.java @@ -34,7 +34,7 @@ import java.awt.Color; * Utility class mapping RGB colour specifications to the colour indices used * in the Pocket PC. The original converter was written for use with Pocket * Word it was later put into the utils so Pocket excel could use this code - * also. For this reason the defualt values are those used by Pocket Word but + * also. For this reason the default values are those used by Pocket Word but * a colour table can be passed in through the constructor to map the 16 * values to a colour table. * |